java.lang.Object
io.github.jwharm.cairobindings.Proxy
org.freedesktop.cairo.TextExtents
The TextExtents structure stores the extents of a single glyph or a string of
glyphs in user-space coordinates. Because text extents are in user-space
coordinates, they are mostly, but not entirely, independent of the current
transformation matrix. If you call
Context.scale(2.0, 2.0)
, text will
be drawn twice as big, but the reported text extents will not be doubled.
They will change slightly due to hinting (so you can't assume that metrics
are independent of the transformation matrix), but otherwise will remain
unchanged.- Since:
- 1.0
-
Constructor Summary
ConstructorDescriptionTextExtents
(MemorySegment address) Constructor used internally to instantiate a java TextExtents object for a nativecairo_text_extents_t
instance -
Method Summary
Modifier and TypeMethodDescriptionstatic TextExtents
Allocate a new, uninitializedcairo_text_extents_t
double
height()
Height of the glyphs as drawndouble
width()
Width of the glyphs as drawndouble
xAdvance()
Distance to advance in the X direction after drawing these glyphsdouble
xBearing()
The horizontal distance from the origin to the leftmost part of the glyphs as drawn.double
yAdvance()
Distance to advance in the Y direction after drawing these glyphs.double
yBearing()
The vertical distance from the origin to the topmost part of the glyphs as drawn.
-
Constructor Details
-
TextExtents
Constructor used internally to instantiate a java TextExtents object for a nativecairo_text_extents_t
instance- Parameters:
address
- the memory address of the nativecairo_text_extents_t
instance
-
-
Method Details
-
create
Allocate a new, uninitializedcairo_text_extents_t
- Parameters:
arena
- the arena in which the TextExtents will be allocated- Returns:
- a newly allocated, uninitialized TextExtents
-
xBearing
public double xBearing()The horizontal distance from the origin to the leftmost part of the glyphs as drawn. Positive if the glyphs lie entirely to the right of the origin.- Returns:
- the horizontal distance from the origin to the leftmost part of the glyphs as drawn
-
yBearing
public double yBearing()The vertical distance from the origin to the topmost part of the glyphs as drawn. Positive only if the glyphs lie completely below the origin; will usually be negative.- Returns:
- the vertical distance from the origin to the topmost part of the glyphs as drawn
-
width
public double width()Width of the glyphs as drawn- Returns:
- width of the glyphs as drawn
-
height
public double height()Height of the glyphs as drawn- Returns:
- height of the glyphs as drawn
-
xAdvance
public double xAdvance()Distance to advance in the X direction after drawing these glyphs- Returns:
- distance to advance in the X direction after drawing these glyphs
-
yAdvance
public double yAdvance()Distance to advance in the Y direction after drawing these glyphs. Will typically be zero except for vertical text layout as found in East-Asian languages.- Returns:
- distance to advance in the Y direction after drawing these glyphs
-