Add hwid/fwid for circled/boxed/braced characters
This commit is contained in:
parent
7e114dbfb8
commit
a84743e77a
1 changed files with 177 additions and 152 deletions
|
@ -247,6 +247,9 @@ export : define [apply] : begin
|
||||||
|
|
||||||
# Build miniature clyphs : circled, superscripts, subscripts...
|
# Build miniature clyphs : circled, superscripts, subscripts...
|
||||||
# Circled
|
# Circled
|
||||||
|
|
||||||
|
define circleWidthClasses {{'hwid' WIDTH} {'fwid' FULLWIDTH0}}
|
||||||
|
|
||||||
define [circleInner dscale miniatureFont unicode parts width bal baly] : begin
|
define [circleInner dscale miniatureFont unicode parts width bal baly] : begin
|
||||||
define gni : '.ci.' + [parts.join '_'] + '.' + [{dscale width bal baly}.join '.']
|
define gni : '.ci.' + [parts.join '_'] + '.' + [{dscale width bal baly}.join '.']
|
||||||
if (glyphs.(gni)) : return glyphs.(gni)
|
if (glyphs.(gni)) : return glyphs.(gni)
|
||||||
|
@ -274,11 +277,14 @@ export : define [apply] : begin
|
||||||
set-width 0
|
set-width 0
|
||||||
return lg
|
return lg
|
||||||
|
|
||||||
|
define CircCrowd 5
|
||||||
|
define CircScale 0.65
|
||||||
|
|
||||||
define [circleDimens dscale w m] : begin
|
define [circleDimens dscale w m] : begin
|
||||||
define width : fallback w WIDTH
|
define width : fallback w WIDTH
|
||||||
define dscale : linreg WIDTH 0.55 UPM 0.6 width
|
define dscale : linreg WIDTH 0.55 UPM 0.6 width
|
||||||
define spatt : linreg WIDTH 0.175 UPM 0.27 width
|
define spatt : linreg WIDTH 0.175 UPM 0.27 width
|
||||||
define sw0 : adviceBlackness 5
|
define sw0 : dscale * [adviceBlackness CircCrowd] / CircScale
|
||||||
define sw : Math.max sw0 [fallback m 0]
|
define sw : Math.max sw0 [fallback m 0]
|
||||||
define top : CAP * dscale + [Math.max (CAP * spatt) (sw * 3)]
|
define top : CAP * dscale + [Math.max (CAP * spatt) (sw * 3)]
|
||||||
define bot : 0 - [Math.max (CAP * spatt) (sw * 3)]
|
define bot : 0 - [Math.max (CAP * spatt) (sw * 3)]
|
||||||
|
@ -298,17 +304,20 @@ export : define [apply] : begin
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
return : Miniature
|
return : Miniature
|
||||||
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
|
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
|
||||||
crowd -- 5
|
crowd -- CircCrowd
|
||||||
scale -- 0.65
|
scale -- CircScale
|
||||||
unfair -- true
|
unfair -- true
|
||||||
|
|
||||||
|
define [CircName prefix parts suffix] : suggestName : prefix + '-' + [parts.join '_'] + '.' + suffix
|
||||||
|
|
||||||
define [createCircledGlyphs records] : if [not recursive] : begin
|
define [createCircledGlyphs records] : if [not recursive] : begin
|
||||||
local miniatureFont : circledMiniatureFont records
|
local miniatureFont : circledMiniatureFont records
|
||||||
foreach {unicode parts w bal baly} [items-of records] : do
|
foreach {unicode parts w bal baly} [items-of records] : do
|
||||||
define [object width dscale sw top bot left right] : circleDimens dscale w
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
create-glyph [suggestName : 'circle-' + [parts.join '_']] : glyph-construction
|
define [object width dscale sw top bot left right] : circleDimens dscale ww
|
||||||
|
create-glyph [CircName 'circle' parts suffix] : glyph-construction
|
||||||
set-width width
|
set-width width
|
||||||
if unicode : assign-unicode unicode
|
if (w == ww && unicode) : assign-unicode unicode
|
||||||
include : circleInner dscale miniatureFont unicode parts width bal baly
|
include : circleInner dscale miniatureFont unicode parts width bal baly
|
||||||
include : OShape top bot left right sw (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
include : OShape top bot left right sw (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
||||||
|
|
||||||
|
@ -319,10 +328,11 @@ export : define [apply] : begin
|
||||||
define [createBoxedGlyphs records] : if [not recursive] : begin
|
define [createBoxedGlyphs records] : if [not recursive] : begin
|
||||||
local miniatureFont : circledMiniatureFont records
|
local miniatureFont : circledMiniatureFont records
|
||||||
foreach {unicode parts w bal baly} [items-of records] : do
|
foreach {unicode parts w bal baly} [items-of records] : do
|
||||||
define [object width dscale sw top bot left right] : circleDimens dscale w
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
create-glyph [suggestName : 'boxed-' + [parts.join '_']] : glyph-construction
|
define [object width dscale sw top bot left right] : circleDimens dscale ww
|
||||||
|
create-glyph [CircName 'boxed' parts suffix] : glyph-construction
|
||||||
set-width width
|
set-width width
|
||||||
if unicode : assign-unicode unicode
|
if (w == ww && unicode) : assign-unicode unicode
|
||||||
include : circleInner dscale miniatureFont unicode parts width bal baly
|
include : circleInner dscale miniatureFont unicode parts width bal baly
|
||||||
include : union
|
include : union
|
||||||
HBarTop left right top sw
|
HBarTop left right top sw
|
||||||
|
@ -337,10 +347,11 @@ export : define [apply] : begin
|
||||||
define [createInsetCircledGlyphs records] : if [not recursive] : begin
|
define [createInsetCircledGlyphs records] : if [not recursive] : begin
|
||||||
local miniatureFont : circledMiniatureFont records
|
local miniatureFont : circledMiniatureFont records
|
||||||
foreach {unicode parts w bal baly} [items-of records] : do
|
foreach {unicode parts w bal baly} [items-of records] : do
|
||||||
define [object width dscale sw top bot left right] : circleDimens dscale w
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
create-glyph [suggestName : 'inset-circle-' + [parts.join '_']] : glyph-construction
|
define [object width dscale sw top bot left right] : circleDimens dscale ww
|
||||||
|
create-glyph [CircName 'inset-circle' parts suffix] : glyph-construction
|
||||||
set-width width
|
set-width width
|
||||||
if unicode : assign-unicode unicode
|
if (w == ww && unicode) : assign-unicode unicode
|
||||||
include : difference
|
include : difference
|
||||||
OShapeOutline top bot left right sw (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
OShapeOutline top bot left right sw (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
||||||
circleInner dscale miniatureFont unicode parts width bal baly
|
circleInner dscale miniatureFont unicode parts width bal baly
|
||||||
|
@ -352,10 +363,11 @@ export : define [apply] : begin
|
||||||
define [createInsetBoxedGlyphs records] : if [not recursive] : begin
|
define [createInsetBoxedGlyphs records] : if [not recursive] : begin
|
||||||
local miniatureFont : circledMiniatureFont records
|
local miniatureFont : circledMiniatureFont records
|
||||||
foreach {unicode parts w bal baly} [items-of records] : do
|
foreach {unicode parts w bal baly} [items-of records] : do
|
||||||
define [object width dscale sw top bot left right] : circleDimens dscale w
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
create-glyph [suggestName : 'inset-boxed-' + [parts.join '_']] : glyph-construction
|
define [object width dscale sw top bot left right] : circleDimens dscale ww
|
||||||
|
create-glyph [CircName 'inset-boxed' parts suffix] : glyph-construction
|
||||||
set-width width
|
set-width width
|
||||||
if unicode : assign-unicode unicode
|
if (w == ww && unicode) : assign-unicode unicode
|
||||||
include : difference
|
include : difference
|
||||||
spiro-outline
|
spiro-outline
|
||||||
corner left top
|
corner left top
|
||||||
|
@ -372,11 +384,12 @@ export : define [apply] : begin
|
||||||
define [createDoubleCircledGlyphs records] : if [not recursive] : begin
|
define [createDoubleCircledGlyphs records] : if [not recursive] : begin
|
||||||
local miniatureFont : circledMiniatureFont records
|
local miniatureFont : circledMiniatureFont records
|
||||||
foreach {unicode parts w bal baly} [items-of records] : do
|
foreach {unicode parts w bal baly} [items-of records] : do
|
||||||
define [object width dscale sw0 sw top bot left right] : circleDimens dscale w (w * 0.08)
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
|
define [object width dscale sw0 sw top bot left right] : circleDimens dscale ww (ww * 0.08)
|
||||||
define sw1 : Math.min sw0 (sw / 3)
|
define sw1 : Math.min sw0 (sw / 3)
|
||||||
create-glyph [suggestName : 'double-circle-' + [parts.join '_']] : glyph-construction
|
create-glyph [CircName 'double-circle' parts suffix] : glyph-construction
|
||||||
set-width width
|
set-width width
|
||||||
if unicode : assign-unicode unicode
|
if (w == ww && unicode) : assign-unicode unicode
|
||||||
include : circleInner dscale miniatureFont unicode parts width bal baly
|
include : circleInner dscale miniatureFont unicode parts width bal baly
|
||||||
include : OShape top bot left right sw1 (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
include : OShape top bot left right sw1 (SMALLSMOOTHA * width / WIDTH) (SMALLSMOOTHB * width / WIDTH)
|
||||||
include : OShape
|
include : OShape
|
||||||
|
@ -392,11 +405,16 @@ export : define [apply] : begin
|
||||||
apply-transform : Translate 0 (symbolMid - CAP * dscale / 2)
|
apply-transform : Translate 0 (symbolMid - CAP * dscale / 2)
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
|
|
||||||
|
define BraceCrowd [fallback para.smallCrowd 3.75]
|
||||||
|
define BraceScale 0.65
|
||||||
|
|
||||||
define [bracedDottdeDimens width] : begin
|
define [bracedDottdeDimens width] : begin
|
||||||
define sw0 : Math.max (WIDTH * 0.075) [adviceBlackness 5]
|
|
||||||
define sw : Math.min STROKE sw0
|
|
||||||
define dscale : linreg WIDTH 0.55 UPM 0.65 width
|
define dscale : linreg WIDTH 0.55 UPM 0.65 width
|
||||||
define pscale : linreg WIDTH 0.6 UPM 0.75 width
|
define pscale : linreg WIDTH 0.6 UPM 0.75 width
|
||||||
|
define sw0 : Math.max
|
||||||
|
WIDTH * 0.075
|
||||||
|
dscale * [adviceBlackness BraceCrowd] / BraceScale
|
||||||
|
define sw : Math.min STROKE sw0
|
||||||
define l : [Math.max (SB + O * 3) (width / 2 - CAP / 2 * dscale - sw0 * 2.5)] + OX
|
define l : [Math.max (SB + O * 3) (width / 2 - CAP / 2 * dscale - sw0 * 2.5)] + OX
|
||||||
define r : width - l
|
define r : width - l
|
||||||
return : object width sw dscale pscale l r
|
return : object width sw dscale pscale l r
|
||||||
|
@ -405,15 +423,16 @@ export : define [apply] : begin
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
local miniatureFont : Miniature
|
local miniatureFont : Miniature
|
||||||
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
|
glyphs -- [pendingGlyphs.reduce : [a b] => [a.concat b]]
|
||||||
crowd -- [fallback para.smallCrowd 3.75]
|
crowd -- BraceCrowd
|
||||||
scale -- 0.65
|
scale -- BraceScale
|
||||||
sbscale -- 1
|
sbscale -- 1
|
||||||
unfair -- true
|
unfair -- true
|
||||||
|
|
||||||
foreach {unicode parts w bal baly} [items-of records] : do
|
foreach {unicode parts w bal baly} [items-of records] : do
|
||||||
define [object width dscale pscale sw l r] : bracedDottdeDimens w
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
local gn : suggestName : 'braced-' + [parts.join '_']
|
define [object width dscale pscale sw l r] : bracedDottdeDimens ww
|
||||||
local gni : suggestName : 'braced-inner-' + [parts.join '_'] + '.' + dscale
|
local gn : CircName 'braced' parts suffix
|
||||||
|
local gni : CircName 'braced-inner' parts suffix
|
||||||
|
|
||||||
local lg : create-glyph gni : glyph-construction
|
local lg : create-glyph gni : glyph-construction
|
||||||
local tw 0
|
local tw 0
|
||||||
|
@ -466,7 +485,8 @@ export : define [apply] : begin
|
||||||
include : Translate 0 (symbolMid - symbolMid * pscale)
|
include : Translate 0 (symbolMid - symbolMid * pscale)
|
||||||
include : Italify
|
include : Italify
|
||||||
|
|
||||||
save gn unicode
|
if (w == ww) : save gn unicode
|
||||||
|
: else : save gn
|
||||||
|
|
||||||
define [createDottedGlyphs shrink records] : if [not recursive] : begin
|
define [createDottedGlyphs shrink records] : if [not recursive] : begin
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
|
@ -475,8 +495,10 @@ export : define [apply] : begin
|
||||||
if (para.spacing > 1) 1 shrink
|
if (para.spacing > 1) 1 shrink
|
||||||
|
|
||||||
foreach {unicode parts w} [items-of records] : do
|
foreach {unicode parts w} [items-of records] : do
|
||||||
local gn : suggestName : 'dotted-' + [parts.join '_']
|
foreach {suffix ww} [items-of circleWidthClasses] : do
|
||||||
define [object width dscale pscale sw l r] : bracedDottdeDimens w
|
|
||||||
|
local gn : CircName 'dotted' parts suffix
|
||||||
|
define [object width dscale pscale sw l r] : bracedDottdeDimens ww
|
||||||
|
|
||||||
sketch
|
sketch
|
||||||
set-width width
|
set-width width
|
||||||
|
@ -497,7 +519,9 @@ export : define [apply] : begin
|
||||||
: else : apply-transform : Translate (width / 2 - tw / 2) 0
|
: else : apply-transform : Translate (width / 2 - tw / 2) 0
|
||||||
apply-transform : Italify
|
apply-transform : Italify
|
||||||
set currentGlyph.cmpPriority 11
|
set currentGlyph.cmpPriority 11
|
||||||
save gn unicode
|
|
||||||
|
if (w == ww) : save gn unicode
|
||||||
|
: else : save gn
|
||||||
|
|
||||||
define [createSuperscripts records] : if [not recursive] : begin
|
define [createSuperscripts records] : if [not recursive] : begin
|
||||||
local pendingGlyphs : records.map : [record] => record.1
|
local pendingGlyphs : records.map : [record] => record.1
|
||||||
|
@ -988,6 +1012,7 @@ export : define [apply] : begin
|
||||||
if [not recursive] : let : begin
|
if [not recursive] : let : begin
|
||||||
local compositions : list
|
local compositions : list
|
||||||
list 0xA9 {'C'} FULLWIDTH2
|
list 0xA9 {'C'} FULLWIDTH2
|
||||||
|
list 0x1F12F {'turnC'} FULLWIDTH2
|
||||||
list 0xAE {'R'} FULLWIDTH2
|
list 0xAE {'R'} FULLWIDTH2
|
||||||
list 0x2117 {'P'} FULLWIDTH2
|
list 0x2117 {'P'} FULLWIDTH2
|
||||||
list 0x24EA {'zero'} FULLWIDTH1
|
list 0x24EA {'zero'} FULLWIDTH1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue