feat(fonts): Google Fonts fetching with local cache#57
Merged
Conversation
fonts: [{family: "Inter", source: "google", weights: [400,700]}]
(and <font family=.. source=google weights=..> in the HTML dialect)
downloads TTFs via the css2 endpoint with a non-browser UA and caches
them in ~/.cache/rustmotion/fonts (LOCALAPPDATA on Windows). Cache
hits never touch the network (tested with injected cache dirs); the
offline error names the family, the URL tried and the exact cache
path for manual placement. path stays required for local entries
(path+source conflict and missing-both are dedicated errors); existing
{path, family} entries deserialize and load unchanged. No new
dependencies (ureq was already there for icons). Clippy warnings from
the agent pass fixed during integration review.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50.
Goal: declare fonts by family name —
fonts: [{"family": "Inter", "source": "google", "weights": [400, 700]}], and<font family="Inter" source="google" weights="400,700">in the HTML dialect.~/.cache/rustmotion/fonts/<family-slug>-<weight>.ttf(%LOCALAPPDATA%on Windows); cache hits never touch the network — proven by tests with injected cache dirs and pre-placed filesFontEntry.pathbecomesOptionwith strict validation (missing both / both set → dedicated errors); existing{path, family}entries unchanged--all-targets(5 real warnings on the branch); fixed during review — the verification gap, not the feature.Tests: 22 new (URL building, CSS parsing, slugs, cache hits ×2, entry resolution ×4, HTML transpilation ×4, network test behind
#[ignore]). 272 total, all green.Verify:
cargo test --workspace→ 272 passed ✓ ·cargo fmt --check✓ · clippy 0 warnings ✓