Skip to content

Commit e02bd37

Browse files
committed
Use 100% font stretch as default
1 parent 33ae373 commit e02bd37

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/type/p5.Font.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ export class Font {
691691
} else if (tag === 'wdth') {
692692
// TODO: map from keywords (normal, ultra-condensed, etc) to values
693693
// return renderer.states.fontStretch
694-
return defaultVal;
694+
return 100;
695695
} else if (renderer.textCanvas().style.fontVariationSettings) {
696696
const match = new RegExp(`\\b${tag}\s+(\d+)`)
697697
.exec(renderer.textCanvas().style.fontVariationSettings);
@@ -977,7 +977,7 @@ function createFontFace(name, path, descriptors, rawFont) {
977977
if (tag === 'wght') {
978978
descriptors.weight = `${minVal} ${maxVal}`;
979979
} else if (tag === 'wdth') {
980-
descriptors.stretch = `${minVal} ${maxVal}`;
980+
descriptors.stretch = `${minVal}% ${maxVal}%`;
981981
}
982982
// TODO add other descriptors
983983
}

test/unit/visual/cases/typography.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ visualSuite("Typography", function () {
113113
p5.createCanvas(100, 100);
114114
const font = await p5.loadFont(
115115
'/unit/assets/BricolageGrotesque-Variable.ttf',
116-
{ weight: '200 800' }
117116
);
118117
for (let weight = 400; weight <= 800; weight += 100) {
119118
p5.background(255);
@@ -130,7 +129,6 @@ visualSuite("Typography", function () {
130129
p5.createCanvas(100, 100, p5.WEBGL);
131130
const font = await p5.loadFont(
132131
'/unit/assets/BricolageGrotesque-Variable.ttf',
133-
{ weight: '200 800' }
134132
);
135133
for (let weight = 400; weight <= 800; weight += 100) {
136134
p5.push();

0 commit comments

Comments
 (0)