DocumentTools[Layout]
Font
generate XML for a Font element
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Font( str, opts )
str
-
(optional) ; a string of text
opts
(optional) ; one or more keyword options as described later
background : {list(nonnegint),symbol,string}:=[255,255,255] ; The background color for text. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of non-negative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [255,255,255] which corresponds to white.
bold : truefalse:=false ; Whether text will be shown in bold.
color : {list(nonnegint),symbol,string}:=[0,0,0] ; The foreground color for text. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [0,0,0] which corresponds to black.
encoding : identical("UTF-8"):=NULL ; Indicates that UTF-8 encoding shall be used. The default is NULL.
family : identical("Times New Roman","Courier","DejaVu Sans","DejaVu Serif","Helvetica","Lucida Sans"):="Times New Roman" ; The font family to be used for displayed text.
italic : truefalse:=false ; Whether text will be shown in italics.
opaque : truefalse ; Whether the background color will be opaque, in which case any underlying color such as the fillcolor of a Table Cell will show. The default value is false when background is white, and true otherwise.
size : posint:=12 ; The size of the text font.
style : identical(Text,Hyperlink):=Text ; A worksheet style for text.
superscript : truefalse:=false ; Whether the text will be displayed in the superscript position.
underline : truefalse:=false ; Whether text will be shown underlined.
The Font command provides a modifier for a string of text appearing in a Textfield.
An Font element is returned as an XML function call.
The generated XML may be used with the results of additional commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document may be inserted into the current document using the InsertContent command.
with⁡DocumentTools:
with⁡DocumentTools:-Layout:
Executing the Font command produces a function call.
F≔Font⁡Some text
F≔_XML_Font⁡size=12,mathsize=12,mathvariant=normal,style=Text,background=[255,255,255],mathbackground=[255,255,255],foreground=[0,0,0],mathcolor=[0,0,0],family=Times New Roman,Some text
By using additional commands from the Layout Constructors package a nested function call can be produced which represents an entire worksheet.
xml≔Worksheet⁡Group⁡Input⁡Textfield⁡F:
That XML representation of a worksheet can be inserted directly.
InsertContent⁡xml:
Some text
Size and color can be specified as options.
F≔Font⁡Some text,size=20,color=0,150,0,background=255,255,120:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡F:
F≔Font⁡Some text,size=20,color=blue,background=Orange:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡F:
Each of the bold, italic, and underline options can be used independently.
F≔Font⁡Some text,size=20,bold:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡F:
F≔seq⁡Font⁡Text,size=20,op⁡f, ,fincombinat:-powerset⁡underline,bold,italic:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡F:
Text Text Text Text Text Text Text Text
The font family may be specified as an option.
F≔Font⁡Some text,size=20,color=DarkCyan,family=DejaVu Sans:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡F:
Text may be placed in a superscript position.
FM≔Font⁡M,size=20:FE≔Font⁡e,size=20,superscript:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡FM,FE:
Me
The worksheet's hyperlink style can be respected.
F≔Font⁡Some text,size=16,color=blue,style=:-Hyperlink:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡F:
By default a background other than white is opaque with respect to an underlying shade such as the fillcolor of a Table Cell. And by default a white background is not opaque. In either case the opaque option can be used to force the behavior.
s≔size=16,The quick brown fox jumps over the lazy dog:cf≔fillcolor=0,120,150:F1≔Font⁡s,background=Orange:F2≔Font⁡s,background=Orange,opaque=false:F3≔Font⁡s,background=Orange,opaque=true:F4≔Font⁡s:F5≔Font⁡s,opaque=false:F6≔Font⁡s,opaque=true:T≔Table⁡alignment=center,width=50,seq⁡Row⁡Cell⁡cf,F‖i,i=1..6:InsertContent⁡Worksheet⁡T:
The quick brown fox jumps over the lazy dog
The DocumentTools:-Layout:-Font command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
See Also
Cell
Component Constructors
DocumentTools
InsertContent
Layout Constructors
Table
Textfield
XMLTools
Download Help Document