Hello.
How to get the values of "created" and "modified" using Python and fonttools?
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="4.0"/>
<checkSumAdjustment value="0x160025c"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00001011"/>
<unitsPerEm value="1000"/>
<created value="Thu Jul 25 11:21:21 2013"/>
<modified value="Thu Apr 5 15:06:34 2018"/>
<xMin value="-166"/>
<yMin value="-248"/>
<xMax value="1085"/>
<yMax value="973"/>
<macStyle value="00000000 00000001"/>
<lowestRecPPEM value="9"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
Thanks in advance for your reply!
from fontTools.ttLib import TTFont
f = TTFont('path/to/my/font.otf')
print(f['head'].modified)
Thank you, but this way gives the answer - "3605785594"
If we convert it to a "human-readable date", we get "Wed Apr 5 15:06:34 2084".
Date in ttx file - "Thu Apr 5 15:06:34 2018"
Maybe you know why the year is different? (2084 vs 2018)?
This is the time where you should go to the spec and read up on the details: https://docs.microsoft.com/en-us/typography/opentype/spec/head
And/or read the fontTools source code, to see how it's used: https://github.com/fonttools/fonttools/blob/fbf2b960ccf6a003605d77d01ffe09dc1ff502f3/Lib/fontTools/ttLib/tables/_h_e_a_d.py#L81 and https://github.com/fonttools/fonttools/blob/fbf2b960ccf6a003605d77d01ffe09dc1ff502f3/Lib/fontTools/misc/timeTools.py#L43
Many thanks, Justvanrossum!
For your programs and for your help. You are a great man!
Happy New Year!