Skip to content

Type42 font embedding broken for fonts without glyph names #18307

Closed

Description

@anntzer

Bug report

Bug summary

Setting pdf.fonttype or ps.fonttype to 42 and using a font with no glyph names (i.e. for which FT_HAS_GLYPH_NAMES returns 0) results in non-displayed text.

Code for reproduction

Arial is a prominent font with no glyph names (so it's not a completely obscure edge case...).

from pathlib import Path
rcParams.update({"pdf.fonttype": 42, "ps.fonttype": 42}
figtext(.5, .5, "ab", font="arial")
savefig("/tmp/test.pdf")
savefig("/tmp/test.ps")

Actual outcome

Files are displayed as empty.

Expected outcome

Text is shown.


Again #18143 may be relevant here: perhaps fontTools can generate the glyph names table if needed?

Matplotlib version

  • Operating system: fedora
  • Matplotlib version: master
  • Python version: 38

Activity

  1. github-actions commented on Aug 16, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  2. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on Aug 16, 2023
  3. QuLogic commented on Aug 18, 2023

    @QuLogic
    Member

    I can't reproduce this on Windows, at least for PDF output on main. The Arial font there appears to have flags of FT_FACE_FLAG_SCALABLE | FT_FACE_FLAG_SFNT | FT_FACE_FLAG_HORIZONTAL | FT_FACE_FLAG_KERNING | FT_FACE_FLAG_EXTERNAL_STREAM | FT_FACE_FLAG_HINTER.

  4. anntzer commented on Aug 23, 2023

    @anntzer
    ContributorAuthor

    Indeed, this seems to have been fixed in the meantime (likely due to the switch to fonttools).

  5. removed
    keepItems to be ignored by the “Stale” Github Action
    on Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions