Bug 1164177 - fontconfig does not properly match Helvetica
Summary: fontconfig does not properly match Helvetica
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: fontconfig
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-14 09:23 UTC by Matt Hirsch
Modified: 2015-06-29 23:18 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-29 23:18:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
output of fc-match command with FC_DEBUG=3 (1.77 MB, text/plain)
2014-11-14 09:28 UTC, Matt Hirsch
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Launchpad 504235 0 None None None Never
Red Hat Bugzilla 226973 0 medium CLOSED Improper handling of genuine "Base35" font 2021-02-22 00:41:40 UTC

Description Matt Hirsch 2014-11-14 09:23:56 UTC
Description of problem: When asked to match Helvetica, fontconfig seems to match the narrowest variant installed on the system.


Version-Release number of selected component (if applicable):
fontconfig-2.11.0-2.fc20.x86_64
fontconfig-2.11.0-2.fc20.i686

How reproducible:
Always

Steps to Reproduce:
1. Have Helvetica, Helvetica-Narrow installed in /usr/share/fonts
2. $ fc-match Helvetica

Actual results:

$fc-match Helvetica
Helvetica-Narrow.ttf: "Helvetica" "Narrow"

Expected results:

$fc-match Helvetica
Helvetica.ttf: "Helvetica" "Regular"

Comment 1 Matt Hirsch 2014-11-14 09:28:21 UTC
Created attachment 957456 [details]
output of fc-match command with FC_DEBUG=3

$ export FC_DEBUG=3
$ fc-match Helvetica > fc-match-debug

Comment 2 Akira TAGOH 2014-11-17 09:14:51 UTC
According to the debugging log:
Font 120 Pattern has 22 elts (size 22)
	family: "Helvetica"(w) "Helvetica Narrow"(w)
	familylang: "en"(w) "en"(w)
	style: "Narrow"(w) "Regular"(w)
	stylelang: "en"(w) "en"(w)
	fullname: "Helvetica-Narrow"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 100(i)(w)
	width: 100(i)(w)
	foundry: "unknown"(w)
	file: "/usr/share/fonts/macos/Helvetica-Narrow.ttf"(w)
	index: 0(i)(w)
	outline: True(w)
	scalable: True(w)
	charset: 
	0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ff5fdffe ffffffff ffffffff
	0001: 00000000 00020000 000c0006 61000003 00040000 00000000 00000000 00000000
	0002: 00000000 00000000 00000000 00000000 00000000 00000000 3f0000c0 00000000
	0003: 00000000 00000000 00000000 00000000 00000000 10000000 00000000 00000000
	0020: 77180000 06010047 00000010 00000000 00000000 00001000 00000000 00000000
	0021: 00000000 00000004 00000000 00000000 00000000 00000000 00000000 00000000
	0022: 00040000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
	lang: aa|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|ts|uz|vo|vot|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(w)
	fontversion: 65536(i)(w)
	capability: "otlayout:latn"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	hash: "sha256:577eb1902dadf25d3714a054eee40a9d86c23646efd23b82aa71ca519a175fff"(w)
	postscriptname: "Helvetica-Narrow"(w)

 family: 1  "Helvetica"(s) "DejaVu Sans"(w) "PT Sans"(w) "Liberation Sans Narrow"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Carlito"(w) "Droid Sans"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "SimSun"(w) "PMingLiu"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "Mingzat"(w) "Padauk"(w) "Noto Sans Mandaic"(w) "Noto Sans Tai Tham"(w) "Noto Sans Tai Viet"(w) "Nuosu SIL"(w) "FreeSans"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w),  "Helvetica"(w) "Helvetica Narrow"(w)
 slant: 1  0(i)(s),  0(i)(w)
 weight: 1  100(i)(s),  100(i)(w)
 width: 1  100(i)(s),  100(i)(w)
 lang: 1  "en"(w),  aa|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|ts|uz|vo|vot|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(w)
 fontversion: 2.14742e+12  2147483647(i)(s),  65536(i)(w)
 decorative: 1  False(s),  False(w)
Score 0 0 0 0 0 0 1 0 1 12 0 0 0 0 1 1 1 1 0 0 0 2.14742e+12

Font 122 Pattern has 22 elts (size 22)
	family: "Helvetica"(w)
	familylang: "en"(w)
	style: "Regular"(w)
	stylelang: "en"(w)
	fullname: "Helvetica"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 100(i)(w)
	width: 100(i)(w)
	foundry: "unknown"(w)
	file: "/usr/share/fonts/macos/Helvetica.ttf"(w)
	index: 0(i)(w)
	outline: True(w)
	scalable: True(w)
	charset: 
	0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ff5fdffe ffffffff ffffffff
	0001: 00000000 00020000 000c0006 61000003 00040000 00000000 00000000 00000000
	0002: 00000000 00000000 00000000 00000000 00000000 00000000 3f0000c0 00000000
	0003: 00000000 00000000 00000000 00000000 00000000 10000000 00000000 00000000
	0020: 77180000 06010047 00000010 00000000 00000000 00001000 00000000 00000000
	0021: 00000000 00000004 00000000 00000000 00000000 00000000 00000000 00000000
	0022: 00040000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
	lang: aa|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|ts|uz|vo|vot|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(w)
	fontversion: 65536(i)(w)
	capability: "otlayout:latn"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	hash: "sha256:22e6b0ab68b66d28ed39ed3b4613cedb31e79a3bebeb025b1b4a1a6243766578"(w)
	postscriptname: "Helvetica"(w)

 family: 1  "Helvetica"(s) "DejaVu Sans"(w) "PT Sans"(w) "Liberation Sans Narrow"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Carlito"(w) "Droid Sans"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "SimSun"(w) "PMingLiu"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "Mingzat"(w) "Padauk"(w) "Noto Sans Mandaic"(w) "Noto Sans Tai Tham"(w) "Noto Sans Tai Viet"(w) "Nuosu SIL"(w) "FreeSans"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w) "sans-serif"(w),  "Helvetica"(w)
 slant: 1  0(i)(s),  0(i)(w)
 weight: 1  100(i)(s),  100(i)(w)
 width: 1  100(i)(s),  100(i)(w)
 lang: 1  "en"(w),  aa|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nds|nl|nn|no|nr|nso|oc|om|pt|rm|sma|smj|so|sq|ss|st|sv|sw|tl|tn|ts|uz|vo|vot|wa|xh|yap|zu|an|fil|ht|jv|kj|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(w)
 fontversion: 2.14742e+12  2147483647(i)(s),  65536(i)(w)
 decorative: 1  False(s),  False(w)
Score 0 0 0 0 0 0 1 0 1 12 0 0 0 0 1 1 1 1 0 0 0 2.14742e+12

Both has the same score on that query:
Score 0 0 0 0 0 0 1 0 1 12 0 0 0 0 1 1 1 1 0 0 0 2.14742e+12
Score 0 0 0 0 0 0 1 0 1 12 0 0 0 0 1 1 1 1 0 0 0 2.14742e+12

So that returns the first one. plus, apparently you have an alias of Helvetica for Helvetica-Narrow. this isn't a bug then.

For a workaround, you should drop Regular from style for Helvetica Narrow and set a style to the query to match on the better one.

<match target="scan">
  <test name="family"><string>Helvetica Narrow</string></test>
  <test name="style"><string>Regular</string></test>
  <edit name="style" mode="delete"/>
</match>

Comment 3 Matt Hirsch 2014-11-17 10:36:04 UTC
Akira,

Thanks for your explanation. I'm certainly not an expert on fonts or fontconfig, but it does seem like there might be a bug here. The font, as it comes from Adobe has the following fields set under "TTF Names" (according to fontforge):

Copyright: (copyright text)
Family: Helvetica Narrow
Styles (SubFamily): Regular
UniqueID: Helvetica Narrow:44711
Fullname: Helvetica-Narrow
Version: 003.001
Preferred Family: Helvetica
Preferred Styles: Narrow

I don't know if there is a standard for how these should be formally interprited. As they are written they make sense to me: this font is the "Regular" style for the narrow version of Helvetica. There are also bold, etc. styles of Narrow. fc-match is taking the style (apparently) from both the "Preferred Styles" field and the "Styles (SubFamily)" field and treating them the same way. For complex font families like Helvetica I can see why this causes problems.

Further, I have no alias on my system mapping Helvetica-Narrow to Helvetica, as you said. It would seem fc-match is getting that from the "Preferred Family" field. I can edit the font with fontforge to resolve both of those problems, but I don't think that's the right solution. We shouldn't ask everyone in Fedora to manually edit (or create fontconfig rules for) very standard fonts like Helvetica.

The bug I linked from launchpad would seem to indicate that Ubuntu is patching fontconfig to solve this problem.

Again, thanks for your consideration. I'd be interested to hear your thoughts, and perhaps re-open the bug?

Comment 4 Akira TAGOH 2014-11-18 04:25:33 UTC
Thanks for more information. let me take a look then.

Comment 5 Akira TAGOH 2014-11-19 02:52:44 UTC
(In reply to Matt Hirsch from comment #3)
> The bug I linked from launchpad would seem to indicate that Ubuntu is
> patching fontconfig to solve this problem.

There was no patches related to this issue in Ubuntu's. so what I can suggest to avoid this situation is, a) as I said the above comment, you could modify the cache with the fontconfig rule at comment#2. you don't even need to modify a font itself by the editor. b) add more pattern to narrow down the result.

> Further, I have no alias on my system mapping Helvetica-Narrow to Helvetica,
> as you said. It would seem fc-match is getting that from the "Preferred
> Family" field.

Yes, indeed fontconfig does. so the result against querying a font with that pattern is correct as long as a font has "Helvetica" as the family name.

As a result, I'm afraid I'd say it isn't a bug then.

Comment 6 Fedora End Of Life 2015-05-29 13:18:03 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-06-29 23:18:20 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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