Skip to content

Phase 4 Step 4: @font-face / custom web fonts #45

@thomasnemer

Description

@thomasnemer

Parent: #41

Goal

Implement @font-face support and custom web font loading so that pages can use fonts fetched from the network.

Prerequisites

  • Steps 2-3 (render pipeline stable before adding font complexity)

Implementation

  • Parse @font-face rule: font-family, src (url + format hints), font-weight, font-style, font-display, unicode-range
  • Font loader: fetch WOFF2/WOFF/TTF via ie-net
  • WOFF2 decompression using woff2 crate
  • Disk + memory font cache (avoid re-downloading)
  • Register loaded fonts into fontdb/cosmic-text so glyphon picks them up
  • Implement font-display behavior state machine per @font-face: swap, block, fallback, optional
  • Trigger relayout when a font transitions from loading to loaded state

Tests

  • @font-face parsing tests for all descriptors
  • WOFF2 decompression round-trip tests
  • Font cache hit/miss tests
  • font-display state machine transition tests
  • Integration test: page with custom font loads, relayouts, renders correctly

Acceptance Criteria

  • @font-face rules parse correctly in ie-css
  • WOFF2, WOFF, and TTF fonts load and decompress correctly
  • Fonts are cached on disk and in memory
  • font-display behaviors match spec (swap, block, fallback, optional)
  • Layout updates when custom fonts finish loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions