Added localized Cyrillic letters for Serbian.

This commit is contained in:
be5invis 2015-10-11 03:19:11 +08:00
parent ec873b1fb1
commit 64c7d21d73
14 changed files with 125 additions and 42 deletions

View file

@ -388,16 +388,16 @@ define [buildFont para recursive] : begin
if closed if closed
then then
local g : new Glyph 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 local lhsContour g.contours.0
set g.contours {} 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 local rhsContour g.contours.0
set g.contours {[lhsContour.concat rhsContour]} set g.contours {[lhsContour.concat rhsContour]}
else else
local g : new Glyph local g : new Glyph
lhs.0.type = rhs.0.type = lhs.(lhs.length - 1).type = rhs.(rhs.length - 1).type = 'corner' 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 return g.contours
define [spiro-outline] : let [k : {}.slice.call arguments 0] : glyph-construction define [spiro-outline] : let [k : {}.slice.call arguments 0] : glyph-construction
local {.knots knots .closed closed .lastafs lastafs} : prepareSpiroKnots k this local {.knots knots .closed closed .lastafs lastafs} : prepareSpiroKnots k this

9
features/italiconly.fea Normal file
View file

@ -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;

9
features/uprightonly.fea Normal file
View file

@ -0,0 +1,9 @@
lookup loclSerbian {
sub [cyrbe] by [cyrbe.serbian];
} loclSerbian;
feature locl {
script cyrl;
language SRB exclude_dflt;
lookup loclSerbian;
} locl;

View file

@ -256,7 +256,19 @@ define [createSMCPs records] : if [not recursive] : begin
include sf.(glyphid) AS_BASE include sf.(glyphid) AS_BASE
if tfm : include tfm 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 define [createFractions records] : if [not recursive] : begin
local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2 local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2
@ -555,6 +567,20 @@ createFractions : list
# fraction bar # fraction bar
list null 'space' 'space' 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 # Ligatures
define [createLigature unicode] : begin define [createLigature unicode] : begin

View file

@ -145,6 +145,8 @@ create-glyph 'cyrbe' : glyph-construction
alsothruthem [list {0.25 0.79} {0.5 0.87}] important alsothruthem [list {0.25 0.79} {0.5 0.87}] important
g4 (RIGHTSB - HALFSTROKE * CORRECTION_HX) CAP g4 (RIGHTSB - HALFSTROKE * CORRECTION_HX) CAP
alias 'cyrbe.serbian' null 'delta'
create-glyph 'cyrve.italic' : glyph-construction create-glyph 'cyrve.italic' : glyph-construction
include eMarks include eMarks
@ -190,6 +192,10 @@ create-glyph 'cyrghe.italic' : glyph-construction
hookend O SBALANCE hookend O SBALANCE
g4 RIGHTSB SHOOK g4 RIGHTSB SHOOK
create-glyph 'cyrghe.serbian' : glyph-construction
include glyphs.dotlessi AS_BASE
include glyphs.macronAbove
italic-variant 'cyrghe' 0x433 italic-variant 'cyrghe' 0x433
define [CyrDeShape top] : glyph-construction define [CyrDeShape top] : glyph-construction
local cutleft : mix SB RIGHTSB 0.2 local cutleft : mix SB RIGHTSB 0.2
@ -220,6 +226,8 @@ create-glyph 'cyrde.italic' : glyph-construction
quadcontrols 0 0.8 quadcontrols 0 0.8
g4 (SB + STROKE * 1.1) CAP g4 (SB + STROKE * 1.1) CAP
alias 'cyrde.serbian' null 'g.singlestorey'
italic-variant 'cyrde' 0x434 italic-variant 'cyrde' 0x434
define [CyrZheShape top] : glyph-construction define [CyrZheShape top] : glyph-construction
local fine : adviceBlackness 3.3 local fine : adviceBlackness 3.3
@ -480,3 +488,12 @@ create-glyph 'cyrya' : glyph-construction
assign-unicode 0x44F assign-unicode 0x44F
include eMarks include eMarks
include : CyrYaShape XH 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

