Thanks to visit codestin.com
Credit goes to github.com

Skip to content

generating fontconfig strings from mpl FontProperties is broken #4910

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

Closed
wants to merge 2 commits into from

Conversation

jrevans
Copy link

@jrevans jrevans commented Aug 12, 2015

This was making invalid fontconfig strings (as per the fontconfig documentation). This added a leading ':' character when there shouldn't have been one. the 'family' parameter was being improperly escaped. This was adding 'family=' for the 'family' parameter when it shouldn't be there. The result was
that FontConfig would generate a pattern, but couldn't correctly read it back in. This has now been fixed.

This addresses an issue in #4897.

documentation).  This added a leading ':' character when there shouldn't have
been one.  the 'family' parameter was being improperly escaped.  This was adding
'family=' for the 'family' parameter when it shouldn't be there.  The result was
that FontConfig would generate a pattern, but couldn't correctly read it back
in.  This has now been fixed.
# Handle 'family' first and escape it properly
family = d.get_family()
if family:
if type(family) == list:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be isinstance(family, list)?

@tacaswell tacaswell added this to the next point release milestone Aug 12, 2015
@tacaswell
Copy link
Member

Can you add a test for this?

@tacaswell
Copy link
Member

You need to add test test files to the whitelist in matplotlib.__init__ https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L1403

These tests do not pass for me on either python 2 or 3

14:39 $ python tests.py -s --processes=8 --process-timeout=300 matplotlib.tests.test_fontconfig

FE
======================================================================
ERROR: matplotlib.tests.test_fontconfig.do_test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcaswell/.virtualenvs/mpl_2k/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
TypeError: do_test() takes exactly 2 arguments (0 given)

======================================================================
FAIL: matplotlib.tests.test_fontconfig.test_fontconfig
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcaswell/.virtualenvs/mpl_2k/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/tcaswell/source/my_source/matplotlib/lib/matplotlib/tests/test_fontconfig.py", line 40, in test_fontconfig
    do_test(f1, s1)
  File "/home/tcaswell/source/my_source/matplotlib/lib/matplotlib/tests/test_fontconfig.py", line 28, in do_test
    assert_equal(fc, expected)
AssertionError: u'Bitstream Vera Sans:style=normal:variant=normal:weight=400:stretch=normal:size [truncated]... != u"u'sans\\-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=1 [truncated]...
- Bitstream Vera Sans:style=normal:variant=normal:weight=400:stretch=normal:size=12.0
? ^^^ ------------                                       ^^^
+ u'sans\-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0'
? ^^    +++++++                                    ^^^^^^                         +


----------------------------------------------------------------------
Ran 2 tests in 0.383s

FAILED (errors=1, failures=1)

@tacaswell
Copy link
Member

ping @jrevans Any update on this?

@tacaswell
Copy link
Member

@jrevans Any updates on this?

@jrevans
Copy link
Author

jrevans commented Sep 27, 2015

I apologize for the delayed response. Things have been really busy at the day job. I expect to have some time in the upcoming week to get back to some of the remaining open issues/questions.

--James Evans

From: Thomas A Caswell [mailto:[email protected]]
Sent: Saturday, September 26, 2015 11:39 AM
To: matplotlib/matplotlib [email protected]
Cc: James Evans [email protected]
Subject: Re: [matplotlib] generating fontconfig strings from mpl FontProperties is broken (#4910)

@jrevans https://github.com/jrevans Any updates on this?


Reply to this email directly or view it on GitHub #4910 (comment) .

@tacaswell
Copy link
Member

I feel you on crazy day-job issues. I am hoping to get an rc2 out tonight, maybe do an rc3 next weekend?

@tacaswell tacaswell modified the milestones: next bug fix release (2.0.1), next point release (1.5.0) Oct 8, 2015
@tacaswell
Copy link
Member

@jrevans If you get this done it can go in, but we are not going to block on it.

@jrevans jrevans mentioned this pull request Oct 28, 2015
17 tasks
@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@jklymak
Copy link
Member

jklymak commented May 9, 2018

Given the amount of recent fontconfig work I'm going to guess this is now obsolete. Feel free to re-open if I'm mistaken! Thanks!

@jklymak jklymak closed this May 9, 2018
@anntzer
Copy link
Contributor

anntzer commented Dec 3, 2019

Superseded by #15601.

@story645 story645 removed this from the future releases milestone Oct 6, 2022
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.

8 participants