fontTools.misc.psCharStrings
index
/home/mcfletch/pylive/fontTools/misc/psCharStrings.py

psCharStrings.py -- module implementing various kinds of CharStrings: 
CFF dictionary data and Type1/Type2 CharStrings.

 
Modules
       
string
struct
types

 
Classes
       
Exception(BaseException)
CharStringCompileError
ByteCodeBase
DictDecompiler
T2CharString
T1CharString
SimpleT2Decompiler
T2OutlineExtractor
T1OutlineExtractor

 
class ByteCodeBase
     Methods defined here:
read_byte(self, b0, data, index)
read_fixed1616(self, b0, data, index)
read_longInt(self, b0, data, index)
read_realNumber(self, b0, data, index)
read_shortInt(self, b0, data, index)
read_smallInt1(self, b0, data, index)
read_smallInt2(self, b0, data, index)

 
class CharStringCompileError(Exception)
    
Method resolution order:
CharStringCompileError
Exception
BaseException
object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from Exception:
__new__ = <built-in method __new__ of type object at 0x8108c0>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from BaseException:
__dict__
args
message

 
class DictDecompiler(ByteCodeBase)
     Methods defined here:
__init__(self, strings)
arg_SID(self, name)
arg_array(self, name)
arg_delta(self, name)
arg_number(self, name)
decompile(self, data)
do_operator(self, b0, data, index)
getDict(self)
handle_operator(self, operator, argType)
pop(self)
popall(self)

Data and other attributes defined here:
operandEncoding = ['do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', ...]

Methods inherited from ByteCodeBase:
read_byte(self, b0, data, index)
read_fixed1616(self, b0, data, index)
read_longInt(self, b0, data, index)
read_realNumber(self, b0, data, index)
read_shortInt(self, b0, data, index)
read_smallInt1(self, b0, data, index)
read_smallInt2(self, b0, data, index)

 
class SimpleT2Decompiler
     Methods defined here:
__init__(self, localSubrs, globalSubrs)
countHints(self)
execute(self, charString)
op_callgsubr(self, index)
op_callsubr(self, index)
op_cntrmask = op_hintmask(self, index)
op_endchar(self, index)
op_hintmask(self, index)
op_hstem(self, index)
op_hstemhm(self, index)
op_ignore(self, index)
op_return(self, index)
op_vstem(self, index)
op_vstemhm(self, index)
pop(self)
popall(self)
push(self, value)
reset(self)

 
class T1CharString(T2CharString)
    
Method resolution order:
T1CharString
T2CharString
ByteCodeBase

Methods defined here:
__init__(self, bytecode=None, program=None, subrs=None)
decompile(self)
draw(self, pen)
getFixedEncoder(self)
getIntEncoder(self)

Data and other attributes defined here:
opcodes = {'callothersubr': (12, 16), 'callsubr': (10,), 'closepath': (9,), 'div': (12, 12), 'dotsection': (12, 0), 'endchar': (14,), 'hlineto': (6,), 'hmoveto': (22,), 'hsbw': (13,), 'hstem': (1,), ...}
operandEncoding = ['do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', ...]
operators = {1: 'hstem', 3: 'vstem', 4: 'vmoveto', 5: 'rlineto', 6: 'hlineto', 7: 'vlineto', 8: 'rrcurveto', 9: 'closepath', 10: 'callsubr', 11: 'return', ...}

Methods inherited from T2CharString:
__repr__(self)
compile(self)
do_operator(self, b0, data, index)
fromXML(self, (name, attrs, content))
getBytes(self, index, nBytes)
getToken(self, index, len=<built-in function len>, ord=<built-in function ord>, getattr=<built-in function getattr>, type=<type 'type'>, StringType=<type 'str'>)
needsDecompilation(self)
setBytecode(self, bytecode)
setProgram(self, program)
toXML(self, xmlWriter)

Methods inherited from ByteCodeBase:
read_byte(self, b0, data, index)
read_fixed1616(self, b0, data, index)
read_longInt(self, b0, data, index)
read_realNumber(self, b0, data, index)
read_shortInt(self, b0, data, index)
read_smallInt1(self, b0, data, index)
read_smallInt2(self, b0, data, index)

 
class T1OutlineExtractor(T2OutlineExtractor)
    
Method resolution order:
T1OutlineExtractor
T2OutlineExtractor
SimpleT2Decompiler

Methods defined here:
__init__(self, pen, subrs)
doFlex(self)
endPath(self)
exch(self)
op_callothersubr(self, index)
op_callsubr(self, index)
op_closepath(self, index)
op_dotsection(self, index)
op_endchar(self, index)
op_hmoveto(self, index)
op_hsbw(self, index)
op_hstem3(self, index)
op_pop(self, index)
op_rmoveto(self, index)
# path constructors
op_sbw(self, index)
op_seac(self, index)
asb adx ady bchar achar seac
op_setcurrentpoint(self, index)
op_vmoveto(self, index)
op_vstem3(self, index)
popallWidth(self, evenOdd=0)
reset(self)

