For those AFDKO users who use, plan to use, or would like to explore the broad capabilities of its tx tool, here’s a command line that is very useful when building new versions of existing fonts, especially when only a small number of glyphs have changed:
% tx -bc -sha1 -z 400 <font_file>
The <font_file> portion of the command line can be any type of font file, such as an OpenType font, a CFF resource, a CIDFont resource, or a name-keyed Type 1 font.
What this command line produces is a 40-character SHA-1 hash value for each glyph based on its rendering at 400 pixels. After much testing, I have found that the 400-pixel value provides the greatest sensitivity. In other words, if the rendered 400-pixel bitmap is the same for two glyphs, the SHA-1 hash value will be the same.
Below is an excerpt from running this command line on AdobeHeitiStd-Regular, which is an Adobe-GB1-5 ROS OpenType/CFF font that has 30,284 glyphs:
font AdobeHeitiStd-Regular (400 ppem)
glyph 8c10b6d90142c44f4187d93b2d12014ff6790cc0 \0
glyph 41e8445c497b89d636e8047b5fd2fa8debe24cef \1
glyph cf707b65914bfc0d9298e97141e2bc990471fcbd \2
glyph af7a4cfbc3ecfe9a43bddd5c760c93f708a25489 \3
glyph d13c41387953ad4d76e77a50945b8fb2ab9e3d0d \4
<30,274 lines omitted>
glyph 8b4830ad84d3f2014730bc4327098e53e9bb954f \30279
glyph 3c2d8e897ccdbcd6112a79998b5e27f287f749f8 \30280
glyph c4a3fcf87bdea5c2ef70bc733f0e39ed8ea40650 \30281
glyph 3dd0700f6ed3f8f8d5d5956efdeaa70946c96058 \30282
glyph 14abb6b2f0615d8dc13b0ca723afc86c8fa82fff \30283
If I were to modify a glyph, say the one for CID+4162 (U+4E00; 一), such that its 400-pixel bitmap were to change, the result would be a different SHA-1 hash value. Consider the following two command lines:
% tx -bc -sha1 -z 400 AdobeHeitiStd-Regular.otf.OLD > old
% tx -bc -sha1 -z 400 AdobeHeitiStd-Regular.otf > new
If we were to perform a diff on the two files that were written to STDOUT, old and new, we would immediately know which glyphs have changed between the previous version of the font (AdobeHeitiStd-Regular.otf.OLD) and the current version (AdobeHeitiStd-Regular.otf):
% diff old new
glyph 9f700c5c93fe559d237a9c3602b071beece45a56 \4162
As you can see, this tx command line can be used to streamline the testing of new versions of existing fonts when a small number of glyphs have changed. When dealing with fonts that include thousands or tens of thousands of glyphs, this command line allows testing, at least for the ‘CFF’ table of OpenType/CFF fonts, to be significantly streamlined.