-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
API: convert string fontsize to points immediately #7007
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
Merged
QuLogic
merged 9 commits into
matplotlib:v2.x
from
tacaswell:api_set_font_size_at_creation_time
Dec 12, 2016
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
06dce26
API: convert string fontsize to points immediately
tacaswell 2ddcc68
API: cache usetex value at text creation time
tacaswell 98e9fb2
STY: some whitespace cleanups
tacaswell bb37ab6
MNT: ensure that defaults are cached init
tacaswell a578628
STY: wrap long line
tacaswell b079583
MNT: remove None from value checks
tacaswell 55c266c
MNT: set the family to rcParam value in init
tacaswell b6278e3
MNT: use else block to localize exceptions
tacaswell 5f4eead
MNT: minor simplification
tacaswell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MNT: ensure that defaults are cached init
This appears to already be the case for all of these properties, but remove the rcparams lookup from the get_* methods just to be sure.
- Loading branch information
commit bb37ab6fd1e2cbb9049feb2e66225701c36ba68e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,7 +355,7 @@ def _get_layout(self, renderer): | |
|
||
baseline = 0 | ||
for i, line in enumerate(lines): | ||
clean_line, ismath = self.is_math_text(line) | ||
clean_line, ismath = self.is_math_text(line, self.get_usetex()) | ||
if clean_line: | ||
w, h, d = renderer.get_text_width_height_descent(clean_line, | ||
self._fontproperties, | ||
|
@@ -782,7 +782,7 @@ def draw(self, renderer): | |
y = y + posy | ||
if renderer.flipy(): | ||
y = canvash - y | ||
clean_line, ismath = textobj.is_math_text(line) | ||
clean_line, ismath = textobj.is_math_text(line, self.get_usetex()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
if textobj.get_path_effects(): | ||
from matplotlib.patheffects import PathEffectRenderer | ||
|
@@ -1212,7 +1212,7 @@ def set_text(self, s): | |
self.stale = True | ||
|
||
@staticmethod | ||
def is_math_text(s): | ||
def is_math_text(s, usetex=None): | ||
""" | ||
Returns a cleaned string and a boolean flag. | ||
The flag indicates if the given string *s* contains any mathtext, | ||
|
@@ -1222,7 +1222,9 @@ def is_math_text(s): | |
""" | ||
# Did we find an even number of non-escaped dollar signs? | ||
# If so, treat is as math text. | ||
if self.get_usetex(): | ||
if usetex is None: | ||
usetex = rcParams['text.usetex'] | ||
if usetex: | ||
if s == ' ': | ||
s = r'\ ' | ||
return s, 'TeX' | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you forgotten to change this?