WoW BlueTracker Home | RSS | News | Contact
Recent | Search | Archive | CS Posts
Poster: slouken at 12/23/2005 11:32:13 AM PST
Subject: 1.10 sneak peek - Font Objects
   So I'm working on some font improvements for 1.10.
Here's the design so far (all subject to change):

There will be a new Font element that can be declared at the top level of the UI schema, along with the Script and Frame elements. Every declaration of a Font object creates a new font object with that name in script. If a font object with that name already exists, the declaration will just modify the existing font object. If the font object is declared as virtual, it is both instantiated, and it can also be "inherited" by other font objects and font strings.

When a font object is modified, it affects anything that is associated with it, including "inheriting" font objects, font strings, and special frame types, changing any properties that are not overridden by the associated object.

In addition to being able to inherit font objects, you will be able to directly specify a font object instead of a font file in the XML wherever the "font" attribute is used.

In the cases where a frame type allows you to specify a font through the "font" attribute, and also allows you to specify a FontString element to describe the font used, the FontString element will override the "font" attribute.

For those frame types that have a SetFont method, they will also have a SetFontObject method, which will associate the frame with the given font object. Using SetFont or other methods to set specific font attributes afterwards will act as overrides, and will prevent those attributes from being changed when the font object is changed.

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284479
 
Poster: slouken at 12/23/2005 11:32:13 AM PST
Subject: 1.10 sneak peek - Font Objects *edited post*
   So I'm working on some font improvements for 1.10.
Here's the design so far (all subject to change):

There will be a new Font element that can be declared at the top level of the UI schema, along with the Script and Frame elements. Every declaration of a Font object creates a new font object with that name in script. If a font object with that name already exists, the declaration will just modify the existing font object. If the font object is declared as virtual, it is both instantiated, and it can also be "inherited" by other font objects and font strings.

When a font object is modified, it affects anything that is associated with it, including "inheriting" font objects, font strings, and special frame types, changing any properties that are not overridden by the associated object.

In addition to being able to inherit font objects, you will be able to directly specify a font object instead of a font file in the XML wherever the "font" attribute is used.

In the cases where a frame type allows you to specify a font through the "font" attribute, and also allows you to specify a FontString element to describe the font used, the FontString element will override the "font" attribute.

For those frame types that have a SetFont method, they will also have a SetFontObject method, which will associate the frame with the given font object. Using SetFont or other methods to set specific font attributes afterwards will act as overrides, and will prevent those attributes from being changed when the font object is changed.

New API functions:

Font:GetName()
Font:SetAlpha()
Font:SetFont()
Font:GetFont()
Font:SetTextColor()
Font:GetTextColor()
Font:SetShadowColor()
Font:GetShadowColor()
Font:SetShadowOffset()
Font:GetShadowOffset()
Font:SetSpacing()
Font:GetSpacing()
Font:SetJustifyH()
Font:SetJustifyV()

FontString:SetFontObject()
FontString:GetFontObject()
FontString:SetShadowColor()
FontString:GetShadowColor()
FontString:SetShadowOffset()
FontString:GetShadowOffset()
FontString:SetSpacing()
FontString:GetSpacing()

EditBox:SetFontObject()
EditBox:GetFontObject()

ScrollingMessageFrame:SetFontObject()
ScrollingMessageFrame:GetFontObject()

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284479
Poster: slouken at 12/23/2005 1:28:41 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Don't worry, Slouken. At some point somebody who can actually code will respond and give you /meaningful/ feedback.


*laugh* It's all good. :)
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284547
Poster: slouken at 12/23/2005 1:43:19 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:

I take it this is the proposed clean solution to changing the font of the whole UI so that we dont need to edit FrameXML\Fonts.xml



Yep.


Q u o t e:

Will the font objects provide sufficient get methods to query which overrides they provide, as well as the inheritance tree (at the very least in the parent direction, though 'children' would be ideal).


An interesting idea, remind me to look into that.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284569
Poster: slouken at 12/23/2005 1:43:19 PM PST
Subject: Re: 1.10 sneak peek - Font Objects *edited post*
  

Q u o t e:

I take it this is the proposed clean solution to changing the font of the whole UI so that we dont need to edit FrameXML\Fonts.xml



