From c9843ff8da2d26cd816931336b2642ad0522d3dd Mon Sep 17 00:00:00 2001 From: be5invis Date: Sat, 24 Feb 2024 20:47:23 -0800 Subject: [PATCH] Added a `MOSC` feature that turns certain geometric shapes into mosaics (#2212). --- changes/29.0.0.md | 1 + packages/font-glyphs/src/symbol/mosaic/powerline.ptl | 7 +++++++ packages/font-otl/src/index.ptl | 3 +++ packages/glyph/src/relation.mjs | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/changes/29.0.0.md b/changes/29.0.0.md index 9f230127f..625486498 100644 --- a/changes/29.0.0.md +++ b/changes/29.0.0.md @@ -40,3 +40,4 @@ * Fix a disjoint stroke of Outlined Curly `Z` under some weights (#2195). * Unify diagonal box drawings' angles (#2197). * Fix Large Type Piece `U+1CE3B` (#2206). +* Added a `MOSC` feature that turns certain geometric shapes into mosaics (#2212). diff --git a/packages/font-glyphs/src/symbol/mosaic/powerline.ptl b/packages/font-glyphs/src/symbol/mosaic/powerline.ptl index 6a4e8d0ab..5b2563a08 100644 --- a/packages/font-glyphs/src/symbol/mosaic/powerline.ptl +++ b/packages/font-glyphs/src/symbol/mosaic/powerline.ptl @@ -1,6 +1,7 @@ $$include '../../meta/macros.ptl' import [mix linreg clamp fallback] from "@iosevka/util" +import as Gr from "@iosevka/glyph/relation" glyph-module @@ -137,3 +138,9 @@ glyph-block Symbol-Mosaic-Powerline : begin RotatedPowerline 'powerline/slashBottomRight' 0xE0BB 'powerline/slashTopLeft' RotatedPowerline 'powerline/cornerTopRight' 0xE0BE 'powerline/cornerBottomLeft' RotatedPowerline 'powerline/slashTopRight' 0xE0BF 'powerline/slashBottomLeft' + + + Gr.linkSingleGlyphPairGr glyphStore [MangleName 'blackTriangleRB'] [MangleName 'powerline/cornerBottomRight'] Gr.MosaicForm + Gr.linkSingleGlyphPairGr glyphStore [MangleName 'blackTriangleLB'] [MangleName 'powerline/cornerBottomLeft'] Gr.MosaicForm + Gr.linkSingleGlyphPairGr glyphStore [MangleName 'blackTriangleLT'] [MangleName 'powerline/cornerTopLeft'] Gr.MosaicForm + Gr.linkSingleGlyphPairGr glyphStore [MangleName 'blackTriangleRT'] [MangleName 'powerline/cornerTopRight'] Gr.MosaicForm diff --git a/packages/font-otl/src/index.ptl b/packages/font-otl/src/index.ptl index 130440669..ce8f6c833 100644 --- a/packages/font-otl/src/index.ptl +++ b/packages/font-otl/src/index.ptl @@ -32,6 +32,9 @@ define [buildGSUB para glyphStore markGlyphs] : begin buildGrFeature gsub glyphStore Gr.Lnum buildGrFeature gsub glyphStore Gr.Onum + # Mosaic form + buildGrFeature gsub glyphStore Gr.MosaicForm + # zero is handled inside the CV/SS feature builder # As it is a cv/ss "cherry picking". diff --git a/packages/glyph/src/relation.mjs b/packages/glyph/src/relation.mjs index 64070ebee..47315e048 100644 --- a/packages/glyph/src/relation.mjs +++ b/packages/glyph/src/relation.mjs @@ -67,6 +67,7 @@ export const Wwid = OtlTaggedProp("Wwid", "WWID", "Narrow cell"); export const Lnum = OtlTaggedProp("Lnum", "lnum", "Lining number"); export const Onum = OtlTaggedProp("Onum", "onum", "Old-style number"); export const Zero = OtlTaggedProp("Zero", "zero", "Slashed zero"); +export const MosaicForm = OtlTaggedProp("MosaicForm", "MOSC", "Mosaic form"); export const AplForm = OtlTaggedProp("AplForm", "APLF", "APL form"); export const NumeratorForm = OtlTaggedProp("Numerator", "numr"); export const DenominatorForm = OtlTaggedProp("Denominator", "dnom"); @@ -330,6 +331,7 @@ export function createGrDisplaySheet(glyphStore, gn) { displayQueryPairFeatures(glyph, "Width", Nwid, Wwid, typographicFeatures); displayQueryPairFeatures(glyph, "Number Form", Lnum, Onum, typographicFeatures); displayQuerySingleFeature(glyph, AplForm, typographicFeatures); + displayQuerySingleFeature(glyph, MosaicForm, typographicFeatures); for (const gr of CvCherryPickingGrs) displayQuerySingleFeature(glyph, gr, typographicFeatures); // Query selected character variants @@ -447,6 +449,14 @@ export function linkSuffixPairGr(gs, tagCis, tagTrans, grCis, grTrans) { } } +export function linkSingleGlyphPairGr(gs, fromName, toName, gr) { + const gFrom = gs.queryByName(fromName); + if (!gFrom) return; + const gTo = gs.queryByName(toName); + if (!gTo) return; + gr.set(gFrom, toName); +} + /////////////////////////////////////////////////////////////////////////////////////////////////// export function hashCv(g) {