# subframe7536/maple-font architecture

> Architecture diagram of the GitHub repository subframe7536/maple-font, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subframe7536/maple-font
- Repository: https://github.com/subframe7536/maple-font

## Overview

Maple Mono is a coding-focused monospace font project. Its central workflow is configuring and running the font build, which assembles OpenType feature definitions and applies font transformations to produce font variants. Feature generation covers ligatures, character variants, stylistic sets, and italic/regular presets; separate tasks support Nerd Font and Chinese glyph integration, font merging, and browser-side feature testing. The graph follows documented capabilities and visible imports; unsampled task internals and some build-stage ordering are not asserted.

Main entry points: [`build.py`](https://github.com/subframe7536/maple-font/blob/v7/build.py) (Font Builder), [`source/py/feature/__init__.py`](https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/__init__.py) (Feature Generator), [`source/py/utils.py`](https://github.com/subframe7536/maple-font/blob/v7/source/py/utils.py) (Font Utilities), [`source/py/feature/italic.py`](https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/italic.py) (Style Presets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Font Build"]
  node_builder["Font Builder<br/>[build.py]"]
  node_transform["Glyph Transforms<br/>[transform.py]"]
  node_freeze["Browser Freeze<br/>[freeze.py]"]
end

subgraph group_features["OpenType Features"]
  node_featuregen["Feature Generator<br/>[__init__.py]"]
  node_ast["Feature AST<br/>[ast.py]"]
  node_basefeat["Base Features"]
  node_ligatures["Smart Ligatures"]
  node_charvariants["Character Variants"]
  node_stylefeatures["Stylistic Sets"]
  node_stylepresets["Style Presets<br/>[italic.py]"]
  node_regularpreset["Regular Preset<br/>[regular.py]"]
end

subgraph group_variants["Font Variants"]
end

subgraph group_tasks["Font Tasks"]
  node_cn["Chinese Font Task<br/>[cn.py]"]
  node_nerd["Nerd Font Task<br/>[nerdfont.py]"]
  node_merge["Font Merger<br/>[__init__.py]"]
  node_browser["Feature Preview<br/>[in_browser.py]"]
  node_utils["Font Utilities<br/>[utils.py]"]
end

node_user(("Font User"))
node_fontfiles["Font Files"]

node_user -.->|"configures build"| node_builder
node_builder -->|"generates features"| node_featuregen
node_builder -->|"transforms glyphs"| node_transform
node_builder -->|"uses utilities"| node_utils
node_builder -->|"freezes features"| node_freeze
node_featuregen -->|"builds feature AST"| node_ast
node_featuregen -->|"includes base rules"| node_basefeat
node_featuregen -->|"includes ligatures"| node_ligatures
node_featuregen -->|"selects style preset"| node_stylepresets
node_stylepresets -->|"assembles variants"| node_charvariants
node_stylepresets -->|"assembles style sets"| node_stylefeatures
node_ligatures -->|"creates substitutions"| node_ast
node_charvariants -->|"creates substitutions"| node_ast
node_builder -.->|"produces font variants"| node_fontfiles
node_user -.->|"requests CN build"| node_cn
node_user -.->|"requests icon support"| node_nerd
node_user -.->|"requests font merge"| node_merge
node_user -.->|"previews features"| node_browser
node_cn -->|"uses utilities"| node_utils
node_nerd -->|"uses utilities"| node_utils
node_merge -->|"uses utilities"| node_utils
node_freeze -->|"uses preview"| node_browser

click node_builder "https://github.com/subframe7536/maple-font/blob/v7/build.py"
click node_transform "https://github.com/subframe7536/maple-font/blob/v7/source/py/transform.py"
click node_freeze "https://github.com/subframe7536/maple-font/blob/v7/source/py/freeze.py"
click node_featuregen "https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/__init__.py"
click node_ast "https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/ast.py"
click node_basefeat "https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/base"
click node_ligatures "https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/calt"
click node_charvariants "https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/cv"
click node_stylefeatures "https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/ss"
click node_stylepresets "https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/italic.py"
click node_regularpreset "https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/regular.py"
click node_cn "https://github.com/subframe7536/maple-font/blob/v7/source/py/task/cn.py"
click node_nerd "https://github.com/subframe7536/maple-font/blob/v7/source/py/task/nerdfont.py"
click node_merge "https://github.com/subframe7536/maple-font/blob/v7/source/py/task/merge_font/__init__.py"
click node_browser "https://github.com/subframe7536/maple-font/blob/v7/source/py/in_browser.py"
click node_utils "https://github.com/subframe7536/maple-font/blob/v7/source/py/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_builder,node_transform,node_freeze,node_user toneBlue
class node_featuregen,node_ast,node_basefeat,node_ligatures,node_charvariants,node_stylefeatures,node_stylepresets,node_regularpreset toneAmber
class node_cn,node_nerd,node_merge,node_browser,node_utils toneRose
class node_fontfiles toneIndigo
```

## Components

### Font Build

- [Font Builder](https://github.com/subframe7536/maple-font/blob/v7/build.py): `build.py`
- [Glyph Transforms](https://github.com/subframe7536/maple-font/blob/v7/source/py/transform.py): `source/py/transform.py`
- [Browser Freeze](https://github.com/subframe7536/maple-font/blob/v7/source/py/freeze.py): `source/py/freeze.py`

### OpenType Features

- [Feature Generator](https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/__init__.py): `source/py/feature/__init__.py`
- [Feature AST](https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/ast.py): `source/py/feature/ast.py`
- [Base Features](https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/base): `source/py/feature/base`
- [Smart Ligatures](https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/calt): `source/py/feature/calt`
- [Character Variants](https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/cv): `source/py/feature/cv`
- [Stylistic Sets](https://github.com/subframe7536/maple-font/tree/v7/source/py/feature/ss): `source/py/feature/ss`
- [Style Presets](https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/italic.py): `source/py/feature/italic.py`
- [Regular Preset](https://github.com/subframe7536/maple-font/blob/v7/source/py/feature/regular.py): `source/py/feature/regular.py`

### Font Tasks

- [Chinese Font Task](https://github.com/subframe7536/maple-font/blob/v7/source/py/task/cn.py): `source/py/task/cn.py`
- [Nerd Font Task](https://github.com/subframe7536/maple-font/blob/v7/source/py/task/nerdfont.py): `source/py/task/nerdfont.py`
- [Font Merger](https://github.com/subframe7536/maple-font/blob/v7/source/py/task/merge_font/__init__.py): `source/py/task/merge_font/__init__.py`
- [Feature Preview](https://github.com/subframe7536/maple-font/blob/v7/source/py/in_browser.py): `source/py/in_browser.py`
- [Font Utilities](https://github.com/subframe7536/maple-font/blob/v7/source/py/utils.py): `source/py/utils.py`

### Other components

- **Font User**
- **Font Files**

## Connections

- Font User → Font Builder: configures build
- Font Builder → Feature Generator: generates features (evidence: `build.py`)
- Font Builder → Glyph Transforms: transforms glyphs (evidence: `build.py`)
- Font Builder → Font Utilities: uses utilities (evidence: `build.py`)
- Font Builder → Browser Freeze: freezes features (evidence: `build.py`)
- Feature Generator → Feature AST: builds feature AST (evidence: `source/py/feature/__init__.py`)
- Feature Generator → Base Features: includes base rules (evidence: `source/py/feature/__init__.py`)
- Feature Generator → Smart Ligatures: includes ligatures (evidence: `source/py/feature/__init__.py`)
- Feature Generator → Style Presets: selects style preset (evidence: `source/py/feature/__init__.py`)
- Style Presets → Character Variants: assembles variants (evidence: `source/py/feature/italic.py`)
- Style Presets → Stylistic Sets: assembles style sets (evidence: `source/py/feature/italic.py`)
- Smart Ligatures → Feature AST: creates substitutions (evidence: `source/py/feature/calt/tag.py`)
- Character Variants → Feature AST: creates substitutions (evidence: `source/py/feature/cv/cv01.py`)
- Font Builder → Font Files: produces font variants
- Font User → Chinese Font Task: requests CN build
- Font User → Nerd Font Task: requests icon support
- Font User → Font Merger: requests font merge
- Font User → Feature Preview: previews features
- Chinese Font Task → Font Utilities: uses utilities (evidence: `source/py/task/cn.py`)
- Nerd Font Task → Font Utilities: uses utilities (evidence: `source/py/task/nerdfont.py`)
- Font Merger → Font Utilities: uses utilities (evidence: `source/py/task/merge_font/__init__.py`)
- Browser Freeze → Feature Preview: uses preview (evidence: `source/py/freeze.py`)