Yep.


Q u o t e:

Will the font objects provide sufficient get methods to query which overrides they provide, as well as the inheritance tree (at the very least in the parent direction, though 'children' would be ideal).


Probably not. You can look at the XML to find out what the inheritance and overrides are. Knowing what they are programmatically won't do you much good, except maybe for knowing what you'll be affecting by modifying a font object, and that's not feasible to return through the API.

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284569
Poster: slouken at 12/23/2005 3:53:49 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Does this mean, that if I say change the font type of the object at runtime, all fontstrings etc that's associated with it, will reflect the changes aswell?



Yep.


Q u o t e:

Fontstrings etc, that are associated with the object, can they have a relative font-size to the object, for instance have a headline fontstring, that's always 50% larger than the base font, even if it's changed on the object?


No, you'll typically use two different font objects for that.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284619
Poster: slouken at 12/23/2005 3:54:31 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
In the current implementation, I don't believe it's possible to tweak the Shadow element properties of a FontString at runtime, but I'm aware of ways to modify everything else ( Height, Color, Font, etc. ). Is there any plan to add this ability to the new system? ( Or perhaps I'm just missing how you do this in the current one )


Yes, look at the new API additions in the first post in this thread.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284620
Poster: slouken at 12/23/2005 6:30:59 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
   By the way, this design allowed me to switch every "FontString" in Fonts.xml to "Font", and everything magically worked, except now each font is tweakable live in game.

Neat! :)
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284683
Poster: slouken at 12/24/2005 4:33:17 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Is there any way to declare these new font objects on the fly?


If you mean dynamically create them through script, then nope.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284806
Poster: slouken at 12/24/2005 9:36:10 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Is there any way to declare these new font objects on the fly?


Sure, why not? It's on my TODO list.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284849
Poster: slouken at 12/24/2005 9:40:48 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:

1) Are you going to be adding any new fonts to play around with?



No, but you will be able to declare your own in XML, and I'll probably have a function for you to create new ones.


Q u o t e:

2) Will there be any functions to load default font settings, or profiles?



No, but since you'll be able to query and set all the font attributes, you'll be able to create your own.


Q u o t e:

3) And what Tem mentioned..when a font-changing function is fired, will it be in realtime or only visible on a reload?



Realtime, that's what makes it fun.


Q u o t e:

Thanks a bunch Slouken

Merry Christmas n stuff


Thanks! Happy Holidays. :)
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284851
Poster: slouken at 12/24/2005 10:12:40 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:

1) There are a few get methods conspicuously absent, is ther any reason for the omission?

Font:GetAlpha()
Font:GetJustifyH()
Font:GetJustifyV()



Nope, they're on my list to add.


Q u o t e:

I'd like to be able to 'copy' any 'Font' via the API (Assuming i've created a Font object to copy the values into).



I have a Font:CopyFontObject() on my TODO list as well.


Q u o t e:

2) Do the various Font methods take the same parameters/have the same return values as the FontString methods of the same name?


Yes.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284867
Poster: slouken at 12/24/2005 10:17:49 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Oh.. one more question...

Will all of the :Set functions on Font accept a nil argument to reset the font to 'inherit from parent' ?


No, although the function can return nil and accept nil to indicate that the specified attribute will no longer be propagated to objects that are associated with the font object, if that's helpful.

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284870
Poster: slouken at 12/24/2005 5:52:49 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Will this have any effect on SetTextHeight? When I call SetTextHeight now, I get distorted text. Any way to fix that?


No, SetTextHeight takes the existing font texture and stretches it to whatever height you've requested, by design.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post285066
Poster: slouken at 12/26/2005 8:25:05 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
For the Get* methods, though I guess the problem then is that it's tricky to figure out the effective alpha/whatever if it's inherited.


It's actually not that bad. There's no such thing as real inheritance. As soon as an object is associated with a font object the attributes are propogated immediately. If the association is broken, the attributes remain until changed via another font object, or explicitly. This means that if a font object inherits a font object that sets color, for example, then the derived font object will also set color. If it doesn't set alignment, for example, then returning a non-nil value for the alignment is misleading, since it won't actually set alignment on associated objects.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post285573
Poster: slouken at 12/23/2005 11:32:13 AM PST
Subject: 1.10 sneak peek - Font Objects *edited post*
   So I'm working on some font improvements for 1.10.

