-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FreeType <= 2.6.1 on OSM rendering server causes Noto CJK too much bold #2402
Comments
I think it wood be a good idea to find out what exactly causes the boldness of this font. I don't think it is caused by the weight of the font.
and in #2349 (comment) @pnorman wrote
Apparently both of them were able to render Noto Sans CJK without excessive boldness. It would be useful to know which versions of the font they installed. My guess is that the hinted / unhinted versions of the font could explain the difference, but this has to be tested. |
Unfortounally, I’m currently busy with other stuff, so I can’t investigate further on this. However, to generate the screenshot at #2349 (comment) I was using the package that comes with openSUSE Leap 42: noto-sans-cjkjp - Noto CJKjp Sans Serif Font Version: /usr/share/fonts/truetype/NotoSansCJKjp-Black.otf |
Thanks. Since you used the otf version, a possibility is that the OTF versus TTC versions of the font could explain the non-bold / bold difference. |
One was Ubuntu 14.04 packaged, the other was the latest version of Noto from git. Both should have used hinted if available. |
I have further investigated the issue. I have compared the TTC and OTF versions of the font, and both render the same (too bold in my year-old version of Kosmtik). There are no unhinted versions of the CJK fonts as far as I can see, only hinted ones (even Google's Noto-unhinted.zip contains hinted CJK fonts). So the fonts are not the problem. Instead, it appears the problem is caused by the FreeType rasterizer that Mapnik uses. Some background: OpenType fonts come in two flavors: TrueType-based, with extension ttf, and PostScript-based (also called CFF), with extension otf. All Noto fonts are TrueType except the CJK fonts, which are CFF. That is why we are seeing the boldness problem only with the CJK font and not with the other scripts. In June 2013, FreeType 2.5 switched to Adobe's engine for rendering CFF fonts. This engine contains a feature called "stem darkening" which makes fonts thicker at small sizes. Many users found that this feature makes fonts much too dark, which is caused by incorrect gamma correction. For this reason, stem darkening was switched off in FreeType 2.6.2, released on 28 Nov 2015. This then is the reason for the too bold fonts: when a version of FreeType from 2.5 to 2.6.1 is used, which have stem darkening turned on. For those using Kosmtik, node-mapnik was upgraded from FreeType 2.6.1 to 2.6.5 on 9 Sep 2016 with node-mapnik 3.5.14. I have just installed a fresh copy of Kosmtik with node-mapnik 3.5.14 and verified that the CJK fonts look OK there. On the rendering servers, which use Ubuntu 16.04.1 LTS, the installed version of FreeType is probably the packaged version which is 2.6.1 and has the stem darkening turned on. So to solve the problem on those servers, installing a newer version of FreeType would probably be sufficient. |
Sounds very much like the horrible "Enhance thin lines" option Adobe made default for Adobe Reader, and that ruins elegant (cartographic) designs with thin lines when displayed in its default ON status by making them bolder and over-emphasizing them: |
I had initially doubted this could explain it since I had a less bold rendering with Noto when I used fonts from git, but I realized that I was probably getting Unifont there. |
Thanks for investigtion. I have changed the title. |
Unfortunately it seems no official backports of FreeType available for Ubuntu Xenial.
|
yakkety has 2.6.3, so I'd prefer a backport over backporting ourself with a PPA. Unfortunately libfreetype6 has a huge reverse depends list including some core components so I don't think this is practical.
That might be the best option. |
@vholten Thanks for your investigative work and the detailed description! |
Simply converts to (OpenType) TTF does not work, I am trying |
I would advise against this. TTF and CFF are fundamentally different formats and the conversion is not lossless. In particular, we would probably lose all hinting. There is a reason that the CJK fonts were only released as CFF. As explained in notofonts/noto-fonts#249,
If installing a more recent version of FreeType on the rendering servers is not practical, there is another solution. The "stem darkening" feature can be turned off in all versions of FreeType, including 2.6.1. This is done using the FT_Property_Set function as described at https://www.freetype.org/freetype2/docs/reference/ft2-cff_driver.html#no-stem-darkening(cff) . If that is also not possible, maybe the FreeType 2.6.1 package could be rebuilt from source, changing the line |
It is 3AM in Taiwan now, so I have to sleep. I will try to patch Mapnik tomorrow to see the result. 🌙 |
I tried setting Neither patching FreeType nor Mapnik is within the scope of what we can do here. I'm revising #2409 to remove the mention of converting the CJK fonts. |
This may cause some confusion for tile designer, but I think it is the best way for everyone. |
Wait, I am wrong, maybe Stem darkening is too much bold that changing the font weight will not be so effective. |
I have tried to install FreeType 2.7 PPA from here, which overrides But I don't know what else can happen if just upgrade the And it seems I cannot request backport for freetype as Ubuntu Yakkety is not yet released. |
Operations is trying it in the PPA. The problem with doing an official backport is that we'd need to test the rdepends packages |
I still hope we can solve this by updating FreeType, but if not, here are renders of CJK Thin, Light, DemiLight, and Regular, with an old version of FreeType: Thin works quite well. However, if we use it, the font will look OK on the rendering servers but not on systems with a recent FreeType. |
Great! I thank the operations team for their quick response. |
Yes - backport is in our PPA at https://launchpad.net/~osmadmins/+archive/ubuntu/ppa and has been installed on all three servers and renderd restarted. |
Huge thanks!! I have checked the rendering, all goes well. :) |
@tomhughes Thanks a lot for the quick solution! |
#2349, #2391 Followup.
As the patch that enabled Noto CJK on Standard layer is up, I wrote this issue.
Take Tokyo, Japan for example, you can see the CJK fonts is way too bold compared to ref numbers:
IMHO we can use lighter variant of Noto CJK for both regular and bold font.
My personal suggestion:
The following is a screenshot I made to compare the font weight:

But actual Mapnik rendering may be compared too. Can someone do it in Tokyo, Seoul and Taipei?
The text was updated successfully, but these errors were encountered: