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 } ;
27 ARTICLE: "presentations" "Presentations"
28 "The " { $link presented } " style can be used to emit clickable objects. The " { $link write-object } " word should be used instead of setting this directly." ;
30 ARTICLE: "styles" "Formatted output"
31 "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."
33 "Style hashtables are keyed by symbols from the " { $vocab-link "styles" } " vocabulary."
34 { $subsection "character-styles" }
35 { $subsection "paragraph-styles" }
36 { $subsection "table-styles" }
37 { $subsection "presentations" } ;
42 { $description "A value for the " { $link font-style } " character style denoting plain text." } ;
45 { $description "A value for the " { $link font-style } " character style denoting boldface text." } ;
48 { $description "A value for the " { $link font-style } " character style denoting italicized text." } ;
51 { $description "A value for the " { $link font-style } " character style denoting boldface italicized text." } ;
54 { $description "Character style. Text color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
58 " \"Hello world\" swap"
59 " { 0.1 0.1 0.2 1 } n*v { 1 1 1 1 } vmin"
60 " foreground associate format nl"
66 { $description "Character style. Background color, denoted by a sequence of four numbers between 0 and 1 (red, green, blue and alpha)." }
70 " \"Hello world\" swap"
71 " { 0.1 0.4 0.1 } n*v { 1 1 1 } vmin { 1 } append"
72 " background associate format nl"
78 { $description "Character style. Font family named by a string." }
80 "This example outputs some different font sizes:"
81 { $code "{ \"monospace\" \"serif\" \"sans-serif\" }\n[ dup font associate format nl ] each" }
85 { $description "Character style. Font size, an integer." }
87 "This example outputs some different font sizes:"
88 { $code "{ 12 18 24 72 }"
89 "[ \"Bigger\" swap font-size associate format nl ] each"
94 { $description "Character style. Font style, one of " { $link plain } ", " { $link bold } ", " { $link italic } ", or " { $link bold-italic } "." }
96 "This example outputs text in all three styles:"
97 { $code "{ plain bold italic bold-italic }\n[ [ word-name ] keep font-style associate format nl ] each" }
101 { $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." } ;
104 { $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." } ;
106 HELP: presented-printer
107 { $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." } ;
110 { $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)." }
112 { $code "H{ { page-color { 1 0.8 0.5 1 } } }\n[ \"A background\" write ] with-nesting nl" }
116 { $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)." }
118 { $code "H{ { border-color { 1 0 0 1 } } }\n[ \"A border\" write ] with-nesting nl" }
122 { $description "Paragraph style. Pixels between edge of text and border color, an integer." }
124 { $code "H{ { border-width 10 } }\n[ \"Some inset text\" write ] with-nesting nl" }
128 { $description "Paragraph style. Pixels between left margin and right margin where text is wrapped, an integer." } ;
130 { wrap-margin bl } related-words
133 { $description "Table style. Horizontal and vertical gap between table cells, denoted by a pair of integers." } ;
135 { table-gap table-border stream-write-table tabular-output } related-words
138 { $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)." } ;
141 { $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> } "." }
143 "This presentation class is used for the code examples you see in the online help:"
144 { $code "\"2 3 + .\" dup <input> write-object nl" }
147 HELP: <input> ( string -- input )
148 { $values { "string" string } { "input" input } }
149 { $description "Creates a new " { $link input } "." } ;
151 HELP: standard-table-style
152 { $values { "style" hashtable } }
153 { $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 } "." } ;