View file

@ -19,25 +19,20 @@ alias 'omicron' 0x3BF 'o'
# Capital # Capital
define [LambdaShape STROKE] : glyph-construction define [LambdaShape STROKE] : glyph-construction
local TURN (XH * 0.1) local TURN (CAP * 0.1)
local curviness 0.1 local curviness 0.2
include : create-stroke include : spiro
:.start-from SB 0 widths.rhs STROKE
:.heads-to UPWARD flat SB 0 [heading UPWARD]
:.set-width 0 STROKE curl SB TURN [heading UPWARD]
:.line-to SB TURN quadcontrols 0 curviness
:.heads-to UPWARD g4 (MIDDLE - STROKE / 2) CAP [widths 0 (STROKE * 0.8)]
:.curve-to SB [mix TURN CAP curviness] (MIDDLE - STROKE / 2) CAP include : spiro
:.set-width 0 (STROKE * 0.8) widths.lhs STROKE
flat RIGHTSB 0 [heading UPWARD]
include : create-stroke curl RIGHTSB TURN [heading UPWARD]
:.start-from RIGHTSB 0 quadcontrols 0 curviness
:.heads-to UPWARD g4 (MIDDLE + STROKE / 2) CAP [widths (STROKE * 0.8) 0]
:.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
start-from (MIDDLE - STROKE / 2) CAP start-from (MIDDLE - STROKE / 2) CAP
line-to (MIDDLE + STROKE / 2) CAP line-to (MIDDLE + STROKE / 2) CAP

View file

@ -81,9 +81,9 @@ create-glyph 'd' : glyph-construction
:.heads-to UPWARD :.heads-to UPWARD
:.to-outline :.to-outline
create-glyph 'g' : glyph-construction create-glyph 'g.doublestorey' : glyph-construction
set-width WIDTH set-width WIDTH
assign-unicode 'g' #assign-unicode 'g'
include pMarks include pMarks
include : smallo XH (XH * GBARPOS - O) SB (RIGHTSB - 0.3 * SB) include : smallo XH (XH * GBARPOS - O) SB (RIGHTSB - 0.3 * SB)
@ -110,7 +110,13 @@ create-glyph 'g' : glyph-construction
line-to MIDDLE XH line-to MIDDLE XH
set-anchor 'overlay' BASE MIDDLE [mix (DESCENDER + O) groundy 0.5] 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 ### c e t
create-glyph 'c' : glyph-construction create-glyph 'c' : glyph-construction

View file

@ -628,12 +628,7 @@ create-glyph 'latinupsilon2' : glyph-construction
include eMarks include eMarks
include : LatinUpsilon2Shape XH SMALLSMOOTHA SMALLSMOOTHB include : LatinUpsilon2Shape XH SMALLSMOOTHA SMALLSMOOTHB
create-glyph 'scriptg' : glyph-construction alias 'scriptg' 0x261 'g.singlestorey'
assign-unicode 0x261
include pMarks
include : oRight
include : sHookLower DESCENDER SMALLSMOOTHA SHOOK
include : VBarRight RIGHTSB (DESCENDER + SMALLSMOOTHA) XH
define [RamsHornShape bottom top] : glyph-construction define [RamsHornShape bottom top] : glyph-construction
local hf : [adviceBlackness 4] / 2 local hf : [adviceBlackness 4] / 2

View file

@ -200,6 +200,26 @@ create-glyph 'eight' : glyph-construction
arcvh 1 arcvh 1
close 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 create-glyph 'nine' : glyph-construction
include capitalMarks include capitalMarks

View file

@ -54,15 +54,13 @@ create-glyph 'infty' : glyph-construction
create-glyph 'propto' : glyph-construction create-glyph 'propto' : glyph-construction
assign-unicode 0x221D assign-unicode 0x221D
local s : (RIGHTSB - SB - O * 2) / (CAP - SMOOTH) local s : (RIGHTSB - SB - O * 4) / CAP
include [Miniature {'eight'} 5 s].eight include [Miniature {'rotetedpropto'} 5 s].rotetedpropto
this.contours.pop
this.contours.pop
apply-transform : Upright apply-transform : Upright
apply-transform : Translate (-MIDDLE) (-CAP / 2) apply-transform : Translate (-MIDDLE) (-CAP / 2)
apply-transform : Rotate (Math.PI / 2) apply-transform : Rotate (Math.PI / 2)
apply-transform : Scale s apply-transform : Scale s
apply-transform : Translate (MIDDLE + SMOOTH / 2 * s) parenMid apply-transform : Translate MIDDLE parenMid
apply-transform : Italify apply-transform : Italify
create-glyph 'partial' : glyph-construction create-glyph 'partial' : glyph-construction

View file

@ -6,12 +6,15 @@ OBJDIR = build
SUPPRESS_ERRORS = 2> /dev/null 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)) MAPS = $(subst .ttf,.charmap,$(TARGETS))
OTFS = $(subst .ttf,.otf,$(TARGETS)) OTFS = $(subst .ttf,.otf,$(TARGETS))
PASS0 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS)) PASS0 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass0-,$(TARGETS))
ABFEAT = $(subst .ttf,.ab.fea,$(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)) PASS1 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass1-,$(TARGETS))
PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS)) PASS2 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass2-,$(TARGETS))
PASS3 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass3-,$(TARGETS)) PASS3 = $(subst $(OBJDIR)/,$(OBJDIR)/.pass3-,$(TARGETS))
@ -44,8 +47,11 @@ $(ABFEAT) : $(OBJDIR)/.pass0-%.ab.fea : $(OBJDIR)/.pass0-%.ttf
-@echo Autobuild feature $@ from $< -@echo Autobuild feature $@ from $<
$(MAPS) : $(OBJDIR)/%.charmap : $(OBJDIR)/.pass0-%.ttf $(MAPS) : $(OBJDIR)/%.charmap : $(OBJDIR)/.pass0-%.ttf
-@echo Autobuild CM $@ from $< -@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 $^ > $@ cat $^ > $@
$(FEATITA) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.fea features/italiconly.fea
cat $^ > $@
# Pass 1 : Outline cleanup and merge # Pass 1 : Outline cleanup and merge
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf $(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf

View file

@ -6,7 +6,7 @@
"node-sfnt" : ">=0.0.20", "node-sfnt" : ">=0.0.20",
"bezier-js" : "*", "bezier-js" : "*",
"yargs" : "*", "yargs" : "*",
"libspiro-js" : ">=0.2.1", "libspiro-js" : ">=0.3.0",
"toml": ">=2.3.0", "toml": ">=2.3.0",
"unorm": ">=1.4.1" "unorm": ">=1.4.1"
} }

View file

@ -34,9 +34,10 @@ if len(sys.argv) <= 3:
# Outline simplify # Outline simplify
print "Simplify, pass 1: ", font.fontname print "Simplify, pass 1: ", font.fontname
font.simplify(0.1)
font.layers["Fore"].is_quadratic = False font.layers["Fore"].is_quadratic = False
font.selection.all() 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 print "Simplify, pass 2: ", font.fontname
oldem = font.em oldem = font.em

View file

@ -62,6 +62,7 @@ define [Glyph.prototype.curve-control x y] : begin
define [Glyph.prototype.curve-to xc yc 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}] 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 return this
Glyph.prototype.curveTo = Glyph.prototype.curve-to
define [Glyph.prototype.arc-vh-to x y kappa] : begin define [Glyph.prototype.arc-vh-to x y kappa] : begin
local lastContour this.contours.((this.contours.length - 1)) local lastContour this.contours.((this.contours.length - 1))