Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MNT: print fontname in missing glyph warning#26989

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 2 commits intomatplotlib:mainfromstory645:warning-fontname
Oct 27, 2023

Conversation

story645
Copy link
Member

@story645story645 commentedOct 3, 2023
edited
Loading

PR summary

Modified the "missing glyph" warning to also print out the name of the font the glyph is missing from. This is mostly to help me debug why#26854 is failing on CI but working locally but there have been times where I've gotten this error and would have found it helpful to have the added context.

second commit adds a :filter-warning: option to the..plot directive spun out into#27076

PR checklist

@story645story645 changed the titleprint fontname in missing glyph warningMNT: print fontname in missing glyph warningOct 3, 2023
@tacaswell
Copy link
Member

How does this interact with the fallback list? Presumable we would want to show all of the fonts that were considered?

@story645
Copy link
MemberAuthor

story645 commentedOct 4, 2023
edited
Loading

How does this interact with the fallback list? Presumable we would want to show all of the fonts that were considered?

Currently fallback suppresses the missing font and if fallback doesn't work only prints the first font

eta: I think b/c it's marked as a flag once and load_char_with_fallaback is kinda recursive.

bool was_found =load_char_with_fallback(ft_object_with_glyph, glyph_index, glyphs,
char_to_font, glyph_to_font, codepoints[n], flags,
charcode_error, glyph_error,false);
if (!was_found) {
ft_glyph_warn((FT_ULong)codepoints[n]);

@story645
Copy link
MemberAuthor

: I think b/c it's marked as a flag once and load_char_with_fallaback is kinda recursive.

Which also means I can't think of a clean way to only print the warnings if the fallback fails w/o maintaining a separate stack of warnings & I think that rabbit hole is out of scope for this PR.

@story645story645force-pushed thewarning-fontname branch 2 times, most recently from22e8b01 toe16b88dCompareOctober 4, 2023 18:56
@story645
Copy link
MemberAuthor

story645 commentedOct 4, 2023
edited
Loading

Added a :filter-warning: to the plot directive so docs can build cleanly, but I'm really unsure that raising the warnings is all that helpful to someone using fallback-presumably they're using it b/c they expect that not all the fonts will work.

@tacaswell
Copy link
Member

When we exhaust the list of fallback fonts, do we have anyway to get back to the top of the list and walk it again collecting all of their names?

@story645
Copy link
MemberAuthor

story645 commentedOct 4, 2023
edited
Loading

When we exhaust the list of fallback fonts, do we have anyway to get back to the top of the list and walk it again collecting all of their names?

Kinda maybe? if we exhaust the list, it means i==fallbacks.size() and if that works that's definitely a cleaner solution than the changes I've been making of passing around a cache object...but also currently pybind doesn't want to work for me so I can't build anything.

for (size_t i =0; i < fallbacks.size(); ++i) {
bool was_found = fallbacks[i]->load_char_with_fallback(
ft_object_with_glyph, final_glyph_index, parent_glyphs, parent_char_to_font,
parent_glyph_to_font, charcode, flags, charcode_error, glyph_error,override);
if (was_found) {
returntrue;
}
}
returnfalse;

@story645
Copy link
MemberAuthor

So I was wrong in that it'll miss the first glyph when there's an override.

@story645
Copy link
MemberAuthor

Got this to work by adding an array to F2tFont to store the names of the fonts. Reason is because if you can't find anything, you need to printfont + fallback_list

@story645story645force-pushed thewarning-fontname branch 4 times, most recently fromb3dd35d to1ff3b42CompareOctober 17, 2023 15:23
@story645story645force-pushed thewarning-fontname branch 2 times, most recently from0a39542 to296977bCompareOctober 17, 2023 19:56
tacaswell
tacaswell previously requested changesOct 18, 2023
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

I think this can be done without adding any new state to the objects.

@story645
Copy link
MemberAuthor

changed to parameter into function

@story645story645 added this to thev3.8.1 milestoneOct 22, 2023
@tacaswelltacaswell dismissed theirstale reviewOctober 26, 2023 20:30

passing cache through works.

@story645
Copy link
MemberAuthor

story645 commentedOct 27, 2023
edited
Loading

one warning w/ all the fonts instead of n warnings w/ one font per@tacaswell's request - and I'm 99% sure that the set can be passed from c++ to python directly but since this is for a string I figure there's no harm in doing the strcat on the C++ side since passing the set over would I think involve copying the set to the python set object. I figure this can get cleaned up as part of the pybind port if it's important enough.

@story645story645force-pushed thewarning-fontname branch 2 times, most recently from22c8c97 to6470890CompareOctober 27, 2023 06:00
lists all fallback fonts if glyph missing in all fontsremoved ft_get_char_index_or_warnadded a test for otf fonts on pdf + some windows fonts to testsCo-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
@ksundenksunden modified the milestones:v3.8.1,v3.9.0Oct 27, 2023
@tacaswell
Copy link
Member

one warning w/ all the fonts instead of n warnings w/ one font per@tacaswell's request

It was not a request, I only asked (in a private channel) why many instead of one!

@tacaswelltacaswell merged commitdbebe96 intomatplotlib:mainOct 27, 2023
@tacaswell
Copy link
Member

Thank you@story645 !

story645 reacted with thumbs up emoji

@story645story645 deleted the warning-fontname branchOctober 27, 2023 20:58
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@ksundenksundenksunden approved these changes

@tacaswelltacaswelltacaswell approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.9.0
Development

Successfully merging this pull request may close these issues.

4 participants
@story645@tacaswell@QuLogic@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp