Bug 107462 - MS Gothic and MS Mincho text rendered differently at different zoom levels
Summary: MS Gothic and MS Mincho text rendered differently at different zoom levels
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.7.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering CJK
  Show dependency treegraph
 
Reported: 2017-04-26 22:10 UTC by Yousuf Philips (jay) (retired)
Modified: 2017-04-28 18:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
sample (10.58 KB, application/wps-office.docx)
2017-04-26 22:10 UTC, Yousuf Philips (jay) (retired)
Details
150 and 170 zoom levels (19.90 KB, image/png)
2017-04-26 22:10 UTC, Yousuf Philips (jay) (retired)
Details
font name toolbar control (9.62 KB, image/png)
2017-04-26 22:12 UTC, Yousuf Philips (jay) (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2017-04-26 22:10:07 UTC
Created attachment 132877 [details]
sample

Steps:
1) Install MS Gothic and MS Mincho fonts if not already installed
2) Open the attached document
3) Document opens at 150% and the fonts render like another font
4) Click each line and notice that in the font name drop down, it shows the font names in italics (what happens when fonts are substituted)
5) Zoom to 170% and they will render correctly

Version: 5.4.0.0.alpha0+
Build ID: f0340e3dca1091accdb71e0c566b96cdf9e0f791
CPU threads: 2; OS: Linux 4.4; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-04-21_13:34:48
Locale: en-US (en_US.UTF-8); Calc: group

The problem in the font name drop down is it is displaying the alternative name for the font rather than the english name.
Comment 1 Yousuf Philips (jay) (retired) 2017-04-26 22:10:46 UTC
Created attachment 132878 [details]
150 and 170 zoom levels
Comment 2 Yousuf Philips (jay) (retired) 2017-04-26 22:12:04 UTC
Created attachment 132879 [details]
font name toolbar control
Comment 3 ⁨خالد حسني⁩ 2017-04-27 01:52:22 UTC
The different rendering is properly is how the fonts are set up in the “gasp” table which specifies the anti-aliasing behavior for given pixel sizes. CJK fonts typically prefer string hinting and no anti-aliasing at smaller pixel sizes. Anyway, I think it is just DirectWrite doing its magic since I don’t recall us fiddling with anti-aliasing settings.

Not displaying the English name if the font do not have a localized name for the current locale is an independent issue and should be reported separately.

Marking the font as being substituted when localized name is used in a different locale is also an independent issue and should be reported separately.
Comment 4 Yousuf Philips (jay) (retired) 2017-04-27 14:17:19 UTC
(In reply to Khaled Hosny from comment #3)
> The different rendering is properly is how the fonts are set up in the
> “gasp” table which specifies the anti-aliasing behavior for given pixel
> sizes. CJK fonts typically prefer string hinting and no anti-aliasing at
> smaller pixel sizes. Anyway, I think it is just DirectWrite doing its magic
> since I don’t recall us fiddling with anti-aliasing settings.

Not sure how DirectWrite is involved as i'm running Linux.

> Not displaying the English name if the font do not have a localized name for
> the current locale is an independent issue and should be reported separately.

Done. Bug 107485. But i'm a bit confused why it should show a localized name at all, as when you open up the font name drop down, it always shows the english name in the left column and i would assume the user cant type the localized name of the font in the drop down to locate it.

> Marking the font as being substituted when localized name is used in a
> different locale is also an independent issue and should be reported
> separately.

Done. Bug 107484
Comment 5 ⁨خالد حسني⁩ 2017-04-27 15:28:33 UTC
(In reply to Yousuf Philips (jay) from comment #4)
> (In reply to Khaled Hosny from comment #3)
> > The different rendering is properly is how the fonts are set up in the
> > “gasp” table which specifies the anti-aliasing behavior for given pixel
> > sizes. CJK fonts typically prefer string hinting and no anti-aliasing at
> > smaller pixel sizes. Anyway, I think it is just DirectWrite doing its magic
> > since I don’t recall us fiddling with anti-aliasing settings.
> 
> Not sure how DirectWrite is involved as i'm running Linux.

I see. Then I suspect the fonts has embedded bitmap strikes for certain pixel sizes (many CJK fonts do) and that is what you are getting at lower sizes. Try to disabled embedded bitmaps in FontConfig and see if it makes any difference (the simplist way is to copy/link /etc/fonts/conf.avail/70-no-bitmaps.conf to /etc/fonts/conf.d/70-no-bitmaps.conf and restart LibreOffice).

> > Not displaying the English name if the font do not have a localized name for
> > the current locale is an independent issue and should be reported separately.
> 
> Done. Bug 107485. But i'm a bit confused why it should show a localized name
> at all, as when you open up the font name drop down, it always shows the
> english name in the left column and i would assume the user cant type the
> localized name of the font in the drop down to locate it.

Since you are on Linux, that is the only platform where we try to read all localized font names and set them internally as alternate names (so that specifying the font by its localized name works), but probably this code is too naïve and things got mixed up.
Comment 6 Adolfo Jayme Barrientos 2017-04-27 16:59:54 UTC
Khaled is right, Fontconfig in Ubuntu/Linux Mint/etc. is set by default to read any embedded bitmaps in fonts. I always disable that behavior. See also https://ask.libreoffice.org/en/question/7127/calibri-font-not-rendering-correctly/?answer=8124#post-id-8124
Comment 7 Yousuf Philips (jay) (retired) 2017-04-28 11:49:33 UTC
(In reply to Khaled Hosny from comment #5)
> I see. Then I suspect the fonts has embedded bitmap strikes for certain
> pixel sizes (many CJK fonts do) and that is what you are getting at lower
> sizes. Try to disabled embedded bitmaps in FontConfig and see if it makes
> any difference (the simplist way is to copy/link
> /etc/fonts/conf.avail/70-no-bitmaps.conf to
> /etc/fonts/conf.d/70-no-bitmaps.conf and restart LibreOffice).

As harfbuzz is doing all the text rendering now, cant we set it to disable that feature on linux by default so others dont fall into this same trap and have to manually fix it at the system level.

> Since you are on Linux, that is the only platform where we try to read all
> localized font names and set them internally as alternate names (so that
> specifying the font by its localized name works), but probably this code is
> too naïve and things got mixed up.

Thanks for the info, i've added it to the bug report.
Comment 8 ⁨خالد حسني⁩ 2017-04-28 18:05:35 UTC
(In reply to Yousuf Philips (jay) from comment #7)
> (In reply to Khaled Hosny from comment #5)
> > I see. Then I suspect the fonts has embedded bitmap strikes for certain
> > pixel sizes (many CJK fonts do) and that is what you are getting at lower
> > sizes. Try to disabled embedded bitmaps in FontConfig and see if it makes
> > any difference (the simplist way is to copy/link
> > /etc/fonts/conf.avail/70-no-bitmaps.conf to
> > /etc/fonts/conf.d/70-no-bitmaps.conf and restart LibreOffice).
> 
> As harfbuzz is doing all the text rendering now, cant we set it to disable
> that feature on linux by default so others dont fall into this same trap and
> have to manually fix it at the system level.

HarfBuzz is doing text layout not rendering, we still use different libraries to do rendering on different platforms. Also embedded bitmaps are a feature not a bug, (some) CJK users expect it as improves rendering of CJK glyphs at smaller point sizes.