lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #1  
Unread 11-23-2011, 01:52 PM
Zelxyb Zelxyb is offline
The Wary
 
Join Date: Nov 2011
Posts: 2
Mixed fonts in a single label?

I'm still trying to learn the limits of what Lua can do, so bear with me on any dumb questions!

I've got a label where I want to emphasize part of the text but not all of it.

Example: This line would be an example.
Example: This line would be another example.

Is this possible to do? If so, could someone give me some sample code for the example lines above?

If not, I can always create multiple labels next to each other, but I'm worried about that working out with translations (as in, I don't want to have to re-layout the screen when the German words are longer than the English ones).

Thanks in advance for any help!
Reply With Quote
  #2  
Unread 11-23-2011, 02:19 PM
Galuhad's Avatar
Galuhad Galuhad is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Dec 2010
Location: Norwich, UK
Posts: 24
To my knowledge it's not possible as you assign the font to the label as a whole ( label:SetFont() ).
__________________
Galuhad, Guardians of the Light, Evernight (formally of Eldar RIP)
---
Reply With Quote
  #3  
Unread 11-23-2011, 02:53 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 341
Galuhad is correct. There is no mixing fonts within a single label. Additionally, there are no font metrics so you have to use the scrollbar trick to figure out the needed width for the control if you intend to use multiple controls to build your text. It gets messy REAL quick if the text is variable. If it's just fixed text and will only need to highlight a specific series of words it can be done, but it's still ugly.
Reply With Quote
  #4  
Unread 11-23-2011, 03:21 PM
Zelxyb Zelxyb is offline
The Wary
 
Join Date: Nov 2011
Posts: 2
Thanks, both of you. I was afraid of that, but thought I should ask just in case!

I'll never take flashbuilder for granted again...
Reply With Quote
  #5  
Unread 11-24-2011, 10:20 PM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Turbine has given us enough psuedo-OOP utillity to seriously improve upon the basic API. For instance, while having more than one font in a label is not possible, it is more than possible to make a custom class that combines multiple lables to achieve the same effect. To get around the issue of handling size based on text length, one posibility is to store pre-defined character widths based on font size.

While there are things we just can't do (mostly game API and graphics limitations), never feel that the API or stock Lua functions are what ultimately decides your limits.
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote
  #6  
Unread 11-25-2011, 12:23 PM
Equendil Equendil is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2011
Posts: 52
Quote:
Originally Posted by Digital_Utopia
Turbine has given us enough psuedo-OOP utillity to seriously improve upon the basic API. For instance, while having more than one font in a label is not possible, it is more than possible to make a custom class that combines multiple lables to achieve the same effect. To get around the issue of handling size based on text length, one posibility is to store pre-defined character widths based on font size.

While there are things we just can't do (mostly game API and graphics limitations), never feel that the API or stock Lua functions are what ultimately decides your limits.
Hehe I like to say "impossible" in software developer jargon is merely a synonym for "very time consuming".

Situation #1:
Boss: Hey, can you implement that new feature our customer requested ?
Dev: Well it would take months and the feature is rather minor
Boss: Get on it ! We need it for yesterday !

Situation #2:
Boss: Hey, can you implement that new feature our customer requested ?
Dev: Nah, not possible.
Boss: Isn't there any way ?
Dev: Nope.
__________________
Author of LIP, Bootstrap and Baruk
Reply With Quote
  #7  
Unread 11-25-2011, 05:33 PM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Quote:
Originally Posted by Equendil
Hehe I like to say "impossible" in software developer jargon is merely a synonym for "very time consuming".

Situation #1:
Boss: Hey, can you implement that new feature our customer requested ?
Dev: Well it would take months and the feature is rather minor
Boss: Get on it ! We need it for yesterday !

Situation #2:
Boss: Hey, can you implement that new feature our customer requested ?
Dev: Nah, not possible.
Boss: Isn't there any way ?
Dev: Nope.
Haha certainly! Thankfully, in this case we're all our own "boss", but on the other side, there really is an "impossible" here. Well, at least in limiting ourselves within the plugin system, within the client. There is also however, a "reasonably possible" as well - and that kinda goes hand in hand with what you were saying. Just because you technically could do it, doesn't mean that what you would need it for is that crucial to make it worth the effort.

For instance, in this multi-font label thing, if the author's goal was to (for some reason) create a plugin that renders HTML/CSS, then the effort required would probably be worth it (at least for the goal). On the other hand, if they just wanted to make their options panel prettier, then...that's probably a different story. Even still, since we are all our own "boss", it's up to the individual author to make that final decision - whether their effort, is worth (to them) the result.

The message though, is you'll be able to accomplish and pull off a lot more if you go into a project asking "This is what I want to do, now how do I use what exists to pull it off?" instead of "This is what I want to do, now does the API/Language have a "whatIWantToDo(justLikeThis);" function?". Unless you're dealing with PHP, or love spending time searching for and downloading 3rd-party libraries, there's probably not going to be such a function - until you make it of course.
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab Control and Auto Sizing Label lunarwtr Tutorials & Other Helpful Information (L) 0 03-14-2011 08:26 PM
Mixed UIs Uthboth General Authoring Discussion (L) 0 07-26-2009 12:22 PM
Changing Fonts Deewe LotRO Wish List (L) 0 09-29-2007 10:38 AM
Chat Fonts Rainwhisper Interface Requests (L) 1 04-25-2007 12:40 PM
Single panel names Oberion LotRO Wish List (L) 1 02-19-2007 01:37 AM


All times are GMT -5. The time now is 05:55 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui