diff --git a/src/marks/text.js b/src/marks/text.js index c7feb36bfe..a243c5a1c1 100644 --- a/src/marks/text.js +++ b/src/marks/text.js @@ -409,7 +409,7 @@ export function defaultWidth(text, start = 0, end = text.length) { export function monospaceWidth(text, start = 0, end = text.length) { let sum = 0; for (let i = start; i < end; i = readCharacter(text, i)) { - sum += isPictographic(text, i) ? 200 : 100; + sum += isPictographic(text, i) ? 126 : 63; } return sum; } diff --git a/test/output/textOverflow.svg b/test/output/textOverflow.svg index 4f7549895e..c9e60ab2ce 100644 --- a/test/output/textOverflow.svg +++ b/test/output/textOverflow.svg @@ -327,44 +327,44 @@ - The Best Yea…The Best Years of Our Lives - The Ballad o…The Ballad of Gregorio Cortez - My Big Fat I…My Big Fat Independent Movie - Battle for t…Battle for the Planet of the Apes + The Best Ye…The Best Years of Our Lives + The Ballad…The Ballad of Gregorio Cortez + My Big Fat…My Big Fat Independent Movie + Battle for…Battle for the Planet of the Apes Big Things Bogus - Beverly Hill…Beverly Hills Cop - Beverly Hill…Beverly Hills Cop II - Beverly Hill…Beverly Hills Cop III - The Black Ho…The Black Hole - The Big Para…The Big Parade - Boyz n the H…Boyz n the Hood - The Book of…Volume 1: Th…The Book of Mormon Movie, + <text y="0.32em" transform="translate(271,168)">Beverly Hil…<title>Beverly Hills Cop + Beverly Hil…Beverly Hills Cop II + Beverly Hil…Beverly Hills Cop III + The Black H…The Black Hole + The Big Par…The Big Parade + Boyz n the…Boyz n the Hood + The Book of…Volume 1: T…The Book of Mormon Movie, Volume 1: The Journey - Return to th…Return to the Blue Lagoon - Bright Light…Bright Lights, Big City - The Blue Bird - The Blue But…The Blue Butterfly + Return to t…Return to the Blue Lagoon + Bright Ligh…Bright Lights, Big City + The Blue Bi…The Blue Bird + The Blue Bu…The Blue Butterfly Blade Runner Bloodsport - The Blues Br…The Blues Brothers + The Blues B…The Blues Brothers Blow Out - De battre mo…De battre mon cœur s'est arrêté - The Broadway…The Broadway Melody + De battre m…De battre mon cœur s'est arrêté + The Broadwa…The Broadway Melody Boom Town - Bill & Ted's…Bill & Ted's Bogus Journey - The Birth of…The Birth of a Nation - The Ballad o…The Ballad of Cable Hogue - The Blood of…The Blood of Heroes - The Blood of…The Blood of My Brother: A Story of Death in Iraq + Bill & Ted'…Bill & Ted's Bogus Journey + The Birth o…The Birth of a Nation + The Ballad…The Ballad of Cable Hogue + The Blood o…The Blood of Heroes + The Blood o…The Blood of My Brother: A Story of Death in Iraq Boomerang - The Bridge o…The Bridge on the River Kwai + The Bridge…The Bridge on the River Kwai Born on the…Born on the Fourth of July Basquiat Black Rain - Bottle Rocket - 👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩…👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩 - 🧑🏾.👨🏻.👧🏼.👦🏽.…🧑🏾.👨🏻.👧🏼.👦🏽.🧒🏿.🧑🏾.👨🏻.👧🏼.👦🏽.🧒🏿 + Bottle Rock…Bottle Rocket + 👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️…👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩👁️‍🗨️👩‍❤️‍💋‍👩 + 🧑🏾.👨🏻.👧🏼.👦🏽…🧑🏾.👨🏻.👧🏼.👦🏽.🧒🏿.🧑🏾.👨🏻.👧🏼.👦🏽.🧒🏿 diff --git a/test/plots/text-overflow.ts b/test/plots/text-overflow.ts index cfdea5a407..3c64e9c7b3 100644 --- a/test/plots/text-overflow.ts +++ b/test/plots/text-overflow.ts @@ -71,7 +71,7 @@ export async function textOverflow() { fx: () => "monospace", monospace: true, textOverflow: "ellipsis-end", - lineWidth: 13, + lineWidth: 8, dx: -4, frameAnchor: "right" }), @@ -117,7 +117,7 @@ async function textOverflowPlot(textOverflow, {monospace = false} = {}) { color: {domain: opinions, scheme: "rdylbu"}, marks: [ Plot.axisX({monospace}), - Plot.axisY({lineWidth: monospace ? 9 : 6, textOverflow, monospace}), + Plot.axisY({lineWidth: 6, textOverflow, monospace}), Plot.axisY({ anchor: "right", tickFormat: (name) => `${dates.get(name).getUTCFullYear()}`,