owned by cairo. To keep a reference to it, you must call [cairo.pattern.Pattern.reference].
userScaledFontGetForegroundSource
cairo.pattern.Pattern userScaledFontGetForegroundSource(cairo.scaled_font.ScaledFont scaledFont)Gets the foreground pattern of the glyph currently being rendered. A #cairo_user_scaled_font_render_glyph_func_t function that has been set with [cairo.global.userFontFaceSetRenderColorGlyphFunc] may call this function to retrieve the current foreground pattern for the glyph being rendered. The function should not be called outside of a [cairo.global.userFontFaceSetRenderColorGlyphFunc] callback.
This function returns the current source at the time the glyph is rendered. Compared with [cairo.global.userScaledFontGetForegroundMarker], this function returns the actual source pattern that will be used to render the glyph. The render callback is free to query the pattern and extract color components or other pattern data. For example if the render callback wants to create a gradient stop based on colors in the foreground source pattern, it will need to use this function in order to be able to query the colors in the foreground pattern.
While this function does not have the restrictions on using the pattern that [cairo.global.userScaledFontGetForegroundMarker] has, it does incur a performance penalty. If a render callback calls this function:
- Cairo will call the render callback whenever the current pattern
of the context in which the glyph is rendered changes.
- On backends that support font embedding (PDF, PostScript, and
SVG), cairo can not embed this glyph in a font. Instead the glyph will be emitted as an image or sequence of drawing operations each time it is used.
Parameters
scaledFont | A user scaled font |