Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::canvas::FontScope Class Reference

#include <font_scope.hpp>

Public Member Functions

 FontScope (FontScopeId id)
 ~FontScope ()
 FontScope (const FontScope &)=delete
FontScope & operator= (const FontScope &)=delete
FontScopeId id () const noexcept
std::uint64_t generation () const noexcept
 Monotonic counter; incremented by every successful registration in this scope.
void bump_generation ()
 Forces a generation bump without a registration.
bool register_font (const std::uint8_t *data, std::size_t size, const std::string &family_override="")
 Register a font from raw TTF/OTF bytes into THIS scope.
bool register_font_file (const std::string &path, const std::string &family_override="")
 File variant.
bool is_registered (const std::string &family) const
 Family-name lookup limited to this scope.
void set_memory_budget (std::size_t bytes)
 Memory budget (in bytes) for caches associated with this scope: FontResolver typeface entries, TextShaper segment cache pressure, and Skia strike cache pressure.
std::size_t memory_budget () const noexcept
void prune_to_budget ()
 Explicit prune-to-budget trigger.

Constructor & Destructor Documentation

◆ FontScope() [1/2]

pulp::canvas::FontScope::FontScope ( FontScopeId id)
explicit

◆ ~FontScope()

pulp::canvas::FontScope::~FontScope ( )

◆ FontScope() [2/2]

pulp::canvas::FontScope::FontScope ( const FontScope & )
delete

Member Function Documentation

◆ bump_generation()

void pulp::canvas::FontScope::bump_generation ( )

Forces a generation bump without a registration.

Useful for integration tests and for scope-level "I know the underlying platform fonts changed" signals (e.g. macOS font activation).

◆ generation()

std::uint64_t pulp::canvas::FontScope::generation ( ) const
noexcept

Monotonic counter; incremented by every successful registration in this scope.

Never resets across process lifetime.

◆ id()

FontScopeId pulp::canvas::FontScope::id ( ) const
inlinenoexcept

◆ is_registered()

bool pulp::canvas::FontScope::is_registered ( const std::string & family) const

Family-name lookup limited to this scope.

Does not walk other scopes; that's the resolver's job.

◆ memory_budget()

std::size_t pulp::canvas::FontScope::memory_budget ( ) const
noexcept

◆ operator=()

FontScope & pulp::canvas::FontScope::operator= ( const FontScope & )
delete

◆ prune_to_budget()

void pulp::canvas::FontScope::prune_to_budget ( )

Explicit prune-to-budget trigger.

Called automatically by set_memory_budget; exposed so memory-pressure handlers can request a manual prune.

◆ register_font()

bool pulp::canvas::FontScope::register_font ( const std::uint8_t * data,
std::size_t size,
const std::string & family_override = "" )

Register a font from raw TTF/OTF bytes into THIS scope.

Returns true if Skia accepted the bytes and the registration was stored. Idempotent on family_override.

◆ register_font_file()

bool pulp::canvas::FontScope::register_font_file ( const std::string & path,
const std::string & family_override = "" )

File variant.

◆ set_memory_budget()

void pulp::canvas::FontScope::set_memory_budget ( std::size_t bytes)

Memory budget (in bytes) for caches associated with this scope: FontResolver typeface entries, TextShaper segment cache pressure, and Skia strike cache pressure.

0 (default) disables the budget. Setting a non-zero budget triggers an immediate prune_to_budget().


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/canvas/include/pulp/canvas/font_scope.hpp