There will be a new Font element that can be declared at the top level of the UI schema, along with the Script and Frame elements. Every declaration of a Font object creates a new font object with that name in script. If a font object with that name already exists, the declaration will just modify the existing font object. If the font object is declared as virtual, it is both instantiated, and it can also be "inherited" by other font objects and font strings.

When a font object is modified, it affects anything that is associated with it, including "inheriting" font objects, font strings, and special frame types, changing any properties that are not overridden by the associated object.

In addition to being able to inherit font objects, you will be able to directly specify a font object instead of a font file in the XML wherever the "font" attribute is used.

In the cases where a frame type allows you to specify a font through the "font" attribute, and also allows you to specify a FontString element to describe the font used, the FontString element will override the "font" attribute.

For those frame types that have a SetFont method, they will also have a SetFontObject method, which will associate the frame with the given font object. Using SetFont or other methods to set specific font attributes afterwards will act as overrides, and will prevent those attributes from being changed when the font object is changed.

New API functions:

Font:GetName()
Font:SetAlpha()
Font:GetAlpha()
Font:SetFontObject()
Font:GetFontObject()
Font:CopyFontObject()
Font:SetFont()
Font:GetFont()
Font:SetTextColor()
Font:GetTextColor()
Font:SetShadowColor()
Font:GetShadowColor()
Font:SetShadowOffset()
Font:GetShadowOffset()
Font:SetSpacing()
Font:GetSpacing()
Font:SetJustifyH()
Font:GetJustifyH()
Font:SetJustifyV()
Font:GetJustifyV()

FontString:GetAlpha()
FontString:SetFontObject()
FontString:GetFontObject()
FontString:SetShadowColor()
FontString:GetShadowColor()
FontString:SetShadowOffset()
FontString:GetShadowOffset()
FontString:SetSpacing()
FontString:GetSpacing()
FontString:GetJustifyH()
FontString:GetJustifyV()

Button:SetTextFontObject()
Button:GetTextFontObject()
Button:SetDisabledFontObject()
Button:GetDisabledFontObject()
Button:SetHighlightFontObject()
Button:GetHighlightFontObject()

EditBox:SetFontObject()
EditBox:GetFontObject()

ScrollingMessageFrame:SetFontObject()
ScrollingMessageFrame:GetFontObject()

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284479
Poster: slouken at 12/27/2005 10:48:06 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
   For discussion:

Should font objects return non-nil values when querying attributes which are not set on associated objects?
e.g. if a font object only sets the font, and not the font color, should querying the font color return nil? Of course once a font color is actually set, then that font object will affect the default text color of associated objects.

Conversely, should setting nil for an attribute be used to indicate that the font object should no longer set that attribute? Associated objects wouldn't suddenly change, but any new objects associated with the font object wouldn't get those attributes set.

My feeling is that in practice it won't actually matter much, since objects won't switch which font object they use often, and when they do, the font objects will generally all modify the same set of attributes.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post286036
Poster: slouken at 12/23/2005 11:32:13 AM PST
Subject: 1.10 sneak peek - Font Objects *edited post*
   So I'm working on some font improvements for 1.10.

There will be a new Font element that can be declared at the top level of the UI schema, along with the Script and Frame elements. Every declaration of a Font object creates a new font object with that name in script. If a font object with that name already exists, the declaration will just modify the existing font object. If the font object is declared as virtual, it is both instantiated, and it can also be "inherited" by other font objects and font strings.

When a font object is modified, it affects anything that is associated with it, including "inheriting" font objects, font strings, and special frame types, changing any properties that are not overridden by the associated object.

In addition to being able to inherit font objects, you will be able to directly specify a font object instead of a font file in the XML wherever the "font" attribute is used.

In the cases where a frame type allows you to specify a font through the "font" attribute, and also allows you to specify a FontString element to describe the font used, the FontString element will override the "font" attribute.

For those frame types that have a SetFont method, they will also have a SetFontObject method, which will associate the frame with the given font object. Using SetFont or other methods to set specific font attributes afterwards will act as overrides, and will prevent those attributes from being changed when the font object is changed.

New API functions:

Font:GetName()
Font:SetAlpha(a)
Font:GetAlpha()
Font:SetFontObject(font or nil)
Font:GetFontObject()
Font:CopyFontObject(font)
Font:SetFont("fontFile", fontHeight [, flags])
Font:GetFont()
Font:SetTextColor(r, g, b [, a])
Font:GetTextColor()
Font:SetShadowColor(r, g, b [, a])
Font:GetShadowColor()
Font:SetShadowOffset(x, y)
Font:GetShadowOffset()
Font:SetSpacing(spacing)
Font:GetSpacing()
Font:SetJustifyH("LEFT" or "CENTER" or "RIGHT")
Font:GetJustifyH()
Font:SetJustifyV("TOP" or "MIDDLE" or "BOTTOM")
Font:GetJustifyV()

FontString:GetAlpha()
FontString:SetFontObject(font or nil)
FontString:GetFontObject()
FontString:SetShadowColor(r, g, b [, a])
FontString:GetShadowColor()
FontString:SetShadowOffset(x, y)
FontString:GetShadowOffset()
FontString:SetSpacing(spacing)
FontString:GetSpacing()
FontString:GetJustifyH()
FontString:GetJustifyV()

Button:SetTextFontObject(font or nil)
Button:GetTextFontObject()
Button:SetDisabledFontObject(font or nil)
Button:GetDisabledFontObject()
Button:SetHighlightFontObject(font or nil)
Button:GetHighlightFontObject()

EditBox:SetFontObject(font or nil)
EditBox:GetFontObject()

ScrollingMessageFrame:SetFontObject(font or nil)
ScrollingMessageFrame:GetFontObject()

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284479
Poster: slouken at 12/23/2005 11:32:13 AM PST
Subject: 1.10 sneak peek - Font Objects *edited post*
   So I'm working on some font improvements for 1.10.

There will be a new Font element that can be declared at the top level of the UI schema, along with the Script and Frame elements. Every declaration of a Font object creates a new font object with that name in script. If a font object with that name already exists, the declaration will just modify the existing font object. If the font object is declared as virtual, it is both instantiated, and it can also be "inherited" by other font objects and font strings.

When a font object is modified, it affects anything that is associated with it, including "inheriting" font objects, font strings, and special frame types, changing any properties that are not overridden by the associated object.

In addition to being able to inherit font objects, you will be able to directly specify a font object instead of a font file in the XML wherever the "font" attribute is used.

In the cases where a frame type allows you to specify a font through the "font" attribute, and also allows you to specify a FontString element to describe the font used, the FontString element will override the "font" attribute.

For those frame types that have a SetFont method, they will also have a SetFontObject method, which will associate the frame with the given font object. Using SetFont or other methods to set specific font attributes afterwards will act as overrides, and will prevent those attributes from being changed when the font object is changed.

New API functions:

font = CreateFont("name") - Dynamically create a font object

Font:GetName()
Font:SetAlpha(a)
Font:GetAlpha()
Font:SetFontObject(font or nil)
Font:GetFontObject()
Font:CopyFontObject(font)
Font:SetFont("fontFile", fontHeight [, flags])
Font:GetFont()
Font:SetTextColor(r, g, b [, a])
Font:GetTextColor()
Font:SetShadowColor(r, g, b [, a])
Font:GetShadowColor()
Font:SetShadowOffset(x, y)
Font:GetShadowOffset()
Font:SetSpacing(spacing)
Font:GetSpacing()
Font:SetJustifyH("LEFT" or "CENTER" or "RIGHT")
Font:GetJustifyH()
Font:SetJustifyV("TOP" or "MIDDLE" or "BOTTOM")
Font:GetJustifyV()

FontString:GetAlpha()
FontString:SetFontObject(font or nil)
FontString:GetFontObject()
FontString:SetShadowColor(r, g, b [, a])
FontString:GetShadowColor()
FontString:SetShadowOffset(x, y)
FontString:GetShadowOffset()
FontString:SetSpacing(spacing)
FontString:GetSpacing()
FontString:GetJustifyH()
FontString:GetJustifyV()

