Subfamilies with different OpenType 'size' should not be merged
Submitted by gm@..@..yx.org
Assigned to fon..@..op.org
Description
When a font comes in several variants of different sizes, in the sense of the opentype 'size' feature, fontconfig has a hard time loading the proper one. For now, fontconfig does not implement the opentype 'size' feature and maybe this is complicated and has been already decided against; in any case, in the current state, fonts with 'size' variants are completely unusable since we cannot choose which variant is going to be selected, and it appears to be chosen at random (examples below).
== Fonts I used for the tests (output of fc-list): ==
''' /home/user/.fonts/from adobe CS3/ArnoPro-Subhead.otf: Arno Pro,Arno Pro Subhead:style=Subhead,Regular /home/user/.fonts/from adobe CS3/ArnoPro-Caption.otf: Arno Pro,Arno Pro Caption:style=Caption,Regular /home/user/.fonts/from adobe CS3/ArnoPro-LightDisplay.otf: Arno Pro,Arno Pro Light Display:style=Light Display,Regular /home/user/.fonts/from adobe CS3/ArnoPro-SmText.otf: Arno Pro,Arno Pro SmText:style=SmText,Regular /home/user/.fonts/from adobe CS3/ArnoPro-Display.otf: Arno Pro,Arno Pro Display:style=Display,Regular /home/user/.fonts/from adobe CS3/ArnoPro-Regular.otf: Arno Pro:style=Regular '''
Contents of the 'size' feature:
''' $ otfinfo -z /home/user/.fonts/from\ adobe\ CS3/ArnoPro-Caption.otf design size 8 pt, size range (5.9 pt, 8.5 pt], subfamily ID 1, subfamily name Regular $ otfinfo -z /home/user/.fonts/from\ adobe\ CS3/ArnoPro-SmText.otf design size 10 pt, size range (8.5 pt, 11 pt], subfamily ID 1, subfamily name Regular $ otfinfo -z /home/user/.fonts/from\ adobe\ CS3/ArnoPro-Regular.otf design size 12 pt, size range (11 pt, 14 pt], subfamily ID 1, subfamily name Regular $ otfinfo -z /home/user/.fonts/from\ adobe\ CS3/ArnoPro-Subhead.otf design size 18 pt, size range (14 pt, 21.5 pt], subfamily ID 1, subfamily name Regular $ otfinfo -z /home/user/.fonts/from\ adobe\ CS3/ArnoPro-Display.otf design size 36 pt, size range (21.5 pt, 72 pt], subfamily ID 1, subfamily name Regular $ otfinfo -z /home/user/.fonts/from\ adobe\ CS3/ArnoPro-LightDisplay.otf design size 36 pt, size range (21.5 pt, 72 pt], subfamily ID 4, subfamily name Light '''
These fonts are not free but after writing the result of my tests I realised that all the problems below can be reproduced using the open source font EB Garamond (08 vs 12).
== Issues: ==
-
The gnome font selector (for instance in the preferences of gedit) shows all the fonts, but they all display the same as Arno Pro Caption, i.e. if one chooses Arno Pro Regular one gets Arno Pro Caption instead.
-
Inkscape only lists Arno Pro as a family. One can enter "Arno Pro Display" (and Caption, etc.) by hand, however this produces strange results: the metrics of Arno Pro Display are used, but the glyphs from the initial font are used. I noticed it used to work better in older versions of Inkscape (from Ubuntu 11.04, if my memory serves well).
-
LyX 2.2dev (based on qt) only shows "Arno Pro" as a choice in the Dialog. Moreover requesting the font "Arno Pro" with qt5 (QFont class) with various weights seems to select the variant randomly (the weight is an integer between 0 and 99): 0 (Ultra light): ArnoPro-Display.otf 1-37 (Light): ArnoPro-LightDisplay.otf 38-56 (Normal): ArnoPro-Display.otf 57-69 (Demi bold): ArnoPro-SmbdSubhead.otf 70-99 (Bold and black): ArnoPro-Bold.otf (i.e. the bold variant of size range (11 pt, 14 pt])
Only the bold weight produces the expected font.
This is the relevant fontconfig debug output when requesting "Arno Pro" in weight 50 with QFont in lyx:
''' FC_DEBUG=3: Match Pattern has 24 elts (size 32) family: "Arno Pro"(s) "DejaVu Sans"(w) "DejaVu LGC Sans"(w) "DejaVu LGC Sans"(w) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Nimbus Sans"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Laksaman"(w) "Noto Sans CJK JP"(w) "Noto Sans CJK SC"(w) "Noto Sans CJK TC"(w) "Khmer OS"(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) "DejaVu Sans"(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) "WenQuanYi Micro Hei"(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) familylang: "fr"(s) "en-us"(w) stylelang: "fr"(s) "en-us"(w) fullnamelang: "fr"(s) "en-us"(w) slant: 0(i)(s) weight: 80(i)(s) width: 100(i)(s) size: 25,92(f)(s) pixelsize: 27(f)(s) hintstyle: 3(i)(s) hinting: True(s) verticallayout: False(s) autohint: False(s) globaladvance: True(s) file: "/home/user/.fonts/from adobe CS3/ArnoPro-Display.otf"(s) index: 0(i)(s) lang: "fr"(w) fontversion: 2147483647(i)(s) embeddedbitmap: True(s) decorative: False(s) lcdfilter: 1(i)(w) namelang: "fr"(s) prgname: "part3"(s) symbol: False(s) '''
This seems to be the only relevant font appearing in the debug output, so I conclude that the wrong choice is made by fontconfig and not qt.
Also, do not be fooled by the requested size above which appears to match the size range of Display. The selection does not depend on the size, asking for a smaller size still gives the Display variant. And in this particular case, even obeying the opentype 'size' specification would produce wrong results since it does not take the local dpi into account (here, for size 25.9 the regular variant would be desired).
== Expected behaviour: ==
-
At the very least, the font selection should be consistent and preferably select the regular variant by default. However, it is hard to know for sure which one should be selected, because nothing in the opentype specification of the 'size' feature indicates that there must be a reference variant, such as Arno Pro Regular in the example of Arno Pro.
-
Preferably, Arno Pro Caption, Arno Pro SmText, Arno Pro Regular, Arno Pro Subhead, and Arno Pro Display should be recognised as distinct font families such that user interfaces would let the user choose every variant, and this variant should be correctly selected when asked for. (In the case of Arno Pro, they all come with bold, semi-bold and italic variants.)
-
Alternatively, the opentype 'size' feature should be implemented. However, the example of qt, above, where size 25.9 is requested while it looks like 12pt on screen shows that the 'size' feature is not viable without a way to fine-tune or disable the feature.
Implementing the opentype 'size' feature looks like a complicated enhancement. I think it is reasonable in the meanwhile to request a way to make fonts with 'size' variants at least usable.
I use the current Ubuntu 16.04 (fontconfig 2.11.94-0ubuntu1). Again, the bugs can be reproduced with EB Garamond 08 & 12 (in this case the qt (lyx 2.2dev) issue even worse, since EB Garamond Small Caps is rendered!).
Maybe related: bug #13416.
Version: 2.11