Skip to content

small-caps doesn't seem to work #8552

Open

Description

@geib7592

I noticed that even in the demo, the small-caps feature is not working. I tried switching fonts to STIXGeneral, and setting variant='small-caps' still had no effect.

Activity

  1. added this to the milestone on Apr 30, 2017
  2. modified the milestones: , on Sep 24, 2017
  3. coderforlife commented on Feb 7, 2021

    @coderforlife

    This is still true.

  4. modified the milestones: needs sorting, v3.4.1 on Feb 7, 2021
  5. anntzer commented on Feb 7, 2021

    @anntzer
    Contributor

    This will basically not work (AFAICT) until we switch to using harfbuzz for font shaping (#14912). (Currently the way we detect small-caps fonts is just if their name is exactly (case-insensitively) either "capitals" or "small-caps", which of course fails to catch any relevant small caps font -- but it's not as if any simple regex on the font name would really be sufficient, see e.g. https://www.fontsc.com/font/tag/small-caps, https://www.fontsquirrel.com/fonts/list/tag/small%20caps.)

    Given that it seems unlikely we'll switch to harfbuzz any time soon (well, it depends on whether someone picks up #14912), I think we should simply just document "variant: small-caps" as unsupported and emit a warning when the user requests that.

  6. jklymak commented on Feb 7, 2021

    @jklymak
    Member

    It seems regenerating the images is the only hold up for harfbuzz?

  7. anntzer commented on Feb 7, 2021

    @anntzer
    Contributor

    Actually there's a bit more, e.g. figuring out whether we need static linking (especially the situation on non-linux), fixing a version, and all that stuff...

  8. jklymak commented on Feb 7, 2021

    @jklymak
    Member

    Where are we tracking g the image comparison issue? I think we should just go low tech and have two repositories and let folks who want smaller downloads just limit the depth they pull off GitHub.

  9. anntzer commented on Feb 7, 2021

    @anntzer
    Contributor
  10. modified the milestones: v3.4.1, on Feb 15, 2021
  11. modified the milestones: , needs sorting on Oct 6, 2022
  12. github-actions commented on Oct 9, 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!

  13. added
    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.
    on Nov 8, 2023
  14. AWildridge commented on Apr 19, 2024

    @AWildridge

    Are there any workarounds to get small caps fonts in text in matplotlib? Perhaps getting some LaTeX installation or something working with matplotlib? I would like to be able to use small caps as it is used a lot in high energy physics and our legends need to properly reflect the exact font formatting.

  15. oscargus commented on Apr 19, 2024

    @oscargus
    Member

    @AWildridge it should work if you use usetex=True as that will use standard LaTeX to generate the text, see https://matplotlib.org/stable/users/explain/text/usetex.html

    (The problem here is primarily that our internal mathtext engine cannot handle it, but with the correct preamble etc, anything that can be done in LaTeX can be done in Matplotlib.)

  16. removed
    status: inactiveMarked by the “Stale” Github Action
    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.
    on Apr 11, 2026
  17. QuLogic commented on Apr 17, 2026

    @QuLogic
    Member

    @dstansby pointed out that this didn't work in matplotlib/cheatsheets#183 (comment) Unfortunately, I had not noticed this property or I might have tried to do something with it in the font overhaul.

    That being said, it should be possible to get small caps working in 3.11 by passing the right font features (small caps is the smcp feature): matplotlib/cheatsheets#183 (comment)

    I do think that the font feature tag names are a bit unergonomic, so I wonder if we want to implement all the CSS options for font-variant (or at least the ones we are capable of providing.)

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions