package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Font_chooser

type t = [ `font_chooser ] Gobject.obj
val from_gobject : 'a Gobject.obj -> t
val set_show_preview_entry : t -> bool -> unit

Shows or hides the editable preview entry.

val set_preview_text : t -> string -> unit

Sets the text displayed in the preview area.

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

val set_level : t -> Gtk_enums.fontchooserlevel -> unit

Sets the desired level of granularity for selecting fonts.

val set_language : t -> string -> unit

Sets the language to use for font features.

val set_font_map : t -> Ocgtk_pango.Pango.Wrappers.Font_map.t option -> unit

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

val set_font_desc : t -> Ocgtk_pango.Pango.Wrappers.Font_description.t -> unit

Sets the currently-selected font from @font_desc.

val set_font : t -> string -> unit

Sets the currently-selected font.

val get_show_preview_entry : t -> bool

Returns whether the preview entry is shown or not.

val get_preview_text : t -> string

Gets the text displayed in the preview area.

val get_level : t -> Gtk_enums.fontchooserlevel

Returns the current level of granularity for selecting fonts.

val get_language : t -> string

Gets the language that is used for font features.

val get_font_size : t -> int

The selected font size.

val get_font_map : t -> Ocgtk_pango.Pango.Wrappers.Font_map.t option

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

val get_font_features : t -> string

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.

val get_font_family : t -> Ocgtk_pango.Pango.Wrappers.Font_family.t option

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.

val get_font_face : t -> Ocgtk_pango.Pango.Wrappers.Font_face.t option

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.

val get_font_desc : t -> Ocgtk_pango.Pango.Wrappers.Font_description.t option

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.

val get_font : t -> string option

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.

val on_font_activated : ?after:bool -> t -> callback:(fontname:string -> unit) -> Gobject.Signal.handler_id