freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] On units_per_EM in the Type 1 and CFF drivers


From: Tom Kacvinsky
Subject: [Devel] On units_per_EM in the Type 1 and CFF drivers
Date: Wed, 24 Jan 2001 10:10:12 -0500 (EST)

Hi all,

I came up with a heuristic for determining the units_per_EM for a particular
font based on the FontMatrix.  I have already checked in the changes for the
Type 1 driver, and attached are patches for the CFF driver (for pure CFF fonts
only -- OpenType/CFF and CEF fonts have a units per em field in one of the
tables in the font that is correct for that font).  I had to make a minor change
to cfftypes.h in order to get the information passed along from matrix parsing
function (cff_parse_font_matrix), and I also had to add a number parsing routine
(really, just grab a real number and multiply by 1000, in order to overcome some
problems with moving a real number into a FT_Fixed variable).

My only problem is this: I currently use the fourth field of the FontMatrix to
get the units_per_Em value.  This is not quite right, because the FontMatrix for
a font can be used for rotation, translation, skewing, etc..., all of which
might make the fourth value not properly reflect the fonts units_per_EM.  Most
foundries are shipping fonts with "standard" font matrices, but in light of
Distiller produced PFAs (and "weird" font matrices that might ensue), I am
concerned that my heuristic will fail in certain cases...

We could decompose the font matrix into a scale, rotation, skew, etc... 
matrices,
but the decomposition might now be unique, and we would also have to use
floating point numbers (think of arctan, etc...).  Given that FreeType uses
mostly 16.16 fixed numbers for real numbers, I think the latter is a stumbling
block.  Also, I am not sure if the scale matrix (which is what we need for
units_per_EM) that would ensue from such a decomposition would accurately
reflect the scaling used in the font.

Let me know what you think.

Tom

Attachment: cffobjs.diff
Description: Text document

Attachment: cffparse.diff
Description: Text document

Attachment: cfftypes.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]