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

Update docs of type1font#15942

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
anntzer merged 1 commit intomatplotlib:masterfromtimhoffm:doc-type1
Dec 16, 2019
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletionslib/matplotlib/type1font.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,8 +54,13 @@ class Type1Font:

def __init__(self, input):
"""
Initialize a Type-1 font. *input* can be either the file name of
a pfb file or a 3-tuple of already-decoded Type-1 font parts.
Initialize a Type-1 font.

Parameters
----------
input : str or 3-tuple
Either a pfb file name, or a 3-tuple of already-decoded Type-1
font `~.Type1Font.parts`.
"""
if isinstance(input, tuple) and len(input) == 3:
self.parts = input
Expand All@@ -67,9 +72,7 @@ def __init__(self, input):
self._parse()

def _read(self, file):
"""
Read the font from a file, decoding into usable parts.
"""
"""Read the font from a file, decoding into usable parts."""
rawdata = file.read()
if not rawdata.startswith(b'\x80'):
return rawdata
Expand DownExpand Up@@ -306,12 +309,23 @@ def suppress(tokens):

def transform(self, effects):
"""
Transform the font by slanting or extending. *effects* should
be a dict where ``effects['slant']`` is the tangent of the
angle that the font is to be slanted to the right (so negative
values slant to the left) and ``effects['extend']`` is the
multiplier by which the font is to be extended (so values less
than 1.0 condense). Returns a new :class:`Type1Font` object.
Return a new font that is slanted and/or extended.

Parameters
----------
effects : dict
A dict with optional entries:

- 'slant' : float, default: 0
Tangent of the angle that the font is to be slanted to the
right. Negative values slant to the left.
- 'extend' : float, default: 1
Scaling factor for the font width. Values less than 1 condense
the glyphs.

Returns
-------
font : `Type1Font`
"""
tokenizer = self._tokens(self.parts[0])
transformed = self._transformer(tokenizer,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp