feat(converter): add font fallback improvements for unknown and CJK fonts#86
Merged
feat(converter): add font fallback improvements for unknown and CJK fonts#86
Conversation
…onts - Add FontClassifier helper to classify unknown fonts by name patterns - "sans" pattern → sans-serif fallback - "mono", "code", "courier" patterns → monospace fallback - Other fonts default to serif - Add CJK font fallback chains for East Asian text: - Japanese (ja-JP): Noto Serif CJK JP, Yu Mincho, MS Mincho, etc. - Simplified Chinese (zh-hans): Noto Serif CJK SC, Microsoft YaHei, SimSun, etc. - Traditional Chinese (zh-hant): Noto Serif CJK TC, Microsoft JhengHei, PMingLiU, etc. - Korean (ko): Noto Serif CJK KR, Malgun Gothic, Batang, etc. - Fix Courier New and Lucida Console to include monospace fallback - Update CreateFontCssProperty to accept language context Addresses converter gaps #13 (Limited Font Fallback) and #14 (No CJK Font-Family Fallback Chain)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
FontClassifierhelper to classify unknown fonts by name patterns and apply appropriate generic fallbacks (serif/sans-serif/monospace)monospacefallback (was missing)CreateFontCssPropertyto accept language context for CJK detectionChanges
Unknown Font Classification
Fonts are classified by name patterns:
font-family: 'FontName', sans-seriffont-family: 'FontName', monospaceCJK Font Chains
Language-specific fallback chains for East Asian text:
'Noto Serif CJK JP', 'Yu Mincho', 'MS Mincho', ...'Noto Serif CJK SC', 'Microsoft YaHei', 'SimSun', ...'Noto Serif CJK TC', 'Microsoft JhengHei', 'PMingLiU', ...'Noto Serif CJK KR', 'Malgun Gothic', 'Batang', ...Test plan
Addresses converter gaps #13 (Limited Font Fallback) and #14 (No CJK Font-Family Fallback Chain)