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

How to align text vetrically #33

Open
IProSoft opened this issue May 21, 2015 · 2 comments
Open

How to align text vetrically #33

IProSoft opened this issue May 21, 2015 · 2 comments

Comments

@IProSoft
Copy link

Same as topic: how to align text vetrically to start draw text from width/2 point ?

Thanks for any answer.

@danielearwicker
Copy link
Owner

Do you mean align vertically as in adjust the y-position? You mention start drawing text at width/2 which sounds like horizontal alignment (and that is already built into Carota - the demo has toolbar buttons for left/right/center/justify).

For vertical alignment, it's much simpler - you just move the canvas coordinate origin downward (and for handling mouse events in the editor, you move the coordinate upward). This would be a "whole document" setting, not something applying to selected text. There's nowhere in Carota's own JSON format for such settings. But it would be easy to add them to the outside.

To demo this I've added a setVerticalAlignment function to the editor and in the demo page it now has a dropdown to let the user adjust it.

See updated demo: http://earwicker.com/carota - the right-most toolbar control.

@IProSoft
Copy link
Author

Hi

Yes - that was vertical alignment :-) Thanks for reply and demo!

I hava another question: is there way to get text real height in px of writen text ?

Or is there way to limit textarea to specified width/height, example: user ads text that is formated to font 72 and its higher than 200px, and it's auto resized to fit 200px, ex font 54.

Regards Artur

dhrleandro pushed a commit to dhrleandro/carota that referenced this issue Feb 23, 2024
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

2 participants