Quantcast WoWInterface - View Single Post - oUF - Layout discussion
View Single Post
02-24-09, 11:21 AM   #796
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,676
Originally Posted by Lykofos View Post
OK, here is what I am trying to do:

I want to be able to set the layout's font (aka a custom font) and size of the font in question. Previously I had been using a method stolen from Wimpface's layout (oUF_Faith), however I want to have the font contained within the layout's folder as a opposed to a external AddOn.

Aka

oUF_Layout
- oUF_Layout.lua
- font

Or have the font in a Media folder in my layout folder.

I have tried studying those layouts that use a font other than the standard game fonts (aka I don't want "GameFontHighlightSmall", etc.). My first attempt was to simply try a GameFontHighlightSmall (GameFontHighLightSmall is the font in the p3lim's layout, which is the layout I am learning from) = font of my choice, and while I get the font I want, I cannot control the size of the font. I have then looked at other layouts however no single layout ever seems to use the same method. I have tried adapting other methods to my current Frankenstein of a layout however I have yet to get anything other than my layout going belly up and Bugsack yelling at me. I am learning from my n00bish mistakes, however I have yet to get the results I want.

So I do I replace:

Code:
self.Health.Text = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight')
With a string to specify 1) My chosen font. 2) The font size?

Currently I have my specified font in a local at the top of my layout in the following format (example only):

Code:
local font = "Interface\\AddOns\\oUF_Example\\Example_Font.ttf"
Or am I simply barking up the wrong friggin tree? Once I get this issue licked, I cn tackle more interesting things as I am getting my layout to do what I want (mostly).
I inherit my fonts in the CreateFontString.
An other way to do the same would be 'fontstring:SetFontObject()'
Your example.
Code:
fontstring:SetFontObject('GameFontHighlightSmallRight')
is the same as
Code:
fontstring:SetFont('Fonts\\FRIZQT__.TTF', 12)
fontstring:SetTextColor(1, 1, 1)
fontstring:SetJustifyH('RIGHT')
fontstring:SetShadowColor(0, 0, 0)
fontstring:SetShadowOffset(1, -1)
In other words, its pre-made font styles by blizzard

Last edited by p3lim : 02-24-09 at 11:24 AM.