From fc385976260001e4d17bc17abd8e226b06228569 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Sun, 3 Dec 2023 12:05:55 +0100 Subject: [PATCH] Rename 'FontLib' to 'CustomData' --- src/fontra_rcjk/backend_fs.py | 10 +++++----- src/fontra_rcjk/backend_mysql.py | 16 ++++++++-------- src/fontra_rcjk/base.py | 2 +- tests/test_font.py | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/fontra_rcjk/backend_fs.py b/src/fontra_rcjk/backend_fs.py index 129d010..b599174 100644 --- a/src/fontra_rcjk/backend_fs.py +++ b/src/fontra_rcjk/backend_fs.py @@ -13,7 +13,7 @@ TimedCache, buildLayerGlyphsFromVariableGlyph, buildVariableGlyphFromLayerGlyphs, - standardFontLibItems, + standardCustomDataItems, unpackAxes, ) @@ -158,12 +158,12 @@ async def deleteGlyph(self, glyphName): del self._glyphMap[glyphName] - async def getFontLib(self): - fontLib = {} + async def getCustomData(self): + customData = {} libPath = self.path / "fontLib.json" if libPath.is_file(): - fontLib = json.loads(libPath.read_text(encoding="utf-8")) - return fontLib | standardFontLibItems + customData = json.loads(libPath.read_text(encoding="utf-8")) + return customData | standardCustomDataItems async def watchExternalChanges(self): async for changes in watchfiles.awatch(self.path): diff --git a/src/fontra_rcjk/backend_mysql.py b/src/fontra_rcjk/backend_mysql.py index 71acfcc..9932539 100644 --- a/src/fontra_rcjk/backend_mysql.py +++ b/src/fontra_rcjk/backend_mysql.py @@ -11,7 +11,7 @@ TimedCache, buildLayerGlyphsFromVariableGlyph, buildVariableGlyphFromLayerGlyphs, - standardFontLibItems, + standardCustomDataItems, unpackAxes, ) from .client import HTTPError @@ -79,8 +79,8 @@ async def taskFunc(): self._tempFontItemsCache["designspace"] = font_data["data"].get( "designspace", {} ) - self._tempFontItemsCache["fontLib"] = ( - font_data["data"].get("fontlib", {}) | standardFontLibItems + self._tempFontItemsCache["customData"] = ( + font_data["data"].get("fontlib", {}) | standardCustomDataItems ) self._tempFontItemsCache.updateTimeOut() del self._getMiscFontItemsTask @@ -107,12 +107,12 @@ async def getDefaultLocation(self): async def getUnitsPerEm(self): return 1000 - async def getFontLib(self): - fontLib = self._tempFontItemsCache.get("fontLib") - if fontLib is None: + async def getCustomData(self): + customData = self._tempFontItemsCache.get("customData") + if customData is None: await self._getMiscFontItems() - fontLib = self._tempFontItemsCache["fontLib"] - return fontLib + customData = self._tempFontItemsCache["customData"] + return customData async def getGlyph(self, glyphName): await self._ensureGlyphMap() diff --git a/src/fontra_rcjk/base.py b/src/fontra_rcjk/base.py index 08e3bb1..8f36703 100644 --- a/src/fontra_rcjk/base.py +++ b/src/fontra_rcjk/base.py @@ -444,7 +444,7 @@ def makeSafeLayerName(layerName): return safeLayerName -standardFontLibItems = { +standardCustomDataItems = { "fontra.sourceStatusFieldDefinitions": [ { "label": "In progress", diff --git a/tests/test_font.py b/tests/test_font.py index 8596aae..a41468d 100644 --- a/tests/test_font.py +++ b/tests/test_font.py @@ -431,9 +431,9 @@ async def test_getGlobalAxes(backendName, expectedGlobalAxes): @pytest.mark.asyncio @pytest.mark.parametrize("backendName, expectedLibLen", [("rcjk", 5)]) -async def test_getFontLib(backendName, expectedLibLen): +async def test_getCustomData(backendName, expectedLibLen): font = getTestFont(backendName) - lib = await font.getFontLib() + lib = await font.getCustomData() assert expectedLibLen == len(lib)