Bug 1187528 - [gnome-terminal] blurred rendering of PCF fonts after update of fontconfig
Summary: [gnome-terminal] blurred rendering of PCF fonts after update of fontconfig
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fontconfig
Version: 22
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1217686 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-30 11:01 UTC by Joachim Frieben
Modified: 2015-06-05 23:53 UTC (History)
14 users (show)

Fixed In Version: fontconfig-2.11.94-1.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-05 23:53:48 UTC


Attachments (Terms of Use)
Screenshot for sample font 9x15-ISO8859-1.pcf (721.65 KB, image/png)
2015-01-30 11:01 UTC, Joachim Frieben
no flags Details
Sample font 9x15-ISO8859-1.pcf (20.90 KB, application/octet-stream)
2015-01-30 11:02 UTC, Joachim Frieben
no flags Details
Output of 'fc-match -a "Fixed:style=Regular:lang=en"' (10.26 KB, text/plain)
2015-02-03 11:44 UTC, Joachim Frieben
no flags Details
Output of 'fc-match -a "Fixed:style=Regular:lang=en"' (10.33 KB, text/plain)
2015-02-04 08:59 UTC, Joachim Frieben
no flags Details
Output of 'fc-list' (29.26 KB, text/plain)
2015-02-04 09:02 UTC, Joachim Frieben
no flags Details
Terminus font in Leafpad editor also blurred (MATE desktop). Zoom level 400% (32.10 KB, image/png)
2015-05-28 17:33 UTC, LiuYan
no flags Details

Description Joachim Frieben 2015-01-30 11:01:40 UTC
Created attachment 985938 [details]
Screenshot for sample font 9x15-ISO8859-1.pcf

Description of problem:
After updating fontconfig from the latest stable version 2.11.1 to the development branch 2.11.9x in the Fedora development tree, PCF fonts appear blurred whereas they appear as expected in gnome-font-viewer. Moreover, the size seems to be incorrect.

Version-Release number of selected component (if applicable):
gnome-terminal-3.14.2-2.fc21.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Choose PCF as terminal font.

Actual results:
Characters appear blurred and with a wrong size.

Expected results:
Characters are correctly.

Additional info:
Downgrading to fontconfig-2.11.1-5.fc22 allowed to restore normal rendering for some time before updates introduced library incompatibilities.

Comment 1 Joachim Frieben 2015-01-30 11:02:38 UTC
Created attachment 985939 [details]
Sample font 9x15-ISO8859-1.pcf

Comment 2 Joachim Frieben 2015-01-30 12:14:51 UTC
Since the blurred font is visible also in the profile window opened in the screenshot, this is probably rather a gtk3 issue.

Comment 3 Matthias Clasen 2015-01-30 19:59:17 UTC
So, you diagnosed that the problem appeared with a fontconfig update, and disappears with a fontconfig downgrade. And you think it is a gtk issue, but you file it against gnome-terminal ?

Comment 4 Joachim Frieben 2015-01-30 20:26:49 UTC
(In reply to Matthias Clasen from comment #3)
1. I do not think that this is a fontconfig issue because gnome-font-viewer which is linked against fontconfig itself displays all fonts -correctly- as you see in the screenshot.
2. That a fontconfig update caused this issue does not necessarily imply that fontconfig itself is the culprit. Some change may simply exhibit a bug in a different component, e.g. gnome-terminal (see 1.)
3. When after posting the bug I got aware that the font preview in the preferences panel was also affected which is provided by some (other) gtk3 widget I was less convinced that it was a gnome-terminal issue and added comment 3. The screenshot and the attached PCF file should allow you anyway to reproduce this issue instantaneously. I preferred to leave it up to you to choose the best fitting component.
4. I have just verified that also gedit renders blurred characters when this PCF font is chosen. Thus, indeed, it is not a gnome-terminal issue.

Comment 5 Akira TAGOH 2015-02-03 09:16:34 UTC
If it looks good on gnome-font-viewer, the font actually used for rendering on apps where you are seeing a problem may be different to what you expected because gnome-font-viewer disables the fallback on selecting a better font in pango.
What exactly a font used in pango is hard to see at this moment. just checking the result of fc-match isn't necessarily correct to report the details.

The difference between f22's and f21's related to this I think is, there are the change in scoring a font for bitmap and outline which prefer an outline font rather than bitmap until then, which was a bug. though the behavior looks opposed to that.

I'm not sure if it makes any difference, how about enabling 70-yes-bitmaps.conf?

Comment 6 Joachim Frieben 2015-02-03 10:25:04 UTC
(In reply to Akira TAGOH from comment #5)
Enabling 70-yes-bitmaps.conf by setting

    <patelt name="scalable"><bool>true</bool></patelt>

does not make any difference. I do not understand your reasoning on the handling of fonts: the chosen bitmap font is being used but the rendering is incorrect. There is no issue of erroneously giving preference of another font over the desired one. The reported issue appears to be related of a wrong scaling of the chosen bitmap font.

Comment 7 Akira TAGOH 2015-02-03 11:05:45 UTC
That config enforces the scalable font to choose which means you aren't using the attached font actually. you can see:

$ fc-query /path/to/9x15-ISO8859-1.pcf | grep scalable
        scalable: False(s)

Do you have any other "Fixed Regular" font in your box? what about fc-match -a "Fixed:style=Regular:lang=en" ?

Comment 8 Joachim Frieben 2015-02-03 11:44:44 UTC
Created attachment 987500 [details]
Output of 'fc-match -a "Fixed:style=Regular:lang=en"'

(In reply to Akira TAGOH from comment #7)
I have copied /usr/share/X11/fonts/misc/cl* into $HOME/.fonts/ in order to make these fonts available to fontconfig. This set of bitmap fonts can be chosen through the font selector of gnome-terminal.
The output of fc-match -a "Fixed:style=Regular:lang=en" can be found in the attachment.

Comment 9 Akira TAGOH 2015-02-04 02:43:07 UTC
You don't need to copy the fonts there because there should be /usr/share/fonts/X11 symlink to it. though I don't see any "Fixed" fonts in the list so Pango tries to fallback others then. do you see those fonts with fc-list say?

Comment 10 Joachim Frieben 2015-02-04 08:59:13 UTC
Created attachment 987983 [details]
Output of 'fc-match -a "Fixed:style=Regular:lang=en"'

Output of 'fc-match -a "Fixed:style=Regular:lang=en"' after copying all fonts 9x15* from /usr/share/X11/fonts/misc to an empty folder $HOME/.fonts

Comment 11 Joachim Frieben 2015-02-04 09:02:13 UTC
Created attachment 987985 [details]
Output of 'fc-list'

Output of 'fc-list' after copying all fonts 9x15* from /usr/share/X11/fonts/misc/ to an empty folder $HOME/.fonts.

Nothe that /usr/share/X11/fonts/misc/ is -not- included in fontconfig's search path; from the various X11 font directories only /usr/share/X11/fonts/Type1/ is!

Comment 12 Akira TAGOH 2015-02-17 07:23:49 UTC
Apparently the result at comment#10 is different to comment#8. is it still reproducible even after copying all 9x15* fonts to $HOME/.fonts?

Comment 13 Joachim Frieben 2015-02-17 17:06:10 UTC
To be more precise: after adding 9x15-ISO8859-1.pcf to an -empty- folder $HOME/.fonts, fontconfig behaves correctly when chosing font "Fixed Regular". For a scaling factor 11 from the font selection panel, it looks exactly as when opened with gnome-font-viewer. Only after adding additional fixed fonts of decreasing size to $HOME/.fonts such as 6x13-ISO8859-1.pcf etc., the terminal font changes size and eventually becomes blurred. Only for some small scaling factors, it is possible to obtain a crisp terminal font albeit smaller than the original one. My remedy for the original issue is to use only a single PCF file of the desired font family which looks crisp at the right size.

Comment 14 Akira TAGOH 2015-02-18 03:27:25 UTC
That sounds like just you don't like the fallback font for "Fixed Regular". when no fonts available in the font path where fontconfig recognize, it tries to find out a fallback. if you like a bitmap font rather than outlined one, assuming you have something though, enabling 70-yes-bitmaps.conf would be the way to go for you as I suggested at comment#5.

To make more clear, if you disable 10-scale-bitmap-fonts.conf and see any difference on the behavior, something might be wrong around it otherwise it may be not a bug and depends on how exactly the terminal requests a font.

Comment 15 Jaroslav Reznik 2015-03-03 16:47:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 16 Adam Goode 2015-05-20 01:45:15 UTC
*** Bug 1217686 has been marked as a duplicate of this bug. ***

Comment 17 Adam Goode 2015-05-20 01:55:44 UTC
I have the same problem with Terminus font.

I tried adding 70-yes-bitmaps and disabling 10-scale-bitmap-fonts with no effect. The font is still the wrong size and/or blurry.

Comment 18 Adam Goode 2015-05-20 01:58:41 UTC
This is reproducible in the same way with gedit.

Comment 19 Akira TAGOH 2015-05-20 02:37:21 UTC
(In reply to Adam Goode from comment #18)
> This is reproducible in the same way with gedit.

Does it only happen with PCF fonts?

Comment 20 Adam Goode 2015-05-20 03:41:14 UTC
Yes, using terminus-fonts (PCF).

Comment 21 Akira TAGOH 2015-05-20 05:36:57 UTC
meant to see if it works fine with TrueType/OpenType fonts say.

Comment 22 Joachim Frieben 2015-05-21 07:37:56 UTC
(In reply to Adam Goode from comment #20)
Do not install package terminus-fonts system-wide but extract the PCF files and copy one file alone to $HOME/.fonts in increasing order removing the previous one. The right one will looks crisp at the desired size. This enabled me to use my favourite terminal (bitmap) font even under fedora 22.

Comment 23 Akira TAGOH 2015-05-21 07:58:40 UTC
The above result might explains this weird issue:

$ fc-match :pixelsize=10:scalable=false:lang=en
helvR10-ISO8859-1.pcf.gz: "Helvetica" "Regular"
$ fc-match :pixelsize=12:scalable=false:lang=en
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"
$ fc-match :pixelsize=14:scalable=false:lang=en
helvR10-ISO8859-1.pcf.gz: "Helvetica" "Regular"
$ fc-match :pixelsize=16:scalable=false:lang=en
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"
$ fc-match :pixelsize=18:scalable=false:lang=en
helvR18-ISO8859-1.pcf.gz: "Helvetica" "Regular"

So if there are no requested sizes in fonts, it doesn't return the desired size of bitmap fonts here. though if applications doesn't restrict non-scalable fonts, it should fallback to the scalable fonts. that said if you say it is blurred, you may need to customize your config with hinting etc perhaps.

I'll take a look for that though, maybe good to check /proc/<pid>/maps to see what fonts are used for apps.

Comment 24 Akira TAGOH 2015-05-21 08:53:08 UTC
erm, false alarm. they were picking up in different dpi:

$ fc-match :pixelsize=10:scalable=false:lang=en -f "%{file}:%{family}-%{pixelsize}\n"
/usr/share/fonts/X11/75dpi/helvR10-ISO8859-1.pcf.gz:Helvetica-10
$ fc-match :pixelsize=12:scalable=false:lang=en -f "%{file}:%{family}-%{pixelsize}\n"
/usr/share/fonts/X11/75dpi/helvR12-ISO8859-1.pcf.gz:Helvetica-12
$ fc-match :pixelsize=14:scalable=false:lang=en -f "%{file}:%{family}-%{pixelsize}\n"
/usr/share/fonts/X11/100dpi/helvR10-ISO8859-1.pcf.gz:Helvetica-14
$ fc-match :pixelsize=16:scalable=false:lang=en -f "%{file}:%{family}-%{pixelsize}\n"
/usr/share/fonts/X11/100dpi/helvR12-ISO8859-1.pcf.gz:Helvetica-17
$ fc-match :pixelsize=18:scalable=false:lang=en -f "%{file}:%{family}-%{pixelsize}\n"
/usr/share/fonts/X11/75dpi/helvR18-ISO8859-1.pcf.gz:Helvetica-18

Comment 25 LiuYan 2015-05-28 17:33:10 UTC
Created attachment 1031353 [details]
Terminus font in Leafpad editor also blurred (MATE desktop). Zoom level 400%

Terminus font in Leafpad editor (and other applications) also blurred (MATE desktop)

Comment 26 Marco Giunta 2015-05-30 21:52:37 UTC
(In reply to Joachim Frieben from comment #22)
> Do not install package terminus-fonts system-wide but extract the PCF files
> and copy one file alone to $HOME/.fonts in increasing order removing the
> previous one. The right one will looks crisp at the desired size. This
> enabled me to use my favourite terminal (bitmap) font even under fedora 22.

Same problem here, after F22 upgrade: I'm using Terminus fonts and with Joachim Frieben's trick now I'm able to use it with 'gnome-terminal' and 'gedit'

Comment 27 LiuYan 2015-06-02 07:52:42 UTC
(In reply to Marco Giunta from comment #26)
> (In reply to Joachim Frieben from comment #22)
> > Do not install package terminus-fonts system-wide but extract the PCF files
> > and copy one file alone to $HOME/.fonts in increasing order removing the
> > previous one. The right one will looks crisp at the desired size. This
> > enabled me to use my favourite terminal (bitmap) font even under fedora 22.
> 
> Same problem here, after F22 upgrade: I'm using Terminus fonts and with
> Joachim Frieben's trick now I'm able to use it with 'gnome-terminal' and
> 'gedit'

It works for me too. But instead, I copyied 2 files with same size (ter-116n & ter-116b) to /usr/share/fonts/terminus.  If I copied ter-x??? fonts too, it still works, but if I copied ter-1?? fonts of other sizes, it will blur again. so weird...


Btw, terminus fonts in Fedora 22 only displayed as bitmap style only if the font-size is between 8pt to 10pt, other sizes will displayed blurred (using greyscale antialiasing).

Comment 28 Joachim Frieben 2015-06-02 08:13:23 UTC
(In reply to LiuYan from comment #27)
It seems to me that you have to provide the font files which correspond to the desired size such that fontconfig does not scale them up. Typical sizes of bitmap fonts in a terminal window are 14 px to 16 px high which corresponds to ter-116n. It seems that fontconfig will use a smaller font size if available and erroneously scale it up resulting in a blurred image instead of looking for the closest match.
Btw, I did not need to provide the bold version; the normal font was sufficient.

Comment 29 Fedora Update System 2015-06-02 09:38:08 UTC
fontconfig-2.11.94-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/fontconfig-2.11.94-1.fc22

Comment 30 LiuYan 2015-06-02 10:30:55 UTC
Thanks, fontconfig-2.11.94-1.fc22 fixed this bug. karma +1.

Comment 31 Marco Giunta 2015-06-02 19:48:34 UTC
(In reply to Fedora Update System from comment #29)
> fontconfig-2.11.94-1.fc22 has been submitted as an update for Fedora 22.
> https://admin.fedoraproject.org/updates/fontconfig-2.11.94-1.fc22

Yes, it works. Terminus font is back !!!

Comment 32 Fedora Update System 2015-06-04 20:15:57 UTC
Package fontconfig-2.11.94-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing fontconfig-2.11.94-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-9400/fontconfig-2.11.94-1.fc22
then log in and leave karma (feedback).

Comment 33 Fedora Update System 2015-06-05 23:53:48 UTC
fontconfig-2.11.94-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.