New issue
Advanced search Search tips

Issue 649362 link

Starred by 13 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Feature

Blocked on:
issue skia:6165



Sign in to add a comment

FREETYPE_PROPERTIES is ignored

Reported by ju.o...@gmail.com, Sep 22 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

Example URL:
n/a

Steps to reproduce the problem:
Start chromium with the FREETYPE_PROPERTIES environment variable set to a non-default value.

What is the expected behavior?
Chromium preserves this environment variable to ensure consistent font rendering.

What went wrong?
* FREETYPE_PROPERTIES is not present in /proc/$(pidof chromium)/environ.
* FREETYPE_PROPERTIES is not applied to freetype font rendering.
* Font rendering in chromium is not consistent with the rest of the system.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 53.0.2785.116  Channel: stable
OS Version: 
Flash Version: Shockwave Flash 22.0 r0
 

Comment 1 by daro...@gmail.com, Sep 23 2016

I can confirm this behavior, using chromium v53.0.2785.116 and freetype v2.7 (on Arch Linux).

Comment 2 by kojii@chromium.org, Sep 26 2016

Cc: drott@chromium.org kojii@chromium.org e...@chromium.org
Components: -Blink Blink>Fonts
Status: Untriaged (was: Unconfirmed)
Happen to know if this is supposed to work?

Comment 3 by drott@chromium.org, Sep 26 2016

Status: WontFix (was: Untriaged)
Out of curiosity, ju.orth, would you have an example string of what this variable was set, too? 

However, I am closing this as WontFix, this is a not a way of configuring our rendering path that we currently support.

Comment 4 by ju.o...@gmail.com, Sep 26 2016

>this is a not a way of configuring our rendering path that we currently support

I don't understand what you mean by this. FREETYPE_PROPERTIES affects the freetype library only. Chromium does not have to do anything besides not clearing the environment variables. It seems completely arbitrary that chromium allows me to change the behavior of fontconfig, which is configured via configuration files, but not the behavior of freetype, which is configured via environment variables.

>Out of curiosity, ju.orth, would you have an example string of what this variable was set, too? 

----
~$ cat /etc/profile.d/freetype2.sh 
# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
# version. The available settings are:
#
#     truetype:interpreter-version=35  # Classic mode (default in 2.6)
#     truetype:interpreter-version=38  # Infinality mode
#     truetype:interpreter-version=40  # Minimal mode (default in 2.7)
#
# There are more properties that can be set, separated by whitespace. Please
# refer to the FreeType documentation for details.

# Uncomment and configure below
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"
----

Comment 5 by drott@chromium.org, Sep 26 2016

Thanks for the details. I believe the security sandbox of the renderer process shields it from access to environment variables (haven't verified this). This is why this variable does not have any effect on FreeType's hinting mode.

Comment 6 by ju.o...@gmail.com, Sep 26 2016

I've filed a bug with freetype to allow the configuration via files: https://savannah.nongnu.org/bugs/index.php?49187
I consider it a *very* bad idea that the FREETYPE_PROPERTIES environment variable gets ignored.  The transition from v35 to v40 TTF rendering in FreeType is a very visible change, and there are certainly users who wan't the old behaviour back.

If you insist on Chromium's current behaviour please provide a command line option that provides the same functionality.

Comment 8 by drott@chromium.org, Sep 26 2016

Labels: -Type-Bug -Pri-2 Pri-3 Type-Feature
Owner: drott@chromium.org
Status: Assigned (was: WontFix)
Thanks, Werner, for your input on this. I'll reopen the issue, but can't promise anything at the moment - we need to see how and if we can make this user configurable. 

Comment 9 Deleted

Comment 10 by cky...@gmail.com, Oct 7 2016

drott, I tested chrome without chrome-sandbox installed. Without chrome-sandbox, all environment variables are preserved in every chrome processes (by "ps e" or "cat /proc/xxx/environ"). Even so, the font of chrome still can't be affected by changing the value of REETYPE_PROPERTIES.
Thanks for the additional observation.

Comment 12 by js...@chromium.org, Oct 10 2016

Cc: js...@chromium.org bunge...@chromium.org
bungeman@ for Skia. 
bug 654563 is about adjusting rendering parameters on CrOS. 


Interestingly, what's in /proc/xxx/environ probably doesn't make much difference to 'getenv' (what FreeType is using), since when Chromium forks a subprocess it re-writes the 'environ' global after the fork, overwriting whatever the runtime startup set 'environ' to be ('getenv' reads from 'environ'). See https://cs.chromium.org/chromium/src/base/process/launch_posix.cc?sq=package:chromium&dr=CSs&rcl=1476184839&l=75 for where this appears to be handled. May want to get someone who understands that code on this issue to get a better overview.

Comment 14 by drott@chromium.org, Jan 25 2017

Blockedon: skia:6165
Fixed in Skia. I can try to verify it once Skia rolls past the fix in Skia commit 2a098d09edfb. 
Status: Fixed (was: Assigned)
I believe this is now fixed. I tested with current Chromium Dev 59.0.3067.0 and a build of FreeType at current master eb0683129bc5 . Turned on "Experimental Web Platform features" and ran Chromium Dev with LD_LIBRARY_PATH pointing at my local FreeType build and with FREETYPE_PROPERTIES=truetype:interpreter-version= set alternately to 35 and 40. I then created a small page using the "Selawik Variations" font with the text "\ttversion". The actual displayed glyphs correctly showed "35" or "40" as appropriate.

Comment 17 by drott@chromium.org, Apr 19 2017

Great, nicely done. We should perhaps use Selawik or approaches like in Selawik for testing gasp as well - if possible - perhaps using the \ttmode ligature.


Regarding the display of the current bytecode interpreter version: You might also have a look at

  https://www.freetype.org/freetype2/docs/rasterinfo/rasterinfo.html
Thanks for pointing out the rasterinfo font. I remember having seen it and it was the font I was originally looking for. I'll just have to remember it's at the bottom of the "Documentation" page for FreeType.
Sound likes I've posted a dupe,  bug 743063 , but I can reproduce this problem in Fedora 26 x86-64 and Freetype freetype-2.7.1-9.fc26.x86_64

FREETYPE_PROPERTIES=truetype:interpreter-version=35 is exported for the entire X session yet Google Chrome ignores it.
From https://www.freetype.org/freetype2/docs/rasterinfo/rasterinfo.html

The version of the TrueType bytecode interpreter (‘1’): 40
The Skia change was https://skia.googlesource.com/skia/+/2a098d09edfb7f02139a9537df6f1c0ac514fd74 and the required FreeType change is http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=693f56ffcdb91512b1d40ac45b1c503bef978b81 .

freetype$ git describe --contains 693f56ffcdb91512b1d40ac45b1c503bef978b81
VER-2-8~161
freetype$ git describe 693f56ffcdb91512b1d40ac45b1c503bef978b81
VER-2-7-1-46-g693f56ff

The Skia change is in Chromium, but your FreeType will need to be 2.8 or later (or cherry-pick in this change).
 Issue 743063  has been merged into this issue.
With FreeType 2.8.1 and chromium 60.0.3112.90 I still have this problem. I set FREETYPE_PROPERTIES="truetype:interpreter-version=35" , and I can even see it in /proc/($pidof chromium)/environ. I also straced chromium to be sure it was loading my newly-built-from-source libfreetype.so.6.15.0. But on the rasterinfo page I still see "The version of the TrueType bytecode interpreter (‘1’): 40" and my fonts still hint incorrectly. (As a sanity check, I grepped both the chromium binary and the libfreetype.so for FT_Set_Default_Properties, and both matched.)

Any ideas what might be wrong?
chromiumfont.png
1023 bytes View Download

Comment 25 by drott@chromium.org, Oct 13 2017

Do you have a custom built of Chromium that loads system FreeType? In our Chrome Linux release we ship our own. Are you sure both interpreter levels are built into the libfreetype.so.6.15.0 that you built? 

Did you try FREETYPE_PROPERTIES with the official Chrome build? 
 
Thanks #25! It actually works great in google-chrome-stable 60.0.3112.90 . I was using the version of chromium built by nix, so I will have to try to investigate how it was built. (And it's certainly possible that I didn't build my libfreetype correctly.)

Sign in to add a comment