Font Bakery hinting error message: bit 3 of head table

Thanks! That worked.
Another failure I am seeing is about font hinting. It says it needs “bit 3 set on the flags of the head table so that PPEM values will be rounded into an integer value”.
I have the “Autohint” checked in GlyphsApp when exporting the font.

Here’s the error log:

{
"description": "PPEM must be an integer on hinted fonts.",
"key": [
"<Section: Google Fonts>",
"<FontBakeryCheck:com.google.fonts/check/integer_ppem_if_hinted>",
[
[
"font",
0
]
]
],
"logs": [
{
"message": "This is a hinted font, so it must have bit 3 set on the flags of the head table, so that PPEM values will be rounded into an integer value.\n\nThis can be accomplished by using the 'gftools fix-hinting' command.\n\n# create virtualenvpython3 -m venv venv\n# activate virtualenvsource venv/bin/activate\n# install gftoolspip install git+https://www.github.com/googlefonts/tools [code: bad-flags]",
"status": "FAIL",
"traceback": null
}
],
"rationale": "\n        Hinted fonts must have head table flag bit 3 set.\n\n        Per https://docs.microsoft.com/en-us/typography/opentype/spec/head, bit 3 of Head::flags decides whether PPEM should be rounded. This bit should always be set for hinted fonts.\n\n        Note:\n        Bit 3 = Force ppem to integer values for all internal scaler math;\n                May use fractional ppem sizes if this bit is clear;\n    ",
"result": "FAIL"
}

I have the gftools installed. But before running the gftools fix-hinting command on the ttf files, I am very curious to understand what the error exactly is and how can I fix it on my glyphs file (instead of on multiple ttf files)?

Appreciate the help.
Kedar

I moved the question to a new thread.

Did you read head - Font header table (OpenType 1.9) - Typography | Microsoft Learn as suggested in the error message?

It may be an omission in Glyphs (or ttfautohint) or an outdated suggestion of Font Bakery. The spec says literally:

Bit 3: Force ppem to integer values for all internal scaler math; may use fractional ppem sizes if this bit is clear;

Note that it does not say that it has to be set for hinted fonts. The bit not being set only allows scaling to fractional pixel sizes.

Which exact version of the app are you using? And which exact export settings? Manual or automatic hinting?

App versions:
GlyphsApp: v 2.6.5
FontBakery: v 0.7.31

I am selecting “AutoHint” when exporting. :white_check_mark:

OK, to be clear: this bit does NOT need to be set in a hinted font. The text from FontBakery is misleading. On modern screens and with modern OSes (anything in the past two decades), you do not need to round to full pixel edges. Only very specific applications may require that.

If you really want it to be set, you will need to post process the font with OTMaster or fonttools/ttx. But I strongly advice: If you want to improve the TT rendering, you need to test it on the screen first, and then fix what is broken, not the other way around.

Thanks for the reply. font-bakery is throwing the error for submission to google fonts.
I will try to make a submission nevertheless and see if their bot fails on this too.

I will update this thread with the information when I submit the font.
Please do not close this. Thanks.

For anyone having the same issue, here’s the solution summary:

  • Get gftools

  • Run gftools fix-hinting font-name.ttf
    This will generate a file: font-name.ttf.fix

  • Discard the font-name.ttf file and rename font-name.ttf.fix to font-name.ttf

To automate this for multiple files, here’s a bash script:

echo "Fixing Hinting"
for font in *.ttf
do
	gftools fix-hinting $font;
	if [ -f "$font.fix" ]; then mv "$font.fix" $font; fi
done

Be sure to be inside the same folder as the *.ttf files to avoid chmod issues.

3 Likes

this worked for me. Thanks

:+1: :+1:
You’re welcome.