View Single Post
11-08-10, 05:11 AM   #15
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by Sideshow View Post
That's the dirty way ...
I was just curious if it would possible to drop in a random font file and then recognise/use it in my script.
Well, according to wowprogramming it would be possible.

Code:
isValid = FontInstance:SetFont("filename", fontHeight, "flags")

<snip>

Returns:
isValid - 1 if filename refers to a valid font file; otherwise nil (1nil)
You can load files by checking for font1.ttf, font2.ttf, etc.

Example snippet:
Code:
local fonts, object = {}, CreateFont()

for i=1, 100 do
    local file = "Interface\\AddOns\\TinyDPS\\fonts\\font" .. i
    if object:SetFont(file, 12, "") then
        tinsert(fonts, file)
    end
end
All from the top of my head and untested.

You could also bruteforce aa, ab, ac, ba, zz, zzzzzzzzzzzzz, but that wouldn't be that efficient
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.

Last edited by nightcracker : 11-08-10 at 05:13 AM.
  Reply With Quote