Table of Contents

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

fontUnits int

The length in font design units. May be negative.

unitsPerEm int

The font's unitsPerEm (from the head table). Must be positive.

emSize Twips

The em size (font size) in twips.

Returns

Twips

The equivalent length in twips.

Exceptions

ArgumentOutOfRangeException

unitsPerEm is not positive.