hb-vector

hb-vector — Glyph vector conversion

Functions

hb_vector_draw_t * hb_vector_draw_create_or_fail ()
hb_vector_draw_t * hb_vector_draw_reference ()
void hb_vector_draw_destroy ()
hb_bool_t hb_vector_draw_set_user_data ()
void * hb_vector_draw_get_user_data ()
void hb_vector_draw_set_transform ()
void hb_vector_draw_get_transform ()
void hb_vector_draw_set_scale_factor ()
void hb_vector_draw_get_scale_factor ()
void hb_vector_draw_set_extents ()
hb_bool_t hb_vector_draw_get_extents ()
hb_bool_t hb_vector_draw_set_glyph_extents ()
hb_vector_format_t hb_vector_draw_get_format ()
hb_draw_funcs_t * hb_vector_draw_get_funcs ()
void hb_vector_draw_glyph ()
hb_bool_t hb_vector_draw_glyph_or_fail ()
void hb_vector_draw_set_precision ()
unsigned hb_vector_draw_get_precision ()
void hb_vector_draw_set_foreground ()
hb_color_t hb_vector_draw_get_foreground ()
void hb_vector_draw_set_background ()
hb_color_t hb_vector_draw_get_background ()
void hb_vector_draw_new_path ()
hb_blob_t * hb_vector_draw_render ()
void hb_vector_draw_clear ()
void hb_vector_draw_reset ()
void hb_vector_draw_recycle_blob ()
hb_vector_paint_t * hb_vector_paint_create_or_fail ()
hb_vector_paint_t * hb_vector_paint_reference ()
void hb_vector_paint_destroy ()
hb_bool_t hb_vector_paint_set_user_data ()
void * hb_vector_paint_get_user_data ()
void hb_vector_paint_set_transform ()
void hb_vector_paint_get_transform ()
void hb_vector_paint_set_scale_factor ()
void hb_vector_paint_get_scale_factor ()
void hb_vector_paint_set_extents ()
hb_bool_t hb_vector_paint_get_extents ()
hb_bool_t hb_vector_paint_set_glyph_extents ()
void hb_vector_paint_set_foreground ()
hb_color_t hb_vector_paint_get_foreground ()
void hb_vector_paint_set_background ()
hb_color_t hb_vector_paint_get_background ()
void hb_vector_paint_set_palette ()
int hb_vector_paint_get_palette ()
void hb_vector_paint_set_custom_palette_color ()
void hb_vector_paint_clear_custom_palette_colors ()
hb_vector_format_t hb_vector_paint_get_format ()
hb_paint_funcs_t * hb_vector_paint_get_funcs ()
void hb_vector_paint_glyph ()
hb_bool_t hb_vector_paint_glyph_or_fail ()
void hb_vector_paint_set_precision ()
unsigned hb_vector_paint_get_precision ()
void hb_vector_paint_set_svg_prefix ()
const char * hb_vector_paint_get_svg_prefix ()
hb_blob_t * hb_vector_paint_render ()
void hb_vector_paint_clear ()
void hb_vector_paint_reset ()
void hb_vector_paint_recycle_blob ()

Types and Values

Includes

#include <hb-vector.h>

Description

Functions for converting glyph outlines and color paint trees into SVG or PDF vector output.

hb_vector_draw_t converts monochrome glyph outlines into vector paths. Typical flow:

hb_vector_draw_t *draw = hb_vector_draw_create_or_fail (HB_VECTOR_FORMAT_SVG);
hb_vector_draw_set_scale_factor (draw, 64.f, 64.f);
hb_vector_draw_set_foreground (draw, foreground);
hb_vector_draw_glyph (draw, font, gid, pen_x, pen_y);
hb_blob_t *svg = hb_vector_draw_render (draw);

hb_vector_paint_t renders color paint graphs (COLRv0/v1) and embedded PNG images into vector output with gradients, layers, and compositing. Typical flow:

hb_vector_paint_t *paint = hb_vector_paint_create_or_fail (HB_VECTOR_FORMAT_SVG);
hb_vector_paint_set_scale_factor (paint, 64.f, 64.f);
hb_vector_paint_set_foreground (paint, foreground);
hb_vector_paint_glyph (paint, font, gid, pen_x, pen_y,
                       HB_VECTOR_EXTENTS_MODE_EXPAND);
hb_blob_t *svg = hb_vector_paint_render (paint);

Both contexts accumulate multiple glyphs into a single document. Call hb_vector_draw_render() / hb_vector_paint_render() to retrieve the final blob. Rendering clears all accumulated content (including extents), so retrieve any needed extents via hb_vector_draw_get_extents() / hb_vector_paint_get_extents() before rendering.

Each glyph is emitted as an independent element. If glyphs overlap and the foreground color is semi-transparent, the overlapping regions will be composited separately rather than painted as a single uniform layer.

Functions

hb_vector_draw_create_or_fail ()

hb_vector_draw_t *
hb_vector_draw_create_or_fail (hb_vector_format_t format);

Creates a new draw context for vector output.

Parameters

format

output format.

 

Returns

a newly allocated hb_vector_draw_t, or NULL on failure.

[nullable]

Since: 13.0.0


hb_vector_draw_reference ()

hb_vector_draw_t *
hb_vector_draw_reference (hb_vector_draw_t *draw);

Increases the reference count of draw .

Parameters

draw

a draw context.

 

Returns

referenced draw .

[transfer full]

Since: 13.0.0


hb_vector_draw_destroy ()

void
hb_vector_draw_destroy (hb_vector_draw_t *draw);

Decreases the reference count of draw and destroys it when it reaches zero.

Parameters

draw

a draw context.

 

Since: 13.0.0


hb_vector_draw_set_user_data ()

hb_bool_t
hb_vector_draw_set_user_data (hb_vector_draw_t *draw,
                              hb_user_data_key_t *key,
                              void *data,
                              hb_destroy_func_t destroy,
                              hb_bool_t replace);

Attaches user data to draw .

Parameters

draw

a draw context.

 

key

user-data key.

 

data

user-data value.

 

destroy

destroy callback for data .

[nullable]

replace

whether to replace an existing value for key .

 

Returns

true on success, false otherwise.

Since: 13.0.0


hb_vector_draw_get_user_data ()

void *
hb_vector_draw_get_user_data (const hb_vector_draw_t *draw,
                              hb_user_data_key_t *key);

Gets previously attached user data from draw .

Parameters

draw

a draw context.

 

key

user-data key.

 

Returns

user-data value associated with key .

[nullable]

Since: 13.0.0


hb_vector_draw_set_transform ()

void
hb_vector_draw_set_transform (hb_vector_draw_t *draw,
                              float xx,
                              float yx,
                              float xy,
                              float yy,
                              float dx,
                              float dy);

Sets the affine transform used when drawing glyphs.

Parameters

draw

a draw context.

 

xx

transform xx component.

 

yx

transform yx component.

 

xy

transform xy component.

 

yy

transform yy component.

 

dx

transform x translation.

 

dy

transform y translation.

 

Since: 13.0.0


hb_vector_draw_get_transform ()

void
hb_vector_draw_get_transform (const hb_vector_draw_t *draw,
                              float *xx,
                              float *yx,
                              float *xy,
                              float *yy,
                              float *dx,
                              float *dy);

Gets the affine transform used when drawing glyphs.

Parameters

draw

a draw context.

 

xx

transform xx component.

[out][nullable]

yx

transform yx component.

[out][nullable]

xy

transform xy component.

[out][nullable]

yy

transform yy component.

[out][nullable]

dx

transform x translation.

[out][nullable]

dy

transform y translation.

[out][nullable]

Since: 13.0.0


hb_vector_draw_set_scale_factor ()

void
hb_vector_draw_set_scale_factor (hb_vector_draw_t *draw,
                                 float x_scale_factor,
                                 float y_scale_factor);

Sets additional output scaling factors.

Parameters

draw

a draw context.

 

x_scale_factor

x scale factor.

 

y_scale_factor

y scale factor.

 

Since: 13.0.0


hb_vector_draw_get_scale_factor ()

