Class FontDialog

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class FontDialog extends GObject

Asynchronous API to present a font chooser dialog.

GtkFontDialog collects the arguments that are needed to present the dialog to the user, such as a title for the dialog and whether it should be modal.

The dialog is shown with the chooseFont(Window, FontDescription, Cancellable, AsyncReadyCallback) function or its variants.

See FontDialogButton for a convenient control that uses GtkFontDialog and presents the results.

Since:
4.10
  • Constructor Details

    • FontDialog

      public FontDialog(MemorySegment address)
      Create a FontDialog instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • FontDialog

      public FontDialog()
      Create a new FontDialog.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the FontDialog class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected FontDialog asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • chooseFace

      public void chooseFace(@Nullable Window parent, @Nullable FontFace initialValue, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Presents a font chooser dialog to the user.

      The font chooser dialog will be set up for selecting a font face.

      A font face represents a font family and style, but no specific font size.

      Parameters:
      parent - the parent window
      initialValue - the initial value
      cancellable - a cancellable to cancel the operation
      callback - a callback to call when the operation is complete
      Since:
      4.10
    • chooseFaceFinish

      public FontFace chooseFaceFinish(AsyncResult result) throws GErrorException

      Finishes the chooseFace(Window, FontFace, Cancellable, AsyncReadyCallback) call.

      Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

      Parameters:
      result - the result
      Returns:
      the selected FontFace
      Throws:
      GErrorException - see GError
      Since:
      4.10
    • chooseFamily

      public void chooseFamily(@Nullable Window parent, @Nullable FontFamily initialValue, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Presents a font chooser dialog to the user.

      The font chooser dialog will be set up for selecting a font family.

      Parameters:
      parent - the parent window
      initialValue - the initial value
      cancellable - a cancellable to cancel the operation
      callback - a callback to call when the operation is complete
      Since:
      4.10
    • chooseFamilyFinish

      public FontFamily chooseFamilyFinish(AsyncResult result) throws GErrorException

      Finishes the chooseFamily(Window, FontFamily, Cancellable, AsyncReadyCallback) call.

      Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

      Parameters:
      result - the result
      Returns:
      the selected FontFamily
      Throws:
      GErrorException - see GError
      Since:
      4.10
    • chooseFont

      public void chooseFont(@Nullable Window parent, @Nullable FontDescription initialValue, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Presents a font chooser dialog to the user.

      The font chooser dialog will be set up for selecting a font.

      If you want to let the user select font features as well, use chooseFontAndFeatures(Window, FontDescription, Cancellable, AsyncReadyCallback) instead.

      Parameters:
      parent - the parent window
      initialValue - the font to select initially
      cancellable - a cancellable to cancel the operation
      callback - a callback to call when the operation is complete
      Since:
      4.10
    • chooseFontAndFeatures

      public void chooseFontAndFeatures(@Nullable Window parent, @Nullable FontDescription initialValue, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Presents a font chooser dialog to the user.

      The font chooser dialog will be set up for selecting a font and specify features for the selected font.

      Font features affect how the font is rendered, for example enabling glyph variants or ligatures.

      Parameters:
      parent - the parent window
      initialValue - the font to select initially
      cancellable - a cancellable to cancel the operation
      callback - a callback to call when the operation is complete
      Since:
      4.10
    • chooseFontFinish

      public FontDescription chooseFontFinish(AsyncResult result) throws GErrorException

      Finishes the chooseFont(Window, FontDescription, Cancellable, AsyncReadyCallback) call.

      Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

      Parameters:
      result - the result
      Returns:
      a Pango.FontDescription describing the selected font
      Throws:
      GErrorException - see GError
      Since:
      4.10
    • getFilter

      public @Nullable Filter getFilter()
      Returns the filter that decides which fonts to display in the font chooser dialog.
      Returns:
      the filter
      Since:
      4.10
    • getFontMap

      public @Nullable FontMap getFontMap()
      Returns the fontmap from which fonts are selected, or NULL for the default fontmap.
      Returns:
      the fontmap
      Since:
      4.10
    • getLanguage

      public @Nullable Language getLanguage()
      Returns the language for which font features are applied.
      Returns:
      the language for font features
      Since:
      4.10
    • getModal

      public boolean getModal()
      Returns whether the font chooser dialog blocks interaction with the parent window while it is presented.
      Returns:
      true if the font chooser dialog is modal
      Since:
      4.10
    • getTitle

      public String getTitle()
      Returns the title that will be shown on the font chooser dialog.
      Returns:
      the title
      Since:
      4.10
    • setFilter

      public void setFilter(@Nullable Filter filter)

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

      The filter must be able to handle both PangoFontFamily and PangoFontFace objects.

      Parameters:
      filter - the filter
      Since:
      4.10
    • setFontMap

      public void setFontMap(@Nullable FontMap fontmap)

      Sets the fontmap from which fonts are selected.

      If fontmap is NULL, the default fontmap is used.

      Parameters:
      fontmap - the fontmap
      Since:
      4.10
    • setLanguage

      public void setLanguage(Language language)
      Sets the language for which font features are applied.
      Parameters:
      language - the language for font features
      Since:
      4.10
    • setModal

      public void setModal(boolean modal)
      Sets whether the font chooser dialog blocks interaction with the parent window while it is presented.
      Parameters:
      modal - the new value
      Since:
      4.10
    • setTitle

      public void setTitle(String title)
      Sets the title that will be shown on the font chooser dialog.
      Parameters:
      title - the new title
      Since:
      4.10
    • builder

      public static FontDialog.Builder<? extends FontDialog.Builder> builder()
      A FontDialog.Builder object constructs a FontDialog with the specified properties. Use the various set...() methods to set properties, and finish construction with FontDialog.Builder.build().
      Returns:
      the builder object