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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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"
}

View File

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

View File

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