• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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

Status
Not open for further replies.
Level 14
Joined
Feb 7, 2020
Messages
387
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 14
Joined
Feb 7, 2020
Messages
387
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 14
Joined
Feb 7, 2020
Messages
387
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