Duration, dimensions and frame rate of a local video file, read from its
container/stream metadata via ffprobe — never by decoding a frame (that
is extract_video_frame’s job, and it decodes exactly one, not the
metadata).
How much larger than the target (layout) size icons are rasterized, so
Skia’s downscale keeps edges crisp under sub-pixel positioning and minor
scale animations.
Sentinel colour returned by parse_hex_color (and used by callers of
parse_css_color that choose to mirror this convention) when the input
string cannot be resolved as any known CSS colour form. Deliberately
jarring so a bad colour string is obvious on screen rather than
disappearing into a dark background.
Draw a text line with emoji-font and glyph-coverage fallback (#3, #8).
If emoji_font is None, falls back to drawing everything with the
primary font (plus any #3 system fallback the primary font’s coverage
gap needs).
Resolve a system fallback typeface that actually contains a glyph for
c, for when primary_family’s own face doesn’t cover it (audit #3:
CJK/Arabic/Devanagari/other scripts rendered as .notdef tofu when only
a Latin font-family was requested, because neither measurement nor
painting ever looked past the single requested typeface). This is
Skia’s font-fallback-by-character API — the same mechanism a browser
uses to substitute, say, a CJK font for Chinese text embedded in an
otherwise-Latin paragraph, instead of leaving .notdef tofu. Memoized
per thread (keyed on the inputs that actually affect the OS’s fallback
decision) since callers may probe this once per uncovered code point
during run segmentation. Returns None if no installed font covers c
either — the caller falls back to the originally requested (tofu-
producing) font, exactly the pre-fix behaviour, not worse.
Fetch an icon’s SVG bytes, checking the on-disk cache first and falling
back to the Iconify API on a miss. Same public signature as before this
fix — every existing caller (icon.rs, preload.rs, badge.rs,
notification.rs, list.rs, stat.rs) gets the disk cache for free.
Core of fetch_icon_svg, with the cache directory injectable so tests
can exercise the cache-hit path without touching $HOME or the network —
mirrors google_fonts::resolve_google_font’s cache_dir parameter.
Returns true if ffprobe is on PATH. Mirrors ffmpeg_available
above — ffprobe ships alongside ffmpeg in every common distribution but
is its own binary, so its own check.
Single source of truth for both the oversampled rasterization size and
the asset_cache key used for a given icon at a given target
(layout) size. Returns (render_width, render_height, cache_key).
Measure the width of a text line with emoji-font and glyph-coverage
fallback (#3, #8) — mirrors draw_text_with_fallback run-for-run so
the width this returns always matches what actually gets painted.
Parse a hex colour string (any CSS colour form, historically hex-only —
see module docs) into RGBA components. Infallible: unresolvable input is
reported to stderr and mapped to UNRESOLVED_COLOR rather than black.
Cheap (header-only) dimensions of a local raster image file. The image
crate’s ImageReader::into_dimensions builds just enough of the decoder
to read its declared dimensions, without decoding any pixel data —
unlike every existing paint-time image load in this codebase (image.rs,
avatar.rs, mockup.rs, …), which all go through
skia_safe::Image::from_encoded and pay for a full raster decode because
they need the pixels themselves. A metadata-only query has no such need,
so it takes the cheaper of the two paths instead of reusing theirs.
Probes a local video file’s metadata via ffprobe -show_streams -show_format -of json, a single subprocess call (no frame decode, no
download): the first video stream’s width/height/frame rate, and a
duration that prefers the stream’s own duration field but falls back to
the container’s format.duration (some containers — notably ones
produced by streaming muxers — only populate the latter).
Register a custom font’s bytes under family, tagged with the (weight, italic) style Skia reports for the parsed file. A no-op if that exact
(family, weight, italic) combination is already registered.
Look up only the custom/Google-font registry for family at the
requested style, without falling through to any system font. Exposed
for callers (e.g. codeblock/terminal’s monospace font resolver) that
need to check “did the scenario declare a custom font for this family”
before trying their own family-specific system fallback chain — unlike
typeface_with_fallback, which interleaves a single system-family
lookup between the custom check and its own generic Helvetica/Arial
catch-all, an order that doesn’t suit every caller (see issue: codeblock/
terminal’s hardcoded monospace fallback list was never reached because
typeface_with_fallback’s own system lookup already matched a decoy
system family, e.g. “JetBrains Mono”).
Resolve a typeface for family falling back through Helvetica → Arial →
the OS default. Returns RustmotionError::FontNotFound only if the host
system has no usable font at all (essentially unreachable on every
supported platform). Use this instead of .expect("FontNotFound") so we
never panic from a paint callback.