You are not logged in.

#1 2016-09-11 08:57:08

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

chromium ignores FREETYPE_PROPERTIES

Since the freetype upgrade to version 2.7-2. Font hinting seems to not work properly for chromium (other softwares seems to work fine). I use Xfce and I have enabled font hinting everywhere I can think of: by enabling the symlink /etc/fonts/conf.avail/10-hinting-full.conf, in Xfce setting and by setting the new environnement variable FREETYPE_PROPERTIES but chromium (and only chromium) seems to completely ignore all of these settings. Note that I have already had similar problem in the past. With the older freetype version, only setting the symlink  /etc/fonts/conf.avail/10-hinting-full.conf seemed to work for chromium but now nothing works.

Updated: After some tests, it appears (by cat /proc/xxxx/environ) that the chrome processes run without any environnement variables. Probably chromium relaunch itself after unseting them. I don't know exactly why but this could explain why FREETYPE_PROPERTIES (that I have set to "truetype:interpreter-version=35") is ignored.
of

Updated2: After some hacking, I can change the default value of truetype:interpreter-version if unset in FREETYPE_PROPERTIES (file truetype/ttobjs.c, line 1290 to 1295 set all value to driver->interpreter_version = TT_INTERPRETER_VERSION_35). But this is not a proper solution. The real problem is that chromium completely ignores FREETYPE_PROPERTIES. I change the title accordingly.

Last edited by olive (2016-09-11 14:42:36)

Offline

#2 2016-09-12 08:13:58

mafflin
Member
Registered: 2016-03-19
Posts: 1

Re: chromium ignores FREETYPE_PROPERTIES

Same problem.

Offline

#3 2016-09-12 16:37:09

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: chromium ignores FREETYPE_PROPERTIES

Same problem, with all software that uses a font affected by FT2_SUBPIXEL_HINTING

Reverting to 2.6.5-2 works around the issue.

I made a bug report: https://bugs.archlinux.org/task/50755

Last edited by stevenhoneyman (2016-09-12 16:45:43)

Offline

#4 2016-09-12 18:17:52

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: chromium ignores FREETYPE_PROPERTIES

@stevenhoneyman. FT2_SUBPIXEL_HINTING is no longer used, now it is FREETYPE_PROPERTIES (see the pacman log). The new environment variable works except for Chromium that ignores it. The official Google Chrome is also affected. I think it is an upstream Chrome (Chromium) bug. As I said cat /proc/xxxx/environ show that chromium unset its environment variables and that can explain the problem  I have written a patch that modify the default driver (version 35 but you can easily adapt it) for freetype 2.7. You can still choose the driver with FREETYPE_PROPERTIES (except for Chromium that ignores it) only the default is changed. It is available here: http://pastebin.com/Kv02N3PL . But it is not a clean solution. The real problem is Chromium not freetype.

Offline

#5 2016-09-13 14:45:12

darose
Member
Registered: 2004-04-13
Posts: 158

Re: chromium ignores FREETYPE_PROPERTIES

I entered a bug report for this.  (https://bugs.archlinux.org/task/50765)  Might be an upstream problem though.

Offline

#6 2016-09-13 15:14:28

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: chromium ignores FREETYPE_PROPERTIES

@darose I have tested the official Google Chrome and it has the same problem; so that it is definitively an upstream bug. In my previous post I give a workaround by patching freetype2. But as I said it is not a proper fix, the real culprit is Chromium; that's why I do not propose it for the official package. Another workaround is to make symlinks in /etc/fonts/conf.d (for example ln -s /etc/fonts/conf.avail/10-hinting-full.conf . ) to force some settings. But you can't enable all the feature normally available via $FREETYPE_PROPERTIES.

Last edited by olive (2016-09-13 15:46:53)

Offline

#7 2016-10-07 20:13:12

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

olive wrote:

Updated: After some tests, it appears (by cat /proc/xxxx/environ) that the chrome processes run without any environnement variables. Probably chromium relaunch itself after unseting them. I don't know exactly why but this could explain why FREETYPE_PROPERTIES (that I have set to "truetype:interpreter-version=35") is ignored.

The problem is still there even if the environment variables are not unset.

I tested chrome without chrome-sandbox installed. Without chrome-sandbox, all environment variables can be preserved in each chrome process. Although you can see "FREETYPE_PROPERTIES" right there in all chrome processes, the font in chrome is still the subpixel-hinting-enabled look. However, in fact I disable it by set "FREETYPE_PROPERTIES" to "truetype:interpreter-version=35", like you.

This is the bug url of chromium.
https://bugs.chromium.org/p/chromium/is … ?id=649362

Last edited by ccgoo (2016-10-07 20:53:56)

Offline

#8 2016-10-08 06:32:27

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: chromium ignores FREETYPE_PROPERTIES

@ccgoo What exactly did you test? I have tested chromium by renaming /usr/lib/chromium/sandbox and by launching it with "chromium --no-sandbox" and there is still no environment variables in the various chromium processes. Did you test the official Google-chrome instead?

Anyway I don't know why chrome unset all environment variables; they must have a reason to do it (it is not something that will happen just by mistake, it must have been done intentionally). The real problem is that chrome/chromium do not respect FREETYPE_PROPERTIES. It could be possible to read the value and unset environment variables after; that's really something that have to be decided by the developers. Let's hope they will read the bug and fix it. Up to know the only solution I have found is my patch to the freetype library to change the default value (see my previous post).

Last edited by olive (2016-10-08 15:50:07)

Offline

#9 2016-10-10 07:46:48

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

@olive I disable the feature of chrome-sandbox from being compiled. I use Gentoo, so it's easy to do it. By adding "-suid" into USE flag of chromium, the whole chrome-sandbox feature is not gonna be compiled and installed at all. Without this feature, I see all environment variables are preserved in every chrome process.

Offline

#10 2016-10-10 07:53:38

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: chromium ignores FREETYPE_PROPERTIES

Disabling the chrome sandbox just for some fonts seems like an overly drastic measure... you might as well use a different browser then.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#11 2016-10-10 17:57:57

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

Alad wrote:

Disabling the chrome sandbox just for some fonts seems like an overly drastic measure... you might as well use a different browser then.

First, please don't garble, please read the whole topic from top to bottom. I disable chrome-sandbox not just for some fonts. I disable it to test if chrome can preserve all environment variables.

And second, which is important, chrome-sandbox is not necessary. Do you know that? The chrome-sandbox is only needed on CONFIG_USER_NS=n kernels.
My kernel is CONFIG_USER_NS=y, so I definitely can disable chrome-sandbox just for some fonts. It is not an overly drastic measure.

Offline

#12 2016-10-10 18:09:23

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: chromium ignores FREETYPE_PROPERTIES

As indicated in the OP and title, this thread is solely about the appearance of fonts in Chromium.

The chrome-sandbox is only needed on CONFIG_USER_NS=n kernels.

Arch does not have this option set in its kernels.

Last edited by Alad (2016-10-10 18:10:01)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#13 2016-10-10 18:25:12

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

Alad wrote:

As indicated in the OP and title, this thread is solely about the appearance of fonts in Chromium.

Reading OP and title is not enough to join in a thread. You are supposed to read all post of someone, if you want to reply to him.

Alad wrote:

Arch does not have this option set in its kernels.

I know Arch doesn't have this option, which doesn't change the truth chrome-sandbox is only needed on CONFIG_USER_NS=n kernels.

Offline

#14 2016-10-10 18:28:29

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: chromium ignores FREETYPE_PROPERTIES

I read all of it. And your advice to disable major security features because it supposedly doesn't matter on a different distribution (i.e., not Arch) isn't helpful either.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#15 2016-10-10 18:42:29

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

Alad wrote:

I read all of it. And your advice to disable major security features because it supposedly doesn't matter on a different distribution (i.e., not Arch) isn't helpful either.

I don't think you read all of it carefully. Where shows you I advice to disable major security feature. Please don't misleading other readers, and let's stop the meaningless argument.

I am talking to @olive, and he knows exactly what I am talking about, which you don't obviously.

Offline

#16 2016-10-10 18:51:37

Octoploid
Member
From: Berlin, Germany
Registered: 2009-10-13
Posts: 64

Re: chromium ignores FREETYPE_PROPERTIES

ccgoo wrote:

I know Arch doesn't have this option, which doesn't change the truth chrome-sandbox is only needed on CONFIG_USER_NS=n kernels.

This is just wrong. Try it, set CONFIG_USER_NS=y and start chromium with --no-sandbox and open chrome://sandbox/.

Offline

#17 2016-10-10 19:55:39

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

Octoploid wrote:

This is just wrong. Try it, set CONFIG_USER_NS=y and start chromium with --no-sandbox and open chrome://sandbox/.

First of all, you use "--no-sandbox" to launch chromium, so besides turning off sandbox functions, what else you suppose chromium to do? To turn on sandbox functions?

Second, I guess maybe I didn't make my self clear when I mentioned "disable sandbox" in the answer to @olive.

The "disable sandbox" does not mean turn off sandbox functions with option "--no-sandbox" when running chromium. It means remove SUID sandbox feature when compiling chromium.
On a CONFIG_USER_NS=n kernel, if you remove SUID sandbox feature when compiling, then you'll get a chromium which really doesn't have any sandbox feature at all. No security.
On a CONFIG_USER_NS=y kernel, even if you remove SUID sandbox feature when compiling, you'll still get a chromium which has another sandbox-feature enabled, the "Namespace sandbox".

So when you open "chrome://sandbox" on a chromium which has SUID sandbox feature compiled, you'd see

SUID Sandbox         Yes

and if CONFIG_USER_NS=y, you'd see

Namespace Sandbox    Yes

and if you use "--no-sandbox" to run chromium, (despite SUID sandbox is compiled or not, despite CONFIG_USER_NS is set or not), you'd see

SUID Sandbox         No
Namespace Sandbox    No

P.S. We've gone far from the OP, so please stop in thread. If you want to continue, please send message to me.

Last edited by ccgoo (2016-10-10 19:59:20)

Offline

#18 2016-10-10 23:39:33

FelledTreeNo9
Member
Registered: 2015-05-05
Posts: 23

Re: chromium ignores FREETYPE_PROPERTIES

ccgoo, I'm re-reading your original post (#7) and finding it a bit unclear. You say that after taking steps to disable the Chrome sandbox, the environment variables are preserved in every Chrome process - this I understand. But after that, if you set "FREETYPE_PROPERTIES=truetype:interpreter-version=35" in your environment and run your special environment-preserving version of Chrome again, do the fonts have the subpixel-hinting-enabled look or not?

Offline

#19 2016-10-10 23:48:20

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

@FelledTreeNo9, the answer is yes, subpixel-hinting is still enabled, even I set "FREETYPE_PROPERTIES" to "truetype:interpreter-version=35", and it is preserved in each chrome process.

As @olive said, "The real problem is that chrome/chromium do not respect FREETYPE_PROPERTIES".

Last edited by ccgoo (2016-10-10 23:51:58)

Offline

#20 2016-10-11 04:24:12

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: chromium ignores FREETYPE_PROPERTIES

ccgoo wrote:

As @olive said, "The real problem is that chrome/chromium do not respect FREETYPE_PROPERTIES".

Actually, I'd argue that the real problem is freetype using configuration via environment variables.

Chromium's "problem" isn't with FREETYPE_PROPERTIES at all, it's that for security reasons it doesn't access *any* variables, not just this particular one. But that's a feature, not a "problem", hence my use of the quotes and why the Chromium bug was initially closed as WontFix.

Offline

#21 2016-10-11 05:57:51

ccgoo
Member
Registered: 2016-02-12
Posts: 10

Re: chromium ignores FREETYPE_PROPERTIES

It is opened again

Offline

#22 2016-10-11 06:34:33

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: chromium ignores FREETYPE_PROPERTIES

Gusar wrote:

Actually, I'd argue that the real problem is freetype using configuration via environment variables.

Chromium's "problem" isn't with FREETYPE_PROPERTIES at all, it's that for security reasons it doesn't access *any* variables, not just this particular one. But that's a feature, not a "problem", hence my use of the quotes and why the Chromium bug was initially closed as WontFix.

I will qualify it as a bug nevertheless, the Freetype library use some environment variables for its configuration which is quite usual for a library (there are plenty environment variables that can be set for the 3D mesa library, for example). If Chromium want to use it, it should use it properly.I don't consider that font rendering is a minor issue for a browser. The main purpose of a browser is still to render text.

Last edited by olive (2016-10-11 06:35:56)

Offline

#23 2016-10-11 18:09:53

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: chromium ignores FREETYPE_PROPERTIES

I never said this is a minor issue. Font rendering is extremely important. And also very subjective, making it an even more difficult problem to solve. But I have a different view where the bug is. Configuration via environment variables does not go well with sandboxes, because the very point of a sandbox is to be its own isolated environment.

Also, configuring a library via variables is not common, the normal way is for the library to provide an API, and you then make API calls from your application. Or the library reads configuration from a specific file or database. Or both - that's how fontconfig works for example, it parses XML files from /etc/fonts and ~/.config/fontconfig and there's also an API.

Offline

#24 2016-10-11 18:33:35

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: chromium ignores FREETYPE_PROPERTIES

@Gusa. But most libraries use at least some environment variables. The $PATH is an environment variable, the locales are set via environment variables (the various $LC_ ). You can set the timezone with an environment variable. Look at these numerous LIGL and MESA environment variables: http://www.mesa3d.org/envvars.html. Even GTK use them: https://developer.gnome.org/gtk3/stable … nning.html. Even fontconfig (although I don't know if it is still true for the last version) use environment variables (to locate the config files): https://www.x.org/archive//X11R6.9.0/do … ame.3.html.

The very fact that environment variables can be dangerous prove that they are used by the libraries chromium depends on; otherwise it wouldn't be dangerous. Using files instead of environment variables wouldn't be less dangerous. It would be even more dangerous because it is relatively easy to have a list of safe variables; rogue config files cannot be unset so easily.

Last edited by olive (2016-10-11 18:34:53)

Offline

Board footer

Powered by FluxBB