add ligations for <*> =>= etc.

This commit is contained in:
be5invis 2017-01-02 12:30:59 +08:00
parent 2fba9aee2f
commit 87745c5f15
3 changed files with 46 additions and 22 deletions

View File

@ -389,7 +389,7 @@ export : define [apply] : begin
curl (right - HALFSTROKE + TANSLANT * sw) (bot + O)
save 'at.fourfold'
sketch # at.petite
sketch # at.short
set-width WIDTH
local top operTop
@ -402,6 +402,7 @@ export : define [apply] : begin
local sma : SMOOTHA * ((m1 - SB) / (RIGHTSB - SB) * 1.1)
local smb : SMOOTHB * ((m1 - SB) / (RIGHTSB - SB) * 1.1)
local atTurnBot (obot - sma / 2)
local shrink 0.6
@ -419,17 +420,17 @@ export : define [apply] : begin
include : dispiro
widths.lhs sw
corner m1 (obot + sma) [heading UPWARD]
corner m1 (atTurnBot + sma) [heading UPWARD]
corner m1 (otop - smb) [heading UPWARD]
corner m1 otop [widths.heading (sw * shrink) 0 UPWARD]
include : dispiro
widths.lhs (sw * shrink)
straight.down.start (m1 - sw * shrink * HVCONTRAST) (obot + sma) [heading DOWNWARD]
straight.down.start (m1 - sw * shrink * HVCONTRAST) (atTurnBot + sma) [heading DOWNWARD]
arcvh
g4 ([mix (m1 - sw * HVCONTRAST) RIGHTSB 0.5] + CORRECTION_OMIDX * sw) (obot + O) [widths.lhs sw]
g4 ([mix (m1 - sw * HVCONTRAST) RIGHTSB 0.5] + CORRECTION_OMIDX * sw) (atTurnBot + O) [widths.lhs sw]
archv
flat RIGHTSB (obot + sma)
flat RIGHTSB (atTurnBot + sma)
curl RIGHTSB (top - SMOOTHB)
hookend (top - O)
g4 SB (top - HOOK)

View File

