Restore textPos function
This commit is contained in:
parent
45d619183f
commit
c8a8661978
|
@ -132,8 +132,8 @@
|
||||||
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
|
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
|
||||||
},
|
},
|
||||||
"node_modules/hersheytext": {
|
"node_modules/hersheytext": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"resolved": "git+ssh://git@github.com/mattmcw/hersheytextjs.git#5aab4b86180419170157d36f14571605c587cb06",
|
"resolved": "git+ssh://git@github.com/mattmcw/hersheytextjs.git#6b309796d2a83509307011165c75f3061709d88f",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^0.22.0"
|
"cheerio": "^0.22.0"
|
||||||
|
@ -399,7 +399,7 @@
|
||||||
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
|
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
|
||||||
},
|
},
|
||||||
"hersheytext": {
|
"hersheytext": {
|
||||||
"version": "git+ssh://git@github.com/mattmcw/hersheytextjs.git#5aab4b86180419170157d36f14571605c587cb06",
|
"version": "git+ssh://git@github.com/mattmcw/hersheytextjs.git#6b309796d2a83509307011165c75f3061709d88f",
|
||||||
"from": "hersheytext@github:mattmcw/hersheytextjs",
|
"from": "hersheytext@github:mattmcw/hersheytextjs",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cheerio": "^0.22.0"
|
"cheerio": "^0.22.0"
|
||||||
|
|
|
@ -40,6 +40,17 @@ async function loadFont (fontPath) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function textPos (str) {
|
||||||
|
const len = str.length;
|
||||||
|
const w = len * W;
|
||||||
|
const h = H;
|
||||||
|
const x = (75.0 - w) / 2.0;
|
||||||
|
const y = (75.0 - h) / 2.0;
|
||||||
|
|
||||||
|
return { x : x * UNIT, y : y * UNIT };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
const fontPath = args.font;
|
const fontPath = args.font;
|
||||||
const text = args.text.replace('\\n', '\n');
|
const text = args.text.replace('\\n', '\n');
|
||||||
|
|
Loading…
Reference in New Issue