WoWInterface (
-   Lua/XML Help (
-   -   Unable to use SetFontObject on a custom .ttf font (

jezzi23 05-12-20 08:20 AM

Unable to use SetFontObject on a custom .ttf font
I have this really simple problem that I just can't seem to figure out...

I'm trying to use a custom font for my addon. As an example, I'll try to use arial.ttf, which exists at the wow base directory, and in every directory along the way to my addon directory, e.g. "Interface\\AddOns\\MY_ADDON_NAME\\fonts\\arial.ttf"

font_str = UIParent:CreateFontString(nil, "OVERLAY")
font_str:SetFontObject("arial.ttf"); -- try to find it at wow base directory
font_str:SetPoint("TOP", 0, -30);

I have tried looking for it in the addon directory as well but it never works and I get "<unnamed>:SetFontObject(): Couldn't find font named arial.ttf".

What is going on here? : (

EDIT: This is Wow Classic

Kanegasi 05-12-20 09:12 AM

A font object is a font defined in an xml file. SetFontObject does not accept file paths.

You're looking for SetFont.

All times are GMT -6. The time now is 09:43 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI