@@ -1523,7 +1523,7 @@ function elements.sqrt:output (x, y, line)
15231523 local symbol = {
15241524 _r (self .radicalRuleThickness ),
15251525 " w" , -- line width
1526- 2 ,
1526+ 1 ,
15271527 " j" , -- round line joins
15281528 _r (sw + s0 ),
15291529 _r (self .extraAscender ),
@@ -1598,6 +1598,63 @@ end
15981598
15991599function elements .padded .output (_ , _ , _ , _ ) end
16001600
1601+ -- Bevelled fractions are not part of MathML Core, and MathML4 does not
1602+ -- exactly specify how to compute the layout.
1603+ elements .bevelledFraction = pl .class (elements .fraction ) -- Inherit from fraction
1604+ elements .fraction ._type = " BevelledFraction"
1605+
1606+ function elements .bevelledFraction :shape ()
1607+ local constants = self :getMathMetrics ().constants
1608+ local scaleDown = self :getScaleDown ()
1609+ local hSkew = constants .skewedFractionHorizontalGap * scaleDown
1610+ -- OpenType has properties which are not totally explicit.
1611+ -- The definition of skewedFractionVerticalGap (and its value in fonts
1612+ -- such as Libertinus Math) seems to imply that it is measured from the
1613+ -- bottom of the numerator to the top of the denominator.
1614+ -- This does not seem to be a nice general layout.
1615+ -- So we will use superscriptShiftUp(Cramped) for the numerator:
1616+ local vSkewUp = isCrampedMode (self .mode ) and constants .superscriptShiftUpCramped * scaleDown
1617+ or constants .superscriptShiftUp * scaleDown
1618+ -- And all good books say that the denominator should not be shifted down:
1619+ local vSkewDown = 0
1620+
1621+ self .ruleThickness = self .attributes .linethickness
1622+ and SU .cast (" measurement" , self .attributes .linethickness ):tonumber ()
1623+ or constants .fractionRuleThickness * scaleDown
1624+ self .numerator .relX = SILE .types .length (0 )
1625+ self .numerator .relY = SILE .types .length (- vSkewUp )
1626+ self .denominator .relX = self .numerator .width + hSkew
1627+ self .denominator .relY = SILE .types .length (vSkewDown )
1628+ self .width = self .numerator .width + self .denominator .width + hSkew
1629+ self .height = maxLength (self .numerator .height + vSkewUp , self .denominator .height - vSkewDown )
1630+ self .depth = maxLength (self .numerator .depth - vSkewUp , self .denominator .depth + vSkewDown )
1631+ self .barWidth = SILE .types .length (hSkew )
1632+ self .barX = self .numerator .relX + self .numerator .width
1633+ end
1634+
1635+ function elements .bevelledFraction :output (x , y , line )
1636+ local h = self .height :tonumber ()
1637+ local d = self .depth :tonumber ()
1638+ local barwidth = scaleWidth (self .barWidth , line ):tonumber ()
1639+ local xscaled = scaleWidth (x + self .barX , line )
1640+ local rd = self .ruleThickness / 2
1641+ local symbol = {
1642+ _r (self .ruleThickness ),
1643+ " w" , -- line width
1644+ 1 ,
1645+ " J" , -- round line caps
1646+ _r (0 ),
1647+ _r (d + h - rd ),
1648+ " m" ,
1649+ _r (barwidth ),
1650+ _r (rd ),
1651+ " l" ,
1652+ " S" ,
1653+ }
1654+ local svg = table.concat (symbol , " " )
1655+ SILE .outputter :drawSVG (svg , xscaled , y , barwidth , h , 1 )
1656+ end
1657+
16011658elements .mathMode = mathMode
16021659elements .atomType = atomType
16031660elements .symbolDefaults = symbolDefaults
0 commit comments