java.lang.Object
io.github.jwharm.cairobindings.Proxy
org.freedesktop.cairo.ScaledFont
org.freedesktop.cairo.FTScaledFont
Provides a ScaledFont from the FreeType font backend.
The FreeType font backend is primarily used to render text on GNU/Linux systems, but can be used on other platforms too.
- Since:
- 1.0
-
Constructor Summary
ConstructorDescriptionFTScaledFont
(MemorySegment address) Constructor used internally to instantiate a java FTScaledFont object for a nativecairo_scaled_font_t
instance -
Method Summary
Modifier and TypeMethodDescriptionstatic FTScaledFont
create
(FTFontFace fontFace, Matrix fontMatrix, Matrix ctm, FontOptions options) Creates a FTScaledFont object from a FreeType font face and matrices that describe the size of the font and the environment in which it will be used.lockFace()
Gets the FT_Face object from a FreeType backend font and scales it appropriately for the font and applies OpenType font variations if applicable.void
Releases a face obtained withlockFace()
.Methods inherited from class org.freedesktop.cairo.ScaledFont
create, destroy, extents, getCTM, getFontFace, getFontMatrix, getFontOptions, getFontType, getScaleMatrix, getType, getUserData, glyphExtents, setUserData, status, textExtents, textToGlyphs
-
Constructor Details
-
FTScaledFont
Constructor used internally to instantiate a java FTScaledFont object for a nativecairo_scaled_font_t
instance- Parameters:
address
- the memory address of the nativecairo_scaled_font_t
instance
-
-
Method Details
-
create
public static FTScaledFont create(FTFontFace fontFace, Matrix fontMatrix, Matrix ctm, FontOptions options) Creates a FTScaledFont object from a FreeType font face and matrices that describe the size of the font and the environment in which it will be used.- Parameters:
fontFace
- a FTFontFacefontMatrix
- font space to user space transformation matrix for the font. In the simplest case of a N point font, this matrix is just a scale by N, but it can also be used to shear the font or stretch it unequally along the two axes. SeeContext.setFontMatrix(Matrix)
.ctm
- user to device transformation matrix with which the font will be used.options
- options to use when getting metrics for the font and rendering with it.- Returns:
- a newly created FTScaledFont
- Since:
- 1.0
-
lockFace
Gets the FT_Face object from a FreeType backend font and scales it appropriately for the font and applies OpenType font variations if applicable. You must release the face withunlockFace()
when you are done using it. Since theFace
object can be shared between multiple FTScaledFont objects, you must not lock any other font objects until you unlock this one. A count is kept of the number of timeslockFace()
is called.unlockFace()
must be called the same number of times.You must be careful when using this function in a library or in a threaded application, because freetype's design makes it unsafe to call freetype functions simultaneously from multiple threads, (even if using distinct FT_Face objects). Because of this, application code that acquires an FT_Face object with this call must add its own locking to protect any use of that object, (and which also must protect any other calls into cairo as almost any cairo function might result in a call into the freetype library).
- Returns:
- The FT_Face object for this font, scaled appropriately, or
null
if this font is in an error state (seeScaledFont.status()
) or there is insufficient memory. - Since:
- 1.0
-
unlockFace
-