warn and auto-select weight when font_name has no Normal(400) face#810
Open
romanstingler wants to merge 1 commit into
Open
warn and auto-select weight when font_name has no Normal(400) face#810romanstingler wants to merge 1 commit into
romanstingler wants to merge 1 commit into
Conversation
529accb to
e58e83e
Compare
Owner
|
Yep, it's something a little bit borderline and maybe could be placed in |
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.
ashellsilently falls back to a different font when the configuredfont_nameexists in the system font database but has no face withweight=Normal(400)(e.g. Terminus TTF, whose Regular face reportsweight=500/Mediumin its OS/2 table). This happens because cosmic-text's font matcher re-scores all faces and prefers the one whose weight is closest to the requestedNormal(400), even if that means picking a font from a different family.https://docs.rs/fontdb/0.23.0/src/fontdb/lib.rs.html#986
https://docs.rs/iced_core/0.14.0/src/iced_core/font.rs.html#74
Changes:
Add
fontdbas a direct dependency (same version already used transitively byiced_layershell)(@MalpenZibo no idea i am really weighing if it is OK to keep it here or to put it intoiced_layershell, but I think maybe you want to keepiced_layershellas slim as possible).Add
resolve_font()which:iced::Fontwith that face's actual weight and style, so cosmic-text's matcher stays on the right font.Normal(400)face is available.Fixes #768
