java.lang.Object
org.freedesktop.cairo.Glyphs
- All Implemented Interfaces:
AutoCloseable
The
Glyphs class represents an array of glyphs. It will also optionally
contain an array of clusters and the accompanying TextClusterFlags.-
Method Summary
Modifier and TypeMethodDescriptionstatic MemorySegmentallocateClusters(int numClusters) Allocates an array ofTextClusters.static MemorySegmentallocateGlyphs(int numGlyphs) Allocates an array ofGlyphs.voidclose()Free the glyphs array usingcairo_glyph_freeand the clusters array usingcairo_text_cluster_free.Get the text cluster flagsGet a pointer to the clusters arrayGet a pointer to the glyphs arrayintGet the number of text clusters in the cluster arrayintGet the number of glyphs in the arrayvoidsetClusterFlags(TextClusterFlags clusterFlags) Set the text cluster flagsvoidsetClustersPointer(MemorySegment clustersPointer) Set a pointer to the clusters arrayvoidsetGlyphsPointer(MemorySegment glyphsPointer) Set a pointer to the glyphs arrayvoidsetNumClusters(int numClusters) Set the number of text clusters in the cluster arrayvoidsetNumGlyphs(int numGlyphs) Set the number of glyphs in the array
-
Method Details
-
getGlyphsPointer
Get a pointer to the glyphs arrayThe returned memory segment has zero length. It can be resized with
MemorySegment.reinterpret(long)RESTRICTED.- Returns:
- a zero-length MemorySegment pointing to the glyphs array
-
setGlyphsPointer
Set a pointer to the glyphs array- Parameters:
glyphsPointer- a MemorySegment pointing to the glyphs array
-
getNumGlyphs
public int getNumGlyphs()Get the number of glyphs in the array- Returns:
- the number of glyphs
-
setNumGlyphs
public void setNumGlyphs(int numGlyphs) Set the number of glyphs in the array- Parameters:
numGlyphs- the number of glyphs
-
getClustersPointer
Get a pointer to the clusters arrayThe returned memory segment has zero length. It can be resized with
MemorySegment.reinterpret(long)RESTRICTED.- Returns:
- a zero-length MemorySegment pointing to the clusters array
-
setClustersPointer
Set a pointer to the clusters arrayThe returned memory segment has zero length. It can be resized with
MemorySegment.reinterpret(long)RESTRICTED.- Parameters:
clustersPointer- the MemorySegment pointing to the clusters array
-
getNumClusters
public int getNumClusters()Get the number of text clusters in the cluster array- Returns:
- the number of text clusters
-
setNumClusters
public void setNumClusters(int numClusters) Set the number of text clusters in the cluster array- Parameters:
numClusters- the number of text clusters
-
getClusterFlags
Get the text cluster flags- Returns:
- the text cluster flags
-
setClusterFlags
Set the text cluster flags- Parameters:
clusterFlags- the text cluster flags
-
close
public void close()Free the glyphs array usingcairo_glyph_freeand the clusters array usingcairo_text_cluster_free.- Specified by:
closein interfaceAutoCloseable
-
allocateGlyphs
Allocates an array ofGlyphs. This function is only useful in implementations ofUserScaledFontTextToGlyphsFuncwhere the user needs to allocate an array of glyphs that cairo will free. For all other uses, user can use their own allocation method for glyphs.This function returns
MemorySegment.NULLifnumGlyphsis not positive, or if out of memory. That means, theNULLreturn value signals out-of-memory only ifnumGlyphswas positive.- Parameters:
numGlyphs- number of glyphs to allocate- Returns:
- the newly allocated array of glyphs
- Since:
- 1.8
-
allocateClusters
Allocates an array ofTextClusters. This function is only useful in implementations ofUserScaledFontTextToGlyphsFuncwhere the user needs to allocate an array of text clusters that cairo will free. For all other uses, user can use their own allocation method for text clusters.This function returns
MemorySegment.NULLifnumClustersis not positive, or if out of memory. That means, theNULLreturn value signals out-of-memory only ifnumClusterswas positive.- Parameters:
numClusters- number of TextClusters to allocate- Returns:
- the newly allocated array of text clusters
- Since:
- 1.8
-