diff --git a/pyproject.toml b/pyproject.toml index 8a5cce3b28..ca8fd14824 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ fontra-copy = "fontra.backends.copy:main" [project.entry-points."fontra.views"] editor = "fontra.views.editor" +fontinfo = "fontra.views.fontinfo" plugins = "fontra.views.plugins" diff --git a/src/fontra/views/fontinfo/fontinfo.html b/src/fontra/views/fontinfo/fontinfo.html new file mode 100644 index 0000000000..4a513d228b --- /dev/null +++ b/src/fontra/views/fontinfo/fontinfo.html @@ -0,0 +1,51 @@ + + + + + + Fontra Font Info + + + +
+
Names
+
Axes
+
Sources
+
+
+ + + +
+ + + diff --git a/src/fontra/views/fontinfo/fontinfo.js b/src/fontra/views/fontinfo/fontinfo.js new file mode 100644 index 0000000000..69acf2fab9 --- /dev/null +++ b/src/fontra/views/fontinfo/fontinfo.js @@ -0,0 +1,37 @@ +import { getRemoteProxy } from "../core/remote.js"; +import { makeDisplayPath } from "../core/view-tools.js"; + +export class FontInfoController { + static async fromWebSocket() { + const pathItems = window.location.pathname.split("/").slice(3); + const displayPath = makeDisplayPath(pathItems); + document.title = `Fontra Font Info — ${decodeURI(displayPath)}`; + const projectPath = pathItems.join("/"); + const protocol = window.location.protocol === "http:" ? "ws" : "wss"; + const wsURL = `${protocol}://${window.location.host}/websocket/${projectPath}`; + + const remoteFontEngine = await getRemoteProxy(wsURL); + const fontInfoController = new FontInfoController(remoteFontEngine); + remoteFontEngine.receiver = fontInfoController; + remoteFontEngine.onclose = (event) => fontInfoController.handleRemoteClose(event); + remoteFontEngine.onerror = (event) => fontInfoController.handleRemoteError(event); + await fontInfoController.start(); + return fontInfoController; + } + + constructor(font) { + this.font = font; + } + + async start() { + this.axes = await this.font.getGlobalAxes(); + } + + handleRemoteClose(event) { + // + } + + handleRemoteError(event) { + // + } +}