Re: [csswg-drafts] Backslash & Yen sign behavior (#6848)

The CSS Working Group just discussed `Backslash and Yen`.

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> Topic: Backslash and Yen<br>
&lt;TabAtkins> github: https://github.com/w3c/csswg-drafts/issues/6848<br>
&lt;TabAtkins> fantasai: WebKit has a bunch of code to handle this problem - the backslash is often rendered as a Yen sign, especially on Windows systems, for historical reasons<br>
&lt;addison> (or a won sign or a yuan sign; special handling is on non-Windows OS)<br>
&lt;TabAtkins> fantasai: The special handling in WK is they check if they have one fo the "known problematic fonts" or if the encoding is one of the "known problematic encodings", they'll render the backslash as Yen, kinda like a text-transform.<br>
&lt;TabAtkins> fantasai: So for the WG, do we want a heuristic for this like the WK stuff, or do we want to ask them to ignore it?<br>
&lt;TabAtkins> fantasai: Currently text rendered on Windows doesn't look like other OSes, because the Yen characters appear on Windows and not elsewhere.<br>
&lt;TabAtkins> addison: One issue is that it's an expectation of some speakes that the path separate is actually a Yen<br>
&lt;TabAtkins> addison: So actually showing backslash might not be expected by the user.<br>
&lt;florian> q+<br>
&lt;TabAtkins> florian: bc this is a strong expectation in japan/korea, at least, that the backslash doesn't look liekt he backslash, authors will continue author this way, and if it works inconsistently based on the system that's not good. I think we should try for interop.<br>
&lt;TabAtkins> florian: Reason it works on Windows is the fonts; if you don't ahve the right font it won't happen<br>
&lt;addison> s/liekt/like/<br>
&lt;emilio> q+<br>
&lt;TabAtkins> florian: So the font heuristics shoudl probably be standardized<br>
&lt;TabAtkins> florian: On top of that, I think authors should be able to control this more directly.<br>
&lt;drott> q+<br>
&lt;TabAtkins> florian: An @font-face descriptor that lets them say what this font is doing wrt backslash or yen<br>
&lt;TabAtkins> florian: Otherwise pages authored on windows will look different on Mac or Android, etc.<br>
&lt;TabAtkins> florian: So we should aim for interop on at least the heuristics.<br>
&lt;hober> q+<br>
&lt;TabAtkins> florian: And likely go byeond to let authors specify.<br>
&lt;astearns> ack emilio<br>
&lt;TabAtkins> emilio: The compat issue on Mac comes from authros not specifying a font-name, or specifying a font that doesn't exist?<br>
&lt;TabAtkins> addison: The last one.<br>
&lt;TabAtkins> emilio: In taht case, can that font be shipped on Mac?<br>
&lt;addison> I believe locales for JP, KR, TW, and CN regions do this<br>
&lt;TabAtkins> florian: And Android, and Linux...<br>
&lt;TabAtkins> emilio: These kinds of heuristics don't seem terribly appealing to implement... I'd rather not have them, especially if it works on windows due to fonts<br>
&lt;David-Clarke> s/authros/authors/<br>
&lt;addison> This is rooted in DOS code page behavior<br>
&lt;TabAtkins> myles: there's no way we can ship this font on iOS or Mac, that options is off the table<br>
&lt;TabAtkins> emilio: can you explain why?<br>
&lt;florian> q?<br>
&lt;astearns> ack drott<br>
&lt;TabAtkins> hober: fonts are expensive; this would have to be a business arrangement, and the spec probably shoudlnt' rely on that existing for all OSes<br>
&lt;TabAtkins> drott: Can we discuss what th eheuristic would look like? Is it like "this window font as the primary in the font stack"?<br>
&lt;fantasai> WebKit heuristic is described here: https://github.com/w3c/csswg-drafts/issues/6848#issue-1067848361<br>
&lt;florian> q+<br>
&lt;TabAtkins> drott: And second to emilio, I don't think I'd like to carry this legacy issue further by putting it into @font-face<br>
&lt;emilio> +1<br>
&lt;TabAtkins> drott: So probably fint with a heuristic but not futher<br>
&lt;TabAtkins> fantasai: Heuristic is "problematic font? problematic encoding? yes to either, render backslash as yen"<br>
&lt;TabAtkins> iank_: What does "render" mean?<br>
&lt;TabAtkins> fantasai: Do a text-transform, basically.<br>
&lt;TabAtkins> myles: And this is a whole-element thing, looking at primary font, not a glyph-by-glyph sub.<br>
&lt;TabAtkins> drott: So primary font of the element, ok.<br>
&lt;David-Clarke> q+<br>
&lt;TabAtkins> fantasai: So just checking, you're looking at computed 'font-family' and looking at the first font in the list?<br>
&lt;TabAtkins> myles: Probably, yes, I'll need to check.<br>
&lt;TabAtkins> myles: Also this code is older than the Blink fork. But this behavior doesn't happen in Mac Chrome, so presuambly it was deleted?<br>
&lt;TabAtkins> iank_: I'd have to dig into the history, yeah<br>
&lt;JakeA> q+<br>
&lt;TabAtkins> myles: grep for "yen sign" in the webkit codebase to find it in ours<br>
&lt;astearns> ack hober<br>
&lt;David-Clarke> q-<br>
&lt;emilio> https://searchfox.org/wubkat/rev/0c40ba62b482511fe03646f1d4982efd727475dd/Source/WebCore/rendering/RenderText.cpp#1345-1346<br>
&lt;emilio> iank_: ^<br>
&lt;TabAtkins> hober: Sometimes we need heuristics for compat reasons, but that makes me nervous<br>
&lt;TabAtkins> hober: So one, heuristic should be as simple as possible.<br>
&lt;TabAtkins> hober: And two, spec is as a floor; this is the minimum for compat, but you might do better, and hopefully bring it to the group to specify.<br>
&lt;astearns> ack florian<br>
&lt;andreubotella> q+<br>
&lt;TabAtkins> florian: I'd like to push back against this as legacy. It's a compat problem, but it's not rooted in the past; it's the current expectation for Korea and Japan users<br>
&lt;TabAtkins> florian: I don't think a German user wants their path filled with Yen signs, so it's not spreading.<br>
&lt;drott> q+<br>
&lt;TabAtkins> florian: The primary offender is Windows system fonts, but Japanese fonts are often *written* this way.<br>
&lt;emilio> https://searchfox.org/wubkat/rev/0c40ba62b482511fe03646f1d4982efd727475dd/Source/WebCore/platform/graphics/FontCache.cpp#457 is the font-family check<br>
&lt;TabAtkins> florian: So if your primary font is one of these manually-authored fonts, but it didn't download, you'll have this problem again.<br>
&lt;dholbert> q+<br>
&lt;TabAtkins> florian: So that's why my suggestion for @font-face exists, so authors can tell us what their font expects and we can do the right thing just like if it was a windows system font.<br>
&lt;florian> q?<br>
&lt;TabAtkins> myles: Right now there are zero browsers that do this on a font-by-font basis; putting it in @font-face would mean we have to invent a new mechanism<br>
&lt;astearns> zakim, close queue<br>
&lt;Zakim> ok, astearns, the speaker queue is closed<br>
&lt;drott> q-<br>
&lt;JakeA> q-<br>
&lt;TabAtkins> florian: I don't see why that would be required - the descriptor would just tell you whether the font is one that needs the transform<br>
&lt;TabAtkins> (I assume this would just cause the font to trip the "problematic font?" part of the heuristic.)<br>
&lt;astearns> ack andreubotella<br>
&lt;TabAtkins> andreubotella: What happens on Windows if you copy text with this behavior?<br>
&lt;TabAtkins> addison: They'll copy a backspace, that's the acutal character<br>
&lt;TabAtkins> andreubotella: Is that what authors expect?<br>
&lt;TabAtkins> addison: They'll see it as a Yen when they paste, as well. The only difference will be if they put it in a message and send it elsewhere.<br>
&lt;TabAtkins> JakeA: Note that text-transfo9rm doesn't usually do that; it typically changes what you copy<br>
&lt;TabAtkins> fantasai: For some values; for other values (like fullsize-kana) you do *not* copy the transformed version of the text.<br>
&lt;astearns> ack dholbert<br>
&lt;addison> s/They'll/Windows users will/<br>
&lt;iank_> Our bug relating to this: https://bugs.chromium.org/p/chromium/issues/detail?id=305827<br>
&lt;fantasai> And I would argue that text-transform should never copy out the transformed text<br>
&lt;TabAtkins> dholbert: Does the text-transform handle the scenario where the font has a backslash but not a yen character?<br>
&lt;TabAtkins> myles: We don't handle that; rather, I don't know what happens, but we don't seem to do anything special.<br>
&lt;drott> q+<br>
&lt;addison> Not just yen sign... sometimes the won sign (in Korea)<br>
&lt;TabAtkins> dholbert: So possibly rendering tofu rather than slash<br>
&lt;drott> q?<br>
&lt;drott> q-<br>
&lt;TabAtkins> myles: Probably just doing a fallback, like text-transform:uppercase on a font with only lowercase will trigger fallback<br>
&lt;emilio> Gecko also implemented this hack and removed it: https://bugzilla.mozilla.org/show_bug.cgi?id=926580<br>
&lt;TabAtkins> drott: I foudn the Chrome bug to remove the hack<br>
&lt;addison> s/foudn/found/<br>
&lt;TabAtkins> drott: There was some question of whether content was being created expecting this, and if we could phase it out<br>
&lt;David-Clarke> All the fonts and encodings shown in the example are Japanese, but this affects Korean?<br>
&lt;TabAtkins> astearns: Seems the answer is yes, and no.<br>
&lt;TabAtkins> florian: When Windows reaches 0 market share...<br>
&lt;TabAtkins> myles: I asked another group earlier this week - in Japanese keyboards, is there separate backslash and Yen keys? If not, what keycode comes out?<br>
&lt;TabAtkins> florian: Think the answer is "depends on the keyboard"<br>
&lt;TabAtkins> astearns: Probalby enough discussion - is there appetite from gecko and blink to specify a simple heuristic and implement it?<br>
&lt;TabAtkins> iank_: I think the problem is... i'm looking at the patch that removed this, and it's a lot bigger than a text-transform.<br>
&lt;TabAtkins> iank_: Appears to be special code...<br>
&lt;TabAtkins> astearns: Re: tess's point, the rule should be simple and you should implement it as you want.<br>
&lt;TabAtkins> chris: the backing store is a backslash<br>
&lt;TabAtkins> fantasai: I'd said before it depends on the transform<br>
&lt;TabAtkins> myles: from a user perspective it looks like a Yen, so they'd expect a Yen<br>
&lt;addison> (if you paste into a cmd shell, you want the path separator to be a path separotr)<br>
&lt;TabAtkins> florian: Unsure that's true, to the user it's a path separator, and that's a specific codepoint<br>
&lt;TabAtkins> emilio: I'd want to check with jfkthame and the Japanese folks<br>
&lt;TabAtkins> emilio: But given we removed this a while ago, I don't think so. We could reconsider, I guess.<br>
&lt;TabAtkins> drott: The previous patch didn't seem to be text-transform based<br>
&lt;TabAtkins> ACTION drott to investigate for Chrome<br>
&lt;TabAtkins> ACTION emilio to investigate for Firefox<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6848#issuecomment-1249645495 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 16 September 2022 17:54:29 UTC