647 lines
22 KiB
Text
647 lines
22 KiB
Text
###### Automatic builds
|
||
$$include '../../meta/macros.ptl'
|
||
|
||
import [linreg clamp mix fallback] from '../../support/utils'
|
||
import [AnyCv DotlessOrNot getGrTree getGrMesh CvDecompose MathSansSerif] from "../../support/gr"
|
||
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
|
||
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 Autobuild-Transformed : begin
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Fork Miniature
|
||
glyph-block-import Marks : markMiddle aboveMarkBot aboveMarkTop belowMarkBot belowMarkTop
|
||
glyph-block-import Autobuild-Transformed-Shared : extendRelatedGlyphs link-relations
|
||
|
||
define [createSuperscripts _records] : begin
|
||
local {records relSets targetNameMap} : extendRelatedGlyphs 'sup' _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local miniatureFont : Miniature pendingGlyphs
|
||
crowd -- 3.5
|
||
scale -- 0.7
|
||
mono -- true
|
||
sbscale -- 1
|
||
foreach {unicode glyphid pri} [items-of records]
|
||
if [not : query-glyph targetNameMap.(glyphid)]
|
||
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 [Upright] true
|
||
include [Translate (-middle) (-CAP)] true
|
||
include [Scale 0.7] true
|
||
include [Translate middle (CAP + Accent / 2)] true
|
||
include [Italify] true
|
||
if pri : set currentGlyph.autoRefPriority pri
|
||
link-relations relSets
|
||
return { targetNameMap records }
|
||
|
||
define [createSubscripts _records] : begin
|
||
local {records relSets targetNameMap} : extendRelatedGlyphs 'sub' _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local miniatureFont : Miniature pendingGlyphs
|
||
crowd -- 3.5
|
||
scale -- 0.7
|
||
mono -- true
|
||
sbscale -- 1
|
||
foreach {unicode glyphid pri} [items-of records]
|
||
if [not : query-glyph targetNameMap.(glyphid)]
|
||
create-glyph (targetNameMap.(glyphid)) unicode : glyph-proc
|
||
local middle : [miniatureFont.queryByName glyphid].advanceWidth / 2
|
||
include [miniatureFont.queryByName glyphid] AS_BASE ALSO_METRICS
|
||
include [Upright] true
|
||
include [Translate (-middle) 0] true
|
||
include [Scale 0.7] true
|
||
include [Translate middle (Descender / 2)] true
|
||
include [Italify] true
|
||
if pri : set currentGlyph.autoRefPriority pri
|
||
link-relations relSets
|
||
|
||
# Not used today -- may be used in the future
|
||
define [createSMCPs _records] : begin
|
||
local {records relSets targetNameMap} : extendRelatedGlyphs 'smcp' _records
|
||
local pendingGlyphs : records.map : [record] => record.1
|
||
local forkedParams : Object.create para
|
||
set forkedParams.cap0 para.cap
|
||
set forkedParams.cap XH
|
||
set forkedParams.xheight (XH * XH / CAP)
|
||
set forkedParams.diversityM 1
|
||
set forkedParams.diversityF 1
|
||
set forkedParams.diversityI 1
|
||
set forkedParams.diversityII 1
|
||
local sf : Fork pendingGlyphs forkedParams
|
||
foreach {unicode glyphid} [items-of records] : begin
|
||
if [not : query-glyph targetNameMap.(glyphid)] : begin
|
||
create-glyph targetNameMap.(glyphid) unicode : glyph-proc
|
||
include [sf.queryByName glyphid] AS_BASE ALSO_METRICS
|
||
link-relations relSets
|
||
|
||
define [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 : Upright
|
||
include : Translate (-middle) (-low)
|
||
include : Scale 0.4
|
||
include : Translate markMiddle aboveMarkBot
|
||
include : Italify
|
||
local markHeight : 0.4 * (high - low) + 0 * (aboveMarkTop - aboveMarkBot)
|
||
set-mark-anchor 'above' markMiddle XH markMiddle (aboveMarkBot + markHeight)
|
||
set-base-anchor 'aboveBrace' markMiddle (aboveMarkBot + markHeight + XH * 0.2)
|
||
|
||
link-relations relSets
|
||
|
||
define [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 : Upright
|
||
include : Translate (-middle) (-XH)
|
||
include : Scale 0.4
|
||
include : Translate markMiddle belowMarkTop
|
||
include : Italify
|
||
set-mark-anchor 'below' markMiddle 0 markMiddle belowMarkBot
|
||
set-base-anchor 'belowBrace' markMiddle (belowMarkTop - XH * 0.2)
|
||
|
||
link-relations relSets
|
||
|
||
createSuperscripts : list
|
||
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 'turnrrtail'
|
||
list 0x02B6 'invSmcpR'
|
||
list 0x02B7 'w'
|
||
list 0x02B8 'y'
|
||
list 0x02C0 'fineglottalstop'
|
||
list 0x02C1 'finerevglottalstop'
|
||
list 0x02E0 'latingamma'
|
||
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 'turne'
|
||
list 0x1D4B 'grek/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 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/revSmallEpsilon'
|
||
list 0x1DA0 'f'
|
||
list 0x1DA1 'turnf'
|
||
list 0x1DA2 'scriptg'
|
||
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 0x1DAC 'mLTail'
|
||
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 'latinupsilon1'
|
||
list 0x1DB8 'smcpU'
|
||
list 0x1DB9 'latinupsilon2'
|
||
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 'cyrl/I'
|
||
list 0x1D3C 'O'
|
||
list 0x1D3D 'OU'
|
||
list 0x1D3E 'P'
|
||
list 0x1D3F 'R'
|
||
list null 'C' # there is no superscript C in unicode, but is is used for the MC symbol
|
||
list null 'S' # there is no superscript S in unicode, but is is used for the SM symbol
|
||
list 0x1D40 'T'
|
||
list 0x1D41 'U'
|
||
list 0x1D42 'W'
|
||
list 0x2C7D 'V'
|
||
list 0x207A 'plus' (-11)
|
||
list 0x207B 'minus' (-11)
|
||
list 0x207C 'equal' (-11)
|
||
list 0x207D 'parenLeft' (-11)
|
||
list 0x207E 'parenRight' (-11)
|
||
list 0xA7F8 'smcpHbar'
|
||
list 0xA7F9 'oe'
|
||
|
||
do "superscript AE"
|
||
define { tnmAHalf jobsAHalf } : createSuperscripts { { null 'AE/AHalf' } }
|
||
define { tnmEHalf jobsEHalf } : createSuperscripts { { 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') }
|
||
|
||
let [df : Miniature {'a' 'o'} 4 0.7] : begin
|
||
create-glyph 'ordfeminine' 0xAA : glyph-proc
|
||
include : df.queryByName 'a'
|
||
include : HBarBottom SB RightSB Descender
|
||
include : Upright
|
||
include : Translate (-Middle) (-XH)
|
||
include : Scale 0.7
|
||
include : Translate Middle CAP
|
||
include : Italify
|
||
|
||
create-glyph 'ordmasculine' 0xBA : glyph-proc
|
||
include : df.queryByName 'o'
|
||
include : HBarBottom SB RightSB Descender
|
||
include : Upright
|
||
include : Translate (-Middle) (-XH)
|
||
include : Scale 0.7
|
||
include : Translate Middle CAP
|
||
include : Italify
|
||
|
||
createSubscripts : 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 'turne'
|
||
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' (-11)
|
||
list 0x208B 'minus' (-11)
|
||
list 0x208C 'equal' (-11)
|
||
list 0x208D 'parenLeft' (-11)
|
||
list 0x208E 'parenRight' (-11)
|
||
|
||
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 0x1DD8 'cyrl/de.italic'
|
||
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 'turne'
|
||
list 0x1DED 'oWithLightCentralizationStroke'
|
||
list 0x1DF0 'uWithLightCentralizationStroke'
|
||
list 0x1DF1 'w'
|
||
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 0x2DF6 'cyrl/a'
|
||
list 0x2DF7 'cyrl/ie'
|
||
list 0x2DFB 'cyrl/yu'
|
||
list 0x2DFD 'cyrl/smallYus'
|
||
list 0x2DFE 'cyrl/bigYus'
|
||
list 0x2DFF 'cyrl/bigYusIotified'
|
||
|
||
createMedievalCombs 0 CAP : list
|
||
list 0x365 'i'
|
||
list 0x36D 't'
|
||
list 0x1DD9 'eth'
|
||
list 0x1DDC 'k'
|
||
list 0x1DDD 'l'
|
||
list 0x1DE8 'b'
|
||
list 0x1DF2 'aDieresis'
|
||
list 0x1DF3 'oDieresis'
|
||
list 0x1DF4 'uDieresis'
|
||
list 0x2DE0 'cyrl/be'
|
||
list 0x2DFA 'cyrl/yat'
|
||
|
||
createMedievalCombs Descender XH : list
|
||
list 0x1DDA 'g'
|
||
list 0x1DD7 'cCedilla'
|
||
list 0x1DE9 'grek/beta'
|
||
list 0x1DEE 'p'
|
||
list 0x2DEC 'cyrl/er'
|
||
|
||
createMedievalCombs Descender CAP : list
|
||
list 0x1DEB 'f'
|
||
list 0x1DE5 'longs'
|
||
list 0x1DEF 'esh'
|
||
|
||
createMedievalBelowCombs : list
|
||
list 0x0359 'asterisk.midXH'
|
||
list 0x1ABF 'w'
|
||
list 0x1AC0 'turnw'
|
||
list 0x1DCA 'r'
|
||
|
||
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.reinit 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
|
||
if [not : forked.queryByName glyphid] : console.log glyphid
|
||
include [forked.queryByName glyphid] AS_BASE ALSO_METRICS
|
||
|
||
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']
|
||
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 'αβγδεζηθικλμνξοπρςστυφχψω∂ϵϑϰϕϱϖ' # Some are missing though
|
||
define ObliqueBlackboardBolds : Array.from '𝔻𝕕𝕖𝕚𝕛'
|
||
|
||
define [CreateMathDerivatives groupName tfm gr base letters overrides] : begin
|
||
if recursive : return nothing
|
||
local jobs {}
|
||
local overrideMap : new Map (overrides || {})
|
||
foreach j [range 0 letters.length] : begin
|
||
local letter letters.(j)
|
||
local source : glyphStore.queryNameOfUnicode : 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
|
||
if recursive : return nothing
|
||
local overrideMap : new Map (overrides || {})
|
||
foreach j [range 0 letters.length] : begin
|
||
local letter letters.(j)
|
||
local source : glyphStore.queryNameOfUnicode : 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
|
||
|
||
# Math Italic
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x1D434 UpperLatin
|
||
CreateMathDerivatives 'mathit' tfItalic null 0x1D44E LowerLatin2 : list
|
||
list 'h' 0x210E
|
||
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 Marks : markFine
|
||
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
|
||
|
||
define [createRhotics groupName y _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 : ErTail (Width * 0.85 - SB - markFine * HVContrast * 1.25) y
|
||
|
||
link-relations relSets
|
||
return { targetNameMap records }
|
||
|
||
createRhotics 'er' (XH / 2) : list { 0x25A 'schwa' }
|
||
createRhotics 'revLatinEpsilonEr' (XH * [mix 0.65 1 0.5]) : list { 0x25D 'latn/revSmallEpsilon' }
|
||
|
||
glyph-block Autobuild-Rotated : begin
|
||
glyph-block-import CommonShapes
|
||
glyph-block-import Common-Derivatives
|
||
glyph-block-import Recursive-Build : Miniature
|
||
|
||
for-width-kinds WideWidth1 : do
|
||
local s : (RightSB - SB - O * 4 + (MosaicWidth - Width) * 0.5) / CAP
|
||
local df : Miniature {'eight.lnum.crossing' 'rotetedPropto' 'revS'}
|
||
crowd -- 4
|
||
scale -- s
|
||
slopeAngle -- 0
|
||
|
||
define [InftyLikeShape gn u gns] : begin
|
||
create-glyph [MangleName gn] [MangleUnicode u] : glyph-proc
|
||
set-width MosaicWidth
|
||
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 'rotetedPropto'
|
||
InftyLikeShape 'infty' 0x221E 'eight.lnum.crossing'
|
||
InftyLikeShape 'invLazyS' 0x223E 'revS.serifless'
|