• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] What is the best way to get BlzFrameSetFont to work?

Status
Not open for further replies.
Level 15
Joined
Feb 7, 2020
Messages
398
What is the best way to get custom fonts to work for frames outside of overriding the default font (I'd like to mix and match multiple font faces)? I have not had any luck. I've tried a half dozen methods of using simple frames and frames that have text children and it either crashes the game or makes the text disappear. I do understand there is an absurd limitation in the actual "TEXT" frametypes not supporting this function (ugh!).

Anyone have snippets that work? Can this only be done via FDF and TOC files?
 
Level 15
Joined
Feb 7, 2020
Messages
398
Finally figured out the issue. You need a line break at the end of a .toc file to get BlzLoadTOCFile() to work (UI: toc-Files)

fdf:
Lua:
war3mapImported\SimpleFrameString.fdf

toc:
Lua:
Frame "SIMPLEFRAME" "SimpleFrameString" {
    Width 0.0001,
    Height 0.0001,
    String "SimpleFrameStringValue" {
        Anchor TOPLEFT, 0, 0,
        Font "war3mapImported\fonts-consolas.ttf", 0.01,
    }
}
 
Level 15
Joined
Feb 7, 2020
Messages
398
You can just copy and past the original "Text" frame with different fonts inside a custom fdf though.

A simpleframe is much better in most use-cases though. That is unless you really need it to be a nonsimple frame (for example to allow layering ir on top of other nonsimple frames).
I ended up going this route after digging through the .fdf source so I can use the 'INHERITS' property everywhere else.

Lua:
Frame "TEXT" "FrameBaseText" {
    FrameFont "war3mapImported\fonts-consolas.ttf", 0.008, "",
    FontJustificationH JUSTIFYLEFT,
    FontJustificationV JUSTIFYTOP,
    FontColor 1.0 1.0 1.0 1.0,
}
 
Status
Not open for further replies.
Top