Class PangoCairo

java.lang.Object
org.gnome.pango.cairo.PangoCairo

@Generated("org.javagi.JavaGI") public final class PangoCairo extends Object
Constants and functions that are declared in the global PangoCairo namespace.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable org.freedesktop.cairo.FontOptions
    Retrieves any font rendering options previously set with contextSetFontOptions(Context, FontOptions).
    static double
    Gets the resolution for the context.
    static @Nullable ShapeRendererFunc
    contextGetShapeRenderer(Context context, @Nullable MemorySegment data)
    Sets callback function for context to use for rendering attributes of type AttrType.SHAPE.
    static void
    contextSetFontOptions(Context context, @Nullable org.freedesktop.cairo.FontOptions options)
    Sets the font options used when rendering text with this context.
    static void
    contextSetResolution(Context context, double dpi)
    Sets the resolution for the context.
    static void
    Sets callback function for context to use for rendering attributes of type AttrType.SHAPE.
    static Context
    createContext(org.freedesktop.cairo.Context cr)
    Creates a context object set up to match the current transformation and target surface of the Cairo context.
    static Layout
    createLayout(org.freedesktop.cairo.Context cr)
    Creates a layout object set up to match the current transformation and target surface of the Cairo context.
    static void
    errorUnderlinePath(org.freedesktop.cairo.Context cr, double x, double y, double width, double height)
    Add a squiggly line to the current path in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error.
    static void
    glyphStringPath(org.freedesktop.cairo.Context cr, Font font, GlyphString glyphs)
    Adds the glyphs in glyphs to the current path in the specified cairo context.
    static void
     
    static void
    layoutLinePath(org.freedesktop.cairo.Context cr, LayoutLine line)
    Adds the text in PangoLayoutLine to the current path in the specified cairo context.
    static void
    layoutPath(org.freedesktop.cairo.Context cr, Layout layout)
    Adds the text in a PangoLayout to the current path in the specified cairo context.
    static void
    showErrorUnderline(org.freedesktop.cairo.Context cr, double x, double y, double width, double height)
    Draw a squiggly line in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error.
    static void
    showGlyphItem(org.freedesktop.cairo.Context cr, String text, GlyphItem glyphItem)
    Draws the glyphs in glyphItem in the specified cairo context,
    static void
    showGlyphString(org.freedesktop.cairo.Context cr, Font font, GlyphString glyphs)
    Draws the glyphs in glyphs in the specified cairo context.
    static void
    showLayout(org.freedesktop.cairo.Context cr, Layout layout)
    Draws a PangoLayout in the specified cairo context.
    static void
    showLayoutLine(org.freedesktop.cairo.Context cr, LayoutLine line)
    Draws a PangoLayoutLine in the specified cairo context.
    static void
    updateContext(org.freedesktop.cairo.Context cr, Context context)
    Updates a PangoContext previously created for use with Cairo to match the current transformation and target surface of a Cairo context.
    static void
    updateLayout(org.freedesktop.cairo.Context cr, Layout layout)
    Updates the private PangoContext of a PangoLayout created with createLayout(Context) to match the current transformation and target surface of a Cairo context.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PangoCairo

      public PangoCairo()
  • Method Details

    • javagi$ensureInitialized

      public static void javagi$ensureInitialized()
    • contextGetFontOptions

      public static @Nullable org.freedesktop.cairo.FontOptions contextGetFontOptions(Context context)

      Retrieves any font rendering options previously set with contextSetFontOptions(Context, FontOptions).

      This function does not report options that are derived from the target surface by updateContext(Context, Context).

      Parameters:
      context - a PangoContext, from a pangocairo font map
      Returns:
      the font options previously set on the context, or null if no options have been set. This value is owned by the context and must not be modified or freed.
      Since:
      1.10
    • contextGetResolution

      public static double contextGetResolution(Context context)

      Gets the resolution for the context.

      See contextSetResolution(Context, double)

      Parameters:
      context - a PangoContext, from a pangocairo font map
      Returns:
      the resolution in "dots per inch". A negative value will be returned if no resolution has previously been set.
      Since:
      1.10
    • contextGetShapeRenderer

      public static @Nullable ShapeRendererFunc contextGetShapeRenderer(Context context, @Nullable MemorySegment data)

      Sets callback function for context to use for rendering attributes of type AttrType.SHAPE.

      See PangoCairoShapeRendererFunc for details.

      Retrieves callback function and associated user data for rendering attributes of type AttrType.SHAPE as set by contextSetShapeRenderer(Context, ShapeRendererFunc), if any.

      Parameters:
      context - a PangoContext, from a pangocairo font map
      data - Pointer to gpointer to return user data
      Returns:
      the shape rendering callback previously set on the context, or null if no shape rendering callback have been set.
      Since:
      1.18
    • contextSetFontOptions

      public static void contextSetFontOptions(Context context, @Nullable org.freedesktop.cairo.FontOptions options)

      Sets the font options used when rendering text with this context.

      These options override any options that updateContext(Context, Context) derives from the target surface.

      Parameters:
      context - a PangoContext, from a pangocairo font map
      options - a cairo_font_options_t, or null to unset any previously set options. A copy is made.
      Since:
      1.10
    • contextSetResolution

      public static void contextSetResolution(Context context, double dpi)

      Sets the resolution for the context.

      This is a scale factor between points specified in a PangoFontDescription and Cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).

      Parameters:
      context - a PangoContext, from a pangocairo font map
      dpi - the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.
      Since:
      1.10
    • contextSetShapeRenderer

      public static void contextSetShapeRenderer(Context context, @Nullable ShapeRendererFunc func)

      Sets callback function for context to use for rendering attributes of type AttrType.SHAPE.

      See PangoCairoShapeRendererFunc for details.

      Parameters:
      context - a PangoContext, from a pangocairo font map
      func - Callback function for rendering attributes of type AttrType.SHAPE, or null to disable shape rendering.
      Since:
      1.18
    • createContext

      public static Context createContext(org.freedesktop.cairo.Context cr)

      Creates a context object set up to match the current transformation and target surface of the Cairo context.

      This context can then be used to create a layout using Layout().

      This function is a convenience function that creates a context using the default font map, then updates it to cr. If you just need to create a layout for use with cr and do not need to access PangoContext directly, you can use createLayout(Context) instead.

      Parameters:
      cr - a Cairo context
      Returns:
      the newly created PangoContext
      Since:
      1.22
    • createLayout

      public static Layout createLayout(org.freedesktop.cairo.Context cr)

      Creates a layout object set up to match the current transformation and target surface of the Cairo context.

      This layout can then be used for text measurement with functions like Layout#getSize or drawing with functions like showLayout(Context, Layout). If you change the transformation or target surface for cr, you need to call updateLayout(Context, Layout).

      This function is the most convenient way to use Cairo with Pango, however it is slightly inefficient since it creates a separate PangoContext object for each layout. This might matter in an application that was laying out large amounts of text.

      Parameters:
      cr - a Cairo context
      Returns:
      the newly created PangoLayout
      Since:
      1.10
    • errorUnderlinePath

      public static void errorUnderlinePath(org.freedesktop.cairo.Context cr, double x, double y, double width, double height)

      Add a squiggly line to the current path in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error.

      The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle.

      Parameters:
      cr - a Cairo context
      x - The X coordinate of one corner of the rectangle
      y - The Y coordinate of one corner of the rectangle
      width - Non-negative width of the rectangle
      height - Non-negative height of the rectangle
      Since:
      1.14
    • glyphStringPath

      public static void glyphStringPath(org.freedesktop.cairo.Context cr, Font font, GlyphString glyphs)

      Adds the glyphs in glyphs to the current path in the specified cairo context.

      The origin of the glyphs (the left edge of the baseline) will be at the current point of the cairo context.

      Parameters:
      cr - a Cairo context
      font - a PangoFont from a PangoCairoFontMap
      glyphs - a PangoGlyphString
      Since:
      1.10
    • layoutLinePath

      public static void layoutLinePath(org.freedesktop.cairo.Context cr, LayoutLine line)

      Adds the text in PangoLayoutLine to the current path in the specified cairo context.

      The origin of the glyphs (the left edge of the line) will be at the current point of the cairo context.

      Parameters:
      cr - a Cairo context
      line - a PangoLayoutLine
      Since:
      1.10
    • layoutPath

      public static void layoutPath(org.freedesktop.cairo.Context cr, Layout layout)

      Adds the text in a PangoLayout to the current path in the specified cairo context.

      The top-left corner of the PangoLayout will be at the current point of the cairo context.

      Parameters:
      cr - a Cairo context
      layout - a Pango layout
      Since:
      1.10
    • showErrorUnderline

      public static void showErrorUnderline(org.freedesktop.cairo.Context cr, double x, double y, double width, double height)

      Draw a squiggly line in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error.

      The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle.

      Parameters:
      cr - a Cairo context
      x - The X coordinate of one corner of the rectangle
      y - The Y coordinate of one corner of the rectangle
      width - Non-negative width of the rectangle
      height - Non-negative height of the rectangle
      Since:
      1.14
    • showGlyphItem

      public static void showGlyphItem(org.freedesktop.cairo.Context cr, String text, GlyphItem glyphItem)

      Draws the glyphs in glyphItem in the specified cairo context,

      embedding the text associated with the glyphs in the output if the output format supports it (PDF for example), otherwise it acts similar to showGlyphString(Context, Font, GlyphString).

      The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.

      Note that text is the start of the text for layout, which is then indexed by glyph_item->item->offset.

      Parameters:
      cr - a Cairo context
      text - the UTF-8 text that glyphItem refers to
      glyphItem - a PangoGlyphItem
      Since:
      1.22
    • showGlyphString

      public static void showGlyphString(org.freedesktop.cairo.Context cr, Font font, GlyphString glyphs)

      Draws the glyphs in glyphs in the specified cairo context.

      The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.

      Parameters:
      cr - a Cairo context
      font - a PangoFont from a PangoCairoFontMap
      glyphs - a PangoGlyphString
      Since:
      1.10
    • showLayout

      public static void showLayout(org.freedesktop.cairo.Context cr, Layout layout)

      Draws a PangoLayout in the specified cairo context.

      The top-left corner of the PangoLayout will be drawn at the current point of the cairo context.

      Parameters:
      cr - a Cairo context
      layout - a Pango layout
      Since:
      1.10
    • showLayoutLine

      public static void showLayoutLine(org.freedesktop.cairo.Context cr, LayoutLine line)

      Draws a PangoLayoutLine in the specified cairo context.

      The origin of the glyphs (the left edge of the line) will be drawn at the current point of the cairo context.

      Parameters:
      cr - a Cairo context
      line - a PangoLayoutLine
      Since:
      1.10
    • updateContext

      public static void updateContext(org.freedesktop.cairo.Context cr, Context context)

      Updates a PangoContext previously created for use with Cairo to match the current transformation and target surface of a Cairo context.

      If any layouts have been created for the context, it's necessary to call Layout#contextChanged on those layouts.

      Parameters:
      cr - a Cairo context
      context - a PangoContext, from a pangocairo font map
      Since:
      1.10
    • updateLayout

      public static void updateLayout(org.freedesktop.cairo.Context cr, Layout layout)
      Updates the private PangoContext of a PangoLayout created with createLayout(Context) to match the current transformation and target surface of a Cairo context.
      Parameters:
      cr - a Cairo context
      layout - a PangoLayout, from createLayout(Context)
      Since:
      1.10