ccmp: Add composition for overlays and hooks (#2262)
This commit is contained in:
parent
d461934be1
commit
4a6862aa45
4 changed files with 152 additions and 32 deletions
|
@ -1,6 +1,6 @@
|
|||
$$include './meta/macros.ptl'
|
||||
|
||||
import [UkMapToLookup UkMap2ToLookup] from "./table-util.mjs"
|
||||
import [UkMapToLookup UkLigatureToLookup] from "./table-util.mjs"
|
||||
import [Dotless TieMark TieGlyph OgonekTrY IsSuperscript IsSubscript LeaningMark LeaningMarkSpacer] from "@iosevka/glyph/relation"
|
||||
import as UnicodeKnowledge from "@iosevka/font-glyphs/unicode-knowledge"
|
||||
|
||||
|
@ -33,6 +33,14 @@ export : define [buildCCMP gsub glyphStore markGlyphs] : begin
|
|||
|
||||
gsub.endBlock rec
|
||||
|
||||
Ccmp-Group "Combining of overlay/hoked letters" : begin
|
||||
define combineLookup : gsub.createLookup : object
|
||||
.type 'gsub_ligature'
|
||||
.substitutions : UkLigatureToLookup UnicodeKnowledge.ccmpCombinations
|
||||
function u : glyphStore.queryNameByUnicode u
|
||||
|
||||
export-lookup combineLookup
|
||||
|
||||
Ccmp-Group "Mark transforms" : begin
|
||||
|
||||
define groupGrekUpperTonos {}
|
||||
|
@ -67,7 +75,7 @@ export : define [buildCCMP gsub glyphStore markGlyphs] : begin
|
|||
|
||||
export-lookup : gsub.createLookup : object
|
||||
.type 'gsub_ligature'
|
||||
.substitutions : UkMap2ToLookup UnicodeKnowledge.markCompositionTf
|
||||
.substitutions : UkLigatureToLookup UnicodeKnowledge.markCompositionTf [function n n]
|
||||
|
||||
export-lookup : gsub.createLookup : object
|
||||
.type 'gsub_multiple'
|
||||
|
|
|
@ -221,8 +221,25 @@ export : define [UkMapToLookup m] : begin
|
|||
r.push v
|
||||
return { .left l .right r }
|
||||
|
||||
export : define [UkMap2ToLookup mm] : begin
|
||||
local res {}
|
||||
foreach { g1 second } [Object.entries mm] : foreach { g2 gTo } [Object.entries second] : begin
|
||||
res.push {.from {g1 g2} .to gTo}
|
||||
return res
|
||||
export : define [UkLigatureToLookup data mapper] : begin
|
||||
local substitutions {}
|
||||
foreach { from to } [items-of data] : begin
|
||||
local allFound true
|
||||
local fromGlyphNames {}
|
||||
local toGlyph null
|
||||
|
||||
foreach u [items-of from] : begin
|
||||
local gn : mapper u
|
||||
if gn
|
||||
: then : fromGlyphNames.push gn
|
||||
: else : set allFound false
|
||||
|
||||
begin
|
||||
local gn : mapper to
|
||||
if gn
|
||||
: then : set toGlyph gn
|
||||
: else : set allFound false
|
||||
|
||||
if allFound : substitutions.push {.from fromGlyphNames .to toGlyph}
|
||||
|
||||
return substitutions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue