From f05ae63f70b0b832ae8ea3952f7ca9483d30b437 Mon Sep 17 00:00:00 2001 From: Eigi Date: Fri, 7 May 2021 10:42:53 +0200 Subject: [PATCH 1/2] test if issue #2295 is fixed --- Tests/ttLib/tables/_g_l_y_f_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tests/ttLib/tables/_g_l_y_f_test.py b/Tests/ttLib/tables/_g_l_y_f_test.py index 70560cc7b8..84f30dc6c2 100644 --- a/Tests/ttLib/tables/_g_l_y_f_test.py +++ b/Tests/ttLib/tables/_g_l_y_f_test.py @@ -362,6 +362,23 @@ def test_decompile_empty_table(self): self.assertEqual(font["glyf"][".notdef"].numberOfContours, 0) self.assertEqual(font["glyf"]["space"].numberOfContours, 0) + def test_getPhantomPoints(self): + # https://github.com/fonttools/fonttools/issues/2295 + font = TTFont() + glyphNames = [".notdef"] + font.setGlyphOrder(glyphNames) + font["loca"] = newTable("loca") + font["loca"].locations = [0] * (len(glyphNames) + 1) + font["glyf"] = newTable("glyf") + font["glyf"].decompile(b"\x00", font) + font["hmtx"] = newTable("hmtx") + font["hmtx"].metrics = {".notdef": (100,0)} + font["head"] = newTable("head") + font["head"].unitsPerEm = 1000 + self.assertEqual( + font["glyf"].getPhantomPoints(".notdef", font, 0), + [(0, 0), (100, 0), (0, 0), (0, -1000)] + ) class GlyphTest: From 84d77e5c3ac35dbea123b4dcbf4197ff81ac0a22 Mon Sep 17 00:00:00 2001 From: Eigi Date: Sun, 9 May 2021 18:59:34 +0200 Subject: [PATCH 2/2] fix for issue #2299 translate leading backslashes of UNC path to forward slashes. --- Lib/fontTools/designspaceLib/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/fontTools/designspaceLib/__init__.py b/Lib/fontTools/designspaceLib/__init__.py index 9ea22fe692..3bb2bbfc96 100644 --- a/Lib/fontTools/designspaceLib/__init__.py +++ b/Lib/fontTools/designspaceLib/__init__.py @@ -33,6 +33,9 @@ def posix(path): if path.startswith('/'): # The above transformation loses absolute paths new_path = '/' + new_path + elif path.startswith(r'\\'): + # The above transformation loses leading slashes of UNC path mounts + new_path = '//' + new_path return new_path