Method FromFontUnits
- Namespace
- DocWright.Core.Primitives
- Assembly
- DocWright.Core.dll
FromFontUnits(int, int, Twips)
Converts a length in font design units to twips for a given em size, using integer
arithmetic with round-half-away-from-zero: funits * emSize / unitsPerEm.
This is the single sanctioned funit conversion (Microsoft OpenType specification,
"Converting FUnits to pixels", adapted to twips).
public static Twips FromFontUnits(int fontUnits, int unitsPerEm, Twips emSize)
Parameters
fontUnitsintThe length in font design units. May be negative.
unitsPerEmintThe font's unitsPerEm (from the head table). Must be positive.
emSizeTwipsThe em size (font size) in twips.
Returns
- Twips
The equivalent length in twips.
Exceptions
- ArgumentOutOfRangeException
unitsPerEmis not positive.