954 lines
31 KiB
Text
954 lines
31 KiB
Text
###### Automatic builds
|
||
$$include '../../meta/macros.ptl'
|
||
|
||
import [linreg clamp mix fallback] from"../../support/utils.mjs"
|
||
import [getGrTree IsSuperscript IsSubscript] from"../../support/gr.mjs"
|
||
import [AnyCv DotlessOrNot CvDecompose MathSansSerif Texture] from"../../support/gr.mjs"
|
||
import [NumeratorForm DenominatorForm] from"../../support/gr.mjs"
|
||
import [Transform] from"../../support/geometry/transform.mjs"
|
||
extern Map
|
||
extern Set
|
||
|
||
glyph-module
|
||
|
||
glyph-block Autobuild-Transformed-Shared : begin
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
|
||
glyph-block-export wrapName
|
||
define [wrapName groupID baseName] "\(groupID){\(baseName)}"
|
||
|
||
define [suggestName _name] : begin
|
||
local name _name
|
||
if [query-glyph name] : begin
|
||
local j 2
|
||
while [query-glyph (name + j)] : inc j
|
||
set name (name + j)
|
||
return name
|
||
|
||
glyph-block-export suggestMappedName
|
||
define [suggestMappedName map key name] : begin
|
||
if map.(key) : return map.(key)
|
||
local amended : suggestName name
|
||
set map.(key) amended
|
||
return amended
|
||
|
||
glyph-block-export extendRelatedGlyphs
|
||
define [extendRelatedGlyphs groupID records] : begin
|
||
local relatedRecords {}
|
||
local relSets {}
|
||
local targetNameMap {.}
|
||
|
||
foreach [record : items-of records] : begin
|
||
local srcName record.1
|
||
|
||
local dstName : wrapName groupID srcName
|
||
suggestMappedName targetNameMap srcName dstName
|
||
|
||
local tree : getGrTree srcName { DotlessOrNot AnyCv } query-glyph
|
||
foreach [{gr origSrcName relSrcName} : items-of tree] : if [query-glyph relSrcName] : begin
|
||
local origDstName : suggestMappedName targetNameMap origSrcName [wrapName groupID origSrcName]
|
||
local relDstName : suggestMappedName targetNameMap relSrcName [wrapName groupID relSrcName]
|
||
|
||
local relatedRecord : record.slice 0
|
||
set relatedRecord.0 null
|
||
set relatedRecord.1 relSrcName
|
||
set relatedRecord.2 true
|
||
relatedRecords.push relatedRecord
|
||
|
||
relSets.push { gr origDstName relDstName }
|
||
|
||
return { [records.concat relatedRecords] relSets targetNameMap }
|
||
|
||
glyph-block-export link-relations
|
||
define [link-relations relSets] : begin
|
||
local rs : new Set
|
||
foreach [{gr origDstName relDstName} : items-of relSets]
|
||
if [query-glyph origDstName] : begin
|
||
gr.set [query-glyph origDstName] relDstName
|
||
if [query-glyph relDstName] : begin
|
||
[query-glyph origDstName].tryBecomeMirrorOf [query-glyph relDstName] rs
|
||
|
||
glyph-block-export ToSuperscript
|
||
define [ToSuperscript div] : glyph-proc
|
||
local df : DivFrame df
|
||
include [Ungizmo] true
|
||
include [Translate (-df.middle) (-CAP)] true
|
||
include [Scale ToSuperscript.crowdAdjScale] true
|
||
include [Translate df.middle (CAP + AccentStackOffset / 2)] true
|
||
include [Regizmo] true
|
||
set ToSuperscript.crowd 3.5
|
||
set ToSuperscript.crowdAdjScale 0.7
|
||
|
||
glyph-block-export ToSubscript
|
||
define [ToSubscript div] : glyph-proc
|
||
local df : DivFrame df
|
||
include [Ungizmo] true
|
||
include [Translate (-df.middle) 0] true
|
||
include [Scale ToSubscript.crowdAdjScale] true
|
||
include [Translate df.middle (Descender / 2)] true
|
||
include [Regizmo] true
|
||
set ToSubscript.crowd 3.5
|
||
set ToSubscript.crowdAdjScale 0.7
|
||
|
||
glyph-block Autobuild-Transformed : begin
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Fork Miniature
|
||
glyph-block-import Mark-Shared-Metrics : markMiddle
|
||
glyph-block-import Mark-Above : aboveMarkBot aboveMarkMid aboveMarkTop
|
||
glyph-block-import Mark-Below : belowMarkBot belowMarkMid belowMarkTop
|
||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations
|
||
glyph-block-import Autobuild-Transformed-Shared : ToSuperscript ToSubscript
|
||
|
||
do
|
||
createSuperscripts 'sup' null : list
|
||
list 0x00AA 'aSbRsbUnderlineBelow'
|
||
list 0x00BA 'oSbRsbUnderlineBelow'
|
||
list 0x2070 'zero.lnum'
|
||
list 0x00B9 'one.lnum'
|
||
list 0x00B2 'two.lnum'
|
||
list 0x00B3 'three.lnum'
|
||
list 0x2074 'four.lnum'
|
||
list 0x2075 'five.lnum'
|
||
list 0x2076 'six.lnum'
|
||
list 0x2077 'seven.lnum'
|
||
list 0x2078 'eight.lnum'
|
||
list 0x2079 'nine.lnum'
|
||
list 0x02B0 'h'
|
||
list 0x02B1 'hHookTop'
|
||
list 0x02B2 'j'
|
||
list 0x02B3 'r'
|
||
list 0x02B4 'turnr'
|
||
list 0x02B5 'rTurnRTail'
|
||
list 0x02B6 'invSmcpR'
|
||
list 0x02B7 'w'
|
||
list 0x02B8 'y'
|
||
list 0x02C0 'smallGlottalStop'
|
||
list 0x02C1 'smallRevGlottalStop'
|
||
list 0x02E0 'latn/gamma'
|
||
list 0x02E1 'l'
|
||
list 0x02E2 's'
|
||
list 0x02E3 'x'
|
||
list 0x02E4 'revGlottalStop'
|
||
list 0x2071 'i'
|
||
list 0x207F 'n'
|
||
list 0x1D43 'a'
|
||
list 0x1D44 'turna'
|
||
list 0x1D45 'scripta'
|
||
list 0x1D46 'turnae'
|
||
list 0x1D47 'b'
|
||
list 0x1D48 'd'
|
||
list 0x1D49 'e'
|
||
list 0x1D4A 'schwa'
|
||
list 0x1D4B 'latn/epsilon'
|
||
list 0x1D4C 'turnepsilon'
|
||
list 0x1D4D 'g'
|
||
list 0x1D4E 'turni'
|
||
list 0x1D4F 'k'
|
||
list 0x1D50 'm'
|
||
list 0x1D51 'eng'
|
||
list 0x1D52 'o'
|
||
list 0x1D53 'turnc'
|
||
list 0x1D54 'oupperhalf'
|
||
list 0x1D55 'olowerhalf'
|
||
list 0x1D56 'p'
|
||
list 0x1D57 't'
|
||
list 0x1D58 'u'
|
||
list 0x1D59 'uSideways'
|
||
list 0x1D5A 'turnm'
|
||
list 0x1D5B 'v'
|
||
list 0x1D5C 'latinAyin'
|
||
list 0x1D5D 'grek/beta'
|
||
list 0x1D5E 'grek/gamma'
|
||
list 0x1D5F 'grek/delta'
|
||
list 0x1D60 'grek/phi'
|
||
list 0x1D61 'grek/chi'
|
||
list 0x1D78 'cyrl/en'
|
||
list 0x1D9B 'turnscripta'
|
||
list 0x1D9C 'c'
|
||
list 0x1D9D 'cCurlyTail'
|
||
list 0x1D9E 'eth'
|
||
list 0x1D9F 'latn/epsilonRev'
|
||
list 0x1DA0 'f'
|
||
list 0x1DA1 'dotlessjBar'
|
||
list 0x1DA2 'gScript'
|
||
list 0x1DA3 'turnh'
|
||
list 0x1DA4 'iBarOver'
|
||
list 0x1DA5 'latn/iota'
|
||
list 0x1DA6 'smcpI'
|
||
list 0x1DA7 'smcpIBarOver'
|
||
list 0x1DA8 'jCurlyTail'
|
||
list 0x1DAB 'smcpL'
|
||
list 0x1DA9 'lRTail'
|
||
list 0x1DAA 'lPalatalHook'
|
||
list 0x1DAC 'meng'
|
||
list 0x1DAD 'turnmLeg'
|
||
list 0x1DAE 'nLTail'
|
||
list 0x1DAF 'nHookBottom'
|
||
list 0x1DB0 'smcpN'
|
||
list 0x1DB1 'obar'
|
||
list 0x1DB2 'latn/phi'
|
||
list 0x1DB3 'sRTail'
|
||
list 0x1DB4 'esh'
|
||
list 0x1DB5 'tLTail'
|
||
list 0x1DB6 'uLongBarOver'
|
||
list 0x1DB7 'latn/upsilon'
|
||
list 0x1DB8 'smcpU'
|
||
list 0x1DB9 'vHookTop'
|
||
list 0x1DBA 'turnv'
|
||
list 0x1DBC 'zRTailBR'
|
||
list 0x1DBD 'zCurlyTail'
|
||
list 0x1DBE 'ezh'
|
||
list 0x1DBF 'grek/theta'
|
||
list 0x1DBB 'z'
|
||
list 0x1D2C 'A'
|
||
list 0x1D2E 'B'
|
||
list 0x1D2F 'BBar'
|
||
list 0x1D30 'D'
|
||
list 0x1D31 'E'
|
||
list 0x1D32 'revE'
|
||
list 0x1D33 'G'
|
||
list 0x1D34 'H'
|
||
list 0x1D35 'I'
|
||
list 0x1D36 'J'
|
||
list 0x1D37 'K'
|
||
list 0x1D38 'L'
|
||
list 0x1D39 'M'
|
||
list 0x1D3A 'N'
|
||
list 0x1D3B 'NRev'
|
||
list 0x1D3C 'O'
|
||
list 0x1D3D 'OU'
|
||
list 0x1D3E 'P'
|
||
list 0x1D3F 'R'
|
||
list 0x1D40 'T'
|
||
list 0x1D41 'U'
|
||
list 0x1D42 'W'
|
||
list 0x2C7D 'V'
|
||
list 0x207A 'plus'
|
||
list 0x207B 'minus'
|
||
list 0x207C 'equal'
|
||
list 0x207D 'parenLeft'
|
||
list 0x207E 'parenRight'
|
||
list 0xA69C 'cyrl/yer'
|
||
list 0xA69D 'cyrl/yeri'
|
||
list 0xA702 'subst'
|
||
list 0xA703 'substBarNoRise'
|
||
list 0xA704 'supst'
|
||
list 0xA705 'supstBarNoRise'
|
||
list 0xA71B 'arrowUp.NWID'
|
||
list 0xA71C 'arrowDown.NWID'
|
||
list 0xA71D 'alveolarclick'
|
||
list 0xA71E 'alveolarpercussive'
|
||
list 0xA7F2 'C'
|
||
list 0xA7F3 'F'
|
||
list 0xA7F4 'Q'
|
||
list 0xA7F8 'smcpHStroke'
|
||
list 0xA7F9 'oe'
|
||
list 0xAB5C 'heng'
|
||
list 0xAB5D 'lInvLazySOver'
|
||
list 0xAB5E 'lTildeOver'
|
||
list 0xAB69 'turnw'
|
||
list 0x107AF 'tRTail'
|
||
list 0x1078B 'dHookBottom'
|
||
list 0x107A5 'q'
|
||
list 0x10792 'smcpG'
|
||
list 0x107B3 'glottalStopBar'
|
||
list 0x10795 'hBar'
|
||
list 0x10797 'hengHookTop'
|
||
list 0x107B0 'vHookRight'
|
||
list 0x107A9 'rFlap'
|
||
list 0x107A8 'rRTail'
|
||
list 0x107BA 'sCurlyTail'
|
||
list 0x10784 'smcpB'
|
||
list 0x107AA 'smcpR'
|
||
list 0x10796 'smcpH'
|
||
list 0x107B4 'revGlottalStopBar'
|
||
list 0x1079B 'lBelt'
|
||
list 0x1079E 'lyogh'
|
||
list 0x1079D 'lBeltRTail'
|
||
list 0x1079F 'lyoghRTail'
|
||
list 0x107A1 'turnyBelt'
|
||
list 0x1079C 'smcpLBelt'
|
||
list 0x107A0 'turny'
|
||
list 0x107A6 'turnrLongLeg'
|
||
list 0x107A7 'rTurnLongLetRTail'
|
||
list 0x10780 'smcpAA'
|
||
list 0x10785 'bHookTop'
|
||
list 0x1078C 'dHookTop'
|
||
list 0x1078D 'dHookTopBottom'
|
||
list 0x10798 'dotlessjBarHookTop'
|
||
list 0x10793 'gScriptHookTop'
|
||
list 0x10794 'smcpGHookTop'
|
||
list 0x107B5 'bullEye'
|
||
list 0x107B6 'dentalclick'
|
||
list 0x107B8 'palatoalveolarclick'
|
||
list 0x107B9 'retroflexClickHook'
|
||
list 0x107B7 'alveolarlateralclick'
|
||
list 0x107B2 'smcpY'
|
||
list 0x107A4 'closeomega'
|
||
list 0x107A2 'oSlash'
|
||
list 0x1078E 'eRev'
|
||
list 0x10791 'ramshorn'
|
||
list 0x1078F 'epsilonRevClosed'
|
||
list 0x10783 'ae'
|
||
list 0x107A3 'smcpOE'
|
||
list 0x10781 'triangleColon'
|
||
list 0x10782 'halfTriangleColon'
|
||
list 0x1E030 'cyrl/a'
|
||
list 0x1E031 'cyrl/be'
|
||
list 0x1E032 'cyrl/ve'
|
||
list 0x1E033 'cyrl/ghe'
|
||
list 0x1E034 'cyrl/de'
|
||
list 0x1E035 'cyrl/ie'
|
||
list 0x1E036 'cyrl/zhe'
|
||
list 0x1E037 'cyrl/ze'
|
||
list 0x1E038 'cyrl/i'
|
||
list 0x1E039 'cyrl/ka'
|
||
list 0x1E03A 'cyrl/el'
|
||
list 0x1E03B 'cyrl/em'
|
||
list 0x1E03C 'cyrl/o'
|
||
list 0x1E03D 'cyrl/pe'
|
||
list 0x1E03E 'cyrl/er'
|
||
list 0x1E03F 'cyrl/es'
|
||
list 0x1E040 'cyrl/te'
|
||
list 0x1E041 'cyrl/u'
|
||
list 0x1E042 'cyrl/ef'
|
||
list 0x1E043 'cyrl/ha'
|
||
list 0x1E044 'cyrl/tse'
|
||
list 0x1E045 'cyrl/che'
|
||
list 0x1E046 'cyrl/sha'
|
||
list 0x1E047 'cyrl/yery'
|
||
list 0x1E048 'cyrl/e'
|
||
list 0x1E049 'cyrl/yu'
|
||
list 0x1E04A 'cyrl/dzze'
|
||
list 0x1E04B 'cyrl/schwa'
|
||
list 0x1E04C 'cyrl/Ukrainiani'
|
||
list 0x1E04D 'cyrl/je'
|
||
list 0x1E04E 'cyrl/oe'
|
||
list 0x1E04F 'cyrl/ue'
|
||
list 0x1E050 'cyrl/palochka'
|
||
list 0x1E06B 'cyrl/the'
|
||
list 0x1E06C 'cyrl/yeryBack'
|
||
list 0x1E06D 'cyrl/KazakhShortu'
|
||
list null 'S' # there is no superscript S in unicode, but is is used for the SM symbol
|
||
|
||
createSuperscripts 'numerator' NumeratorForm : list
|
||
list null 'zero.onum'
|
||
list null 'one.onum'
|
||
list null 'two.onum'
|
||
list null 'three.onum'
|
||
list null 'four.onum'
|
||
list null 'five.onum'
|
||
list null 'six.onum'
|
||
list null 'seven.onum'
|
||
list null 'eight.onum'
|
||
list null 'nine.onum'
|
||
list null 'zero.lnum'
|
||
list null 'one.lnum'
|
||
list null 'two.lnum'
|
||
list null 'three.lnum'
|
||
list null 'four.lnum'
|
||
list null 'five.lnum'
|
||
list null 'six.lnum'
|
||
list null 'seven.lnum'
|
||
list null 'eight.lnum'
|
||
list null 'nine.lnum'
|
||
|
||
do "superscript AE"
|
||
define { tnmAHalf jobsAHalf } : createSuperscripts 'sup' null { { null 'AE/AHalf' } }
|
||
define { tnmEHalf jobsEHalf } : createSuperscripts 'sup' null { { null 'AE/EHalf' } }
|
||
create-glyph 'sup{AE}' 0x1D2D : glyph-proc
|
||
include [refer-glyph tnmAHalf.('AE/AHalf')] AS_BASE ALSO_METRICS
|
||
include [refer-glyph tnmEHalf.('AE/EHalf')]
|
||
CvDecompose.set currentGlyph { tnmAHalf.('AE/AHalf') tnmEHalf.('AE/EHalf') }
|
||
|
||
: where : [createSuperscripts prefix gr _records] : begin
|
||
local {records relSets targetNameMap} : extendRelatedGlyphs prefix _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local miniatureFont : Miniature pendingGlyphs
|
||
crowd -- ToSuperscript.crowd
|
||
scale -- ToSuperscript.crowdAdjScale
|
||
mono -- true
|
||
sbscale -- 0.75
|
||
foreach { unicode glyphid fRelated } [items-of records]
|
||
if [not : query-glyph targetNameMap.(glyphid)] : begin
|
||
create-glyph (targetNameMap.(glyphid)) unicode : glyph-proc
|
||
if [not : miniatureFont.queryByName glyphid] : begin
|
||
throw : new Error "Cannot find glyph \(glyphid)"
|
||
local middle : [miniatureFont.queryByName glyphid].advanceWidth / 2
|
||
include [miniatureFont.queryByName glyphid] AS_BASE ALSO_METRICS
|
||
include : ToSuperscript
|
||
IsSuperscript.set currentGlyph
|
||
if ([not fRelated] && gr) : gr.set [query-glyph glyphid] (targetNameMap.(glyphid))
|
||
link-relations relSets
|
||
return { targetNameMap records }
|
||
|
||
do
|
||
createSubscripts 'sub' null : list
|
||
list 0x2080 'zero.lnum'
|
||
list 0x2081 'one.lnum'
|
||
list 0x2082 'two.lnum'
|
||
list 0x2083 'three.lnum'
|
||
list 0x2084 'four.lnum'
|
||
list 0x2085 'five.lnum'
|
||
list 0x2086 'six.lnum'
|
||
list 0x2087 'seven.lnum'
|
||
list 0x2088 'eight.lnum'
|
||
list 0x2089 'nine.lnum'
|
||
list 0x2090 'a'
|
||
list 0x2091 'e'
|
||
list 0x2092 'o'
|
||
list 0x2093 'x'
|
||
list 0x2094 'schwa'
|
||
list 0x2095 'h'
|
||
list 0x2096 'k'
|
||
list 0x2097 'l'
|
||
list 0x2098 'm'
|
||
list 0x2099 'n'
|
||
list 0x209A 'p'
|
||
list 0x209B 's'
|
||
list 0x209C 't'
|
||
list 0x1D62 'i'
|
||
list 0x1D63 'r'
|
||
list 0x1D64 'u'
|
||
list 0x1D65 'v'
|
||
list 0x1D66 'grek/beta'
|
||
list 0x1D67 'grek/gamma'
|
||
list 0x1D68 'grek/rho'
|
||
list 0x1D69 'grek/phi'
|
||
list 0x1D6A 'grek/chi'
|
||
list 0x2C7C 'j'
|
||
list 0x208A 'plus'
|
||
list 0x208B 'minus'
|
||
list 0x208C 'equal'
|
||
list 0x208D 'parenLeft'
|
||
list 0x208E 'parenRight'
|
||
list 0xA700 'subst'
|
||
list 0xA701 'substBarNoRise'
|
||
list 0xA706 'supst'
|
||
list 0xA707 'supstBarNoRise'
|
||
list 0xA71F 'alveolarpercussive'
|
||
list 0x1E051 'cyrl/a'
|
||
list 0x1E052 'cyrl/be'
|
||
list 0x1E053 'cyrl/ve'
|
||
list 0x1E054 'cyrl/ghe'
|
||
list 0x1E055 'cyrl/de'
|
||
list 0x1E056 'cyrl/ie'
|
||
list 0x1E057 'cyrl/zhe'
|
||
list 0x1E058 'cyrl/ze'
|
||
list 0x1E059 'cyrl/i'
|
||
list 0x1E05A 'cyrl/ka'
|
||
list 0x1E05B 'cyrl/el'
|
||
list 0x1E05C 'cyrl/o'
|
||
list 0x1E05D 'cyrl/pe'
|
||
list 0x1E05E 'cyrl/es'
|
||
list 0x1E05F 'cyrl/u'
|
||
list 0x1E060 'cyrl/ef'
|
||
list 0x1E061 'cyrl/ha'
|
||
list 0x1E062 'cyrl/tse'
|
||
list 0x1E063 'cyrl/che'
|
||
list 0x1E064 'cyrl/sha'
|
||
list 0x1E065 'cyrl/yer'
|
||
list 0x1E066 'cyrl/yery'
|
||
list 0x1E067 'cyrl/ge'
|
||
list 0x1E068 'cyrl/Ukrainiani'
|
||
list 0x1E069 'cyrl/dze'
|
||
list 0x1E06A 'cyrl/dzhe'
|
||
|
||
createSubscripts 'denominator' DenominatorForm : list
|
||
list null 'zero.onum'
|
||
list null 'one.onum'
|
||
list null 'two.onum'
|
||
list null 'three.onum'
|
||
list null 'four.onum'
|
||
list null 'five.onum'
|
||
list null 'six.onum'
|
||
list null 'seven.onum'
|
||
list null 'eight.onum'
|
||
list null 'nine.onum'
|
||
list null 'zero.lnum'
|
||
list null 'one.lnum'
|
||
list null 'two.lnum'
|
||
list null 'three.lnum'
|
||
list null 'four.lnum'
|
||
list null 'five.lnum'
|
||
list null 'six.lnum'
|
||
list null 'seven.lnum'
|
||
list null 'eight.lnum'
|
||
list null 'nine.lnum'
|
||
|
||
: where : [createSubscripts prefix gr _records] : begin
|
||
local {records relSets targetNameMap} : extendRelatedGlyphs prefix _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local miniatureFont : Miniature pendingGlyphs
|
||
crowd -- ToSubscript.crowd
|
||
scale -- ToSubscript.crowdAdjScale
|
||
mono -- true
|
||
sbscale -- 0.75
|
||
foreach { unicode glyphid fRelated } [items-of records]
|
||
if [not : query-glyph targetNameMap.(glyphid)] : begin
|
||
create-glyph (targetNameMap.(glyphid)) unicode : glyph-proc
|
||
local middle : [miniatureFont.queryByName glyphid].advanceWidth / 2
|
||
include [miniatureFont.queryByName glyphid] AS_BASE ALSO_METRICS
|
||
include : ToSubscript
|
||
IsSubscript.set currentGlyph
|
||
if ([not fRelated] && gr) : gr.set [query-glyph glyphid] (targetNameMap.(glyphid))
|
||
link-relations relSets
|
||
|
||
do
|
||
createMedievalCombs 0 XH : list
|
||
list 0x363 'a'
|
||
list 0x364 'e'
|
||
list 0x366 'o'
|
||
list 0x367 'u'
|
||
list 0x368 'c'
|
||
list 0x369 'd'
|
||
list 0x36A 'h'
|
||
list 0x36B 'm'
|
||
list 0x36C 'r'
|
||
list 0x36E 'v'
|
||
list 0x36F 'x'
|
||
list 0x1DD4 'ae'
|
||
list 0x1DD5 'ao'
|
||
list 0x1DDB 'smcpG'
|
||
list 0x1DDE 'smcpL'
|
||
list 0x1DDF 'smcpM'
|
||
list 0x1DE0 'n'
|
||
list 0x1DE1 'smcpN'
|
||
list 0x1DE2 'smcpR'
|
||
list 0x1DE3 'rRotunda'
|
||
list 0x1DE4 's'
|
||
list 0x1DE6 'z'
|
||
list 0x1DE7 'scripta'
|
||
list 0x1DEA 'schwa'
|
||
list 0x1DED 'oWithLightCentralizationStroke'
|
||
list 0x1DF0 'uWithLightCentralizationStroke'
|
||
list 0x1DF1 'w'
|
||
list 0x1ACE 'tInsular'
|
||
list 0x20F0 'asterisk/slashBot'
|
||
list 0x2DE1 'cyrl/ve'
|
||
list 0x2DE2 'cyrl/ghe'
|
||
list 0x2DE3 'cyrl/de'
|
||
list 0x2DE4 'cyrl/zhe'
|
||
list 0x2DE5 'cyrl/ze'
|
||
list 0x2DE6 'cyrl/ka'
|
||
list 0x2DE7 'cyrl/el'
|
||
list 0x2DE8 'cyrl/em'
|
||
list 0x2DE9 'cyrl/en'
|
||
list 0x2DEA 'cyrl/o'
|
||
list 0x2DEB 'cyrl/pe'
|
||
list 0x2DED 'cyrl/es'
|
||
list 0x2DEE 'cyrl/te'
|
||
list 0x2DEF 'cyrl/ha'
|
||
list 0x2DF0 'cyrl/tse'
|
||
list 0x2DF1 'cyrl/che'
|
||
list 0x2DF2 'cyrl/sha'
|
||
list 0x2DF3 'cyrl/shcha'
|
||
list 0x2DF4 'cyrl/fita'
|
||
list 0x2DF5 'cyrl/este'
|
||
list 0x2DF6 'cyrl/a'
|
||
list 0x2DF7 'cyrl/ie'
|
||
list 0x2DF8 'cyrl/djerv'
|
||
list 0x2DF9 'cyrl/uk'
|
||
list 0x2DFB 'cyrl/yu'
|
||
list 0x2DFC 'cyrl/aIotified'
|
||
list 0x2DFD 'cyrl/smallYus'
|
||
list 0x2DFE 'cyrl/bigYus'
|
||
list 0x2DFF 'cyrl/bigYusIotified'
|
||
list 0xA674 'cyrl/ye'
|
||
list 0xA675 'cyrl/i'
|
||
list 0xA67B 'cyrl/omega'
|
||
list 0xA69F 'cyrl/eIotified'
|
||
|
||
createMedievalCombs 0 CAP : list
|
||
list 0x365 'i'
|
||
list 0x36D 't'
|
||
list 0x1AC6 'numberSign'
|
||
list 0x1DD8 'dInsular'
|
||
list 0x1DD9 'eth'
|
||
list 0x1DDC 'k'
|
||
list 0x1DDD 'l'
|
||
list 0x1DE8 'b'
|
||
list 0x1DEC 'lDblTildeOver'
|
||
list 0x1DF2 'aDieresis'
|
||
list 0x1DF3 'oDieresis'
|
||
list 0x1DF4 'uDieresis'
|
||
list 0x2DE0 'cyrl/be'
|
||
list 0x2DFA 'cyrl/yat'
|
||
list 0xA676 'cyrl/yi'
|
||
list 0xA678 'cyrl/yer'
|
||
list 0xA679 'cyrl/yery'
|
||
list 0xA67A 'cyrl/yeri'
|
||
list 0x1E08F 'cyrl/Ukrainiani'
|
||
|
||
createMedievalCombs Descender XH : list
|
||
list 0x1ACC 'gInsular'
|
||
list 0x1DDA 'g'
|
||
list 0x1DD7 'cCedilla'
|
||
list 0x1DE9 'latn/beta'
|
||
list 0x1DEE 'p'
|
||
list 0x2DEC 'cyrl/er'
|
||
list 0xA677 'cyrl/u'
|
||
|
||
createMedievalCombs Descender CAP : list
|
||
list 0x1ACD 'rInsular'
|
||
list 0x1DEB 'f'
|
||
list 0x1DE5 'longs'
|
||
list 0x1DEF 'esh'
|
||
list 0xA69E 'cyrl/ef'
|
||
|
||
: where : [createMedievalCombs defaultLow defaultHigh _records] : begin
|
||
local { records relSets targetNameMap } : extendRelatedGlyphs 'medievalAbove' _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local miniatureFont : Miniature pendingGlyphs
|
||
crowd -- 7
|
||
scale -- 0.4
|
||
mono -- true
|
||
sbscale -- 1
|
||
|
||
foreach {unicode glyphid} [items-of records] : if [not : query-glyph targetNameMap.(glyphid)]
|
||
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
|
||
set-width 0
|
||
local derived [miniatureFont.queryByName glyphid]
|
||
local low defaultLow
|
||
local high defaultHigh
|
||
if (derived && derived.baseAnchors.above && derived.baseAnchors.below) : begin
|
||
set low derived.baseAnchors.below.y
|
||
set high derived.baseAnchors.above.y
|
||
|
||
local middle : derived.advanceWidth / 2
|
||
include derived
|
||
include : Ungizmo
|
||
include : Translate (-middle) (-low)
|
||
include : Scale 0.4
|
||
include : Translate markMiddle aboveMarkBot
|
||
include : Regizmo
|
||
local markHeight : 0.4 * (high - low) + 0 * (aboveMarkTop - aboveMarkBot)
|
||
|
||
set-mark-anchor 'above' markMiddle XH markMiddle (aboveMarkBot + markHeight)
|
||
set-base-anchor 'aboveBraceL' markMiddle (aboveMarkBot + markHeight / 2)
|
||
set-base-anchor 'aboveBraceR' markMiddle (aboveMarkBot + markHeight / 2)
|
||
|
||
link-relations relSets
|
||
|
||
do
|
||
createMedievalBelowCombs : list
|
||
list 0x0359 'asterisk/sMid'
|
||
list 0x1ABF 'w'
|
||
list 0x1AC0 'turnw'
|
||
list 0x1DCA 'r'
|
||
: where : [createMedievalBelowCombs _records] : begin
|
||
local { records relSets targetNameMap } : extendRelatedGlyphs 'medievalBelow' _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local miniatureFont : Miniature pendingGlyphs
|
||
crowd -- 7
|
||
scale -- 0.4
|
||
mono -- true
|
||
sbscale -- 1
|
||
foreach {unicode glyphid} [items-of records] : if [not : query-glyph targetNameMap.(glyphid)]
|
||
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
|
||
set-width 0
|
||
local middle : [miniatureFont.queryByName glyphid].advanceWidth / 2
|
||
include [miniatureFont.queryByName glyphid]
|
||
include : Ungizmo
|
||
include : Translate (-middle) (-XH)
|
||
include : Scale 0.4
|
||
include : Translate markMiddle belowMarkTop
|
||
include : Regizmo
|
||
set-mark-anchor 'below' markMiddle 0 markMiddle belowMarkBot
|
||
set-base-anchor 'belowBraceL' markMiddle belowMarkMid
|
||
set-base-anchor 'belowBraceR' markMiddle belowMarkMid
|
||
|
||
link-relations relSets
|
||
|
||
do
|
||
createReversed : list
|
||
list 0xA7FB 'F'
|
||
list 0xA7FC 'P'
|
||
list 0xA7FD 'turnM'
|
||
list 0x1DF01 'gScript'
|
||
list 0x1DF03 'k'
|
||
list 0x1DF07 'eng'
|
||
|
||
: where : [createReversed _records] : begin
|
||
local { records relSets targetNameMap } : extendRelatedGlyphs 'reversed' _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local forkedPara : para.createFork : function p : begin
|
||
set p.shape.slopeAngle (-p.shape.slopeAngle)
|
||
|
||
local miniatureFont : Fork pendingGlyphs forkedPara
|
||
foreach {unicode glyphid} [items-of records] : if [not : query-glyph targetNameMap.(glyphid)]
|
||
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
|
||
# Include the glyph built with negative slope
|
||
local g1 : miniatureFont.queryByName glyphid
|
||
include g1 AS_BASE ALSO_METRICS
|
||
|
||
# Inverse
|
||
set currentGlyph.gizmo g1.gizmo
|
||
include : Ungizmo
|
||
set currentGlyph.gizmo [Transform.Id]
|
||
include : ScaleAround (currentGlyph.advanceWidth / 2) 0 (-1) 1
|
||
include GlobalTransform
|
||
|
||
link-relations relSets
|
||
|
||
glyph-block Autobuild-Transformed-Texture : begin
|
||
if (!(para.buildTextureFeature && !para.isQuasiProportional)) : return nothing
|
||
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Fork
|
||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations wrapName
|
||
|
||
define [createTextureDerivatives gr extL extR _records] : begin
|
||
local { records relSets targetNameMap } : extendRelatedGlyphs gr.key _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
|
||
local forkedPara : Object.assign {.} para
|
||
if (extL + extR > 0)
|
||
: then : forkedPara.diversityM = 1 + extL + extR
|
||
: else : begin
|
||
forkedPara.diversityF = 1 + extL + extR
|
||
forkedPara.diversityI = 1 + extL + extR
|
||
forkedPara.diversityII = 1 + extL + extR
|
||
|
||
local forked : Fork pendingGlyphs forkedPara
|
||
foreach {unicode glyphid} [items-of records] : begin
|
||
if [not : query-glyph targetNameMap.(glyphid)] : begin
|
||
define glyphT : forked.queryByName glyphid
|
||
define glyphO : glyphStore.queryByName glyphid
|
||
if (glyphT && glyphO) : begin
|
||
if (glyphT.advanceWidth != glyphO.advanceWidth) : begin
|
||
gr.set glyphO targetNameMap.(glyphid)
|
||
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
|
||
include glyphT AS_BASE ALSO_METRICS
|
||
set-width Width
|
||
if extL : currentGlyph.applyTransform [Translate (-extL * Width) 0] true
|
||
|
||
link-relations relSets
|
||
|
||
define ranges : list
|
||
list 0x41 0x5A
|
||
list 0x61 0x7A
|
||
list 0xC0 0xFF
|
||
list 0x100 0x2AF
|
||
list 0x370 0x3FF
|
||
list 0x400 0x4FF
|
||
list 0x500 0x52F
|
||
|
||
define [jobs base] : list
|
||
local results {}
|
||
foreach {low high} [items-of ranges] : begin
|
||
foreach lch [range low till high] : begin
|
||
local source : glyphStore.queryNameByUnicode lch
|
||
if source : results.push { null source }
|
||
return results
|
||
|
||
define EXTENSION : 1 / 12
|
||
define SHRINK : -1 / 12
|
||
createTextureDerivatives Texture.ExtL EXTENSION 0 [jobs 0xF000]
|
||
createTextureDerivatives Texture.ExtR 0 EXTENSION [jobs 0xF100]
|
||
createTextureDerivatives Texture.ExtLR EXTENSION EXTENSION [jobs 0xF200]
|
||
createTextureDerivatives Texture.ShrL SHRINK 0 [jobs 0xF300]
|
||
createTextureDerivatives Texture.ShrR 0 SHRINK [jobs 0xF400]
|
||
createTextureDerivatives Texture.ShrLR SHRINK SHRINK [jobs 0xF500]
|
||
|
||
|
||
glyph-block Autobuild-Transformed-Mathematical : begin
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Fork
|
||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations wrapName
|
||
|
||
define [createMathDerivedSeriesImpl groupName tfm _records] : begin
|
||
local { records relSets targetNameMap } : extendRelatedGlyphs groupName _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local forkedPara : para.createFork tfm
|
||
local forked : Fork pendingGlyphs forkedPara
|
||
foreach {unicode glyphid} [items-of records] : if [not : query-glyph targetNameMap.(glyphid)]
|
||
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
|
||
define glyphT : forked.queryByName glyphid
|
||
if [not glyphT] : console.log glyphid
|
||
include glyphT AS_BASE ALSO_METRICS
|
||
set currentGlyph.gizmo glyphT.gizmo
|
||
|
||
link-relations relSets
|
||
|
||
define [boldGrade g] : begin
|
||
local pGrade : (900 - g) / 100
|
||
return : 900 - 100 * (2 / 25) * pGrade * pGrade
|
||
define [tfBold a] : begin [set a.shape.weight : boldGrade a.shape.weight]
|
||
define [tfItalic a] : begin
|
||
set a.shape.slope 'italic'
|
||
set a.shape.slopeAngle : mix (para.slopeAngle || 0) 15 (94 / 150)
|
||
define [tfSans a] : begin [set a.shape.serifs 'sans']
|
||
define [tfBoldItalic a] : begin [tfBold a] [tfItalic a]
|
||
define [tfSansBold a] : begin [tfSans a] [tfBold a]
|
||
define [tfSansItalic a] : begin [tfSans a] [tfItalic a]
|
||
define [tfSansBoldItalic a] : begin [tfSans a] [tfBold a] [tfItalic a]
|
||
define [tfTypeWriter a] : begin
|
||
set a.shape.spacing 'fixed'
|
||
if (a.derivingVariants && a.derivingVariants.mathtt)
|
||
set a.variants a.derivingVariants.mathtt
|
||
|
||
define Digits : Array.from '0123456789'
|
||
define UpperLatin : Array.from 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||
define LowerLatin : Array.from 'abcdefghijklmnopqrstuvwxyz'
|
||
define LowerLatin2 : Array.from 'abcdefghijklmnopqrstuvwxyzħıȷ'
|
||
define UpperGreek : Array.from 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡϴΣΤΥΦΧΨΩ∇'
|
||
define LowerGreek : Array.from 'αβγδεζηθικλμνξοπρςστυφχψω∂ϵϑϰϕϱϖ'
|
||
define Greek2 : Array.from 'Ϝϝ'
|
||
define ObliqueBlackboardBolds : Array.from '𝔻𝕕𝕖𝕚𝕛'
|
||
|
||
define [CreateMathDerivatives groupName tfm gr base letters overrides] : begin
|
||
local jobs {}
|
||
local overrideMap : new Map (overrides || {})
|
||
foreach j [range 0 letters.length] : begin
|
||
local letter letters.(j)
|
||
local source : glyphStore.queryNameByUnicode : letter.codePointAt 0
|
||
if (gr && [gr.get : query-glyph source]) : set source : gr.get : query-glyph source
|
||
local dst : base + j
|
||
if [overrideMap.has letter] : set dst [overrideMap.get letter]
|
||
if source : jobs.push { dst source }
|
||
createMathDerivedSeriesImpl groupName tfm jobs
|
||
|
||
define [CreateMathAliasableImpl groupName altGroupName tfm gr base letters overrides] : begin
|
||
local overrideMap : new Map (overrides || {})
|
||
foreach j [range 0 letters.length] : begin
|
||
local letter letters.(j)
|
||
local source : glyphStore.queryNameByUnicode : letter.codePointAt 0
|
||
if (source && altGroupName) : set source : wrapName altGroupName source
|
||
local uDst : base + j
|
||
if [overrideMap.has letter] : set uDst [overrideMap.get letter]
|
||
if source : alias [wrapName groupName source] uDst source
|
||
|
||
define [CreateMathAliasable cond groupName altGroupName tfm gr base letters overrides] : begin
|
||
if cond
|
||
CreateMathDerivatives groupName tfm gr base letters overrides
|
||
CreateMathAliasableImpl groupName altGroupName tfm gr base letters overrides
|
||
|
||
# Math bold
|
||
CreateMathDerivatives 'mathbf' tfBold null 0x1D400 UpperLatin
|
||
CreateMathDerivatives 'mathbf' tfBold null 0x1D41A LowerLatin
|
||
CreateMathDerivatives 'mathbf' tfBold null 0x1D6A8 UpperGreek
|
||
CreateMathDerivatives 'mathbf' tfBold null 0x1D6C2 LowerGreek
|
||
CreateMathDerivatives 'mathbf' tfBold null 0x1D7CE Digits
|
||
CreateMathDerivatives 'mathbf' tfBold null 0x1D7CA Greek2
|
||
|
||
# Math Italic
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x1D434 UpperLatin
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x1D44E LowerLatin2 : list
|
||
list 'h' 0x210E
|
||
list 'ħ' 0x210F
|
||
list 'ı' 0x1D6A4
|
||
list 'ȷ' 0x1D6A5
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x1D6E2 UpperGreek
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x1D6FC LowerGreek
|
||
|
||
|
||
# Math Bold Italic
|
||
CreateMathDerivatives 'mathbi' tfBoldItalic null 0x1D468 UpperLatin
|
||
CreateMathDerivatives 'mathbi' tfBoldItalic null 0x1D482 LowerLatin
|
||
CreateMathDerivatives 'mathbi' tfBoldItalic null 0x1D71C UpperGreek
|
||
CreateMathDerivatives 'mathbi' tfBoldItalic null 0x1D736 LowerGreek
|
||
|
||
# Math Sans-serif
|
||
CreateMathDerivatives 'mathss' tfSans MathSansSerif 0x1D5A0 UpperLatin
|
||
CreateMathDerivatives 'mathss' tfSans MathSansSerif 0x1D5BA LowerLatin
|
||
CreateMathDerivatives 'mathss' tfSans MathSansSerif 0x1D7E2 Digits
|
||
|
||
CreateMathDerivatives 'mathsi' tfSansItalic MathSansSerif 0x1D608 UpperLatin
|
||
CreateMathDerivatives 'mathsi' tfSansItalic MathSansSerif 0x1D622 LowerLatin
|
||
|
||
CreateMathDerivatives 'mathsb' tfSansBold MathSansSerif 0x1D5D4 UpperLatin
|
||
CreateMathDerivatives 'mathsb' tfSansBold MathSansSerif 0x1D5EE LowerLatin
|
||
CreateMathDerivatives 'mathsb' tfSansBold MathSansSerif 0x1D756 UpperGreek
|
||
CreateMathDerivatives 'mathsb' tfSansBold MathSansSerif 0x1D770 LowerGreek
|
||
CreateMathDerivatives 'mathsb' tfSansBold MathSansSerif 0x1D7EC Digits
|
||
|
||
CreateMathDerivatives 'mathsz' tfSansBoldItalic MathSansSerif 0x1D63C UpperLatin
|
||
CreateMathDerivatives 'mathsz' tfSansBoldItalic MathSansSerif 0x1D656 LowerLatin
|
||
CreateMathDerivatives 'mathsz' tfSansBoldItalic MathSansSerif 0x1D790 UpperGreek
|
||
CreateMathDerivatives 'mathsz' tfSansBoldItalic MathSansSerif 0x1D7AA LowerGreek
|
||
|
||
# Math Typewriter
|
||
local doTypewriter para.isQuasiProportional
|
||
CreateMathAliasable doTypewriter 'mathtt' null tfTypeWriter null 0x1D670 UpperLatin
|
||
CreateMathAliasable doTypewriter 'mathtt' null tfTypeWriter null 0x1D68A LowerLatin
|
||
CreateMathAliasable doTypewriter 'mathtt' null tfTypeWriter null 0x1D7F6 Digits
|
||
|
||
# Italic blackboard bold
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x2145 ObliqueBlackboardBolds
|
||
|
||
glyph-block Autobuild-Rhotic : begin
|
||
glyph-block-import Mark-Shared-Metrics : markFine markstroke
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Widen
|
||
glyph-block-import Letter-Latin-Rhotic : ErTail
|
||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations
|
||
glyph-block-import Letter-Shared-Shapes : RetroflexHook
|
||
|
||
define [ErTailAttachment y] : ErTail (Width * 0.85 - SB - [HSwToV : 1.25 * markFine]) y (XH * 0.2)
|
||
define [RhoticTailAttachment] : RetroflexHook.r
|
||
x -- [mix RightSB Width 0.5]
|
||
y -- 0
|
||
yAttach -- (XH / 2 - HalfStroke)
|
||
xLink -- (Width * 0.85 - SB - [HSwToV : 1.25 * markFine])
|
||
refSw -- [AdviceStroke 4]
|
||
|
||
define [createRhotics groupName tail _records] : begin
|
||
local {records relSets targetNameMap} : extendRelatedGlyphs "rhotic_\(groupName)" _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local thinFont : Widen pendingGlyphs 0.85 1
|
||
foreach {unicode glyphid pri} [items-of records]
|
||
if [not : query-glyph targetNameMap.(glyphid)]
|
||
create-glyph (targetNameMap.(glyphid)) unicode : glyph-proc
|
||
if [not : thinFont.queryByName glyphid] : begin
|
||
throw : new Error "Cannot find glyph \(glyphid)"
|
||
include : MarkSet.e
|
||
include : thinFont.queryByName glyphid
|
||
include tail
|
||
|
||
link-relations relSets
|
||
return { targetNameMap records }
|
||
|
||
createRhotics 'er' [ErTailAttachment (XH / 2)]
|
||
list { 0x25A 'schwa' }
|
||
createRhotics 'rhotic' [RhoticTailAttachment]
|
||
list { 0x1D95 'schwa' }
|
||
createRhotics 'revLatinEpsilonEr' [ErTailAttachment (XH * [mix 0.65 1 0.5])]
|
||
list { 0x25D 'latn/epsilonRev' }
|
||
|
||
glyph-block Autobuild-Rotated : begin
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Miniature
|
||
glyph-block-import Symbol-Math-APL : LinkAplFormForNwidWwid
|
||
|
||
for-width-kinds WideWidth1 : do
|
||
local s : (RightSB - SB - O * 4 + (MosaicWidth - Width) * 0.5) / CAP
|
||
local df : Miniature {'eight.lnum.crossing' 'rotatedPropto' 'revS.serifless'}
|
||
crowd -- (4 / [Math.sqrt MosaicWidthScalar])
|
||
scale -- s
|
||
forceUpright -- true
|
||
|
||
define [InftyLikeShape gn u gns] : begin
|
||
create-glyph [MangleName gn] [MangleUnicode u] : glyph-proc
|
||
set-width MosaicWidth
|
||
if [not : df.queryByName gns] : throw : new Error "Cannot find glyph \(gns)"
|
||
include : df.queryByName gns
|
||
include : Translate (-(Width / 2)) (-CAP / 2)
|
||
include : Rotate (Math.PI / 2)
|
||
include : Scale s
|
||
include : Translate (MosaicWidth / 2) SymbolMid
|
||
include : Italify
|
||
|
||
InftyLikeShape 'propto' 0x221D 'rotatedPropto'
|
||
InftyLikeShape 'infty' 0x221E 'eight.lnum.crossing'
|
||
InftyLikeShape 'invLazyS' 0x223E 'revS.serifless'
|
||
|
||
# Link APLF for BQN
|
||
LinkAplFormForNwidWwid 'infty'
|
||
LinkAplFormForNwidWwid 'invLazyS'
|