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.
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
Implement checking if the font familly exists in pango #455
base: main
Are you sure you want to change the base?
Implement checking if the font familly exists in pango #455
Changes from 1 commit
7218cf2
43796b3
eb7b455
b3d9b85
f0e6f1c
6291c38
154eaf6
1ff7276
1101f30
f413247
d21f23a
7ca9372
88ccad2
bb0a741
0372651
720c44c
4f1fdbc
7eb17e8
bcedb2c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
As a note: a fancier version of this might do things like return
Helvetica Neue
forHelvetica
ifHelvetica
isn't present, and it might also want to be case-insensitive?Additionally, it looks like we aren't using this check? If we don't find the font we should return
None
.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.
What check do you mean? I can add the
Helvetica
->Helvetica Neue
check if thats what you mean.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.
What I mean is that we're looking at the families to see if
family_name
exists, but we're still always returningSome
from this function.We may also want to keep around a
HashSet
of family names so that we aren't doing a linear search each time, but that can be future work.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.
Just for fun here are some useful guidelines on font matching: https://drafts.csswg.org/css-fonts-3/#font-matching-algorithm
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.
I feel really stupid now. I just noticed this as well while looking at the code again.
As for the matching, I am honestly not sure how I would go about implementing that. Stripping away all the stuff we dont have/need, im left with the only restriction being "a case insensitive match". it should be easy to match case insensitively, but that doesnt solve the
Helvetica
->Helvetica Neue
match you wanted. I could check for substrings, I think thats easiest. It wont match the other way around, but we could check vise-versa as well?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.
There exists a function in pango for matching, I just use that.
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.
Is this a change you're going to make, or is it in the current version? I didn't see it.
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.
I currently made a change so that it uses the pango matching function.
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.
(the
better_match
function)