Charles.Forsyth20060303-partialeea662d19 years agoHistory
111 lines · 2.3 KB · Text
RawDownload
.TH DRAW-FONT 2.SH NAMEFont \-character images for Unicode text.SH SYNOPSIS.EXinclude	"draw.m";draw := load Draw Draw->PATH; Font: adt{    name:    string;    height:  int;    ascent:  int;    display: ref Display;     open:    fn(d: ref Display, file:  string):        ref Font;    build:   fn(d: ref Display, name, desc: string):   ref Font;    width:   fn(f: self ref Font, str: string):        int;};.EE.SH DESCRIPTIONThe.B Fonttype defines the appearance of characters drawn with the.B Image.textprimitive (see.IR draw-image (2))..B Fontsare usually read from files and are selected based on theirsize, their style, the portion of Unicode space they represent,and so on..PPFonts are built from a series of subfonts that define contiguous portionsof the Unicode character space, such as the ASCII or theGreek alphabet.Font files are textual descriptions of the allocation of characters inthe various regions of the Unicode space; see.IR font (6)for the format.Subfonts are not visible from Limbo..PPA default font, named.BR *default* ,is always available..PPThe type incorporates:.TP 10.BR ascent ", " heightThese define the vertical sizesof the font, in pixels.The.B ascentis the distance from the font baseline to the top ofa line of text;.B heightgives the interline spacing, that is, the distance fromone baseline to the next..TP.B nameThis fieldidentifies the font, eitherthe name ofthe file from which the font was read, or.B"*default*"for the default font..TP.B displayTells on which display the font resides..TP.BI open( d\fP,\fP\ file\fP)The.B openmethod creates a.B Fontby reading the contents of the named.IR file .Fonts are cached, so an open request may return a pointer to anexisting.BR Font ,without rereading the file.The name.B"*default*"always describes a defined font.Fonts are created for an instance of a.B Displayobject, even though the creationfunctions are in type.BR Font ..TP.BI build( d\fP,\fP\ name\fP,\fP\ desc ).B Buildcreates a.B Fontobject by reading the description from the string.B descrather than a file..I Namespecifies the name of the font to be created..TP\f2f\fP\f5.width(\fP \f2str\fP \f5)\fPThe.B widthmethod returns the width in pixels that.I strwould occupy if drawn by.B Image.textin the Font.IR f .