GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: 等幅フォントが macOS で proportional fallback する問題を解消 (#97) by ymnao · Pull Request #132 · ymnao/scripta

Conversation

@ymnao

@ymnao ymnao commented Jun 3, 2026

Copy link
Copy Markdown
Owner

概要

設定で「等幅 (Monospace)」を選んでもエディタ等で proportional フォントが当たる問題 (#97) を修正。原因はフォントスタック先頭付近の SFMono-Regular (PostScript 名) が macOS 環境差で解決失敗するケース。スタックから SFMono-Regular を削除し、"SF Mono" (display name) を残しつつ Windows/Linux 向け fallback (Consolas / "Liberation Mono") を追記。あわせて 8 箇所に散在していた literal を CSS / TS それぞれ単一 source に整理。

関連 Issue

closes #97

移行 Stage

該当なし (bug fix 群 [7])

変更内容

  • フォントスタックを差し替え (SFMono-Regular を削除)
    • 旧: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace
    • 新: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace
  • CSS 側を Tailwind の --font-mono に統合 (src/index.css)
    • @theme { --font-mono: ... } で Tailwind デフォルト (SFMono-Regular を含む) を上書き
    • .font-mono utility (Kbd.tsx / FormInputs.tsx / MermaidEditorDialog.tsx の 4 箇所) も新スタックに解決
    • .search-panel-match / .slide-preview-content code / --editor-font-family 初期値も var(--font-mono) 経由に統一
  • TS 側を FONT_FAMILY_MAP.monospace に統合 (src/components/editor/editor-theme.ts)
    • .cm-codeblock-line / .cm-math-error / .cm-mermaid-error の literal を撤去
  • export.ts (src/lib/export.ts) は editor-theme.ts への依存で CodeMirror module を export 経路に引き込みたくないため literal 更新のみ (HTML 出力 portability 維持)

--editor-font-family は AppLayout.tsx で user fontFamily 設定値に runtime override されるため、user 設定に追従させたくない非エディタ monospace 用途 (search panel / slide preview / Tailwind util) は --font-mono を直参照して切り分け。

commit 構成 (3 commits)

# hash 内容
1 31fee51 fix: フォントスタックから SFMono-Regular 削除、8 箇所の literal を新スタックへ
2 eacf424 refactor: editor-theme.ts 内の literal 重複を FONT_FAMILY_MAP.monospace 参照に統合 + 独自 CSS 変数追加
3 dc548b2 fix: Tailwind font-mono utility デフォルト (--font-mono) も override し、CSS 側を --font-mono 単一 source 化

動作確認

  • pnpm format / pnpm lint / pnpm typecheck / pnpm typecheck:e2e green
  • pnpm test — 1845 passed / 2 skipped
  • pnpm test:e2e (renderer-only) — 143 passed
  • pnpm build 成功
  • pnpm check:legacy-residue green
  • build 後 CSS で .font-mono { font-family: var(--font-mono) } → --font-mono が新スタックに解決することを確認 (残存する SFMono-Regular 文字列は var(--default-mono-font-family, <fallback>) の到達不能 fallback)
  • macOS 実機で Settings → 等幅選択時のエディタ表示が等幅化されることを目視確認 (環境再現が必要 — レビュアー協力依頼)

スクリーンショット

該当なし (静的フォントスタック修正)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ymnao added 3 commits June 3, 2026 10:05
@ymnao
fix: 等幅フォントが macOS で proportional fallback する問題を解消 (#97)
31fee51
`SFMono-Regular` の PostScript 名解決が macOS 環境差で失敗するケースに対応するため、
フォントスタックから `SFMono-Regular` を削除し、`"SF Mono"` (display name) を先頭側へ。
Windows / Linux 向けの fallback として `Consolas` / `"Liberation Mono"` も追記。

new stack: `ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`

対象 8 箇所:
- src/index.css: `--editor-font-family` / `.search-panel-match` / `.slide-preview-content code`
- src/components/editor/editor-theme.ts: `FONT_FAMILY_MAP.monospace` /
  `.cm-codeblock-line` / `.cm-math-error` / `.cm-mermaid-error`
- src/lib/export.ts: HTML / PDF export 内 `code` セレクタ
@ymnao
refactor: 等幅フォントスタックの重複を解消 (#97 cleanup)
eacf424
bug fix #97 で 8 箇所に同一の monospace font-family literal が散在することが顕在化したため、シングルソース化:

- editor-theme.ts: `.cm-codeblock-line` / `.cm-math-error` / `.cm-mermaid-error`
  → 既存の `FONT_FAMILY_MAP.monospace` 参照に変更(同一ファイル内の literal 重複 4 → 1)
- index.css: `:root` に `--font-family-mono` 変数を追加し、
  `.search-panel-match` / `.slide-preview-content code` で `var(--font-family-mono)` を参照
  (`--editor-font-family` 初期値も同変数経由に統一)

`--editor-font-family` は AppLayout.tsx で user fontFamily 設定値に runtime override される
ため、user 設定に追従させたくない非エディタ monospace 用途には別変数 (`--font-family-mono`)
を用意して切り分けている。

`src/lib/export.ts` は editor-theme.ts に依存させると CodeMirror module を export 経路に
引き込むため、literal のまま残す(HTML 出力の portability も維持)。

`AppLayout.test.tsx` は `FONT_FAMILY_MAP.monospace` を動的参照しているため変更不要。
@ymnao
fix: Tailwind の font-mono utility も SFMono-Regular を含むデフォルトを上書き (#97)
dc548b2
前 commit で独自に追加した --font-family-mono は src/index.css 内の参照のみに効き、
Tailwind v4 デフォルトの --font-mono (SFMono-Regular を含む) は手付かずだった。
font-mono utility (Kbd.tsx / FormInputs.tsx / MermaidEditorDialog.tsx の 4 箇所) は
依然 SFMono-Regular にヒットし、#97 の修正が抜けていた。

修正: @theme ブロックで --font-mono を override し、独自 --font-family-mono を廃止
して全参照 (.search-panel-match / .slide-preview-content code / --editor-font-family
初期値) を Tailwind と同じ --font-mono に統合。これにより:

- Tailwind font-mono utility → --font-mono → 新スタックに解決 (build 出力で確認)
- 独自 monospace 参照も同じ --font-mono を共有 (CSS 側の単一 source)
- Tailwind chain (--default-mono-font-family → var(--font-mono)) も追従

build 後の CSS で残る "SFMono-Regular" は `var(--default-mono-font-family, <fallback>)`
のフォールバック値で、--default-mono-font-family が set されているため dead 領域。
Copilot AI review requested due to automatic review settings June 3, 2026 01:57
Copilot AI reviewed Jun 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ymnao
ymnao merged commit 1ed66ab into main Jun 3, 2026
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ymnao
ymnao deleted the fix/monospace-font-fallback branch June 3, 2026 02:01
ymnao added a commit that referenced this pull request Jun 5, 2026
@ymnao @claude
docs: CHANGELOG を v0.2.0 リリース内容に更新
0598509
- Fixed にバグ修正クラスタをロールアップ追記 (#116 #117 #120 #124 #130 #131 #132 #134 #135 #136 #137)
- Added に手動アップデートチェック (#98 → #138) を追記
- Dependencies を Phase α 反映の実バージョンに更新
  (electron 42.3.3 / biome 2.4.16 / zustand 5.0.14 / js-yaml 4.2.0 /
   dompurify 3.4.8 / marked 18.0.4 / lucide-react 1.17.0 /
   @codemirror/view 6.43.0 / vite 8.0.14 / vitest 4.1.7)
- リリース日を _(unreleased)_ に、旧リポ表記を scripta-tauri (private) に、
  footer URL を ymnao/scripta に修正

Co-Authored-By: Claude Opus 4.8 <[email protected]>
ymnao added a commit that referenced this pull request Jun 5, 2026
@ymnao @claude
release: v0.2.0 (Electron 版初回リリース) (#61)
be27030
* release: v0.2.0

- package.json:version 0.0.0 → 0.2.0
- CHANGELOG.md 新設(旧 Tauri 版から Electron への完全書き直し版として
  Added / Changed / Fixed / Dependencies / Security / 既知の制限 を記載)

closes #27

* docs: v0.2.0 リリース運用注釈と README の表現を release-ready に更新

レビュー指摘反映:
- README.md: "v0.2.0 を予定" / "リリース後 ... 取得できる予定" を
  リリース後にも valid な表現へ書き換え(merge → tag push 後に
  Releases ページが publish される前提)
- docs/parity-checklist.md § 12: 「必須 4 項目は tag push 前に
  手動検証で pass させ、検証ログを Release Notes に追記する」
  というリリース運用を冒頭に明示

* docs: CHANGELOG リリース日と parity-checklist リリース運用を実態に合わせる

レビュー指摘反映:
- CHANGELOG.md: リリース日を 2026-05-13 → 2026-05-14 (publish/tag 日に揃える)
- docs/parity-checklist.md § 12: release.yml が tag push 後に
  draft Release を `--generate-notes` で自動生成する流れに合わせ、
  「Release Notes 追記 → tag push」を「tag push → draft 自動生成
  → 生成された draft に検証ログ追記 → publish」の正しい順序へ修正

* docs: CHANGELOG を v0.2.0 リリース内容に更新

- Fixed にバグ修正クラスタをロールアップ追記 (#116 #117 #120 #124 #130 #131 #132 #134 #135 #136 #137)
- Added に手動アップデートチェック (#98 → #138) を追記
- Dependencies を Phase α 反映の実バージョンに更新
  (electron 42.3.3 / biome 2.4.16 / zustand 5.0.14 / js-yaml 4.2.0 /
   dompurify 3.4.8 / marked 18.0.4 / lucide-react 1.17.0 /
   @codemirror/view 6.43.0 / vite 8.0.14 / vitest 4.1.7)
- リリース日を _(unreleased)_ に、旧リポ表記を scripta-tauri (private) に、
  footer URL を ymnao/scripta に修正

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

fix: 等幅フォントが macOS で proportional fallback する疑い (SFMono-Regular)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ymnao
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.