rainmeter-studio/Library/MeterString.cpp

662 lines
15 KiB
C++
Raw Normal View History

2009-02-10 18:37:48 +00:00
/*
Copyright (C) 2001 Kimmo Pekkola
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2009-02-10 18:37:48 +00:00
*/
#include "StdAfx.h"
2009-02-10 18:37:48 +00:00
#include "MeterString.h"
#include "Rainmeter.h"
#include "Measure.h"
#include "Error.h"
2013-03-25 15:42:18 +00:00
#include "../Common/Gfx/Canvas.h"
2009-02-10 18:37:48 +00:00
using namespace Gdiplus;
2011-06-06 12:27:19 +00:00
#define PI (3.14159265f)
#define CONVERT_TO_DEGREES(X) ((X) * (180.0f / PI))
2010-11-05 03:25:21 +00:00
void StringToUpper(std::wstring& str)
{
WCHAR* srcAndDest = &str[0];
int strAndDestLen = (int)str.length();
LCMapString(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, srcAndDest, strAndDestLen, srcAndDest, strAndDestLen);
2010-11-05 03:25:21 +00:00
}
void StringToLower(std::wstring& str)
{
WCHAR* srcAndDest = &str[0];
int strAndDestLen = (int)str.length();
LCMapString(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, srcAndDest, strAndDestLen, srcAndDest, strAndDestLen);
2010-11-05 03:25:21 +00:00
}
void StringToProper(std::wstring& str)
{
if (!str.empty())
{
2012-05-13 09:30:20 +00:00
WCHAR* srcAndDest = &str[0];
LCMapString(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, srcAndDest, 1, srcAndDest, 1);
2010-11-05 03:25:21 +00:00
for (size_t i = 1; i < str.length(); ++i)
{
2012-05-13 09:30:20 +00:00
srcAndDest = &str[i];
LCMapString(LOCALE_USER_DEFAULT, (iswspace(str[i - 1]) > 0) ? LCMAP_UPPERCASE : LCMAP_LOWERCASE, srcAndDest, 1, srcAndDest, 1);
2010-11-05 03:25:21 +00:00
}
}
}
2009-02-10 18:37:48 +00:00
/*
** The constructor
**
*/
2013-05-31 14:18:52 +00:00
MeterString::MeterString(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
m_Color(Color::White),
m_EffectColor(Color::Black),
m_AutoScale(AUTOSCALE_OFF),
m_Style(NORMAL),
m_Effect(EFFECT_NONE),
2012-05-20 17:57:12 +00:00
m_Case(TEXTCASE_NONE),
m_FontSize(10),
m_Scale(1.0),
m_NoDecimals(true),
m_Percentual(true),
m_ClipType(CLIP_OFF),
m_NeedsClipping(false),
m_ClipStringW(-1),
m_ClipStringH(-1),
2013-03-25 15:42:18 +00:00
m_TextFormat(meterWindow->GetCanvas().CreateTextFormat()),
m_NumOfDecimals(-1),
m_Angle()
2009-02-10 18:37:48 +00:00
{
}
/*
** The destructor
**
*/
2013-05-31 14:18:52 +00:00
MeterString::~MeterString()
2009-02-10 18:37:48 +00:00
{
2013-03-25 15:42:18 +00:00
delete m_TextFormat;
2013-05-31 14:28:39 +00:00
m_TextFormat = nullptr;
2009-02-10 18:37:48 +00:00
}
/*
** Returns the X-coordinate of the meter
**
*/
2013-05-31 14:18:52 +00:00
int MeterString::GetX(bool abs)
2009-02-10 18:37:48 +00:00
{
2013-05-31 14:18:52 +00:00
int x = Meter::GetX();
2009-02-10 18:37:48 +00:00
2011-03-29 19:21:57 +00:00
if (!abs)
2009-02-10 18:37:48 +00:00
{
2013-03-25 15:42:18 +00:00
switch (m_TextFormat->GetHorizontalAlignment())
2009-02-10 18:37:48 +00:00
{
2013-03-25 15:42:18 +00:00
case Gfx::HorizontalAlignment::Center:
2011-11-10 13:44:19 +00:00
x -= m_W / 2;
2009-02-10 18:37:48 +00:00
break;
2013-03-25 15:42:18 +00:00
case Gfx::HorizontalAlignment::Right:
2009-02-10 18:37:48 +00:00
x -= m_W;
break;
}
}
return x;
}
/*
** Returns the Y-coordinate of the meter
**
*/
2013-05-31 14:18:52 +00:00
int MeterString::GetY(bool abs)
{
2013-05-31 14:18:52 +00:00
int y = Meter::GetY();
if (!abs)
{
2013-03-25 15:42:18 +00:00
switch (m_TextFormat->GetVerticalAlignment())
{
2013-03-25 15:42:18 +00:00
case Gfx::VerticalAlignment::Center:
y -= m_H / 2;
break;
2013-03-25 15:42:18 +00:00
case Gfx::VerticalAlignment::Bottom:
y -= m_H;
break;
}
}
return y;
}
2009-02-10 18:37:48 +00:00
/*
** Create the font that is used to draw the text.
**
*/
2013-05-31 14:18:52 +00:00
void MeterString::Initialize()
2009-02-10 18:37:48 +00:00
{
2013-05-31 14:18:52 +00:00
Meter::Initialize();
2012-09-27 01:47:25 +00:00
2013-03-25 15:42:18 +00:00
m_TextFormat->SetProperties(
m_FontFace.c_str(),
m_FontSize,
m_Style & BOLD,
m_Style & ITALIC,
m_MeterWindow->GetFontCollection());
2009-02-10 18:37:48 +00:00
}
/*
** Read the options specified in the ini file.
2009-02-10 18:37:48 +00:00
**
*/
2013-05-31 14:18:52 +00:00
void MeterString::ReadOptions(ConfigParser& parser, const WCHAR* section)
2009-02-10 18:37:48 +00:00
{
// Store the current font values so we know if the font needs to be updated
std::wstring oldFontFace = m_FontFace;
int oldFontSize = m_FontSize;
TEXTSTYLE oldStyle = m_Style;
2013-05-31 14:18:52 +00:00
Meter::ReadOptions(parser, section);
2009-02-10 18:37:48 +00:00
2009-09-04 16:37:51 +00:00
m_Color = parser.ReadColor(section, L"FontColor", Color::Black);
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", Color::Black);
2009-02-10 18:37:48 +00:00
2012-07-03 13:57:46 +00:00
m_Prefix = parser.ReadString(section, L"Prefix", L"");
m_Postfix = parser.ReadString(section, L"Postfix", L"");
m_Text = parser.ReadString(section, L"Text", L"");
2009-02-10 18:37:48 +00:00
2009-09-04 16:37:51 +00:00
m_Percentual = 0!=parser.ReadInt(section, L"Percentual", 0);
int clipping = parser.ReadInt(section, L"ClipString", 0);
switch (clipping)
{
case 2:
m_ClipType = CLIP_AUTO;
2013-01-23 20:24:25 +00:00
m_ClipStringW = parser.ReadInt(section, L"ClipStringW", -1);
m_ClipStringH = parser.ReadInt(section, L"ClipStringH", -1);
break;
case 1:
m_ClipType = CLIP_ON;
break;
case 0:
m_ClipType = CLIP_OFF;
break;
default:
LogErrorF(this, L"ClipString=%s is not valid", clipping);
2013-01-23 20:24:25 +00:00
}
2009-02-10 18:37:48 +00:00
m_FontFace = parser.ReadString(section, L"FontFace", L"Arial");
if (m_FontFace.empty())
{
m_FontFace = L"Arial";
}
2013-02-06 10:12:16 +00:00
m_FontSize = parser.ReadInt(section, L"FontSize", 10);
if (m_FontSize < 0)
{
m_FontSize = 10;
}
2009-09-04 16:37:51 +00:00
m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", -1);
2009-02-10 18:37:48 +00:00
m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", 0.0);
2009-02-10 18:37:48 +00:00
2011-01-24 10:15:05 +00:00
const std::wstring& autoscale = parser.ReadString(section, L"AutoScale", L"0");
int autoscaleValue = _wtoi(autoscale.c_str());
if (autoscaleValue == 0)
{
m_AutoScale = AUTOSCALE_OFF;
}
else
{
if (autoscale.find_last_of(L"kK") == std::wstring::npos)
{
m_AutoScale = (autoscaleValue == 2) ? AUTOSCALE_1000 : AUTOSCALE_1024;
}
else
{
m_AutoScale = (autoscaleValue == 2) ? AUTOSCALE_1000K : AUTOSCALE_1024K;
}
}
2011-01-24 10:15:05 +00:00
const std::wstring& scale = parser.ReadString(section, L"Scale", L"1");
m_NoDecimals = (scale.find(L'.') == std::wstring::npos);
m_Scale = parser.ParseDouble(scale.c_str(), 1);
2009-02-10 18:37:48 +00:00
2013-03-25 15:42:18 +00:00
const WCHAR* hAlign = parser.ReadString(section, L"StringAlign", L"LEFT").c_str();
2013-05-31 14:28:39 +00:00
const WCHAR* vAlign = nullptr;
2013-03-25 15:42:18 +00:00
if (_wcsnicmp(hAlign, L"LEFT", 4) == 0)
{
2013-03-25 15:42:18 +00:00
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Left);
vAlign = hAlign + 4;
}
2013-03-25 15:42:18 +00:00
else if (_wcsnicmp(hAlign, L"RIGHT", 5) == 0)
{
2013-03-25 15:42:18 +00:00
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Right);
vAlign = hAlign + 5;
}
2013-03-25 15:42:18 +00:00
else if (_wcsnicmp(hAlign, L"CENTER", 6) == 0)
{
2013-03-25 15:42:18 +00:00
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Center);
vAlign = hAlign + 6;
}
2013-03-25 15:42:18 +00:00
if (!vAlign || _wcsicmp(vAlign, L"TOP") == 0)
{
2013-03-25 15:42:18 +00:00
m_TextFormat->SetVerticalAlignment(Gfx::VerticalAlignment::Top);
}
2013-03-25 15:42:18 +00:00
else if (_wcsicmp(vAlign, L"BOTTOM") == 0)
{
2013-03-25 15:42:18 +00:00
m_TextFormat->SetVerticalAlignment(Gfx::VerticalAlignment::Bottom);
}
2013-03-25 15:42:18 +00:00
else if (_wcsicmp(vAlign, L"CENTER") == 0)
2009-02-10 18:37:48 +00:00
{
2013-03-25 15:42:18 +00:00
m_TextFormat->SetVerticalAlignment(Gfx::VerticalAlignment::Center);
2009-02-10 18:37:48 +00:00
}
2011-11-16 16:47:20 +00:00
const WCHAR* stringCase = parser.ReadString(section, L"StringCase", L"NONE").c_str();
if (_wcsicmp(stringCase, L"NONE") == 0)
{
2012-05-20 17:57:12 +00:00
m_Case = TEXTCASE_NONE;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(stringCase, L"UPPER") == 0)
{
2012-05-20 17:57:12 +00:00
m_Case = TEXTCASE_UPPER;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(stringCase, L"LOWER") == 0)
{
2012-05-20 17:57:12 +00:00
m_Case = TEXTCASE_LOWER;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(stringCase, L"PROPER") == 0)
{
2012-05-20 17:57:12 +00:00
m_Case = TEXTCASE_PROPER;
}
else
{
LogErrorF(this, L"StringCase=%s is not valid", stringCase);
}
2011-11-16 16:47:20 +00:00
const WCHAR* style = parser.ReadString(section, L"StringStyle", L"NORMAL").c_str();
if (_wcsicmp(style, L"NORMAL") == 0)
2009-02-10 18:37:48 +00:00
{
m_Style = NORMAL;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(style, L"BOLD") == 0)
2009-02-10 18:37:48 +00:00
{
m_Style = BOLD;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(style, L"ITALIC") == 0)
2009-02-10 18:37:48 +00:00
{
m_Style = ITALIC;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(style, L"BOLDITALIC") == 0)
2009-02-10 18:37:48 +00:00
{
m_Style = BOLDITALIC;
}
else
{
LogErrorF(this, L"StringStyle=%s is not valid", style);
2009-02-10 18:37:48 +00:00
}
2011-11-16 16:47:20 +00:00
const WCHAR* effect = parser.ReadString(section, L"StringEffect", L"NONE").c_str();
if (_wcsicmp(effect, L"NONE") == 0)
{
m_Effect = EFFECT_NONE;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(effect, L"SHADOW") == 0)
{
m_Effect = EFFECT_SHADOW;
}
2011-11-16 16:47:20 +00:00
else if (_wcsicmp(effect, L"BORDER") == 0)
{
m_Effect = EFFECT_BORDER;
}
else
{
LogErrorF(this, L"StringEffect=%s is not valid", effect);
}
if (m_Initialized &&
(wcscmp(oldFontFace.c_str(), m_FontFace.c_str()) != 0 ||
oldFontSize != m_FontSize ||
oldStyle != m_Style))
{
Initialize(); // Recreate the font
}
2009-02-10 18:37:48 +00:00
}
/*
** Updates the value(s) from the measures.
**
*/
2013-05-31 14:18:52 +00:00
bool MeterString::Update()
2009-02-10 18:37:48 +00:00
{
2013-05-31 14:18:52 +00:00
if (Meter::Update())
2009-02-10 18:37:48 +00:00
{
int decimals = (m_NumOfDecimals != -1) ? m_NumOfDecimals : (m_NoDecimals && (m_Percentual || m_AutoScale == AUTOSCALE_OFF)) ? 0 : 1;
2009-02-10 18:37:48 +00:00
2012-07-03 13:57:46 +00:00
// Create the text
m_String = m_Prefix;
2012-07-17 07:57:28 +00:00
if (!m_Measures.empty())
2009-02-10 18:37:48 +00:00
{
2012-07-17 07:57:28 +00:00
if (m_Text.empty())
2012-07-03 13:57:46 +00:00
{
m_String += m_Measures[0]->GetStringOrFormattedValue(
m_AutoScale, m_Scale, decimals, m_Percentual);
2012-07-17 07:57:28 +00:00
}
else
{
std::wstring tmpText = m_Text;
ReplaceMeasures(tmpText, m_AutoScale, m_Scale, decimals, m_Percentual);
m_String += tmpText;
2012-07-03 13:57:46 +00:00
}
}
else
{
m_String += m_Text;
}
2012-07-03 13:57:46 +00:00
if (!m_Postfix.empty()) m_String += m_Postfix;
2009-02-10 18:37:48 +00:00
2012-05-20 17:57:12 +00:00
switch (m_Case)
{
case TEXTCASE_UPPER:
2010-11-05 03:25:21 +00:00
StringToUpper(m_String);
break;
case TEXTCASE_LOWER:
2010-11-05 03:25:21 +00:00
StringToLower(m_String);
break;
case TEXTCASE_PROPER:
2010-11-05 03:25:21 +00:00
StringToProper(m_String);
break;
}
2011-11-01 06:01:12 +00:00
if (!m_WDefined || !m_HDefined)
2009-02-10 18:37:48 +00:00
{
// Calculate the text size
RectF rect;
2013-03-25 15:42:18 +00:00
if (DrawString(m_MeterWindow->GetCanvas(), &rect))
{
m_W = (int)rect.Width + GetWidthPadding();
m_H = (int)rect.Height + GetHeightPadding();
}
else
{
m_W = GetWidthPadding() + 1;
m_H = GetHeightPadding() + 1;
}
2009-02-10 18:37:48 +00:00
}
return true;
}
return false;
}
/*
** Draws the meter on the double buffer
**
*/
2013-05-31 14:18:52 +00:00
bool MeterString::Draw(Gfx::Canvas& canvas)
2009-02-10 18:37:48 +00:00
{
2013-05-31 14:18:52 +00:00
if (!Meter::Draw(canvas)) return false;
2009-02-10 18:37:48 +00:00
2013-05-31 14:28:39 +00:00
return DrawString(canvas, nullptr);
2009-02-10 18:37:48 +00:00
}
/*
** Draws the string or calculates it's size
**
*/
2013-05-31 14:18:52 +00:00
bool MeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
2009-02-10 18:37:48 +00:00
{
2013-03-25 15:42:18 +00:00
if (!m_TextFormat->IsInitialized()) return false;
2011-06-06 12:27:19 +00:00
LPCWSTR string = m_String.c_str();
2013-03-25 15:42:18 +00:00
UINT stringLen = (UINT)m_String.length();
2013-03-25 15:42:18 +00:00
canvas.SetTextAntiAliasing(m_AntiAlias);
2013-03-25 15:42:18 +00:00
m_TextFormat->SetTrimming(
m_ClipType == CLIP_ON ||
(m_ClipType == CLIP_AUTO && (m_NeedsClipping || (m_WDefined && m_HDefined))));
2010-11-05 03:25:21 +00:00
Gdiplus::Rect meterRect = GetMeterRectPadding();
2009-02-10 18:37:48 +00:00
if (rect)
{
rect->X = (REAL)meterRect.X;
rect->Y = (REAL)meterRect.Y;
2013-03-25 15:42:18 +00:00
if (canvas.MeasureTextW(string, stringLen, *m_TextFormat, *rect) &&
m_ClipType == CLIP_AUTO)
{
// Set initial clipping
m_NeedsClipping = false;
REAL w, h;
bool updateSize = true;
if (m_WDefined)
{
w = (REAL)meterRect.Width;
h = rect->Height;
m_NeedsClipping = true;
}
else if (m_HDefined)
{
if (m_ClipStringW == -1)
{
// Text does not fit in defined height, clip it
if (rect->Height > (REAL)meterRect.Height)
{
m_NeedsClipping = true;
}
rect->Height = (REAL)meterRect.Height;
updateSize = false;
}
else
{
if (rect->Width > (REAL)m_ClipStringW)
{
w = (REAL)m_ClipStringW;
m_NeedsClipping = true;
}
else
{
w = rect->Width;
}
h = (REAL)meterRect.Height;
}
}
else
{
if (m_ClipStringW == -1)
{
// Clip text if already larger than ClipStringH
if (m_ClipStringH != -1 && rect->Height > (REAL)m_ClipStringH)
{
m_NeedsClipping = true;
rect->Height = (REAL)m_ClipStringH;
}
updateSize = false;
}
else
{
if (rect->Width > (REAL)m_ClipStringW)
{
w = (REAL)m_ClipStringW;
m_NeedsClipping = true;
}
else
{
w = rect->Width;
}
h = rect->Height;
}
}
if (updateSize)
{
2013-03-25 15:42:18 +00:00
UINT lines = 0;
RectF layout((REAL)meterRect.X, (REAL)meterRect.Y, w, h);
2013-03-25 15:42:18 +00:00
if (canvas.MeasureTextLinesW(string, stringLen, *m_TextFormat, layout, lines) &&
lines != 0)
{
rect->Width = w;
rect->Height = layout.Height;
if (m_HDefined || (m_ClipStringH != -1 && rect->Height > (REAL)m_ClipStringH))
{
rect->Height = m_HDefined ? (REAL)meterRect.Height : (REAL)m_ClipStringH;
}
}
}
}
2009-02-10 18:37:48 +00:00
}
else
{
RectF rcDest((REAL)meterRect.X, (REAL)meterRect.Y, (REAL)meterRect.Width, (REAL)meterRect.Height);
2011-06-06 12:27:19 +00:00
m_Rect = rcDest;
2009-02-10 18:37:48 +00:00
2010-11-05 03:25:21 +00:00
if (m_Angle != 0.0f)
2009-02-10 18:37:48 +00:00
{
const float baseX = (float)Meter::GetX();
canvas.RotateTransform(CONVERT_TO_DEGREES(m_Angle), baseX, (REAL)meterRect.Y, -baseX, -(REAL)meterRect.Y);
2009-02-10 18:37:48 +00:00
}
2011-11-01 04:56:46 +00:00
if (m_Effect != EFFECT_NONE)
{
SolidBrush solidBrush(m_EffectColor);
2011-06-06 12:27:19 +00:00
RectF rcEffect(rcDest);
if (m_Effect == EFFECT_SHADOW)
{
rcEffect.Offset(1, 1);
2013-03-25 15:42:18 +00:00
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
2011-06-06 12:27:19 +00:00
}
else //if (m_Effect == EFFECT_BORDER)
{
rcEffect.Offset(0, 1);
2013-03-25 15:42:18 +00:00
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
2011-06-06 12:27:19 +00:00
rcEffect.Offset(1, -1);
2013-03-25 15:42:18 +00:00
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
2011-06-06 12:27:19 +00:00
rcEffect.Offset(-1, -1);
2013-03-25 15:42:18 +00:00
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
2011-06-06 12:27:19 +00:00
rcEffect.Offset(-1, 1);
2013-03-25 15:42:18 +00:00
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcEffect, solidBrush);
2011-06-06 12:27:19 +00:00
}
}
2011-03-29 19:21:57 +00:00
SolidBrush solidBrush(m_Color);
2013-03-25 15:42:18 +00:00
canvas.DrawTextW(string, (UINT)stringLen, *m_TextFormat, rcDest, solidBrush);
2010-11-05 03:25:21 +00:00
if (m_Angle != 0.0f)
{
canvas.ResetTransform();
2010-11-05 03:25:21 +00:00
}
2009-02-10 18:37:48 +00:00
}
return true;
}
/*
** Overridden method. The string meters need not to be bound on anything
**
*/
2013-05-31 14:18:52 +00:00
void MeterString::BindMeasures(ConfigParser& parser, const WCHAR* section)
2009-02-10 18:37:48 +00:00
{
2012-07-17 07:37:53 +00:00
if (BindPrimaryMeasure(parser, section, true))
2009-02-10 18:37:48 +00:00
{
2012-07-17 07:37:53 +00:00
BindSecondaryMeasures(parser, section);
2009-02-10 18:37:48 +00:00
}
}
/*
** Static helper to log all installed font families.
**
*/
2013-05-31 14:18:52 +00:00
void MeterString::EnumerateInstalledFontFamilies()
{
INT fontCount;
InstalledFontCollection fontCollection;
if (Ok == fontCollection.GetLastStatus())
{
fontCount = fontCollection.GetFamilyCount();
if (fontCount > 0)
{
INT fontFound;
FontFamily* fontFamilies = new FontFamily[fontCount];
if (Ok == fontCollection.GetFamilies(fontCount, fontFamilies, &fontFound))
{
std::wstring fonts;
2010-03-30 22:37:05 +00:00
for (INT i = 0; i < fontCount; ++i)
{
WCHAR familyName[LF_FACESIZE];
if (Ok == fontFamilies[i].GetFamilyName(familyName))
{
fonts += familyName;
}
else
{
fonts += L"***";
}
fonts += L", ";
}
2013-05-30 14:19:42 +00:00
LogWarning(fonts.c_str());
}
else
{
2013-05-30 14:19:42 +00:00
LogError(L"Font enumeration: GetFamilies failed");
}
delete [] fontFamilies;
}
else
{
2013-05-30 14:19:42 +00:00
LogWarning(L"No installed fonts");
}
}
else
{
2013-05-30 14:19:42 +00:00
LogError(L"Font enumeration: InstalledFontCollection failed");
}
2012-11-12 02:10:40 +00:00
}
2013-05-31 14:18:52 +00:00
void MeterString::InitializeStatic()
2012-11-12 02:10:40 +00:00
{
if (GetRainmeter().GetDebug())
2012-11-12 02:10:40 +00:00
{
2013-05-30 14:19:42 +00:00
LogDebug(L"------------------------------");
LogDebug(L"* Font families:");
2012-11-12 02:10:40 +00:00
EnumerateInstalledFontFamilies();
2013-05-30 14:19:42 +00:00
LogDebug(L"------------------------------");
2012-11-12 02:10:40 +00:00
}
}
2013-05-31 14:18:52 +00:00
void MeterString::FinalizeStatic()
2012-11-12 02:10:40 +00:00
{
}