-
Notifications
You must be signed in to change notification settings - Fork 8
Text
Christopher Nikkel edited this page Dec 23, 2018
·
9 revisions
type TextAnchor =
| Start
| Middle
| End
| Inherit
type Text =
{
Position: Point
Body: string
FontFamily: string option
FontSize: int option
Anchor: TextAnchor option
}
Text
is used to create a SVG text block.
Function | Signature | Description |
---|---|---|
Text.create |
Point -> Length -> Text |
create a text block at a specified Point for the upper left corner and a string for the body |
Text.withFont |
string -> int -> Text -> Text |
add a string font family and a integer font size to a text block |
Text.withFontFamily |
string -> Text -> Text |
add a string font family to a text block |
Text.withFontSize |
string -> Text -> Text |
add a integer font size to a text block |
Text.withAnchor |
TextAnchor -> Text -> Text |
add a text anchor to a text block |
Text.toString |
Text -> string |
convert a text block to a string |
let position = Point.ofInts (55, 45)
let style = Style.create (Name Colors.White) (Name Colors.Black) (Length.ofInt 1) 1.0 1.0
Text.create position "Hello World!"
|> Element.createWithStyle style
|> printf "%O"
<text stroke="black" stroke-width="1" fill="white" opacity="1" x="55" y="45">Hello World!</text>