Add more math symbols

This commit is contained in:
Belleve Invis 2020-01-20 23:55:36 -08:00
parent 055b9233e0
commit df3bf928ac
10 changed files with 828 additions and 725 deletions

View file

@ -190,12 +190,15 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
line-to (RIGHTSB - STROKE) STROKE
line-to (RIGHTSB - STROKE) (CAP - STROKE)
line-to (SB + STROKE) (CAP - STROKE)
set currentGlyph.cmpPriority (9999)
save '.notdef'
sketch # .null
set-width 0
set currentGlyph.cmpPriority (9998)
save '.null'
sketch # nonmarkingreturn
set-width WIDTH
set currentGlyph.cmpPriority (-1)

View file

@ -44,7 +44,7 @@ export : define [apply] : begin
apply-transform : Translate (width / 2) (CAP / 2 * dscale)
apply-transform : Italify
set currentGlyph.cmpPriority 12
refair this
refair currentGlyph
set-width 0
return lg
@ -230,7 +230,7 @@ export : define [apply] : begin
apply-transform : Translate (width / 2) (symbolMid * pscale - (CAP / 2 - shift) * dscale)
apply-transform : Italify
set currentGlyph.cmpPriority 11
refair this
refair currentGlyph
set-width 0
sketch

View file

@ -32,7 +32,7 @@ export : define [apply] : begin
apply-transform [Translate middle (CAP + ACCENT / 2)] true
apply-transform [Italify] true
if pri : set currentGlyph.cmpPriority pri
refair this
refair currentGlyph
define [createSubscripts records] : begin
local pendingGlyphs : records.map : [record] => record.1
@ -52,7 +52,7 @@ export : define [apply] : begin
apply-transform [Translate middle (DESCENDER / 2)] true
apply-transform [Italify] true
if pri : set currentGlyph.cmpPriority pri
refair this
refair currentGlyph
define [createSMCPs records] : begin
local pendingGlyphs : records.map : [record] => record.1
@ -89,7 +89,7 @@ export : define [apply] : begin
apply-transform : Scale 0.4
apply-transform : Translate markMiddle aboveMarkBot
apply-transform : Italify
refair this
refair currentGlyph
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
if [not recursive] : createSuperscripts : list
@ -375,7 +375,7 @@ export : define [apply] : begin
apply-transform : Scale (CAP / [fallback height CAP] * scaleFactor)
apply-transform : Translate MIDDLE (symbolMid + dist / 2)
apply-transform : Italify
refair this
refair currentGlyph
if [not glyphs.(denid + suffix + ".denpart")] : begin
save-glyph (denid + suffix + ".denpart") null : sketch
@ -385,7 +385,7 @@ export : define [apply] : begin
apply-transform : Scale (CAP / [fallback height CAP] * scaleFactor)
apply-transform : Translate MIDDLE (symbolMid - CAP * scaleFactor - dist / 2)
apply-transform : Italify
refair this
refair currentGlyph
foreach {unicode numid denid height} [items-of records] : do
save-glyph [suggestName : numid + 'over' + denid] unicode : glyph-construction
@ -499,3 +499,42 @@ export : define [apply] : begin
if [not recursive] : createLigatures 0.7 0.8 0.75 0.9 : list
list 0x2103 'degree' 'C'
list 0x2109 'degree' 'F'
define [createAccentedEquals crowd scale records] : begin
local pendingGlyphs : records.map : [record] => record.2
local miniatureFont : Miniature
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
crowd -- crowd
scale -- scale
unfair -- true
mono -- true
foreach {unicode base upper} [items-of records] : do
local innerGlyphName : suggestName : "inner_" + base + "_" + [upper.join "_"]
local fullGlyphName : suggestName : "comb_" + base + "_" + [upper.join "_"]
create-glyph innerGlyphName : glyph-construction
local totalWidth 0
foreach [glyphid : items-of upper] : begin
local subGlyph miniatureFont.(glyphid)
include subGlyph
apply-transform : Translate (-subGlyph.advanceWidth) 0
set totalWidth : totalWidth + subGlyph.advanceWidth
apply-transform : Upright
apply-transform : Translate (totalWidth / 2) 0
apply-transform : Scale scale
apply-transform : Translate MIDDLE aboveMarkBot
apply-transform : Italify
refair currentGlyph
create-glyph fullGlyphName : glyph-construction
if unicode : assign-unicode unicode
include glyphs.(innerGlyphName)
include glyphs.(base)
if [not recursive] : createAccentedEquals 7 0.4 : list
list 0x2257 "equal" {"o"}
list 0x225e "equal" {"m"}
list 0x225F "equal" {"question"}
if [not recursive] : createAccentedEquals 8 0.3 : list
list 0x225d "equal" {"d" "e" "f"}

View file

@ -775,4 +775,27 @@ export : define [apply] : begin
include : difference background [union.apply null candidates]
include overlay
return [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned dual hcombine vdual vcombine fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor]
define [CreateWaveShape dist sw] : begin
define WaveResolution 8
define WaveMagnitude : dist * (3 / 4) - sw / 2
define WaveAdj : TANSLANT * WaveMagnitude * (-0.75)
define [WaveShapeImpl] : params [left right ts te xsJoin xfJoin] : glyph-construction
local resolution : Math.ceil (WaveResolution * (te - ts))
local knots {}
foreach [pr : range 0 till resolution] : begin
local theta : [mix ts te (pr / resolution)] * Math.PI * 2
local waveRelY : (-1) * [Math.sin theta] - 0.075 * [Math.sin (theta * 3)]
local flat : [Math.abs ([mix ts te (pr / resolution)] * 2 % 1)] < 1 / WaveResolution
knots.push : g2
(WaveAdj * waveRelY) + [mix left right (pr / resolution)]
symbolMid + WaveMagnitude * waveRelY
include : dispiro
widths.center sw
if (xsJoin !== nothing) {[straight.right.start xsJoin symbolMid]} {}
begin knots
if (xfJoin !== nothing) {[straight.right.end xfJoin symbolMid]} {}
define [WaveShape] : params [left right xsJoin xfJoin [unitWidth WIDTH]] : WaveShapeImpl (unitWidth * -left) (unitWidth * (1 + right)) (-left * 2) (2 + right * 2) xsJoin xfJoin
return WaveShape
return [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned dual hcombine vdual vcombine fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor CreateWaveShape]

View file