Button:SetTextFontObject(font or nil)
Button:GetTextFontObject()
Button:SetDisabledFontObject(font or nil)
Button:GetDisabledFontObject()
Button:SetHighlightFontObject(font or nil)
Button:GetHighlightFontObject()

EditBox:SetFontObject(font or nil)
EditBox:GetFontObject()

MessageFrame:SetFontObject(font or nil)
MessageFrame:GetFontObject()
MessageFrame:SetFont()
MessageFrame:GetFont()

ScrollingMessageFrame:SetFontObject(font or nil)
ScrollingMessageFrame:GetFontObject()

[ post edited by slouken ]

  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post284479
Poster: slouken at 12/28/2005 9:18:39 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
On the discussion point, can you clarify the following (I'd like to sanity check how I think these things will work).

Suppose I have the following Font objects:

FontX
FontXY - Derived from FontX
FontXYZ - Derived from FontXY
FontXA - Derived from FontX
FontXAB - Derived from FontXA

FontX sets the font file and color (to red)
FontXY additionally sets shadow parameters (minor - small offset, mid alpha)
FontXYZ sets the color (to blue)
FontXA sets the color (to green)
FontXAB sets the color (to yellow)

Now if on screen i'm displaying the letters X, XY, XYZ, XA, and XAB with FontStrings which use the appropriate Fonts, i'd expect to start with:

red X, red minor shadow XY, blue minor shadow XYZ, green XA, yellow XAB

Given that, are the following correct?

1) At runtime, if I then call SetColor on FontX to change it to cyan, I'd expect

cyan X, cyan minor shadow XY, blue minor shadow XYZ, green XA, yellow XAB

2) Now, if I do FontXA:SetColor(nil), what happens to XA? I'd expect:

cyan X, cyan minor shadow XY, blue minor shadow XYZ, cyan XA, yellow XAB

Because there's still a color override 'showing through' from FontX

3) If I do FontXY:SetShadow(nil) (possibly the shadow offset, whichever 'clears' the shadow) I'd expect nothing to change, because there's no new value to replace the old.

4) If I then use the shadow methods on FontXY to set the shadow to a major shadow (big offset, solid alpha) I'd expect

cyan X, cyan major shadow XY, blue major shadow XYZ, cyan XA, yellow XAB


For simplicity (and my own sanity) nil will not be returned nor allowed as a set value for the font objects. It works the way you'd expect through point 1, above.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post286553
Poster: slouken at 12/28/2005 9:57:42 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Does the Font:SetFontObject method do what I think it does (namely, re-parent the font object for property inheritance) or something entirely different?


Yes, that's exactly what it does.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post286572
Poster: slouken at 12/28/2005 9:58:53 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
The system fonts for people varies widely, and thus why I asked. As an author, I could be sure that 90% would have, say, Verdana, but it'd be nice to have a means for it to gracefully fallback to another if it wasn't available. Same theory for webpage fonts, since you're never sure of the OS that the user has.



You should include any fonts that you want to use with your addon, and reference them directly. You can't use system fonts in WoW.

Of course make sure you have the rights to redistribute any fonts you include. :)
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post286573
Poster: slouken at 12/28/2005 10:14:11 AM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Can we get Font:UnsetAll() (Unsets all settings, though leaves the 'parent' as-is) as a compromise? Or is that similarly ugly?


I'm not sure that would do what you want. In that case, you'd have a font that didn't set any attributes on new objects associated with it, but as soon as its parent font changed, that change would be propogated through to it and all associated objects.
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post286582
Poster: slouken at 12/28/2005 2:18:17 PM PST
Subject: Re: 1.10 sneak peek - Font Objects
  

Q u o t e:
Well, the idea would be that if I wanted to drop some but not all of the values, I could remember those I wanted to keep, and then unset everything and replace only those which I needed.

Unfortunately I can't think of a simple concrete example of somewhere this would be necessary, but I just have a gut feeling I'll run into a time when I want it! 8-)


Let me know when you do. :)
  http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=284479&p=#post286740

View all recent official Blue Posts

WoW Blue Tracker: Archiving World of Warcraft Blue Posts
since March 2005
Home | RSS | News | Contact
Recent | Search | Archive | CS Posts
 

Why Ads?