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

imagettfbbox(): Could not find/open font #423

Closed
LeQuangKhai99 opened this issue Nov 8, 2023 · 6 comments
Closed

imagettfbbox(): Could not find/open font #423

LeQuangKhai99 opened this issue Nov 8, 2023 · 6 comments
Assignees
Labels

Comments

@LeQuangKhai99
Copy link

LeQuangKhai99 commented Nov 8, 2023

I have error
image
image
It error when i add label. It seems like it can't read the default font file

@endroid
Copy link
Owner

endroid commented Nov 8, 2023

Hi @LeQuangKhai99 what version are you using? The current version checks if the path to the font exists (this happens in Label::create) while the imagettfbbox method is called later, when writing the image. So it appears that the font does exist but it can't be opened. Please put a debug statement in the LoadImageData class just before the imagettfbbox method and tell me what $label->getFont()->getPath() resolves to and what file_exists($label->getFont()->getPath()) resolves to.

@endroid endroid self-assigned this Nov 8, 2023
@LeQuangKhai99
Copy link
Author

Hi @endroid, file_exists($label->getFont()->getPath()) return true.

@LeQuangKhai99
Copy link
Author

image

noto_sans.oft is exist

@endroid
Copy link
Owner

endroid commented Nov 8, 2023

Thank you. And the output of the path please. And could you try using realpath() around the path, like $labelBox = imagettfbbox(realpath($label->getFont()->getSize()), 0, $label->getFont()->getPath(), $label->getText());

And if that does not work, what does file_get_contents give? Can it read the file?

@LeQuangKhai99
Copy link
Author

@endroid I'm sorry, i was installed this package to another project and it work well. I think i will uninstall and try again. Thanks!

@endroid
Copy link
Owner

endroid commented Nov 8, 2023

Np, glad to hear your problem is solved!

@endroid endroid closed this as completed Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants