We now have partial generation and automatic super/subscript generation.

This commit is contained in:
Belleve Invis 2015-07-26 08:49:13 +08:00
parent daae14cdf0
commit 45b0b0bb92
11 changed files with 4560 additions and 3641 deletions

View File

@ -10,5 +10,6 @@ foreach glyph [items-of glyphList] : begin {
}
set font.glyf : font.glyf.filter : function [glyph] : glyph && [not glyph.dontExport]
set font.glyfMap glyphs
return font
}

View File

@ -12,7 +12,7 @@ define [exports.build para] : begin {
define variantSelector para.variantSelector
define font [require './empty.json']
define font : JSON.parse : JSON.stringify [require './empty.json']
define glyphList font.glyf
define glyphs (.'.notdef' glyphList.0)
@ -108,6 +108,10 @@ define MARK 'mark'
define MARKBASE 'markbase'
define AS_BASE 'AS-BASE'
define [Upright angle] (.xx 1 .yx [-[Math.tan [[fallback angle para.italicangle] / 180 * Math.PI]]] .xy 0 .yy 1 .x 0 .y 0)
define [Italify angle] (.xx 1 .yx [Math.tan [[fallback angle para.italicangle] / 180 * Math.PI]] .xy 0 .yy 1 .x 0 .y 0)
define [Scale s] (.xx s .yx 0 .xy 0 .yy s .x 0 .y 0)
define [Translate x y] (.xx 1 .yx 0 .xy 0 .yy 1 .x x .y y)
define [tm anchor] : return (
.x [anchor.x * globalTransform.xx + anchor.y * globalTransform.yx + globalTransform.x]
@ -179,6 +183,7 @@ define-macro glyph-construction : syntax-rules {
local include : this.include.bind this
local create-stroke : this.create-stroke.bind this
local set-anchor : this.set-anchor.bind this
local apply-transform : this.apply-transform.bind this
local [dont-export] : set currentGlyph.dontExport true
this.gizmo = globalTransform
this.set-width WIDTH
@ -186,24 +191,39 @@ define-macro glyph-construction : syntax-rules {
return nothing
}]] env)
}
define [create-glyph name actions] : begin {
console.log : "Building /" + name
define glyphObject [new Glyph name]
glyphList.push glyphObject
glyphs`name = glyphObject
actions.call glyphObject
return glyphObject
local nTemp 0
define [create-glyph name groupid actions] : piecewise {
[name && groupid && actions] : begin {
if [para.buildFor && para.buildFor !== groupid && groupid !== '*'] : return nothing
define glyphObject [new Glyph name]
glyphList.push glyphObject
glyphs`name = glyphObject
actions.call glyphObject
return glyphObject
}
[name && groupid] : create-glyph name name arguments.1
true : begin {
local actions arguments.0
local glyphObject [new Glyph ['.temp-' + [set nTemp [inc nTemp]]]]
actions.call glyphObject
return glyphObject
}
}
define [select-variant glyphid unicode default] : begin {
local variant : variantSelector`glyphid || default
local chosenGlyph glyphs`[glyphid + '.' + variant]
set glyphs`glyphid chosenGlyph
if unicode : begin {
chosenGlyph.assign-unicode unicode
set chosenGlyph.dontExport false
set unicodeGlyphs.(chosenGlyph.unicode`[chosenGlyph.unicode.length - 1]) chosenGlyph
define [select-variant glyphid groupid unicode default] : piecewise {
[glyphid && groupid && unicode && default] : begin {
if [para.buildFor && para.buildFor !== groupid && groupid !== '*'] : return nothing
local variant : variantSelector`glyphid || default
local chosenGlyph glyphs`[glyphid + '.' + variant]
set glyphs`glyphid chosenGlyph
if unicode : begin {
chosenGlyph.assign-unicode unicode
set chosenGlyph.dontExport false
set unicodeGlyphs.(chosenGlyph.unicode`[chosenGlyph.unicode.length - 1]) chosenGlyph
}
}
[glyphid && groupid && unicode] : select-variant glyphid glyphid arguments.1 arguments.2
}
###### HERE WE GO!

File diff suppressed because it is too large Load Diff

View File

@ -202,14 +202,15 @@ define [XSHookLower bottom left middle right smooth hook] : glyph-construction {
:.curve-to [mix middle left KAPPA_HOOK] [bottom + O] [left + OXHOOK] [bottom + hook]
}
define [smallo u d l r] : glyph-construction {
define [smallo u d l r _width] : glyph-construction {
local middle : [l + r] / 2
local width : fallback _width STROKE
if [u - d > SMALLSMOOTHA + SMALLSMOOTHB] {
then : begin {
include : create-stroke
:.set-transform globalTransform
:.start-from middle [u - O]
:.set-width STROKE 0
:.set-width width 0
:.heads-to LEFTWARD
:.arc-hv-to [l + O] [u - SMALLSMOOTHA]
:.line-to [l + O] [d + SMALLSMOOTHB]
@ -226,7 +227,7 @@ define [smallo u d l r] : glyph-construction {
include : create-stroke
:.set-transform globalTransform
:.start-from middle [u - O]
:.set-width STROKE 0
:.set-width width 0
:.heads-to LEFTWARD
:.arc-hv-to [l + O] ymiddlea
:.arc-vh-to middle [d + O]

View File

@ -252,7 +252,7 @@ create-glyph 'D' : glyph-construction {
:.line-to SB CAP
:.heads-to LEFTWARD
}
create-glyph 'P' : glyph-construction {
create-glyph 'P' '*' : glyph-construction {
set-width WIDTH
assign-unicode 'P'
include capitalMarks
@ -391,11 +391,7 @@ create-glyph 'U' : glyph-construction {
### F E H L I T Z
create-glyph 'F' : glyph-construction {
set-width WIDTH
assign-unicode 'F'
include capitalMarks
define [FShape] : glyph-construction {
include : create-stroke :.start-from [SB * 1.5] 0 :.heads-to UPWARD :.set-width 0 STROKE
:.line-to [SB * 1.5] CAP :.heads-to UPWARD
include : create-stroke :.start-from [SB * 1.5] CAP :.set-width 0 STROKE :.heads-to RIGHTWARD
@ -403,10 +399,17 @@ create-glyph 'F' : glyph-construction {
include : create-stroke :.start-from [SB * 1.5] [CAP * 0.54] :.set-width HALFSTROKE HALFSTROKE :.heads-to RIGHTWARD
:.line-to [RIGHTSB - HALFSTROKE] [CAP * 0.54] :.heads-to RIGHTWARD
}
create-glyph 'F' : glyph-construction {
set-width WIDTH
assign-unicode 'F'
include capitalMarks
include : FShape
}
create-glyph 'E' : glyph-construction {
set-width WIDTH
assign-unicode 'E'
include glyphs.F AS_BASE
include capitalMarks
include : FShape
include : create-stroke :.start-from [SB * 1.5] 0 :.set-width STROKE 0 :.heads-to RIGHTWARD
:.line-to RIGHTSB 0 :.heads-to RIGHTWARD
@ -443,7 +446,7 @@ create-glyph 'L' : glyph-construction {
:.heads-to RIGHTWARD
}
create-glyph 'I.straight' : glyph-construction {
create-glyph 'I.straight' 'I' : glyph-construction {
dont-export
include capitalMarks
include : create-stroke
@ -453,7 +456,7 @@ create-glyph 'I.straight' : glyph-construction {
:.line-to MIDDLE CAP
:.heads-to UPWARD
}
create-glyph 'I.serifed' : glyph-construction {
create-glyph 'I.serifed' 'I' : glyph-construction {
dont-export
include glyphs.'I.straight' AS_BASE
# Top serif
@ -502,7 +505,7 @@ create-glyph 'Z' : glyph-construction {
### J
create-glyph 'J.straight' : glyph-construction {
create-glyph 'J.straight' 'J' : glyph-construction {
set-width WIDTH
dont-export
include capitalMarks
@ -521,7 +524,7 @@ create-glyph 'J.straight' : glyph-construction {
:.arc-vh-to [mix hookx [RIGHTSB - JBALANCE] 0.5] O :.heads-to LEFTWARD
:.curve-to [MIDDLE - kappa * [MIDDLE - SB] - SB * 0.5] O hookx HOOK
}
create-glyph 'J.serifed' : glyph-construction {
create-glyph 'J.serifed' 'J' : glyph-construction {
set-width WIDTH
dont-export
include glyphs.'J.straight' AS_BASE

View File

@ -19,9 +19,7 @@ create-glyph 'o' : glyph-construction {
:.arc-vh-to MIDDLE XO
:.heads-to LEFTWARD
}
create-glyph 'o.left' : glyph-construction {
dont-export
set-width WIDTH
define [oLeft] : glyph-construction {
# right half
include : create-stroke
:.start-from MIDDLE XO
@ -44,9 +42,7 @@ create-glyph 'o.left' : glyph-construction {
:.set-width STROKE 0
:.heads-to RIGHTWARD
}
create-glyph 'o.right' : glyph-construction {
dont-export
set-width WIDTH
define [oRight] : glyph-construction {
# left half
include : create-stroke
:.start-from MIDDLE XO
@ -74,7 +70,7 @@ create-glyph 'p' : glyph-construction {
assign-unicode 'p'
include eMarks
include glyphs.'o.left'
include : oLeft
include : create-stroke
:.start-from SB XH
:.heads-to DOWNWARD
@ -87,7 +83,7 @@ create-glyph 'b' : glyph-construction {
assign-unicode 'b'
include bMarks
put-shapes glyphs.'o.left'.contours
include : oLeft
include : create-stroke
:.start-from SB 0
:.heads-to UPWARD
@ -100,7 +96,7 @@ create-glyph 'q' : glyph-construction {
assign-unicode 'q'
include eMarks
put-shapes glyphs.'o.right'.contours
include : oRight
include : create-stroke
:.start-from RIGHTSB XH
:.heads-to DOWNWARD
@ -113,7 +109,7 @@ create-glyph 'd' : glyph-construction {
assign-unicode 'd'
include bMarks
put-shapes glyphs.'o.right'.contours
include : oRight
include : create-stroke
:.start-from RIGHTSB 0
:.heads-to UPWARD
@ -172,7 +168,7 @@ create-glyph 'c' : glyph-construction {
:.heads-to RIGHTWARD
:.curve-to [MIDDLE + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [MIDDLE - SB]] O [RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx] [HOOK - TAILADJY * globalTransform.yx]
}
create-glyph 'e.upright' : glyph-construction {
create-glyph 'e.upright' 'e' : glyph-construction {
set-width WIDTH
dont-export
@ -199,7 +195,7 @@ create-glyph 'e.upright' : glyph-construction {
:.line-to [RIGHTSB - HALFSTROKE] barbottom
:.heads-to RIGHTWARD
}
create-glyph 'e.italic' : glyph-construction {
create-glyph 'e.italic' 'e' : glyph-construction {
set-width WIDTH
dont-export
@ -255,7 +251,7 @@ create-glyph 't' : glyph-construction {
}
### a u
create-glyph 'a.upright' : glyph-construction {
create-glyph 'a.upright' 'a' : glyph-construction {
set-width WIDTH
dont-export
local bartop [XH * BARPOS + STROKE]
@ -285,10 +281,10 @@ create-glyph 'a.upright' : glyph-construction {
:.heads-to UPWARD
:.set-width 0 [STROKE * 0.4]
}
create-glyph 'a.italic' : glyph-construction {
create-glyph 'a.italic' 'a' : glyph-construction {
set-width WIDTH
dont-export
include glyphs.'o.right'
include : oRight
include : create-stroke
:.start-from RIGHTSB 0
:.heads-to UPWARD
@ -398,7 +394,7 @@ create-glyph 'm' : glyph-construction {
}
### i j l
create-glyph 'dotlessi.straight' : glyph-construction {
create-glyph 'dotlessi.straight' 'i' : glyph-construction {
dont-export
include eMarks
include : create-stroke
@ -408,17 +404,17 @@ create-glyph 'dotlessi.straight' : glyph-construction {
:.line-to MIDDLE XH
:.heads-to UPWARD
}
create-glyph 'dotlessi.hooky' : glyph-construction {
create-glyph 'dotlessi.hooky' 'i' : glyph-construction {
dont-export
include glyphs.'dotlessi.straight' AS_BASE
put-shapes : leftwardTopSerif MIDDLE XH LONGJUT
}
create-glyph 'dotlessi.zshaped' : glyph-construction {
create-glyph 'dotlessi.zshaped' 'i' : glyph-construction {
dont-export
include glyphs.'dotlessi.hooky' AS_BASE
put-shapes : rightwardBottomSerif MIDDLE 0 LONGJUT
}
create-glyph 'dotlessi.serifed' : glyph-construction {
create-glyph 'dotlessi.serifed' 'i' : glyph-construction {
dont-export
include eMarks
@ -433,7 +429,7 @@ create-glyph 'dotlessi.serifed' : glyph-construction {
include : rightwardBottomSerif MIDDLE 0 LONGJUT
include : leftwardBottomSerif MIDDLE 0 LONGJUT
}
select-variant 'dotlessi' 0x131 'serifed'
select-variant 'dotlessi' 'i' 0x131 'serifed'
create-glyph 'i' : glyph-construction {
set-width WIDTH
@ -442,7 +438,7 @@ create-glyph 'i' : glyph-construction {
include glyphs.dotAbove
}
create-glyph 'dotlessj.straight' : glyph-construction {
create-glyph 'dotlessj.straight' 'j' : glyph-construction {
dont-export
set-anchor 'above' BASE [MIDDLE + JBALANCE] XH
include : create-stroke
@ -452,13 +448,13 @@ create-glyph 'dotlessj.straight' : glyph-construction {
:.line-to [MIDDLE + JBALANCE] 0
:.arc-vh-to [MIDDLE + DESCENDER * 0.85] [DESCENDER + HALFSTROKE]
}
create-glyph 'dotlessj.serifed' : glyph-construction {
create-glyph 'dotlessj.serifed' 'j' : glyph-construction {
dont-export
include glyphs.'dotlessj.straight' AS_BASE
put-shapes : leftwardTopSerif [MIDDLE + JBALANCE] XH LONGJUT
}
select-variant 'dotlessj' 0x237 'serifed'
select-variant 'dotlessj' 'j' 0x237 'serifed'
create-glyph 'j' : glyph-construction {
set-width WIDTH
assign-unicode 'j'
@ -467,7 +463,7 @@ create-glyph 'j' : glyph-construction {
include glyphs.dotAbove
}
create-glyph 'l.straight' : glyph-construction {
create-glyph 'l.straight' 'l' : glyph-construction {
include bMarks
dont-export
include : create-stroke
@ -477,19 +473,19 @@ create-glyph 'l.straight' : glyph-construction {
:.line-to MIDDLE CAP
:.heads-to UPWARD
}
create-glyph 'l.hooky' : glyph-construction {
create-glyph 'l.hooky' 'l' : glyph-construction {
include bMarks
dont-export
include glyphs.'l.straight'
put-shapes : leftwardTopSerif MIDDLE CAP LONGJUT
}
create-glyph 'l.zshaped' : glyph-construction {
create-glyph 'l.zshaped' 'l' : glyph-construction {
include bMarks
dont-export
include glyphs.'l.hooky'
put-shapes : rightwardBottomSerif MIDDLE 0 LONGJUT
}
create-glyph 'l.serifed' : glyph-construction {
create-glyph 'l.serifed' 'l' : glyph-construction {
include bMarks
dont-export
local balance ILBALANCE
@ -715,8 +711,7 @@ create-glyph 'r' : glyph-construction {
}
### f
create-glyph 'fbar' : glyph-construction {
dont-export
define [fBar] : glyph-construction {
include : create-stroke
:.start-from [MIDDLE - LONGJUT] XH
:.heads-to RIGHTWARD
@ -724,7 +719,7 @@ create-glyph 'fbar' : glyph-construction {
:.line-to [MIDDLE + LONGJUT] XH
:.heads-to RIGHTWARD
}
create-glyph 'longs.upright' : glyph-construction {
create-glyph 'longs.upright' 'f' : glyph-construction {
set-width WIDTH
dont-export
include bMarks
@ -744,7 +739,7 @@ define [eshHook attach] : glyph-construction {
:.arc-hv-to attach.x attach.y
:.line-to attach.x [attach.y + STROKE]
}
create-glyph 'longs.italic' : glyph-construction {
create-glyph 'longs.italic' 'f' : glyph-construction {
set-width WIDTH
dont-export
include ifMarks
@ -757,7 +752,7 @@ create-glyph 'longs.italic' : glyph-construction {
:.arc-vh-to [MIDDLE + SHOOK * 2] [CAP - HALFSTROKE - O * 6]
:.heads-to RIGHTWARD
}
create-glyph 'longs' : glyph-construction {
create-glyph 'longs' 'f' : glyph-construction {
set-width WIDTH
assign-unicode 0x17f
@ -771,5 +766,5 @@ create-glyph 'f' : glyph-construction {
set-width WIDTH
assign-unicode 'f'
include glyphs.longs AS_BASE
include glyphs.fbar
include : fBar
}

View File

@ -1,25 +1,25 @@
###### NUMBERS
create-glyph 'zero.slashed' : glyph-construction {
create-glyph 'zero.unslashed' 'zero' : glyph-construction {
set-width WIDTH
dont-export
include glyphs.O
include : smallo CAP 0 SB RIGHTSB
}
create-glyph 'zero.slashed' 'zero' : glyph-construction {
set-width WIDTH
dont-export
include glyphs.'zero.unslashed'
local fine : adviceBlackness 9
include : create-stroke
:.start-from [SB + STROKE / 2] [CAP * [1 - 0.77]]
:.set-width fine fine
:.line-to [RIGHTSB - STROKE / 2] [CAP * 0.77]
}
create-glyph 'zero.unslashed' : glyph-construction {
create-glyph 'zero.dotted' 'zero' : glyph-construction {
set-width WIDTH
dont-export
include glyphs.O
}
create-glyph 'zero.dotted' : glyph-construction {
set-width WIDTH
dont-export
include glyphs.O
include glyphs.'zero.unslashed'
local radius : Math.min DOTRADIUS [[RIGHTSB - SB - STROKE * 2] / 4]
include : list {
Ring [CAPMIDDLE + radius] [CAPMIDDLE - radius] [MIDDLE + radius] [MIDDLE - radius]

View File

@ -17,7 +17,7 @@ local belowMarkTop [0 - ACCENT * 0.35]
### Above marks
create-glyph 'dotAbove' : glyph-construction {
create-glyph 'dotAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x307
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -25,7 +25,7 @@ create-glyph 'dotAbove' : glyph-construction {
Ring [XH + ACCENT + DOTRADIUS] [XH + ACCENT - DOTRADIUS] [markMiddle - DOTRADIUS] [markMiddle + DOTRADIUS]
}
}
create-glyph 'dieresisAbove' : glyph-construction {
create-glyph 'dieresisAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x308
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -34,7 +34,7 @@ create-glyph 'dieresisAbove' : glyph-construction {
Ring [XH + ACCENT + markDotsRadius] [XH + ACCENT - markDotsRadius] [markMiddle - markDotsRadius + markExtend] [markMiddle + markDotsRadius + markExtend]
}
}
create-glyph 'ringAbove' : glyph-construction {
create-glyph 'ringAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x30A
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -47,7 +47,7 @@ create-glyph 'ringAbove' : glyph-construction {
}
reverse-last
}
create-glyph 'graveAbove' : glyph-construction {
create-glyph 'graveAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x300
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -59,7 +59,7 @@ create-glyph 'graveAbove' : glyph-construction {
:.set-width markStress markStress
:.set-samples 1
}
create-glyph 'acuteAbove' : glyph-construction {
create-glyph 'acuteAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x301
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -71,7 +71,7 @@ create-glyph 'acuteAbove' : glyph-construction {
:.set-width markStress markStress
:.set-samples 1
}
create-glyph 'circumflexAbove' : glyph-construction {
create-glyph 'circumflexAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x302
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -90,7 +90,7 @@ create-glyph 'circumflexAbove' : glyph-construction {
:.heads-to UPWARD
:.set-samples 1
}
create-glyph 'caronAbove' : glyph-construction {
create-glyph 'caronAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x30c
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -109,7 +109,7 @@ create-glyph 'caronAbove' : glyph-construction {
:.heads-to DOWNWARD
:.set-samples 1
}
create-glyph 'tildeAbove' : glyph-construction {
create-glyph 'tildeAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x303
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -132,7 +132,7 @@ create-glyph 'tildeAbove' : glyph-construction {
:.cubic-to [mix leftEnd rightEnd tildeWaveX] [mix bot top tildeWave] [mix leftEnd rightEnd [1 - tildeWaveX]] [mix bot top [1 - tildeWave]] rightEnd [mix tbot ttop [1 - tildeWaveEnd]]
:.set-samples 11
}
create-glyph 'macronAbove' : glyph-construction {
create-glyph 'macronAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x304
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -147,7 +147,7 @@ create-glyph 'macronAbove' : glyph-construction {
:.line-to rightEnd [aboveMarkTop - DOTRADIUS]
:.heads-to RIGHTWARD
}
create-glyph 'breveAbove' : glyph-construction {
create-glyph 'breveAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x306
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -163,7 +163,7 @@ create-glyph 'breveAbove' : glyph-construction {
:.arc-hv-to rightEnd aboveMarkTop
:.heads-to UPWARD
}
create-glyph 'archAbove' : glyph-construction {
create-glyph 'archAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x311
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -179,7 +179,7 @@ create-glyph 'archAbove' : glyph-construction {
:.arc-hv-to rightEnd aboveMarkBot
:.heads-to DOWNWARD
}
create-glyph 'hookabove' : glyph-construction {
create-glyph 'hookabove' '*' : glyph-construction {
set-width 0
assign-unicode 0x309
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -198,7 +198,7 @@ create-glyph 'hookabove' : glyph-construction {
:.line-to [markMiddle - markExtend + fine] hookTop
:.heads-to LEFTWARD
}
create-glyph 'doubleGraveAbove' : glyph-construction {
create-glyph 'doubleGraveAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x30F
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -218,7 +218,7 @@ create-glyph 'doubleGraveAbove' : glyph-construction {
:.set-width markStress markStress
:.set-samples 1
}
create-glyph 'doubleAcuteAbove' : glyph-construction {
create-glyph 'doubleAcuteAbove' '*' : glyph-construction {
set-width 0
assign-unicode 0x30B
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
@ -240,7 +240,7 @@ create-glyph 'doubleAcuteAbove' : glyph-construction {
}
### Below marks
create-glyph 'dotBelow' : glyph-construction {
create-glyph 'dotBelow' '*' : glyph-construction {
set-width 0
assign-unicode 0x323
set-anchor 'below' MARK markMiddle 0 markMiddle belowMarkBot
@ -248,7 +248,7 @@ create-glyph 'dotBelow' : glyph-construction {
Ring [0 - ACCENT + DOTRADIUS] [0 - ACCENT - DOTRADIUS] [markMiddle - DOTRADIUS] [markMiddle + DOTRADIUS]
}
}
create-glyph 'cedillaBelow' : glyph-construction {
create-glyph 'cedillaBelow' '*' : glyph-construction {
set-width 0
assign-unicode 0x327
set-anchor 'below' MARK markMiddle 0 markMiddle belowMarkBot

View File

@ -52,3 +52,178 @@ create-glyph 'plusminus' : glyph-construction {
include glyphs.underscore
include glyphs.plus
}
define [Miniature glyphid fold scale] : begin {
local forkedPara : Object.create para
forkedPara.upmscale = 1
forkedPara.buildFor = glyphid
forkedPara.stroke = [adviceBlackness fold] / scale
forkedPara.sb = SB / 2
local forkFont : exports.build forkedPara
return forkFont.glyfMap`glyphid
}
define [CircledGlyph glyphid] : glyph-construction {
local sw [adviceBlackness 6]
include : create-glyph : glyph-construction {
include : Miniature glyphid 4.2 0.6
apply-transform : Upright
apply-transform : Scale 0.45
apply-transform : Translate [[WIDTH - WIDTH * 0.45] / 2] [sw * 2]
apply-transform : Italify
}
include : smallo [CAP * 0.45 + sw * 4] 0 SB RIGHTSB sw
apply-transform : Upright
apply-transform : Translate 0 [parenMid - [CAP * 0.45 + sw * 4] / 2]
apply-transform : Italify
}
define [createSuperscript unicode glyphid] : if glyphs`glyphid : begin {
create-glyph ['superscript_' + glyphid] : glyph-construction {
assign-unicode unicode
include : create-glyph : glyph-construction {
include : Miniature glyphid 4.2 0.6
apply-transform : Upright
apply-transform : Translate [-MIDDLE] [-CAP]
apply-transform : Scale 0.6
apply-transform : Translate MIDDLE CAP
apply-transform : Italify
}
}
}
define [createSubscript unicode glyphid] : if glyphs`glyphid : begin {
create-glyph ['subscript_' + glyphid] : glyph-construction {
assign-unicode unicode
include : create-glyph : glyph-construction {
include : Miniature glyphid 4.2 0.6
apply-transform : Upright
apply-transform : Translate [-MIDDLE] 0
apply-transform : Scale 0.6
apply-transform : Translate MIDDLE [-DESCENDER / 2]
apply-transform : Italify
}
}
}
create-glyph 'copyright' : glyph-construction {
assign-unicode 0xA9
include : CircledGlyph 'C'
}
create-glyph 'registered' : glyph-construction {
assign-unicode 0xAE
include : CircledGlyph 'R'
}
create-glyph 'ordfeminine' : glyph-construction {
assign-unicode 0xAA
include : Miniature 'a' 4.2 0.6
include : create-stroke
:.start-from SB DESCENDER
:.set-width STROKE 0
:.heads-to RIGHTWARD
:.line-to RIGHTSB DESCENDER
:.heads-to RIGHTWARD
apply-transform : Upright
apply-transform : Translate [-MIDDLE] [-XH]
apply-transform : Scale 0.6
apply-transform : Translate MIDDLE CAP
apply-transform : Italify
}
create-glyph 'ordmasculine' : glyph-construction {
assign-unicode 0xBA
include : Miniature 'o' 4.2 0.6
include : create-stroke
:.start-from SB DESCENDER
:.set-width STROKE 0
:.heads-to RIGHTWARD
:.line-to RIGHTSB DESCENDER
:.heads-to RIGHTWARD
apply-transform : Upright
apply-transform : Translate [-MIDDLE] [-XH]
apply-transform : Scale 0.6
apply-transform : Translate MIDDLE CAP
apply-transform : Italify
}
createSuperscript 0x2070 'zero'
createSuperscript 0x00B9 'one'
createSuperscript 0x00B2 'two'
createSuperscript 0x00B3 'three'
createSuperscript 0x2074 'four'
createSuperscript 0x2075 'five'
createSuperscript 0x2076 'six'
createSuperscript 0x2077 'seven'
createSuperscript 0x2078 'eight'
createSuperscript 0x2079 'nine'
createSuperscript 0x02B0 'h'
createSuperscript 0x02B2 'j'
createSuperscript 0x02B3 'r'
createSuperscript 0x02B7 'w'
createSuperscript 0x02B8 'y'
createSuperscript 0x02E1 'l'
createSuperscript 0x02E2 's'
createSuperscript 0x02E3 'x'
createSuperscript 0x2071 'i'
createSuperscript 0x207F 'n'
createSuperscript 0x1D43 'a'
createSuperscript 0x1D47 'b'
createSuperscript 0x1D48 'd'
createSuperscript 0x1D49 'e'
createSuperscript 0x1D4D 'g'
createSuperscript 0x1D4F 'k'
createSuperscript 0x1D50 'm'
createSuperscript 0x1D52 'o'
createSuperscript 0x1D56 'p'
createSuperscript 0x1D57 't'
createSuperscript 0x1D58 'u'
createSuperscript 0x1D5B 'v'
createSuperscript 0x1D9C 'c'
createSuperscript 0x1DA0 'f'
createSuperscript 0x1DBB 'z'
createSuperscript 0x1D2C 'A'
createSuperscript 0x1D2E 'B'
createSuperscript 0x1D30 'D'
createSuperscript 0x1D31 'E'
createSuperscript 0x1D33 'G'
createSuperscript 0x1D34 'H'
createSuperscript 0x1D35 'I'
createSuperscript 0x1D36 'J'
createSuperscript 0x1D37 'K'
createSuperscript 0x1D38 'L'
createSuperscript 0x1D39 'M'
createSuperscript 0x1D3A 'N'
createSuperscript 0x1D3C 'O'
createSuperscript 0x1D3E 'P'
createSuperscript 0x1D3F 'R'
createSuperscript 0x1D40 'T'
createSuperscript 0x1D41 'U'
createSuperscript 0x1D42 'W'
createSubscript 0x2080 'zero'
createSubscript 0x2081 'one'
createSubscript 0x2082 'two'
createSubscript 0x2083 'three'
createSubscript 0x2084 'four'
createSubscript 0x2085 'five'
createSubscript 0x2086 'six'
createSubscript 0x2087 'seven'
createSubscript 0x2088 'eight'
createSubscript 0x2089 'nine'
createSubscript 0x2090 'a'
createSubscript 0x2091 'e'
createSubscript 0x2092 'o'
createSubscript 0x2093 'x'
# createSubscript 0x2094 'reve'
createSubscript 0x2095 'h'
createSubscript 0x2096 'k'
createSubscript 0x2097 'l'
createSubscript 0x2098 'm'
createSubscript 0x2099 'n'
createSubscript 0x209A 'p'
createSubscript 0x209B 's'
createSubscript 0x209C 't'
createSubscript 0x1D62 'i'
createSubscript 0x1D63 'r'
createSubscript 0x1D64 'u'
createSubscript 0x1D65 'v'

View File

@ -1,5 +1,5 @@
{
var r0_bezierCubic2Q2, r0_tp, r0_Stroke, r0_id, r0_fallback, r0_aFunction, r0_Glyph, _r0_t0, _r0_t1, _r0_t2, _r0_t3, _r0_t4, _r0_t5, _r0_t6, _r0_t7, _r0_t8, _r0_t9, _r0_t10, _r0_t11, _r0_t12, _r0_t13, _r0_t14, _r0_t15;
var r0_bezierCubic2Q2, r0_tp, r0_Stroke, r0_id, r0_fallback, r0_aFunction, r0_Glyph, _r0_t0, _r0_t1, _r0_t2, _r0_t3, _r0_t4, _r0_t5, _r0_t6, _r0_t7, _r0_t8, _r0_t9, _r0_t10, _r0_t11, _r0_t12, _r0_t13, _r0_t14, _r0_t15, _r0_t16;
r0_bezierCubic2Q2 = require('node-sfnt/lib/math/bezierCubic2Q2');
r0_tp = require('./transform')['transformPoint'];
r0_Stroke = require('./stroke')['Stroke'];
@ -290,37 +290,48 @@
} else
return void 0;
};
r0_Glyph['prototype']['create-stroke'] = function _r0_t14() {
var r22_s, _r22_t0, _r22_t1;
r0_Glyph['prototype']['apply-transform'] = function _r0_t14(r22_transform) {
var r22_transform, _r22_t0, _r22_t1, _r22_t2;
_r22_t0 = this;
r22_s = new r0_Stroke();
r22_s['gizmo'] = Object['create'](_r22_t0['gizmo']);
return r22_s;
};
r0_Glyph['prototype']['set-anchor'] = function _r0_t15(r23_id, r23_type, r23_x, r23_y, r23_mbx, r23_mby) {
var r23_id, r23_type, r23_x, r23_y, r23_mbx, r23_mby, r23_anchorpoint, r23_markbasepoint, _r23_t0, _r23_t1, _r23_t2;
_r23_t0 = this;
r23_anchorpoint = r0_tp(_r23_t0['gizmo'], {
'x': r23_x,
'y': r23_y
return _r22_t0['contours'] = _r22_t0['contours']['map'](function _r22_t2(r23_contour) {
var r23_contour, _r23_t0, _r23_t1, _r23_t2;
return r23_contour['map'](function _r23_t2(r24_point) {
var r24_point, _r24_t0, _r24_t1;
return r0_tp(r22_transform, r24_point);
});
});
if (r23_mbx !== void 0 && r23_mby !== void 0)
_r23_t2 = r0_tp(_r23_t0['gizmo'], {
'x': r23_mbx,
'y': r23_mby
};
r0_Glyph['prototype']['create-stroke'] = function _r0_t15() {
var r25_s, _r25_t0, _r25_t1;
_r25_t0 = this;
r25_s = new r0_Stroke();
r25_s['gizmo'] = Object['create'](_r25_t0['gizmo']);
return r25_s;
};
r0_Glyph['prototype']['set-anchor'] = function _r0_t16(r26_id, r26_type, r26_x, r26_y, r26_mbx, r26_mby) {
var r26_id, r26_type, r26_x, r26_y, r26_mbx, r26_mby, r26_anchorpoint, r26_markbasepoint, _r26_t0, _r26_t1, _r26_t2;
_r26_t0 = this;
r26_anchorpoint = r0_tp(_r26_t0['gizmo'], {
'x': r26_x,
'y': r26_y
});
if (r26_mbx !== void 0 && r26_mby !== void 0)
_r26_t2 = r0_tp(_r26_t0['gizmo'], {
'x': r26_mbx,
'y': r26_mby
});
else
_r23_t2 = {
_r26_t2 = {
'x': void 0,
'y': void 0
};
r23_markbasepoint = _r23_t2;
return _r23_t0['anchors'][r23_id] = {
'x': r23_anchorpoint['x'],
'y': r23_anchorpoint['y'],
'type': r23_type,
'mbx': r23_markbasepoint['x'],
'mby': r23_markbasepoint['y']
r26_markbasepoint = _r26_t2;
return _r26_t0['anchors'][r26_id] = {
'x': r26_anchorpoint['x'],
'y': r26_anchorpoint['y'],
'type': r26_type,
'mbx': r26_markbasepoint['x'],
'mby': r26_markbasepoint['y']
};
};
exports['Glyph'] = r0_Glyph;

View File

@ -129,6 +129,9 @@ define [Glyph.prototype.include component copyAnchors] : begin {
* a
}
}
define [Glyph.prototype.apply-transform transform] : set this.contours : this.contours.map : function [contour] : begin {
return : contour.map : function [point] [tp transform point]
}
define [Glyph.prototype.create-stroke] : begin {
local s : new Stroke
s.gizmo = [Object.create this.gizmo]