Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
bundled_fonts.hpp File Reference
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <future>
#include <string>
#include <optional>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::canvas::DeclaredWeightRange
 One CSS @font-face rule's declared font-weight range (a single weight has min == max). More...

Namespaces

namespace  pulp
namespace  pulp::canvas

Enumerations

enum class  pulp::canvas::FontState : std::uint8_t { pulp::canvas::Pending , pulp::canvas::Loaded , pulp::canvas::Failed , pulp::canvas::Substituted }
 Async font lifecycle state. More...

Functions

bool pulp::canvas::register_font (const std::uint8_t *data, std::size_t size, const std::string &family_override="")
 Register a font from raw TTF/OTF bytes.
bool pulp::canvas::register_font_file (const std::string &path, const std::string &family_override="")
 Convenience overload: register a font from a file on disk.
void pulp::canvas::declare_font_face_weight_range (const std::string &family, int weight_min, int weight_max, const std::string &scope={})
 Records that an @font-face rule bound family at a declared weight range for scope.
void pulp::canvas::clear_declared_font_face_weight_ranges (const std::string &scope)
 Remove all declared ranges owned by scope.
bool pulp::canvas::has_declared_font_face_weights (const std::string &family)
 Whether any @font-face weight range has been declared for family.
int pulp::canvas::css_match_declared_weight (const std::vector< DeclaredWeightRange > &ranges, int desired_weight)
 The declared range CSS font matching picks for desired_weight (CSS Fonts 4 section 5.2): a range containing it, else for a desired weight in 400..500 the nearest range up to 500 then below then above, for one under 400 the nearest below then above, and for one over 500 the nearest above then below.
std::optional< bool > pulp::canvas::declared_face_synthesizes_bold (const std::string &family, int requested_weight)
 Whether Chromium synthesizes bold for requested_weight text in family: it does exactly when the request is 600 or more and the declared range CSS matching picks ends below 600.
std::uint64_t pulp::canvas::woff2_file_routes () noexcept
 How many register_font_file calls this process has routed to register_font_woff2 because the file started with the WOFF2 magic.
bool pulp::canvas::is_font_registered (const std::string &family)
 Returns true iff the requested family name was previously registered via register_font / register_font_file.
std::uint64_t pulp::canvas::font_registration_generation () noexcept
 Monotonic counter that bumps every time a typeface registration mutates process-global font state.
void pulp::canvas::bump_font_registration_generation () noexcept
 Force-bump the registration generation.
bool pulp::canvas::validate_font_bytes (const std::uint8_t *data, std::size_t size)
 Validate font bytes before handing them to Skia.
std::future< FontState > pulp::canvas::register_font_url (const std::string &url, const std::string &family_override="")
 Schedule a font registration from a URL or filesystem path and return a future that resolves to the final FontState.
bool pulp::canvas::register_font_woff2 (const std::uint8_t *woff2_data, std::size_t size, const std::string &family_override="")
 Register a WOFF2-compressed font at runtime.
bool pulp::canvas::woff2_decoder_available () noexcept
 Runtime check for WOFF2 decoder availability.
std::size_t pulp::canvas::cluster_step (const std::string &text, std::size_t byte_offset, bool forward=true)
 Grapheme-aware cursor step for TextEditor.
std::size_t pulp::canvas::word_break_step (const std::string &text, std::size_t byte_offset, const std::string &locale="", bool forward=true)
 Locale-aware word break iterator.
std::vector< std::size_t > pulp::canvas::line_break_opportunities (const std::string &text, const std::string &locale="")
 Find line-break opportunities in text.