Restored centering logic. viewBox screws scale up a little and ultimately does not do what I hoped it would.
This commit is contained in:
parent
7819702763
commit
614c8fafef
|
@ -22,7 +22,7 @@ version="1.1">`;
|
||||||
let options = {
|
let options = {
|
||||||
font : 'ems_nixish',
|
font : 'ems_nixish',
|
||||||
scale : 0.005,
|
scale : 0.005,
|
||||||
weight : 5
|
weight : 1
|
||||||
};
|
};
|
||||||
|
|
||||||
async function loadFont (fontPath) {
|
async function loadFont (fontPath) {
|
||||||
|
@ -41,12 +41,12 @@ async function loadFont (fontPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function textPos (str) {
|
function textPos (str) {
|
||||||
|
const UNIT = 21000 / W;
|
||||||
const len = str.length;
|
const len = str.length;
|
||||||
const w = len * charW;
|
const w = len * charW;
|
||||||
const h = charH;
|
const h = charH;
|
||||||
const x = (W - w) / 2.0;
|
const x = ((W - w) / 2.0) * UNIT;
|
||||||
const y = 1;
|
const y = 1 * UNIT;
|
||||||
//console.log(w);
|
|
||||||
return { x, y };
|
return { x, y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue