Sign in Join
FPDoc Onlineexperiment

TIns_Metrics record

In unit TTObjs

Declaration

pascal
TIns_Metrics = record

Description

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

pointsizepublic
x_resolutionpublic
y_resolutionpublic
x_ppempublic
y_ppempublic
x_scale1public
x_scale2public
y_scale1public
y_scale2public
x_ratiopublic
y_ratiopublic
scale1public
scale2public
ppempublic
ratiopublic
compensationspublic
rotatedpublic
stretchedpublic

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.