gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Interfaces.FontChooser

Contents

Description

FontChooser is an interface that can be implemented by widgets displaying the list of fonts. In GTK+, the main objects that implement this interface are FontChooserWidget, FontChooserDialog and FontButton. The GtkFontChooser interface has been introducted in GTK+ 3.2.

Synopsis

Exported types

Methods

getFont

fontChooserGetFont Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m (Maybe Text)

Returns: A string with the name of the current font, or Nothing if no font is selected. You must free this string with free.

Gets the currently-selected font name.

Note that this can be a different string than what you set with fontChooserSetFont, 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 fontDescriptionEqual if you want to compare two font descriptions.

Since: 3.2

getFontDesc

fontChooserGetFontDesc Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m (Maybe FontDescription)

Returns: A FontDescription for the current font, or Nothing if no font is selected.

Gets the currently-selected font.

Note that this can be a different string than what you set with fontChooserSetFont, 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 fontDescriptionEqual if you want to compare two font descriptions.

Since: 3.2

getFontFace

fontChooserGetFontFace Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m (Maybe FontFace)

Returns: A FontFace representing the selected font group details, or Nothing. The returned object is owned by fontchooser and must not be modified or freed.

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

If the selected font is not installed, returns Nothing.

Since: 3.2

getFontFamily

fontChooserGetFontFamily Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m (Maybe FontFamily)

Returns: A FontFamily representing the selected font family, or Nothing. The returned object is owned by fontchooser and must not be modified or freed.

Gets the FontFamily representing the selected font family. Font families are a collection of font faces.

If the selected font is not installed, returns Nothing.

Since: 3.2

getFontMap

fontChooserGetFontMap Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m (Maybe FontMap)

Returns: a FontMap, or Nothing

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

Since: 3.18

getFontSize

fontChooserGetFontSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m Int32

Returns: A n integer representing the selected font size, or -1 if no font size is selected.

The selected font size.

Since: 3.2

getPreviewText

fontChooserGetPreviewText Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m Text

Returns: the text displayed in the preview area

Gets the text displayed in the preview area.

Since: 3.2

getShowPreviewEntry

fontChooserGetShowPreviewEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> m Bool

Returns: True if the preview entry is shown or False if it is hidden.

Returns whether the preview entry is shown or not.

Since: 3.2

setFilterFunc

fontChooserSetFilterFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> Maybe FontFilterFunc

filter: a FontFilterFunc, or Nothing

-> m () 

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

Since: 3.2

setFont

fontChooserSetFont Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> Text

fontname: a font name like “Helvetica 12” or “Times Bold 18”

-> m () 

Sets the currently-selected font.

Since: 3.2

setFontDesc

fontChooserSetFontDesc Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> FontDescription

fontDesc: a FontDescription

-> m () 

Sets the currently-selected font from fontDesc.

Since: 3.2

setFontMap

fontChooserSetFontMap Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a, IsFontMap b) 
=> a

fontchooser: a FontChooser

-> Maybe b

fontmap: a FontMap

-> m () 

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 code

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);

Since: 3.18

setPreviewText

fontChooserSetPreviewText Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> Text

text: the text to display in the preview area

-> m () 

Sets the text displayed in the preview area. The text is used to show how the selected font looks.

Since: 3.2

setShowPreviewEntry

fontChooserSetShowPreviewEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontChooser a) 
=> a

fontchooser: a FontChooser

-> Bool

showPreviewEntry: whether to show the editable preview entry or not

-> m () 

Shows or hides the editable preview entry.

Since: 3.2

Properties

font

data FontChooserFontPropertyInfo Source #

Instances

AttrInfo FontChooserFontPropertyInfo Source # 
type AttrOrigin FontChooserFontPropertyInfo Source # 
type AttrLabel FontChooserFontPropertyInfo Source # 
type AttrGetType FontChooserFontPropertyInfo Source # 
type AttrBaseTypeConstraint FontChooserFontPropertyInfo Source # 
type AttrSetTypeConstraint FontChooserFontPropertyInfo Source # 
type AttrAllowedOps FontChooserFontPropertyInfo Source # 

fontDesc

data FontChooserFontDescPropertyInfo Source #

Instances

AttrInfo FontChooserFontDescPropertyInfo Source # 
type AttrOrigin FontChooserFontDescPropertyInfo Source # 
type AttrLabel FontChooserFontDescPropertyInfo Source # 
type AttrGetType FontChooserFontDescPropertyInfo Source # 
type AttrBaseTypeConstraint FontChooserFontDescPropertyInfo Source # 
type AttrSetTypeConstraint FontChooserFontDescPropertyInfo Source # 
type AttrAllowedOps FontChooserFontDescPropertyInfo Source # 

previewText

data FontChooserPreviewTextPropertyInfo Source #

Instances

AttrInfo FontChooserPreviewTextPropertyInfo Source # 
type AttrOrigin FontChooserPreviewTextPropertyInfo Source # 
type AttrLabel FontChooserPreviewTextPropertyInfo Source # 
type AttrGetType FontChooserPreviewTextPropertyInfo Source # 
type AttrBaseTypeConstraint FontChooserPreviewTextPropertyInfo Source # 
type AttrSetTypeConstraint FontChooserPreviewTextPropertyInfo Source # 
type AttrAllowedOps FontChooserPreviewTextPropertyInfo Source # 

showPreviewEntry

data FontChooserShowPreviewEntryPropertyInfo Source #

Instances

AttrInfo FontChooserShowPreviewEntryPropertyInfo Source # 
type AttrOrigin FontChooserShowPreviewEntryPropertyInfo Source # 
type AttrLabel FontChooserShowPreviewEntryPropertyInfo Source # 
type AttrGetType FontChooserShowPreviewEntryPropertyInfo Source # 
type AttrBaseTypeConstraint FontChooserShowPreviewEntryPropertyInfo Source # 
type AttrSetTypeConstraint FontChooserShowPreviewEntryPropertyInfo Source # 
type AttrAllowedOps FontChooserShowPreviewEntryPropertyInfo Source # 

Signals

fontActivated