From de95f0ad2582cdd1f5ea2875f651fa3c7b6e128a Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 Jul 2026 07:50:50 +0000 Subject: [PATCH 04/71] fix(macos): name a real monospace family in the render probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The probe built FontDescriptions with the default family "regular", which resolves to no installed font, so the renderer threw "Failed to load regular font" before any pixels were produced. Only the regular face is mandatory (bold/italic/emoji fall back to it), so set a real monospace family on the four faces — Menlo by default (ships with macOS since 10.6), overridable as the second CLI argument. This also makes the probe the first real exercise of the rewritten CoreText locator. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/render_probe.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/contour_macos/render_probe.cpp b/src/contour_macos/render_probe.cpp index dff745a4..61fdb2ce 100644 --- a/src/contour_macos/render_probe.cpp +++ b/src/contour_macos/render_probe.cpp @@ -68,7 +68,21 @@ int main(int argc, char** argv) auto& terminal = mock.terminal; auto const colorPalette = terminal.colorPalette(); + + // A real monospace family must be named; the default "regular" resolves to no font and + // the renderer would throw. Menlo ships with macOS since 10.6. auto fonts = FontDescriptions {}; + char const* const family = argc > 2 ? argv[2] : "Menlo"; + for (text::font_description* fd: { &fonts.regular, &fonts.bold, &fonts.italic, &fonts.boldItalic }) + { + fd->familyName = family; + fd->wFamilyName = std::wstring(family, family + std::char_traits::length(family)); + } + fonts.regular.weight = text::font_weight::normal; + fonts.bold.weight = text::font_weight::bold; + fonts.italic.slant = text::font_slant::italic; + fonts.boldItalic.weight = text::font_weight::bold; + fonts.boldItalic.slant = text::font_slant::italic; auto renderer = Renderer { pageSize, fonts,