void
hb_vector_draw_get_scale_factor (const hb_vector_draw_t *draw,
                                 float *x_scale_factor,
                                 float *y_scale_factor);

Gets additional output scaling factors.

Parameters

draw

a draw context.

 

x_scale_factor

x scale factor.

[out][nullable]

y_scale_factor

y scale factor.

[out][nullable]

Since: 13.0.0


hb_vector_draw_set_extents ()

void
hb_vector_draw_set_extents (hb_vector_draw_t *draw,
                            const hb_vector_extents_t *extents);

Sets or expands output extents on draw . Passing NULL clears extents.

Parameters

draw

a draw context.

 

extents

output extents to set or expand.

[nullable]

Since: 13.0.0


hb_vector_draw_get_extents ()

hb_bool_t
hb_vector_draw_get_extents (const hb_vector_draw_t *draw,
                            hb_vector_extents_t *extents);

Gets current output extents from draw .

Parameters

draw

a draw context.

 

extents

where to store current output extents.

[out][nullable]

Returns

true if extents are set, false otherwise.

Since: 13.0.0


hb_vector_draw_set_glyph_extents ()

hb_bool_t
hb_vector_draw_set_glyph_extents (hb_vector_draw_t *draw,
                                  const hb_glyph_extents_t *glyph_extents);

Expands draw extents using glyph_extents under the current transform.

Parameters

draw

a draw context.

 

glyph_extents

glyph extents in font units.

 

Returns

true on success, false otherwise.

Since: 13.0.0


hb_vector_draw_get_format ()

hb_vector_format_t
hb_vector_draw_get_format (const hb_vector_draw_t *draw);

Gets the output format draw was created with.

Parameters

draw

a vector draw context.

 

Returns

the output format.

Since: 14.2.0


hb_vector_draw_get_funcs ()

hb_draw_funcs_t *
hb_vector_draw_get_funcs (const hb_vector_draw_t *draw);

Gets draw callbacks for feeding outline data into draw . Pass draw as the draw_data argument when calling them.

Parameters

draw

a vector draw context.

 

Returns

immutable hb_draw_funcs_t.

[transfer none]

Since: 14.2.0


hb_vector_draw_glyph ()

void
hb_vector_draw_glyph (hb_vector_draw_t *draw,
                      hb_font_t *font,
                      hb_codepoint_t glyph,
                      hb_vector_extents_mode_t extents_mode);

Draws one glyph into draw . Equivalent to hb_vector_draw_glyph_or_fail() with the return value ignored.

Parameters

draw

a draw context.

 

font

font object.

 

glyph

glyph ID.

 

extents_mode

extents update mode.

 

Since: 14.2.0


hb_vector_draw_glyph_or_fail ()

hb_bool_t
hb_vector_draw_glyph_or_fail (hb_vector_draw_t *draw,
                              hb_font_t *font,
                              hb_codepoint_t glyph,
                              hb_vector_extents_mode_t extents_mode);

Convenience to draw one glyph into draw . Equivalent to:

// extend extents if requested
hb_vector_draw_new_path (draw);
hb_font_draw_glyph_or_fail (font, glyph,
  hb_vector_draw_get_funcs (draw), draw);

Parameters

draw

a draw context.

 

font

font object.

 

glyph

glyph ID.

 

extents_mode

extents update mode.

 

Returns

true if glyph data was emitted, false otherwise.

Since: 14.2.0


hb_vector_draw_set_precision ()

void
hb_vector_draw_set_precision (hb_vector_draw_t *draw,
                              unsigned  precision);

Sets numeric output precision for draw output.

Parameters

draw

a draw context.

 

precision

decimal precision.

 

Since: 14.2.0


hb_vector_draw_get_precision ()

unsigned
hb_vector_draw_get_precision (const hb_vector_draw_t *draw);

Returns the numeric output precision previously set on draw , or the default if none was set.

Parameters

draw

a draw context.

 

Returns

the precision.

Since: 14.2.0


hb_vector_draw_set_foreground ()

void
hb_vector_draw_set_foreground (hb_vector_draw_t *draw,
                               hb_color_t foreground);

Sets the fill color for drawn glyph outlines. Default is opaque black.

Parameters

draw

a draw context.

 

foreground

foreground fill color.

 

Since: 14.2.0


hb_vector_draw_get_foreground ()

hb_color_t
hb_vector_draw_get_foreground (const hb_vector_draw_t *draw);

Returns the foreground fill color.

Parameters

draw

a draw context.

 

Returns

the foreground color.

Since: 14.2.0


hb_vector_draw_set_background ()

void
hb_vector_draw_set_background (hb_vector_draw_t *draw,
                               hb_color_t background);

Sets the background color. If non-transparent, a filled rectangle covering the extents is emitted behind all content. Default is transparent (no background).

Parameters

draw

a draw context.

 

background

background color.

 

Since: 14.2.0


hb_vector_draw_get_background ()

hb_color_t
hb_vector_draw_get_background (const hb_vector_draw_t *draw);

Returns the background color.

Parameters

draw

a draw context.

 

Returns

the background color.

Since: 14.2.0


hb_vector_draw_new_path ()

void
hb_vector_draw_new_path (hb_vector_draw_t *draw);

Flushes any pending path and starts a new one. Call this between glyphs to separate their outlines so fill rules don't interact across glyphs.

Parameters

draw

a draw context.

 

Since: 14.2.0


hb_vector_draw_render ()

hb_blob_t *
hb_vector_draw_render (hb_vector_draw_t *draw);

Renders accumulated draw content to an output blob.

Parameters

draw

a draw context.

 

Returns

output blob, or NULL if rendering cannot proceed.

[transfer full][nullable]

Since: 13.0.0


hb_vector_draw_clear ()

void
hb_vector_draw_clear (hb_vector_draw_t *draw);

Discards accumulated draw output so draw can be reused for another render. User configuration (transform, scale factors, precision) is preserved. Call hb_vector_draw_reset() to also reset user configuration to defaults.

Parameters

draw

a draw context.

 

Since: 14.2.0


hb_vector_draw_reset ()

void
hb_vector_draw_reset (hb_vector_draw_t *draw);

Resets draw state and clears accumulated content.

Parameters

draw

a draw context.

 

Since: 13.0.0


hb_vector_draw_recycle_blob ()

void
hb_vector_draw_recycle_blob (hb_vector_draw_t *draw,
                             hb_blob_t *blob);

Provides a blob for internal buffer reuse by later render calls.

Parameters

draw

a draw context.

 

blob

previously rendered blob to recycle.

[nullable]

Since: 13.0.0


hb_vector_paint_create_or_fail ()

hb_vector_paint_t *
hb_vector_paint_create_or_fail (hb_vector_format_t format);

Creates a new paint context for vector output.

Parameters

format

output format.

 

Returns

a newly allocated hb_vector_paint_t, or NULL on failure.

[nullable]

Since: 13.0.0


hb_vector_paint_reference ()

hb_vector_paint_t *
hb_vector_paint_reference (hb_vector_paint_t *paint);

Increases the reference count of paint .

Parameters

paint

a paint context.

 

Returns

referenced paint .

[transfer full]

Since: 13.0.0


hb_vector_paint_destroy ()

void
hb_vector_paint_destroy (hb_vector_paint_t *paint);

Decreases the reference count of paint and destroys it when it reaches zero.

Parameters

paint

a paint context.

 

Since: 13.0.0


hb_vector_paint_set_user_data ()

hb_bool_t
hb_vector_paint_set_user_data (hb_vector_paint_t *paint,
                               hb_user_data_key_t *key,
                               void *data,
                               hb_destroy_func_t destroy,
                               hb_bool_t replace);

Attaches user data to paint .

Parameters

paint

a paint context.

 

key

user-data key.

 

data

user-data value.

 

destroy

destroy callback for data .

[nullable]

replace

whether to replace an existing value for key .

 

Returns

true on success, false otherwise.

Since: 13.0.0


hb_vector_paint_get_user_data ()

void *
hb_vector_paint_get_user_data (const hb_vector_paint_t *paint,
                               hb_user_data_key_t *key);

Gets previously attached user data from paint .

Parameters

paint

a paint context.

 

key

user-data key.

 

Returns

user-data value associated with key .

[nullable]

Since: 13.0.0


hb_vector_paint_set_transform ()

void
hb_vector_paint_set_transform (hb_vector_paint_t *paint,
                               float xx,
                               float yx,
                               float xy,
                               float yy,
                               float dx,
                               float dy);

Sets the affine transform used when painting glyphs.

Parameters

paint

a paint context.

 

xx

transform xx component.

 

yx

transform yx component.

 

xy

transform xy component.

 

yy

transform yy component.

 

dx

transform x translation.

 

dy

transform y translation.

 

Since: 13.0.0


hb_vector_paint_get_transform ()

void
hb_vector_paint_get_transform (const hb_vector_paint_t *paint,
                               float *xx,
                               float *yx,
                               float *xy,
                               float *yy,
                               float *dx,
                               float *dy);

Gets the affine transform used when painting glyphs.

Parameters

paint

a paint context.

 

xx

transform xx component.

[out][nullable]

yx

transform yx component.

[out][nullable]

xy

transform xy component.

[out][nullable]

yy

transform yy component.

[out][nullable]

dx

transform x translation.

[out][nullable]

dy

transform y translation.

[out][nullable]

Since: 13.0.0


hb_vector_paint_set_scale_factor ()

void
hb_vector_paint_set_scale_factor (hb_vector_paint_t *paint,
                                  float x_scale_factor,
                                  float y_scale_factor);

Sets additional output scaling factors.

Parameters

paint

a paint context.

 

x_scale_factor

x scale factor.

 

y_scale_factor

y scale factor.

 

Since: 13.0.0


hb_vector_paint_get_scale_factor ()

void
hb_vector_paint_get_scale_factor (const hb_vector_paint_t *paint,
                                  float *x_scale_factor,
                                  float *y_scale_factor);

Gets additional output scaling factors.

Parameters

paint

a paint context.

 

x_scale_factor

x scale factor.

[out][nullable]

y_scale_factor

y scale factor.

[out][nullable]

Since: 13.0.0


hb_vector_paint_set_extents ()

void
hb_vector_paint_set_extents (hb_vector_paint_t *paint,
                             const hb_vector_extents_t *extents);

Sets or expands output extents on paint . Passing NULL clears extents.

Parameters

paint

a paint context.

 

extents

output extents to set or expand.

[nullable]

Since: 13.0.0


hb_vector_paint_get_extents ()

hb_bool_t
hb_vector_paint_get_extents (const hb_vector_paint_t *paint,
                             hb_vector_extents_t *extents);

Gets current output extents from paint .

Parameters

paint

a paint context.

 

extents

where to store current output extents.

[out][nullable]

Returns

true if extents are set, false otherwise.

Since: 13.0.0


hb_vector_paint_set_glyph_extents ()

hb_bool_t
hb_vector_paint_set_glyph_extents (hb_vector_paint_t *paint,
                                   const hb_glyph_extents_t *glyph_extents);

Expands paint extents using glyph_extents under the current transform.

Parameters

paint

a paint context.

 

glyph_extents

glyph extents in font units.

 

Returns

true on success, false otherwise.

Since: 13.0.0


hb_vector_paint_set_foreground ()

void
hb_vector_paint_set_foreground (hb_vector_paint_t *paint,
                                hb_color_t foreground);

Sets fallback foreground color used by paint operations.

Parameters

paint

a paint context.

 

foreground

foreground color used for COLR foreground paints.

 

Since: 13.0.0


hb_vector_paint_get_foreground ()

hb_color_t
hb_vector_paint_get_foreground (const hb_vector_paint_t *paint);

Returns the foreground color previously set on paint , or the default opaque black if none was set.

Parameters

paint

a paint context.

 

Returns

the foreground color.

Since: 14.2.0


hb_vector_paint_set_background ()

void
hb_vector_paint_set_background (hb_vector_paint_t *paint,
                                hb_color_t background);

Sets the background color for paint . If set to a non-transparent value, the renderer emits a filled rectangle covering the extents behind all glyph content. Default is transparent (no background).

Parameters

paint

a paint context.

 

background

background color.

 

Since: 14.2.0


hb_vector_paint_get_background ()

hb_color_t
hb_vector_paint_get_background (const hb_vector_paint_t *paint);

Returns the background color previously set on paint , or transparent if none was set.

Parameters

paint

a paint context.

 

Returns

the background color.

Since: 14.2.0


hb_vector_paint_set_palette ()

void
hb_vector_paint_set_palette (hb_vector_paint_t *paint,
                             int palette);

Sets the color palette index used by paint operations.

Parameters

paint

a paint context.

 

palette

palette index for color glyph painting.

 

Since: 13.0.0


hb_vector_paint_get_palette ()

int
hb_vector_paint_get_palette (const hb_vector_paint_t *paint);

Returns the palette index previously set on paint , or 0 if none was set.

Parameters

paint

a paint context.

 

Returns

the palette index.

Since: 14.2.0


hb_vector_paint_set_custom_palette_color ()

void
hb_vector_paint_set_custom_palette_color
                               (hb_vector_paint_t *paint,
                                unsigned  color_index,
                                hb_color_t color);

Overrides one font palette color entry for subsequent paint operations. Overrides are keyed by color_index and persist on paint until cleared (or replaced for the same index).

These overrides are consulted by paint operations that resolve CPAL entries, including SVG glyph content using var(--colorN).

Parameters

paint

a paint context.

 

color_index

color index to override.

 

color

replacement color.

 

Since: 13.0.0


hb_vector_paint_clear_custom_palette_colors ()

void
hb_vector_paint_clear_custom_palette_colors
                               (hb_vector_paint_t *paint);

Clears all custom palette color overrides previously set on paint .

After this call, palette lookups use the selected font palette without custom override entries.

Parameters

paint

a paint context.

 

Since: 13.0.0


hb_vector_paint_get_format ()

hb_vector_format_t
hb_vector_paint_get_format (const hb_vector_paint_t *paint);

Gets the output format paint was created with.

Parameters

paint

a vector paint context.

 

Returns

the output format.

Since: 14.2.0


hb_vector_paint_get_funcs ()

hb_paint_funcs_t *
hb_vector_paint_get_funcs (const hb_vector_paint_t *paint);

Gets paint callbacks for emitting paint operations into paint . Pass paint as the paint_data argument when calling them.

Parameters

paint

a vector paint context.

 

Returns

immutable hb_paint_funcs_t.

[transfer none]

Since: 14.2.0


hb_vector_paint_glyph ()

void
hb_vector_paint_glyph (hb_vector_paint_t *paint,
                       hb_font_t *font,
                       hb_codepoint_t glyph,
                       hb_vector_extents_mode_t extents_mode);

Paints one glyph into paint . Unlike hb_vector_paint_glyph_or_fail(), glyphs with no color paint data fall back to a synthesized foreground-colored outline, so any glyph with an outline or bitmap image produces output.

Parameters

paint

a paint context.

 

font

font object.

 

glyph

glyph ID.

 

extents_mode

extents update mode.

 

Since: 14.2.0


hb_vector_paint_glyph_or_fail ()

hb_bool_t
hb_vector_paint_glyph_or_fail (hb_vector_paint_t *paint,
                               hb_font_t *font,
                               hb_codepoint_t glyph,
                               hb_vector_extents_mode_t extents_mode);

Convenience to paint one color glyph into paint . Equivalent to:

// extend extents if requested
hb_paint_funcs_t *funcs = hb_vector_paint_get_funcs (paint);
hb_paint_push_transform (funcs, paint, ...transform...);
hb_font_paint_glyph_or_fail (font, glyph, funcs, paint,
  palette, foreground);
hb_paint_pop_transform (funcs, paint);

Parameters

paint

a paint context.

 

font

font object.

 

glyph

glyph ID.

 

extents_mode

extents update mode.

 

Returns

true if glyph paint data was emitted, false otherwise.

Since: 14.2.0


hb_vector_paint_set_precision ()

void
hb_vector_paint_set_precision (hb_vector_paint_t *paint,
                               unsigned  precision);

