]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/text/text-docs.factor
docs: change $subsection to $subsections
[factor.git] / basis / ui / text / text-docs.factor
1 IN: ui.text
2 USING: help.markup help.syntax kernel ui.text.private strings math fonts ;
3
4 HELP: string-width
5 { $values { "font" font } { "string" string } { "w" "a positive integer" } }
6 { $contract "Outputs the width of a string." }
7 { $notes "This is a low-level word; use " { $link text-width } " instead." } ;
8
9 HELP: text-width
10 { $values { "font" font } { "text" "a string or sequence of strings" } { "w" "a positive integer" } }
11 { $description "Outputs the width of a piece of text." } ;
12
13 HELP: string-height
14 { $values { "font" font } { "string" string } { "h" "a positive integer" } }
15 { $contract "Outputs the height of a string." }
16 { $notes "This is a low-level word; use " { $link text-height } " instead." } ;
17
18 HELP: text-height
19 { $values { "font" font } { "text" "a string or sequence of strings" } { "h" "a positive integer" } }
20 { $description "Outputs the height of a piece of text." } ;
21
22 HELP: string-dim
23 { $values { "font" font } { "string" string } { "dim" "a pair of integers" } }
24 { $contract "Outputs the dimensions of a string." }
25 { $notes "This is a low-level word; use " { $link text-dim } " instead." } ;
26
27 HELP: text-dim
28 { $values { "font" font } { "text" "a string or sequence of strings" } { "dim" "a pair of integers" } }
29 { $description "Outputs the dimensions of a piece of text, which is either a single-line string or an array of lines." } ;
30
31 HELP: draw-string
32 { $values { "font" font } { "string" string } }
33 { $contract "Draws a line of text." } ;
34
35 HELP: draw-text
36 { $values { "font" font } { "text" "a string or an array of strings" } }
37 { $description "Draws a piece of text." } ;
38
39 HELP: x>offset
40 { $values { "x" real } { "font" font } { "string" string } { "n" integer } }
41 { $contract "Outputs the string index closest to the given x co-ordinate." } ;
42
43 HELP: offset>x
44 { $values { "n" integer } { "font" font } { "string" string } { "x" real } }
45 { $contract "Outputs the x co-ordinate of the character at the given index." } ;
46
47 HELP: line-metrics
48 { $values { "font" font } { "string" string } { "metrics" line-metrics } }
49 { $contract "Outputs a " { $link metrics } " object with text measurements." } ;
50
51 ARTICLE: "text-rendering" "Rendering text"
52 "The " { $vocab-link "ui.text" } " vocabulary provides a cross-platform interface to the operating system's native font rendering engine. Currently, it uses Core Text on Mac OS X and FreeType on Windows and X11."
53 { $subsections "fonts" }
54 "Measuring text:"
55 { $subsections
56     text-dim
57     text-width
58     text-height
59     line-metrics
60 }
61 "Converting screen locations to string offsets, and vice versa:"
62 { $subsections
63     x>offset
64     offset>x
65 }
66 "Rendering text:"
67 { $subsections draw-text }
68 "Low-level text protocol for UI backends:"
69 { $subsections
70     string-width
71     string-height
72     string-dim
73     draw-string
74 } ;
75
76 ABOUT: "text-rendering"