Added several more enclosed letters.

This commit is contained in:
be5invis 2015-08-30 16:40:26 +08:00
parent 1c1e01ef0b
commit dd0eae9ecf
13 changed files with 154 additions and 133 deletions

View File

@ -74,6 +74,7 @@ define [buildFont para recursive] : begin {
define [Rotate angle] (.xx [Math.cos angle] .yx [-[Math.sin angle]] .xy [Math.sin angle] .yy [Math.cos angle] .x 0 .y 0)
define globalTransform : Italify para.italicAngle
define deGlobalTransform : inverse globalTransform
define CORRECTION_HX : 1 / [Math.sqrt [1 - globalTransform.yx * globalTransform.yx]]
# Orient parameters
@ -344,7 +345,7 @@ define [buildFont para recursive] : begin {
define [alsothru rx ry raf] (.type 'interpolate' .rx rx .ry ry .raf raf .af afInterpolate)
define [alsothruthem rs raf] (.type 'interpolate' .rs rs .raf raf .af afInterpolateThem)
define [bezcontrols x1 y1 x2 y2 _samples notiny] : begin {
define [bezcontrols x1 y1 x2 y2 _samples raf] : begin {
local samples : fallback _samples 5
local tiny 0.005
local rs ()
@ -354,11 +355,11 @@ define [buildFont para recursive] : begin {
bez3 0 y1 y2 1 [mix tiny [1 - tiny] [j / samples]]
}
# if [not notiny] : rs.push ([bez3 0 x1 x2 1 [1 - tiny]] [bez3 0 y1 y2 1 [1 - tiny]] 2)
alsothruthem rs
alsothruthem rs raf
}
define [quadcontrols x1 y1 samples] : bezcontrols [x1 * 2 / 3] [y1 * 2 / 3] [mix 1 x1 [2 / 3]] [mix 1 y1 [2 / 3]] samples
define [archv samples notiny] : bezcontrols KAPPA_SPIRO_ARC 0 1 [1 - KAPPA_SPIRO_ARC] samples notiny
define [arcvh samples notiny] : bezcontrols 0 KAPPA_SPIRO_ARC [1 - KAPPA_SPIRO_ARC] 1 samples notiny
define [quadcontrols x1 y1 samples raf] : bezcontrols [x1 * 2 / 3] [y1 * 2 / 3] [mix 1 x1 [2 / 3]] [mix 1 y1 [2 / 3]] samples raf
define [archv samples] : bezcontrols KAPPA_SPIRO_ARC 0 1 [1 - KAPPA_SPIRO_ARC] samples
define [arcvh samples] : bezcontrols 0 KAPPA_SPIRO_ARC [1 - KAPPA_SPIRO_ARC] 1 samples
define [complexThru] : begin {
local a : ().slice.call arguments
@ -419,13 +420,11 @@ define [buildFont para recursive] : begin {
libspiro.spiroToBezierOnContext [rhs.reverse :.slice 0 [-1]] true g
local rhsContour g.contours.0
set g.contours ([lhsContour.concat rhsContour])
g.cleanup
}
else {
local g : new Glyph
lhs.0.type = rhs.0.type = lhs.[lhs.length - 1].type = rhs.[rhs.length - 1].type = 'corner'
libspiro.spiroToBezierOnContext [lhs.concat : rhs.reverse] true g
g.cleanup
}
}
return g.contours
@ -541,20 +540,7 @@ define [buildFont para recursive] : begin {
finalUprightify.y = 0
if [not recursive] : foreach glyph [items-of glyphList] : begin {
glyph.apply-transform finalUprightify
local p0 nothing
foreach [contour : items-of glyph.contours] : foreach [point : items-of contour] : begin {
if [not p0] : set p0 (.x point.x .y point.y)
if [[Math.abs point.x] < [Math.abs p0.x]] : set p0.x point.x
if [[Math.abs point.y] < [Math.abs p0.y]] : set p0.y point.y
}
if p0 : begin {
local pr (.x [Math.round p0.x] .y [Math.round p0.y])
foreach [contour : items-of glyph.contours] : foreach [k : range 0 contour.length] : set contour.(k) : object {
x : pr.x + [Math.round : contour.(k).x - p0.x]
y : pr.y + [Math.round : contour.(k).y - p0.y]
onCurve contour.(k).onCurve
}
}
glyph.cleanup
}
set font.glyfMap glyphs

View File

@ -164,31 +164,43 @@ foreach code [range 0x0000 0xFFFF] : if [not unicodeGlyphs`code] : begin {
}
}
define [suggestName name] : begin {
if glyphs.(name) : begin {
local j 2
while glyphs.[name + j] : inc j
set name [name + j]
}
return name
}
# Build miniature clyphs : circled, superscripts, subscripts...
define [createCircledGlyphs records] : if [not recursive] : begin {
local dscale 0.45
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7
local miniatureFont : Miniature pendingGlyphs 3.7 0.65
foreach (unicode glyphid) [items-of records] : create-glyph ['circle' + glyphid] : glyph-construction {
foreach (unicode glyphid _scale shift) [items-of records] : create-glyph [suggestName : 'circle' + glyphid] : glyph-construction {
local scale : fallback _scale dscale
local sw [adviceBlackness 6]
if unicode : assign-unicode unicode
include : create-glyph : glyph-construction {
include : create-glyph [suggestName : 'circleinner' + glyphid] : glyph-construction {
include miniatureFont.(glyphid)
apply-transform : Upright
apply-transform : Scale 0.45
apply-transform : Translate [[WIDTH - WIDTH * 0.45] / 2] [sw * 2]
apply-transform : Translate [-WIDTH / 2] [-CAP / 2 + [fallback shift 0]]
apply-transform : Scale scale
apply-transform : Translate [WIDTH / 2] [CAP / 2 * dscale]
apply-transform : Italify
}
include : smallo [CAP * 0.45 + sw * 4] 0 SB RIGHTSB sw
include : smallo [CAP * dscale + sw * 2.5] [-sw * 2.5] [SB + O * 3] [RIGHTSB - O * 3] sw
apply-transform : Upright
apply-transform : Translate 0 [parenMid - [CAP * 0.45 + sw * 4] / 2]
apply-transform : Translate 0 [parenMid - CAP * dscale / 2]
apply-transform : Italify
}
}
define [createSuperscripts records] : if [not recursive] : begin {
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7
foreach (unicode glyphid) [items-of records] : create-glyph ['sup' + glyphid] : glyph-construction {
foreach (unicode glyphid) [items-of records] : create-glyph [suggestName : 'sup' + glyphid] : glyph-construction {
if unicode : assign-unicode unicode
include miniatureFont.(glyphid) AS_BASE
apply-transform [Upright] true
@ -201,7 +213,7 @@ define [createSuperscripts records] : if [not recursive] : begin {
define [createSubscripts records] : if [not recursive] : begin {
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7
foreach (unicode glyphid) [items-of records] : create-glyph ['sub' + glyphid] : glyph-construction {
foreach (unicode glyphid) [items-of records] : create-glyph [suggestName : 'sub' + glyphid] : glyph-construction {
if unicode : assign-unicode unicode
include miniatureFont.(glyphid) AS_BASE
apply-transform [Upright] true
@ -215,33 +227,32 @@ define [createSubscripts records] : if [not recursive] : begin {
define [createFractions records] : if [not recursive] : begin {
local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2
local miniatureFont : Miniature pendingGlyphs 4 0.6
foreach (unicode numid denid height) [items-of records] : create-glyph [numid + 'over' + denid] : glyph-construction {
foreach (unicode numid denid height) [items-of records] : create-glyph [suggestName : numid + 'over' + denid] : glyph-construction {
if unicode : assign-unicode unicode
local fine : adviceBlackness 3.7
local dist : XH * 0.4
include : create-glyph : glyph-construction {
include : create-glyph : glyph-construction {
include : create-glyph [suggestName : 'num' + numid] : glyph-construction {
include miniatureFont.(numid)
apply-transform : Upright
apply-transform : Translate [- miniatureFont.(numid).advanceWidth / 2] 0
apply-transform : Scale [CAP / [fallback height CAP]]
apply-transform : Scale [CAP / [fallback height CAP] * 0.55]
apply-transform : Translate MIDDLE 0
apply-transform : Italify
}
apply-transform : Upright
apply-transform : Translate 0 [CAP + dist]
apply-transform : Translate 0 [CAP * 0.55 + dist]
apply-transform : Italify
include : create-glyph : glyph-construction {
include : create-glyph [suggestName : 'den' + denid] : glyph-construction {
include miniatureFont.(denid)
apply-transform : Upright
apply-transform : Translate [- miniatureFont.(denid).advanceWidth / 2] 0
apply-transform : Scale [CAP / [fallback height CAP]]
apply-transform : Scale [CAP / [fallback height CAP] * 0.55]
apply-transform : Translate MIDDLE 0
apply-transform : Italify
}
apply-transform : Upright
apply-transform : Translate [-MIDDLE] [-CAP - dist / 2]
apply-transform : Scale 0.55
apply-transform : Translate [-MIDDLE] [-CAP * 0.55 - dist / 2]
apply-transform : Translate MIDDLE parenMid
apply-transform : Italify
}
@ -249,10 +260,16 @@ define [createFractions records] : if [not recursive] : begin {
}
}
createCircledGlyphs : list {
if [not recursive] : createCircledGlyphs : [list {
list 0xA9 'C'
list 0xAE 'R'
list 0x2117 'P'
list null 'space' # a blank circle glyph for size optimization
}].concat : let [a ()] : begin {
foreach [j : range 1 till 9] : a.push ([0x2460 + j - 1] unicodeGlyphs.[['0'.charCodeAt 0] + j].name)
foreach [j : range 0 26] : a.push ([0x24B6 + j] unicodeGlyphs.[['A'.charCodeAt 0] + j].name)
foreach [j : range 0 26] : a.push ([0x24D0 + j] unicodeGlyphs.[['a'.charCodeAt 0] + j].name 0.425 [CAP / 2 - XH / 2])
* a
}
create-glyph 'ordfeminine' : glyph-construction {
@ -473,6 +490,8 @@ createFractions : list {
list 0x2106 'C' 'U'
# Powerline LN symbol
list 0xE0A1 'L' 'N'
# fraction bar
list null 'space' 'space'
}
# Ligatures

View File

@ -328,7 +328,7 @@ create-glyph 'delta' : glyph-construction {
g4 [xNeck + STROKE] [mix [CAPO - STROKE] bar 0.5]
arcvh 2
g4 xOTLeft bar [heading RIGHTWARD]
alsothruthem : list (0.25 0.06) (0.5 0.13)
alsothruthem : list (0.25 0.05) (0.5 0.13)
flat [RIGHTSB - O] [bar - smb]
curl [RIGHTSB - O] sma
arcvh 16
@ -612,6 +612,7 @@ create-glyph 'pomega' : glyph-construction {
### Polytonic symbols
define [GreekLRDoubleMark id unicode leftGlyph rightGlyph] : begin {
create-glyph id : glyph-construction {
set-width 0
local k : -WIDTH * 0.15
include leftGlyph
@ -633,13 +634,14 @@ GreekLRDoubleMark 'dasiavaria' 0x1FDD glyphs.revCommaAbove glyphs.variaAbove
GreekLRDoubleMark 'dasiaoxia' 0x1FDE glyphs.revCommaAbove glyphs.oxiaAbove
create-glyph 'psiliperispomeni' : glyph-construction {
set-width 0
include glyphs.commaAbove
local yc : XH + ACCENT + DOTRADIUS * 0.25
local radius : markHalfStroke * 2.25
local radius : [adviceBlackness 6] * 1.5
include : create-stroke
:.start-from [markMiddle - radius] yc
:.heads-to UPWARD
:.set-width [markFine * 2] 0
:.set-width [[adviceBlackness 6.5] * 1.25] 0
:.arc-vh-to markMiddle [yc + radius]
:.arc-hv-to [markMiddle + radius] yc
:.heads-to DOWNWARD
@ -651,13 +653,14 @@ create-glyph 'spaced_psiliperispomeni' : glyph-construction {
include glyphs.psiliperispomeni
}
create-glyph 'dasiaperispomeni' : glyph-construction {
set-width 0
include glyphs.revCommaAbove
local yc : XH + ACCENT + DOTRADIUS * 0.25
local radius : markHalfStroke * 2.25
local radius : [adviceBlackness 6] * 1.5
include : create-stroke
:.start-from [markMiddle - radius] yc
:.heads-to UPWARD
:.set-width [markFine * 2] 0
:.set-width [[adviceBlackness 6.5] * 1.25] 0
:.arc-vh-to markMiddle [yc + radius]
:.arc-hv-to [markMiddle + radius] yc
:.heads-to DOWNWARD

View File

@ -90,15 +90,15 @@ create-glyph 'g' : glyph-construction {
local gleftx [SB * 0.8 + O]
local grightx [RIGHTSB + SB * 0.1 - O]
local groundy : [mix DESCENDER [XH * GBARPOS] 0.7] + HALFSTROKE
local groundy : [mix DESCENDER [XH * GBARPOS] 0.701] + HALFSTROKE
include : spiro {
g4 MIDDLE [XH * GBARPOS] [widths 0 [STROKE * 0.75]]
g4 MIDDLE [XH * GBARPOS - O] [widths 0 [STROKE * 0.75]]
#archv
g4 [SB * 1.25 + STROKE] [mix groundy [XH * GBARPOS] 0.5] [widths 0 STROKE]
#arcvh
flat [MIDDLE + DESCENDER * 0.15] groundy
curl [MIDDLE - DESCENDER * 0.15] groundy
archv
archv 2
g4 grightx [mix [DESCENDER + O] groundy 0.53]
arcvh
g4 [mix gleftx grightx 0.5] [DESCENDER + O]
@ -589,27 +589,24 @@ create-glyph 'z' : glyph-construction {
}
define [SmallKShape] : glyph-construction {
local TURN [XH * 0.99]
local turn [XH * 0.99]
local rturn [XH * 0.1]
local right [RIGHTSB - O]
local attach [XH * 0.4]
local attach [XH * 0.375]
local attach2 MIDDLE
local fine : adviceBlackness 3.5
include : spiro {
g4 [RIGHTSB + O] XH [widths.heading 0 [STROKE * 1.05] DOWNWARD]
#curl RIGHTSB turn [heading DOWNWARD]
bezcontrols 0 0.2 0.5 0.65 8
g4 [SB + STROKE] attach [widths 0 fine]
}
include : create-stroke
:.start-from RIGHTSB XH
:.heads-to DOWNWARD
:.set-width 0 STROKE
:.line-to RIGHTSB TURN
:.heads-to DOWNWARD
:.curve-to RIGHTSB [[1 - 0.18] * TURN] [SB + STROKE] attach
:.set-width 0 fine
include : create-stroke
:.start-from [right - HALFSTROKE] 0
:.start-from [RIGHTSB - HALFSTROKE] 0
:.heads-to UPWARD
:.set-width HALFSTROKE HALFSTROKE
:.curve-to [right - HALFSTROKE] [rturn + 0.05 * [XH - rturn]] attach2 [XH * 0.52 + HALFSTROKE]
:.curve-to [RIGHTSB - HALFSTROKE] [rturn + 0.05 * [XH - rturn]] attach2 [XH * 0.61]
:.set-width [fine / 2] [fine / 2]
}

View File

@ -63,8 +63,7 @@ create-glyph 'OE' : glyph-construction {
include : OEShape CAP
}
create-glyph 'aeepart' : glyph-construction {
dont-export
define aeepart : glyph-construction {
local eLeft : MIDDLE - MVERTSTROKE / 2 * CORRECTION_HX
local eMiddle : [mix eLeft [RIGHTSB - O] 0.5] - MVERTSTROKE * globalTransform.yx
local barbottom [XH * EBARPOS]
@ -90,8 +89,7 @@ create-glyph 'aeepart' : glyph-construction {
:.line-to [RIGHTSB - MVERTSTROKE / 2] barbottom
:.heads-to RIGHTWARD
}
create-glyph 'aeapart' : glyph-construction {
dont-export
define aeapart : glyph-construction {
local bartop [XH * BARPOS + HALFSTROKE]
local abarRight : MIDDLE + MVERTSTROKE / 2 * CORRECTION_HX
@ -116,8 +114,7 @@ create-glyph 'aeapart' : glyph-construction {
curl [abarRight - 1] bartop [heading RIGHTWARD]
}
}
create-glyph 'oeopart' : glyph-construction {
dont-export
define oeopart : glyph-construction {
local abarRight : MIDDLE + MVERTSTROKE / 2 * CORRECTION_HX
include : smallo XH 0 [SB + O] [abarRight + O] MVERTSTROKE [SMALLSMOOTHA * 0.6] [SMALLSMOOTHB * 0.6]
@ -127,32 +124,32 @@ create-glyph 'ae' : glyph-construction {
set-width WIDTH
assign-unicode 0xE6
include eMarks
include glyphs.aeepart
include glyphs.aeapart
include aeepart
include aeapart
}
create-glyph 'oe' : glyph-construction {
set-width WIDTH
assign-unicode 0x153
include eMarks
include glyphs.aeepart
include glyphs.oeopart
include aeepart
include oeopart
}
create-glyph 'db' : glyph-construction {
set-width WIDTH
assign-unicode 0x238
include bMarks
include glyphs.oeopart
include oeopart
include : FlipAround MIDDLE [XH / 2]
include glyphs.oeopart
include oeopart
include : VBar MIDDLE [XH / 2] CAP MVERTSTROKE
}
create-glyph 'pq' : glyph-construction {
set-width WIDTH
assign-unicode 0x239
include pMarks
include glyphs.oeopart
include oeopart
include : FlipAround MIDDLE [XH / 2]
include glyphs.oeopart
include oeopart
include : VBar MIDDLE DESCENDER [XH / 2] MVERTSTROKE
}

View File

@ -353,6 +353,12 @@ create-glyph 'hhooktopltail' : glyph-construction {
include glyphs.hhooktop
include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK
}
create-glyph 'hltail' : glyph-construction {
assign-unicode 0xA727
include pMarks
include glyphs.h
include : VerticalHook [RIGHTSB - HALFSTROKE * CORRECTION_HX] 0 [-HOOKX] HOOK
}
# Right-tail
create-glyph 'srtail' : glyph-construction {
assign-unicode 0x282

View File

@ -8,11 +8,11 @@ local markHalfStroke : mix markFine markStress 0.5
local markMiddle [-MIDDLE]
local markDotsRadius : DOTRADIUS * markStress / HALFSTROKE
local aboveMarkTop [XH + ACCENT * 1.375]
local aboveMarkBot [XH + ACCENT * 0.325]
local aboveMarkTop [XH + ACCENT * 1.38]
local aboveMarkBot [XH + ACCENT * 0.35]
local belowMarkBot [0 - ACCENT * 1.375]
local belowMarkTop [0 - ACCENT * 0.325]
local belowMarkBot [0 - ACCENT * 1.38]
local belowMarkTop [0 - ACCENT * 0.35]
### Above marks
@ -259,16 +259,19 @@ create-glyph 'commaAbove' : glyph-construction {
this.shortName = 'comma'
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
local radius : markHalfStroke * 1.5
local radius : adviceBlackness 6
include : list {
Ring [XH + ACCENT + radius] [XH + ACCENT - radius] [markMiddle - radius] [markMiddle + radius]
Ring aboveMarkTop [aboveMarkTop - radius * 2] [markMiddle - radius] [markMiddle + radius]
}
include : spiro {
widths.rhs [markFine * 1.75]
flat [markMiddle + radius] [aboveMarkTop - radius]
curl [markMiddle + radius] [aboveMarkTop - radius - 1]
quadcontrols 0 0.6
g4 [mix markMiddle [markMiddle - radius] 0.2] [aboveMarkBot - radius]
}
include : create-stroke
:.start-from [markMiddle + radius] [XH + ACCENT]
:.set-width 0 [markFine * 1.75]
:.curve-to [markMiddle + radius] [mix [XH + ACCENT] [aboveMarkBot - radius] 0.75] [mix markMiddle [markMiddle - radius] 0.2] [aboveMarkBot - radius]
apply-transform : Upright
apply-transform : Translate 0 [DOTRADIUS * 0.25]
apply-transform : Translate 0 [DOTRADIUS * 0.3]
apply-transform : Italify
}
create-glyph 'turnCommaAbove' : glyph-construction {
@ -276,7 +279,7 @@ create-glyph 'turnCommaAbove' : glyph-construction {
assign-unicode 0x312
this.shortName = 'turnComma'
include glyphs.commaAbove
include : FlipAround markMiddle [XH + ACCENT - DOTRADIUS * 0.25]
include : FlipAround markMiddle [[mix aboveMarkTop [aboveMarkBot - [adviceBlackness 6]] 0.5] + [DOTRADIUS * 0.3]]
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
}
create-glyph 'revCommaAbove' : glyph-construction {
@ -284,16 +287,20 @@ create-glyph 'revCommaAbove' : glyph-construction {
assign-unicode 0x314
this.shortName = 'revComma'
set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop
local radius : markHalfStroke * 1.5
local radius : adviceBlackness 6
include : list {
Ring [XH + ACCENT + radius] [XH + ACCENT - radius] [markMiddle - radius] [markMiddle + radius]
Ring aboveMarkTop [aboveMarkTop - radius * 2] [markMiddle - radius] [markMiddle + radius]
}
include : spiro {
widths.lhs [markFine * 1.75]
flat [markMiddle - radius] [aboveMarkTop - radius]
curl [markMiddle - radius] [aboveMarkTop - radius - 1]
quadcontrols 0 0.6
g4 [mix markMiddle [markMiddle + radius] 0.2] [aboveMarkBot - radius]
}
include : create-stroke
:.start-from [markMiddle - radius] [XH + ACCENT]
:.set-width [markFine * 1.75] 0
:.curve-to [markMiddle - radius] [mix [XH + ACCENT] [aboveMarkBot - radius] 0.75] [mix markMiddle [markMiddle + radius] 0.2] [aboveMarkBot - radius]
apply-transform : Upright
apply-transform : Translate 0 [DOTRADIUS * 0.25]
apply-transform : Translate 0 [DOTRADIUS * 0.3]
apply-transform : Italify
}
create-glyph 'barAbove' : glyph-construction {

View File

@ -45,12 +45,12 @@ $(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.
cat $^ > $@
# Pass 1 : Outline cleanup and merge
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea
fontforge -quiet -script pass1-cleanup.py $^ $@ $(SUPPRESS_ERRORS)
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : $(OBJDIR)/.pass1-%.ttf
node pass2-smartround.js $^ $@ --upm $(TARGETUPM)
$(PASS3) : $(OBJDIR)/.pass3-%.ttf : $(OBJDIR)/.pass2-%.ttf
fontforge -quiet -script pass3-finalize.py $^ $@ $(TARGETUPM)
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea
fontforge -quiet -script $^ $@ $(SUPPRESS_ERRORS)
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-smartround.js $(OBJDIR)/.pass1-%.ttf
node $^ $@ --upm $(TARGETUPM)
$(PASS3) : $(OBJDIR)/.pass3-%.ttf : pass3-finalize.py $(OBJDIR)/.pass2-%.ttf
fontforge -quiet -script $^ $@ $(TARGETUPM)
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass3-%.ttf
ttfautohint $< $@

View File

@ -33,7 +33,7 @@ define regular (
.italicangle 0
.longjut 175
.jut 70
.accent 153
.accent 155
.accentx 200
.tbalance 50

View File

@ -9,14 +9,10 @@ font = fontforge.open(source)
# Replace accented characters into references
print "Reference finding: ", font.fontname
font.selection.select(("ranges", "unicode", None), 0x1FCD, 0x1FCF, 0x1FDD, 0x1FDF)
font.replaceWithReference(4)
font.selection.none()
font.selection.select(("ranges", "unicode", None), 0x0300, 0x036F)
font.replaceWithReference(4)
font.selection.none()
font.selection.select(("ranges", "unicode", None), 0x0000, 0xFFFF)
font.replaceWithReference(4)
font.selection.none()
font.replaceWithReference(2)
font.selection.all()
font.selection.select(("less", None), "I.straight", "dotlessi.straight", "l.straight")
font.replaceWithReference(2)
# Remove overlapped area
print "Overlap Removal: ", font.fontname
@ -29,24 +25,19 @@ for i in font:
if len(glyph.references) > 0 and len(glyph.layers["Fore"]) > 0: # a mixed glyph
glyph.unlinkRef()
glyph.removeOverlap()
font.selection.all()
font.replaceWithReference(2)
# Outline simplify
print "Simplify, pass 1: ", font.fontname
font.simplify(1)
font.layers["Fore"].is_quadratic = False
font.selection.all()
font.simplify(font.em / 1000.0 * 0.5, ("smoothcurves", "choosehv"), 0.1);
font.simplify(font.em / 1000.0 * 0.75, ("smoothcurves", "choosehv"), 0.1)
print "Simplify, pass 2: ", font.fontname
oldem = font.em
font.em = 1000
font.round()
font.simplify(0.25)
font.transform(psMat.skew(-font.italicangle / 180 * math.pi))
for i in font:
font[i].addExtrema(("all"))
font.simplify(1, ("smoothcurves"), 0.05)
font.layers["Fore"].is_quadratic = True
font.transform(psMat.skew(-font.italicangle / 180 * math.pi))
print "Finalize: ", font.fontname
font.em = oldem

View File

@ -2,6 +2,8 @@ define bezierCubic2Q2 [require './toquad']
define tp [require './transform'].transformPoint
define utp [require './transform'].untransform
define Stroke [require './stroke'].Stroke
define Bezier [require 'bezier-js']
define [mix a b p] : a + [b - a] * p
define id (
.xx 1
@ -194,9 +196,34 @@ define [oncurveRemovable a b c] : begin {
return : [not a.onCurve] && b.onCurve && [not c.onCurve] && [a.x <= b.x && b.x <= c.x || a.x >= b.x && b.x >= c.x] && [a.y <= b.y && b.y <= c.y || a.y >= b.y && b.y >= c.y] && [Math.abs [b.x - xm]] <= 0.5 && [Math.abs [b.y - ym]] <= 0.5
}
define [Glyph.prototype.cleanup] : begin {
return this
foreach c [range 0 this.contours.length] : begin {
local contour this.contours.(c)
local ocontour this.contours.(c)
# add infections
local contour (ocontour.0)
foreach [j : range 1 [ocontour.length - 1]] : piecewise {
ocontour.(j).onCurve : contour.push ocontour.(j)
true : begin {
local p0 contour.[contour.length - 1]
local p1 ocontour.(j)
local p2 ocontour.[j + 1]
if [not p2.onCurve] : set p1 (.x [mix p1.x p2.x 0.5] .y [mix p1.y p2.y 0.5] .onCurve true)
local strand : new Bezier p0.x p0.y p1.x p1.y p2.x p2.y
local ts [strand.inflections].y
piecewise {
[!ts || ts.length < 1] : contour.push p1 p2
true : begin {
ts.unshift 0
ts.push 1
foreach [k : range 0 [ts.length - 1]] : begin {
local s : strand.split ts.(k) ts.[k + 1]
if s.points : contour.push (.x s.points.1.x .y s.points.1.y .onCurve false) (.x s.points.2.x .y s.points.2.y .onCurve true)
}
}
}
}
}
contour.push ocontour.[ocontour.length - 1]
# cleanup
local cleanedContour ()
foreach j [range 1 : contour.length - 1] : begin {
local p0 contour.[j - 1]

View File

@ -326,18 +326,6 @@ define [Stroke.prototype.to-outline d1 d2 _samples straight] : begin {
set j [k - 1]
}
set shape : shape.filter : function [point] [point && [not point.removable]]
# Remove removable midpoints
for [local j 1] [j < shape.length - 2] [inc j] : begin {
local p0 shape`j
local p1 shape`[j + 1]
local p2 shape`[j + 2]
if [[not p0.onCurve] && p1.onCurve && [not p2.onCurve] && [midclose p0 p1 p2]] : begin {
set p1.removable true
set j [j + 1]
}
}
set shape : shape.filter : function [point] [point && [not point.removable]]
return shape
}
}

View File

@ -4,7 +4,7 @@
<title>Iosevka</title>
<style>
html {
font-size: 12px;
font-size: 14px;
}
@font-face {
font-family: IosevkaWEB;
@ -225,7 +225,7 @@
var sampleSentences = [
{lang: 'English', sample: 'Shaw, those twelve beige hooks are joined if I patch a young, gooey mouth. Bl̓ood of m̧y ḃlȯod.'},
{lang: 'IPA', sample: '[aɪ kæn iːt glɑːs ænd ɪt dɐz nɒt hɜːt miː]'},
{lang: 'IPA', sample: '*ɢʷəʔ nraʔ lˁoŋ t.qʰa ʑi̪ə'},
{lang: 'Powerline', sample: '<span style="background:black;color:white"> NORMAL </span><span style="background:#ccc;color:black;font-style:normal">\uE0B0</span><span style="background:#ccc;color:black"> <span style="font-style:normal">\uE0A0</span> master <span style="font-style:normal">\uE0B1</span> glyphs/powerline.patel </span><span style="background:#eee;color:#ccc;font-style:normal">\uE0B0</span><span style="background:#eee;color:#555"> dos <span style="font-style:normal">\uE0B3</span> utf-8 <span style="font-style:normal">\uE0B3</span> PatEL </span><span style="background:#eee;color:#ccc;font-style:normal">\uE0B2</span><span style="background:#ccc"> 2% </span><span style="background:#ccc;color:black;font-style:normal">\uE0B2</span><span style="color:white;background:black"> \uE0A1 1:1 </span>'},
{lang: 'Bulgarian', sample: 'Я, пазачът Вальо уж бди, а скришом хапва кюфтенца зад щайгите.'},
{lang: 'Czech', sample: 'Nechť již hříšné saxofony ďáblů rozezvučí síň úděsnými tóny waltzu, tanga a quickstepu.'},