Skip to content

Commit

Permalink
Properly capitalize "Unicode".
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Jan 31, 2022
1 parent 30db833 commit 88cb4c9
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples/pyplots/text_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)

ax.text(3, 2, 'unicode: Institut f\374r Festk\366rperphysik')
ax.text(3, 2, 'Unicode: Institut f\374r Festk\366rperphysik')

ax.text(0.95, 0.01, 'colored text in axes coords',
verticalalignment='bottom', horizontalalignment='right',
Expand Down
4 changes: 2 additions & 2 deletions examples/text_labels_and_annotations/accented_text.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
r"""
=================================
Using accented text in matplotlib
Using accented text in Matplotlib
=================================
Matplotlib supports accented characters via TeX mathtext or unicode.
Matplotlib supports accented characters via TeX mathtext or Unicode.
Using mathtext, the following accents are provided: \\hat, \\breve, \\grave,
\\bar, \\acute, \\tilde, \\vec, \\dot, \\ddot. All of them have the same
Expand Down
10 changes: 5 additions & 5 deletions lib/matplotlib/_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def get_unicode_index(symbol, math=True):
Parameters
----------
symbol : str
A single unicode character, a TeX command (e.g. r'\pi') or a Type1
A single (Unicode) character, a TeX command (e.g. r'\pi') or a Type1
symbol name (e.g. 'phi').
math : bool, default: True
If False, always treat as a single unicode character.
If False, always treat as a single Unicode character.
"""
# for a non-math symbol, simply return its unicode index
# for a non-math symbol, simply return its Unicode index
if not math:
return ord(symbol)
# From UTF #25: U+2212 minus sign is the preferred
Expand All @@ -56,7 +56,7 @@ def get_unicode_index(symbol, math=True):
# length, usually longer than a hyphen.
if symbol == '-':
return 0x2212
try: # This will succeed if symbol is a single unicode char
try: # This will succeed if symbol is a single Unicode char
return ord(symbol)
except TypeError:
pass
Expand Down Expand Up @@ -482,7 +482,7 @@ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
except ValueError:
uniindex = ord('?')
found_symbol = False
_log.warning("No TeX to unicode mapping for {!a}.".format(sym))
_log.warning("No TeX to Unicode mapping for {!a}.".format(sym))

fontname, uniindex = self._map_virtual_font(
fontname, font_class, uniindex)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

# TODOs:
#
# * encoding of fonts, including mathtext fonts and unicode support
# * encoding of fonts, including mathtext fonts and Unicode support
# * TTF support has lots of small TODOs, e.g., how do you know if a font
# is serif/sans-serif, or symbolic/non-symbolic?
# * draw_quad_mesh
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

backend_version = __version__

# SPECIAL_KEYS are Qt::Key that do *not* return their unicode name
# SPECIAL_KEYS are Qt::Key that do *not* return their Unicode name
# instead they have manually specified names.
SPECIAL_KEYS = {
_to_int(getattr(_enum("QtCore.Qt.Key"), k)): v for k, v in [
Expand Down Expand Up @@ -374,12 +374,12 @@ def _get_key(self, event):
if event_key != key and event_mods & mod]
try:
# for certain keys (enter, left, backspace, etc) use a word for the
# key, rather than unicode
# key, rather than Unicode
key = SPECIAL_KEYS[event_key]
except KeyError:
# unicode defines code points up to 0x10ffff (sys.maxunicode)
# Unicode defines code points up to 0x10ffff (sys.maxunicode)
# QT will use Key_Codes larger than that for keyboard keys that are
# are not unicode characters (like multimedia keys)
# are not Unicode characters (like multimedia keys)
# skip these
# if you really want them, you should add them to SPECIAL_KEYS
if event_key > sys.maxunicode:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/qt_editor/_formlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
box) for each member of a datagroup inside a datagroup
Supported types for field_value:
- int, float, str, unicode, bool
- int, float, str, bool
- colors: in Qt-compatible text form, i.e. in hex format or name
(red, ...) (automatically detected from a string)
- list/tuple:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/mpl-data/stylelib/classic.mplstyle
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ axes.formatter.offset_threshold : 2 # When useoffset is True, the offset
# at least this number of significant
# digits from tick labels.

axes.unicode_minus : True # use unicode for the minus symbol
axes.unicode_minus : True # use Unicode for the minus symbol
# rather than hyphen. See
# https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
axes.prop_cycle : cycler('color', 'bgrcmyk')
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __call__(self, x, pos=None):
vmin, vmax = self.axis.get_view_interval()
d = np.rad2deg(abs(vmax - vmin))
digits = max(-int(np.log10(d) - 1.5), 0)
# Use unicode rather than mathtext with \circ, so that it will work
# Use Unicode rather than mathtext with \circ, so that it will work
# correctly with any arbitrary font (assuming it has a degree sign),
# whereas $5\circ$ will only work correctly with one of the supported
# math fonts (Computer Modern and STIX).
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def _test_enums_impl():

_enum("QtGui.QImage.Format").Format_ARGB32_Premultiplied
_enum("QtGui.QImage.Format").Format_ARGB32_Premultiplied
# SPECIAL_KEYS are Qt::Key that do *not* return their unicode name instead
# SPECIAL_KEYS are Qt::Key that do *not* return their Unicode name instead
# they have manually specified names.
SPECIAL_KEYS = {
_to_int(getattr(_enum("QtCore.Qt.Key"), k)): v
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ def test_params(self, unicode_minus, input, expected):
assert _formatter(input) == _exp_output

# Test several non default separators: no separator, a narrow
# no-break space (unicode character) and an extravagant string.
# no-break space (Unicode character) and an extravagant string.
for _sep in ("", "\N{NARROW NO-BREAK SPACE}", "@_@"):
# Case 2: unit=UNIT and sep=_sep.
# Replace the default space separator from the reference case
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/texmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class TexManager:
'avant garde': ('pag', r'\usepackage{avant}'),
'courier': ('pcr', r'\usepackage{courier}'),
# Loading the type1ec package ensures that cm-super is installed, which
# is necessary for unicode computer modern. (It also allows the use of
# is necessary for Unicode computer modern. (It also allows the use of
# computer modern at arbitrary sizes, but that's just a side effect.)
'monospace': ('cmtt', r'\usepackage{type1ec}'),
'computer modern roman': ('cmr', r'\usepackage{type1ec}'),
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _get_ps_font_and_encoding(texname):
# If psfonts.map specifies an encoding, use it: it gives us a
# mapping of glyph indices to Adobe glyph names; use it to convert
# dvi indices to glyph names and use the FreeType-synthesized
# unicode charmap to convert glyph names to glyph indices (with
# Unicode charmap to convert glyph names to glyph indices (with
# FT_Get_Name_Index/get_name_index), and load the glyph using
# FT_Load_Glyph/load_glyph. (That charmap has a coverage at least
# as good as, and possibly better than, the native charmaps.)
Expand Down
10 changes: 5 additions & 5 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def set_locs(self, locs):
def fix_minus(s):
"""
Some classes may want to replace a hyphen for minus with the proper
unicode symbol (U+2212) for typographical correctness. This is a
Unicode symbol (U+2212) for typographical correctness. This is a
helper method to perform such a replacement when it is enabled via
:rc:`axes.unicode_minus`.
"""
Expand Down Expand Up @@ -344,9 +344,9 @@ class FormatStrFormatter(Formatter):
The format string should have a single variable format (%) in it.
It will be applied to the value (not the position) of the tick.
Negative numeric values will use a dash not a unicode minus,
use mathtext to get a unicode minus by wrappping the format specifier
with $ (e.g. "$%g$").
Negative numeric values will use a dash, not a Unicode minus; use mathtext
to get a Unicode minus by wrappping the format specifier with $ (e.g.
"$%g$").
"""
def __init__(self, fmt):
self.fmt = fmt
Expand Down Expand Up @@ -542,7 +542,7 @@ def set_useLocale(self, val):

def _format_maybe_minus_and_locale(self, fmt, arg):
"""
Format *arg* with *fmt*, applying unicode minus and locale if desired.
Format *arg* with *fmt*, applying Unicode minus and locale if desired.
"""
return self.fix_minus(locale.format_string(fmt, (arg,), True)
if self._useLocale else fmt % arg)
Expand Down
4 changes: 2 additions & 2 deletions tools/create_DejaVuDisplay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# Subsetting DejaVu fonts to create a display-math-only font

# The DejaVu fonts include math display variants outside of the unicode range,
# The DejaVu fonts include math display variants outside of the Unicode range,
# and it is currently hard to access them from matploltib. The subset.py script
# in `tools` has been modified to move the math display variants found in DejaVu
# fonts into a new TTF font with these variants in the unicode range.
# fonts into a new TTF font with these variants in the Unicode range.

# This bash script calls the subset.py scripts with the appropriate options to
# generate the new font files `DejaVuSansDisplay.ttf` and
Expand Down
2 changes: 1 addition & 1 deletion tools/gh_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def encode_multipart_formdata(fields, boundary=None):
bytes. If the value is a tuple of two elements, then the first element
is treated as the filename of the form-data section.
Field names and filenames must be unicode.
Field names and filenames must be str.
:param boundary:
If not specified, then a random boundary will be generated using
Expand Down
2 changes: 1 addition & 1 deletion tools/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
print("Clear()", file=pe)

if '--move-display' in opts:
print("Moving display glyphs into unicode ranges...")
print("Moving display glyphs into Unicode ranges...")
font.familyname += " Display"
font.fullname += " Display"
font.fontname += "Display"
Expand Down
2 changes: 1 addition & 1 deletion tutorials/text/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Text
matplotlib has extensive text support, including support for
mathematical expressions, truetype support for raster and
vector outputs, newline separated text with arbitrary
rotations, and unicode support. These tutorials cover
rotations, and Unicode support. These tutorials cover
the basics of working with text in Matplotlib.
4 changes: 2 additions & 2 deletions tutorials/text/text_intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Matplotlib has extensive text support, including support for
mathematical expressions, truetype support for raster and
vector outputs, newline separated text with arbitrary
rotations, and unicode support.
rotations, and Unicode support.
Because it embeds fonts directly in output documents, e.g., for postscript
or PDF, what you see on the screen is what you get in the hardcopy.
Expand Down Expand Up @@ -87,7 +87,7 @@

ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)

ax.text(3, 2, 'unicode: Institut für Festkörperphysik')
ax.text(3, 2, 'Unicode: Institut für Festkörperphysik')

ax.text(0.95, 0.01, 'colored text in axes coords',
verticalalignment='bottom', horizontalalignment='right',
Expand Down

0 comments on commit 88cb4c9

Please sign in to comment.