Skip to content

Commit

Permalink
Fix frac feature for better recognizing fraction patterns (#2214).
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Feb 27, 2024
1 parent bcb50d4 commit d076cf8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 57 deletions.
1 change: 1 addition & 0 deletions changes/29.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
81 changes: 28 additions & 53 deletions packages/font-glyphs/src/auto-build/transformed.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions packages/font-otl/src/gsub-frac.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand All @@ -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
Expand Down

0 comments on commit d076cf8

Please sign in to comment.