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

Overflow Y Hidden #83

Open
Pelican104 opened this issue Aug 4, 2023 · 8 comments
Open

Overflow Y Hidden #83

Pelican104 opened this issue Aug 4, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@Pelican104
Copy link

This is very impressive.

Is there a way to stop text spilling out of the text box bounds?

If i provide too much text or increase the font size too much the text is spilling out of the text box at the top and bottom.

@jiakuan
Copy link
Contributor

jiakuan commented Aug 5, 2023

Based on the current font style, text, and preferred width, I think we should be able to calculate the minimum height of the text box.

@Pelican104
Copy link
Author

Have we not already provided the height of the text box? It would be useful if there was a setting to stop text displaying outside the box, I guess like the css overflow hidden property

@geongeorge
Copy link
Owner

Height calculation is really easy, I'm still unsure how the effect should be. Any inputs @Pelican104 @jiakuan ?

Frame 1 (28)

@geongeorge geongeorge changed the title Overflow Overflow Y Hidden Aug 24, 2023
@geongeorge geongeorge added the enhancement New feature or request label Aug 24, 2023
@Pelican104
Copy link
Author

I was imagining exactly what you have shown in option A.

@jiakuan
Copy link
Contributor

jiakuan commented Aug 25, 2023

For my use case, I normally pre-calculate the text box based on the text content/style and preferred width, and then draw text exactly in the text box.

In case of the text box is too small, perhaps we could provide a configuration, like CSS, e.g. overflow: visible or hidden, which means either the Current (visible) or Option A (hidden), not sure if Option B is useful in some scenarios or not.

@pulimoodan
Copy link

Hey, I think I have the solution for this.

May be I can make pull request.

I have one question, Is there an option to supply font color?

@stefcameron
Copy link

@pulimoodan

Your solution to clipping the overflow seems good to me.

I have one question, Is there an option to supply font color?

Not currently, but in #95, I have added color support for individual words in the text. 😄

@bobvandevijver
Copy link

I would like to have another option, to truncate the text instead of hiding the overflow (as also already asked in #91).

stefcameron added a commit to stefcameron/text-to-canvas that referenced this issue Mar 13, 2024
Originally requested here: geongeorge/Canvas-Txt#83

By default, text overflows. Set to `false` to clip the text to the
specified box.
stefcameron added a commit to stefcameron/text-to-canvas that referenced this issue Mar 13, 2024
Originally requested here: geongeorge/Canvas-Txt#83

And fix proposed here: geongeorge/Canvas-Txt#94

By default, text overflows. Set to `false` to clip the text to the
specified box.
stefcameron added a commit to stefcameron/text-to-canvas that referenced this issue Mar 13, 2024
Originally requested here: geongeorge/Canvas-Txt#83

And fix proposed here: geongeorge/Canvas-Txt#94

By default, text overflows. Set to `false` to clip the text to the
specified box.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants