Complement: /longsslash, /longsbar, and new marks.

This commit is contained in:
be5invis 2015-12-22 15:25:10 +08:00
parent 5f0f9d6791
commit e7dd737a74
5 changed files with 70 additions and 49 deletions

View File

@ -9,6 +9,9 @@ import './support/monotonic-interpolate' as smoothreg
import './support/fairify' as fairify
extern global
define [gc] : begin
if (global && global.gc) : global.gc
return nothing
### File inclusion macro
define-macro $$include : syntax-rules
@ -116,7 +119,7 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
# Progress indicator
define [progress status] : if [not recursive] : begin
#console.log " \(font.name.uniqueSubFamily) : Done \(status)"
* nothing
gc
# Key metrics
define WIDTH para.width
@ -417,7 +420,6 @@ export as build : define [buildFont para recursive recursiveCodes] : begin
$$include 'glyphs/symbol-other.ptl'
# Autobuilds
if (global && global.gc) : global.gc
$$include 'glyphs/autobuilds.ptl'
set font.glyfMap glyphs

View File

@ -42,6 +42,10 @@ define customDecompositions {
."\u04B1" "\u04AF\u0335"
."\u024F" "y\u0336"
."\u0142" "l\uE090"
."\u013E" "l\u0315"
."\u0165" "t\u0315"
."\u023A" "A\u0338"
."\u023B" "C\u0338"
."\u023C" "c\u0337"
@ -59,6 +63,8 @@ define customDecompositions {
."\u1D99" "u\u0322"
."\u1E9A" "a\u0357"
."\u1E9C" "\u017F\uE090"
."\u1E9D" "\u017F\u0335"
# Cyrillic composite characters
."\u0498" "\u0417\u0327"
@ -162,7 +168,7 @@ define [pad s n] : begin
#set font.features.ccmp {}
define [shorter x y] : if (x.length < y.length) x y
local {cfv} : let : begin
let : begin
local nComposed 0
local foundDecompositions {.}
define [decideName namingParts parts code] : begin
@ -190,7 +196,7 @@ local {cfv} : let : begin
set parts : subParts parts
local glyphName : decideName namingParts parts code
set foundDecompositions.(glyphName) {glyphName code parts}
inc nComposed
#if (global && global.gc) : global.gc
if recursiveCodes : recursiveCodes.forEach buildForCode
: else : foreach code [range 0x0000 0xFFFF] : buildForCode code
@ -208,6 +214,7 @@ local {cfv} : let : begin
include part
names.push part.name
if (part.name === 'rtailBR') : eject-contour 'serifRB'
inc nComposed
define [cfv glyphName _pa] : if (!recursive && _pa.0.featureSelector) : begin
local h {.}
@ -227,15 +234,16 @@ local {cfv} : let : begin
create-glyph glyphName construction
cfv glyphName parts
# Manual decomposites
#cfv 'i' {glyphs.dotlessi glyphs.dotAbove}
#cfv 'cyrUkrainiani' {glyphs.i}
progress "Unicode Precomposites (\(nComposed) glyphs)"
list cfv
* nothing
symbol-block "Manual Precomposites and CV variants"
cfv 'i' {glyphs.dotlessi glyphs.dotAbove}
cfv 'cyrUkrainiani' {glyphs.i}
symbol-block "Other Precomposites"
foreach [name : items-of : Object.keys glyphs] : begin
if glyphs.(name).featureSelector : begin
local fs glyphs.(name).featureSelector
@ -756,6 +764,9 @@ symbol-block 'CJK Double Width Characters'
if [not recursive] : createDoubleWidth : let [a {}] : begin
foreach [j : range 1 0x5f] : if [not unicodeGlyphs.(0xff00 + j)] : a.push {(0xff00 + j) unicodeGlyphs.(0x20 + j).name}
a.push {0xFFE0 'cent'}
a.push {0xFFE1 'sterling'}
a.push {0xFFE5 'yen'}
* a
### Generate Features and remove double-width glyphs when necessary

View File

@ -78,11 +78,18 @@ symbol-block 'i'
include glyphs.dotlessi AS_BASE
include glyphs.ogonekBelow
create-glyph 'i' : glyph-construction
set-width WIDTH
assign-unicode 'i'
include glyphs.dotlessi AS_BASE
include glyphs.dotAbove
composite 'i' glyphs.dotlessi glyphs.dotAbove [into-unicode 'i']
if (glyphs.i && glyphs.dotlessi) : begin
composite 'i.cv03' glyphs.(glyphs.dotlessi.featureSelector.cv03) glyphs.dotAbove
composite 'i.cv04' glyphs.(glyphs.dotlessi.featureSelector.cv04) glyphs.dotAbove
composite 'i.cv05' glyphs.(glyphs.dotlessi.featureSelector.cv05) glyphs.dotAbove
composite 'i.cv06' glyphs.(glyphs.dotlessi.featureSelector.cv06) glyphs.dotAbove
set glyphs.i.featureSelector {
.cv03 'i.cv03'
.cv04 'i.cv04'
.cv05 'i.cv05'
.cv06 'i.cv06'
}
alias 'cyrUkrainiani' 0x456 'i'
turned nothing 0x1D09 'i' MIDDLE (XH / 2) pMarks
@ -276,7 +283,7 @@ symbol-block 'l'
include : VBar (MIDDLE + balance) 0 CAP
include : LeftwardTopSerif (MIDDLE + balance) CAP (LONGJUT - balance)
include : CenterBottomSerif MIDDLE 0 LONGJUT
set this.barx (MIDDLE + balance)
set-anchor 'overlay' BASE (MIDDLE + balance / 2) (CAP * BARPOS)
create-glyph 'l.italic' : glyph-construction
local left : mix SB RIGHTSB 0.3
@ -294,7 +301,7 @@ symbol-block 'l'
include bMarks
set-anchor 'above' BASE (left + HALFSTROKE) CAP
set-anchor 'below' BASE middle 0
set this.barx (left + HALFSTROKE)
set-anchor 'overlay' BASE (left + HALFSTROKE) (CAP * BARPOS)
select-variant 'l' 'l' [if para.isItalic 'italic' 'serifed'] {
.'cv07' 'l.serifed'
@ -305,16 +312,11 @@ symbol-block 'l'
alias 'palochka' 0x4CF 'l'
turned 'turnl' 0xA781 'l' MIDDLE (XH / 2) pMarks
create-glyph 'lcaron' : glyph-construction
assign-unicode 0x13E
include glyphs.commaAbove
apply-transform : Translate (WIDTH + (RIGHTSB - SB) * 0.375) 0
include glyphs.l AS_BASE
create-glyph 'lslash' : glyph-construction
assign-unicode 0x142
include glyphs.l AS_BASE
include : FlatSlashShape [tp [Upright] glyphs.l.anchors.above].x [mix 0 CAP BARPOS] (0.5 * OVERLAYSTROKE)
#create-glyph 'lcaron' : glyph-construction
# assign-unicode 0x13E
# include glyphs.commaAbove
# apply-transform : Translate (WIDTH + (RIGHTSB - SB) * 0.375) 0
# include glyphs.l AS_BASE
create-glyph 'ldot' : glyph-construction
assign-unicode 0x140
@ -2337,6 +2339,7 @@ define {LongSShape} : symbol-block 'f'
curl (MIDDLE - FBALANCE) (CAP - FHOOK)
arcvh
straight.right.end (MIDDLE - FBALANCE + HOOKX) (CAP - HALFSTROKE - fovershoot)
set-anchor 'overlay' BASE (MIDDLE - FBALANCE + STROKE * 0.5 * HVCONTRAST) (CAP * BARPOS)
if SLAB : begin
include : CenterBottomSerif (MIDDLE - FBALANCE) 0 JUT
tag-contour 'serifMB'
@ -2351,6 +2354,7 @@ define {LongSShape} : symbol-block 'f'
hookstart (CAP - O)
flat m (CAP - SMOOTHA)
curl m 0
set-anchor 'overlay' BASE (m + STROKE * 0.65 * HVCONTRAST) (CAP * BARPOS)
if SLAB : begin
include : tagged 'serifLB' : CenterBottomSerif (m + HALFSTROKE * HVCONTRAST + RBALANCE * 0.35) 0 (JUT + RBALANCE * 0.65)
@ -2370,17 +2374,12 @@ define {LongSShape} : symbol-block 'f'
create-glyph 'longs' : glyph-construction
set-width WIDTH
assign-unicode 0x17f
assign-unicode 0x17F
if (para.isItalic)
then : include glyphs.'longs.italic' AS_BASE
else : include glyphs.'longs.upright' AS_BASE
create-glyph 'longsslash' : glyph-construction
assign-unicode 0x1E9C
include glyphs.longs AS_BASE
include : FlatSlashShape [tp [Upright] glyphs.l.anchors.above].x [mix 0 CAP BARPOS] (0.5 * OVERLAYSTROKE)
create-glyph 'esh' : glyph-construction
assign-unicode 0x283
include glyphs.'longs.italic' AS_BASE
@ -2710,12 +2709,6 @@ symbol-block 't'
include glyphs.t AS_BASE
include : HOverlayBar ([mix MIDDLE SB 0.7] - TBALANCE * 0.5 - STROKE * 0.25 * HVCONTRAST) ([mix MIDDLE RIGHTSB 0.7] - TBALANCE * 0.5 - STROKE * 0.25 * HVCONTRAST) [mix 0 XH 0.6]
create-glyph 'tcaron' : glyph-construction
assign-unicode 0x165
include glyphs.commaAbove
apply-transform : Translate (WIDTH + (RIGHTSB - SB) / 2) 0
include glyphs.t AS_BASE
### S and s
symbol-block 'S'
create-glyph 'S' : glyph-construction

View File

@ -745,6 +745,15 @@ symbol-block 'Corner marks'
include : Ring (XH + ACCENT + DOTRADIUS) (XH + ACCENT - DOTRADIUS) (0 - DOTRADIUS) (0 + DOTRADIUS) true
set-anchor 'topright' MARK 0 XH 0 aboveMarkTop
create-glyph 'commaTR' : glyph-construction
set-width 0
assign-unicode 0x315
include glyphs.commaAbove
apply-transform : Upright
apply-transform : Translate (RIGHTSB - MIDDLE - OX) (XH - aboveMarkTop - commaOvershoot)
apply-transform : Italify
set-anchor 'topright' MARK 0 XH 0 aboveMarkTop
create-glyph 'rtailBR' : glyph-construction
set-width 0
assign-unicode 0x322
@ -755,8 +764,6 @@ symbol-block 'Corner marks'
flat 0 (-O) [heading DOWNWARD]
curl 0 0 [heading DOWNWARD]
straight.right.end (HOOKX - HALFSTROKE * HVCONTRAST) (-HOOK + HALFSTROKE)
#flat (HOOKX - HALFSTROKE * HVCONTRAST - 0.01) (-HOOK + HALFSTROKE)
#curl (HOOKX - HALFSTROKE * HVCONTRAST) (-HOOK + HALFSTROKE)
create-glyph 'ltailBR' : glyph-construction
set-width 0
@ -792,6 +799,12 @@ symbol-block 'Overlay Marks'
set-anchor 'overlay' MARK markMiddle (XH / 2) markMiddle (XH / 2)
include : HOverlayBar ([mix 0 SB 0.5] - WIDTH) ([mix WIDTH RIGHTSB 0.5] - WIDTH) (XH / 2)
create-glyph 'shortSlashOver' : glyph-construction
set-width 0
assign-unicode 0xE090
set-anchor 'overlay' MARK markMiddle (XH / 2) markMiddle (XH / 2)
include : FlatSlashShape markMiddle (XH / 2) (0.5 * OVERLAYSTROKE)
create-glyph 'slashOver' : glyph-construction
set-width 0
assign-unicode 0x337

View File

@ -11,11 +11,13 @@ ARCPREFIXB = iosevka$(SUFFIX)
ifeq ($(OS),Windows_NT)
SHELL = C:\\Windows\\System32\\cmd.exe
SUPPRESS_ERRORS = 2> NUL
PASS = @rem
else
SUPPRESS_ERRORS = 2> /dev/null
PASS = @:
endif
NODE_FDT = node --expose-gc
NODE_FDT = @node --expose-gc
NODE = node
UPRIGHT = $(OBJDIR)/$(PREFIX)-thin.ttf $(OBJDIR)/$(PREFIX)-extralight.ttf $(OBJDIR)/$(PREFIX)-light.ttf $(OBJDIR)/$(PREFIX)-regular.ttf $(OBJDIR)/$(PREFIX)-medium.ttf $(OBJDIR)/$(PREFIX)-bold.ttf $(OBJDIR)/$(PREFIX)-heavy.ttf
@ -89,20 +91,20 @@ $(OBJDIR)/.pass0-$(PREFIX)-heavyoblique.fdt : $(SCRIPTS) | $(OBJDIR)
$(NODE_FDT) generator iosevka $(STYLE_COMMON) w-heavy s-oblique $(STYLE_oblique) $(STYLE_SUFFIX) $(OUTPUTS) --uprightify 1
$(SVG0) : $(OBJDIR)/.pass0-%.svg : $(OBJDIR)/.pass0-%.fdt
@echo $^ "'->'" $@
$(PASS)
$(ABFEAT) : $(OBJDIR)/.pass0-%.ab.fea : $(OBJDIR)/.pass0-%.fdt
@echo $^ "'->'" $@
$(PASS)
$(MAPS) : $(OBJDIR)/%.charmap : $(OBJDIR)/.pass0-%.fdt
@echo $^ "'->'" $@
$(PASS)
$(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 $^ > $@
@cat $^ > $@
# Pass 1 : Outline cleanup and merge features
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.svg $(OBJDIR)/.pass0-%.fea
fontforge -quiet -script $^ $@ $(if $(findstring italic,$@),10,$(if $(findstring oblique,$@),10,0)) $(FAST) $(SUPPRESS_ERRORS)
@fontforge -quiet -script $^ $@ $(if $(findstring italic,$@),10,$(if $(findstring oblique,$@),10,0)) $(FAST) $(SUPPRESS_ERRORS)
# Pass 2 : add metadata
# IDKY, but converting into TTX and convert back dramatically reduces the file size
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-finalize.js $(OBJDIR)/.pass1-%.ttf $(OBJDIR)/.pass0-%.fdt
@ -111,10 +113,10 @@ $(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-finalize.js $(OBJDIR)/.pass1-%.ttf $(O
@ttx -q -o $@ $@.a.ttx $(SUPPRESS_ERRORS)
@rm $@.a.ttf $@.a.ttx
$(TARGETS) : $(OBJDIR)/%.ttf : $(OBJDIR)/.pass2-%.ttf
ttfautohint $< $@
@ttfautohint $< $@
$(DISTTARGETS) : $(DISTDIR)/%.ttf : $(OBJDIR)/%.ttf
cp $< $@
@cp $< $@
# releaseing
RELEASEDIR = releases