@ -8,13 +8,12 @@ import [designParameters] from '../meta/aesthetics'
export : define [apply] : begin
glyph-module-entry commonShapes overmarks
define WidthKinds {{'.hwid' WIDTH}}
if (para.spacing > 0) : WidthKinds.push {'.fwid' FULLWIDTH0}
define WidthKinds {{'.hwid' WIDTH WIDTH} {'.fwid' FULLWIDTH0 (FULLWIDTH0 / 2)}}
local exportArrowShape nothing
### Arrowheads
foreach {suffix MosaicWidth} [items-of WidthKinds] : do 'Arrows'
foreach {suffix MosaicWidth MosaicUnitWidth} [items-of WidthKinds] : do 'Arrows'
define [MangleUnicode unicode] : if (MosaicWidth == FULLWIDTH2) unicode nothing
define [MangleName name] : name + suffix
@ -257,6 +256,45 @@ export : define [apply] : begin
arrow [HalfArrowShape LHSHalfArrowHead] [MangleName 'arrowdownHL'] [MangleUnicode 0x21C2] arrowMidX arrowTop arrowMidX arrowBot
arrow [HalfArrowShape RHSHalfArrowHead] [MangleName 'arrowdownHR'] [MangleUnicode 0x21C3] arrowMidX arrowTop arrowMidX arrowBot
do "Wave arrows"
define WaveShape : CreateWaveShape
doubleArrowStemWidth / 2
Math.min OPERATORSTROKE (doubleArrowStemWidth / 3)
define rightTBias : (MosaicWidth / MosaicUnitWidth) - 1
define freeCoT : arrowSB / MosaicWidth
define connectedCoT : (arrowSB / MosaicWidth) + (11 / 32)
sketch
set-width MosaicWidth
include : WaveShape
left -- (-connectedCoT)
right -- (rightTBias - connectedCoT)
xsJoin -- (arrowSB - o)
xfJoin -- (arrowRSB + o)
unitWidth -- MosaicUnitWidth
include : ArrowHead arrowSB symbolMid arrowRSB symbolMid
include : ArrowHead arrowRSB symbolMid arrowSB symbolMid
save [MangleName 'waveArrowLeftRight'] [MangleUnicode 0x21AD]
sketch
set-width MosaicWidth
include : WaveShape
left -- (-connectedCoT)
right -- (rightTBias - freeCoT)
xsJoin -- (arrowSB - o)
unitWidth -- MosaicUnitWidth
include : ArrowHead arrowRSB symbolMid arrowSB symbolMid
save [MangleName 'waveArrowLeft'] [MangleUnicode 0x219C]
sketch
set-width MosaicWidth
include : WaveShape
left -- (-freeCoT)
right -- (rightTBias - connectedCoT)
xfJoin -- (arrowRSB + o)
unitWidth -- MosaicUnitWidth
include : ArrowHead arrowSB symbolMid arrowRSB symbolMid
save [MangleName 'waveArrowRight'] [MangleUnicode 0x219D]
arrow [ThickArrowShape 'white'] [MangleName 'uni21E6'] [MangleUnicode 0x21E6] arrowRSB symbolMid arrowSB symbolMid
arrow [ThickArrowShape 'white'] [MangleName 'uni21E7'] [MangleUnicode 0x21E7] arrowMidX arrowBot arrowMidX arrowTop
arrow [ThickArrowShape 'white'] [MangleName 'uni21E8'] [MangleUnicode 0x21E8] arrowSB symbolMid arrowRSB symbolMid
@ -353,6 +391,9 @@ export : define [apply] : begin
if (MosaicWidth == FULLWIDTH2) : set exportArrowShape ArrowShape
alias 'longArrowLeft' 0x27F5 'arrowleft.fwid'
alias 'longArrowRight' 0x27F6 'arrowright.fwid'
### Standard geometric shapes
foreach {suffix MosaicWidth} [items-of WidthKinds] : do 'Geometric'
define [MangleUnicode unicode] : if (MosaicWidth == FULLWIDTH2) unicode nothing

View file

@ -68,7 +68,7 @@ export : define [apply] : begin
apply-transform : Scale s
apply-transform : Translate (fullWidth / 2) symbolMid
apply-transform : Italify
refair this
refair currentGlyph
save 'infty' 0x221E
sketch # propto
@ -79,7 +79,7 @@ export : define [apply] : begin
apply-transform : Scale s
apply-transform : Translate (fullWidth / 2) symbolMid
apply-transform : Italify
refair this
refair currentGlyph
save 'propto' 0x221D
sketch # partial
@ -191,6 +191,9 @@ export : define [apply] : begin
include markset.plus
include : HBar SB RIGHTSB symbolMid OPERATORSTROKE
save 'minus' 0x2212
include : DotAt MIDDLE plusTop DOTRADIUS
save 'minusDot' 0x2238
sketch # innerMinus
include markset.plus
include : HBar SB RIGHTSB symbolMid GEOMETRYSTROKE
@ -287,7 +290,7 @@ export : define [apply] : begin
local sbSquash 0.5
local delta : Math.max 0 : WIDTH / 2 - DOTRADIUS + SB * sbSquash
local delta : Math.max 0 : WIDTH / 2 - DOTRADIUS - SB * sbSquash
apply-transform : Upright
apply-transform : Translate (-delta) (symbolMid - XH / 2)
apply-transform : Italify
@ -475,7 +478,11 @@ export : define [apply] : begin
sketch # cup
include : UShape operTop operBot OPERATORSTROKE true
save 'cup' 0x222A
branch
include : DotAt MIDDLE (operBot + SMOOTH) [Math.min DOTRADIUS ((RIGHTSB - SB - OPERATORSTROKE * HVCONTRAST * 2) * (1 / 3))]
save 'cupDot' 0x228E
turned 'cap' 0x2229 'cup' MIDDLE symbolMid
turned 'capDot' 0x2A40 'cupDot' MIDDLE symbolMid
sketch # squareCap
include : PiShape operTop operBot (shrinkrate -- 0) (_fine -- OPERATORSTROKE) (div -- 1)
@ -547,6 +554,9 @@ export : define [apply] : begin
include : HBarBottom SB RIGHTSB 0 OPERATORSTROKE
include : VBar MIDDLE (symbolMid * 2) 0 OPERATORSTROKE
save 'perpendicular' 0x27C2
sketch # endOfProof
include : Rect tackTop tackBot SB RIGHTSB
save 'endOfProof' 0x220E
do "Comparison"
# Less and Greater

