Restored centering logic. viewBox screws scale up a little and ultimately does not do what I hoped it would.

This commit is contained in:
Matt McWilliams 2021-07-29 18:43:42 -04:00
parent 7819702763
commit 614c8fafef
1 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ version="1.1">`;
let options = {
font : 'ems_nixish',
scale : 0.005,
weight : 5
weight : 1
};
async function loadFont (fontPath) {
@ -41,12 +41,12 @@ async function loadFont (fontPath) {
}
function textPos (str) {
const UNIT = 21000 / W;
const len = str.length;
const w = len * charW;
const h = charH;
const x = (W - w) / 2.0;
const y = 1;
//console.log(w);
const x = ((W - w) / 2.0) * UNIT;
const y = 1 * UNIT;
return { x, y };
}