- Direct Known Subclasses:
FTFontFace
,ToyFontFace
,UserFontFace
FontFace represents a particular font at a particular weight, slant, and other characteristic but no size, transformation, or size.
Font faces are created using font-backend-specific constructors, typically of
the form FontFaceClass.create()
, or implicitly using the toy text API
by way of Context.selectFontFace(String, FontSlant, FontWeight)
. The
resulting face can be accessed using Context.getFontFace()
.
A FontFace specifies all aspects of a font other than the size or font matrix
(a font matrix is used to distort a font by shearing it or scaling it
unequally in the two directions) . A font face can be set on a Context by
using Context.setFontFace(FontFace)
the size and font matrix are set
with Context.setFontSize(double)
and
Context.setFontMatrix(Matrix)
.
There are various types of font faces, depending on the font backend they
use. The type of a font face can be queried using getFontType()
.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorDescriptionFontFace
(MemorySegment address) Constructor used internally to instantiate a java FontFace object for a nativecairo_font_face_t
instance -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Invokes the cleanup action that is normally invoked during garbage collection.Returns the type of the backend used to create a font face.static org.gnome.glib.Type
getType()
Get the CairoFontFace GTypegetUserData
(UserDataKey key) Return user data previously attached to the font face using the specified key.setUserData
(UserDataKey key, MemorySegment userData) Attach user data to the font face.status()
Checks whether an error has previously occurred for this font face
-
Constructor Details
-
FontFace
Constructor used internally to instantiate a java FontFace object for a nativecairo_font_face_t
instance- Parameters:
address
- the memory address of the nativecairo_font_face_t
instance
-
-
Method Details
-
destroy
public void destroy()Invokes the cleanup action that is normally invoked during garbage collection. If the instance is "owned" by the user, thedestroy()
function is run to dispose the native instance. -
status
Checks whether an error has previously occurred for this font face- Returns:
Status.SUCCESS
or another error such asStatus.NO_MEMORY
.- Since:
- 1.0
-
getFontType
-
setUserData
Attach user data to the font face. To remove user data from a font face, call this function with the key that was used to set it andnull
foruserData
.- Parameters:
key
- the key to attach the user data touserData
- the user data to attach to the font face- Returns:
- the key
- Throws:
NullPointerException
- ifkey
isnull
- Since:
- 1.4
-
getUserData
Return user data previously attached to the font face using the specified key. If no user data has been attached with the given key this function returnsnull
.The returned memory segment has zero length. It can be resized with
MemorySegment.reinterpret(long)
RESTRICTED.- Parameters:
key
- the UserDataKey the user data was attached to- Returns:
- the user data previously attached or
null
- Since:
- 1.4
-
getType
public static org.gnome.glib.Type getType()Get the CairoFontFace GType- Returns:
- the GType
-