Skip to content

# `typerig.proxy.pens.outlinePen`

## typerig.proxy.pens.outlinePen (version 0.1.3)

    #FLM: Refactor: Outline Pen
    # MODULE: Typerig / Proxy / Pen / Outline Pen (Pen)
    # -----------------------------------------------------------
    # (C) Vassil Kateliev, 2019-2020        (http://www.kateliev.com)
    # (C) Karandash Type Foundry            (http://www.karandash.eu)
    #------------------------------------------------------------
    # www.typerig.com

### Modules

- fontgate
- fontlab
- math

### Classes

- fontTools.pens.basePen.BasePen(fontTools.pens.basePen.DecomposingPen)
- - OutlinePen
- typerig.core.objects.point.Point(builtin.object)
- - altPoint

## class OutlinePen(fontTools.pens.basePen.BasePen)

      OutlinePen (protocol)
      Adapted from: Frederik Berlaen's (Typemytype) outlinerRoboFontExtension
      Original Source: https://github.com/typemytype/outlinerRoboFontExtension

      Attribs:
      - offset (float): Outline offset
      - contrast (float): Outline Contrast
      - contrastAngle (float): Outline contrast angle
      - connection (string): Connection type - square;
      - cap (string): Cap type - round
      - closeOpenPaths (bool): Close open paths
      - optimizeCurve (bool): Optimize curve (adds an extra point of every curve at .5 time)
      - filterDoubles (bool): Filter double nodes
      - miterLimit (float): Sets miter limit

      Returns:
      - getGlyphs(): innerGlyph, outerGlyph, originalGlyph,(fgGlyph)
      - getShapes():  innerShape, outerShape, originalShape (flShape)
      - getContours(): innerContour, outerContour, originalContour (flShape)

Method resolution order:
  OutlinePen
  fontTools.pens.basePen.BasePen
  fontTools.pens.basePen.DecomposingPen
  fontTools.pens.basePen.LoggingPen
  fontTools.misc.loggingTools.LogMixin
  fontTools.pens.basePen.AbstractPen
  builtin.object

#### Methods

init(self, **kwargs)

buildCap(self, firstContour, lastContour)

      # - Line Caps --------------------------------

buildConnection(self, close=False)

      # -- Connections --------------------------------

capButt(self, firstContour, lastContour, first, last, angle)

capRound(self, firstContour, lastContour, first, last, angle)

capSquare(self, firstContour, lastContour, first, last, angle)

connectionButt(self, first, last, pen, close)

connectionInnerCorner(self, first, last, pen, close)

connectionRound(self, first, last, pen, close)

connectionSquare(self, first, last, pen, close)

getGlyphs(self)

      # - Output -----------------------------------------------

getShapes(self)

getThickness(self, angle)

      # -- Thickness

#### Attributes

magicCurve = 0.5522847498

pointClass = <class 'typerig.proxy.pens.outlinePen.altPoint'>

#### Methods from fontTools.pens.basePen.BasePen

closePath(self)

curveTo(self, *points)

endPath(self)

lineTo(self, pt)

moveTo(self, pt)

qCurveTo(self, *points)

#### Methods from fontTools.pens.basePen.DecomposingPen

addComponent(self, glyphName, transformation)

      Transform the points of the base glyph and draw it onto self.

#### Attributes from fontTools.pens.basePen.DecomposingPen

skipMissingComponents = True

#### Descriptors from fontTools.misc.loggingTools.LogMixin

dict

      dictionary for instance variables (if defined)

weakref

      list of weak references to the object (if defined)

log

## class altPoint(typerig.core.objects.point.Point)

      # - Classes ------------------------------

Method resolution order:
  altPoint
  typerig.core.objects.point.Point
  builtin.object

#### Methods

eq(self, p)

getitem(self, index)

init(self, x, y=None)

iter(self)

ne(self, p)

#### Descriptors

fgPoint

#### Methods from typerig.core.objects.point.Point

abs(self)

add(self, other)

      # -- Operators

and(self, other)

      self & other: Used as for Scalar product

div(self, other)

mul(self, other)

neg(self)

or(self, other)

      self | other: Used as for Cross product

rdiv = div(self, other)

repr(self)

rmul = mul(self, other)

sub(self, other)

truediv = div(self, other)

angle_to(self, other, add=90)

      Angle to another point in radians

diff_to(self, other)

doFlip(self, sign=(True, True))

doSwap(self)

      # -- Modifiers

doTransform(self, transform=None)

solve_width(self, y=0)

      Get width - find adjacent X by opposite Y

solve_x(self, y)

solve_y(self, x)

#### Descriptors from typerig.core.objects.point.Point

dict

      dictionary for instance variables (if defined)

weakref

      list of weak references to the object (if defined)

angle

magnitude

slope

swap

tuple

unit

y_intercept

## `OutlinePen`

## typerig.proxy.pens.outlinePen.OutlinePen = class OutlinePen(fontTools.pens.basePen.BasePen)

      OutlinePen (protocol)
      Adapted from: Frederik Berlaen's (Typemytype) outlinerRoboFontExtension
      Original Source: https://github.com/typemytype/outlinerRoboFontExtension

      Attribs:
      - offset (float): Outline offset
      - contrast (float): Outline Contrast
      - contrastAngle (float): Outline contrast angle
      - connection (string): Connection type - square;
      - cap (string): Cap type - round
      - closeOpenPaths (bool): Close open paths
      - optimizeCurve (bool): Optimize curve (adds an extra point of every curve at .5 time)
      - filterDoubles (bool): Filter double nodes
      - miterLimit (float): Sets miter limit

      Returns:
      - getGlyphs(): innerGlyph, outerGlyph, originalGlyph,(fgGlyph)
      - getShapes():  innerShape, outerShape, originalShape (flShape)
      - getContours(): innerContour, outerContour, originalContour (flShape)

Method resolution order:
  OutlinePen
  fontTools.pens.basePen.BasePen
  fontTools.pens.basePen.DecomposingPen
  fontTools.pens.basePen.LoggingPen
  fontTools.misc.loggingTools.LogMixin
  fontTools.pens.basePen.AbstractPen
  __builtin__.object

#### Methods

__init__(self, **kwargs)

buildCap(self, firstContour, lastContour)

      # - Line Caps --------------------------------

buildConnection(self, close=False)

      # -- Connections --------------------------------

capButt(self, firstContour, lastContour, first, last, angle)

capRound(self, firstContour, lastContour, first, last, angle)

capSquare(self, firstContour, lastContour, first, last, angle)

connectionButt(self, first, last, pen, close)

connectionInnerCorner(self, first, last, pen, close)

connectionRound(self, first, last, pen, close)

connectionSquare(self, first, last, pen, close)

getGlyphs(self)

      # - Output -----------------------------------------------

getShapes(self)

getThickness(self, angle)

      # -- Thickness

#### Attributes

magicCurve = 0.5522847498

pointClass = <class 'typerig.proxy.pens.outlinePen.altPoint'>

#### Methods from fontTools.pens.basePen.BasePen

closePath(self)

curveTo(self, *points)

endPath(self)

lineTo(self, pt)

moveTo(self, pt)

qCurveTo(self, *points)

#### Methods from fontTools.pens.basePen.DecomposingPen

addComponent(self, glyphName, transformation)

      Transform the points of the base glyph and draw it onto self.

#### Attributes from fontTools.pens.basePen.DecomposingPen

skipMissingComponents = True

#### Descriptors from fontTools.misc.loggingTools.LogMixin

__dict__

      dictionary for instance variables (if defined)

__weakref__

      list of weak references to the object (if defined)

log

### `magicCurve`

typerig.proxy.pens.outlinePen.OutlinePen.magicCurve = 0.5522847498