579
edits
(List of 2.10 Nasal Canvas methods (what I wish I had when I made my HUD)) |
(Filled in what I could about the Text element) |
||
Line 153: | Line 153: | ||
It uses same coordinate format as [http://www.w3.org/TR/CSS21/visufx.html#clipping Clipping] | It uses same coordinate format as [http://www.w3.org/TR/CSS21/visufx.html#clipping Clipping] | ||
Example: my_grp.set("clip", "rect(62px, 587px, 262px, 437px)"); # top,right,bottom,left | '''Example:''' my_grp.set("clip", "rect(62px, 587px, 262px, 437px)"); # top,right,bottom,left | ||
''key = "font"'' | ''key = "font"'' | ||
Line 159: | Line 159: | ||
Sets the default font. | Sets the default font. | ||
Example: my_group.set("font", "LiberationFonts/LiberationMono-Regular.ttf"); | '''Example:''' my_group.set("font", "LiberationFonts/LiberationMono-Regular.ttf"); | ||
''key = "stroke"'' | ''key = "stroke"'' | ||
Line 215: | Line 215: | ||
=== setText === | === setText === | ||
'''Parameters:''' (text) | |||
Sets the text to be displayed. | |||
=== setAlignment === | === setAlignment === | ||
'''Parameters:''' (alignment) | |||
Sets how the text should be aligned with its position. | |||
'''Examples of alignment:''' "left-top", "center-center", "right-bottom", "left-baseline", "center-bottom-baseline" | |||
=== setFontSize === | === setFontSize === | ||
'''Parameters:''' (size, aspectRatio) | |||
Sets the size and aspectRatio of the font. AspectRatio is the Ratio between character height and width. Default aspectRatio is 1. | |||
=== setFont === | === setFont === | ||
'''Parameters:''' (fontName) | |||
Sets the font to be used. See $FG_DATA/Fonts for list of fonts. | |||
=== setDrawMode === | === setDrawMode === | ||
'''Parameters:''' (mode) | |||
Sets the drawing mode. You can use the values below and add those you need. | |||
'''Text.TEXT:''' Draws the text | |||
'''Text.BOUNDINGBOX:''' Draws the boundingbox | |||
'''Text.FILLEDBOUNDINGBOX:''' Draws the filled boundingbox | |||
'''Text.ALIGNMENT:''' Draws a cross where the element position is | |||
'''Example:''' my_text.setDrawMode(Text.TEXT + Text.BOUNDINGBOX); | |||
=== setPadding === | === setPadding === | ||
? | |||
=== setMaxWidth === | === setMaxWidth === | ||
? | |||
=== setColor === | === setColor === | ||
'''Parameters:''' (r, g, b) | |||
'''Parameters:''' (r, g, b, a) | |||
Sets the color the text should be drawn in. | |||
=== setColorFill === | === setColorFill === | ||
'''Parameters:''' (r, g, b) | |||
'''Parameters:''' (r, g, b, a) | |||
Sets the color the text background should be drawn in. | |||
== Path == | == Path == | ||
Inherits from element. | Inherits from element. |
edits