Skip to content

v1.3.0

Latest
Compare
Choose a tag to compare
@sammycage sammycage released this 22 Jul 17:10
· 11 commits to main since this release

Advanced Font Cache and Region Testing

This release adds a powerful font-face cache system and new APIs for testing whether a point lies within fill, stroke, or clip regions. It improves font management, enables dynamic font selection by family and style, and supports precise hit-testing for interactive graphics.


New APIs and Features

Font-Face Cache System

A complete API for managing and accessing font faces:

  • Creation and Lifecycle

    • plutovg_font_face_cache_create()
    • plutovg_font_face_cache_reference()
    • plutovg_font_face_cache_destroy()
    • plutovg_font_face_cache_reference_count()
    • plutovg_font_face_cache_reset()
  • Manual Addition and Retrieval

    • plutovg_font_face_cache_add()
      Adds a font face with a specified family and style.
    • plutovg_font_face_cache_add_file()
      Loads and adds a font face from a specific file.
    • plutovg_font_face_cache_get()
      Retrieves a font face matching a given style.
  • Bulk Font Loading

    • plutovg_font_face_cache_load_file()
      Loads all faces from a single file.
    • plutovg_font_face_cache_load_dir()
      Recursively loads fonts from a directory.
    • plutovg_font_face_cache_load_sys()
      Loads system-installed fonts.

Canvas Font Integration

The canvas can now associate and select fonts dynamically using:

  • plutovg_canvas_set_font_face_cache()
    Assigns a font cache to the canvas.

  • plutovg_canvas_get_font_face_cache()
    Retrieves the current cache from the canvas.

  • plutovg_canvas_add_font_face()
    Registers a font face under a family and style.

  • plutovg_canvas_add_font_file()
    Loads and registers a font face from a file.

  • plutovg_canvas_select_font_face()
    Selects a font face for use in drawing operations.

These APIs allow high-level font selection using family names and style flags (bold, italic), while internally managing font-face lifetimes through the cache.

Point Containment Queries

Three new functions provide hit-testing against rendering regions in user space:

  • plutovg_canvas_fill_contains()
    Tests whether a point lies within the current fill region (ignores clip and surface).

  • plutovg_canvas_stroke_contains()
    Tests whether a point lies within the stroked path outline.

  • plutovg_canvas_clip_contains()
    Tests whether a point lies inside the canvas clipping region.

These APIs allow precise user interaction handling, including mouse hit-tests and visual region queries.