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 = {
|
||||
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 };
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue