Open Bug 1790564 Opened 2 years ago Updated 10 months ago

Prevent Anti-Aliasing of Embedded Bitmap Fonts on Linux

Categories

(Core :: Graphics: Text, defect)

Firefox 104
defect

Tracking

()

UNCONFIRMED

People

(Reporter: zhangboyang.id, Unassigned)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

  1. Install the 'WenQuanYi Zen Hei Sharp' font. On debian/ubuntu, the commandline is apt install fonts-wqy-zenhei

  2. Please test this page
    <pre style="font-family: 'WenQuanYi Zen Hei Sharp'; font-size: 16px">HelloWorld ABCDEFG 1234567 16px</pre>
    <pre style="font-family: 'WenQuanYi Zen Hei Sharp'; font-size: 15.5px">HelloWorld ABCDEFG 1234567 15.5px</pre>
    <pre style="font-family: 'WenQuanYi Zen Hei Sharp'; font-size: 15px">HelloWorld ABCDEFG 1234567 15px</pre>

Actual results:

The line in the middle (15.5px) is blurry. It seems the bitmap glyph is scaled.

Expected results:

The line in the middle (15.5px) should fallback to nearest font-size and be pixel perfect.

This bug also affects the UI of firefox. The text on UI is blurry, too. This problem doesn't exist in the old gfx.xrender.

The 'WenQuanYi Zen Hei Sharp' is a scalable font with embedded bitmaps. Similar fonts like 'SimSun', 'MS Gothic' is also affected.

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core

The severity field is not set for this bug.
:dholbert, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dholbert)

So, if it's a scalable font, but with embedded bitmaps, disabling embedded bitmaps at system-level may just resolve this.
This confers the advantage of not falling back to nearest sizes (Which I imagine we did, instead of scaling and then anti-aliasing) as well.

Flags: needinfo?(zhangboyang.id)

(In reply to David Shin[:dshin] from comment #6)

So, if it's a scalable font, but with embedded bitmaps, disabling embedded bitmaps at system-level may just resolve this.
This confers the advantage of not falling back to nearest sizes (Which I imagine we did, instead of scaling and then anti-aliasing) as well.

Thanks for replying. Disabling bitmap fonts can be a workaround to this problem, but there are many people prefer bitmap fonts, especially for East-Asian scripts, because East-Asian characters are complex and bitmap fonts can improve readability greatly. So I think we'd better fix the problem.

I tested the same font on Firefox/Windows, and it doesn't have the problem. Old Firefox/Linux versions using xrender also doesn't have this problem. It seems only Firefox/Linux (with WebRenderer) is affected. (macOS is not tested, though)

On the other hand, Chrome/Linux and Chrome/Windows also don't have this problem.

Flags: needinfo?(zhangboyang.id)

[...] especially for East-Asian scripts, because East-Asian characters are complex and bitmap fonts can improve readability greatly. [...]

Haven't thought of that - thanks. Confirmed the rounding behaviour on Windows.

Component: Layout: Text and Fonts → Graphics: Text
Summary: Bitmap font is scaled and blurry → Prevent Anti-Aliasing of Embedded Bitmap Fonts on Linux
Flags: needinfo?(dholbert)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: