Supported full width forms of ASCII characters (U+FF01 to U+FF5E).
This commit is contained in:
parent
70462cfa08
commit
0d7414bda3
|
@ -559,6 +559,22 @@ create-glyph 'servicemark' : glyph-construction {
|
|||
include : doubleSuperscript glyphs.supS glyphs.supM
|
||||
}
|
||||
|
||||
# CJK double width letters
|
||||
define [createDoubleWidth records] : if [not recursive] : begin {
|
||||
local scale 1.3
|
||||
local pendingGlyphs : records.map : [record] -> record.1
|
||||
local widenFont : Widen pendingGlyphs scale [scale * 1.1]
|
||||
foreach (unicode glyphid) [items-of records] : create-glyph [suggestName : 'dw' + glyphid] : glyph-construction {
|
||||
set-width UPM
|
||||
if unicode : assign-unicode unicode
|
||||
include widenFont.(glyphid) AS_BASE
|
||||
apply-transform [Translate [UPM / 2 - [WIDTH * scale] / 2] 0] true
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
### Generate MARK and MKMK features
|
||||
set font.features.mark (.)
|
||||
|
@ -567,7 +583,7 @@ set font.features.markGlyphs (.)
|
|||
set font.features.gdef (.simple () .ligature () .mark ())
|
||||
define [buildAnchorDescription glyph inserter propx propy prefix th] : begin {
|
||||
local buf ''
|
||||
foreach key [items-of : Object.keys glyph.anchors] : if [!th || th.(key)] : buf = buf + ' <anchor ' + [Math.round [upmscale * glyph.anchors.(key).(propx)]] + ' ' + [Math.round [upmscale * glyph.anchors.(key).(propy)]] + '> ' + inserter + ' @' + prefix + key
|
||||
foreach key [items-of : Object.keys glyph.anchors] : if [!th || th.(key)] : buf = buf + ' <anchor ' + [Math.round glyph.anchors.(key).(propx)] + ' ' + [Math.round glyph.anchors.(key).(propy)] + '> ' + inserter + ' @' + prefix + key
|
||||
return buf
|
||||
}
|
||||
# mark
|
||||
|
|
|
@ -403,6 +403,17 @@ define [Thinner glyphs p] : begin {
|
|||
local forkFont : buildFont forkedPara shouldBuildList
|
||||
return forkFont.glyfMap
|
||||
}
|
||||
define [Widen glyphs p psb] : begin {
|
||||
local forkedPara : Object.create para
|
||||
forkedPara.upmscale = 1
|
||||
forkedPara.width = WIDTH * p
|
||||
forkedPara.sb = SB * [fallback psb p]
|
||||
forkedPara.accentx = ACCENTX * p
|
||||
local shouldBuildList ()
|
||||
foreach glyphid [items-of glyphs] : set shouldBuildList : shouldBuildList.concat (glyphid :: dependencyProfile.(glyphid))
|
||||
local forkFont : buildFont forkedPara shouldBuildList
|
||||
return forkFont.glyfMap
|
||||
}
|
||||
define [turned newid unicode id x y mark] : create-glyph [fallback newid : 'turn' + id] : glyph-construction {
|
||||
if unicode : assign-unicode unicode
|
||||
include glyphs`id [if mark false AS_BASE]
|
||||
|
|
|
@ -92,12 +92,10 @@ create-glyph 'g' : glyph-construction {
|
|||
local grightx [RIGHTSB + SB * 0.1 - O]
|
||||
local groundy : [mix DESCENDER [XH * GBARPOS] 0.7] + HALFSTROKE
|
||||
include : spiro {
|
||||
g4 MIDDLE [XH * GBARPOS - O] [widths 0 [STROKE * 0.65]]
|
||||
#archv
|
||||
g4 [SB * 1.25 + STROKE] [mix groundy [XH * GBARPOS] 0.5] [widths 0 [STROKE * 0.95]]
|
||||
#arcvh
|
||||
flat [MIDDLE + DESCENDER * 0.15] groundy [widths 0 STROKE]
|
||||
curl [MIDDLE - DESCENDER * 0.15] groundy
|
||||
g4 [mix SB RIGHTSB 0.3] [mix XH [XH * GBARPOS - O] 0.95] [widths 0 [STROKE * 0.7]]
|
||||
alsothru [-0.6] 0.5 [widths 0 [STROKE * 0.95]]
|
||||
flat [mix SB RIGHTSB 0.425] groundy [widths 0 STROKE]
|
||||
curl [mix RIGHTSB SB 0.425] groundy
|
||||
archv 4
|
||||
g4 grightx [mix [DESCENDER + O] groundy 0.53]
|
||||
arcvh
|
||||
|
@ -105,7 +103,7 @@ create-glyph 'g' : glyph-construction {
|
|||
archv
|
||||
g4 gleftx [mix [DESCENDER + O] groundy 0.53]
|
||||
arcvh
|
||||
g4 [MIDDLE + DESCENDER * 0.15] groundy
|
||||
g4 [mix SB RIGHTSB 0.425] groundy
|
||||
}
|
||||
start-from [RIGHTSB + 0.25 * SB] XH
|
||||
line-to [RIGHTSB + 0.25 * SB] [XH - STROKE]
|
||||
|
@ -597,7 +595,7 @@ define [SmallKShape] : glyph-construction {
|
|||
|
||||
local fine : adviceBlackness 3.5
|
||||
include : spiro {
|
||||
g4 [RIGHTSB + O] XH [widths.heading 0 [STROKE * 1.05] DOWNWARD]
|
||||
g4 [RIGHTSB + O] XH [widths.heading 0 [STROKE * 1.05 * [WIDTH * 2 / UPM]] DOWNWARD]
|
||||
#curl RIGHTSB turn [heading DOWNWARD]
|
||||
bezcontrols 0 0.2 0.5 0.65 8
|
||||
g4 [SB + STROKE] attach [widths 0 fine]
|
||||
|
|
|
@ -245,7 +245,7 @@ create-glyph 'doubledagger' : glyph-construction {
|
|||
create-glyph 'onedotLeader' : glyph-construction {
|
||||
set-width FULLWIDTH
|
||||
assign-unicode 0x2024
|
||||
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] [WIDTH * 2] PERIODRADIUS FULLWIDTH
|
||||
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] UPM PERIODRADIUS FULLWIDTH
|
||||
include : list {
|
||||
Ring [radius * 2 - O] O [FULLWIDTH / 2 - radius + O] [FULLWIDTH / 2 + radius - O] true
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ create-glyph 'onedotLeader' : glyph-construction {
|
|||
create-glyph 'twodotsLEader' : glyph-construction {
|
||||
set-width FULLWIDTH
|
||||
assign-unicode 0x2025
|
||||
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] [WIDTH * 2] PERIODRADIUS FULLWIDTH
|
||||
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] UPM PERIODRADIUS FULLWIDTH
|
||||
local left : mix 0 FULLWIDTH [1 / 4]
|
||||
local right : mix 0 FULLWIDTH [3 / 4]
|
||||
include : list {
|
||||
|
@ -264,7 +264,7 @@ create-glyph 'twodotsLEader' : glyph-construction {
|
|||
create-glyph 'ellipsis' : glyph-construction {
|
||||
set-width FULLWIDTH
|
||||
assign-unicode 0x2026
|
||||
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] [WIDTH * 2] PERIODRADIUS FULLWIDTH
|
||||
local radius : linreg WIDTH [0.5 * [adviceBlackness 3.25] * PERIODSIZE / DOTSIZE] UPM PERIODRADIUS FULLWIDTH
|
||||
local left : mix 0 FULLWIDTH [1 / 6]
|
||||
local right : mix 0 FULLWIDTH [5 / 6]
|
||||
include : list {
|
||||
|
|
6
makefile
6
makefile
|
@ -46,13 +46,13 @@ $(FEATURE) : $(OBJDIR)/.pass0-%.fea : $(OBJDIR)/.pass0-%.ab.fea features/common.
|
|||
cat $^ > $@
|
||||
|
||||
# Pass 1 : Outline cleanup and merge
|
||||
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf $(OBJDIR)/.pass0-%.fea
|
||||
$(PASS1) : $(OBJDIR)/.pass1-%.ttf : pass1-cleanup.py $(OBJDIR)/.pass0-%.ttf
|
||||
fontforge -quiet -script $^ $@ $(SUPPRESS_ERRORS)
|
||||
$(PASS2) : $(OBJDIR)/.pass2-%.ttf : pass2-smartround.js $(OBJDIR)/.pass1-%.ttf
|
||||
node $^ $@ --upm $(TARGETUPM)
|
||||
$(PASS3) : $(OBJDIR)/.pass3-%.ttf : pass3-finalize.py $(OBJDIR)/.pass2-%.ttf
|
||||
$(PASS3) : $(OBJDIR)/.pass3-%.ttf : pass3-features.py $(OBJDIR)/.pass2-%.ttf $(OBJDIR)/.pass0-%.fea
|
||||
fontforge -quiet -script $^ $@ $(TARGETUPM)
|
||||
$(PASS4) : $(OBJDIR)/.pass4-%.ttf : pass4-fixmeta.js $(OBJDIR)/.pass3-%.ttf
|
||||
$(PASS4) : $(OBJDIR)/.pass4-%.ttf : pass4-finalize.js $(OBJDIR)/.pass3-%.ttf
|
||||
@node $^ $@.a.ttf
|
||||
@ttx -o $@.a.ttx $@.a.ttf
|
||||
@ttx -o $@ $@.a.ttx
|
||||
|
|
|
@ -43,8 +43,7 @@ font.transform(psMat.skew(-font.italicangle / 180 * math.pi))
|
|||
# Feature merging and output
|
||||
print "Finalize: ", font.fontname
|
||||
font.em = oldem
|
||||
font.mergeFeature(sys.argv[2])
|
||||
|
||||
font.canonicalContours()
|
||||
font.canonicalStart()
|
||||
font.generate(sys.argv[3], flags = ("short-post", "opentype"))
|
||||
font.generate(sys.argv[2])
|
|
@ -5,9 +5,10 @@ import math
|
|||
|
||||
source = sys.argv[1]
|
||||
font = fontforge.open(source)
|
||||
font.em = int(sys.argv[3])
|
||||
font.em = int(sys.argv[4])
|
||||
font.selection.all()
|
||||
font.round()
|
||||
font.removeOverlap()
|
||||
font.simplify(0.1)
|
||||
font.generate(sys.argv[2], flags = ("short-post", "opentype"))
|
||||
font.mergeFeature(sys.argv[2])
|
||||
font.generate(sys.argv[3], flags = ("short-post", "opentype"))
|
Loading…
Reference in New Issue
Block a user