Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Corrupt TrueType Font Detection

Tags:

fonts

truetype

I am at present dealing with a corrupt TrueType font. Programs available to me tell me there is a problem with the maxp table -- the maxContours member has a value that is too large. Is there a sure-fire way to detect when a maxContours value is too high or too low (yes that too can be a problem)? (Fonts are programs so one way to detect a font file is good is to execute them, but this is not an acceptable solution for me.)

I don't need a font library because I can't add one. I have already rolled my own TrueType font parser. What remains is to check if a given value of the above mentioned table is incorrect. I'll then add my parser and the checks to my product.

I don't have the option of rebuilding the font. I am a consumer -- I need to detect if the incoming font is corrupt or not and if it is bail out with as little work done as possible.

In case it helps -- I'm on Windows XP/Vista both 32 & 64 bit and their server versions!

like image 423
dirkgently Avatar asked Mar 05 '09 16:03

dirkgently


1 Answers

Rather than trying to detect errors, I've found it most convenient to just rebuild the trouble-font with FontForge. This can be completely automated, since it provides a rich command line and scripting API. Plus, You can transform the font into a more convenient format or encoding, if you need.

like image 109
SingleNegationElimination Avatar answered Oct 06 '22 21:10

SingleNegationElimination