Methods inherited from T2OutlineExtractor:
alternatingLineto(self, isHorizontal)
# miscelaneous helpers
closePath(self)
countHints(self)
hcurveto(self, args)
op_abs(self, index)
op_add(self, index)
op_and(self, index)
# misc
op_blend(self, index)
# MultipleMaster. Well...
op_div(self, index)
op_drop(self, index)
op_dup(self, index)
op_eq(self, index)
op_exch(self, index)
op_flex(self, index)
op_flex1(self, index)
op_get(self, index)
op_hflex(self, index)
# path constructors, flex
op_hflex1(self, index)
op_hhcurveto(self, index)
dy1? {dxa dxb dyb dxc}+ hhcurveto
op_hlineto(self, index)
op_hvcurveto(self, index)
dx1 dx2 dy2 dy3 {dya dxb dyb dxc dxd dxe dye dyf}* dxf?
{dxa dxb dyb dyc dyd dxe dye dxf}+ dyf?
op_ifelse(self, index)
op_index(self, index)
op_load(self, index)
op_mul(self, index)
op_neg(self, index)
op_not(self, index)
op_or(self, index)
op_put(self, index)
op_random(self, index)
op_rcurveline(self, index)
{dxa dya dxb dyb dxc dyc}+ dxd dyd rcurveline
op_rlinecurve(self, index)
{dxa dya}+ dxb dyb dxc dyc dxd dyd rlinecurve
op_rlineto(self, index)
# path constructors, lines
op_roll(self, index)
op_rrcurveto(self, index)
{dxa dya dxb dyb dxc dyc}+ rrcurveto
op_sqrt(self, index)
op_store(self, index)
op_sub(self, index)
op_vhcurveto(self, index)
dy1 dx2 dy2 dx3 {dxa dxb dyb dyc dyd dxe dye dxf}* dyf? vhcurveto (30)
{dya dxb dyb dxc dxd dxe dye dyf}+ dxf? vhcurveto
op_vlineto(self, index)
op_vvcurveto(self, index)
dx1? {dya dxb dyb dyc}+ vvcurveto
rCurveTo(self, pt1, pt2, pt3)
rLineTo(self, point)
rMoveTo(self, point)
vcurveto(self, args)

Methods inherited from SimpleT2Decompiler:
execute(self, charString)
op_callgsubr(self, index)
op_cntrmask = op_hintmask(self, index)
op_hintmask(self, index)
op_hstem(self, index)
op_hstemhm(self, index)
op_ignore(self, index)
op_return(self, index)
op_vstem(self, index)
op_vstemhm(self, index)
pop(self)
popall(self)
push(self, value)

 
class T2CharString(ByteCodeBase)
     Methods defined here:
__init__(self, bytecode=None, program=None, private=None, globalSubrs=None)
__repr__(self)
compile(self)
decompile(self)
do_operator(self, b0, data, index)
draw(self, pen)
fromXML(self, (name, attrs, content))
getBytes(self, index, nBytes)
getFixedEncoder(self)
getIntEncoder(self)
getToken(self, index, len=<built-in function len>, ord=<built-in function ord>, getattr=<built-in function getattr>, type=<type 'type'>, StringType=<type 'str'>)
needsDecompilation(self)
setBytecode(self, bytecode)
setProgram(self, program)
toXML(self, xmlWriter)

Data and other attributes defined here:
opcodes = {'abs': (12, 9), 'add': (12, 10), 'and': (12, 3), 'blend': (16,), 'callgsubr': (29,), 'callsubr': (10,), 'cntrmask': (20,), 'div': (12, 12), 'drop': (12, 18), 'dup': (12, 27), ...}
operandEncoding = ['do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', ...]
operators = {1: 'hstem', 3: 'vstem', 4: 'vmoveto', 5: 'rlineto', 6: 'hlineto', 7: 'vlineto', 8: 'rrcurveto', 10: 'callsubr', 11: 'return', 14: 'endchar', ...}

Methods inherited from ByteCodeBase:
read_byte(self, b0, data, index)
read_fixed1616(self, b0, data, index)
read_longInt(self, b0, data, index)
read_realNumber(self, b0, data, index)
read_shortInt(self, b0, data, index)
read_smallInt1(self, b0, data, index)
read_smallInt2(self, b0, data, index)

 
class T2OutlineExtractor(SimpleT2Decompiler)
     Methods defined here:
__init__(self, pen, localSubrs, globalSubrs, nominalWidthX, defaultWidthX)
alternatingLineto(self, isHorizontal)
# miscelaneous helpers
closePath(self)
countHints(self)
endPath(self)
hcurveto(self, args)
op_abs(self, index)
op_add(self, index)
op_and(self, index)
# misc
op_blend(self, index)
# MultipleMaster. Well...
op_div(self, index)
op_drop(self, index)
op_dup(self, index)
op_endchar(self, index)
op_eq(self, index)
op_exch(self, index)
op_flex(self, index)
op_flex1(self, index)
op_get(self, index)
op_hflex(self, index)
# path constructors, flex
op_hflex1(self, index)
op_hhcurveto(self, index)
dy1? {dxa dxb dyb dxc}+ hhcurveto
op_hlineto(self, index)
op_hmoveto(self, index)
op_hvcurveto(self, index)
dx1 dx2 dy2 dy3 {dya dxb dyb dxc dxd dxe dye dyf}* dxf?
{dxa dxb dyb dyc dyd dxe dye dxf}+ dyf?
op_ifelse(self, index)
op_index(self, index)
op_load(self, index)
op_mul(self, index)
op_neg(self, index)
op_not(self, index)
op_or(self, index)
op_put(self, index)
op_random(self, index)
op_rcurveline(self, index)
{dxa dya dxb dyb dxc dyc}+ dxd dyd rcurveline
op_rlinecurve(self, index)
{dxa dya}+ dxb dyb dxc dyc dxd dyd rlinecurve
op_rlineto(self, index)
# path constructors, lines
op_rmoveto(self, index)
# path constructors, moveto
op_roll(self, index)
op_rrcurveto(self, index)
{dxa dya dxb dyb dxc dyc}+ rrcurveto
op_sqrt(self, index)
op_store(self, index)
op_sub(self, index)
op_vhcurveto(self, index)
dy1 dx2 dy2 dx3 {dxa dxb dyb dyc dyd dxe dye dxf}* dyf? vhcurveto (30)
{dya dxb dyb dxc dxd dxe dye dyf}+ dxf? vhcurveto
op_vlineto(self, index)
op_vmoveto(self, index)
op_vvcurveto(self, index)
dx1? {dya dxb dyb dyc}+ vvcurveto
popallWidth(self, evenOdd=0)
rCurveTo(self, pt1, pt2, pt3)
rLineTo(self, point)
rMoveTo(self, point)
reset(self)
vcurveto(self, args)

Methods inherited from SimpleT2Decompiler:
execute(self, charString)
op_callgsubr(self, index)
op_callsubr(self, index)
op_cntrmask = op_hintmask(self, index)
op_hintmask(self, index)
op_hstem(self, index)
op_hstemhm(self, index)
op_ignore(self, index)
op_return(self, index)
op_vstem(self, index)
op_vstemhm(self, index)
pop(self)
popall(self)
push(self, value)

 
Functions
       
buildOperatorDict(operatorList)
calcSubrBias(subrs)
encodeFixed(f, pack=<built-in function pack>)
encodeFloat(f)
encodeIntCFF = encodeInt(value, fourByteOp='\x1d', chr=<built-in function chr>, pack=<built-in function pack>, unpack=<built-in function unpack>)
encodeIntT1 = encodeInt(value, fourByteOp='\xff', chr=<built-in function chr>, pack=<built-in function pack>, unpack=<built-in function unpack>)
encodeIntT2 = encodeInt(value, fourByteOp=None, chr=<built-in function chr>, pack=<built-in function pack>, unpack=<built-in function unpack>)
getIntEncoder(format)

 
Data
        DEBUG = 0
__file__ = '/home/mcfletch/pylive/fontTools/misc/psCharStrings.pyc'
__name__ = 'fontTools.misc.psCharStrings'
__package__ = 'fontTools.misc'
_i = 14
cffDictOperandEncoding = ['do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', ...]
realNibbles = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', None, '-']
realNibblesDict = {None: 13, '-': 14, '.': 10, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, ...}
t1OperandEncoding = ['do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', ...]
t1Operators = [(1, 'hstem'), (3, 'vstem'), (4, 'vmoveto'), (5, 'rlineto'), (6, 'hlineto'), (7, 'vlineto'), (8, 'rrcurveto'), (9, 'closepath'), (10, 'callsubr'), (11, 'return'), (13, 'hsbw'), (14, 'endchar'), (21, 'rmoveto'), (22, 'hmoveto'), (30, 'vhcurveto'), (31, 'hvcurveto'), ((12, 0), 'dotsection'), ((12, 1), 'vstem3'), ((12, 2), 'hstem3'), ((12, 6), 'seac'), ...]
t2OperandEncoding = ['do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', 'do_operator', ...]
t2Operators = [(1, 'hstem'), (3, 'vstem'), (4, 'vmoveto'), (5, 'rlineto'), (6, 'hlineto'), (7, 'vlineto'), (8, 'rrcurveto'), (10, 'callsubr'), (11, 'return'), (14, 'endchar'), (16, 'blend'), (18, 'hstemhm'), (19, 'hintmask'), (20, 'cntrmask'), (21, 'rmoveto'), (22, 'hmoveto'), (23, 'vstemhm'), (24, 'rcurveline'), (25, 'rlinecurve'), (26, 'vvcurveto'), ...]