From 87745c5f159fceb389210c6e374141694e9598a3 Mon Sep 17 00:00:00 2001 From: be5invis Date: Mon, 2 Jan 2017 12:30:59 +0800 Subject: [PATCH] add ligations for <*> =>= etc. --- glyphs/symbol-punctuation.ptl | 11 ++++---- meta/features.ptl | 51 +++++++++++++++++++++++++---------- snapshot/index.html | 6 ++--- 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/glyphs/symbol-punctuation.ptl b/glyphs/symbol-punctuation.ptl index 3925a02..ef7ecc4 100644 --- a/glyphs/symbol-punctuation.ptl +++ b/glyphs/symbol-punctuation.ptl @@ -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) diff --git a/meta/features.ptl b/meta/features.ptl index 4b1a9be..0fa6c0b 100644 --- a/meta/features.ptl +++ b/meta/features.ptl @@ -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] \ No newline at end of file diff --git a/snapshot/index.html b/snapshot/index.html index 4009a6e..9bdb27b 100644 --- a/snapshot/index.html +++ b/snapshot/index.html @@ -350,13 +350,13 @@ Feature TagsDesigned ForSample No Ligation 
-<< -< <-- <--- <<- <- -> ->> --> ---> >- >>- <-> <--> <---> <----> <!--
 =<< =< <== <=== <<= <= => =>> ==> ===> >= >>= <=> <==> <===> <====> <!---
-:= :- :+ :< :>   <: >: +: -: =:   a:b a::b a:::b
+:= :- :+ :< :> <: >: +: -: =: :* ::* <*> *: *:: a:b a::b a:::b caltDefault setting set in
most IDEs and editors
-<< -< <-- <--- <<- <- -> ->> --> ---> >- >>- <-> <--> <---> <----> <!--
 =<< =< <== <=== <<= <= => =>> ==> ===> >= >>= <=> <==> <===> <====> <!---
-:= :- :+ :< :>   <: >: +: -: =:   a:b a::b a:::b
+:= :- :+ :< :> <: >: +: -: =: :* ::* <*> *: *:: a:b a::b a:::b XHS_, XPTLHaskell, PatEL
-<< -< <-- <--- <<- <- -> ->> --> ---> >- >>- <-> <--> <---> <----> <!--
 =<< =< <== <=== <<= <= => =>> ==> ===> >= >>= <=> <==> <===> <====> <!---
-:= :- :+ :< :>   <: >: +: -: =:   a:b a::b a:::b
+:= :- :+ :< :> <: >: +: -: =: :* ::* <*> *: *:: a:b a::b a:::b