gtk.font_chooser_mixin

Module for FontChooser interface mixin

Templates 2

tmplFontChooserT()

gtk.font_chooser.FontChooser is an interface that can be implemented by widgets for choosing fonts.

In GTK, the main objects that implement this interface are gtk.font_chooser_widget.FontChooserWidget, gtk.font_chooser_dialog.FontChooserDialog and gtk.font_button.FontButton.

Deprecated

Functions
string font()

Get font property.

Returns

The font description as a string, e.g. "Sans Italic 12".

Deprecated

void font(string propval)

Set font property.

Parameters

propvalThe font description as a string, e.g. "Sans Italic 12".

Deprecated

Get fontDesc property.

Returns

The font description as a pango.font_description.FontDescription.

Deprecated

Set fontDesc property.

Parameters

propvalThe font description as a pango.font_description.FontDescription.

Deprecated

string fontFeatures()

Get fontFeatures property.

Returns

The selected font features.

The format of the string is compatible with CSS and with Pango attributes.

Deprecated

string language()

Get language property.

Returns

The language for which the font features were selected.

Deprecated

void language(string propval)

Set language property.

Parameters

propvalThe language for which the font features were selected.

Deprecated

Get level property.

Returns

The level of granularity to offer for selecting fonts.

Deprecated

void level(gtk.types.FontChooserLevel propval)

Set level property.

Parameters

propvalThe level of granularity to offer for selecting fonts.

Deprecated

string previewText()

Get previewText property.

Returns

The string with which to preview the font.

Deprecated

void previewText(string propval)

Set previewText property.

Parameters

propvalThe string with which to preview the font.

Deprecated

bool showPreviewEntry()

Get showPreviewEntry property.

Returns

Whether to show an entry to change the preview text.

Deprecated

void showPreviewEntry(bool propval)

Set showPreviewEntry property.

Parameters

propvalWhether to show an entry to change the preview text.

Deprecated

string getFont()

Gets the currently-selected font name.

Note that this can be a different string than what you set with gtk.font_chooser.FontChooser.setFont, 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 pango.font_description.FontDescription.equal if you want to compare two font descriptions.

Returns

A string with the name

of the current font

Deprecated

Gets the currently-selected font.

Note that this can be a different string than what you set with gtk.font_chooser.FontChooser.setFont, 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 pango.font_description.FontDescription.equal if you want to compare two font descriptions.

Returns

Deprecated

Gets the pango.font_face.FontFace representing the selected font group details (i.e. family, slant, weight, width, etc).

If the selected font is not installed, returns null.

Returns

A pango.font_face.FontFace representing the

selected font group details

Deprecated

Gets the pango.font_family.FontFamily representing the selected font family.

Font families are a collection of font faces.

If the selected font is not installed, returns null.

Returns

A pango.font_family.FontFamily representing the

selected font family

Deprecated

string getFontFeatures()

Gets the currently-selected font features.

The format of the returned string is compatible with the CSS font-feature-settings property. It can be passed to pango.attr_font_features.AttrFontFeatures.new_.

Returns

the currently selected font features

Deprecated

Gets the custom font map of this font chooser widget, or null if it does not have one.

Returns

Deprecated

int getFontSize()

The selected font size.

Returns

A n integer representing the selected font size,

or -1 if no font size is selected.

Deprecated

string getLanguage()

Gets the language that is used for font features.

Returns

the currently selected language

Deprecated

Returns the current level of granularity for selecting fonts.

Returns

the current granularity level

Deprecated

string getPreviewText()

Gets the text displayed in the preview area.

Returns

the text displayed in the preview area

Deprecated

bool getShowPreviewEntry()

Returns whether the preview entry is shown or not.

Returns

true if the preview entry is shown or false if it is hidden.

Deprecated

void setFilterFunc(gtk.types.FontFilterFunc filter = null)

Adds a filter function that decides which fonts to display in the font chooser.

Parameters

filtera gtk.types.FontFilterFunc

Deprecated

void setFont(string fontname)

Sets the currently-selected font.

Parameters

fontnamea font name like “Helvetica 12” or “Times Bold 18”

Deprecated

void setFontDesc(pango.font_description.FontDescription fontDesc)

Sets the currently-selected font from font_desc.

Parameters

fontDesca pango.font_description.FontDescription

Deprecated

void setFontMap(pango.font_map.FontMap fontmap = null)

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.

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:

context = gtk_widget_get_pango_context (label);
pango_context_set_font_map (context, fontmap);

Parameters

fontmapa pango.font_map.FontMap

Deprecated

void setLanguage(string language)

Sets the language to use for font features.

Parameters

languagea language

Deprecated

void setLevel(gtk.types.FontChooserLevel level)

Sets the desired level of granularity for selecting fonts.

Parameters

levelthe desired level of granularity

Deprecated

void setPreviewText(string text)

Sets the text displayed in the preview area.

The text is used to show how the selected font looks.

Parameters

textthe text to display in the preview area

Deprecated

void setShowPreviewEntry(bool showPreviewEntry)

Shows or hides the editable preview entry.

Parameters

showPreviewEntrywhether to show the editable preview entry or not

Deprecated

gulong connectFontActivated(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == string))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.font_chooser.FontChooser))) && Parameters!T.length < 3)

Connect to FontActivated signal.

Emitted when a font is activated.

This usually happens when the user double clicks an item, or an item is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

Parameters

callbacksignal callback delegate or function to connect void callback(string fontname, gtk.font_chooser.FontChooser fontChooser) fontname the font name (optional) fontChooser the instance the signal is connected to (optional)
afterYes.After to execute callback after default handler, No.After to execute before (default)

Returns

Signal ID

Deprecated

tmplFontChooserGidBuilderT()

Fluent builder implementation template for gtk.font_chooser.FontChooser

Functions
T font(string propval)

Set font property.

Parameters

propvalThe font description as a string, e.g. "Sans Italic 12".

Returns

Builder instance for fluent chaining

Deprecated

Set fontDesc property.

Parameters

propvalThe font description as a pango.font_description.FontDescription.

Returns

Builder instance for fluent chaining

Deprecated

T language(string propval)

Set language property.

Parameters

propvalThe language for which the font features were selected.

Returns

Builder instance for fluent chaining

Deprecated

Set level property.

Parameters

propvalThe level of granularity to offer for selecting fonts.

Returns

Builder instance for fluent chaining

Deprecated

T previewText(string propval)

Set previewText property.

Parameters

propvalThe string with which to preview the font.

Returns

Builder instance for fluent chaining

Deprecated

T showPreviewEntry(bool propval)

Set showPreviewEntry property.

Parameters

propvalWhether to show an entry to change the preview text.

Returns

Builder instance for fluent chaining

Deprecated