]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/text/freetype/freetype-docs.factor
Add foreground and background color slots to font tuple
[factor.git] / basis / ui / text / freetype / freetype-docs.factor
1 USING: help.syntax help.markup strings kernel alien opengl
2 opengl.sprites quotations ui.render ui.text ui.text.private
3 freetype ;
4 IN: ui.text.freetype
5
6 HELP: freetype
7 { $values { "alien" alien } }
8 { $description "Outputs a native handle used by the FreeType library, initializing FreeType first if necessary." } ;
9
10 HELP: open-fonts
11 { $var-description "Global variable. Hashtable mapping font descriptors to " { $link freetype-font } " instances." } ;
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 HELP: freetype-font
18 { $class-description "A font which has been loaded by FreeType." } ;
19
20 HELP: close-freetype
21 { $description "Closes the FreeType library." }
22 { $notes "Do not call this word if you are using the UI." } ;
23
24 HELP: open-face
25 { $values { "font" freetype-font } { "face" "alien pointer to an " { $snippet "FT_Face" } } }
26 { $description "Loads a TrueType font with the requested logical font name and style." } ;
27
28 HELP: render-glyph
29 { $values  { "font" freetype-font } { "char" "a non-negative integer" } { "bitmap" alien } }
30 { $description "Renders a character and outputs a pointer to the bitmap." } ;
31
32 HELP: <char-sprite>
33 { $values { "font" freetype-font } { "char" "a non-negative integer" } { "sprite" sprite } }
34 { $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 } "." } ;
35
36 HELP: (draw-string)
37 { $values { "font" freetype-font } { "sprites" "a vector of " { $link sprite } " instances" } { "string" string } { "loc" "a pair of integers" } }
38 { $description "Draws a line of text." }
39 { $notes "This is a low-level word, UI code should use " { $link draw-string } " or " { $link draw-text } " instead." }
40 { $side-effects "sprites" } ;
41
42 HELP: run-char-widths
43 { $values { "font" freetype-font } { "string" string } { "widths" "a sequence of integers" } }
44 { $description "Outputs a sequence of x co-ordinates of the midpoint of each character in the string." }
45 { $notes "This word is used to convert x offsets to document locations, for example when the user moves the caret by clicking the mouse." } ;