Skip to content

Underscore character does not exist for cmr10 font #16995

@jrwrigh

Description

@jrwrigh

Bug report

The bundled font cmr10 (and it's associated family) do not contain the underscore character. Instead, the unicode character for the underscore (according to this website anyways) is actually mappted to the overdot.

See this StackOverflow for details, but I'll repeat here.

Code for reproduction

import matplotlib.pyplot as plt
plt.rcParams.update({
            'font.family': 'serif',
            'font.serif': 'cmr10',
})

variable = range(5)
plt.plot(variable, variable, label='test_underscore')
plt.plot(variable, variable, label='escape\_underscore')
plt.plot(variable, variable, label=r'rawtest_underscore')
plt.plot(variable, variable, label=r'rawescape\_underscore')
_=plt.legend()

Actual outcome

image

Expected outcome

image

Matplotlib version

  • Operating system: Manjaro 19.0.2
  • Matplotlib version: 3.1.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.6

Other
cmr10 loaded into FontForge shows that:
A) the underscore character doesn't exist
B) the normal underscore character (005f) is replaced by the overdot
image

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