fontconfig does not honor hintslight, hintmedium, hintfull
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| cairo |
Confirmed
|
Low
|
|||
| cairo (Ubuntu) |
Low
|
Unassigned | |||
Bug Description
Binary package hint: fontconfig
fontconfig-
When I ask fontconfig to use the authinter and specify hintstyle as hintslight, hintmedium, or hintfull there is no perceptible difference on the screen. Doing this on a similar Fedora 8 system shows perceptible differences with all settings.
I also tried downloading and compiling freetype2 with the bytecode interpreter forced "off" so the autohinter is always used. The font rendering is certainly the autohinter but there is again no perceptible difference between hintslight, hintmedium, and hintfull.
I suspect but cannot prove that this might be the result of the fontconfig "hack" that was made to enable/disable the legacy LCD filter for monospaced fonts in gutsy.
Ubuntu 7.10 (gutsy)
| Kriston Rehberg (me-kriston) wrote : | #1 |
| Arne Goetje (arnegoetje) wrote : | #2 |
Can you try to remove /etc/fonts/
If that helps, then we would need some discussion if we should disable that file by default.
As a general note: due to the nature of fontconfig being a system wide setting and users will always have different preferences when it comes to text rendering, it is actually impossible for us to provide a default configuration that works for everyone. Manual tweaking by the user will aways be needed.
| Kriston Rehberg (me-kriston) wrote : Re: [Bug 200707] Re: fontconfig does not honor hintslight, hintmedium, hintfull | #3 |
The problem is not with the LCD filter, it's whether the Ubuntu copy of
freetype is changing the autohint style. When choosing each of the four
options the fonts change their shapes. In Ubuntu, only the "none" and
"full" make any hinting difference. Someone in gutsy changed the
"medium" and "full" buttons to do nothing more than turn on and off the
monospace lcd filter. This needs to be fixed so that the buttons do
what they say.
--
Kriston Rehberg
http://
Arne Goetje wrote:
> Can you try to remove /etc/fonts/
> see if that helps?
>
> If that helps, then we would need some discussion if we should disable
> that file by default.
>
> As a general note: due to the nature of fontconfig being a system wide
> setting and users will always have different preferences when it comes
> to text rendering, it is actually impossible for us to provide a default
> configuration that works for everyone. Manual tweaking by the user will
> aways be needed.
>
> --
> fontconfig does not honor hintslight, hintmedium, hintfull
> https:/
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Source Package "fontconfig" in Ubuntu: New
>
> Bug description:
> Binary package hint: fontconfig
>
> fontconfig-
> hintfull options for the autohinter.
> When I ask fontconfig to use the authinter and specify hintstyle as
> hintslight, hintmedium, or hintfull there is no perceptible difference
> on the screen. Doing this on a similar Fedora 8 system shows
> perceptible differences with all settings.
> I also tried downloading and compiling freetype2 with the bytecode
> interpreter forced "off" so the autohinter is always used. The font
> rendering is certainly the autohinter but there is again no perceptible
> difference between hintslight, hintmedium, and hintfull.
> I suspect but cannot prove that this might be the result of the
> fontconfig "hack" that was made to enable/disable the legacy LCD filter
> for monospaced fonts in gutsy.
>
> Ubuntu 7.10 (gutsy)
>
>
| Kriston Rehberg (me-kriston) wrote : | #4 |
The problem is not with the LCD filter, it's whether the Ubuntu copy of freetype is changing the autohint style. When choosing each of the four options the fonts normally change their shapes in obvious ways. In Ubuntu gutsy, only the "none" and "full" buttons make any difference. Someone in gutsy changed the "medium" and "full" buttons to do nothing more than turn on and off the monospace lcd filter to keep things simple, but this appears to break the autohinting configuration. This could be due to the fact that Ubuntu normally ships with the autohinter disabled. In any case this needs to be fixed so that the buttons do what they say, that is, adjust autohinter hint styles.
In addition, manually editting ~/.fonts.conf to use the various hint styles does not seem to make any difference so this is therefore a problem with Ubuntu's fontconfig patches.
| Mingming Ren (portis25) wrote : | #5 |
Could this be a bug of libcairo? Because after comment one line of code in libcairo, the hintstyle sets in ~/.fonts.conf makes effect. I reported it to libcairo, Bug #209256, but got no response.
I'd like to render my fonts in different hintstyles.
To be precise, I have chinese font and western language fonts. For the chinese font, I'd like it to be rendered in hintfull, but for other fonts, I'd prefer hintslight.
Ok, I configured in the fontconfig file, but it didn't make any change. All the fonts are in the same hintstyle, depending on the configuration in gnome-appearanc
I googled for quite a long time and finally I got one solution.
In the file cairo-ft-font.c, in function _cairo_
// if (options-
and recompile, now everything works fine. The fonts are rendered according to the hintstyles configured in fontconfig.
I don't know if this is really a bug of libcairo. If I'm wrong, please accept my apology.
| Kriston Rehberg (me-kriston) wrote : | #6 |
Mingming, thanks for the comments.
I suspect that the user's settings in fontconfig are not being honored
when an application asserts a setting. This needs to be addressed.
It indeed might be a libcairo thing.
There is still alot of work going on in the new rendering pipeline so
perhaps when the dust clears, so to speak, this issue will be resolved
and there will be a "new" place where this kind of setting is supposed
to be asserted.
Mingming wrote:
> Could this be a bug of libcairo? Because after comment one line of code
> in libcairo, the hintstyle sets in ~/.fonts.conf makes effect. I
> reported it to libcairo, Bug #209256, but got no response.
>
> I'd like to render my fonts in different hintstyles.
>
> To be precise, I have chinese font and western language fonts. For the
> chinese font, I'd like it to be rendered in hintfull, but for other
> fonts, I'd prefer hintslight.
>
> Ok, I configured in the fontconfig file, but it didn't make any change.
> All the fonts are in the same hintstyle, depending on the configuration
> in gnome-appearanc
>
> I googled for quite a long time and finally I got one solution.
>
> In the file cairo-ft-font.c, in function _cairo_
> comment the following line:
>
> // if (options-
>
> and recompile, now everything works fine. The fonts are rendered
> according to the hintstyles configured in fontconfig.
>
> I don't know if this is really a bug of libcairo. If I'm wrong, please
> accept my apology.
>
> --
> fontconfig does not honor hintslight, hintmedium, hintfull
> https:/
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Source Package "fontconfig" in Ubuntu: New
>
> Bug description:
> Binary package hint: fontconfig
>
> fontconfig-
> hintfull options for the autohinter.
> When I ask fontconfig to use the authinter and specify hintstyle as
> hintslight, hintmedium, or hintfull there is no perceptible difference
> on the screen. Doing this on a similar Fedora 8 system shows
> perceptible differences with all settings.
> I also tried downloading and compiling freetype2 with the bytecode
> interpreter forced "off" so the autohinter is always used. The font
> rendering is certainly the autohinter but there is again no perceptible
> difference between hintslight, hintmedium, and hintfull.
> I suspect but cannot prove that this might be the result of the
> fontconfig "hack" that was made to enable/disable the legacy LCD filter
> for monospaced fonts in gutsy.
>
> Ubuntu 7.10 (gutsy)
>
>
|
|
#7 |
Recently I've found a better fix. Set default hintstyle to "CAIRO_
if (options-
to
if (other-
This should give fair result, i.e., only if hintstyle is specified with fontconfig would the value configured with gnome-settings-
The rgba behavior is actually more complicated:
With "echo Xft.rgba: rgb | xrdb -merge"
and <edit name="rgba" mode="assign" ><const>
"pango-view -t 'fcgray antialias' --backend=cairo"
renders with rgb subpixel antialiasing.
"--backend=ft2" and "--backend=xft" render with gray antialiasing as expected.
_cairo_
on the scaled_font or on the cairo_ft_font_face (from the FcPattern)
take priority in the way the font behaves.
Assuming that surface options have already been set on the FcPattern with
cairo_ft_
scaled_font should ever take priority over those from the pattern. If
fontconfig has changed any options on the pattern then that is what the user
(or distribution) wants.
Is the logic in _cairo_
fontconfig settings?
Some surfaces may be pretty keen to have CAIRO_HINT_
surfaces with depth 1 would like CAIRO_ANTIALIAS
need rgba antialiasing, but maybe changing the load flags based on the color support of the surface would produce some surprises with glyph outline changes.
I wouldn't really see a problem with fontconfig settings always having the
last say (bug 4792 comment 5). fontconfig settings should be able to achieve
their goals without unconditionally setting hinting to true (as true is the
default).
Even if there are some special cases where surface options should take
priority, I can't think why the surface should care what hintstyle is used
once hinting is on. Similarly, I can't think why a color surface should care
if the user asks for gray antialiasing on a font that doesn't hint well to
reduce color fringing.
I wonder whether a cairo_ft_
cairo_font_
scaled_font can be created with the font_options that will be used, which
would be useful in _cairo_
But merely modifying _cairo_
even with the existing API.
I know I've been surprised by the logic in _cairo_
I'll look into this after 1.8. Feel free to ping.
|
|
#10 |
*** Bug 13335 has been marked as a duplicate of this bug. ***
|
|
#11 |
*** Bug 4792 has been marked as a duplicate of this bug. ***
| Changed in fontconfig: | |
| importance: | Undecided → Low |
I don't understand why this bug exists such a long time - it's obvious and important. You can't specify different hintstyles for individual fonts through fontconfig - gnome-settings-
| Changed in libcairo: | |
| status: | Unknown → Confirmed |
|
|
#13 |
Created an attachment (id=23125)
patch for cairo-ft-font.c
This bug still exists in Debian sid (libcairo2=
This simple patch shall fix it, at least it works for me.
|
|
#14 |
Created an attachment (id=34511)
cairo-respect-
(In reply to comment #3)
> I'll look into this after 1.8. Feel free to ping.
Ping!
I've used the enclosed cairo-respect-
http://
|
|
#15 |
Hi, this is an annoying bug, any chance for the patch above to be included in cairo? It solves the problem for me.
| Vish (vish) wrote : | #16 |
Switching task to reflect upstream bug report.
| affects: | fontconfig (Ubuntu) → libcairo (Ubuntu) |
| Changed in libcairo (Ubuntu): | |
| status: | New → Triaged |
|
|
#17 |
Bug still there (1.8.10) and cairo-respect-
Simple fix, waiting far too long to be fixed in codebase.
I did some digging and condition (options-
|
|
#18 |
Created an attachment (id=37489)
The complete patch for respecing Fontconfig in Cairo. Hintstyle / RGBA / LCDFilter are supported now.
The routines dealing with data returned by Fontconfig have been rewritten to support all properties. The logic is simple - if anything is returned by Fontconfig, it will be respected. If not, the xrdb/Xft settings are used.
| Changed in libcairo: | |
| importance: | Unknown → Low |
(In reply to comment #11)
> Created an attachment (id=37489) [details]
> The complete patch for respecing Fontconfig in Cairo. Hintstyle / RGBA /
> LCDFilter are supported now.
>
> The routines dealing with data returned by Fontconfig have been rewritten to
> support all properties. The logic is simple - if anything is returned by
> Fontconfig, it will be respected. If not, the xrdb/Xft settings are used.
Quick comments:
1. No unnecessary whitespace changes please.
2. No C++-style comments please.
3. If you can, break down the patch into bite-size chunks such that I can review the behvaior change instead of blanket-approving it.
Thanks
|
|
#20 |
Please excuse me if this is not the best place to bring this topic, but what exactly is the point of supporting all these Xft.<option> xresources?
Maybe I'm a bit uniformed but this stuff is broken by design anyway (hence fontconfig). I mean, toolkits and whatnot shouldn't give a f..k about those options because all they should care about is fontconfig. Setting some Xft.<foo> is global (is terms of fonts) and this is what makes it almost totally useless. Everyone who digs fonts knows that you can't get all your fonts right just by setting some global options. Most good quality fonts (mostly from professional font foundries, but not only) require "tweaks" in hintstyle etc. to look good (in other words - they only look good with e.g. hintstyle=
[This is also a good place to point out that approach taken by tools like gnome-appearanc
"But these are just Xft defaults and we should obey them" you may say. Yeah, but dealing with those legacy options brings SO MUCH CONFUSION and bizarre bugs I lack words to describe it. Every toolkit/app and their dog tries to do something with them and almost always fails to do it right (perhaps because it's impossible to do so). Let's take emacs for an example. Emacs can use gtk2 and fontconfig, but not cairo. It pretty much succeeds but what's striking is that it basically fucks up FcPatterns by modifying them with stuff from Xft xresources. After getting them from fontconfig, so any carefully crafted (font/pattern-
The bottom line is: why not use fontconfig for everything, so app/toolkit developers won't do stupid things like the mentioned above?
Freetype is pretty capable of providing good results, but bugs like this simply prevent demanding users from making use of it.
Also, If you don't believe this stuff, just google around, see how users are struggling in confusion.
Sorry for the style of this comment. I couldn't help myself. My English is so poor I can only rant ;)
(In reply to comment #13)
> The bottom line is: why not use fontconfig for everything,
Fontconfig doesn't know whether the text is being rendered to an LCD screen or a printer, so fontconfig needs to be told subpixel order and whether hinting is appropriate.
Problems happen when fontconfig rules blindly override such information (bug 17722, https:/
|
|
#22 |
(In reply to comment #14)
> Fontconfig doesn't know whether the text is being rendered to an LCD screen or
> a printer, so fontconfig needs to be told subpixel order and whether hinting is
> appropriate.
I admit I don't know how printing specific rendering is being done. Is it that antialiasing and hinting are turned off because printer resolution is much higher than screen and it wouldn't make sense to leave them on? (no visible effect?)
> Problems happen when fontconfig rules blindly override such information (bug
> 17722
Sorry for discussing bug 17722 here, but how come that rules in 10-sub-pixel-*.conf can override anything? Isn't it how defaults supposed to be set, giving that "50-user.conf" can override it later and any "low-level" fontconfig user can do the same if needed? (and virtually all Xft.rgba touching stuff does it anyway? Or doesn't? Or is xrm/fc priority issue? See? This should be nuked.)
| Changed in libcairo: | |
| importance: | Low → Unknown |
|
|
#23 |
Created attachment 42713
Revised version of respect-fontconfig patch against 1.10.2 version.
I am sending the updated patch, with comments from Behdad Esfahbod incorporated.
There are two routines modified with this patch:
* _cairo_
* _get_pattern_
** The most significant change here covers the fact, that hinting information wasn't processed if antialiasing was switched off.
** Another change in behavior applies to antialiasing information - basically there are 7 different combination of FontConfig properties ('antialias' and 'rgba') values that define different behavior, but they cannot be naturally represented in cairo_ft_options_t structure (in theory it could be done, but with extremely nasty approach). As changing the contract and defining additional value for _cairo_
|
|
#24 |
Created attachment 42714
Revised version of respect-fontconfig patch against 1.10.2 version - for easy reading
Just modified methods - for easy reading...
| Changed in libcairo: | |
| importance: | Unknown → Low |
One year passes. Is there anything stopping this patch merged to the main line?
Karl, do you think you would have the time to review the patch?
(In reply to comment #15)
> (In reply to comment #14)
> > Fontconfig doesn't know whether the text is being rendered to an LCD screen or
> > a printer, so fontconfig needs to be told subpixel order and whether hinting is
> > appropriate.
>
> I admit I don't know how printing specific rendering is being done. Is it that
> antialiasing and hinting are turned off because printer resolution is much
> higher than screen and it wouldn't make sense to leave them on? (no visible
> effect?)
Not just that the printer resolution is higher, but the resolution may not
even be known at the time of generating the PDF or PS output.
Comment on attachment 42713
Revised version of respect-fontconfig patch against 1.10.2 version.
Review of attachment 42713:
-------
(In reply to comment #16)
Thanks for the helpful overview of the changes.
> * _cairo_
> algorithm for all font properties: if other structure define a property (it
> does not equal CAIRO_*_DEFAULT), this value will be used.
I'd like to agree in principle, but we need at least one exception to this
rule.
If FT_LOAD_NO_HINTING is not set, but hint_metrics is CAIRO_HINT_
x_advance/y_advance metrics will not be hinted, but x/y_bearing/
metrics and outlines will still be hinted.
https:/
always embeds (and subsets) the fonts used. If subsetting fails it will
fallback to embedding a font generated from the unhinted outlines of the
glyphs."
And https:/
should also be set to none for printing although this only affects the use of
fallback fonts where cairo embeds a font created from the glyph outlines."
That means that a HINT_STYLE_NONE on the surface will need to override
fontconfig. I guess we could argue that users shouldn't have fontconfig
settings that turn on hinting if it has been turned off, but history has shown
that people will use fontconfig to turn on hinting, overriding an explicitly
set value in the pattern.
There are also times when the font_options should be able to override the
cairo antialias option from fontconfig. This would be beneficial if the
destination surface is monochrome or grayscale and so doesn't support the same
antialiasing options, or if the destination is a translucent part of a
CONTENT_COLOR_ALPHA surface and so component-alpha will be lost before the
glyphs are composited onto an opaque background (leading to excessive color
fringing). I think what we want for cairo antialias is not a priority of
fontconfig over other interests, but the greatest common method among those
supported and desired. The current code doesn't provide this exception,
however.
> * _get_pattern_
> cairo_ft_options_t structure.
>
> ** The most significant change here covers the fact, that hinting information
> wasn't processed if antialiasing was switched off.
Yes, processing hinting and hintstyle to determine whether to hint seems the
right thing to do (even if I don't know of a good reason, apart from testing
perhaps, why anyone would want to turn off hinting through fontconfig if
antialias has been set to false).
> ** Another change in behavior applies to antialiasing information - basically
> there are 7 different combination of FontConfig properties ('antialias' and
> 'rgba') values that define different behavior, but they cannot be naturally
> represented in cairo_ft_options_t structure (in theory it could be done, but
> with extremely nasty approach). As changing the contract and defining
> additional value for _cairo_
|
|
#29 |
This bug is still present.
Any hope to see it fixed someday?
I suppose that using Wayland this bug should vanish. Am I right?
Created attachment 109191
GIMP font rendering
https:/
| affects: | libcairo → cairo |
| affects: | libcairo (Ubuntu) → cairo (Ubuntu) |


Binary package hint: fontconfig
fontconfig- 2.4.2-1. 2ubuntu4 does not honor hintslight, hintmedium, hintfull options for the autohinter.
When I ask fontconfig to use the authinter and specify hintstyle as hintslight, hintmedium, or hintfull there is no perceptible difference on the screen. Doing this on a similar Fedora 8 system shows perceptible differences with all settings.
I also tried downloading and compiling freetype2 with the bytecode interpreter forced "off" so the autohinter is always used. The font rendering is certainly the autohinter but there is again no perceptible difference between hintslight, hintmedium, and hintfull.
I suspect but cannot prove that this might be the result of the fontconfig "hack" that was made to enable/disable the legacy LCD filter for monospaced fonts in gutsy.
Ubuntu 7.10 (gutsy)