8000 Clarify docstring of FT2Font.get_glyph_name. by anntzer · Pull Request #15078 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Clarify docstring of FT2Font.get_glyph_name. #15078

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

Merged
merged 1 commit into from
Aug 19, 2019

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Aug 18, 2019

Sometimes the glyph_name returned is completely made up. We can't fix
that for now (this requires changes in ttfont), but at least we can warn
about it.

The "make-up-a-name" code is at

matplotlib/src/ft2font.cpp

Lines 798 to 809 in 70db457

void FT2Font::get_glyph_name(unsigned int glyph_number, char *buffer)
{
if (!FT_HAS_GLYPH_NAMES(face)) {
/* Note that this generated name must match the name that
is generated by ttconv in ttfont_CharStrings_getname. */
PyOS_snprintf(buffer, 128, "uni%08x", glyph_number);
} else {
if (FT_Error error = FT_Get_Glyph_Name(face, glyph_number, buffer, 128)) {
throw_ft_error("Could not get glyph names", error);
}
}
}

I got bitten by that in mplcairo :/

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Sometimes the glyph_name returned is completely made up.  We can't fix
that for now (this requires changes in ttfont), but at least we can warn
about it.
@jklymak jklymak merged commit a2de756 into matplotlib:master Aug 19, 2019
@anntzer anntzer deleted the ft2fontdoc branch August 19, 2019 05:52
@QuLogic QuLogic added this to the v3.2.0 milestone Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0