Added "hair", "light" and "thin" weights.

This commit is contained in:
be5invis 2015-12-15 01:31:35 +08:00
parent ac6d52bea4
commit b26ba95258
10 changed files with 78 additions and 31 deletions

View File

@ -335,6 +335,8 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
### Metadata
# Font names
set para.family [para.family.trim]
set para.style : [para.style.trim] || "Regular"
set font.name.preferredFamily para.family
set font.name.preferredSubFamily para.style
if (para.style == 'Regular' || para.style == 'Bold' || para.style == 'Italic' || para.style == "Bold Italic") : then

View File

@ -399,10 +399,10 @@ define [VBar x ydown yup _fine] : glyph-construction
define [VBarLeft x yd yu _fine] : VBar (x + [fallback _fine STROKE] * 0.5 * CORRECTION_HX) yd yu _fine
define [VBarRight x yd yu _fine] : VBar (x - [fallback _fine STROKE] * 0.5 * CORRECTION_HX) yd yu _fine
define [VerticalHook x y extend depth fine] : glyph-construction
define [VerticalHook x y extend depth fine strg] : glyph-construction
include : dispiro
widths.center [fallback fine STROKE]
flat x y [heading [if (depth > 0) DOWNWARD UPWARD]]
flat x (y + [fallback strg 0]) [heading [if (depth > 0) DOWNWARD UPWARD]]
curl x (y - [if (depth > 0) 0.01 (-0.01)]) [heading [if (depth > 0) DOWNWARD UPWARD]]
flat (x + extend - [if (extend > 0) 0.01 (-0.01)]) (y - depth)
curl (x + extend) (y - depth)

View File

@ -4,7 +4,7 @@
define [CyrDescender x shift] : glyph-construction
local descenderOverflow : if SLAB SIDEJUT ((RIGHTSB - SB) * [fallback shift 0.1])
include : VBarRight (x + descenderOverflow + 0.25 * STROKE) (HALFSTROKE - LONGJUT) STROKE
if (descenderOverflow > HALFSTROKE) : include : HBarTop (x - HALFSTROKE * CORRECTION_HX) (x + descenderOverflow) STROKE
if (descenderOverflow > STROKE * 0.75) : include : HBarTop (x - HALFSTROKE * CORRECTION_HX) (x + descenderOverflow) STROKE
###########################################################################################
# UNIFIED LETTERFORMS : LATIN ORIGINALS
@ -1146,9 +1146,9 @@ symbol-block 'd'
create-glyph 'dcurlytail' : glyph-construction
assign-unicode 0x221
local fine : adviceBlackness 4
local rinner : clamp (WIDTH * 0.05) (XH * 0.05) (fine * 0.35)
local rinner : clamp (WIDTH * 0.065) (XH * 0.05) (fine * 0.35)
local wide STROKE
local m1 : RIGHTSB - rinner * 2
local m1 : Math.min RIGHTSB (WIDTH - rinner * 2 - fine - OX)
local x2 : mix SB m1 0.5
local y2 : 0 - fine - rinner * 1.25
include eMarks
@ -1597,13 +1597,13 @@ symbol-block 'G'
assign-unicode 0x193
include glyphs.G AS_BASE
include : VBarRight (RIGHTSB - OXHOOK) (CAP - HOOK) CAP
include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX - OXHOOK) CAP HOOKX (-HOOK)
include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX - OXHOOK) CAP HOOKX (-HOOK) nothing O
create-glyph 'smcpGhooktop' : glyph-construction
assign-unicode 0x29B
include glyphs.smcpG AS_BASE
include : VBarRight (RIGHTSB - OXHOOK) (XH - HOOK) XH
include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX - OXHOOK) XH HOOKX (-HOOK)
include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX - OXHOOK) XH HOOKX (-HOOK) nothing O
create-glyph 'Gbar' : glyph-construction
assign-unicode 0x1E4
@ -1666,7 +1666,7 @@ symbol-block 'g'
assign-unicode 0x260
include glyphs.scriptg AS_BASE
eject-contour 'serifRT'
include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX) XH HOOKX (-HOOK)
include : VerticalHook (RIGHTSB - HALFSTROKE * CORRECTION_HX) XH HOOKX (-HOOK) nothing O
create-glyph 'gbar' : glyph-construction
assign-unicode 0x1E5
@ -1716,13 +1716,13 @@ symbol-block 'O'
create-glyph 'Obar' : glyph-construction
assign-unicode 0x19F
include glyphs.O AS_BASE
include : HOverlayBar (SB - O) (RIGHTSB + O) (CAP * 0.5)
include : HOverlayBar (SB + OX + 1) (RIGHTSB - OX - 1) (CAP * 0.5)
alias 'cyrOe' 0x4E8 'Obar'
create-glyph 'obar' : glyph-construction
assign-unicode 0x275
include glyphs.o AS_BASE
include : HOverlayBar (SB - O) (RIGHTSB + O) (XH * 0.5)
include : HOverlayBar (SB + OX + 1) (RIGHTSB - OX - 1) (XH * 0.5)
alias 'cyroe' 0x4E9 'obar'
create-glyph 'bulleye' : glyph-construction
@ -1913,9 +1913,9 @@ symbol-block 'n'
create-glyph 'ncurlytail' : glyph-construction
assign-unicode 0x235
local fine : adviceBlackness 4
local rinner : clamp (WIDTH * 0.05) (XH * 0.05) (fine * 0.35)
local rinner : clamp (WIDTH * 0.065) (XH * 0.05) (fine * 0.35)
local wide STROKE
local m1 : RIGHTSB - rinner * 2
local m1 : Math.min RIGHTSB (WIDTH - rinner * 2 - fine - OX)
local x2 : mix SB m1 0.5
local y2 : -fine
include eMarks
@ -2472,7 +2472,7 @@ symbol-block 'E'
### e
define {SmallEShape} : symbol-block 'e'
define [SmallEShape top stroke barpos curly] : glyph-construction
local barbottom (top * [fallback barpos EBARPOS])
local barbottom (top * [fallback barpos EBARPOS] - HALFSTROKE)
local hookx (RIGHTSB - OXHOOK + TAILADJX * globalTransform.yx)
local hookmiddle : [mix (SB + O) hookx 0.55] + CORRECTION_OMIDS
@ -2487,7 +2487,7 @@ define {SmallEShape} : symbol-block 'e'
[if (top <= XH) curl.ai curl] (SB + OX) (0 + SMALLSMOOTHB)
hookend O nothing stroke
g4 (RIGHTSB - OX * 0.5) AHOOK
include : HBarBottom (SB + (stroke / 2)) (RIGHTSB - (stroke / 2)) barbottom stroke
include : HBarBottom (SB + (stroke / 2) + OX) (RIGHTSB - (stroke / 2) - OX) barbottom stroke
create-glyph 'e' : glyph-construction
set-width WIDTH
@ -2509,7 +2509,7 @@ define {SmallEShape} : symbol-block 'e'
alias 'cyrschwa' 0x4D9 'schwa'
define [RevSmallEShape top stroke barpos] : glyph-construction
local barbottom (top * [fallback barpos EBARPOS])
local barbottom (top * [fallback barpos EBARPOS] - HALFSTROKE)
local hookx SB
local hookmiddle : [mix (RIGHTSB - O) hookx 0.55] + CORRECTION_OMIDS
@ -2887,7 +2887,7 @@ symbol-block 'Z'
include eMarks
local fine : adviceBlackness 4
local rinner : Math.max (XH * 0.035) (fine * 0.3)
local rinner : Math.max (XH * 0.04) (fine * 0.3)
local x2 : mix (SB + STROKE) RIGHTSB 0.3
local x1 : mix x2 (RIGHTSB - fine - rinner * 1.5) 0.45
local y2 : -XH * 0.2

View File

@ -284,12 +284,12 @@ symbol-block 'zeta and xi'
include : dispiro
widths.rhs
g4 (RIGHTSB + O) (CAP - STROKE)
bezcontrols 0.7 0.37 1 0.62
g4 (SB + STROKE * CORRECTION_HX) [mix 0 CAP 0.27]
alsothru 0.5 0.8
g4 [mix SB RIGHTSB 0.5] STROKE
bezcontrols 0.7 0.35 1 0.64
g4.down.mid (SB + STROKE * CORRECTION_HX) [mix 0 CAP 0.27]
arcvh
g4 [mix SB RIGHTSB 0.55] STROKE
archv
g4.down.mid RIGHTSB [mix DESCENDER STROKE 0.5] [heading DOWNWARD]
g4.down.mid RIGHTSB [mix DESCENDER STROKE 0.525] [heading DOWNWARD]
arcvh
flat (RIGHTSB - (STROKE - [mix DESCENDER STROKE 0.5]) * 1.1) DESCENDER
curl [mix SB RIGHTSB 0.5] DESCENDER [heading LEFTWARD]

View File

@ -117,6 +117,6 @@ symbol-block 'Letterlike Symbols'
create-glyph 'estimated' : glyph-construction
assign-unicode 0x212E
include : SmallEShape CAP [adviceBlackness 4] (0.5 - [adviceBlackness 4] / CAP / 2)
include : SmallEShape CAP [adviceBlackness 4] 0.5
turned 'turniota' 0x2129 'iota' MIDDLE (XH / 2)

View File

@ -19,10 +19,10 @@ endif
NODE_FDT = node --expose-gc
NODE = node
UPRIGHT = $(OBJDIR)/$(PREFIX)-regular.ttf $(OBJDIR)/$(PREFIX)-bold.ttf
ITALIC = $(OBJDIR)/$(PREFIX)-italic.ttf $(OBJDIR)/$(PREFIX)-bolditalic.ttf
EXTUPRG = $(OBJDIR)/$(PREFIX)-hair.ttf
EXTITAL = $(OBJDIR)/$(PREFIX)-hairitalic.ttf
UPRIGHT = $(OBJDIR)/$(PREFIX)-hair.ttf $(OBJDIR)/$(PREFIX)-thin.ttf $(OBJDIR)/$(PREFIX)-light.ttf $(OBJDIR)/$(PREFIX)-regular.ttf $(OBJDIR)/$(PREFIX)-bold.ttf
ITALIC = $(OBJDIR)/$(PREFIX)-hairitalic.ttf $(OBJDIR)/$(PREFIX)-thinitalic.ttf $(OBJDIR)/$(PREFIX)-lightitalic.ttf $(OBJDIR)/$(PREFIX)-italic.ttf $(OBJDIR)/$(PREFIX)-bolditalic.ttf
EXTUPRG =
EXTITAL =
OUTPUTS = $(UPRIGHT) $(ITALIC)
TARGETS = $(UPRIGHT) $(ITALIC) $(EXTUPRG) $(EXTITAL)
MAPS = $(subst .ttf,.charmap,$(TARGETS))
@ -55,6 +55,14 @@ $(OBJDIR)/.pass0-$(PREFIX)-hair.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-hair s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-hairitalic.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-hair s-italic $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-thin.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-thin s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-thinitalic.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-thin s-italic $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-light.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-light s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-lightitalic.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-light s-italic $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-regular.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generate -o $@ iosevka $(STYLE_COMMON) w-book s-upright $(STYLE_UPRIGHT) $(STYLE_SUFFIX)
$(OBJDIR)/.pass0-$(PREFIX)-italic.fdt : $(SCRIPTS) | $(OBJDIR)

View File

@ -11,6 +11,5 @@ export : define [build parametersData styles] : begin
#if hive.styleSuffix : set param.style "\(param.style)\(hive.styleSuffix)"
if hive.variantSelector : foreach [k : items-of : Object.keys hive.variantSelector] : begin
set variantSelector.(k) hive.variantSelector.(k)
if [not param.style] : set param.style 'Regular'
set param.variantSelector variantSelector
return param

View File

@ -31,7 +31,7 @@ superness = 2.2 # Superness of arcs
barpos = 0.52 # Position of the middle bar in most letters, like `E`
overlaypos = 0.52 # Position of the overlay mark
ebarpos = 0.45 # Position of the middle bar in `e`
ebarpos = 0.50 # Position of the middle bar in `e`
gbarpos = 0.42
pbarpos = 0.53
fivebarpos = 0.63
@ -90,6 +90,32 @@ cthin = 0.9
cthinb = 0.9
shoulderfine = 0.75
[w-thin]
weight = 200
style = 'Thin'
stroke = 36
sb = 72
dotsize = 70
periodsize = 77
essx = 1.12
cthin = 0.75
cthinb = 0.75
[w-light]
weight = 300
style = 'Light'
stroke = 54
sb = 63
dotsize = 90
periodsize = 99
essx = 1.12
cthin = 0.75
cthinb = 0.75
[w-book]
isBold = false
weight = 400
@ -115,7 +141,7 @@ jut = 90
vjut = 165
barpos = 0.51
ebarpos = 0.4
#ebarpos = 0.4
fivebarpos = 0.64
oxhook = -5
ahook = 120

View File

@ -30,7 +30,7 @@ font.replaceWithReference(1)
print " Simplify: ", font.fontname
font.selection.all()
font.transform(psMat.scale(5))
font.simplify(0.05, ("smoothcurves", "choosehv"), 0.1)
font.simplify(0.025, ("smoothcurves", "choosehv"), 0.1)
font.transform(psMat.scale(0.2))
font.simplify(0.2, ("smoothcurves", "choosehv"), 0.1)

View File

@ -231,9 +231,21 @@ define [Glyph.prototype.cleanup t] : begin
set cleanedContour {}
foreach j [range 0 contour.length] : if ([not contour.(j).cubic] && [not contour.(j).unimportant]) : begin
local found false
for [local k : j + 1] ((k < contour.length) && [not contour.(k).cubic] && [closepoint contour.(j) contour.(k) t]) [inc k] : begin
for [local k : j + 1] ((k < contour.length) && (
[not contour.(k).cubic] && [closepoint contour.(j) contour.(k) t]
|| contour.(k).cubic && contour.(k + 1).cubic
&& [closepoint contour.(j) contour.(k) t]
&& [closepoint contour.(j) contour.(k) t]
&& [closepoint contour.(j) contour.(k + 2) t])) [inc k] : begin
set contour.(k).unimportant true
set found true
if (contour.(k).cubic && contour.(k + 1).cubic
&& [closepoint contour.(j) contour.(k) t]
&& [closepoint contour.(j) contour.(k) t]
&& [closepoint contour.(j) contour.(k + 2) t]) : begin
set contour.(k + 1).unimportant true
set contour.(k + 2).unimportant true
set k : k + 2
if found : begin
set contour.(j).onCurve true
set j (k - 1)