Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright Generate Font Families

From Leeroopedia

Template:Implementation Page

Overview

Generate Font Families is a build utility that generates default font family configurations for Chromium from the Chromium source code's resource files.

Description

This script parses Chromium's resource XML files to extract default font family mappings for different scripts (Arabic, Cyrillic, CJK, etc.) and font categories (standard, serif, sans-serif, fixed, cursive, fantasy). It generates a JSON configuration file used by Playwright's Chromium implementation to set default fonts.

The script: 1. Reads Chromium's .grd resource files containing font family definitions 2. Maps Chromium's internal IDS constants to protocol font family names 3. Maps script suffixes (ARABIC, CYRILLIC, etc.) to ICU script codes 4. Produces a structured JSON output with per-script font family overrides

Usage

Run manually when updating the Chromium browser revision to regenerate font configurations.

Code Reference

Source Location

utils/generate_chromium_default_font_families.js (116 lines)

Key Classes

class ScriptFontFamilies {
  setFont(scriptName, familyName, value)
  toJSON()
}

Execution

node utils/generate_chromium_default_font_families.js <chromium-src-path>

I/O Contract

Inputs

  • Chromium source code path with .grd resource files
  • Script-to-ICU-code mapping table

Outputs

  • JSON file with font family configurations per script and category
  • Maps to Chrome DevTools Protocol font family names (standard, serif, sansSerif, fixed, cursive, fantasy)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment