Java Reference
In-Depth Information
font: Font { size: 36 }
fill: Color.TRANSPARENT
stroke: Color.BLACK
transforms: Rotate {
angle: 45
pivotX: 0 // default is 0
pivotY: 0 // default is 0
}
}
Figure 5.16
Rotated 45 Degrees from Origin
Adding the pivotX/pivotY is not absolutely necessary because their default values
are zero anyway, but this does show you that you can control the pivot point when
using a javafx.scene.transform.Rotate transform . javafx.scene.transform
.Scale also has pivotX / pivotY variables to anchor the scaling at a particular
point.
TextOrigin
If you were paying close attention, you may have noticed something a little dif-
ferent with this last rotation, which brings us to the next topic, text origin. Text
origin is the origin point, where the text is placed. There are three options for the
text origin: baseline, top, and bottom.
Baseline is the line on which the font places its characters. Some characters may
descend this line, like j, p, and y. Top means the origin is at the top of the font,
and bottom means the origin is at the bottom.
Figure 5.17 shows the three options. Each text is outlined to show its bounding
region, and the dot indicates the origin point (0,0) with a horizontal line. Notice
Search WWH ::




Custom Search