diff --git a/src/fontra/client/core/font-controller.js b/src/fontra/client/core/font-controller.js index 557791c2e..ac2d4d142 100644 --- a/src/fontra/client/core/font-controller.js +++ b/src/fontra/client/core/font-controller.js @@ -42,6 +42,8 @@ export class FontController { this._rootObject = {}; this._rootObject.glyphMap = getGlyphMapProxy(glyphMap, this.characterMap); this._rootObject.axes = ensureDenseAxes(await this.font.getAxes()); + // TODO: Guidelines Font, to the guidelines we need the font sources + // this._rootObject.sources = await this.font.getSources(); this._rootObject.unitsPerEm = await this.font.getUnitsPerEm(); this._rootObject.customData = await this.font.getCustomData(); this._rootClassDef = (await getClassSchema())["Font"]; diff --git a/src/fontra/views/editor/visualization-layer-definitions.js b/src/fontra/views/editor/visualization-layer-definitions.js index d121b353b..ca030272a 100644 --- a/src/fontra/views/editor/visualization-layer-definitions.js +++ b/src/fontra/views/editor/visualization-layer-definitions.js @@ -317,16 +317,22 @@ registerVisualizationLayerDefinition({ context.font = `${fontSize}px fontra-ui-regular, sans-serif`; context.textAlign = "center"; - // TODO: Global Guidelines - - // Draw local guidelines - for (const localGuideline of positionedGlyph.glyph.guidelines) { + // TODO: Guidelines Font + // Draw font guidelines + // const sourceIndex = positionedGlyph.glyph.sourceIndex; + // if (sourceIndex != undefined) { + // const source = model.fontController.sources[sourceIndex]; + // console.log('source: ', source) + // } + + // Draw glyph guidelines + for (const guidelineGlyph of positionedGlyph.glyph.guidelines) { context.save(); context.strokeStyle = parameters.strokeColor; context.lineWidth = parameters.strokeWidth; // move to the origin of the guideline - context.translate(localGuideline.x, localGuideline.y); - context.rotate((localGuideline.angle * Math.PI) / 180); + context.translate(guidelineGlyph.x, guidelineGlyph.y); + context.rotate((guidelineGlyph.angle * Math.PI) / 180); context.scale(1, -1); // draw guideline origin marker @@ -335,8 +341,8 @@ registerVisualizationLayerDefinition({ let textWidth; let textHeight; // draw name - if (localGuideline.name) { - const strLine = `${localGuideline.name}`; + if (guidelineGlyph.name) { + const strLine = `${guidelineGlyph.name}`; textWidth = Math.max(context.measureText(strLine).width); textHeight = Math.max(getTextHeight(context, strLine)); @@ -349,7 +355,7 @@ registerVisualizationLayerDefinition({ } // draw the line - if (localGuideline.name) { + if (guidelineGlyph.name) { // with name strokeLineDashed( context,