1 USING: help.markup help.syntax io.streams.plain io strings
5 ARTICLE: "character-styles" "Character styles"
6 "Character styles for " { $link stream-format } " and " { $link with-style } ":"
7 { $subsection foreground }
8 { $subsection background }
10 { $subsection font-size }
11 { $subsection font-style }
12 { $subsection presented } ;
14 ARTICLE: "paragraph-styles" "Paragraph styles"
15 "Paragraph styles for " { $link with-nesting } ":"
16 { $subsection page-color }
17 { $subsection border-color }
18 { $subsection border-width }
19 { $subsection wrap-margin }
20 { $subsection presented } ;
22 ARTICLE: "table-styles" "Table styles"
23 "Table styles for " { $link tabular-output } ":"
24 { $subsection table-gap }
25 { $subsection table-border } ;
28 { $values { "str" string } { "obj" "an object" } }
29 { $description "Writes a string to " { $link output-stream } ", associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." }
32 ARTICLE: "presentations" "Presentations"
33 "The " { $link presented } " style can be used to emit clickable objects. A utility word for outputting this style:"
34 { $subsection write-object } ;
36 ARTICLE: "styles" "Formatted output"
37 "The " { $link stream-format } ", " { $link with-style } ", " { $link with-nesting } " and " { $link tabular-output } " words take a hashtable of style attributes. Output stream implementations are free to ignore style information."
39 "Style hashtables are keyed by symbols from the " { $vocab-link "io.styles" } " vocabulary."
40 { $subsection "character-styles" }
41 { $subsection "paragraph-styles" }
42 { $subsection "table-styles" }
43 { $subsection "presentations" } ;
48 { $description "A value for the " { $link font-style } " character style denoting plain text." } ;
51 { $description "A value for the " { $link font-style } " character style denoting boldface text." } ;
54 { $description "A value for the " { $link font-style } " character style denoting italicized text." } ;
57 { $description "A value for the " { $link font-style } " character style denoting boldface italicized text." } ;
60 { $description "Character style. Text color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
64 " \"Hello world\" swap"
65 " { 0.1 0.1 0.2 1 } n*v { 1 1 1 1 } vmin"
66 " foreground associate format nl"
72 { $description "Character style. Background color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
76 " \"Hello world\" swap"
77 " { 0.1 0.4 0.1 } n*v { 1 1 1 } vmin { 1 } append"
78 " background associate format nl"
84 { $description "Character style. Font family named by a string." }
86 "This example outputs some different font sizes:"
87 { $code "{ \"monospace\" \"serif\" \"sans-serif\" }\n[ dup font associate format nl ] each" }
91 { $description "Character style. Font size, an integer." }
93 "This example outputs some different font sizes:"
94 { $code "{ 12 18 24 72 }"
95 "[ \"Bigger\" swap font-size associate format nl ] each"
100 { $description "Character style. Font style, one of " { $link plain } ", " { $link bold } ", " { $link italic } ", or " { $link bold-italic } "." }
102 "This example outputs text in all three styles:"
103 { $code "{ plain bold italic bold-italic }\n[ [ name>> ] keep font-style associate format nl ] each" }
107 { $description "Character and paragraph style. An object associated with the text. In the Factor UI, this is shown as a clickable presentation of the object; left-clicking invokes a default command, and right-clicking shows a menu of commands." } ;
110 { $description "Character and paragraph style. An editable object associated with the text. In the Factor UI, this is shown as a clickable presentation of the object path together with an expander button which displays an object editor; left-clicking invokes a default command, and right-clicking shows a menu of commands." } ;
112 HELP: presented-printer
113 { $description "Character and paragraph style. A quotation with stack effect " { $snippet "( obj -- )" } " which is applied to the value at the " { $link presented-path } " if the presentation needs to be re-displayed after the object has been edited." } ;
116 { $description "Paragraph style. Background color of the paragraph block, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
118 { $code "H{ { page-color { 1 0.8 0.5 1 } } }\n[ \"A background\" write ] with-nesting nl" }
122 { $description "Paragraph style. Border color of the paragraph block, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
124 { $code "H{ { border-color { 1 0 0 1 } } }\n[ \"A border\" write ] with-nesting nl" }
128 { $description "Paragraph style. Pixels between edge of text and border color, an integer." }
130 { $code "H{ { border-width 10 } }\n[ \"Some inset text\" write ] with-nesting nl" }
134 { $description "Paragraph style. Pixels between left margin and right margin where text is wrapped, an integer." } ;
136 { wrap-margin bl } related-words
139 { $description "Table style. Horizontal and vertical gap between table cells, denoted by a pair of integers." } ;
141 { table-gap table-border stream-write-table tabular-output } related-words
144 { $description "Table style. Color of the border drawn between cells, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." } ;
147 { $class-description "Class of input text presentations. Instances can be used passed to " { $link write-object } " to output a clickable piece of input. Input text presentations are created by calling " { $link <input> } "." }
149 "This presentation class is used for the code examples you see in the online help:"
150 { $code "\"2 3 + .\" dup <input> write-object nl" }
153 HELP: <input> ( string -- input )
154 { $values { "string" string } { "input" input } }
155 { $description "Creates a new " { $link input } "." } ;
157 HELP: standard-table-style
158 { $values { "style" hashtable } }
159 { $description "Outputs a table style where cells are separated by 5-pixel gaps and framed by a light gray border. This style can be passed to " { $link tabular-output } "." } ;