mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Arial font is now the default font when errors occur. Invalid string styles are now logged.
This commit is contained in:
parent
71025aaf51
commit
6bd978ad21
@ -224,7 +224,7 @@ void CMeterString::Initialize()
|
||||
// It couldn't find the font family: Log it.
|
||||
if (Ok != status)
|
||||
{
|
||||
LogWithArgs(LOG_ERROR, L"String: Unable to load font: %s", m_FontFace.c_str());
|
||||
LogWithArgs(LOG_ERROR, L"Unable to load font: %s", m_FontFace.c_str());
|
||||
|
||||
delete m_FontFamily;
|
||||
m_FontFamily = NULL;
|
||||
@ -266,6 +266,18 @@ void CMeterString::Initialize()
|
||||
|
||||
REAL size = (REAL)m_FontSize * (96.0f / (REAL)dpi);
|
||||
|
||||
// Set font defaults
|
||||
FontFamily defaultFamily(L"Arial");
|
||||
Gdiplus::Font* defaultFont;
|
||||
if (defaultFamily.IsAvailable())
|
||||
{
|
||||
defaultFont = new Gdiplus::Font(&defaultFamily, size, style);
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultFont = new Gdiplus::Font(FontFamily::GenericSansSerif(), size, style);
|
||||
}
|
||||
|
||||
// Check if the font is in the cache and use it
|
||||
cacheKey += L'-';
|
||||
cacheKey += FontPropertiesToString(size, style);
|
||||
@ -282,17 +294,7 @@ void CMeterString::Initialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use Arial if installed, else use a generic font
|
||||
FontFamily fFamily(L"Arial");
|
||||
|
||||
if (fFamily.IsAvailable())
|
||||
{
|
||||
m_Font = new Gdiplus::Font(&fFamily, size, style);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Font = new Gdiplus::Font(FontFamily::GenericSansSerif(), size, style);
|
||||
}
|
||||
m_Font = defaultFont;
|
||||
}
|
||||
|
||||
Status status = m_Font->GetLastStatus();
|
||||
@ -304,12 +306,15 @@ void CMeterString::Initialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_Font;
|
||||
m_Font = NULL;
|
||||
m_Font = defaultFont;
|
||||
|
||||
if (m_FontSize != 0)
|
||||
if (FontStyleNotFound == status)
|
||||
{
|
||||
LogWithArgs(LOG_ERROR, L"String: Invalid font: %s", m_FontFace.c_str());
|
||||
LogWithArgs(LOG_ERROR, L"Invalid StringStyle for font: %s", m_FontFace.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
LogWithArgs(LOG_ERROR, L"Invalid font: %s", m_FontFace.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user