STRML / textFit

A jQuery-free component that quickly fits single and multi-line text to the width (and optionally height) of its container.
https://textfit.strml.net
642 stars 122 forks source link

Handle splitting of long URLs so that the overall text occupies space per configuration #68

Open pbelbin opened 1 year ago

pbelbin commented 1 year ago

I have seen some cases where a long URL is limiting the increase of font size because it is not being split. If the URL were able to be broken up, then the text would grow in font size to be larger, to fill the available box space.

Can this be accommodated?

STRML commented 1 year ago

Yes, set word-break: break-all.

On Mon, Apr 17, 2023 at 12:06 AM Peter Belbin @.***> wrote:

I have seen some cases where a long URL is limiting the increase of font size because it is not being split. If the URL were able to be broken up, then the text would grow in font size to be larger, to fill the available box space.

Can this be accommodated?

— Reply to this email directly, view it on GitHub https://github.com/STRML/textFit/issues/68, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEKPZRPF6GNPEN5CGEALLXBS6URANCNFSM6AAAAAAXATSLNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

pbelbin commented 1 year ago

Thank you for the tip!

OK, but, if you do that to the entire element, then every word in the paragraph, for example, get's treated that way. It would be really good if there was a flag that enables the ability to automagically identify portions of the displayed content that is a URL over a certain size, and if found, wrap that with a 'span' that itself has the 'word-break: break-all' style, so that only the URL has that, not everything. But, perhaps that's something that will be expected to be handled externally.

STRML commented 1 year ago

That's just not what this library does. But you could do it yourself and it won't conflict.

On Fri, Apr 21, 2023 at 9:18 AM Peter Belbin @.***> wrote:

OK, but, if you do that to the entire element, then every word in the paragraph, for example, get's treated that way. It would be really good if there was a flag that enables the ability to automagically identify portions of the displayed content that is a URL over a certain size, and if found, wrap that with a 'span' that itself has the 'word-break: break-all' style, so that only the URL has that, not everything. But, perhaps that's something that will be expected to be handled externally.

— Reply to this email directly, view it on GitHub https://github.com/STRML/textFit/issues/68#issuecomment-1517824470, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEKPYP2K2RG5KK6PYNH43XCKCLBANCNFSM6AAAAAAXATSLNQ . You are receiving this because you commented.Message ID: @.***>