Reputation: 26326
Is this a format that can be parsed by Python into a dict or some other data structure? And of course any format can be parsed, but I am wondering if this format is "known" and can be parsed by some existing library or does the parsing have to be hand written?
It is the output from requesting font info as provided by fc-scan
You can see here the output when I do:
fc-scan : family /usr/share/fonts/truetype/yaldevicolombo/YaldeviColombo-ExtraLight.ttf
(venv35) ubuntu@ip-10-0-0-196:~/font/fonts-master$ fc-scan : family /usr/share/fonts/truetype/yaldevicolombo/YaldeviColombo-ExtraLight.ttf
Pattern has 23 elts (size 32)
family: "Yaldevi Colombo ExtraLight"(s) "Yaldevi Colombo"(s)
familylang: "en"(s) "en"(s)
style: "Regular"(s) "ExtraLight"(s)
stylelang: "en"(s) "en"(s)
fullname: "Yaldevi Colombo ExtraLight"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 48(i)(s)
width: 100(i)(s)
foundry: "unknown"(s)
file: "/usr/share/fonts/truetype/yaldevicolombo/YaldeviColombo-ExtraLight.ttf"(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
0001: cfcff0ff 7ec3cc0c cfff31fe 7f0fcc3f 00040000 00000000 00000000 00000000
0002: 0f000000 00000000 00000000 00000000 00000000 00000000 3f0002c0 00000000
0003: 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
000d: 00000000 00000000 00000000 00000000 fc7fffec 2ffbffff ff5f847f 001c0000
0020: 77183000 06010047 00000010 00000000 00000000 24001000 00000000 00000000
0021: 00080000 00004044 00000000 00000000 00000000 00000000 00000000 00000000
0022: 46268044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
0025: 00000000 00000000 00000000 00000000 00000000 00000000 00001400 00000000
00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
lang: aa|ay|bi|br|bs|ch|co|cs|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|io|is|it|lb|lt|lv|mg|mh|nb|nds|nl|nn|no|nr|nso|oc|om|pl|pt|rm|ro|si|sk|sl|sma|smj|so|sq|ss|st|sv|sw|tk|tl|tn|tr|ts|uz|vo|vot|wa|wen|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|li|ms|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
fontversion: 66846(i)(s)
capability: "otlayout:DFLT otlayout:sinh"(s)
fontformat: "TrueType"(s)
decorative: False(s)
postscriptname: "YaldeviColombo-ExtraLight"(s)
color: False(s)
symbol: False(s)
(venv35) ubuntu@ip-10-0-0-196:~/font/fonts-master$
Upvotes: 0
Views: 142
Reputation: 189357
No, this looks like a completely ad-hoc human-readable output format specific to this particular mode of this precise tool. Parsing the original .ttf
file is probably a more fruitful approach.
Upvotes: 1
Reputation: 24181
.ttf
files can be manipulated (and converted to/from xml) with python using the fontTools
library:
https://pypi.python.org/pypi/FontTools
from fontTools.ttLib import TTFont
font_path = "/usr/share/fonts/truetype/yaldevicolombo/YaldeviColombo-ExtraLight.ttf"
font = TTFont(font_path)
print(font)
<fontTools.ttLib.TTFont object at 0x10c34ed50>
Upvotes: 0