Skip to content
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

Add face_index support to celiagg and kiva.agg backends. #605

Merged
merged 8 commits into from
Mar 10, 2021

Conversation

jwiggins
Copy link
Member

@jwiggins jwiggins commented Feb 22, 2021

Fixes #391

Leaving this as a draft for now, because it depends on the latest release of celiagg which is not yet available via EDM.

Aside from that this is a pretty scary change due to how twisty the font manager code is [and uncertainty about 3rd-party callers of said code]. It's be great to get some extra eyes on this before we move forward.

Copy link
Contributor

@kitchoi kitchoi left a comment

Choose a reason for hiding this comment

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

The little bit of exposure I had with font manager does not seem enough to qualify me as that second pair of 👀 . I would want to sit down to give this a harder look if I am to review this, but realistically speaking, I am not sure I have the bandwidth to do that. I am sorry.

One comment after a quick glance.

kiva/fonttools/tests/test_font.py Outdated Show resolved Hide resolved
@rahulporuri rahulporuri self-requested a review February 22, 2021 14:56
@jwiggins
Copy link
Member Author

We can wrap this up once #633 is merged.

@jwiggins jwiggins marked this pull request as ready for review February 26, 2021 13:58
@jwiggins
Copy link
Member Author

jwiggins commented Mar 5, 2021

OK. I've tested this on Windows and macOS and am happy where it's at. I'm ready for a full review!

@aaronayres35
Copy link
Contributor

aaronayres35 commented Mar 5, 2021

I have not reviewed the code changes at all, but here is an update of what I see when I run the benchmark suite on this branch:

show_text:
Screen Shot 2021-03-05 at 10 03 53 AM

show_text_2x:
Screen Shot 2021-03-05 at 10 04 44 AM

show_text_radial_gradient:
Screen Shot 2021-03-05 at 10 05 07 AM

@aaronayres35
Copy link
Contributor

After a git clean and a rebuild, I no longer see any italicized text 👍

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

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

LGTM with a couple of comments. Given the current refactor of font code that is happening in parallel, I guess we need to redo some of these changes?

self.assertTrue(os.path.exists(font_file_path))
spec = font.findfont()
self.assertTrue(os.path.exists(spec.filename))
self.assertEqual(spec.face_index, 0)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think its worth adding a test for face_index or will that be easier after the ongoing refactor of the font manager code?

Copy link
Member Author

Choose a reason for hiding this comment

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

A test for face_index? What do you mean? And yes, it'll probably be easier after integrating these changes with the new font manager code.

{
unsigned i;

if ((face_name_len + 4 + 1) > m_face_lookup_scratch_len)
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not entirely sure what the magical 4 and 1 here are.

Copy link
Member Author

Choose a reason for hiding this comment

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

4 for the face index (this is the %04u in the format string) and 1 for the NULL.

@jwiggins
Copy link
Member Author

Thanks for the feedback and testing. I'll integrate this into my larger font manager refactor and then we'll go from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Matching TTF fonts isn't working well
5 participants