From 64c7d21d73b9f8c697a57d84b9e1a9d7d08827ff Mon Sep 17 00:00:00 2001 From: be5invis Date: Sun, 11 Oct 2015 03:19:11 +0800 Subject: [PATCH] Added localized Cyrillic letters for Serbian. --- buildglyphs.patel | 6 +++--- features/italiconly.fea | 9 +++++++++ features/uprightonly.fea | 9 +++++++++ glyphs/autobuilds.patel | 28 +++++++++++++++++++++++++- glyphs/cyrillic-basic.patel | 17 ++++++++++++++++ glyphs/greek.patel | 35 ++++++++++++++------------------- glyphs/latin-basic-lower.patel | 10 ++++++++-- glyphs/latin-extend-basis.patel | 7 +------ glyphs/numbers.patel | 20 +++++++++++++++++++ glyphs/symbol-math.patel | 8 +++----- makefile | 12 ++++++++--- package.json | 2 +- pass1-cleanup.py | 3 ++- support/glyph.patel | 1 + 14 files changed, 125 insertions(+), 42 deletions(-) create mode 100644 features/italiconly.fea create mode 100644 features/uprightonly.fea diff --git a/buildglyphs.patel b/buildglyphs.patel index c0d426a..f989267 100644 --- a/buildglyphs.patel +++ b/buildglyphs.patel @@ -388,16 +388,16 @@ define [buildFont para recursive] : begin if closed then local g : new Glyph - libspiro.spiroToBezierOnContext [lhs.slice 0 (-1)] true g + libspiro.spiroToBezierOnContext [lhs.slice 0 (-1)] true g true local lhsContour g.contours.0 set g.contours {} - libspiro.spiroToBezierOnContext [rhs.reverse :.slice 0 (-1)] true g + libspiro.spiroToBezierOnContext [rhs.reverse :.slice 0 (-1)] true g true local rhsContour g.contours.0 set g.contours {[lhsContour.concat rhsContour]} 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 + libspiro.spiroToBezierOnContext [lhs.concat : rhs.reverse] true g true return g.contours define [spiro-outline] : let [k : {}.slice.call arguments 0] : glyph-construction local {.knots knots .closed closed .lastafs lastafs} : prepareSpiroKnots k this diff --git a/features/italiconly.fea b/features/italiconly.fea new file mode 100644 index 0000000..1552828 --- /dev/null +++ b/features/italiconly.fea @@ -0,0 +1,9 @@ +lookup loclSerbian { + sub [cyrbe cyrghe cyrde cyrpe cyrte] by [cyrbe.serbian cyrghe.serbian cyrde.serbian cyrpe.serbian cyrte.serbian]; +} loclSerbian; + +feature locl { + script cyrl; + language SRB exclude_dflt; + lookup loclSerbian; +} locl; \ No newline at end of file diff --git a/features/uprightonly.fea b/features/uprightonly.fea new file mode 100644 index 0000000..e702640 --- /dev/null +++ b/features/uprightonly.fea @@ -0,0 +1,9 @@ +lookup loclSerbian { + sub [cyrbe] by [cyrbe.serbian]; +} loclSerbian; + +feature locl { + script cyrl; + language SRB exclude_dflt; + lookup loclSerbian; +} locl; \ No newline at end of file diff --git a/glyphs/autobuilds.patel b/glyphs/autobuilds.patel index ec6ba7c..73d8ea0 100644 --- a/glyphs/autobuilds.patel +++ b/glyphs/autobuilds.patel @@ -256,7 +256,19 @@ define [createSMCPs records] : if [not recursive] : begin include sf.(glyphid) AS_BASE if tfm : include tfm - +define [createMedievalCombs 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 [suggestName : 'smcp' + glyphid] : glyph-construction + set-width 0 + if unicode : assign-unicode unicode + include miniatureFont.(glyphid) + apply-transform : Upright + apply-transform : Translate (-MIDDLE) 0 + apply-transform : Scale 0.4 + apply-transform : Translate markMiddle aboveMarkBot + apply-transform : Italify + set-anchor 'above' MARK markMiddle XH markMiddle aboveMarkTop define [createFractions records] : if [not recursive] : begin local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2 @@ -555,6 +567,20 @@ createFractions : list # fraction bar list null 'space' 'space' +createMedievalCombs : list + list 0x363 'a' + list 0x364 'e' + list 0x365 'i' + list 0x366 'o' + list 0x367 'u' + list 0x368 'c' + list 0x369 'd' + list 0x36A 'h' + list 0x36B 'm' + list 0x36C 'r' + list 0x36D 't' + list 0x36E 'v' + list 0x36F 'x' # Ligatures define [createLigature unicode] : begin diff --git a/glyphs/cyrillic-basic.patel b/glyphs/cyrillic-basic.patel index 5a4ed43..f118ffc 100644 --- a/glyphs/cyrillic-basic.patel +++ b/glyphs/cyrillic-basic.patel @@ -145,6 +145,8 @@ create-glyph 'cyrbe' : glyph-construction alsothruthem [list {0.25 0.79} {0.5 0.87}] important g4 (RIGHTSB - HALFSTROKE * CORRECTION_HX) CAP +alias 'cyrbe.serbian' null 'delta' + create-glyph 'cyrve.italic' : glyph-construction include eMarks @@ -189,6 +191,10 @@ create-glyph 'cyrghe.italic' : glyph-construction g4 SB (SMOOTHB * 0.85) [widths STROKE 0] hookend O SBALANCE g4 RIGHTSB SHOOK + +create-glyph 'cyrghe.serbian' : glyph-construction + include glyphs.dotlessi AS_BASE + include glyphs.macronAbove italic-variant 'cyrghe' 0x433 define [CyrDeShape top] : glyph-construction @@ -220,6 +226,8 @@ create-glyph 'cyrde.italic' : glyph-construction quadcontrols 0 0.8 g4 (SB + STROKE * 1.1) CAP +alias 'cyrde.serbian' null 'g.singlestorey' + italic-variant 'cyrde' 0x434 define [CyrZheShape top] : glyph-construction local fine : adviceBlackness 3.3 @@ -480,3 +488,12 @@ create-glyph 'cyrya' : glyph-construction assign-unicode 0x44F include eMarks include : CyrYaShape XH + +# Serbian pe and te +create-glyph 'cyrpe.serbian' : glyph-construction + include glyphs.u AS_BASE + include glyphs.macronAbove + +create-glyph 'cyrte.serbian' : glyph-construction + include glyphs.'cyrsha.italic' AS_BASE + include glyphs.macronAbove \ No newline at end of file diff --git a/glyphs/greek.patel b/glyphs/greek.patel index 652d03b..64575f0 100644 --- a/glyphs/greek.patel +++ b/glyphs/greek.patel @@ -19,26 +19,21 @@ alias 'omicron' 0x3BF 'o' # Capital define [LambdaShape STROKE] : glyph-construction - local TURN (XH * 0.1) - local curviness 0.1 - include : create-stroke - :.start-from SB 0 - :.heads-to UPWARD - :.set-width 0 STROKE - :.line-to SB TURN - :.heads-to UPWARD - :.curve-to SB [mix TURN CAP curviness] (MIDDLE - STROKE / 2) CAP - :.set-width 0 (STROKE * 0.8) - - include : create-stroke - :.start-from RIGHTSB 0 - :.heads-to UPWARD - :.set-width STROKE 0 - :.line-to RIGHTSB TURN - :.heads-to UPWARD - :.curve-to RIGHTSB [mix TURN CAP curviness] (MIDDLE + STROKE / 2) CAP - :.set-width (STROKE * 0.8) 0 - + local TURN (CAP * 0.1) + local curviness 0.2 + include : spiro + widths.rhs STROKE + flat SB 0 [heading UPWARD] + curl SB TURN [heading UPWARD] + quadcontrols 0 curviness + g4 (MIDDLE - STROKE / 2) CAP [widths 0 (STROKE * 0.8)] + include : spiro + widths.lhs STROKE + flat RIGHTSB 0 [heading UPWARD] + curl RIGHTSB TURN [heading UPWARD] + quadcontrols 0 curviness + g4 (MIDDLE + STROKE / 2) CAP [widths (STROKE * 0.8) 0] + start-from (MIDDLE - STROKE / 2) CAP line-to (MIDDLE + STROKE / 2) CAP line-to MIDDLE (CAP - STROKE) diff --git a/glyphs/latin-basic-lower.patel b/glyphs/latin-basic-lower.patel index d2149c2..c9e2913 100644 --- a/glyphs/latin-basic-lower.patel +++ b/glyphs/latin-basic-lower.patel @@ -81,9 +81,9 @@ create-glyph 'd' : glyph-construction :.heads-to UPWARD :.to-outline -create-glyph 'g' : glyph-construction +create-glyph 'g.doublestorey' : glyph-construction set-width WIDTH - assign-unicode 'g' + #assign-unicode 'g' include pMarks include : smallo XH (XH * GBARPOS - O) SB (RIGHTSB - 0.3 * SB) @@ -110,7 +110,13 @@ create-glyph 'g' : glyph-construction line-to MIDDLE XH set-anchor 'overlay' BASE MIDDLE [mix (DESCENDER + O) groundy 0.5] +create-glyph 'g.singlestorey' : glyph-construction + include pMarks + include : oRight + include : sHookLower DESCENDER SMALLSMOOTHA SHOOK + include : VBarRight RIGHTSB (DESCENDER + SMALLSMOOTHA) XH +select-variant 'g' 'g' 'doublestorey' ### c e t create-glyph 'c' : glyph-construction diff --git a/glyphs/latin-extend-basis.patel b/glyphs/latin-extend-basis.patel index 7bdaf8e..92498b8 100644 --- a/glyphs/latin-extend-basis.patel +++ b/glyphs/latin-extend-basis.patel @@ -628,12 +628,7 @@ create-glyph 'latinupsilon2' : glyph-construction include eMarks include : LatinUpsilon2Shape XH SMALLSMOOTHA SMALLSMOOTHB -create-glyph 'scriptg' : glyph-construction - assign-unicode 0x261 - include pMarks - include : oRight - include : sHookLower DESCENDER SMALLSMOOTHA SHOOK - include : VBarRight RIGHTSB (DESCENDER + SMALLSMOOTHA) XH +alias 'scriptg' 0x261 'g.singlestorey' define [RamsHornShape bottom top] : glyph-construction local hf : [adviceBlackness 4] / 2 diff --git a/glyphs/numbers.patel b/glyphs/numbers.patel index 0eb069c..e662f65 100644 --- a/glyphs/numbers.patel +++ b/glyphs/numbers.patel @@ -200,6 +200,26 @@ create-glyph 'eight' : glyph-construction arcvh 1 close +# There is an "eight without lower contour" shape used for /propto +create-glyph 'rotetedpropto' : glyph-construction + local sma : SMOOTHA * 0.975 + CORRECTION_VS * CORRECTION_HX + local smb : SMOOTHB * 0.975 - CORRECTION_VS * CORRECTION_HX + + local p 0.96 + local py 0.6 + + include : spiro + flat (RIGHTSB - STROKE) 0 [widths 0 STROKE] + curl (RIGHTSB - STROKE) 1 [widths 0 STROKE] + alsothru 0.5 py [widths (STROKE * py) (STROKE * (1 - py))] + g4 ([mix RIGHTSB SB p] + STROKE) (CAP - sma * p) [widths STROKE 0] + arcvh 1 + g4 (MIDDLE - CORRECTION_OMIDS + CORRECTION_VS) (CAP - O - STROKE) + archv 1 + g4 ([mix SB RIGHTSB p] - STROKE) (CAP - smb * p) + alsothru 0.5 (1 - py) [widths (STROKE * py) (STROKE * (1 - py))] + flat (SB + STROKE) 1 [widths 0 STROKE] + curl (SB + STROKE) 0 [widths 0 STROKE] create-glyph 'nine' : glyph-construction include capitalMarks diff --git a/glyphs/symbol-math.patel b/glyphs/symbol-math.patel index 7d9a245..2a9fe9d 100644 --- a/glyphs/symbol-math.patel +++ b/glyphs/symbol-math.patel @@ -54,15 +54,13 @@ create-glyph 'infty' : glyph-construction create-glyph 'propto' : glyph-construction assign-unicode 0x221D - local s : (RIGHTSB - SB - O * 2) / (CAP - SMOOTH) - include [Miniature {'eight'} 5 s].eight - this.contours.pop - this.contours.pop + local s : (RIGHTSB - SB - O * 4) / CAP + include [Miniature {'rotetedpropto'} 5 s].rotetedpropto apply-transform : Upright apply-transform : Translate (-MIDDLE) (-CAP / 2) apply-transform : Rotate (Math.PI / 2) apply-transform : Scale s - apply-transform : Translate (MIDDLE + SMOOTH / 2 * s) parenMid + apply-transform : Translate MIDDLE parenMid apply-transform : Italify create-glyph 'partial' : glyph-construction diff --git a/makefile b/makefile index 3796f0c..47faaa4 100644 --- a/makefile +++ b/makefile @@ -6,12 +6,15 @@ OBJDIR = build SUPPRESS_ERRORS = 2> /dev/null -TARGETS = $(OBJDIR)/iosevka-regular.ttf $(OBJDIR)/iosevka-bold.ttf $(OBJDIR)/iosevka-italic.ttf $(OBJDIR)/iosevka-bolditalic.ttf $(OBJDIR)/iosevkacc-regular.ttf $(OBJDIR)/iosevkacc-bold.ttf $(OBJDIR)/iosevkacc-italic.ttf $(OBJDIR)/iosevkacc-bolditalic.ttf +UPRIGHT = $(OBJDIR)/iosevka-regular.ttf $(OBJDIR)/iosevka-bold.ttf $(OBJDIR)/iosevkacc-regular.ttf $(OBJDIR)/iosevkacc-bold.ttf +ITALIC = $(OBJDIR)/iosevka-italic.ttf $(OBJDIR)/iosevka-bolditalic.ttf $(OBJDIR)/iosevkacc-italic.ttf $(OBJDIR)/iosevkacc-bolditalic.ttf +TARGETS = $(UPRIGHT) $(ITALIC) MAPS = $(subst .ttf,.charmap,$(TARGETS)) OTFS = $(subst .ttf,.otf,$(TARGETS)) PASS0 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)) ABFEAT = $(subst .ttf,.ab.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))) -FEATURE = $(subst .ttf,.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))) +FEATURE = $(subst .ttf,.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(UPRIGHT))) +FEATITA = $(subst .ttf,.fea,$(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(ITALIC))) PASS1 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS)) PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS)) PASS3 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass3-,$(TARGETS)) @@ -44,8 +47,11 @@ $(ABFEAT) : $(OBJDIR)/.pass0-%.ab.fea : $(OBJDIR)/.pass0-%.ttf -@echo Autobuild feature $@ from $< $(MAPS) : $(OBJDIR)/%.charmap : $(OBJDIR)/.pass0-%.ttf -@echo Autobuild CM $@ from $< -$(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.fea +$(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.fea features/uprightonly.fea cat $^ > $@ +$(FEATITA) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.fea features/italiconly.fea + cat $^ > $@ + # Pass 1 : Outline cleanup and merge $(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf diff --git a/package.json b/package.json index 0bf53c9..5e38b04 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "node-sfnt" : ">=0.0.20", "bezier-js" : "*", "yargs" : "*", - "libspiro-js" : ">=0.2.1", + "libspiro-js" : ">=0.3.0", "toml": ">=2.3.0", "unorm": ">=1.4.1" } diff --git a/pass1-cleanup.py b/pass1-cleanup.py index 7c5bea6..2e1017d 100644 --- a/pass1-cleanup.py +++ b/pass1-cleanup.py @@ -34,9 +34,10 @@ if len(sys.argv) <= 3: # Outline simplify print "Simplify, pass 1: ", font.fontname +font.simplify(0.1) font.layers["Fore"].is_quadratic = False font.selection.all() -font.simplify(font.em / 1000.0 * 0.75, ("smoothcurves", "choosehv"), 0.1) +font.simplify(font.em / 1000.0 * 0.5, ("smoothcurves", "choosehv"), 0.1) print "Simplify, pass 2: ", font.fontname oldem = font.em diff --git a/support/glyph.patel b/support/glyph.patel index 3153d7f..1efb0f5 100644 --- a/support/glyph.patel +++ b/support/glyph.patel @@ -62,6 +62,7 @@ define [Glyph.prototype.curve-control x y] : begin define [Glyph.prototype.curve-to xc yc x y] : begin this.contours.((this.contours.length - 1)).push [tp this.gizmo {.x xc .y yc .onCurve false}] [tp this.gizmo {.x x .y y .onCurve true}] return this +Glyph.prototype.curveTo = Glyph.prototype.curve-to define [Glyph.prototype.arc-vh-to x y kappa] : begin local lastContour this.contours.((this.contours.length - 1))