Now ellipsises for Iosevka CC is full-width, as well as circled letters and numbers.

This commit is contained in:
be5invis 2015-08-30 18:33:22 +08:00
parent dd0eae9ecf
commit 5a8a724b1a
7 changed files with 42 additions and 27 deletions

View File

@ -349,12 +349,10 @@ define [buildFont para recursive] : begin {
local samples : fallback _samples 5
local tiny 0.005
local rs ()
# if [not notiny] : rs.push ([bez3 0 x1 x2 1 tiny] [bez3 0 y1 y2 1 tiny] 1)
foreach j [range 1 samples] : rs.push : list {
bez3 0 x1 x2 1 [mix tiny [1 - tiny] [j / samples]]
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 raf
}
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

View File

@ -175,23 +175,27 @@ define [suggestName name] : begin {
# Build miniature clyphs : circled, superscripts, subscripts...
define [createCircledGlyphs records] : if [not recursive] : begin {
local dscale 0.45
local dscale 0.55
local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.65
local miniatureFont : Miniature pendingGlyphs 4 0.65
foreach (unicode glyphid _scale shift) [items-of records] : create-glyph [suggestName : 'circle' + glyphid] : glyph-construction {
local scale : fallback _scale dscale
foreach (unicode glyphid w) [items-of records] : create-glyph [suggestName : 'circle' + glyphid] : glyph-construction {
local width : fallback w WIDTH
set-width width
local sw [adviceBlackness 6]
if unicode : assign-unicode unicode
include : create-glyph [suggestName : 'circleinner' + glyphid] : glyph-construction {
include miniatureFont.(glyphid)
local g miniatureFont.(glyphid)
include g
local shift 0
if [g.anchors.above && g.anchors.below] : set shift : CAP / 2 - [mix g.anchors.above.y g.anchors.below.y 0.5]
apply-transform : Upright
apply-transform : Translate [-WIDTH / 2] [-CAP / 2 + [fallback shift 0]]
apply-transform : Scale scale
apply-transform : Translate [WIDTH / 2] [CAP / 2 * dscale]
apply-transform : Translate [-WIDTH / 2] [-CAP / 2 + shift]
apply-transform : Scale dscale
apply-transform : Translate [width / 2] [CAP / 2 * dscale]
apply-transform : Italify
}
include : smallo [CAP * dscale + sw * 2.5] [-sw * 2.5] [SB + O * 3] [RIGHTSB - O * 3] sw
include : smallo [CAP * dscale + sw * 3] [-sw * 3] [Math.max [SB + O * 3] [width / 2 - CAP / 2 * dscale - sw * 2.5]] [Math.min [width - SB - O * 3] [width / 2 + CAP / 2 * dscale + sw * 2.5]] sw [SMALLSMOOTHA * width / WIDTH] [SMALLSMOOTHB * width / WIDTH]
apply-transform : Upright
apply-transform : Translate 0 [parenMid - CAP * dscale / 2]
apply-transform : Italify
@ -264,11 +268,12 @@ if [not recursive] : createCircledGlyphs : [list {
list 0xA9 'C'
list 0xAE 'R'
list 0x2117 'P'
list null 'space' # a blank circle glyph for size optimization
list 0x24EA 'zero' FULLWIDTH
list null 'space' FULLWIDTH # 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])
foreach [j : range 1 till 9] : a.push ([0x2460 + j - 1] unicodeGlyphs.[['0'.charCodeAt 0] + j].name FULLWIDTH)
foreach [j : range 0 26] : a.push ([0x24B6 + j] unicodeGlyphs.[['A'.charCodeAt 0] + j].name FULLWIDTH)
foreach [j : range 0 26] : a.push ([0x24D0 + j] unicodeGlyphs.[['a'.charCodeAt 0] + j].name FULLWIDTH)
* a
}

View File

@ -90,7 +90,7 @@ 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.701] + HALFSTROKE
local groundy : [mix DESCENDER [XH * GBARPOS] 0.7] + HALFSTROKE
include : spiro {
g4 MIDDLE [XH * GBARPOS - O] [widths 0 [STROKE * 0.75]]
#archv
@ -98,7 +98,7 @@ create-glyph 'g' : glyph-construction {
#arcvh
flat [MIDDLE + DESCENDER * 0.15] groundy
curl [MIDDLE - DESCENDER * 0.15] groundy
archv 2
archv 4
g4 grightx [mix [DESCENDER + O] groundy 0.53]
arcvh
g4 [mix gleftx grightx 0.5] [DESCENDER + O]

View File

@ -243,30 +243,33 @@ create-glyph 'doubledagger' : glyph-construction {
}
# Ellipsis
create-glyph 'onedotLeader' : glyph-construction {
set-width FULLWIDTH
assign-unicode 0x2024
local radius : 0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] [WIDTH * 2] PERIODRADIUS FULLWIDTH
include : list {
Ring [radius * 2 - O] O [MIDDLE - radius + O] [MIDDLE + radius - O] true
Ring [radius * 2 - O] O [FULLWIDTH / 2 - radius + O] [FULLWIDTH / 2 + radius - O] true
}
}
create-glyph 'twodotsLEader' : glyph-construction {
set-width FULLWIDTH
assign-unicode 0x2025
local radius : 0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE
local left : mix 0 WIDTH [1 / 4]
local right : mix 0 WIDTH [3 / 4]
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] [WIDTH * 2] PERIODRADIUS FULLWIDTH
local left : mix 0 FULLWIDTH [1 / 4]
local right : mix 0 FULLWIDTH [3 / 4]
include : list {
Ring [radius * 2 - O] O [left - radius + O] [left + radius - O] true
Ring [radius * 2 - O] O [right - radius + O] [right + radius - O] true
}
}
create-glyph 'ellipsis' : glyph-construction {
set-width FULLWIDTH
assign-unicode 0x2026
local radius : 0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE
local left : mix 0 WIDTH [1 / 6]
local right : mix 0 WIDTH [5 / 6]
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] [WIDTH * 2] PERIODRADIUS FULLWIDTH
local left : mix 0 FULLWIDTH [1 / 6]
local right : mix 0 FULLWIDTH [5 / 6]
include : list {
Ring [radius * 2 - O] O [left - radius + O] [left + radius - O] true
Ring [radius * 2 - O] O [MIDDLE - radius + O] [MIDDLE + radius - O] true
Ring [radius * 2 - O] O [FULLWIDTH / 2 - radius + O] [FULLWIDTH / 2 + radius - O] true
Ring [radius * 2 - O] O [right - radius + O] [right + radius - O] true
}
}

View File

@ -13,7 +13,7 @@ define regular (
.barpos 0.52
.overlaypos 0.52
.ebarpos 0.45
.gbarpos 0.35
.gbarpos 0.352
.fivebarpos 0.55
.hook 145

View File

@ -8,5 +8,6 @@ font = fontforge.open(source)
font.em = int(sys.argv[3])
font.selection.all()
font.round()
font.removeOverlap()
font.simplify(0.1)
font.generate(sys.argv[2], flags = ("short-post", "opentype"))

View File

@ -223,6 +223,14 @@ define [Glyph.prototype.cleanup] : begin {
}
}
contour.push ocontour.[ocontour.length - 1]
# smart round
local p0 contour.0
local rx : Math.round p0.x
local ry : Math.round p0.y
foreach [j : range 0 contour.length] : begin {
contour.(j).x = [Math.round : contour.(j).x - p0.x + rx]
contour.(j).y = [Math.round : contour.(j).y - p0.y + ry]
}
# cleanup
local cleanedContour ()
foreach j [range 1 : contour.length - 1] : begin {