Skip to content

Commit

Permalink
* Add proper support for IPA tone letters (#508).
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed May 18, 2020
1 parent ec45a1a commit bc659cf
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changes/3.1.0.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* Add Pitman duodecimal digits (#483).
* Add Pitman duodecimal digits (#483).
* Add proper support for IPA tone letters (#508).
46 changes: 45 additions & 1 deletion glyphs/symbol-other.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,55 @@ glyph-block Symbol-Other-Phonetic : begin
line-to (MIDDLE + triangleSize * 1.35) XH
save 'halftrianglecolon' 0x2D1

define [yOfTone tone] : mix (OPERATORSTROKE / 2) (CAP - OPERATORSTROKE / 2) (tone / 4)

foreach tone [range 4 downtill 0] : begin
create-glyph ('tone' + tone) : glyph-construction
assign-unicode (0x2E5 + 4 - tone)
include : VBarRight [mix SB RIGHTSB 0.9] 0 CAP OPERATORSTROKE
include : HBar [mix SB RIGHTSB 0.1] ([mix SB RIGHTSB 0.9] - 1) [mix (OPERATORSTROKE / 2) (CAP - OPERATORSTROKE / 2) (tone / 4)] OPERATORSTROKE
include : HBar [mix SB RIGHTSB 0.1] ([mix SB RIGHTSB 0.9] - 1) [yOfTone tone] OPERATORSTROKE

foreach toneStart [range 4 downtill 0] : foreach toneEnd [range 4 downtill 0] : begin
create-glyph ('toneStart' + toneStart + toneEnd) : glyph-construction
include : intersection
Rect CAP 0 0 WIDTH
dispiro
widths.center OPERATORSTROKE
corner (WIDTH / 2) [yOfTone toneStart]
corner (WIDTH + WIDTH / 2) [yOfTone toneEnd]

foreach toneStart [range 4 downtill 0] : foreach toneEnd [range 4 downtill 0] : begin
create-glyph ('toneEnd' + toneStart + toneEnd) : glyph-construction
include : intersection
Rect CAP 0 0 MIDDLE
dispiro
widths.center OPERATORSTROKE
corner (0 - WIDTH / 2) [yOfTone toneStart]
corner (WIDTH + WIDTH / 2) [yOfTone : mix toneStart toneEnd 2]
include : VBar MIDDLE 0 CAP OPERATORSTROKE

foreach toneStart [range 4 downtill 0] : foreach toneMid [range 4 downtill 0] : foreach toneEnd [range 4 downtill 0] : begin
create-glyph ('toneMid' + toneStart + toneMid + toneEnd) : glyph-construction
include : intersection
Rect CAP 0 0 WIDTH
union
intersection
dispiro
widths.center OPERATORSTROKE
corner (0 - WIDTH / 2) [yOfTone toneStart]
corner (WIDTH + WIDTH / 2) [yOfTone : mix toneStart toneMid 2]
dispiro
widths.center OPERATORSTROKE
corner (0 - WIDTH / 2) [yOfTone : mix toneEnd toneMid 2]
corner (WIDTH + WIDTH / 2) [yOfTone toneEnd]
dispiro
widths.center OPERATORSTROKE
corner (0 - WIDTH / 2) [yOfTone toneStart]
corner (WIDTH / 2) [yOfTone toneMid]
dispiro
widths.center OPERATORSTROKE
corner (WIDTH / 2) [yOfTone toneMid]
corner (WIDTH + WIDTH / 2) [yOfTone toneEnd]

glyph-block Symbol-Other-Suit-Cards : begin
glyph-block-import CommonShapes
Expand Down
60 changes: 60 additions & 0 deletions otl/gsub-ccmp.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ export : define [buildCCMP sink glyphs markGlyphs] : begin
define [IotaLF] : {'iotaBelow'} ~> {'iotaLF'}
define [OgonekTrailing] : {'ogonekBelow'} ~> {'ogonekTR'}

define [ToneToToneStart toneEnd] : begin
local f {}
local e {}
foreach toneStart [range 4 downtill 0] : begin
f.push ('tone' + toneStart)
e.push ('toneStart' + toneStart + toneEnd)
return (f ~> e)

define [ToneToToneEnd toneStart] : begin
local f {}
local e {}
foreach toneEnd [range 4 downtill 0] : begin
f.push ('tone' + toneEnd)
e.push ('toneEnd' + toneStart + toneEnd)
return (f ~> e)

define [toneStartOrMidAt y]: begin
local f {}
foreach toneEnd [range 4 downtill 0] : begin
f.push ('toneStart' + y + toneEnd)
foreach toneStart [range 4 downtill 0] : foreach toneEnd [range 4 downtill 0] : begin
f.push ('toneMid' + toneStart + y + toneEnd)
return f

define [ToneStartToToneMid toneStart] : begin
local f {}
local e {}
foreach toneMid [range 4 downtill 0] : foreach toneEnd [range 4 downtill 0] : begin
f.push ('toneStart' + toneMid + toneEnd)
e.push ('toneMid' + toneStart + toneMid + toneEnd)
return (f ~> e)

define lookupCcmp1 : add-lookup sink : object
.type 'gsub_chaining'
.subtables : list
Expand Down Expand Up @@ -60,5 +92,33 @@ export : define [buildCCMP sink glyphs markGlyphs] : begin
object [from {'revCommaAbove' 'acuteAbove'}] [to 'dasiaoxia']
object [from {'revCommaAbove' 'perispomeniAbove'}] [to 'dasiaperispomeni']

define lookupCcmp-ToneStart : add-lookup sink : object
.type 'gsub_chaining'
.subtables : list
chain-rule [ToneToToneStart 0] {'tone0'}
chain-rule [ToneToToneStart 1] {'tone1'}
chain-rule [ToneToToneStart 2] {'tone2'}
chain-rule [ToneToToneStart 3] {'tone3'}
chain-rule [ToneToToneStart 4] {'tone4'}

define lookupCcmp-ToneMid : add-lookup sink : object
.type 'gsub_chaining'
.subtables : list
chain-rule [toneStartOrMidAt 0] [ToneStartToToneMid 0]
chain-rule [toneStartOrMidAt 1] [ToneStartToToneMid 1]
chain-rule [toneStartOrMidAt 2] [ToneStartToToneMid 2]
chain-rule [toneStartOrMidAt 3] [ToneStartToToneMid 3]
chain-rule [toneStartOrMidAt 4] [ToneStartToToneMid 4]

define lookupCcmp-ToneEnd : add-lookup sink : object
.type 'gsub_chaining'
.subtables : list
chain-rule [toneStartOrMidAt 0] [ToneToToneEnd 0]
chain-rule [toneStartOrMidAt 1] [ToneToToneEnd 1]
chain-rule [toneStartOrMidAt 2] [ToneToToneEnd 2]
chain-rule [toneStartOrMidAt 3] [ToneToToneEnd 3]
chain-rule [toneStartOrMidAt 4] [ToneToToneEnd 4]

ccmp.lookups.push lookupCcmp1 lookupCcmp2
ccmp.lookups.push lookupCcmp-ToneStart lookupCcmp-ToneMid lookupCcmp-ToneEnd
add-common-feature sink ccmp

0 comments on commit bc659cf

Please sign in to comment.