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 b134721 commit 350e2e3
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/fontra/backends/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def copyFont(
sourceBackend, destBackend, *, glyphNames=None, numTasks=1, progressInterval=0
):
await destBackend.putGlobalAxes(await sourceBackend.getGlobalAxes())
await destBackend.putFontLib(await sourceBackend.getFontLib())
await destBackend.putCustomData(await sourceBackend.getCustomData())
glyphMap = await sourceBackend.getGlyphMap()
glyphNamesInFont = set(glyphMap)
glyphNamesToCopy = sorted(
Expand Down
4 changes: 2 additions & 2 deletions src/fontra/backends/designspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,10 @@ async def putGlobalAxes(self, axes):
async def getUnitsPerEm(self):
return self.defaultFontInfo.unitsPerEm

async def getFontLib(self):
async def getCustomData(self):
return deepcopy(self.dsDoc.lib)

async def putFontLib(self, lib):
async def putCustomData(self, lib):
self.dsDoc.lib = deepcopy(lib)
self.dsDoc.write(self.dsDoc.path)

Expand Down
4 changes: 2 additions & 2 deletions src/fontra/backends/fontra.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ async def putGlobalAxes(self, axes):
self.fontData.axes = deepcopy(axes)
self._scheduler.schedule(self._writeFontData)

async def getFontLib(self):
async def getCustomData(self):
return deepcopy(self.fontData.customData)

async def putFontLib(self, customData):
async def putCustomData(self, customData):
self.fontData.customData = deepcopy(customData)
self._scheduler.schedule(self._writeFontData)

Expand Down
4 changes: 2 additions & 2 deletions src/fontra/backends/opentype.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ async def getGlobalAxes(self):
async def getUnitsPerEm(self):
return self.font["head"].unitsPerEm

async def getFontLib(self):
return []
async def getCustomData(self):
return {}


def tuplifyLocation(loc):
Expand Down
6 changes: 3 additions & 3 deletions src/fontra/client/core/font-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class FontController {
this._rootObject["glyphMap"] = getGlyphMapProxy(glyphMap, this.characterMap);
this._rootObject["axes"] = await this.font.getGlobalAxes();
this._rootObject["unitsPerEm"] = await this.font.getUnitsPerEm();
this._rootObject["lib"] = await this.font.getFontLib();
this._rootObject["customData"] = await this.font.getCustomData();
this._rootClassDef = (await getClassSchema())["Font"];
this._resolveInitialized();
}
Expand Down Expand Up @@ -71,8 +71,8 @@ export class FontController {
return this._rootObject["unitsPerEm"];
}

get fontLib() {
return this._rootObject["lib"];
get customData() {
return this._rootObject["customData"];
}

getCachedGlyphNames() {
Expand Down
6 changes: 3 additions & 3 deletions src/fontra/core/fonthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def remoteMethod(method):
backendAttrMapping = [
("axes", "GlobalAxes"),
("glyphMap", "GlyphMap"),
("lib", "FontLib"),
("customData", "CustomData"),
("unitsPerEm", "UnitsPerEm"),
]

Expand Down Expand Up @@ -209,8 +209,8 @@ async def getUnitsPerEm(self, *, connection):
return await self.getData("unitsPerEm")

@remoteMethod
async def getFontLib(self, *, connection):
return await self.getData("lib")
async def getCustomData(self, *, connection):
return await self.getData("customData")

def _getClientData(self, connection, key, default=None):
return self.clientData[connection.clientUUID].get(key, default)
Expand Down
2 changes: 1 addition & 1 deletion src/fontra/views/editor/cjk-design-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class CJKDesignFrame {
this.cjkDesignFrameParameters = makeParametersFromGlyph(frameGlyph, unitsPerEm);
} else {
const legacyParameters =
this.sceneController.sceneModel.fontController.fontLib[
this.sceneController.sceneModel.fontController.customData[
"CJKDesignFrameSettings"
];
if (legacyParameters) {
Expand Down
2 changes: 1 addition & 1 deletion src/fontra/views/editor/panel-designspace-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default class DesignspaceNavigationPanel extends Panel {
];

const statusFieldDefinitions =
this.sceneController.sceneModel.fontController.fontLib[
this.sceneController.sceneModel.fontController.customData[
FONTRA_STATUS_DEFINITIONS_KEY
];

Expand Down
4 changes: 2 additions & 2 deletions test-py/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,9 +1022,9 @@ async def test_getGlobalAxes(testFontName, expectedGlobalAxes):

@pytest.mark.asyncio
@pytest.mark.parametrize("testFontName, expectedLibLen", getLibTestData)
async def test_getFontLib(testFontName, expectedLibLen):
async def test_getCustomData(testFontName, expectedLibLen):
font = getTestFont(testFontName)
lib = await font.getFontLib()
lib = await font.getCustomData()
assert expectedLibLen == len(lib)


Expand Down

0 comments on commit 350e2e3

Please sign in to comment.