[VARC] Adjust to latest flags change
This commit is contained in:
parent
297e0bd257
commit
b1142b60cb
@ -49,27 +49,28 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class VarComponentFlags(IntFlag):
|
class VarComponentFlags(IntFlag):
|
||||||
USE_MY_METRICS = 0x0001
|
RESET_UNSPECIFIED_AXES = 0x0001
|
||||||
RESET_UNSPECIFIED_AXES = 0x0002
|
|
||||||
|
|
||||||
GID_IS_24BIT = 0x0004
|
HAVE_AXES = 0x0002
|
||||||
|
|
||||||
HAVE_AXES = 0x0008
|
AXIS_VALUES_HAVE_VARIATION = 0x0004
|
||||||
|
TRANSFORM_HAS_VARIATION = 0x0008
|
||||||
|
|
||||||
AXIS_VALUES_HAVE_VARIATION = 0x0010
|
HAVE_TRANSLATE_X = 0x0010
|
||||||
TRANSFORM_HAS_VARIATION = 0x0020
|
HAVE_TRANSLATE_Y = 0x0020
|
||||||
|
HAVE_ROTATION = 0x0040
|
||||||
|
|
||||||
HAVE_TRANSLATE_X = 0x0040
|
USE_MY_METRICS = 0x0080
|
||||||
HAVE_TRANSLATE_Y = 0x0080
|
|
||||||
HAVE_ROTATION = 0x0100
|
|
||||||
HAVE_SCALE_X = 0x0200
|
|
||||||
HAVE_SCALE_Y = 0x0400
|
|
||||||
HAVE_SKEW_X = 0x0800
|
|
||||||
HAVE_SKEW_Y = 0x1000
|
|
||||||
HAVE_TCENTER_X = 0x2000
|
|
||||||
HAVE_TCENTER_Y = 0x4000
|
|
||||||
|
|
||||||
RESERVED = 0x8000
|
HAVE_SCALE_X = 0x0100
|
||||||
|
HAVE_SCALE_Y = 0x0200
|
||||||
|
HAVE_TCENTER_X = 0x0400
|
||||||
|
HAVE_TCENTER_Y = 0x0800
|
||||||
|
|
||||||
|
GID_IS_24BIT = 0x4000
|
||||||
|
|
||||||
|
HAVE_SKEW_X = 0x1000
|
||||||
|
HAVE_SKEW_Y = 0x2000
|
||||||
|
|
||||||
|
|
||||||
VarTransformMappingValues = namedtuple(
|
VarTransformMappingValues = namedtuple(
|
||||||
@ -160,8 +161,8 @@ class VarComponent:
|
|||||||
|
|
||||||
def decompile(self, data, font, localState):
|
def decompile(self, data, font, localState):
|
||||||
i = 0
|
i = 0
|
||||||
self.flags = flags = _unpacker[2](data[i : i + 2])
|
self.flags, i = _readVarInt32(data, i)
|
||||||
i += 2
|
flags = self.flags
|
||||||
|
|
||||||
gidSize = 3 if flags & VarComponentFlags.GID_IS_24BIT else 2
|
gidSize = 3 if flags & VarComponentFlags.GID_IS_24BIT else 2
|
||||||
glyphID = _unpacker[gidSize](data[i : i + gidSize])
|
glyphID = _unpacker[gidSize](data[i : i + gidSize])
|
||||||
@ -262,7 +263,7 @@ class VarComponent:
|
|||||||
value = getattr(self.transform, attr_name)
|
value = getattr(self.transform, attr_name)
|
||||||
data.append(write_transform_component(value, mapping_values))
|
data.append(write_transform_component(value, mapping_values))
|
||||||
|
|
||||||
return struct.pack(">H", flags) + bytesjoin(data)
|
return _writeVarInt32(flags) + bytesjoin(data)
|
||||||
|
|
||||||
def toXML(self, writer, ttFont, attrs):
|
def toXML(self, writer, ttFont, attrs):
|
||||||
attrs.append(("glyphName", self.glyphName))
|
attrs.append(("glyphName", self.glyphName))
|
||||||
|
Binary file not shown.
@ -313,19 +313,19 @@
|
|||||||
<VarComponent index="2" glyphName="glyph00006" flags="0"/>
|
<VarComponent index="2" glyphName="glyph00006" flags="0"/>
|
||||||
</VarCompositeGlyph>
|
</VarCompositeGlyph>
|
||||||
<VarCompositeGlyph index="2">
|
<VarCompositeGlyph index="2">
|
||||||
<VarComponent index="0" glyphName="glyph00008" flags="72" axisIndicesIndex="2" axisValues="(3537,)" translateX="-6.0"/>
|
<VarComponent index="0" glyphName="glyph00008" flags="18" axisIndicesIndex="2" axisValues="(3537,)" translateX="-6.0"/>
|
||||||
</VarCompositeGlyph>
|
</VarCompositeGlyph>
|
||||||
<VarCompositeGlyph index="3">
|
<VarCompositeGlyph index="3">
|
||||||
<VarComponent index="0" glyphName="glyph00008" flags="88" axisIndicesIndex="0" axisValues="(-13184, 0, 7928)" axisValuesVarIndex="0" translateX="-3.0"/>
|
<VarComponent index="0" glyphName="glyph00008" flags="22" axisIndicesIndex="0" axisValues="(-13184, 0, 7928)" axisValuesVarIndex="0" translateX="-3.0"/>
|
||||||
</VarCompositeGlyph>
|
</VarCompositeGlyph>
|
||||||
<VarCompositeGlyph index="4">
|
<VarCompositeGlyph index="4">
|
||||||
<VarComponent index="0" glyphName="glyph00009" flags="248" axisIndicesIndex="1" axisValues="(-8847, 655, -8484, 0, 0)" axisValuesVarIndex="1" transformVarIndex="2" translateX="-5.0" translateY="24.0"/>
|
<VarComponent index="0" glyphName="glyph00009" flags="62" axisIndicesIndex="1" axisValues="(-8847, 655, -8484, 0, 0)" axisValuesVarIndex="1" transformVarIndex="2" translateX="-5.0" translateY="24.0"/>
|
||||||
</VarCompositeGlyph>
|
</VarCompositeGlyph>
|
||||||
<VarCompositeGlyph index="5">
|
<VarCompositeGlyph index="5">
|
||||||
<VarComponent index="0" glyphName="glyph00010" flags="248" axisIndicesIndex="0" axisValues="(-12714, -5843, 0)" axisValuesVarIndex="3" transformVarIndex="4" translateX="53.0" translateY="-231.0"/>
|
<VarComponent index="0" glyphName="glyph00010" flags="62" axisIndicesIndex="0" axisValues="(-12714, -5843, 0)" axisValuesVarIndex="3" transformVarIndex="4" translateX="53.0" translateY="-231.0"/>
|
||||||
</VarCompositeGlyph>
|
</VarCompositeGlyph>
|
||||||
<VarCompositeGlyph index="6">
|
<VarCompositeGlyph index="6">
|
||||||
<VarComponent index="0" glyphName="glyph00009" flags="248" axisIndicesIndex="0" axisValues="(-4227, 819, -8484)" axisValuesVarIndex="5" transformVarIndex="6" translateX="-5.0" translateY="12.0"/>
|
<VarComponent index="0" glyphName="glyph00009" flags="62" axisIndicesIndex="0" axisValues="(-4227, 819, -8484)" axisValuesVarIndex="5" transformVarIndex="6" translateX="-5.0" translateY="12.0"/>
|
||||||
</VarCompositeGlyph>
|
</VarCompositeGlyph>
|
||||||
</VarCompositeGlyphs>
|
</VarCompositeGlyphs>
|
||||||
</VARC>
|
</VARC>
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user