Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FontProperties fail to roundtrip from their str #14977

Closed
@anntzer

Description

@anntzer

Bug report

Bug summary

FontProperties has a__str__ that appears to be intended to allow roundtripping (see use ofget_fontconfig_pattern/parse_fontconfig_pattern), but afterfp = FontProperties(); one hasFontProperties(str(fp)) != fp.

Code for reproduction

frommatplotlib.font_managerimportFontProperties,findfontfrommatplotlibimportstyle;style.use("seaborn")fp=FontProperties()print(fp)print(findfont(fp))fp_str_roundtrip=FontProperties(str(fp))print(fp_str_roundtrip)print(findfont(fp_str_roundtrip))

(setting the style to (matplotlib's version of) seaborn has the side-effect of changing the default sans-serif font from dejavusans to arial, which leads to the difference in the result of findfont -- otherwise, the default sans-serif font is also dejavusans and both calls to findfont return it).

Actual outcome

:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0/usr/share/fonts/TTF/arial.ttf:family=:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0findfont: Font family [''] not found. Falling back to DejaVu Sans./home/antony/src/extern/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf

Expected outcome

Proper roundtripping.

Matplotlib version

  • Operating system: linux
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 37
  • Jupyter version (if applicable):
  • Other libraries:

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp