fix "indentation contains mixed spaces and tabs" errors reported by Landscape
This commit is contained in:
parent
baf2179fc3
commit
a7aef47695
@ -7,7 +7,7 @@
|
||||
|
||||
from __future__ import print_function, division, absolute_import
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.misc.timeTools import timestampNow
|
||||
from fontTools.misc.timeTools import timestampNow
|
||||
from fontTools import ttLib, cffLib
|
||||
from fontTools.ttLib.tables import otTables, _h_e_a_d
|
||||
from fontTools.ttLib.tables.DefaultTable import DefaultTable
|
||||
@ -508,24 +508,24 @@ def merge(self, m, tables):
|
||||
return self
|
||||
|
||||
@_add_method(otTables.SingleSubst,
|
||||
otTables.MultipleSubst,
|
||||
otTables.AlternateSubst,
|
||||
otTables.LigatureSubst,
|
||||
otTables.ReverseChainSingleSubst,
|
||||
otTables.SinglePos,
|
||||
otTables.PairPos,
|
||||
otTables.CursivePos,
|
||||
otTables.MarkBasePos,
|
||||
otTables.MarkLigPos,
|
||||
otTables.MarkMarkPos)
|
||||
otTables.MultipleSubst,
|
||||
otTables.AlternateSubst,
|
||||
otTables.LigatureSubst,
|
||||
otTables.ReverseChainSingleSubst,
|
||||
otTables.SinglePos,
|
||||
otTables.PairPos,
|
||||
otTables.CursivePos,
|
||||
otTables.MarkBasePos,
|
||||
otTables.MarkLigPos,
|
||||
otTables.MarkMarkPos)
|
||||
def mapLookups(self, lookupMap):
|
||||
pass
|
||||
pass
|
||||
|
||||
# Copied and trimmed down from subset.py
|
||||
@_add_method(otTables.ContextSubst,
|
||||
otTables.ChainContextSubst,
|
||||
otTables.ContextPos,
|
||||
otTables.ChainContextPos)
|
||||
otTables.ChainContextSubst,
|
||||
otTables.ContextPos,
|
||||
otTables.ChainContextPos)
|
||||
def __merge_classify_context(self):
|
||||
|
||||
class ContextHelper(object):
|
||||
@ -567,9 +567,9 @@ def __merge_classify_context(self):
|
||||
|
||||
|
||||
@_add_method(otTables.ContextSubst,
|
||||
otTables.ChainContextSubst,
|
||||
otTables.ContextPos,
|
||||
otTables.ChainContextPos)
|
||||
otTables.ChainContextSubst,
|
||||
otTables.ContextPos,
|
||||
otTables.ChainContextPos)
|
||||
def mapLookups(self, lookupMap):
|
||||
c = self.__merge_classify_context()
|
||||
|
||||
@ -589,12 +589,12 @@ def mapLookups(self, lookupMap):
|
||||
assert 0, "unknown format: %s" % self.Format
|
||||
|
||||
@_add_method(otTables.ExtensionSubst,
|
||||
otTables.ExtensionPos)
|
||||
otTables.ExtensionPos)
|
||||
def mapLookups(self, lookupMap):
|
||||
if self.Format == 1:
|
||||
self.ExtSubTable.mapLookups(lookupMap)
|
||||
else:
|
||||
assert 0, "unknown format: %s" % self.Format
|
||||
if self.Format == 1:
|
||||
self.ExtSubTable.mapLookups(lookupMap)
|
||||
else:
|
||||
assert 0, "unknown format: %s" % self.Format
|
||||
|
||||
@_add_method(otTables.Lookup)
|
||||
def mapLookups(self, lookupMap):
|
||||
@ -619,7 +619,7 @@ def mapLookups(self, lookupMap):
|
||||
f.Feature.mapLookups(lookupMap)
|
||||
|
||||
@_add_method(otTables.DefaultLangSys,
|
||||
otTables.LangSys)
|
||||
otTables.LangSys)
|
||||
def mapFeatures(self, featureMap):
|
||||
self.FeatureIndex = [featureMap[i] for i in self.FeatureIndex]
|
||||
if self.ReqFeatureIndex != 65535:
|
||||
@ -915,10 +915,10 @@ class Logger(object):
|
||||
|
||||
|
||||
__all__ = [
|
||||
'Options',
|
||||
'Merger',
|
||||
'Logger',
|
||||
'main'
|
||||
'Options',
|
||||
'Merger',
|
||||
'Logger',
|
||||
'main'
|
||||
]
|
||||
|
||||
def main(args=None):
|
||||
|
@ -5,8 +5,8 @@ from __future__ import print_function, division, absolute_import
|
||||
from fontTools.misc.py23 import *
|
||||
|
||||
__all__ = [
|
||||
"fixedToFloat",
|
||||
"floatToFixed",
|
||||
"fixedToFloat",
|
||||
"floatToFixed",
|
||||
]
|
||||
|
||||
def fixedToFloat(value, precisionBits):
|
||||
|
@ -132,8 +132,8 @@ t2Operators = [
|
||||
(29, 'callgsubr'),
|
||||
(30, 'vhcurveto'),
|
||||
(31, 'hvcurveto'),
|
||||
((12, 0), 'ignore'), # dotsection. Yes, there a few very early OTF/CFF
|
||||
# fonts with this deprecated operator. Just ignore it.
|
||||
((12, 0), 'ignore'), # dotsection. Yes, there a few very early OTF/CFF
|
||||
# fonts with this deprecated operator. Just ignore it.
|
||||
((12, 3), 'and'),
|
||||
((12, 4), 'or'),
|
||||
((12, 5), 'not'),
|
||||
@ -331,8 +331,8 @@ class T2CharString(ByteCodeBase):
|
||||
self.program = None
|
||||
|
||||
def getToken(self, index,
|
||||
len=len, byteord=byteord, basestring=basestring,
|
||||
isinstance=isinstance):
|
||||
len=len, byteord=byteord, basestring=basestring,
|
||||
isinstance=isinstance):
|
||||
if self.bytecode is not None:
|
||||
if index >= len(self.bytecode):
|
||||
return None, 0, 0
|
||||
|
@ -323,8 +323,8 @@ class PSOperators(object):
|
||||
obj = self.pop()
|
||||
|
||||
def ps_readstring(self,
|
||||
ps_boolean=ps_boolean,
|
||||
len=len):
|
||||
ps_boolean=ps_boolean,
|
||||
len=len):
|
||||
s = self.pop('stringtype')
|
||||
oldstr = s.value
|
||||
f = self.pop('filetype')
|
||||
|
@ -322,7 +322,7 @@ class Transform(object):
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s [%g %g %g %g %g %g]>" % ((self.__class__.__name__,) \
|
||||
+ self.__affine)
|
||||
+ self.__affine)
|
||||
|
||||
|
||||
Identity = Transform()
|
||||
|
@ -10,7 +10,7 @@ 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'
|
||||
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
|
||||
@ -39,8 +39,8 @@ sequence of length 2 will do.
|
||||
from __future__ import print_function, division, absolute_import
|
||||
from fontTools.misc.py23 import *
|
||||
|
||||
__all__ = ["AbstractPen", "NullPen", "BasePen",
|
||||
"decomposeSuperBezierSegment", "decomposeQuadraticSegment"]
|
||||
__all__ = ["AbstractPen", "NullPen", "BasePen",
|
||||
"decomposeSuperBezierSegment", "decomposeQuadraticSegment"]
|
||||
|
||||
|
||||
class AbstractPen(object):
|
||||
@ -307,8 +307,8 @@ def decomposeSuperBezierSegment(points):
|
||||
if pt2 is None:
|
||||
pt2 = temp
|
||||
else:
|
||||
pt3 = (0.5 * (pt2[0] + temp[0]),
|
||||
0.5 * (pt2[1] + temp[1]))
|
||||
pt3 = (0.5 * (pt2[0] + temp[0]),
|
||||
0.5 * (pt2[1] + temp[1]))
|
||||
bezierSegments.append((pt1, pt2, pt3))
|
||||
pt1, pt2, pt3 = temp, None, None
|
||||
bezierSegments.append((pt1, points[-2], points[-1]))
|
||||
|
@ -911,11 +911,11 @@ def debugmsg(msg):
|
||||
|
||||
# Table order as recommended in the OpenType specification 1.4
|
||||
TTFTableOrder = ["head", "hhea", "maxp", "OS/2", "hmtx", "LTSH", "VDMX",
|
||||
"hdmx", "cmap", "fpgm", "prep", "cvt ", "loca", "glyf",
|
||||
"kern", "name", "post", "gasp", "PCLT"]
|
||||
"hdmx", "cmap", "fpgm", "prep", "cvt ", "loca", "glyf",
|
||||
"kern", "name", "post", "gasp", "PCLT"]
|
||||
|
||||
OTFTableOrder = ["head", "hhea", "maxp", "OS/2", "name", "cmap", "post",
|
||||
"CFF "]
|
||||
"CFF "]
|
||||
|
||||
def sortedTagList(tagList, tableOrder=None):
|
||||
"""Return a sorted copy of tagList, sorted according to the OpenType
|
||||
|
@ -114,7 +114,7 @@ class SFNTReader(object):
|
||||
class SFNTWriter(object):
|
||||
|
||||
def __init__(self, file, numTables, sfntVersion="\000\001\000\000",
|
||||
flavor=None, flavorData=None):
|
||||
flavor=None, flavorData=None):
|
||||
self.file = file
|
||||
self.numTables = numTables
|
||||
self.sfntVersion = Tag(sfntVersion)
|
||||
|
@ -3,9 +3,9 @@ from fontTools.misc.py23 import *
|
||||
from fontTools.misc import sstruct
|
||||
from . import DefaultTable
|
||||
try:
|
||||
import xml.etree.cElementTree as ET
|
||||
import xml.etree.cElementTree as ET
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ET
|
||||
import xml.etree.ElementTree as ET
|
||||
import struct
|
||||
import re
|
||||
|
||||
@ -19,31 +19,31 @@ only if you add the secret element "<version1/>" to the SVG element in the TTF f
|
||||
Version 0 is the joint Adobe-Mozilla proposal, which supports color palettes.
|
||||
|
||||
The XML format is:
|
||||
<SVG>
|
||||
<svgDoc endGlyphID="1" startGlyphID="1">
|
||||
<![CDATA[ <complete SVG doc> ]]
|
||||
</svgDoc>
|
||||
<SVG>
|
||||
<svgDoc endGlyphID="1" startGlyphID="1">
|
||||
<![CDATA[ <complete SVG doc> ]]
|
||||
</svgDoc>
|
||||
...
|
||||
<svgDoc endGlyphID="n" startGlyphID="m">
|
||||
<![CDATA[ <complete SVG doc> ]]
|
||||
</svgDoc>
|
||||
<![CDATA[ <complete SVG doc> ]]
|
||||
</svgDoc>
|
||||
|
||||
<colorPalettes>
|
||||
<colorParamUINameID>n</colorParamUINameID>
|
||||
...
|
||||
<colorParamUINameID>m</colorParamUINameID>
|
||||
<colorPalette uiNameID="n">
|
||||
<colorRecord red="<int>" green="<int>" blue="<int>" alpha="<int>" />
|
||||
...
|
||||
<colorRecord red="<int>" green="<int>" blue="<int>" alpha="<int>" />
|
||||
</colorPalette>
|
||||
...
|
||||
<colorPalette uiNameID="m">
|
||||
<colorRecord red="<int> green="<int>" blue="<int>" alpha="<int>" />
|
||||
...
|
||||
<colorRecord red=<int>" green="<int>" blue="<int>" alpha="<int>" />
|
||||
</colorPalette>
|
||||
</colorPalettes>
|
||||
<colorPalettes>
|
||||
<colorParamUINameID>n</colorParamUINameID>
|
||||
...
|
||||
<colorParamUINameID>m</colorParamUINameID>
|
||||
<colorPalette uiNameID="n">
|
||||
<colorRecord red="<int>" green="<int>" blue="<int>" alpha="<int>" />
|
||||
...
|
||||
<colorRecord red="<int>" green="<int>" blue="<int>" alpha="<int>" />
|
||||
</colorPalette>
|
||||
...
|
||||
<colorPalette uiNameID="m">
|
||||
<colorRecord red="<int> green="<int>" blue="<int>" alpha="<int>" />
|
||||
...
|
||||
<colorRecord red=<int>" green="<int>" blue="<int>" alpha="<int>" />
|
||||
</colorPalette>
|
||||
</colorPalettes>
|
||||
</SVG>
|
||||
|
||||
Color values must be less than 256.
|
||||
@ -308,7 +308,7 @@ class table_S_V_G_(DefaultTable.DefaultTable):
|
||||
startGID = int(attrs["startGlyphID"])
|
||||
endGID = int(attrs["endGlyphID"])
|
||||
self.docList.append( [doc, startGID, endGID] )
|
||||
elif name == "colorPalettes":
|
||||
elif name == "colorPalettes":
|
||||
self.colorPalettes = ColorPalettes()
|
||||
self.colorPalettes.fromXML(name, attrs, content, ttFont)
|
||||
if self.colorPalettes.numColorParams == 0:
|
||||
|
@ -174,7 +174,7 @@ class table_V_D_M_X_(DefaultTable.DefaultTable):
|
||||
writer.begintag("group", index=groupIndex)
|
||||
writer.newline()
|
||||
writer.comment("recs=%d, startsz=%d, endsz=%d" %
|
||||
(recs, startsz, endsz))
|
||||
(recs, startsz, endsz))
|
||||
writer.newline()
|
||||
for yPelHeight in group.keys():
|
||||
yMax, yMin = group[yPelHeight]
|
||||
|
@ -120,9 +120,9 @@ class CmapSubtable(object):
|
||||
if self.data is None:
|
||||
raise AttributeError(attr)
|
||||
self.decompile(None, None) # use saved data.
|
||||
self.data = None # Once this table has been decompiled, make sure we don't
|
||||
# just return the original data. Also avoids recursion when
|
||||
# called with an attribute that the cmap subtable doesn't have.
|
||||
self.data = None # Once this table has been decompiled, make sure we don't
|
||||
# just return the original data. Also avoids recursion when
|
||||
# called with an attribute that the cmap subtable doesn't have.
|
||||
return getattr(self, attr)
|
||||
|
||||
def decompileHeader(self, data, ttFont):
|
||||
|
@ -633,7 +633,7 @@ class Glyph(object):
|
||||
flag, coordBytes = flagBest(x, y, flag)
|
||||
bestCost += 1 + coordBytes
|
||||
newCandidates = [(bestCost, bestTuple, flag, coordBytes),
|
||||
(bestCost+1, bestTuple, (flag|flagRepeat), coordBytes)]
|
||||
(bestCost+1, bestTuple, (flag|flagRepeat), coordBytes)]
|
||||
for lastCost,lastTuple,lastFlag,coordBytes in candidates:
|
||||
if lastCost + coordBytes <= bestCost + 1 and (lastFlag & flagRepeat) and (lastFlag < 0xff00) and flagSupports(lastFlag, flag):
|
||||
if (lastFlag & 0xFF) == (flag|flagRepeat) and lastCost == bestCost + 1:
|
||||
@ -692,7 +692,7 @@ class Glyph(object):
|
||||
|
||||
# Collect on-curve points
|
||||
onCurveCoords = [coords[j] for j in range(len(coords))
|
||||
if flags[j] & flagOnCurve]
|
||||
if flags[j] & flagOnCurve]
|
||||
# Add implicit on-curve points
|
||||
start = 0
|
||||
for end in endPts:
|
||||
@ -825,9 +825,9 @@ class Glyph(object):
|
||||
return components
|
||||
|
||||
def trim(self, remove_hinting=False):
|
||||
"""Remove padding and, if requested, hinting, from a glyph.
|
||||
This works on both expanded and compacted glyphs, without
|
||||
expanding it."""
|
||||
""" Remove padding and, if requested, hinting, from a glyph.
|
||||
This works on both expanded and compacted glyphs, without
|
||||
expanding it."""
|
||||
if not hasattr(self, "data"):
|
||||
if remove_hinting:
|
||||
self.program = ttProgram.Program()
|
||||
@ -1015,7 +1015,7 @@ class GlyphComponent(object):
|
||||
(xscale, scale01,
|
||||
scale10, yscale) = struct.unpack(">hhhh", data[:8])
|
||||
self.transform = [[fi2fl(xscale,14), fi2fl(scale01,14)],
|
||||
[fi2fl(scale10,14), fi2fl(yscale,14)]] # fixed 2.14
|
||||
[fi2fl(scale10,14), fi2fl(yscale,14)]] # fixed 2.14
|
||||
data = data[8:]
|
||||
more = self.flags & MORE_COMPONENTS
|
||||
haveInstructions = self.flags & WE_HAVE_INSTRUCTIONS
|
||||
|
@ -182,7 +182,7 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
|
||||
numPointsInGlyph = self.getNumPoints_(glyph)
|
||||
gvarData = data[self.offsetToData + offsets[i] : self.offsetToData + offsets[i + 1]]
|
||||
self.variations[glyphName] = \
|
||||
self.decompileGlyph_(numPointsInGlyph, sharedCoords, axisTags, gvarData)
|
||||
self.decompileGlyph_(numPointsInGlyph, sharedCoords, axisTags, gvarData)
|
||||
|
||||
def decompileSharedCoords_(self, axisTags, data):
|
||||
result, _pos = GlyphVariation.decompileCoords_(axisTags, self.sharedCoordCount, data, self.offsetToCoord)
|
||||
|
@ -99,10 +99,10 @@ class table__m_a_x_p(DefaultTable.DefaultTable):
|
||||
headTable.xMax = 0
|
||||
headTable.yMax = 0
|
||||
else:
|
||||
headTable.xMin = xMin
|
||||
headTable.yMin = yMin
|
||||
headTable.xMax = xMax
|
||||
headTable.yMax = yMax
|
||||
headTable.xMin = xMin
|
||||
headTable.yMin = yMin
|
||||
headTable.xMax = xMax
|
||||
headTable.yMax = yMax
|
||||
self.maxPoints = maxPoints
|
||||
self.maxContours = maxContours
|
||||
self.maxCompositePoints = maxCompositePoints
|
||||
|
@ -8,24 +8,24 @@ from .sbixStrike import *
|
||||
|
||||
|
||||
sbixHeaderFormat = """
|
||||
>
|
||||
version: H # Version number (set to 1)
|
||||
flags: H # The only two bits used in the flags field are bits 0
|
||||
# and 1. For historical reasons, bit 0 must always be 1.
|
||||
# Bit 1 is a sbixDrawOutlines flag and is interpreted as
|
||||
# follows:
|
||||
# 0: Draw only 'sbix' bitmaps
|
||||
# 1: Draw both 'sbix' bitmaps and outlines, in that
|
||||
# order
|
||||
numStrikes: L # Number of bitmap strikes to follow
|
||||
>
|
||||
version: H # Version number (set to 1)
|
||||
flags: H # The only two bits used in the flags field are bits 0
|
||||
# and 1. For historical reasons, bit 0 must always be 1.
|
||||
# Bit 1 is a sbixDrawOutlines flag and is interpreted as
|
||||
# follows:
|
||||
# 0: Draw only 'sbix' bitmaps
|
||||
# 1: Draw both 'sbix' bitmaps and outlines, in that
|
||||
# order
|
||||
numStrikes: L # Number of bitmap strikes to follow
|
||||
"""
|
||||
sbixHeaderFormatSize = sstruct.calcsize(sbixHeaderFormat)
|
||||
|
||||
|
||||
sbixStrikeOffsetFormat = """
|
||||
>
|
||||
strikeOffset: L # Offset from begining of table to data for the
|
||||
# individual strike
|
||||
>
|
||||
strikeOffset: L # Offset from begining of table to data for the
|
||||
# individual strike
|
||||
"""
|
||||
sbixStrikeOffsetFormatSize = sstruct.calcsize(sbixStrikeOffsetFormat)
|
||||
|
||||
|
@ -37,7 +37,7 @@ class BaseTTXConverter(DefaultTable):
|
||||
self.tableType = tableType
|
||||
self.cachingStats = cachingStats
|
||||
globalState = GlobalState(tableType=self.tableTag,
|
||||
cachingStats=cachingStats)
|
||||
cachingStats=cachingStats)
|
||||
reader = OTTableReader(data, globalState)
|
||||
tableClass = getattr(otTables, self.tableTag)
|
||||
self.table = tableClass()
|
||||
|
@ -7,15 +7,15 @@ import struct
|
||||
|
||||
sbixGlyphHeaderFormat = """
|
||||
>
|
||||
originOffsetX: h # The x-value of the point in the glyph relative to its
|
||||
# lower-left corner which corresponds to the origin of
|
||||
# the glyph on the screen, that is the point on the
|
||||
# baseline at the left edge of the glyph.
|
||||
originOffsetY: h # The y-value of the point in the glyph relative to its
|
||||
# lower-left corner which corresponds to the origin of
|
||||
# the glyph on the screen, that is the point on the
|
||||
# baseline at the left edge of the glyph.
|
||||
graphicType: 4s # e.g. "png "
|
||||
originOffsetX: h # The x-value of the point in the glyph relative to its
|
||||
# lower-left corner which corresponds to the origin of
|
||||
# the glyph on the screen, that is the point on the
|
||||
# baseline at the left edge of the glyph.
|
||||
originOffsetY: h # The y-value of the point in the glyph relative to its
|
||||
# lower-left corner which corresponds to the origin of
|
||||
# the glyph on the screen, that is the point on the
|
||||
# baseline at the left edge of the glyph.
|
||||
graphicType: 4s # e.g. "png "
|
||||
"""
|
||||
|
||||
sbixGlyphHeaderFormatSize = sstruct.calcsize(sbixGlyphHeaderFormat)
|
||||
|
@ -7,16 +7,16 @@ import struct
|
||||
|
||||
sbixStrikeHeaderFormat = """
|
||||
>
|
||||
ppem: H # The PPEM for which this strike was designed (e.g., 9,
|
||||
# 12, 24)
|
||||
resolution: H # The screen resolution (in dpi) for which this strike
|
||||
# was designed (e.g., 72)
|
||||
ppem: H # The PPEM for which this strike was designed (e.g., 9,
|
||||
# 12, 24)
|
||||
resolution: H # The screen resolution (in dpi) for which this strike
|
||||
# was designed (e.g., 72)
|
||||
"""
|
||||
|
||||
sbixGlyphDataOffsetFormat = """
|
||||
>
|
||||
glyphDataOffset: L # Offset from the beginning of the strike data record
|
||||
# to data for the individual glyph
|
||||
glyphDataOffset: L # Offset from the beginning of the strike data record
|
||||
# to data for the individual glyph
|
||||
"""
|
||||
|
||||
sbixStrikeHeaderFormatSize = sstruct.calcsize(sbixStrikeHeaderFormat)
|
||||
|
@ -473,7 +473,7 @@ class Program(object):
|
||||
False
|
||||
"""
|
||||
return ((hasattr(self, 'assembly') and len(self.assembly) > 0) or
|
||||
(hasattr(self, 'bytecode') and len(self.bytecode) > 0))
|
||||
(hasattr(self, 'bytecode') and len(self.bytecode) > 0))
|
||||
|
||||
__nonzero__ = __bool__
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user