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 MemorySegment
allocateClusters
(int numClusters) Allocates an array ofTextCluster
s.static MemorySegment
allocateGlyphs
(int numGlyphs) Allocates an array ofGlyph
s.void
close()
Free the glyphs array usingcairo_glyph_free
and the clusters array usingcairo_text_cluster_free
.Get the text cluster flagsGet a pointer to the clusters arrayGet a pointer to the glyphs arrayint
Get the number of text clusters in the cluster arrayint
Get the number of glyphs in the arrayvoid
setClusterFlags
(TextClusterFlags clusterFlags) Set the text cluster flagsvoid
setClustersPointer
(MemorySegment clustersPointer) Set a pointer to the clusters arrayvoid
setGlyphsPointer
(MemorySegment glyphsPointer) Set a pointer to the glyphs arrayvoid
setNumClusters
(int numClusters) Set the number of text clusters in the cluster arrayvoid
setNumGlyphs
(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_free
and the clusters array usingcairo_text_cluster_free
.- Specified by:
close
in interfaceAutoCloseable
-
allocateGlyphs
Allocates an array ofGlyph
s. This function is only useful in implementations ofUserScaledFontTextToGlyphsFunc
where 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.NULL
ifnumGlyphs
is not positive, or if out of memory. That means, theNULL
return value signals out-of-memory only ifnumGlyphs
was positive.- Parameters:
numGlyphs
- number of glyphs to allocate- Returns:
- the newly allocated array of glyphs
- Since:
- 1.8
-
allocateClusters
Allocates an array ofTextCluster
s. This function is only useful in implementations ofUserScaledFontTextToGlyphsFunc
where 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.NULL
ifnumClusters
is not positive, or if out of memory. That means, theNULL
return value signals out-of-memory only ifnumClusters
was positive.- Parameters:
numClusters
- number of TextClusters to allocate- Returns:
- the newly allocated array of text clusters
- Since:
- 1.8
-