@ -163,35 +163,50 @@ export : define [apply para glyphList] : begin
dasiaoxia {'revCommaAbove' 'acuteAbove'}
dasiaperispomeni {'revCommaAbove' 'perispomeniAbove'}
local lookupOrder {}
# calt and other ligations
if (para.spacing > 0) : let : begin
if (para.spacing > 0) : do
local stick {'hyphen' 'equal'}
local less {'less'}
local hyphen {'hyphen'}
local exclam {'exclam'}
local greater {'greater'}
define [lsx s] : lambda [t] : t.map : lambda [x] "lig\(x).\(s)"
local progLigNameMap
.XHS_ 'hask'
.XPTL 'hask'
foreach
: ligationFeatureName : items-of : {'calt'}.concat [Object.keys progLigNameMap]
: begin
: do
local mappedFeature : progLigNameMap.(ligationFeatureName) || ligationFeatureName
local ligationLookupName : 'lig_' + mappedFeature
local ligationLookupName : 'lig_' + ligationFeatureName + '-' + mappedFeature
local [only subtable lns] : begin
if ([lns.indexOf mappedFeature] >= 0) [then : return subtable] : else : begin
if ([lns.indexOf mappedFeature] >= 0)
: then : return subtable
: else : begin
set subtable.apply {}
return subtable
commonList.push ligationFeatureName
set features.(ligationFeatureName) {ligationLookupName}
if [not lookups.(ligationLookupName)] : set lookups.(ligationLookupName)
local featLookups {}
local [includeLookup obj] : begin
local ln : ligationLookupName + featLookups.length
set lookups.(ln) obj
featLookups.push ln
lookupOrder.push ln
set features.(ligationFeatureName) featLookups
includeLookup
.type 'gsub_chaining'
.subtables : list
chain-rule less (stick ~> [lsx 'lc'] ) (stick ~> [lsx 'cc'] ) (stick ~> [lsx 'cc'] ) (stick ~> [lsx 'cr']) greater # <----> <=-==>
chain-rule {'less' 'hyphen' 'equal'} ({'asterisk'} ~> {'asterisk.low'}) # <*
chain-rule ({'asterisk'} ~> {'asterisk.low'}) {'greater' 'hyphen' 'equal'} # *>
includeLookup
.type 'gsub_chaining'
.subtables : list
chain-rule less (stick ~> [lsx 'lc'] ) (stick ~> [lsx 'cc'] ) (stick ~> [lsx 'cc'] ) (stick ~> [lsx 'cr']) greater # <----> <====>
chain-rule less (stick ~> [lsx 'lc'] ) (stick ~> [lsx 'cc'] ) (stick ~> [lsx 'cr']) greater # <---> <===>
chain-rule less (stick ~> [lsx 'lc'] ) (stick ~> [lsx 'cr']) greater # <--> <==>
chain-rule less (stick ~> [lsx 'lr']) greater # <->, <=>
@ -210,18 +225,26 @@ export : define [apply para glyphList] : begin
:> only {'hask'}
chain-rule (stick ~> [lsx 'fc']) (stick ~> [lsx 'cc']) (stick ~> [lsx 'cr']) greater # --->, ===>
chain-rule (stick ~> [lsx 'fc']) (stick ~> [lsx 'cr']) greater # -->, ==>
chain-rule (stick ~> [lsx 'fr']) greater (stick ~> [lsx 'jf']) # ->- =>=
:> only {'hask'}
chain-rule (stick ~> [lsx 'fr1']) (greater ~> [lsx 'shift1']) greater # ->>, =>>
:> only {'hask'}
chain-rule (stick ~> [lsx 'fr']) greater # ->, =>
chain-rule (stick ~> [lsx 'fj']) less (stick ~> [lsx 'lf']) # -<- =<=
:> only {'hask'}
chain-rule (stick ~> [lsx 'fj1']) (less ~> [lsx 'shiftN1']) less # -<<, =<<
:> only {'hask'}
chain-rule (stick ~> [lsx 'fj']) less # -<, =<
:> only {'hask'}
chain-rule ({'colon'} ~> {'colon.mid'}) {'greater' 'less' 'hyphen' 'equal' 'plus' 'colon.mid'} # :> :- := :< :+
chain-rule ({'colon'} ~> {'colon.mid'}) ({'colon'} ~> {'colon.mid'}) {'greater' 'less' 'hyphen' 'equal' 'plus' 'colon.mid'} # ::> ::- ::= ::< ::+
chain-rule ({'colon'} ~> {'colon.mid'}) ({'asterisk'} ~> {'asterisk.low'}) # :*
chain-rule ({'colon'} ~> {'colon.mid'}) ({'colon'} ~> {'colon.mid'}) ({'asterisk'} ~> {'asterisk.low'}) # ::*
chain-rule ({'asterisk'} ~> {'asterisk.low'}) ({'colon'} ~> {'colon.mid'}) # *:
chain-rule ({'colon'} ~> {'colon.mid'}) ({'colon'} ~> {'colon.mid'}) ({'colon'} ~> {'colon.mid'}) {'greater' 'less' 'hyphen' 'equal' 'plus' 'colon.mid'} # :::> :::- :::= :::< :::+
chain-rule ({'colon'} ~> {'colon.mid'}) ({'colon'} ~> {'colon.mid'}) {'greater' 'less' 'hyphen' 'equal' 'plus' 'colon.mid'} # ::> ::- ::= ::< ::+
chain-rule ({'colon'} ~> {'colon.mid'}) {'greater' 'less' 'hyphen' 'equal' 'plus' 'colon.mid'} # :> :- := :< :+
chain-rule {'greater' 'less' 'hyphen' 'equal' 'plus' 'colon.mid'} ({'colon'} ~> {'colon.mid'}) # <: >: -: =: +:
chain-rule {'colon.mid'} ({'colon'} ~> {'colon.mid'}) # ::
# Colon chains
chain-rule {'colon.dright' 'colon.dmid'} ({'colon'} ~> {'colon.dmid'}) {'colon'}
@ -247,7 +270,7 @@ export : define [apply para glyphList] : begin
.subtables : list
chain-rule [flatten fwtrail hwtrail fwopen hwopen fwmid hwmid] (fwopen ~> hwopen)
chain-rule (fwclose ~> hwclose) [flatten fwtrail hwtrail fwclose hwclose fwopen hwopen fwmid hwmid]
# locl, SRB
local srbSubtable null
if para.isItalic
@ -301,6 +324,6 @@ export : define [apply para glyphList] : begin
set languages.'cyrl_MKD ' {.features [{'locl_srb'}.concat commonList]}
set languages.'cyrl_BGR ' {.features [{'locl_bgr'}.concat commonList]}
local GSUB {.languages languages .features features .lookups lookups}
local GSUB {.languages languages .features features .lookups lookups .lookupOrder lookupOrder}
return [object GSUB GPOS GDEF]

