Added (true) italic shapes for /dotlessi, /i amd /l.

This commit is contained in:
be5invis 2015-08-12 05:42:40 +08:00
parent a9a59a2fe4
commit 24a294c7be
4 changed files with 81 additions and 16 deletions

View File

@ -360,7 +360,26 @@ create-glyph 'dotlessi.serifed' : glyph-construction {
include : rightwardBottomSerif MIDDLE 0 LONGJUT
include : leftwardBottomSerif MIDDLE 0 LONGJUT
}
select-variant 'dotlessi' 0x131 'serifed'
create-glyph 'dotlessi.italic' : glyph-construction {
local left : MIDDLE - HALFSTROKE
local right : mix SB RIGHTSB 1.1
local middle : mix left right 0.55
include : create-stroke
:.start-from left XH
:.set-width STROKE 0
:.heads-to DOWNWARD
:.line-to left [SMALLSMOOTHB * 0.7]
:.arc-vh-to [middle + OMIDCOR_S] O BKAPPA CKAPPA
:.curve-to [middle + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [right - middle]] O [right - OXHOOK + TAILADJX * globalTransform.yx] [SHOOK * 0.8 - TAILADJY * globalTransform.yx]
include : create-stroke
:.start-from [left - LONGJUT + ILBALANCE + HALFSTROKE] XH
:.set-width 0 STROKE
:.line-to left XH
include eMarks
set-anchor 'above' BASE [left + HALFSTROKE] XH
set-anchor 'below' BASE middle 0
}
select-variant 'dotlessi' 0x131 [if para.italicangle 'italic' 'serifed']
create-glyph 'i' : glyph-construction {
set-width WIDTH
@ -428,8 +447,29 @@ create-glyph 'l.serifed' : glyph-construction {
:.heads-to UPWARD
include : leftwardTopSerif [MIDDLE + balance] CAP [LONGJUT - balance]
include : centerBottomSerif MIDDLE 0 LONGJUT
set this.barx [MIDDLE + balance]
}
select-variant 'l' 'l' 'serifed'
create-glyph 'l.italic' : glyph-construction {
local left : mix SB RIGHTSB 0.3
local right : mix SB RIGHTSB 1.1
local middle : mix left right 0.54
include : create-stroke
:.start-from left CAP
:.set-width STROKE 0
:.heads-to DOWNWARD
:.line-to left [SMALLSMOOTHB * 0.75]
:.arc-vh-to [middle + OMIDCOR_S] O BKAPPA CKAPPA
:.curve-to [middle + [KAPPA_HOOK + TAILADJKAPPA * globalTransform.yx] * [right - middle]] O [right - OXHOOK + TAILADJX * globalTransform.yx] [SHOOK - TAILADJY * globalTransform.yx]
include : create-stroke
:.start-from SB CAP
:.set-width 0 STROKE
:.line-to left CAP
include bMarks
set-anchor 'above' BASE [left + HALFSTROKE] CAP
set-anchor 'below' BASE middle 0
set this.barx [left + HALFSTROKE]
}
select-variant 'l' 'l' [if para.italicangle 'italic' 'serifed']
### x v w y z k
create-glyph 'x' : glyph-construction {

View File

@ -51,13 +51,10 @@ create-glyph 'OE' : glyph-construction {
include : create-stroke
:.start-from [eleft + 1] CAP
:.set-width sw 0
:.heads-to LEFTWARD
:.line-to eleft CAP
:.heads-to LEFTWARD
:.line-to [eleft - OMIDCOR_S] CAP
:.arc-hv-to SB [CAP - SMOOTHA]
:.line-to SB SMOOTHB
:.arc-vh-to eleft 0
:.heads-to RIGHTWARD
:.line-to [eleft + 1] 0
:.heads-to RIGHTWARD
@ -470,10 +467,11 @@ create-glyph 'lslash' : glyph-construction {
include glyphs.l AS_BASE
local fine : 0.5 * [adviceBlackness 5]
local middle : mix 0 CAP 0.55
local middlex [tp [Upright] glyphs.l.anchors.above].x
include : create-stroke
:.start-from [MIDDLE - LONGJUT * 0.8] [middle - LONGJUT * 0.4]
:.start-from [middlex - LONGJUT * 0.8] [middle - LONGJUT * 0.4]
:.set-width fine fine
:.line-to [MIDDLE + LONGJUT * 0.8] [middle + LONGJUT * 0.4]
:.line-to [middlex + LONGJUT * 0.8] [middle + LONGJUT * 0.4]
}
# bdot and ddot 's dots are closer to the glyph
create-glyph 'bdot' : glyph-construction {
@ -520,3 +518,25 @@ create-glyph 'iogonek.dotless' : glyph-construction {
include glyphs.dotlessi AS_BASE
include glyphs.ogonekBelow
}
# compatibility ligatures
create-glyph 'f_i' : glyph-construction {
assign-unicode 0xFB01
include bMarks
include : create-glyph : glyph-construction {
include glyphs.longs
apply-transform : Translate [-[MIDDLE - HALFSTROKE - SB * 2]] 0
}
include : VBarRight [RIGHTSB - SB * 0.5] 0 XH
include : HBarTop SB [RIGHTSB - SB * 0.5] XH
}
create-glyph 'f_l' : glyph-construction {
assign-unicode 0xFB02
include bMarks
include : create-glyph : glyph-construction {
include glyphs.longs
apply-transform : Translate [-[MIDDLE - HALFSTROKE - SB * 2]] 0
}
include : VBarRight [RIGHTSB - SB * 0.5] 0 CAP
include : HBarTop SB [STROKE + SB * 4] XH
}

View File

@ -18,9 +18,10 @@ font.selection.all()
font.removeOverlap()
font.round()
font.removeOverlap()
font.simplify(1)
font.addExtrema()
font.simplify(2)
font.layers["Fore"].is_quadratic = False
font.simplify(4, ("smoothcurves", "removesingletonpoints", "setstarttoextremum"), 0.2)
font.simplify(6, ("smoothcurves", "removesingletonpoints", "setstarttoextremum"), 0.2)
font.canonicalContours()
font.canonicalStart()
font.generate(sys.argv[3], flags = ("short-post", "opentype"))

View File

@ -20,6 +20,7 @@ define KAPPA 0.51
define COKAPPA : 1 - KAPPA
define BKAPPA : KAPPA + 0.1
define COBKAPPA : COKAPPA - 0.1
define CKAPPA BKAPPA
define [Stroke] : begin {
this.points = ()
@ -46,6 +47,7 @@ define [Stroke.bindParameters para] : begin {
COKAPPA = 1 - KAPPA
COBKAPPA = COKAPPA - 0.1
BKAPPA = KAPPA + 0.1
CKAPPA = para.ckappa || BKAPPA
}
define [Stroke.prototype.set-width d1 d2] : begin {
local point this.points`[this.points.length - 1]
@ -79,16 +81,18 @@ define [Stroke.prototype.cubic-to x1 y1 x2 y2 x y] : begin {
this.points.push [tp this.gizmo (.x x1 .y y1 .onCurve false .cubic true)] [tp this.gizmo (.x x2 .y y2 .onCurve false .cubic true)] [tp this.gizmo (.x x .y y .onCurve true)]
return this
}
define [Stroke.prototype.arc-vh-to x y _kappa] : begin {
local kappa : fallback _kappa BKAPPA
define [Stroke.prototype.arc-vh-to x y _kappah _kappav] : begin {
local kappah : fallback _kappah BKAPPA
local kappav : fallback _kappav _kappah CKAPPA
local last :utp this.gizmo this.points`[this.points.length - 1]
this.cubic-to last.x [last.y + kappa * [y - last.y]] [x + kappa * [last.x - x]] y x y
this.cubic-to last.x [last.y + kappav * [y - last.y]] [x + kappah * [last.x - x]] y x y
return this
}
define [Stroke.prototype.arc-hv-to x y _kappa] : begin {
local kappa : fallback _kappa BKAPPA
define [Stroke.prototype.arc-hv-to x y _kappah _kappav] : begin {
local kappah : fallback _kappah BKAPPA
local kappav : fallback _kappav _kappah CKAPPA
local last :utp this.gizmo this.points`[this.points.length - 1]
this.cubic-to [last.x + kappa * [x - last.x]] last.y x [y + kappa * [last.y - y]] x y
this.cubic-to [last.x + kappah * [x - last.x]] last.y x [y + kappav * [last.y - y]] x y
return this
}
define [Stroke.prototype.set-samples samples] : begin {