Java Reference
In-Depth Information
Stage {
title: "Text Demo"
scene: Scene {
width: 400
height: 200
content: [
Text {
x:50 y: 25
wrappingWidth: 300
font: Font {size: 28 name:"Arial Black" }
fill:Color.BROWN
letterSpacing:0.1
oblique:true
content: "This is a simple text demo."
}
]
}
}
This code snippet would render text content oblique as shown in the following figure:
How it works...
The Text class is a visual node intended to render textual shapes in the scene graph. It
provides powerful low-level properties and behaviors, which afford developers control over
raw text display. Let us explore the text properties used in this recipe:
F content:String —this is the actual text that will be displayed when the scene
graph is rendered.
F font:Font —this is an instance of the Font class which is used to specify the font
used for the rendered text.
F fill:Color —the fill property specifies the color or effect that is applied to the
rendered font.
F Stroke:Color —this property controls the color of the outline stroke of the letter
drawn. You can further control the stroke by applying property strokeWidth:Number
to specify the size of the outer stroke around the letter.
F letterSpacing:Number —this property specifies the space increment
between letters.
F oblique:Boolean —when set to true, this property attempts to algorithmically
render the font italicized, whether there is an available italic version of the font or not.
 
Search WWH ::




Custom Search