fc-match does not select regular optical size
I have a font that comes in multiple optical sizes. These are specified as a suffix of the style, and they are called “Regular”, “Caption”, “Subhead”, and “Display”.
Here is what fc-scan
reports for the “Regular” optical size:
Pattern has 26 elts (size 32)
family: "Warnock Pro"(s)
familylang: "en"(s)
style: "Regular"(s)
stylelang: "en"(s)
fullname: "Warnock Pro"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 80(f)(s)
width: 100(f)(s)
foundry: "ADBE"(s)
file: "/usr/share/fonts/Warnock Pro/WarnockPro-Regular.otf"(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: ffffffff ffffffff ffffffff ffffffff 00040000 00000000 00001ff0 f00e0000
0002: 0f000000 00800000 02000000 00000000 00000000 00000000 3f0002c0 00000000
0003: 00000000 00000000 00000000 40000000 ffffd7f0 fffffffb 00037fff 00010000
0004: ffffdffe ffffffff dffeffff 003c000c 00030000 00000000 02000000 00000000
001e: 00000000 00000000 00000000 00000000 0000003f 00000000 00000000 000c0000
0020: 771d0000 06010077 00000010 e3f10000 000063ff 0000109a 00000000 00000000
0021: 00480000 00004044 78180000 00000000 00000000 00000000 00000000 00000000
0022: 46268044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
00e0: ffffffff ffffffff ffffffff ffffffff 1fffffff 00000000 00000000 00000000
00ef: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00ae6000
00f6: 00000000 ffbfff00 ffffdfff ffffffff ffffffff 3fffffff b1fffe08 fffefdff
00f7: 00000000 83ff0042 00000000 07ffffff 00000000 81108102 00000000 ff7fffff
00fb: 0000001f 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
lang: aa|af|av|ay|be|bg|bi|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|mg|mh|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
fontversion: 133365(i)(s)
capability: "otlayout:DFLT otlayout:cyrl otlayout:grek otlayout:latn"(s)
fontformat: "CFF"(s)
decorative: False(s)
postscriptname: "WarnockPro-Regular"(s)
color: False(s)
symbol: False(s)
variable: False(s)
fonthashint: False(s)
order: 0(i)(s)
And here is what fc-scan
reports for the “Caption” optical size:
Pattern has 26 elts (size 32)
family: "Warnock Pro"(s) "Warnock Pro Caption"(s)
familylang: "en"(s) "en"(s)
style: "Caption"(s) "Regular"(s)
stylelang: "en"(s) "en"(s)
fullname: "Warnock Pro Caption"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 80(f)(s)
width: 100(f)(s)
foundry: "ADBE"(s)
file: "/usr/share/fonts/Warnock Pro/WarnockPro-Capt.otf"(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: ffffffff ffffffff ffffffff ffffffff 00040000 00000000 00001ff0 f00e0000
0002: 0f000000 00800000 02000000 00000000 00000000 00000000 3f0002c0 00000000
0003: 00000000 00000000 00000000 40000000 ffffd7f0 fffffffb 00037fff 00010000
0004: ffffdffe ffffffff dffeffff 003c000c 00030000 00000000 02000000 00000000
001e: 00000000 00000000 00000000 00000000 0000003f 00000000 00000000 000c0000
0020: 771d0000 06010077 00000010 e3f10000 000063ff 0000109a 00000000 00000000
0021: 00480000 00004044 78180000 00000000 00000000 00000000 00000000 00000000
0022: 46268044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
00e0: ffffffff ffffffff ffffffff ffffffff 1fffffff 00000000 00000000 00000000
00ef: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00ae6000
00f6: 00000000 ffbfff00 ffffdfff ffffffff ffffffff 3fffffff b1fffe08 fffefdff
00f7: 00000000 83ff0042 00000000 07ffffff 00000000 81108102 00000000 ff7fffff
00fb: 0000001f 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
lang: aa|af|av|ay|be|bg|bi|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|mg|mh|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
fontversion: 133365(i)(s)
capability: "otlayout:DFLT otlayout:cyrl otlayout:grek otlayout:latn"(s)
fontformat: "CFF"(s)
decorative: False(s)
postscriptname: "WarnockPro-Capt"(s)
color: False(s)
symbol: False(s)
variable: False(s)
fonthashint: False(s)
order: 0(i)(s)
Now whichever query I write, I have not succeeded in writing a query that matches the first font file by style or name:
$ fc-match 'Warnock Pro:style=Regular'
WarnockPro-Capt.otf: "Warnock Pro" "Caption"
$ fc-match 'Warnock Pro:fullname=Warnock Pro Regular'
WarnockPro-Capt.otf: "Warnock Pro" "Caption"
$ fc-match 'Warnock Pro:fullname=Warnock Pro'
WarnockPro-Capt.otf: "Warnock Pro" "Caption"
$ fc-match 'Warnock Pro:style='
WarnockPro-Capt.otf: "Warnock Pro" "Caption"
$ fc-match 'Warnock Pro'
WarnockPro-Capt.otf: "Warnock Pro" "Caption"
Selecting by postscriptname
is so far the only thing that enabled me to select the right font, but this is unsuitable for me, because I’m building an application that selects font by name and style.
$ fc-match 'Warnock Pro:postscriptname=WarnockPro-Regular'
WarnockPro-Regular.otf: "Warnock Pro" "Regular"
It looks like “Regular” popping up in the -Capt file might be a problem? When I view the file in gnome-font-viewer
, it just says “Style: Caption”, there is no mention of “Regular”. According to otfinfo
, the difference is in the “Preferred subfamily” field, which otfinfo
does not print for -Regular file, but it does for the -Capt file:
$ otfinfo --info '/usr/share/fonts/Warnock Pro/WarnockPro-Regular.otf'
Family: Warnock Pro
Subfamily: Regular
Full name: WarnockPro-Regular
PostScript name: WarnockPro-Regular
Version: Version 2.035;PS 2.000;hotconv 1.0.51;makeotf.lib2.0.18671
Unique ID: 2.035;ADBE;WarnockPro-Regular
Designer: Robert Slimbach
Vendor URL: http://www.adobe.com/type
Trademark: Warnock is either a registered trademark or a trademark of Adobe Systems Incorporated in the United States and/or other countries.
Copyright: © 2000 Adobe Systems Incorporated. All rights reserved. Protected by U.S. Patents D454,152.
License URL: http://www.adobe.com/type/legal.html
Vendor ID: ADBE
$ otfinfo --info '/usr/share/fonts/Warnock Pro/WarnockPro-Capt.otf'
Family: Warnock Pro Caption
Subfamily: Regular
Full name: WarnockPro-Capt
PostScript name: WarnockPro-Capt
Preferred family: Warnock Pro
Preferred subfamily: Caption
Version: Version 2.035;PS 2.000;hotconv 1.0.51;makeotf.lib2.0.18671
Unique ID: 2.035;ADBE;WarnockPro-Capt
Designer: Robert Slimbach
Vendor URL: http://www.adobe.com/type
Trademark: Warnock is either a registered trademark or a trademark of Adobe Systems Incorporated in the United States and/or other countries.
Copyright: © 2000 Adobe Systems Incorporated. All rights reserved. Protected by U.S. Patents D454,152.
License URL: http://www.adobe.com/type/legal.html
Vendor ID: ADBE
Long story short, I think fc-match 'Warnock Pro:style=Regular'
should match WarnockPro-Regular.otf
, instead of matching WarnockPro-Capt.otf
; right now there doesn’t seem to be a way to match the -Regular font by specifying the style, whereas selecting a different optical size with :style=Display
does work.