Sets numeric output precision for paint output.

Parameters

paint

a paint context.

 

precision

decimal precision.

 

Since: 14.2.0


hb_vector_paint_get_precision ()

unsigned
hb_vector_paint_get_precision (const hb_vector_paint_t *paint);

Returns the numeric output precision previously set on paint , or the default if none was set.

Parameters

paint

a paint context.

 

Returns

the precision.

Since: 14.2.0


hb_vector_paint_set_svg_prefix ()

void
hb_vector_paint_set_svg_prefix (hb_vector_paint_t *paint,
                                const char *prefix);

Namespaces the paint's SVG output. Callers that inject multiple hb-vector SVGs into the same document (e.g. several glyph previews on one page) must set a distinct prefix per context so that the short IDs hb-vector uses for clipPaths, gradients, and use-refs don't collide in the DOM.

No effect on PDF output.

Parameters

paint

a paint context.

 

prefix

a null-terminated ASCII string to prepend to every emitted SVG id and url(#...) reference, or NULL for none.

 

Since: 14.2.0


hb_vector_paint_get_svg_prefix ()

const char *
hb_vector_paint_get_svg_prefix (const hb_vector_paint_t *paint);

Returns the SVG id prefix previously set on paint , or "" if none was set. The pointer remains valid until the next call to hb_vector_paint_set_svg_prefix() or hb_vector_paint_reset() on the same context.

Parameters

paint

a paint context.

 

Returns

the SVG id prefix.

Since: 14.2.0


hb_vector_paint_render ()

hb_blob_t *
hb_vector_paint_render (hb_vector_paint_t *paint);

Renders accumulated paint content to an output blob.

Parameters

paint

a paint context.

 

Returns

output blob, or NULL if rendering cannot proceed.

[transfer full][nullable]

Since: 13.0.0


hb_vector_paint_clear ()

void
hb_vector_paint_clear (hb_vector_paint_t *paint);

Discards accumulated paint output so paint can be reused for another render. User configuration (transform, scale factors, precision, foreground, palette, custom palette colors) is preserved. Call hb_vector_paint_reset() to also reset user configuration to defaults.

Parameters

paint

a paint context.

 

Since: 14.2.0


hb_vector_paint_reset ()

void
hb_vector_paint_reset (hb_vector_paint_t *paint);

Resets paint state and clears accumulated content.

Parameters

paint

a paint context.

 

Since: 13.0.0


hb_vector_paint_recycle_blob ()

void
hb_vector_paint_recycle_blob (hb_vector_paint_t *paint,
                              hb_blob_t *blob);

Provides a blob for internal buffer reuse by later render calls.

Parameters

paint

a paint context.

 

blob

previously rendered blob to recycle.

[nullable]

Since: 13.0.0

Types and Values

enum hb_vector_format_t

Output format for vector conversion.

Members

HB_VECTOR_FORMAT_INVALID

Invalid format.

 

HB_VECTOR_FORMAT_SVG

SVG output.

 

HB_VECTOR_FORMAT_PDF

PDF output.

 

Since: 13.0.0


hb_vector_extents_t

typedef struct {
  float x, y;
  float width, height;
} hb_vector_extents_t;

Vector output extents, mapped to SVG viewBox.

Members

float x;

Left edge of the output coordinate system.

 

float y;

Top edge of the output coordinate system.

 

float width;

Width of the output coordinate system.

 

float height;

Height of the output coordinate system.

 

Since: 13.0.0


enum hb_vector_extents_mode_t

Controls whether convenience glyph APIs update context extents.

Members

HB_VECTOR_EXTENTS_MODE_NONE

Do not update extents.

 

HB_VECTOR_EXTENTS_MODE_EXPAND

Union glyph ink extents into current extents.

 

Since: 13.0.0


hb_vector_draw_t

typedef struct hb_vector_draw_t hb_vector_draw_t;

Opaque draw context for vector outline conversion.

Since: 13.0.0


hb_vector_paint_t

typedef struct hb_vector_paint_t hb_vector_paint_t;

Opaque paint context for vector color-glyph conversion.

Since: 13.0.0