]> gitweb.factorcode.org Git - factor.git/blob - extra/ui/freetype/freetype-docs.factor
Initial import
[factor.git] / extra / ui / freetype / freetype-docs.factor
1 USING: help.syntax help.markup ui.freetype strings kernel
2 alien opengl quotations ui.render io.styles ;
3
4 HELP: freetype
5 { $values { "alien" alien } }
6 { $description "Outputs a native handle used by the FreeType library, initializing FreeType first if necessary." } ;
7
8 HELP: open-fonts
9 { $var-description "Global variable. Hashtable mapping font descriptors to " { $link font } " instances." } ;
10
11 { font open-fonts open-font char-width string-width text-dim draw-string draw-text } related-words
12
13 HELP: init-freetype
14 { $description "Initializes the FreeType library." }
15 { $notes "Do not call this word if you are using the UI." } ;
16
17 USE: ui.freetype
18
19 HELP: font
20 { $class-description "A font which has been loaded by FreeType. Font instances have the following slots:"
21     { $list
22         { { $link font-ascent } ", " { $link font-descent } ", " { $link font-height } " - metrics." }
23         { { $link font-handle } " - alien pointer to an " { $snippet "FT_Face" } "." }
24         { { $link font-widths } " - sequence of character widths. Use " { $link char-width } " and " { $link string-width } " to compute string widths instead of reading this sequence directly." }
25     }
26 } ;
27
28 HELP: close-freetype
29 { $description "Closes the FreeType library." }
30 { $notes "Do not call this word if you are using the UI." } ;
31
32 HELP: open-face
33 { $values { "font" string } { "style" "one of " { $link plain } ", " { $link bold } ", " { $link italic } " or " { $link bold-italic } } { "face" "alien pointer to an " { $snippet "FT_Face" } } }
34 { $description "Loads a TrueType font with the requested logical font name and style." }
35 { $notes "This is a low-level word. Call " { $link open-font } " instead." } ;
36
37 HELP: render-glyph
38 { $values  { "font" font } { "char" "a non-negative integer" } { "bitmap" alien } }
39 { $description "Renders a character and outputs a pointer to the bitmap." } ;
40
41 HELP: <char-sprite>
42 { $values { "font" font } { "char" "a non-negative integer" } { "sprite" sprite } }
43 { $description "Renders a character to an OpenGL texture and records a display list which draws a quad with this texture. This word allocates native resources which must be freed by " { $link free-sprites } "." } ;
44
45 HELP: (draw-string)
46 { $values { "open-font" font } { "sprites" "a vector of " { $link sprite } " instances" } { "string" string } { "loc" "a pair of integers" } }
47 { $description "Draws a line of text." }
48 { $notes "This is a low-level word, UI code should use " { $link draw-string } " or " { $link draw-text } " instead." }
49 { $side-effects "sprites" } ;
50
51 HELP: run-char-widths
52 { $values { "open-font" font } { "string" string } { "widths" "a sequence of integers" } }
53 { $description "Outputs a sequence of x co-ordinates of the midpoint of each character in the string." }
54 { $notes "This word is used to convert x offsets to document locations, for example when the user moves the caret by clicking the mouse." } ;