TextBox without lstrip on whitespace?? and other bits.
#1
is it possible to place text in a textbox witout having all of the lefthand whitespace stripped off of each lineHuh I've written a workaround for this by inserting one non space charachter followed by 7 spaces and then appying expandtabs(8) to each line before adding them to the textbox and then positioning the left hand margin off of the screen so the left hand column of charachters can't be seen and all tabs appear correctly. But this seems a poor way of handling things, but it works.

Also when a textbox is created on a system where the video calibration has been modified to fit a given screens overscan, the size of the textbox is modified to fit within the new display size is there a command to get the actual size the text box is resized to or does anyone know an equation to find the exact values. I'm currently using textbox.width * (calibrated.width / full.width ) which seems fairlt good on pixel ratios of 1 but varies as the pixel ratio drifts further from 1. I'm using this to calculate the number of charachters I can have per line for my word wrapping.
Reply
#2
The textbox doesn't handle tab characters at all. If it did, there wouldn't be an issue. It strips spaces in order to wordwrap, though this may be able to be finetuned after 2.0. Ideally just adding tab support would be best though IMO. I'm not really sure the best way to do this at present.

As for determining the width, this is difficult anyway unless you have the actual size of the text in pixels, as the fonts are generally variable width. I presume you are calculating the text width within python?

The actual size of the textbox at output is dependent on:

1. Screen calibration
2. Skin scaling
3. Window animations (such as zoom)
4. Control animations (such as zoom)

I believe that the skin scaling isn't exposed to python.

Ideally, a gettextwidth() routine would be best. After 2.0 request away.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
I added a fixed width dos font to xbmc and i'm using that for my viewer so calculating text width is easy
Reply

Logout Mark Read Team Forum Stats Members Help
TextBox without lstrip on whitespace?? and other bits.0