diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 20:52:35 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 20:52:35 +0000 |
| commit | 46439007cf417cbd9ac8049bb4122c890097a0fa (patch) | |
| tree | 6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /man/2/draw-font | |
| parent | 37da2899f40661e3e9631e497da8dc59b971cbd0 (diff) | |
20060303-partial
Diffstat (limited to 'man/2/draw-font')
| -rw-r--r-- | man/2/draw-font | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/man/2/draw-font b/man/2/draw-font new file mode 100644 index 00000000..c68d0ef4 --- /dev/null +++ b/man/2/draw-font @@ -0,0 +1,111 @@ +.TH DRAW-FONT 2 +.SH NAME +Font \- +character images for Unicode text +.SH SYNOPSIS +.EX +include "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 DESCRIPTION +The +.B Font +type defines the appearance of characters drawn with the +.B Image.text +primitive (see +.IR draw-image (2)). +.B Fonts +are usually read from files and are selected based on their +size, their style, the portion of Unicode space they represent, +and so on. +.PP +Fonts are built from a series of subfonts that define contiguous portions +of the Unicode character space, such as the ASCII or the +Greek alphabet. +Font files are textual descriptions of the allocation of characters in +the various regions of the Unicode space; see +.IR font (6) +for the format. +Subfonts are not visible from Limbo. +.PP +A default font, named +.BR *default* , +is always available. +.PP +The type incorporates: +.TP 10 +.BR ascent ", " height +These define the vertical sizes +of the font, in pixels. +The +.B ascent +is the distance from the font baseline to the top of +a line of text; +.B height +gives the interline spacing, that is, the distance from +one baseline to the next. +.TP +.B name +This field +identifies the font, either +the name of +the file from which the font was read, or +.B +"*default*" +for the default font. +.TP +.B display +Tells on which display the font resides. +.TP +.BI open( d\fP,\fP\ file\fP) +The +.B open +method creates a +.B Font +by reading the contents of the named +.IR file . +Fonts are cached, so an open request may return a pointer to an +existing +.BR Font , +without rereading the file. +The name +.B +"*default*" +always describes a defined font. +Fonts are created for an instance of a +.B Display +object, even though the creation +functions are in type +.BR Font . +.TP +.BI build( d\fP,\fP\ name\fP,\fP\ desc ) +.B Build +creates a +.B Font +object by reading the description from the string +.B desc +rather than a file. +.I Name +specifies the name of the font to be created. +.TP +\f2f\fP\f5.width(\fP \f2str\fP \f5)\fP +The +.B width +method returns the width in pixels that +.I str +would occupy if drawn by +.B Image.text +in the Font +.IR f . |
