Skip to content

Commit

Permalink
xrUICore/FontManager/FontManager.cpp: return size and interval font s…
Browse files Browse the repository at this point in the history
…ettings (OpenXRay#382)

In original SOC/CS, interval was only set in stat_font, so GSC removed
reading of these config values in COP and just set interval manually.
But reading from config is generally better. Plus, mods could use
interval, so let's return this code.
  • Loading branch information
Xottab-DUTY authored and antoncxx committed Mar 3, 2024
1 parent 6db9d50 commit ebe859d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/xrUICore/FontManager/FontManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ void CFontManager::InitializeFonts()
InitializeFont(pFontGraffiti50Russian, "ui_font_graff_50");
InitializeFont(pFontLetterica25, "ui_font_letter_25");
InitializeFont(pFontStat, "stat_font", CGameFont::fsDeviceIndependent);
pFontStat->SetInterval(0.75f, 1.0f);
}

LPCSTR CFontManager::GetFontTexName(LPCSTR section)
Expand Down Expand Up @@ -78,6 +77,17 @@ void CFontManager::InitializeFont(CGameFont*& F, LPCSTR section, u32 flags)
#ifdef DEBUG
F->m_font_name = section;
#endif

if (pSettings->line_exist(section, "size"))
{
const float sz = pSettings->r_float(section, "size");
if (flags & CGameFont::fsDeviceIndependent)
F->SetHeightI(sz);
else
F->SetHeight(sz);
}
if (pSettings->line_exist(section, "interval"))
F->SetInterval(pSettings->r_fvector2(section, "interval"));
}

CFontManager::~CFontManager()
Expand Down

0 comments on commit ebe859d

Please sign in to comment.