-
Notifications
You must be signed in to change notification settings - Fork 11
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
Calculate font size automatically to fit a given box area #33
Comments
I'm sure you can do this. |
Can you clarify your question a bit? because I can not figure out what exactly is your requirement.
Here a simple explaination: <?php
$text = new Text('My ustom text with opacity!');
$text
// these functions control the size of the text area (box area).
->setWidth(400)
->setHeight(250)
// these functions control the position (x, y) of the text area (box area).
->setLeft(50)
->setTop(50)
// this function controls the font size of the string text.
->setSize(22)
->setOpacity(0.5)
->setColor(255, 255, 255)
->setFontface('/home/my_user/fonts/Lato.ttf'); Check out the complete example at https://joseluisq.github.io/gimage/classes/text/ |
(Sorry for late response @joseluisq and @YeltsinReyes ) Thanks for the answers. In my case, I have a space, say 200 x 50, when I write "Congratulations", it is displayed with a font size of 25px (example only), but if I want to write 'Congratulations, my dear friend ", how can I calculate dynamically the font size to use the same space (200x50)? The same occurs when I have a space delimited for 2 lines, but I don't want to go beyond that and if the text is bigger, I would like to reduce the font so that it is possible to continue using only 2 lines ... It's possible to make these calculations and resize dynamically? thanks a lot! |
What you want is calculate automatically the font size in a particular box area. That is not possible right now. |
Hi,
have some example with form with image upload (blob without save, just use on memory) or image base64?
If it's possible, how I do resize text to fit text (and resize font size) custom area?
The text was updated successfully, but these errors were encountered: