Skip to content

Commit c3d047d

Browse files
committed
rescale monospace base width to 63
closes #1879
1 parent ebe85f2 commit c3d047d

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

src/marks/text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export function defaultWidth(text, start = 0, end = text.length) {
409409
export function monospaceWidth(text, start = 0, end = text.length) {
410410
let sum = 0;
411411
for (let i = start; i < end; i = readCharacter(text, i)) {
412-
sum += isPictographic(text, i) ? 200 : 100;
412+
sum += isPictographic(text, i) ? 126 : 63;
413413
}
414414
return sum;
415415
}

test/output/textOverflow.svg

Lines changed: 27 additions & 27 deletions
Loading

test/plots/text-overflow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export async function textOverflow() {
7171
fx: () => "monospace",
7272
monospace: true,
7373
textOverflow: "ellipsis-end",
74-
lineWidth: 13,
74+
lineWidth: 8,
7575
dx: -4,
7676
frameAnchor: "right"
7777
}),
@@ -117,7 +117,7 @@ async function textOverflowPlot(textOverflow, {monospace = false} = {}) {
117117
color: {domain: opinions, scheme: "rdylbu"},
118118
marks: [
119119
Plot.axisX({monospace}),
120-
Plot.axisY({lineWidth: monospace ? 9 : 6, textOverflow, monospace}),
120+
Plot.axisY({lineWidth: 6, textOverflow, monospace}),
121121
Plot.axisY({
122122
anchor: "right",
123123
tickFormat: (name) => `${dates.get(name).getUTCFullYear()}`,

0 commit comments

Comments
 (0)