Class FontMap<T extends GObject>
- All Implemented Interfaces:
Proxy
,ListModelJavaList<T>
,Iterable<T>
,Collection<T>
,List<T>
,SequencedCollection<T>
,ListModel<T>
- Direct Known Subclasses:
FontMap.FontMapImpl
,FontMap.FontMapImpl
PangoFontMap
represents the set of fonts available for a
particular rendering system.
This is a virtual object with implementations being specific to particular rendering systems.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
FontMap.Builder<B extends FontMap.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
FontMap.FontMapClass<T extends GObject>
ThePangoFontMapClass
structure holds the virtual functions for a particularPangoFontMap
implementation.static class
The FontMapImpl type represents a native instance of the abstract FontMap class.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gio.ListModel
ListModel.ItemsChangedCallback, ListModel.ListModelImpl, ListModel.ListModelInterface
-
Constructor Summary
ConstructorDescriptionFontMap
(MemorySegment address) Create a FontMap proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FontMap
asParent()
Returns this instance as if it were its parent type.static FontMap.Builder
<? extends FontMap.Builder> builder()
AFontMap.Builder
object constructs aFontMap
with the specified properties.void
changed()
Forces a change in the context, which will cause anyPangoContext
using this fontmap to change.Creates aPangoContext
connected to this FontMap.protected FontFace
Gets a font family by name.static MemoryLayout
The memory layout of the native struct.int
Returns the current serial number of this FontMap.static Type
getType()
Get the GType of the FontMap classvoid
listFamilies
(Out<FontFamily[]> families) List all families for a fontmap.loadFont
(Context context, FontDescription desc) Load the font in the fontmap that is the closest match fordesc
.loadFontset
(Context context, FontDescription desc, Language language) Load a set of fonts in the fontmap that can be used to render a font matchingdesc
.reloadFont
(Font font, double scale, @Nullable Context context, @Nullable String variations) Returns a new font that is likefont
, except that its size is multiplied byscale
, its backend-dependent configuration (e.g.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
Methods inherited from interface org.gnome.gio.ListModel
emitItemsChanged, getItem, getItemType, getNItems, itemsChanged, onItemsChanged
Methods inherited from interface io.github.jwharm.javagi.gio.ListModelJavaList
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
-
Constructor Details
-
FontMap
Create a FontMap proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
changed
public void changed()Forces a change in the context, which will cause anyPangoContext
using this fontmap to change.This function is only useful when implementing a new backend for Pango, something applications won't do. Backends should call this function if they have attached extra data to the context and such data is changed.
-
createContext
Creates aPangoContext
connected to this FontMap.This is equivalent to
Context()
followed byContext.setFontMap(org.gnome.pango.FontMap)
.If you are using Pango as part of a higher-level system, that system may have it's own way of create a
PangoContext
. For instance, the GTK toolkit has, among others, gtk_widget_get_pango_context(). Use those instead.- Returns:
- the newly allocated
PangoContext
, which should be freed with g_object_unref().
-
getFamily
Gets a font family by name.- Parameters:
name
- a family name- Returns:
- the
PangoFontFamily
-
getSerial
public int getSerial()Returns the current serial number of this FontMap.The serial number is initialized to an small number larger than zero when a new fontmap is created and is increased whenever the fontmap is changed. It may wrap, but will never have the value 0. Since it can wrap, never compare it with "less than", always use "not equals".
The fontmap can only be changed using backend-specific API, like changing fontmap resolution.
This can be used to automatically detect changes to a
PangoFontMap
, like inPangoContext
.- Returns:
- The current serial number of this FontMap.
-
listFamilies
List all families for a fontmap.Note that the returned families are not in any particular order.
PangoFontMap
also implemented theListModel
interface for enumerating families.- Parameters:
families
- location to store a pointer to an array ofPangoFontFamily
*. This array should be freed with g_free().
-
loadFont
Load the font in the fontmap that is the closest match fordesc
.- Parameters:
context
- thePangoContext
the font will be used withdesc
- aPangoFontDescription
describing the font to load- Returns:
- the newly allocated
PangoFont
loaded, ornull
if no font matched.
-
loadFontset
Load a set of fonts in the fontmap that can be used to render a font matchingdesc
.- Parameters:
context
- thePangoContext
the font will be used withdesc
- aPangoFontDescription
describing the font to loadlanguage
- aPangoLanguage
the fonts will be used for- Returns:
- the newly allocated
PangoFontset
loaded, ornull
if no font matched.
-
reloadFont
public Font reloadFont(Font font, double scale, @Nullable @Nullable Context context, @Nullable @Nullable String variations) Returns a new font that is likefont
, except that its size is multiplied byscale
, its backend-dependent configuration (e.g. cairo font options) is replaced by the one incontext
, and its variations are replaced byvariations
.- Parameters:
font
- a font in this FontMapscale
- the scale factor to applycontext
- aPangoContext
variations
- font variations to use- Returns:
- the modified font
-
getFace
-
builder
AFontMap.Builder
object constructs aFontMap
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withFontMap.Builder.build()
.
-