Skip to content

Commit

Permalink
Rename 'FontLib' to 'CustomData'
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Dec 3, 2023
1 parent e29d548 commit fc38597
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/fontra_rcjk/backend_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TimedCache,
buildLayerGlyphsFromVariableGlyph,
buildVariableGlyphFromLayerGlyphs,
standardFontLibItems,
standardCustomDataItems,
unpackAxes,
)

Expand Down Expand Up @@ -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):
Expand Down
16 changes: 8 additions & 8 deletions src/fontra_rcjk/backend_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
TimedCache,
buildLayerGlyphsFromVariableGlyph,
buildVariableGlyphFromLayerGlyphs,
standardFontLibItems,
standardCustomDataItems,
unpackAxes,
)
from .client import HTTPError
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/fontra_rcjk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def makeSafeLayerName(layerName):
return safeLayerName


standardFontLibItems = {
standardCustomDataItems = {
"fontra.sourceStatusFieldDefinitions": [
{
"label": "In progress",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit fc38597

Please sign in to comment.