VFonts.mesa; Written by S. McGregor
Last Edited by McGregor, July 21, 1983 10:54 am
Last Edited by Wyatt, September 30, 1983 4:00 pm
DIRECTORY
Font USING [FONT, FontBoundingBox, RoundedTextWidth, Width],
Real USING [RoundI],
Rope USING [ROPE];
VFonts: CEDAR DEFINITIONS
IMPORTS Font, Real
= BEGIN
This interface is for syntactic sugaring of the Font interface.
FONT: TYPE = Font.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[Font.FontBoundingBox[font].ymax]]};
FontHeight: PROC [font: FONT] RETURNS [height: INTEGER] = INLINE
{RETURN[Real.RoundI[Font.FontBoundingBox[font].ymax-Font.FontBoundingBox[font].ymin]]};
CharWidth: PROC [char: CHAR, font: FONT ← defaultFont] RETURNS [width: INTEGER] = INLINE
{RETURN[Real.RoundI[Font.Width[font, char]]]};
RopeWidth: PROC [rope: Rope.ROPE, font: FONT ← defaultFont] RETURNS [width: INTEGER] =
INLINE{RETURN[Font.RoundedTextWidth[font, rope]]};
defaultFont: FONT;
END.