Fix frac feature for better recognizing fraction patterns (#2214).

This commit is contained in:
be5invis 2024-02-26 18:05:52 -08:00
parent bcb50d4681
commit d076cf8320
3 changed files with 34 additions and 57 deletions

View file

@ -41,3 +41,4 @@
* Unify diagonal box drawings' angles (#2197).
* Fix Large Type Piece `U+1CE3B` (#2206).
* Added a `MOSC` feature that turns certain geometric shapes into mosaics (#2212).
* Fix `frac` feature for better recognizing fraction patterns (#2214).

View file

@ -111,21 +111,6 @@ glyph-block Autobuild-Transformed : begin
createSuperscripts 'sup' null : list
list 0x00AA 'aSbRsbUnderlineBelow'
list 0x00BA 'oSbRsbUnderlineBelow'
list 0x2070 'zero.lnum'
list 0x00B9 'one.lnum'
list 0x00B2 'two.lnum'
list 0x00B3 'three.lnum'
list 0x2074 'four.lnum'
list 0x2075 'five.lnum'
list 0x2076 'six.lnum'
list 0x2077 'seven.lnum'
list 0x2078 'eight.lnum'
list 0x2079 'nine.lnum'
list 0x207A 'plus'
list 0x207B 'minus'
list 0x207C 'equal'
list 0x207D 'parenLeft'
list 0x207E 'parenRight'
list 0x02B0 'h'
list 0x02B1 'hHookTop'
list 0x02B2 'j'
@ -143,6 +128,11 @@ glyph-block Autobuild-Transformed : begin
list 0x02E3 'x'
list 0x02E4 'revGlottalStop'
list 0x2071 'i'
list 0x207A 'plus'
list 0x207B 'minus'
list 0x207C 'equal'
list 0x207D 'parenLeft'
list 0x207E 'parenRight'
list 0x207F 'n'
list 0x1D43 'a'
list 0x1D44 'turna'
@ -214,6 +204,7 @@ glyph-block Autobuild-Transformed : begin
list 0x1DBE 'ezh'
list 0x1DBF 'grek/theta'
list 0x1D2C 'A'
list 0x1D2D 'AE'
list 0x1D2E 'B'
list 0x1D2F 'BBar'
list 0x1D30 'D'
@ -352,24 +343,17 @@ glyph-block Autobuild-Transformed : begin
list null 'seven.onum'
list null 'eight.onum'
list null 'nine.onum'
list null 'zero.lnum'
list null 'one.lnum'
list null 'two.lnum'
list null 'three.lnum'
list null 'four.lnum'
list null 'five.lnum'
list null 'six.lnum'
list null 'seven.lnum'
list null 'eight.lnum'
list null 'nine.lnum'
do "superscript AE"
define { tnmAHalf jobsAHalf } : createSuperscripts 'sup' null { { null 'AE/AHalf' } }
define { tnmEHalf jobsEHalf } : createSuperscripts 'sup' null { { null 'AE/EHalf' } }
create-glyph 'sup{AE}' 0x1D2D : glyph-proc
include [refer-glyph tnmAHalf.('AE/AHalf')] AS_BASE ALSO_METRICS
include [refer-glyph tnmEHalf.('AE/EHalf')]
CvDecompose.set currentGlyph { tnmAHalf.('AE/AHalf') tnmEHalf.('AE/EHalf') }
list 0x2070 'zero.lnum'
list 0x00B9 'one.lnum'
list 0x00B2 'two.lnum'
list 0x00B3 'three.lnum'
list 0x2074 'four.lnum'
list 0x2075 'five.lnum'
list 0x2076 'six.lnum'
list 0x2077 'seven.lnum'
list 0x2078 'eight.lnum'
list 0x2079 'nine.lnum'
list null 'period'
: where : [createSuperscripts prefix gr _records] : begin
local {records relSets targetNameMap} : extendRelatedGlyphs prefix _records
@ -394,16 +378,6 @@ glyph-block Autobuild-Transformed : begin
do
createSubscripts 'sub' null : list
list 0x2080 'zero.lnum'
list 0x2081 'one.lnum'
list 0x2082 'two.lnum'
list 0x2083 'three.lnum'
list 0x2084 'four.lnum'
list 0x2085 'five.lnum'
list 0x2086 'six.lnum'
list 0x2087 'seven.lnum'
list 0x2088 'eight.lnum'
list 0x2089 'nine.lnum'
list 0x208A 'plus'
list 0x208B 'minus'
list 0x208C 'equal'
@ -475,16 +449,17 @@ glyph-block Autobuild-Transformed : begin
list null 'seven.onum'
list null 'eight.onum'
list null 'nine.onum'
list null 'zero.lnum'
list null 'one.lnum'
list null 'two.lnum'
list null 'three.lnum'
list null 'four.lnum'
list null 'five.lnum'
list null 'six.lnum'
list null 'seven.lnum'
list null 'eight.lnum'
list null 'nine.lnum'
list 0x2080 'zero.lnum'
list 0x2081 'one.lnum'
list 0x2082 'two.lnum'
list 0x2083 'three.lnum'
list 0x2084 'four.lnum'
list 0x2085 'five.lnum'
list 0x2086 'six.lnum'
list 0x2087 'seven.lnum'
list 0x2088 'eight.lnum'
list 0x2089 'nine.lnum'
list null 'period'
: where : [createSubscripts prefix gr _records] : begin
local {records relSets targetNameMap} : extendRelatedGlyphs prefix _records

View file

@ -9,10 +9,6 @@ export : define [buildFrac gsub glyphStore] : begin
define frac : gsub.addCommonFeature : gsub.createFeature 'frac'
define { chain-rule reverse-rule } : gsub.ChainRuleBuilder
define subSolidus : gsub.createLookup : object
.type 'gsub_single'
.substitutions : object ['solidus' 'fractionBar'] ['slash' 'fractionBar']
define digitSet { }
define numSet { }
define denSet { }
@ -25,6 +21,11 @@ export : define [buildFrac gsub glyphStore] : begin
numSet.push numForm
denSet.push denForm
define subSolidus : gsub.createLookup : object
.type 'gsub_chaining'
.rules : list
chain-rule digitSet ({'solidus' 'slash'} ~> {'fractionBar' 'fractionBar'}) digitSet
define subDen : gsub.createLookup : object
.type 'gsub_chaining'
.rules : list