mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-08-04 11:55:07 -04:00
A font object names its face as well as its size, and everything was drawn in FRIZQT regardless — headings that should be MORPHEUS, damage in SKURRI, condensed numbers in ARIALN. All five faces the interface uses are on disk and all five are now loaded and picked per font string. Lookups go through a normalised key, because a font object writes "Fonts\\MORPHEUS.ttf" and the file on disk is lower case; matching either spelling literally would find neither. A face that was never loaded falls back to whatever the renderer was already using rather than drawing nothing. Faces are registered before the first frame, since that is when the glyph atlas is built and it cannot take another afterwards without being torn down.
26 lines
921 B
C++
26 lines
921 B
C++
#pragma once
|
|
|
|
// The interface's typefaces, by the name FrameXML calls them.
|
|
//
|
|
// A font object names its face as a path — "Fonts\MORPHEUS.ttf" — and the file
|
|
// on disk is lower case, so lookups go through a normalised key rather than the
|
|
// spelling either side happens to use. Faces are registered once, before the
|
|
// first frame, because the glyph atlas is built then and cannot take another
|
|
// afterwards without being torn down.
|
|
|
|
#include <string>
|
|
|
|
struct ImFont;
|
|
|
|
namespace wowee::ui {
|
|
|
|
/// Records a face under a path or filename. Later registrations of the same
|
|
/// face replace the earlier one.
|
|
void registerInterfaceFace(const std::string& pathOrName, ImFont* font);
|
|
|
|
/// The face for a path a font object named, or null if it was never loaded —
|
|
/// in which case the caller should draw with whatever it was already using.
|
|
ImFont* interfaceFace(const std::string& pathOrName);
|
|
|
|
} // namespace wowee::ui
|