Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadFont dont work! #1347

Open
AndreZila01 opened this issue Oct 3, 2024 · 5 comments
Open

LoadFont dont work! #1347

AndreZila01 opened this issue Oct 3, 2024 · 5 comments

Comments

@AndreZila01
Copy link

Previously, i was use your code when Jimp has on version ^0.22.10. But when i update the library i received that warning:
"Cannot read properties of undefined (reading 'slice')".
I would like know what happend to the library. And where i can found documentation of JIMP to JavaScript!

const Jimp = require('jimp');

async function load() {

    let content = "Test"

    await Jimp.loadFont(Jimp.FONT_SANS_128_WHITE).then(async (font) => {
        let count = 0;
        await Jimp.read(`./FicheirosS/1.JPG`).then(async (fir_img) => {

            fir_img.print(
                font,
                250,
                2000,
                content,
            );

            fir_img.write(`./FicheirosC/${count++}.JPG`);
        });
    });


}

load();

Thanks for the support!

@AndreZila01
Copy link
Author

Message of error i was received:

Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'slice')
at isBinary (c:\Users\Andre\Desktop\Rita\AddFonte\node_modules@jimp\plugin-print\dist\commonjs\load-bitmap-font.js:24:31)
at parseFont (c:\Users\Andre\Desktop\Rita\AddFonte\node_modules@jimp\plugin-print\dist\commonjs\load-bitmap-font.js:31:9)
at loadBitmapFontData (c:\Users\Andre\Desktop\Rita\AddFonte\node_modules@jimp\plugin-print\dist\commonjs\load-bitmap-font.js:103:16)
at loadFont (c:\Users\Andre\Desktop\Rita\AddFonte\node_modules@jimp\plugin-print\dist\commonjs\load-font.js:28:69)
at processTicksAndRejections (<node_internals>/internal/process/task_queues:95:5)

@FerdinandRamos
Copy link

Did you figure out a solution to this? I'm having the same issue

@AndreZila01
Copy link
Author

Nooo... i'm using the old version number "^0.22.10"

@isntfunny
Copy link

Same issue here.. Any solutions?

@BosseKarat
Copy link

Same issue here using TypeScript when using the example provided by the docs - http://jimp-dev.github.io/jimp/api/jimp/functions/loadfont/

Cannot find module 'jimp/fonts' or its corresponding type declarations.

This is a result of missing node modules, incorrect paths, or missing type declaration files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants