Skip to content

KC-102: pdfTeX microtype model (protrusion + font expansion) - #86

Merged
jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/microtype
Sep 13, 2026
Merged

jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/microtype

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

New crate crates/microtype (owned paths only; no other crates touched).

  • Resolves microtype v3.2d config (bundled microtype.cfg + mt-cmr.cfg) into the exact lpcode/rpcode/efcode tables and pdffontexpand limits; matches pdfTeX dumps slot-for-slot for 96 fonts.
  • pdfTeX 1.40.27 protrusion/expansion primitives (char_pw, char/kern stretch, try_break shortfall rule, cal_expand_ratio, per-glyph expansion) with source citations.
  • Reference pdfTeX line_break/post_line_break/hpack in tests; 32 pdflatex oracle fixtures: 32/32 identical breaks, per-glyph expansion and margin kerns, glyph x error <= 0.00018pt. MT_MUTATE switches show every rule is load-bearing.
  • CONTRACT.md: proposed hooks for paragraph-layout and render-pipeline; HW1 delta = no break changes, HW2 = 2 paragraphs reflow (80 -> 79 lines).

cargo test in crates/microtype; regenerate fixtures with tests/oracle/generate.py (pdflatex oracle only).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

New crate crates/microtype (no dependencies, never runs TeX):

- config: parses microtype.cfg / mt-cmr.cfg (bundled unmodified, LPPL) and
  resolves per NFSS font the \lpcode/\rpcode/\efcode tables and
  \pdffontexpand limits exactly as microtype v3.2d does (font sets, list
  lookup order with family aliases, load= chains, T1 inheritance,
  \MT@scale rounding). Verified slot-for-slot against pdfTeX dumps for 96
  fonts.
- pdftex: protrusion (char_pw), char/kern stretch and shrink, the try_break
  shortfall rule, hpack's cal_expand_ratio and per-glyph expansion,
  transcribed from pdftex.web 1.40.27 and utils.c.
- arith: pdfTeX/e-TeX integer arithmetic.
- tests/common: reference pdfTeX line_break + post_line_break + hpack.
- tests/oracle: 32 pdflatex fixtures (EC and Latin Modern, 10/11/12pt,
  none/protrusion/expansion/both). All 32: identical breaks, identical
  per-glyph expansion, identical margin kerns, glyph x error <= 0.00018pt.
  MT_MUTATE switches show each pdfTeX rule is needed.
- CONTRACT.md: proposed hooks for paragraph-layout and render-pipeline, and
  the HW1/HW2 with/without-microtype delta (HW1: no break changes; HW2: two
  paragraphs reflow, 80 -> 79 lines).

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-102, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar
GoKubar marked this pull request as ready for review September 13, 2026 07:31
@jay3332
jay3332 merged commit b3a2806 into main Sep 13, 2026
14 of 18 checks passed
@jay3332

jay3332 commented Sep 13, 2026

Copy link
Copy Markdown
Member

Merged to main via integration/2026-09-13c (Commander orchestrator-jaysen-claude); hermetic library, tests green.

@GoKubar
GoKubar deleted the agent/kabir-claude/microtype branch September 13, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants