TIns_Metrics record
Declaration
TIns_Metrics = recordDescription
A note regarding non-squared pixels:
(This text will probably go into some docs at some time, for now, it is kept there to explain some definitions in the TIns_Metrics record).
The CVT is a one-dimensional array containing values that control certain important characteristics in a font, like the height of all capitals, all lowercase letter, default spacing or stem width/height.
These values are found in FUnits in the font file, and must be scaled to pixel coordinates before being used by the CVT and glyph programs. Unfortunately, when using distinct x and y resolutions ( or distinct x and y pointsizes ), there are two possible scalings.
A first try was to implement a 'lazy' scheme were all values were scaled when first used. However, some values are always used in the same direction, and some other are used in many different circumstances and orientations.
I have found a simpler way to do the same, and it even seems to work in most of the cases:
- All CVT values are scaled to the maximum ppem size.
- When performing a read or write in the CVT, a ratio factor is used to perform adequate scaling.
Example:
x_ppem = 14
y_ppem = 10
We chose ppem = x_ppem = 14 as the CVT scaling size. All CVT entries are scaled to it.
x_ratio = 1.0
y_ratio = y_ppem/ppem (<1.0)
We compute the current ratio like:
- if projVector is horizontal, ratio = x_ratio = 1.0
- if projVector is vertical, ratop = y_ratio
- else, ratio = sqrt( (proj.x*x_ratio)**2+(proj.y*y_ratio)**2 )
Reading a CVT value returns:
ratio*cvt[index]
Writing a CVT value in pixels:
cvt[index]/ratio
The current ppem is simple:
ratio*ppem
Fields
pointsize | public | |
x_resolution | public | |
y_resolution | public | |
x_ppem | public | |
y_ppem | public | |
x_scale1 | public | |
x_scale2 | public | |
y_scale1 | public | |
y_scale2 | public | |
x_ratio | public | |
y_ratio | public | |
scale1 | public | |
scale2 | public | |
ppem | public | |
ratio | public | |
compensations | public | |
rotated | public | |
stretched | public |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
