Add compile option to default to old-style figures (#397).

This commit is contained in:
be5invis 2020-09-20 15:33:42 -07:00
parent 9f2dc4595e
commit 1d4b78d7a3
4 changed files with 53 additions and 31 deletions

View file

@ -223,6 +223,10 @@ The current available styles for `design`/`upright`/`italic`/`oblique` options a
- Recommended for Linux users who customize for their terminal fonts: certain applications, including FontConfig, recognizes a font as monospace if and only if its every non-combining glyphs having the same width.
- `sp-fixed` : Apply `sp-force-monospace` and `no-ligation` together.
* Style for controlling digits' (figures') style:
- `default-to-old-style-figures`, `default-to-old-style-digits`: Default digit figures to old-style.
- `default-to-lining-figures`, `default-to-lining-digits`: Default digit figures to lining.
<!-- BEGIN Section-Cherry-Picking-Predefined -->
<!-- THIS SECTION IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->

1
changes/3.6.2.md Normal file
View file

@ -0,0 +1 @@
* Add compile option to default to old-style figures (#397).

View file

@ -21,10 +21,14 @@ glyph-block Digits-Shared : begin
e : MarkSet.OfZone {.top OnumHeight .bot 0}
p : MarkSet.OfZone {.top OnumHeight .bot (OnumHeight - CAP)}
glyph-block-export CodeLnum CodeOnum
define [CodeLnum u] : if para.defaultToOldStyleFigures null u
define [CodeOnum u] : if para.defaultToOldStyleFigures u null
glyph-block Digits-Zero : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumHeight OnumMarks
glyph-block-import Digits-Shared : OnumHeight OnumMarks CodeLnum CodeOnum
define [ZeroSlashShape top] : begin
local fine : 0.5 * OverlayStroke
@ -114,13 +118,13 @@ glyph-block Digits-Zero : begin
include : refer-glyph "zero.onum.unslashed"
include : ZeroLongDotShape OnumHeight
select-variant 'zero.lnum' '0' (follow -- 'zero')
select-variant 'zero.onum' (follow -- 'zero')
select-variant 'zero.lnum' [CodeLnum '0'] (follow -- 'zero')
select-variant 'zero.onum' [CodeOnum '0'] (follow -- 'zero')
glyph-block Digits-One : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumHeight OnumMarks
glyph-block-import Digits-Shared : OnumHeight OnumMarks CodeLnum CodeOnum
define [OneShape top balance] : glyph-proc
define topSW : adviceBlackness 3.5
@ -157,13 +161,13 @@ glyph-block Digits-One : begin
include : VBar Middle 0 OnumHeight
set currentGlyph.autoRefPriority (-2)
select-variant 'one.lnum' '1' (follow -- 'one')
select-variant 'one.onum' (follow -- 'one')
select-variant 'one.lnum' [CodeLnum '1'] (follow -- 'one')
select-variant 'one.onum' [CodeOnum '1'] (follow -- 'one')
glyph-block Digits-Two : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumHeight OnumMarks
glyph-block-import Digits-Shared : OnumHeight OnumMarks CodeLnum CodeOnum
define [TwoShape top] : glyph-proc
define smooth : [adviceGlottalStopSmooth top 1] * 0.95
@ -180,11 +184,11 @@ glyph-block Digits-Two : begin
if SLAB : begin
include : UpwardRightSerif RightSB 0 VJut
create-glyph 'two.lnum' '2' : glyph-proc
create-glyph 'two.lnum' [CodeLnum '2'] : glyph-proc
include : MarkSet.capital
include : TwoShape CAP
create-glyph 'two.onum' : glyph-proc
create-glyph 'two.onum' [CodeOnum '2'] : glyph-proc
include : OnumMarks.e
include : TwoShape OnumHeight
@ -193,7 +197,7 @@ glyph-block Digits-Two : begin
glyph-block Digits-Three : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumHeight OnumMarks ShiftDown
glyph-block-import Digits-Shared : OnumHeight OnumMarks ShiftDown CodeLnum CodeOnum
glyph-block-import Letter-Latin-Ezh : EzhShape
define [ThreeShape top] : glyph-proc
@ -231,15 +235,15 @@ glyph-block Digits-Three : begin
include : EzhShape CAP 0 0.25 0.975
include : ShiftDown
select-variant 'three.lnum' '3' (follow -- 'three')
select-variant 'three.onum' (follow -- 'three')
select-variant 'three.lnum' [CodeLnum '3'] (follow -- 'three')
select-variant 'three.onum' [CodeOnum '3'] (follow -- 'three')
turned 'turnDigitThree' 0x218B 'three.lnum' Middle (CAP / 2)
glyph-block Digits-Four : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumMarks ShiftDown
glyph-block-import Digits-Shared : OnumMarks ShiftDown CodeLnum CodeOnum
define [FourStdShape top open crossing] : glyph-proc
local yBar (top * 0.4)
@ -329,13 +333,13 @@ glyph-block Digits-Four : begin
include : FourOpenShape CAP false
include : ShiftDown
select-variant 'four.lnum' '4' (follow -- 'four')
select-variant 'four.onum' (follow -- 'four')
select-variant 'four.lnum' [CodeLnum '4'] (follow -- 'four')
select-variant 'four.onum' [CodeOnum '4'] (follow -- 'four')
glyph-block Digits-Five : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumMarks ShiftDown
glyph-block-import Digits-Shared : OnumMarks ShiftDown CodeLnum CodeOnum
define [FiveShape top bp] : glyph-proc
local t1 : top * bp * 0.8
@ -361,11 +365,11 @@ glyph-block Digits-Five : begin
include : DownwardRightSerif xright top VJut
Rect (t2 / 2 + top * 0.015) (t2 / 2 - top * 0.015) 0 Middle
create-glyph 'five.lnum' '5' : glyph-proc
create-glyph 'five.lnum' [CodeLnum '5'] : glyph-proc
include : MarkSet.capital
include : FiveShape CAP designParameters.fiveBarPos
create-glyph 'five.onum' : glyph-proc
create-glyph 'five.onum' [CodeOnum '5'] : glyph-proc
include : OnumMarks.p
include : FiveShape CAP designParameters.fiveBarPos
include : ShiftDown
@ -381,6 +385,7 @@ glyph-block Digits-Five : begin
glyph-block Digits-Six : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : CodeLnum CodeOnum
glyph-block-export OpenContourSixShape
define [OpenContourSixShape charTop] : glyph-proc
@ -462,27 +467,24 @@ glyph-block Digits-Six : begin
create-glyph 'six.lnum.openContour' : glyph-proc
include : MarkSet.capital
include : OpenContourSixShape CAP
create-aliased-glyph 'six.onum.openContour'
create-glyph 'six.lnum.closedContour' : glyph-proc
include : MarkSet.capital
include : ClosedContourNineShape CAP
include : FlipAround (Middle) (CAP / 2)
create-aliased-glyph 'six.onum.closedContour'
create-glyph 'six.lnum.straightBar' : glyph-proc
include : MarkSet.capital
include : StraightBarSixShape CAP
create-aliased-glyph 'six.onum.straightBar'
select-variant 'six.lnum' '6' (follow -- 'six')
select-variant 'six.onum' (follow -- 'six')
select-variant 'six.lnum' [CodeLnum '6'] (follow -- 'six')
alias 'six.onum' [CodeOnum '6'] 'six.lnum'
glyph-block Digits-Seven : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumMarks ShiftDown
glyph-block-import Digits-Shared : OnumMarks ShiftDown CodeLnum CodeOnum
define SevenXLeft : mix SB RightSB 0.28
define [SevenSwCor top] : [Math.hypot 1 ((RightSB - SevenXLeft - HalfStroke) / (top - Stroke))] * HVContrast
@ -531,12 +533,13 @@ glyph-block Digits-Seven : begin
include : DownwardLeftSerif (SB + (OX - O)) CAP VJut
include : ShiftDown
select-variant 'seven.lnum' '7' (follow -- 'seven')
select-variant 'seven.onum' (follow -- 'seven')
select-variant 'seven.lnum' [CodeLnum '7'] (follow -- 'seven')
select-variant 'seven.onum' [CodeOnum '7'] (follow -- 'seven')
glyph-block Digits-Eight : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : CodeLnum CodeOnum
local EightPr : StrokeWidthBlend 0.85 0.925
define [EightShape top] : begin
@ -560,10 +563,11 @@ glyph-block Digits-Eight : begin
arcvh
close
create-glyph 'eight.lnum' '8' : glyph-proc
create-glyph 'eight.lnum' [CodeLnum '8'] : glyph-proc
include : MarkSet.capital
include : EightShape CAP
create-aliased-glyph 'eight.onum'
alias 'eight.onum' [CodeOnum '8'] 'eight.lnum'
# There is an "eight without lower contour" shape used for /propto
create-glyph 'rotetedpropto' : glyph-proc # rotetedpropto
@ -586,7 +590,7 @@ glyph-block Digits-Eight : begin
glyph-block Digits-Nine : begin
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Digits-Shared : OnumHeight OnumMarks ShiftDown
glyph-block-import Digits-Shared : OnumHeight OnumMarks ShiftDown CodeLnum CodeOnum
glyph-block-import Digits-Six : ClosedContourNineShape OpenContourSixShape StraightBarSixShape
create-glyph 'nine.lnum.closedContour' : glyph-proc
@ -618,8 +622,8 @@ glyph-block Digits-Nine : begin
include : StraightBarSixShape CAP
include : FlipAround (Middle) (OnumHeight / 2)
select-variant 'nine.lnum' '9' (follow -- 'nine')
select-variant 'nine.onum' (follow -- 'nine')
select-variant 'nine.lnum' [CodeLnum '9'] (follow -- 'nine')
select-variant 'nine.onum' [CodeOnum '9'] (follow -- 'nine')
glyph-block Digits-Ten : begin
glyph-block-import CommonShapes

View file

@ -122,6 +122,19 @@ diversityF = 0.75
diversityI = 0.75
diversityII = 0.5
###### Old-style figures
[default-to-old-style-figures]
defaultToOldStyleFigures = true
[default-to-old-style-digits]
defaultToOldStyleFigures = true
[default-to-lining-figures]
defaultToOldStyleFigures = false
[default-to-lining-digits]
defaultToOldStyleFigures = false
###################################################################################################
### Metric-override hives
### These hives are now discouraged in favor of 'metric-override' in build plans but they are