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
|
@ -130,8 +130,7 @@ glyph-block AutoBuild-Accents : begin
|
|||
local second : new Set
|
||||
local mapping : new Map
|
||||
|
||||
foreach { k1 m } [Object.entries uk] : begin
|
||||
foreach { k2 v } [Object.entries m] : begin
|
||||
foreach { { k1 k2 } v } [items-of uk] : begin
|
||||
local g1 : query-glyph k1
|
||||
local g2 : query-glyph k2
|
||||
local g3 : query-glyph v
|
||||
|
|
|
@ -24,18 +24,15 @@ export : define upperGrekMarkToTonosTf : object
|
|||
'psiliPerispomeni' 'psiliPerispomeniGrekUpperTonos'
|
||||
'dasiaPerispomeni' 'dasiaPerispomeniGrekUpperTonos'
|
||||
|
||||
export : define markCompositionTf : object
|
||||
'commaAbove' : object
|
||||
'graveAbove' 'psiliVaria'
|
||||
'acuteAbove' 'psiliOxia'
|
||||
'perispomeniAbove' 'psiliPerispomeni'
|
||||
'cyrlPokrytieAbove' 'commaCyrlPorkytieAbove'
|
||||
'revCommaAbove' : object
|
||||
'graveAbove' 'dasiaVaria'
|
||||
'acuteAbove' 'dasiaOxia'
|
||||
'perispomeniAbove' 'dasiaPerispomeni'
|
||||
'cyrlPsiliAbove' : object
|
||||
'cyrlPokrytieAbove' 'cyrlPsiliPokrytieAbove'
|
||||
export : define markCompositionTf : list
|
||||
list { 'commaAbove' 'graveAbove' } 'psiliVaria'
|
||||
list { 'commaAbove' 'acuteAbove' } 'psiliOxia'
|
||||
list { 'commaAbove' 'perispomeniAbove' } 'psiliPerispomeni'
|
||||
list { 'commaAbove' 'cyrlPokrytieAbove' } 'commaCyrlPorkytieAbove'
|
||||
list { 'revCommaAbove' 'graveAbove' } 'dasiaVaria'
|
||||
list { 'revCommaAbove' 'acuteAbove' } 'dasiaOxia'
|
||||
list { 'revCommaAbove' 'perispomeniAbove' } 'dasiaPerispomeni'
|
||||
list { 'cyrlPsiliAbove' 'cyrlPokrytieAbove' } 'cyrlPsiliPokrytieAbove'
|
||||
|
||||
export : define decompOverrides : object
|
||||
# Latvians use comma instead of cedillas in several letters.
|
||||
|
@ -215,3 +212,102 @@ export : define decompOverrides : object
|
|||
|
||||
0x1DF0B { 'esh' 'dblBarOver' }
|
||||
0x1DF0C { 'eshCurlyTail' 'dblBarOver' }
|
||||
|
||||
|
||||
# List of non-canonical combinations but applicable for ccmp feature
|
||||
export : define ccmpCombinations : list
|
||||
########## Data from L2/24-021
|
||||
|
||||
# Tilde overlays
|
||||
list {0x004C 0x0334} 0x2C62
|
||||
list {0x0062 0x0334} 0x1D6C
|
||||
list {0x0064 0x0334} 0x1D6D
|
||||
list {0x0066 0x0334} 0x1D6E
|
||||
list {0x006C 0x0334} 0x026B
|
||||
list {0x006D 0x0334} 0x1D6F
|
||||
list {0x006E 0x0334} 0x1D70
|
||||
list {0x0070 0x0334} 0x1D71
|
||||
list {0x0072 0x0334} 0x1D72
|
||||
list {0x0073 0x0334} 0x1D74
|
||||
list {0x0074 0x0334} 0x1D75
|
||||
list {0x007A 0x0334} 0x1D76
|
||||
list {0x0279 0x0334} 0xAB68
|
||||
list {0x027E 0x0334} 0x1D73
|
||||
list {0x02E1 0x0334} 0xAB5E
|
||||
|
||||
# Palatal hooks
|
||||
list {0x0043 0x0321} 0xA7C4
|
||||
list {0x005A 0x0321} 0xA7C6
|
||||
list {0x0062 0x0321} 0x1D80
|
||||
list {0x0063 0x0321} 0xA794
|
||||
list {0x0064 0x0321} 0x1D81
|
||||
list {0x0066 0x0321} 0x1D82
|
||||
list {0x0068 0x0321} 0xA795
|
||||
list {0x006B 0x0321} 0x1D84
|
||||
list {0x006C 0x0321} 0x1D85
|
||||
list {0x006D 0x0321} 0x1D86
|
||||
list {0x006E 0x0321} 0x1D87
|
||||
list {0x0070 0x0321} 0x1D88
|
||||
list {0x0072 0x0321} 0x1D89
|
||||
list {0x0073 0x0321} 0x1D8A
|
||||
list {0x0074 0x0321} 0x01AB
|
||||
list {0x0076 0x0321} 0x1D8C
|
||||
list {0x0078 0x0321} 0x1D8D
|
||||
list {0x007A 0x0321} 0x1D8E
|
||||
list {0x014B 0x0321} 0x1DF14
|
||||
list {0x0261 0x0321} 0x1D83
|
||||
list {0x026C 0x0321} 0x1DF13
|
||||
list {0x0279 0x0321} 0x1DF15
|
||||
list {0x027E 0x0321} 0x1DF16
|
||||
list {0x0283 0x0321} 0x1D8B
|
||||
list {0x0292 0x0321} 0x1DF18
|
||||
list {0x02A4 0x0321} 0x1DF12
|
||||
list {0x02A7 0x0321} 0x1DF17
|
||||
list {0x02E1 0x0321} 0x1DAA
|
||||
list {0x1D57 0x0321} 0x1DB5
|
||||
|
||||
# Retroflex hooks
|
||||
list {0x0052 0x0322} 0x2C64
|
||||
list {0x0054 0x0322} 0x01AE
|
||||
list {0x0061 0x0322} 0x1D8F
|
||||
list {0x0063 0x0322} 0x1DF1D
|
||||
list {0x0064 0x0322} 0x0256
|
||||
list {0x0065 0x0322} 0x1D92
|
||||
list {0x0069 0x0322} 0x1D96
|
||||
list {0x006C 0x0322} 0x026D
|
||||
list {0x006E 0x0322} 0x0273
|
||||
list {0x006F 0x0322} 0x1DF1B
|
||||
list {0x0072 0x0322} 0x027D
|
||||
list {0x0074 0x0322} 0x0288
|
||||
list {0x0075 0x0322} 0x1D99
|
||||
list {0x007A 0x0322} 0x0290
|
||||
list {0x01AD 0x0322} 0x1DF09
|
||||
list {0x01C3 0x0322} 0x1DF0A
|
||||
list {0x0251 0x0322} 0x1D90
|
||||
list {0x0254 0x0322} 0x1D97
|
||||
list {0x0257 0x0322} 0x1D91
|
||||
list {0x0259 0x0322} 0x1D95
|
||||
list {0x025B 0x0322} 0x1D93
|
||||
list {0x025C 0x0322} 0x1D94
|
||||
list {0x0268 0x0322} 0x1DF1A
|
||||
list {0x026C 0x0322} 0xA78E
|
||||
list {0x026E 0x0322} 0x1DF05
|
||||
list {0x027A 0x0322} 0x1DF08
|
||||
list {0x0283 0x0322} 0x1D98
|
||||
list {0x0292 0x0322} 0x1D9A
|
||||
list {0x02A3 0x0322} 0xAB66
|
||||
list {0x02A4 0x0322} 0x1DF19
|
||||
list {0x02A6 0x0322} 0xAB67
|
||||
list {0x02A7 0x0322} 0x1DF1C
|
||||
list {0x02B3 0x0322} 0x107A8
|
||||
list {0x02E1 0x0322} 0x1DA9
|
||||
list {0x1D48 0x0322} 0x1078B
|
||||
list {0x1D57 0x0322} 0x107AF
|
||||
list {0x1DBB 0x0322} 0x1DBC
|
||||
list {0x207F 0x0322} 0x1DAF
|
||||
list {0x10787 0x0322} 0x10788
|
||||
list {0x1078C 0x0322} 0x1078D
|
||||
list {0x1079B 0x0322} 0x1079D
|
||||
list {0x1079E 0x0322} 0x1079F
|
||||
list {0x107A6 0x0322} 0x107A7
|
||||
list {0x107AC 0x0322} 0x107AD
|
||||
|
|
|
@ -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