Hovertext Character Width
|
|
Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
|
01-07-2009 19:50
I'm working on a HUD project, using tiny prims with hovertext to display dynamic text. Pretty standard stuff. The client asked me if I could make the text left-justified instead of centered. I said unfortunately no, that's just the nature of hovertext. But...then my geek sense started tingling. Actually it would be possible; given the proportional width of the characters, you could calculate the physical width of the text and shift the prim accordingly Fortunately I was smart enough not to share this little insight with the client just yet  Can anyone think of a practical way to glean this data?
_____________________
Help find a missing child. 
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
01-07-2009 19:56
Wouldn't it just be easier to pad the right side with spaces? Admittedly, that's going to burn up available characters...
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Siann Beck
Beauty & Braiiiiinsss!
Join date: 14 Jul 2007
Posts: 140
|
01-07-2009 20:00
It's a proportional font; you'd still have to know how wide the characters being displayed are.
_____________________
Help find a missing child. 
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
01-07-2009 20:01
i think its the same font as the script editor window, if it is that makes life easy since its a (8?) point monospace font
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
01-07-2009 20:09
There is a copy of FontFont Meta somewhere in the SL viewer folder, you could toss that into a font editor to dig out the metrics. Might be easier just to print out repeated strings of characters and measure from there. Remember that the UI size slider changes the size of llSetText too, so you'll want to do this relative to the rest of the text rather than the prims. But this is still going to leave the possibility of jagged margins, because there's at least one viewer already in circulation that doesn't use that font (licensing issues), so the metrics aren't something you can count on. From: Osgeld Barmy i think its the same font as the script editor window, if it is that makes life easy since its a (8?) point monospace font That would have been nice but LL went with their proportional font there :/
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
01-07-2009 20:13
at least with space padding, you're only having to do one calculation, and dont ALSO have to worry about the pixels-to-meters issue.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
01-07-2009 20:14
From: Winter Ventura at least with space padding, you're only having to do one calculation, and dont ALSO have to worry about the pixels-to-meters issue. Yeah, you would kind of have to do it that way, because of the UI scaling problem.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-07-2009 20:30
Hmm. Does the UI scaling also affect the rendered size of HUD attachments? Since the text is also centered on the prim, the width of the prims could possibly be used to help (though if the wearer has to be able to click past the text they could get in the way). Might be worth a try.
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
01-07-2009 20:34
From: Hewee Zetkin Hmm. Does the UI scaling also affect the rendered size of HUD attachments? Nope 
|