View File

@ -350,13 +350,13 @@
<tr class="first"><th>Feature Tags</th><th>Designed For</th><th>Sample</th></tr>
<tr><td><i>No Ligation</i></td><td>&nbsp;</td><td class="nolig"><pre>-&lt;&lt; -&lt; &lt;-- &lt;--- &lt;&lt;- &lt;- -&gt; -&gt;&gt; --&gt; ---&gt; &gt;- &gt;&gt;- &lt;-&gt; &lt;--&gt; &lt;---&gt; &lt;----&gt; &lt;!--
=&lt;&lt; =&lt; &lt;== &lt;=== &lt;&lt;= &lt;= =&gt; =&gt;&gt; ==&gt; ===&gt; &gt;= &gt;&gt;= &lt;=&gt; &lt;==&gt; &lt;===&gt; &lt;====&gt; &lt;!---
:= :- :+ :&lt; :&gt; &lt;: &gt;: +: -: =: a:b a::b a:::b</pre></td></tr>
:= :- :+ :&lt; :&gt; &lt;: &gt;: +: -: =: :* ::* &lt;*&gt; *: *:: a:b a::b a:::b</pre></td></tr>
<tr><td>calt</td><td><i>Default setting set in<br>most IDEs and editors</i></td><td><pre><s>-&lt;&lt;</s> <s>-&lt;</s> &lt;-- &lt;--- <s>&lt;&lt;-</s> &lt;- -&gt; <s>-&gt;&gt;</s> --&gt; ---&gt; <s>&gt;-</s> <s>&gt;&gt;-</s> &lt;-&gt; &lt;--&gt; &lt;---&gt; &lt;----&gt; &lt;!--
<s>=&lt;&lt;</s> <s>=&lt;</s> &lt;== &lt;=== <s>&lt;&lt;=</s> <s>&lt;=</s> =&gt; <s>=&gt;&gt;</s> ==&gt; ===&gt; <s>&gt;=</s> <s>&gt;&gt;=</s> &lt;=&gt; &lt;==&gt; &lt;===&gt; &lt;====&gt; &lt;!---
:= :- :+ :&lt; :&gt; &lt;: &gt;: +: -: =: a:b a::b a:::b</pre></td></tr>
:= :- :+ :&lt; :&gt; &lt;: &gt;: +: -: =: :* ::* &lt;*&gt; *: *:: a:b a::b a:::b</pre></td></tr>
<tr><td>XHS_, XPTL</td><td>Haskell, PatEL</td><td style="font-feature-settings: &quot;XHS_&quot; 1"><pre>-&lt;&lt; -&lt; &lt;-- &lt;--- &lt;&lt;- &lt;- -&gt; -&gt;&gt; --&gt; ---&gt; &gt;- &gt;&gt;- &lt;-&gt; &lt;--&gt; &lt;---&gt; &lt;----&gt; &lt;!--
=&lt;&lt; =&lt; &lt;== &lt;=== &lt;&lt;= <s>&lt;=</s> =&gt; =&gt;&gt; ==&gt; ===&gt; <s>&gt;=</s> &gt;&gt;= &lt;=&gt; &lt;==&gt; &lt;===&gt; &lt;====&gt; &lt;!---
:= :- :+ :&lt; :&gt; &lt;: &gt;: +: -: =: a:b a::b a:::b</pre></td></tr>
:= :- :+ :&lt; :&gt; &lt;: &gt;: +: -: =: :* ::* &lt;*&gt; *: *:: a:b a::b a:::b</pre></td></tr>
</table>
</section>