Repository navigation
Fix regular font resolution when bold variants are discovered first #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
Preserve style distinctions before overwriting full-name entries.
NormalizeFontNamemaps bothMicrosoft YaHeiandMicrosoft YaHei Boldtomicrosoftyahei. If the regular file is scanned first and the bold file second, the bold file now replaces the regular mapping. Both lookups then return bold, so regular text can use the bold face. Keep style-sensitive full-name keys separate from family aliases.Also applies to: 2545-2545
Select the exact TTC face before a family match.
If a collection contains
Foo BoldbeforeFoo, both with familyFoo, the cache returns the collection path.LoadPreferredTtfFontBytesthen returns the first family match, which is bold, before reaching the regular full-name match. Regular text measurement can therefore use bold metrics. Search the collection for an exact full name before accepting a family match.Resolve the regular family face independently of discovery order.
When a bold face is enumerated before a regular face, and both share the family name
Foo, the family keyfookeeps the bold file. The regular face's full nameFoo Regularnormalizes tofooregular, so it does not replacefoo. A request forFoothen resolves to the bold file. The regular face is selected only when it is enumerated first.The unconditional full-name writes at lines 2537 and 2545 fix only the case where the regular face's full name normalizes to the family key (for example
Foo). This is the case the PR addresses. Faces whose full name includesRegularremain order-dependent.The required behavior: a family lookup for
Foomust return the regular face regardless of enumeration order. Exact full-name matches must keep precedence. The mechanism is the author's choice. It can change the family writes at lines 2538 and 2547, or select a regular face when the family key is first set.