Package ch.bailu.gtk.gtk
Class FontChooser
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.Interface
ch.bailu.gtk.gtk.FontChooser
- All Implemented Interfaces:
PointerInterface
`GtkFontChooser` is an interface that can be implemented by widgets
for choosing fonts.
In GTK, the main objects that implement this interface are
[class@Gtk.FontChooserWidget], [class@Gtk.FontChooserDialog] and
[class@Gtk.FontButton].
for choosing fonts.
In GTK, the main objects that implement this interface are
[class@Gtk.FontChooserWidget], [class@Gtk.FontChooserDialog] and
[class@Gtk.FontButton].
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
getFont()
Gets the currently-selected font name.Gets the currently-selected font.Gets the `PangoFontFace` representing the selected font group
details (i.e. family, slant, weight, width, etc).Gets the `PangoFontFamily` representing the selected font family.Gets the currently-selected font features.Gets the custom font map of this font chooser widget,
or %NULL if it does not have one.int
The selected font size.static int
Gets the language that is used for font features.int
getLevel()
Returns the current level of granularity for selecting fonts.static long
static TypeSystem.TypeSize
Gets the text displayed in the preview area.boolean
Returns whether the preview entry is shown or not.static long
static TypeSystem.TypeSize
Connect to signal "font-activated".void
setFilterFunc
(FontChooser.OnFontFilterFunc filter, Pointer user_data, FontChooser.OnDestroyNotify destroy) Adds a filter function that decides which fonts to display
in the font chooser.void
Sets the currently-selected font.void
Sets the currently-selected font.void
setFontDesc
(FontDescription font_desc) Sets the currently-selected font from @font_desc.void
setFontMap
(FontMap fontmap) Sets a custom font map to use for this font chooser widget.void
setLanguage
(Str language) Sets the language to use for font features.void
setLanguage
(String language) Sets the language to use for font features.void
setLevel
(int level) Sets the desired level of granularity for selecting fonts.void
setPreviewText
(Str text) Sets the text displayed in the preview area.void
setPreviewText
(String text) Sets the text displayed in the preview area.void
setShowPreviewEntry
(boolean show_preview_entry) Shows or hides the editable preview entry.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_FONT_ACTIVATED
- See Also:
-
-
Constructor Details
-
FontChooser
-
-
Method Details
-
getClassHandler
-
getFont
Gets the currently-selected font name.
Note that this can be a different string than what you set with
[method@Gtk.FontChooser.set_font], as the font chooser widget may
normalize font names and thus return a string with a different
structure. For example, “Helvetica Italic Bold 12” could be
normalized to “Helvetica Bold Italic 12”.
Use [method@Pango.FontDescription.equal] if you want to compare two
font descriptions.- Returns:
- A string with the name of the current font
-
getFontDesc
Gets the currently-selected font.
Note that this can be a different string than what you set with
[method@Gtk.FontChooser.set_font], as the font chooser widget may
normalize font names and thus return a string with a different
structure. For example, “Helvetica Italic Bold 12” could be
normalized to “Helvetica Bold Italic 12”.
Use [method@Pango.FontDescription.equal] if you want to compare two
font descriptions.- Returns:
- A `PangoFontDescription` for the current font
-
getFontFace
Gets the `PangoFontFace` representing the selected font group
details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns %NULL.- Returns:
- A `PangoFontFace` representing the selected font group details
-
getFontFamily
Gets the `PangoFontFamily` representing the selected font family.
Font families are a collection of font faces.
If the selected font is not installed, returns %NULL.- Returns:
- A `PangoFontFamily` representing the selected font family
-
getFontFeatures
Gets the currently-selected font features.
The format of the returned string is compatible with the
[CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc).
It can be passed to [func@Pango.AttrFontFeatures.new].- Returns:
- the currently selected font features
-
getFontMap
Gets the custom font map of this font chooser widget,
or %NULL if it does not have one.- Returns:
- a `PangoFontMap`
-
getFontSize
public int getFontSize()The selected font size.- Returns:
- A n integer representing the selected font size, or -1 if no font size is selected.
-
getLanguage
Gets the language that is used for font features.- Returns:
- the currently selected language
-
getLevel
public int getLevel()Returns the current level of granularity for selecting fonts.- Returns:
- the current granularity level
-
getPreviewText
Gets the text displayed in the preview area.- Returns:
- the text displayed in the preview area
-
getShowPreviewEntry
public boolean getShowPreviewEntry()Returns whether the preview entry is shown or not.- Returns:
- %TRUE if the preview entry is shown or %FALSE if it is hidden.
-
setFilterFunc
public void setFilterFunc(FontChooser.OnFontFilterFunc filter, @Nullable Pointer user_data, FontChooser.OnDestroyNotify destroy) Adds a filter function that decides which fonts to display
in the font chooser.- Parameters:
filter
- a `GtkFontFilterFunc`user_data
- data to pass to @filterdestroy
- function to call to free @data when it is no longer needed
-
setFont
Sets the currently-selected font.- Parameters:
fontname
- a font name like “Helvetica 12” or “Times Bold 18”
-
setFont
Sets the currently-selected font.- Parameters:
fontname
- a font name like “Helvetica 12” or “Times Bold 18”
-
setFontDesc
Sets the currently-selected font from @font_desc.- Parameters:
font_desc
- a `PangoFontDescription`
-
setFontMap
Sets a custom font map to use for this font chooser widget.
A custom font map can be used to present application-specific
fonts instead of or in addition to the normal system fonts.
```c
FcConfig *config;
PangoFontMap *fontmap;
config = FcInitLoadConfigAndFonts ();
FcConfigAppFontAddFile (config, my_app_font_file);
fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
gtk_font_chooser_set_font_map (font_chooser, fontmap);
```
Note that other GTK widgets will only be able to use the
application-specific font if it is present in the font map they use:
```c
context = gtk_widget_get_pango_context (label);
pango_context_set_font_map (context, fontmap);
```- Parameters:
fontmap
- a `PangoFontMap`
-
setLanguage
Sets the language to use for font features.- Parameters:
language
- a language
-
setLanguage
Sets the language to use for font features.- Parameters:
language
- a language
-
setLevel
public void setLevel(int level) Sets the desired level of granularity for selecting fonts.- Parameters:
level
- the desired level of granularity
-
setPreviewText
Sets the text displayed in the preview area.
The @text is used to show how the selected font looks.- Parameters:
text
- the text to display in the preview area
-
setPreviewText
Sets the text displayed in the preview area.
The @text is used to show how the selected font looks.- Parameters:
text
- the text to display in the preview area
-
setShowPreviewEntry
public void setShowPreviewEntry(boolean show_preview_entry) Shows or hides the editable preview entry.- Parameters:
show_preview_entry
- whether to show the editable preview entry or not
-
onFontActivated
Connect to signal "font-activated".
SeeFontChooser.OnFontActivated.onFontActivated(ch.bailu.gtk.type.Str)
for signal description.
FieldSIGNAL_ON_FONT_ACTIVATED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-