Skip to content

Text Baseline in SVG Backend #716

@dan-fritchman

Description

@dan-fritchman

https://codepen.io/jonobr1/pen/MWvVBdx

import Two from 'https://cdn.skypack.dev/two.js@latest';

const two = new Two({
  type: Two.Types.webgl,
  fullscreen: true,
  autostart: true
}).appendTo(document.body);

// Create one text of each `baseline` value
const t1 = two.makeText("TOP", two.width / 2, two.height / 2, {size:100});
t1.baseline="top";
const t2 = two.makeText("MID", two.width / 2, two.height / 2,{size:100});
t2.baseline="middle";
const t3 = two.makeText("BOT", two.width / 2, two.height / 2,{size:100});
t3.baseline="bottom";

That code snippet, with the WebGL backend, looks like so:

image

Change it to canvas, and it looks like so:

image

Which are not, like, identical, but for purposes of this, close enough.
But change to Two.Types.svg, and it looks like so:

image

Is that the expected behavior?
I.e. does the baseline attribute not work with the SVG back-end?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions