Skip to content

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

Merged
jwiggins merged 8 commits into
masterfrom
feature/font-face-index
Mar 10, 2021
Merged

Add face_index support to celiagg and kiva.agg backends.#605
jwiggins merged 8 commits into
masterfrom
feature/font-face-index

Conversation

@jwiggins
Copy link
Copy Markdown
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.

@jwiggins jwiggins requested a review from kitchoi February 22, 2021 12:26
Copy link
Copy Markdown
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.

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

We can wrap this up once #633 is merged.

@jwiggins jwiggins force-pushed the feature/font-face-index branch from 48ac3da to 27e3991 Compare February 26, 2021 13:22
@jwiggins jwiggins marked this pull request as ready for review February 26, 2021 13:58
Comment thread kiva/agg/agg-24/font_freetype/agg_font_freetype.cpp Outdated
@jwiggins
Copy link
Copy Markdown
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!

Comment thread kiva/agg/agg-24/font_freetype/agg_font_freetype.cpp Outdated
@aaronayres35
Copy link
Copy Markdown
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:

Details

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
Copy Markdown
Contributor

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

@jwiggins jwiggins requested a review from corranwebster March 9, 2021 08:47
Copy link
Copy Markdown
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?

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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