View file

@ -294,6 +294,7 @@ export : define [apply] : begin
set-width MosaicWidth
include : Shade 8 FillMedium : PatternPolygon22 bits
save [BEGlyphName unicode] [MangleUnicode unicode]
define [InverseMediumShade unicode bits coBits] : sketch
set-width MosaicWidth
include : Shade (-8) (1 - FillMedium) : PatternPolygon22 bits
@ -301,6 +302,7 @@ export : define [apply] : begin
FillBlock 0 1 0 1
PatternPolygon22 bits
save [BEGlyphName unicode] [MangleUnicode unicode]
MediumShade 0x2592 {1 3 9 7}
MediumShade 0x1FB8C {1 2 8 7}
MediumShade 0x1FB8D {2 3 9 8}
@ -325,6 +327,7 @@ export : define [apply] : begin
set-width MosaicWidth
include : Shade (-4) FillHeavy
save [MangleName 'upperLeftToLowerRightFill'] [MangleUnicode 0x1FB98]
sketch # upperRightToLowerLeftFill
set-width MosaicWidth
include : Shade 4 FillHeavy

File diff suppressed because it is too large Load diff

View file

@ -65,10 +65,13 @@ export : define [apply] : begin
sketch # zNotationParenLeft
local dim : ParenDim 0
include : ParenShape OPERATORSTROKE
include : intersection
VBarRight dim.inside dim.bottom dim.top OPERATORSTROKE
ParenShapeMask O
Rect [mix dim.bottom dim.top 2] [mix dim.top dim.bottom 2] 0 dim.inside
union
ParenShape OPERATORSTROKE
intersection
VBarRight dim.inside dim.bottom dim.top OPERATORSTROKE
ParenShapeMask O
save 'zNotationParenLeft' 0x2987
sketch # zNotationParenRight

View file

@ -135,7 +135,7 @@ define-macro save : syntax-rules
define-macro glyph-module-entry : syntax-rules
`[glyph-module-entry @::_opts] : begin
define optionalImports : object
commonShapes `[define [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned hcombine vcombine dual vdual fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor] $capture.commonShapes]
commonShapes `[define [object queryFeatureSelector select-variant italic-variant alias composite into-unicode turned hcombine vcombine dual vdual fwl fwr dwl dwr dwc Rect Ring RingAt DotAt CircleRing CircleRingAt CircleDotAt OShape OShapeOutline OBarLeftShape OBarRightShape LeftwardTopSerif LeftwardBottomSerif RightwardTopSerif RightwardBottomSerif CenterTopSerif CenterBottomSerif DownwardRightSerif UpwardRightSerif DownwardLeftSerif UpwardLeftSerif AIVSerifs AIHSerifs AINSerifs AICyrISerifs AIMSerifs halfXStrand xStrand nShoulderKnots nShoulder mShoulderSpiro HBar HBarTop HBarBottom HOverlayBar VBar VBarLeft VBarRight VerticalHook LegShape LeftHook HooktopLeftBar CurlyTail HCurlyTail FlatSlashShape determineMixR hookstart hookend CyrDescender refair Fork Miniature Thinner Widen FlipAround ScaleAround Realign ForceUpright Overlay diagCor CreateWaveShape] $capture.commonShapes]
overmarks `[define [object markExtend markHalfStroke markStress markFine markMiddle markDotsRadius aboveMarkTop aboveMarkBot aboveMarkMid belowMarkBot belowMarkTop commaOvershoot commaOvershoot2 commaAboveRadius TildeShape HornShape HornMarkAnchor HornBaseAnchor] $capture.overmarks]