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

The typed, hashable contract that replaces (family_string, size) throughout the font subsystem. More...

#include <font_options.hpp>

Public Member Functions

bool operator== (const FontOptions &) const =default
std::size_t hash () const noexcept
 Hash combining all fields.

Public Attributes

std::vector< std::string > family_stack
 Full CSS-style cascade.
float weight = 400.0f
 CSS scalar 100..900 (or variable-axis value when the resolved face has a wght axis).
float width = 100.0f
 CSS font-stretch scalar 50..200, also used as wdth axis value when present.
FontSlant slant = FontSlant::Normal
float oblique_angle = 0.0f
 Slant angle in degrees.
float size = 14.0f
 Pixel size at the canvas's current device scale.
std::vector< FontFeature > features
std::vector< VariationAxis > variation_axes
 Each entry: (axis tag, value).
std::string locale
 BCP-47 language tag ("", "en", "ja-JP", "zh-Hans").
BaseDirection direction = BaseDirection::Auto
float letter_spacing = 0.0f
 Extra letter spacing in px (post-shaping, between clusters).
float word_spacing = 0.0f
 Extra word spacing in px (applied at whitespace cluster boundaries).
HintingMode hinting_mode = HintingMode::PlatformDefault
AntiAliasMode aa_mode = AntiAliasMode::Default
ColorFontMode color_font_mode = ColorFontMode::Auto
FontSynthesisPolicy font_synthesis
FallbackMode fallback_mode = FallbackMode::Hybrid
FontScopeId scope = FontScopeId::global()
std::uint64_t registry_generation = 0
 Set by the resolver before returning a ResolvedFont.

Detailed Description

The typed, hashable contract that replaces (family_string, size) throughout the font subsystem.

Every resolver, shaper, line-layout, and paint cache keys on this whole structure.

Member Function Documentation

◆ hash()

std::size_t pulp::canvas::FontOptions::hash ( ) const
noexcept

Hash combining all fields.

Slow-path acceptable; cache keys take the hash once and reuse it for the lifetime of the lookup. Stable across process runs for the same input.

◆ operator==()

bool pulp::canvas::FontOptions::operator== ( const FontOptions & ) const
default

Member Data Documentation

◆ aa_mode

AntiAliasMode pulp::canvas::FontOptions::aa_mode = AntiAliasMode::Default

◆ color_font_mode

ColorFontMode pulp::canvas::FontOptions::color_font_mode = ColorFontMode::Auto

◆ direction

BaseDirection pulp::canvas::FontOptions::direction = BaseDirection::Auto

◆ fallback_mode

FallbackMode pulp::canvas::FontOptions::fallback_mode = FallbackMode::Hybrid

◆ family_stack

std::vector<std::string> pulp::canvas::FontOptions::family_stack

Full CSS-style cascade.

Order is significant; the resolver walks front-to-back. Empty vector falls through to platform default. An entry may keep its CSS quotes: a quoted entry is a literal family name, never a generic keyword (see split_css_font_family_list).

◆ features

std::vector<FontFeature> pulp::canvas::FontOptions::features

◆ font_synthesis

FontSynthesisPolicy pulp::canvas::FontOptions::font_synthesis

◆ hinting_mode

HintingMode pulp::canvas::FontOptions::hinting_mode = HintingMode::PlatformDefault

◆ letter_spacing

float pulp::canvas::FontOptions::letter_spacing = 0.0f

Extra letter spacing in px (post-shaping, between clusters).

◆ locale

std::string pulp::canvas::FontOptions::locale

BCP-47 language tag ("", "en", "ja-JP", "zh-Hans").

Drives ICU locale-aware shaping and line-break behavior.

◆ oblique_angle

float pulp::canvas::FontOptions::oblique_angle = 0.0f

Slant angle in degrees.

Used when slant == Oblique; ignored otherwise.

◆ registry_generation

std::uint64_t pulp::canvas::FontOptions::registry_generation = 0

Set by the resolver before returning a ResolvedFont.

Baked into every downstream cache key so stale resolutions become eligible for collection on the next lookup after a registration. Never set by the caller — exposed as a public field so caches that don't have access to the resolver (e.g. SkiaCanvas typeface cache) can still observe and bake it in.

◆ scope

FontScopeId pulp::canvas::FontOptions::scope = FontScopeId::global()

◆ size

float pulp::canvas::FontOptions::size = 14.0f

Pixel size at the canvas's current device scale.

Always in device-independent pixels (px); the canvas is responsible for any DPR/transform application.

◆ slant

FontSlant pulp::canvas::FontOptions::slant = FontSlant::Normal

◆ variation_axes

std::vector<VariationAxis> pulp::canvas::FontOptions::variation_axes

Each entry: (axis tag, value).

The resolver consults these for axis instancing. Ordering is irrelevant for resolution but preserved for trace fidelity.

◆ weight

float pulp::canvas::FontOptions::weight = 400.0f

CSS scalar 100..900 (or variable-axis value when the resolved face has a wght axis).

Defaults to 400 (Regular).

◆ width

float pulp::canvas::FontOptions::width = 100.0f

CSS font-stretch scalar 50..200, also used as wdth axis value when present.

Defaults to 100 (Normal).

◆ word_spacing

float pulp::canvas::FontOptions::word_spacing = 0.0f

Extra word spacing in px (applied at whitespace cluster boundaries).


The documentation for this struct was generated from the following file: