VFonts.mesa; Written by S. McGregor
Last Edited by McGregor, July 21, 1983 10:54 am
DIRECTORY
Real USING [RoundI],
Rope USING [ROPE],
UnifiedFonts;
VFonts: CEDAR DEFINITIONS IMPORTS Real, UnifiedFonts = BEGIN
This interface is for syntactic sugaring of UnifiedFonts.
Font: TYPE = UnifiedFonts.FONT;
EstablishFont: PROC [family: Rope.ROPE, size: CARDINAL, bold, italic: BOOLFALSE, defaultOnFailure: BOOLTRUE] RETURNS [Font] ;
FontAscent: PROC [font: Font] RETURNS [ascent: INTEGER] = INLINE
{RETURN[Real.RoundI[UnifiedFonts.FontBoundingBox[font].ymax]]};
FontHeight: PROC [font: Font] RETURNS [height: INTEGER] = INLINE
{RETURN[Real.RoundI[UnifiedFonts.FontBoundingBox[font].ymax-UnifiedFonts.FontBoundingBox[font].ymin]]};
CharWidth: PROC [char: CHAR, font: Font ← defaultFont] RETURNS [width: INTEGER] = INLINE
{RETURN[Real.RoundI[UnifiedFonts.Width[font, char]]]};
RopeWidth: PROC [rope: Rope.ROPE, font: Font ← defaultFont] RETURNS [width: INTEGER] =
INLINE{RETURN[UnifiedFonts.RoundedTextWidth[font, rope]]};
defaultFont: Font;
END.