Closed Bug 1351332 Opened 7 years ago Closed 7 years ago

Needs hack for Meiryo to render italic/oblique style

Categories

(Core :: Layout: Text and Fonts, enhancement)

All
Windows
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

Meiryo, Japanese font of Windows, is odd font. It has same glyph for both normal style and italic/oblique style because MS claims that italic/oblique style isn't in Japanese culture.  However, this is really problem if we take it as default font and web pages use <em>/<i> etc.

If we specify:

> @font-face {
>   font-family: "Meiryo";
>   src: local("Meiryo");
>   font-weight: normal;
> }
> @font-face {
>   font-family: "Meiryo";
>   src: local("Meiryo Bold");
>   font-weight: bold;
> }
> @font-face {
>   font-family: "\30E1 \30A4 \30EA \30AA"; /* メイリオ */
>   src: local("Meiryo");
>   font-weight: normal;
> }
> @font-face {
>   font-family: "\30E1 \30A4 \30EA \30AA"; /* メイリオ */
>   src: local("Meiryo Bold");
>   font-weight: bold;
> }

we see forcibly tilted characters, see following test cases on Windows:

testcases without hack:
https://jsfiddle.net/d_toybox/8vsv97k6/
https://jsfiddle.net/d_toybox/8vsv97k6/2/

testcases with hack:
https://jsfiddle.net/d_toybox/8vsv97k6/4/
https://jsfiddle.net/d_toybox/8vsv97k6/3/

So, we should take this hack with ua.css or hard coded hack in gfx.

Any ideas?
Note that on Windows 10, you need to install Japanese language pack of Windows for Meiryo. IIRC, Win7 and Win8.1 has Meiryo even without Japanese language pack.
Maybe we should also specify unicode-range so that latin characters in Meiryo can use the real italic glyphs instead of simulated ones.
(In reply to Masayuki Nakano [:masayuki] from comment #3)
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=5db86447e26d01e1dc99c889d4a8806a04672c8e

Hmm, adding @font-face to ua.css causes a lot of assertions...
(In reply to Masatoshi Kimura [:emk] from comment #2)
> Maybe we should also specify unicode-range so that latin characters in
> Meiryo can use the real italic glyphs instead of simulated ones.

Hmm, I don't like to do that because:
1. It requires a lot of time to investigate which glyph should be included/excluded...
2. I worry about the performance to use unicode-range (and also @font-face too).
If we use @font-face hack, looks like that it's stored at every document. So, perhaps, we shouldn't use it. Additionally, I see odd rendering result changes on non-Windows platforms. So, using it really risky.
(In reply to Masayuki Nakano [:masayuki] from comment #7)
> If we use @font-face hack, looks like that it's stored at every document.
> So, perhaps, we shouldn't use it.

Yes, I presented the @font-face hack only for demonstration purpose. We should make some C++ changes if we fix this bug.

> Additionally, I see odd rendering result
> changes on non-Windows platforms. So, using it really risky.

Isn't it a bug itself? Meiryo is unavailable on other platforms, so any rendering changes should not happen.
(In reply to Masatoshi Kimura [:emk] from comment #8)
> (In reply to Masayuki Nakano [:masayuki] from comment #7)
> > Additionally, I see odd rendering result
> > changes on non-Windows platforms. So, using it really risky.
> 
> Isn't it a bug itself? Meiryo is unavailable on other platforms, so any
> rendering changes should not happen.

Yeah, probably so but I don't have much time to investigate it for now.

My current patches being tested on tryserver ignore italic style Meiryo faces at creating font list on Windows.
How does Meiryo behave in IE/Edge? In general, I'd be a bit reluctant to add special-case code that is basically working around a design decision from the platform.
(In reply to Jonathan Kew (:jfkthame) from comment #10)
> How does Meiryo behave in IE/Edge?

On the other browsers, they are not rendered as italic/oblique (i.e., rendered as "font-style: normal;"). However, neither IE nor Edge uses Meiryo as default Japanese font.

> In general, I'd be a bit reluctant to add
> special-case code that is basically working around a design decision from
> the platform.

I agree with that. However, Meiryo developers designed the font as so intentionally. However, some designers complain about that (I googled "Meiryo Italic" in Japanese). So, this is the most risky point at switching Japanese default font to Meiryo. If web sites use <em>, <i>, font-style: italic; and font-style: oblique, user will not be able to distinguish such element and the others in Japanese text.

If we could "Yu Gothic", which is available Win8 and later, it's better if there is no rendering trouble I asked you at bug 548311 comment 21. ("Yu Gothic" and "Yu Mincho" have italic style, even though they're newer Windows' default font.)
Comment on attachment 8852534 [details]
Bug 1351332 gfxDWriteFontList and gfxGDIFontList should ignore italic face of Meiryo for using synthetic italic style

https://reviewboard.mozilla.org/r/124720/#review128450
Attachment #8852534 - Flags: review?(jfkthame) → review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/b2cbd8ef4c84
gfxDWriteFontList and gfxGDIFontList should ignore italic face of Meiryo for using synthetic italic style r=jfkthame
https://hg.mozilla.org/mozilla-central/rev/b2cbd8ef4c84
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: