mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
GRAPHICS: MACGUI: Switch TTFMap to saner data structure not requiring global constructor
This commit is contained in:
parent
3334871e3a
commit
5bd7b57282
@ -672,12 +672,12 @@ int MacFontManager::registerFontName(Common::String name, int preferredId) {
|
||||
return id;
|
||||
}
|
||||
|
||||
int MacFontManager::registerTTFFont(const Common::Array<TTFMap> &ttfList) {
|
||||
int MacFontManager::registerTTFFont(const TTFMap ttfList[]) {
|
||||
int defaultValue = 1;
|
||||
int realId = 100;
|
||||
auto checkId = [&](int id) {
|
||||
for (auto &&i : ttfList) {
|
||||
if (_fontInfo.contains(id + i.slant)) {
|
||||
for (const TTFMap *i = ttfList; i->ttfName; i++) {
|
||||
if (_fontInfo.contains(id + i->slant)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -687,9 +687,9 @@ int MacFontManager::registerTTFFont(const Common::Array<TTFMap> &ttfList) {
|
||||
while (checkId(realId))
|
||||
realId++;
|
||||
|
||||
for (auto &&i : ttfList) {
|
||||
for (const TTFMap *i = ttfList; i->ttfName; i++) {
|
||||
int id = realId;
|
||||
Common::String name = i.ttfName;
|
||||
Common::String name = i->ttfName;
|
||||
|
||||
if (name.empty()) {
|
||||
if (defaultValue == 1)
|
||||
@ -705,7 +705,7 @@ int MacFontManager::registerTTFFont(const Common::Array<TTFMap> &ttfList) {
|
||||
|
||||
int slant = 0;
|
||||
|
||||
id += slant | i.slant;
|
||||
id += slant | i->slant;
|
||||
|
||||
FontInfo *info = new FontInfo;
|
||||
info->name = name;
|
||||
|
@ -179,7 +179,7 @@ public:
|
||||
|
||||
void printFontRegistry(int debugLevel, uint32 channel);
|
||||
|
||||
int registerTTFFont(const Common::Array<Graphics::TTFMap> &ttfList);
|
||||
int registerTTFFont(const Graphics::TTFMap ttfList[]);
|
||||
|
||||
int getFamilyId(int newId, int newSlant);
|
||||
|
||||
|
@ -34,11 +34,12 @@
|
||||
|
||||
namespace GUI {
|
||||
|
||||
Common::Array<Graphics::TTFMap> ttfFamily = {
|
||||
const Graphics::TTFMap ttfFamily[] = {
|
||||
{"NotoSans-Regular.ttf", Graphics::kMacFontRegular},
|
||||
{"NotoSans-Bold.ttf", Graphics::kMacFontBold},
|
||||
{"NotoSerif-Italic.ttf", Graphics::kMacFontItalic},
|
||||
{"NotoSerif-Bold-Italic.ttf", Graphics::kMacFontBold | Graphics::kMacFontItalic},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
RichTextWidget::RichTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, const Common::U32String &tooltip)
|
||||
|
Loading…
x
Reference in New Issue
Block a user