Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
2øªjš3 ã @ s d Z ddlmZ ddlmZ dddddd gZG d
d„ deƒZG dd„ dƒZG dd„ deƒZ G d
d„ deeƒZ
G dd„ deƒZG dd„ de
ƒZ
G dd„ de
ƒZdd„ Zdd „ ZG dd„ deƒZedk�redƒZejdƒ ejd ƒ ejd!d"d#d$ƒ ejƒ edƒZejd%d&d'd(dƒ ejƒ dS ))aÛ fontTools.pens.basePen.py -- Tools and base classes to build pen objects.
The Pen Protocol
A Pen is a kind of object that standardizes the way how to "draw" outlines:
it is a middle man between an outline and a drawing. In other words:
it is an abstraction for drawing outlines, making sure that outline objects
don't need to know the details about how and where they're being drawn, and
that drawings don't need to know the details of how outlines are stored.
The most basic pattern is this:
outline.draw(pen) # 'outline' draws itself onto 'pen'
Pens can be used to render outlines to the screen, but also to construct
new outlines. Eg. an outline object can be both a drawable object (it has a
draw() method) as well as a pen itself: you *build* an outline using pen
methods.
The AbstractPen class defines the Pen protocol. It implements almost
nothing (only no-op closePath() and endPath() methods), but is useful
for documentation purposes. Subclassing it basically tells the reader:
"this class implements the Pen protocol.". An examples of an AbstractPen
subclass is fontTools.pens.transformPen.TransformPen.
The BasePen class is a base implementation useful for pens that actually
draw (for example a pen renders outlines using a native graphics engine).
BasePen contains a lot of base functionality, making it very easy to build
a pen that fully conforms to the pen protocol. Note that if you subclass
BasePen, you _don't_ override moveTo(), lineTo(), etc., but _moveTo(),
_lineTo(), etc. See the BasePen doc string for details. Examples of
BasePen subclasses are fontTools.pens.boundsPen.BoundsPen and
fontTools.pens.cocoaPen.CocoaPen.
Coordinates are usually expressed as (x, y) tuples, but generally any
sequence of length 2 will do.
é )ÚTuple)ÚLogMixinÚAbstractPenÚNullPenÚBasePenÚPenErrorÚdecomposeSuperBezierSegmentÚdecomposeQuadraticSegmentc @ s e Zd ZdZdS )r z#Represents an error during penning.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r r ú;/tmp/pip-build-_d5lkt3n/fonttools/fontTools/pens/basePen.pyr / s c @ sª e Zd Zeeef ddœdd„Zeeef ddœdd„Zeeef ddœdd „Zeeef ddœd
d„Zddœd
d„Z ddœdd„Z
eeeeeeeef ddœdd„ZdS )r N)ÚptÚreturnc C s t ‚dS )z…Begin a new sub path, set the current point to 'pt'. You must
end each sub path with a call to pen.closePath() or pen.endPath().
N)ÚNotImplementedError)Úselfr r r r ÚmoveTo5 s zAbstractPen.moveToc C s t ‚dS )z4Draw a straight line from the current point to 'pt'.N)r )r r r r r ÚlineTo; s zAbstractPen.lineTo)Úpointsr c G s t ‚dS )aC Draw a cubic bezier with an arbitrary number of control points.
The last point specified is on-curve, all others are off-curve
(control) points. If the number of control points is > 2, the
segment is split into multiple bezier segments. This works
like this:
Let n be the number of control points (which is the number of
arguments to this call minus 1). If n==2, a plain vanilla cubic
bezier is drawn. If n==1, we fall back to a quadratic segment and
if n==0 we draw a straight line. It gets interesting when n>2:
n-1 PostScript-style cubic segments will be drawn as if it were
one curve. See decomposeSuperBezierSegment().
The conversion algorithm used for n>2 is inspired by NURB
splines, and is conceptually equivalent to the TrueType "implied
points" principle. See also decomposeQuadraticSegment().
N)r )r r r r r ÚcurveTo? s zAbstractPen.curveToc G s t ‚dS )a Draw a whole string of quadratic curve segments.
The last point specified is on-curve, all others are off-curve
points.
This method implements TrueType-style curves, breaking up curves
using 'implied points': between each two consequtive off-curve points,
there is one implied point exactly in the middle between them. See
also decomposeQuadraticSegment().
The last argument (normally the on-curve point) may be None.
This is to support contours that have NO on-curve points (a rarely
seen feature of TrueType outlines).
N)r )r r r r r ÚqCurveToT s zAbstractPen.qCurveTo)r c C s dS )zkClose the current sub path. You must call either pen.closePath()
or pen.endPath() after each sub path.
Nr )r r r r Ú closePathe s zAbstractPen.closePathc C s dS )z}End the current sub path, but don't close it. You must call
either pen.closePath() or pen.endPath() after each sub path.
Nr )r r r r ÚendPathk s zAbstractPen.endPath)Ú glyphNameÚtransformationr c C s t ‚dS )zìAdd a sub glyph. The 'transformation' argument must be a 6-tuple
containing an affine transformation, or a Transform object from the
fontTools.misc.transform module. More precisely: it should be a
sequence containing 6 numbers.
N)r )r r r r r r ÚaddComponentq s
zAbstractPen.addComponent)
r
r r r Úfloatr r r r r r Ústrr r r r r r 3 s c @ sH e Zd ZdZdd„ Zdd„ Zdd„ Zdd „ Zd
d„ Zdd
„ Z dd„ Z
dS )r zA pen that does nothing.
c C s d S )Nr )r r r r r r ƒ s zNullPen.moveToc C s d S )Nr )r r r r r r † s zNullPen.lineToc G s d S )Nr )r r r r r r ‰ s zNullPen.curveToc G s d S )Nr )r r r r r r Œ s zNullPen.qCurveToc C s d S )Nr )r r r r r � s zNullPen.closePathc C s d S )Nr )r r r r r ’ s zNullPen.endPathc C s d S )Nr )r r r r r r r • s zNullPen.addComponentN)r
r r r
r r r r r r r r r r r r ~ s c @ s e Zd ZdZdS )Ú
LoggingPenzHA pen with a `log` property (see fontTools.misc.loggingTools.LogMixin)
N)r
r r r
r r r r r ™ s r c @ s e Zd ZdZdS )ÚMissingComponentErrorzGIndicates a component pointing to a non-existent glyph in the glyphset.N)r
r r r
r r r r r! Ÿ s r! c s, e Zd ZdZdZ‡ fdd„Zdd„ Z‡ ZS )ÚDecomposingPenaù Implements a 'addComponent' method that decomposes components
(i.e. draws them onto self as simple contours).
It can also be used as a mixin class (e.g. see ContourRecordingPen).
You must override moveTo, lineTo, curveTo and qCurveTo. You may
additionally override closePath, endPath and addComponent.
By default a warning message is logged when a base glyph is missing;
set the class variable ``skipMissingComponents`` to False if you want
to raise a :class:`MissingComponentError` exception.
Tc s t t| ƒjƒ || _dS )zƒ Takes a single 'glyphSet' argument (dict), in which the glyphs
that are referenced as components are looked up by their name.
N)Úsuperr" Ú__init__ÚglyphSet)r r% )Ú __class__r r r$ ³ s zDecomposingPen.__init__c C sf ddl m} y| j| }W n2 tk
rL | js8t|ƒ‚| jjd| ƒ Y nX || |ƒ}|j|ƒ dS )zA Transform the points of the base glyph and draw it onto self.
r )ÚTransformPenz,glyph '%s' is missing from glyphSet; skippedN) ZfontTools.pens.transformPenr' r% ÚKeyErrorÚskipMissingComponentsr! ÚlogÚwarningZdraw)r r r r' ZglyphZtPenr r r r º s
zDecomposingPen.addComponent)r
r r r
r) r$ r Ú
__classcell__r r )r&