Interface FontMap
- All Superinterfaces:
Proxy
- All Known Implementing Classes:
FontMap.FontMap$Impl
PangoCairoFontMap is an interface exported by font maps for
use with Cairo.
The actual type of the font map will depend on the particular font technology Cairo was compiled to use.
- Since:
- 1.10
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe FontMap$Impl type represents a native instance of the FontMap interface. -
Method Summary
Modifier and TypeMethodDescriptiondefault ContextDeprecated.Use pango_font_map_create_context() instead.static FontMapGets a defaultPangoCairoFontMapto use with Cairo.default org.freedesktop.cairo.FontTypeGets the type of Cairo font backend that this FontMap uses.default doubleGets the resolution for the fontmap.static @Nullable TypegetType()Get the GType of the FontMap classstatic FontMapnew_()Creates a newPangoCairoFontMapobject.static @Nullable FontMapnewForFontType(org.freedesktop.cairo.FontType fonttype) Creates a newPangoCairoFontMapobject of the type suitable to be used with cairo font backend of typefonttype.default voidSets a defaultPangoCairoFontMapto use with Cairo.default voidsetResolution(double dpi) Sets the resolution for the fontmap.
-
Method Details
-
getType
-
getDefault
Gets a defaultPangoCairoFontMapto use with Cairo.Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; you generally should only use the
PangoFontMapandPangoCairoFontMapinterfaces on the returned object.The default Cairo fontmap can be changed by using
setDefault(). This can be used to change the Cairo font backend that the default fontmap uses for example.Note that since Pango 1.32.6, the default fontmap is per-thread. Each thread gets its own default fontmap. In this way, PangoCairo can be used safely from multiple threads.
- Returns:
- the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
- Since:
- 1.10
-
new_
Creates a newPangoCairoFontMapobject.A fontmap is used to cache information about available fonts, and holds certain global parameters such as the resolution. In most cases, you can use
func@PangoCairo.font_map_get_default] instead. Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; You generally should only use thePangoFontMapandPangoCairoFontMap` interfaces on the returned object.You can override the type of backend returned by using an environment variable
PANGOCAIRO_BACKEND. Supported types, based on your build, are fc (fontconfig), win32, and coretext. If requested type is not available, NULL is returned. Ie. this is only useful for testing, when at least two backends are compiled in.- Returns:
- the newly allocated
PangoFontMap, which should be freed with g_object_unref(). - Since:
- 1.10
-
newForFontType
Creates a newPangoCairoFontMapobject of the type suitable to be used with cairo font backend of typefonttype.In most cases one should simply use
new_(), or in fact in most of those cases, just usegetDefault().- Parameters:
fonttype- desiredcairo_font_type_t- Returns:
- the newly allocated
PangoFontMapof suitable type which should be freed with g_object_unref(), ornullif the requested cairo font backend is not supported / compiled in. - Since:
- 1.18
-
createContext
Deprecated.Use pango_font_map_create_context() instead.Create aPangoContextfor the given fontmap.- Returns:
- the newly created context; free with g_object_unref().
- Since:
- 1.10
-
getFontType
default org.freedesktop.cairo.FontType getFontType()Gets the type of Cairo font backend that this FontMap uses.- Returns:
- the
cairo_font_type_tcairo font backend type - Since:
- 1.18
-
getResolution
default double getResolution()Gets the resolution for the fontmap.- Returns:
- the resolution in "dots per inch"
- Since:
- 1.10
-
setDefault
default void setDefault()Sets a defaultPangoCairoFontMapto use with Cairo.This can be used to change the Cairo font backend that the default fontmap uses for example. The old default font map is unreffed and the new font map referenced.
Note that since Pango 1.32.6, the default fontmap is per-thread. This function only changes the default fontmap for the current thread. Default fontmaps of existing threads are not changed. Default fontmaps of any new threads will still be created using
new_().A value of
nullfor this FontMap will cause the current default font map to be released and a new default font map to be created on demand, usingnew_().- Since:
- 1.22
-
setResolution
default void setResolution(double dpi) Sets the resolution for the fontmap.This is a scale factor between points specified in a
PangoFontDescriptionand Cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).- Parameters:
dpi- the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)- Since:
- 1.10
-