Req No Cut-Off Text in Textboxes
#1
I would love to see textboxes that auto resize their height so that they only show full lines of text and don't cut any off.

For instance say I have a textbox that is 80px high. However, the font size I've used is 25px a line. 3 lines of text are shown (75px) but the top of the fourth line of text can also be seen. What should happen is the text box should resize to the closest height to only show full lines of text - e.g. this example should resize to 75px.

This has three main benefits:
(1) Makes it easier to include multiple font size options to accommodate people with smaller TVs or bad eyesight.
(2) When using alternate resolutions text wont be cut off
(3) Skinning time is saved as the dimensions of the textboxes can be set according to the space they occupy - the textbox doesn't have to be tweaked to match pixel perfectly to the line height.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#2
This could be indeed a nice addition, but what if different line spaces are used?
Reply
#3
What I imagine basically would happen is kodi would calculate font height + line spacing size. Then divide the textbox height by that value, round down to a whole integer and then multiple by the original font height + line spacing pixel value.

e.g.
textbox.autoheight = Int(textbox.height / (fontsize.pixelheight + line.spacing.pixelheight)) * (fontsize.pixelheight + line.spacing.pixelheight)

So to use my original example that would be
Code:
textbox.autoheight = Int(80 / 25) * 25
                   = Int(3.2) * 25
                   = 3 * 25
                   = 75

I have no idea if this is even remotely possible though. However, as long as there is some way to calculate the pixel height of a fontsize plus the linespacing then it would be a relatively simply piece of code to implement.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#4
Auto height was added for Gotham.

(2014-02-03, 14:24)ronie Wrote: 2014-02-02 Add support for auto-height in textbox control

you can now use <height>auto</height> in a textbox control.

git commit: https://github.com/xbmc/xbmc/commit/2db7...c19d2fb38c
pull request: 4085 (PR)
Reply
#5
(2015-02-10, 09:15)Hitcher Wrote: Auto height was added for Gotham.

Doesn't work for what I'm talking about. Auto height only works for making the box height smaller if there aren't enough lines of text to fill it - It doesn't prevent lines being cut off if there are more lines of text than fits within the max height.

Say for instance each line of text is 25px. I have a textbox with <height max="80>auto</height>
If there are 3 lines it will resize to 75px. However, if there are 4 lines the textbox will be at 80px causing the 4th line to be cut off. What I want to happen is it to only resize to 75px. Setting max="75" wont work because I might want to have another font set where each line is 35px high.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#6
I'd use different textboxes for different fonts in that case.
Reply
#7
(2015-02-10, 19:30)Hitcher Wrote: I'd use different textboxes for different fonts in that case.

Is there a way to check what fontset is in use? Because otherwise that's not a possibility.
Regardless, the point is to make it easier to use multiple fontsets of different sizes and/or styles.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#8
Here's what I did to support three different font sets in Mimic...

First, I calculated what the height should be for textboxes with 2,3,4,5 lines using the default font.

Then I created separate fonts for each type of textbox. For example font-2 for textboxes with two lines, font-3 for three lines, etc.

In my other font sets, I adjusted the line spacing for each of the textbox fonts so that they fit in the same space as the default font set.

Not sure if there are better solutions, but this worked for me. The end result is 4-5 extra font declarations for each font set.
Reply
#9
(2015-02-11, 03:33)bryanbrazil Wrote: Here's what I did to support three different font sets in Mimic...

First, I calculated what the height should be for textboxes with 2,3,4,5 lines using the default font.

Then I created separate fonts for each type of textbox. For example font-2 for textboxes with two lines, font-3 for three lines, etc.

In my other font sets, I adjusted the line spacing for each of the textbox fonts so that they fit in the same space as the default font set.

Not sure if there are better solutions, but this worked for me. The end result is 4-5 extra font declarations for each font set.
That's what I usually do (adjust linespacing), but I'd like a way where I can preserve the desired linespacing for each fontset. I am having a problem with my new Arctic skin where there are a few textboxes that fit two lines of text at a small font size. Going up to a larger size means they fit about 1.5 which then requires a massive amount of linespacing that looks really bad for other bigger textboxes.

I *can* think of ways around it - however, considering the other recent improvements to the skinning engine have all been about cutting down unnecessary code (unified ids, filling a list from a plugin/path, left/right/top/bottom sizing) then it would be great if this trend could be continued. I can think of so many usage scenarios where this would dramatically reduce unnecessary code, particularly with the new right/left/top/bottom positioning system.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#10
Now I see where you're coming from (skin supporting different fonts) I totally see the need for this.
Reply

Logout Mark Read Team Forum Stats Members Help
No Cut-Off Text in Textboxes0