Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Tweaks to fix hashmap differences between py2 & py3
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelsousa authored and khaledhosny committed Dec 6, 2018
1 parent a7393e4 commit ed29734
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/psautohint/ufoFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

from collections import OrderedDict

from fontTools.misc.py23 import SimpleNamespace, open
from fontTools.misc.py23 import SimpleNamespace, open, tostr, round
from fontTools.pens.basePen import BasePen
from fontTools.pens.pointPen import AbstractPointPen
from fontTools.ufoLib import (UFOReader, UFOWriter, DEFAULT_GLYPHS_DIRNAME,
Expand Down Expand Up @@ -332,7 +332,7 @@
HASHMAP_NAME = "%s.processedHashMap" % ADOBE_DOMAIN_PREFIX
HASHMAP_VERSION_NAME = "hashMapVersion"
HASHMAP_VERSION = (1, 0) # If major version differs, do not use.
AUTOHINT_NAME = "autohint"
AUTOHINT_NAME = tostr("autohint")
CHECKOUTLINE_NAME = "checkOutlines"

BASE_FLEX_NAME = "flexCurve"
Expand Down Expand Up @@ -536,7 +536,7 @@ def checkSkipGlyph(self, glyphName, newSrcHash, doAll):
# If the source hash has changed, we need to delete the processed
# layer glyph.
self.hashMapChanged = True
self.hashMap[glyphName] = [newSrcHash, [AUTOHINT_NAME]]
self.hashMap[glyphName] = [tostr(newSrcHash), [AUTOHINT_NAME]]
if glyphName in self.processedLayerGlyphMap:
del self.processedLayerGlyphMap[glyphName]

Expand Down Expand Up @@ -803,7 +803,7 @@ class HashPointPen(AbstractPointPen):

def __init__(self, glyph):
self.glyphset = getattr(glyph, "glyphSet", None)
self.width = getattr(glyph, "width", 1000)
self.width = round(getattr(glyph, "width", 1000), 9)
self.data = ["w%s" % self.width]

def getHash(self):
Expand Down Expand Up @@ -832,7 +832,7 @@ def addComponent(self, baseGlyphName, transformation, identifier=None,

for i, v in enumerate(transformation):
if transformation[i] != self.DEFAULT_TRANSFORM[i]:
self.data.append(str(v))
self.data.append(str(round(v, 9)))

self.data.append("w%s" % self.width)
glyph = self.glyphset[baseGlyphName]
Expand Down

0 comments on commit ed29734

Please sign in to comment.