mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Gfx: Add FontCollection implementation
The D2D implementation is a stub for now.
This commit is contained in:
parent
4d22c5ac61
commit
0b3a4d86c4
@ -19,6 +19,7 @@
|
||||
#ifndef RM_GFX_CANVAS_H_
|
||||
#define RM_GFX_CANVAS_H_
|
||||
|
||||
#include "FontCollection.h"
|
||||
#include "TextFormat.h"
|
||||
#include <Windows.h>
|
||||
#include <GdiPlus.h>
|
||||
@ -53,6 +54,7 @@ public:
|
||||
virtual HDC GetDC() = 0;
|
||||
virtual void ReleaseDC(HDC dc) = 0;
|
||||
|
||||
virtual FontCollection* CreateFontCollection() = 0;
|
||||
virtual TextFormat* CreateTextFormat() = 0;
|
||||
|
||||
virtual bool IsTransparentPixel(int x, int y) = 0;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define RM_GFX_CANVASD2D_H_
|
||||
|
||||
#include "Canvas.h"
|
||||
#include "FontCollectionD2D.h"
|
||||
#include "TextFormatD2D.h"
|
||||
#include "WICBitmapDIB.h"
|
||||
#include <string>
|
||||
@ -48,7 +49,8 @@ public:
|
||||
|
||||
virtual HDC GetDC() override;
|
||||
virtual void ReleaseDC(HDC dc) override;
|
||||
|
||||
|
||||
virtual FontCollection* CreateFontCollection() override { return new FontCollectionD2D(); }
|
||||
virtual TextFormat* CreateTextFormat() override { return new TextFormatD2D(); }
|
||||
|
||||
virtual bool IsTransparentPixel(int x, int y) override;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define RM_GFX_CANVASGDIP_H_
|
||||
|
||||
#include "Canvas.h"
|
||||
#include "FontCollectionGDIP.h"
|
||||
#include "TextFormatGDIP.h"
|
||||
#include <string>
|
||||
#include <GdiPlus.h>
|
||||
@ -44,6 +45,7 @@ public:
|
||||
virtual HDC GetDC() override;
|
||||
virtual void ReleaseDC(HDC dc) override;
|
||||
|
||||
virtual FontCollection* CreateFontCollection() override { return new FontCollectionGDIP(); }
|
||||
virtual TextFormat* CreateTextFormat() override { return new TextFormatGDIP(); }
|
||||
|
||||
virtual bool IsTransparentPixel(int x, int y) override;
|
||||
|
31
Common/Gfx/FontCollection.cpp
Normal file
31
Common/Gfx/FontCollection.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright (C) 2013 Birunthan Mohanathas
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "FontCollection.h"
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
FontCollection::FontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
FontCollection::~FontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Gfx
|
44
Common/Gfx/FontCollection.h
Normal file
44
Common/Gfx/FontCollection.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright (C) 2013 Birunthan Mohanathas
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RM_GFX_FONTCOLLECTION_H_
|
||||
#define RM_GFX_FONTCOLLECTION_H_
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
// Interface for a collection of fonts that may or may not be installed on the system.
|
||||
class __declspec(novtable) FontCollection
|
||||
{
|
||||
public:
|
||||
virtual ~FontCollection();
|
||||
|
||||
// Adds a file to the collection. Returns true if the file was successfully added.
|
||||
virtual bool AddFile(const WCHAR* file) = 0;
|
||||
|
||||
protected:
|
||||
FontCollection();
|
||||
|
||||
private:
|
||||
FontCollection(const FontCollection& other) {}
|
||||
};
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
#endif
|
38
Common/Gfx/FontCollectionD2D.cpp
Normal file
38
Common/Gfx/FontCollectionD2D.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (C) 2013 Birunthan Mohanathas
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "FontCollectionD2D.h"
|
||||
#include <GdiPlus.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
FontCollectionD2D::FontCollectionD2D() : FontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
FontCollectionD2D::~FontCollectionD2D()
|
||||
{
|
||||
}
|
||||
|
||||
bool FontCollectionD2D::AddFile(const WCHAR* file)
|
||||
{
|
||||
// FIXME.
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Gfx
|
48
Common/Gfx/FontCollectionD2D.h
Normal file
48
Common/Gfx/FontCollectionD2D.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2013 Birunthan Mohanathas
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RM_GFX_FONTCOLLECTIOND2D_H_
|
||||
#define RM_GFX_FONTCOLLECTIOND2D_H_
|
||||
|
||||
#include "FontCollection.h"
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
// Wraps the DirectWrite IDWriteFontCollection for use with CanvasD2D.
|
||||
class FontCollectionD2D final : public FontCollection
|
||||
{
|
||||
public:
|
||||
virtual ~FontCollectionD2D();
|
||||
|
||||
virtual bool AddFile(const WCHAR* file) override;
|
||||
|
||||
protected:
|
||||
FontCollectionD2D();
|
||||
|
||||
private:
|
||||
friend class CanvasD2D;
|
||||
friend class TextFormatD2D;
|
||||
|
||||
FontCollectionD2D(const FontCollectionD2D& other) {}
|
||||
|
||||
void Dispose();
|
||||
};
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
#endif
|
54
Common/Gfx/FontCollectionGDIP.cpp
Normal file
54
Common/Gfx/FontCollectionGDIP.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (C) 2013 Birunthan Mohanathas
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "FontCollectionGDIP.h"
|
||||
#include <GdiPlus.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
FontCollectionGDIP::FontCollectionGDIP() : FontCollection(),
|
||||
m_PrivateCollection()
|
||||
{
|
||||
}
|
||||
|
||||
FontCollectionGDIP::~FontCollectionGDIP()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
void FontCollectionGDIP::Dispose()
|
||||
{
|
||||
if (m_PrivateCollection)
|
||||
{
|
||||
delete m_PrivateCollection;
|
||||
m_PrivateCollection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool FontCollectionGDIP::AddFile(const WCHAR* file)
|
||||
{
|
||||
if (!m_PrivateCollection)
|
||||
{
|
||||
m_PrivateCollection = new Gdiplus::PrivateFontCollection();
|
||||
}
|
||||
|
||||
const Gdiplus::Status status = m_PrivateCollection->AddFontFile(file);
|
||||
return status == Gdiplus::Ok;
|
||||
}
|
||||
|
||||
} // namespace Gfx
|
54
Common/Gfx/FontCollectionGDIP.h
Normal file
54
Common/Gfx/FontCollectionGDIP.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (C) 2013 Birunthan Mohanathas
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef RM_GFX_FONTCOLLECTIONGDIP_H_
|
||||
#define RM_GFX_FONTCOLLECTIONGDIP_H_
|
||||
|
||||
#include "FontCollection.h"
|
||||
|
||||
namespace Gdiplus {
|
||||
class PrivateFontCollection;
|
||||
}
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
// Wraps the GDI+ PrivateFontCollection for use with CanvasGDIP.
|
||||
class FontCollectionGDIP final : public FontCollection
|
||||
{
|
||||
public:
|
||||
virtual ~FontCollectionGDIP();
|
||||
|
||||
virtual bool AddFile(const WCHAR* file) override;
|
||||
|
||||
protected:
|
||||
FontCollectionGDIP();
|
||||
|
||||
private:
|
||||
friend class CanvasGDIP;
|
||||
friend class TextFormatGDIP;
|
||||
|
||||
FontCollectionGDIP(const FontCollectionGDIP& other) {}
|
||||
|
||||
void Dispose();
|
||||
|
||||
Gdiplus::PrivateFontCollection* m_PrivateCollection;
|
||||
};
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
#endif
|
@ -20,10 +20,11 @@
|
||||
#define RM_GFX_TEXTFORMAT_H_
|
||||
|
||||
#include <Windows.h>
|
||||
#include <GdiPlus.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
class FontCollection;
|
||||
|
||||
enum class HorizontalAlignment : BYTE
|
||||
{
|
||||
Left,
|
||||
@ -44,7 +45,10 @@ public:
|
||||
virtual ~TextFormat();
|
||||
|
||||
virtual bool IsInitialized() const = 0;
|
||||
virtual void SetProperties(const WCHAR* fontFamily, int size, bool bold, bool italic, Gdiplus::PrivateFontCollection* fontCollection) = 0;
|
||||
|
||||
virtual void SetProperties(
|
||||
const WCHAR* fontFamily, int size, bool bold, bool italic,
|
||||
const FontCollection* fontCollection) = 0;
|
||||
|
||||
virtual void SetTrimming(bool trim) = 0;
|
||||
|
||||
|
@ -88,7 +88,9 @@ void TextFormatD2D::CreateLayout(const WCHAR* str, UINT strLen, float maxW, floa
|
||||
}
|
||||
}
|
||||
|
||||
void TextFormatD2D::SetProperties(const WCHAR* fontFamily, int size, bool bold, bool italic, Gdiplus::PrivateFontCollection* fontCollection)
|
||||
void TextFormatD2D::SetProperties(
|
||||
const WCHAR* fontFamily, int size, bool bold, bool italic,
|
||||
const FontCollection* fontCollection)
|
||||
{
|
||||
Dispose();
|
||||
|
||||
|
@ -32,7 +32,10 @@ public:
|
||||
virtual ~TextFormatD2D();
|
||||
|
||||
virtual bool IsInitialized() const override { return m_TextFormat != nullptr; }
|
||||
virtual void SetProperties(const WCHAR* fontFamily, int size, bool bold, bool italic, Gdiplus::PrivateFontCollection* fontCollection) override;
|
||||
|
||||
virtual void SetProperties(
|
||||
const WCHAR* fontFamily, int size, bool bold, bool italic,
|
||||
const FontCollection* fontCollection) override;
|
||||
|
||||
virtual void SetTrimming(bool trim) override;
|
||||
virtual void SetHorizontalAlignment(HorizontalAlignment alignment) override;
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "TextFormatGDIP.h"
|
||||
#include "FontCollectionGDIP.h"
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
@ -40,8 +41,12 @@ void TextFormatGDIP::Dispose()
|
||||
m_Font = nullptr;
|
||||
}
|
||||
|
||||
void TextFormatGDIP::SetProperties(const WCHAR* fontFamily, int size, bool bold, bool italic, Gdiplus::PrivateFontCollection* fontCollection)
|
||||
void TextFormatGDIP::SetProperties(
|
||||
const WCHAR* fontFamily, int size, bool bold, bool italic,
|
||||
const FontCollection* fontCollection)
|
||||
{
|
||||
auto fontCollectionGDIP = (FontCollectionGDIP*)fontCollection;
|
||||
|
||||
Dispose();
|
||||
|
||||
m_FontFamily = new Gdiplus::FontFamily(fontFamily);
|
||||
@ -51,9 +56,9 @@ void TextFormatGDIP::SetProperties(const WCHAR* fontFamily, int size, bool bold,
|
||||
m_FontFamily = nullptr;
|
||||
|
||||
// Not found in system collection so try the private collection.
|
||||
if (fontCollection)
|
||||
if (fontCollectionGDIP && fontCollectionGDIP->m_PrivateCollection)
|
||||
{
|
||||
m_FontFamily = new Gdiplus::FontFamily(fontFamily, fontCollection);
|
||||
m_FontFamily = new Gdiplus::FontFamily(fontFamily, fontCollectionGDIP->m_PrivateCollection);
|
||||
if (m_FontFamily->GetLastStatus() != Gdiplus::Ok)
|
||||
{
|
||||
delete m_FontFamily;
|
||||
|
@ -31,7 +31,10 @@ public:
|
||||
virtual ~TextFormatGDIP();
|
||||
|
||||
virtual bool IsInitialized() const override { return m_Font != nullptr; }
|
||||
virtual void SetProperties(const WCHAR* fontFamily, int size, bool bold, bool italic, Gdiplus::PrivateFontCollection* fontCollection) override;
|
||||
|
||||
virtual void SetProperties(
|
||||
const WCHAR* fontFamily, int size, bool bold, bool italic,
|
||||
const FontCollection* fontCollection) override;
|
||||
|
||||
virtual void SetTrimming(bool trim) override;
|
||||
virtual void SetHorizontalAlignment(HorizontalAlignment alignment) override;
|
||||
|
@ -68,6 +68,9 @@
|
||||
<ClCompile Include="..\Common\Gfx\Canvas.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\CanvasD2D.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\CanvasGDIP.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\FontCollection.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\FontCollectionD2D.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\FontCollectionGDIP.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\TextFormat.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\TextFormatD2D.cpp" />
|
||||
<ClCompile Include="..\Common\Gfx\TextFormatGDIP.cpp" />
|
||||
@ -287,6 +290,9 @@
|
||||
<ClInclude Include="..\Common\Gfx\Canvas.h" />
|
||||
<ClInclude Include="..\Common\Gfx\CanvasD2D.h" />
|
||||
<ClInclude Include="..\Common\Gfx\CanvasGDIP.h" />
|
||||
<ClInclude Include="..\Common\Gfx\FontCollection.h" />
|
||||
<ClInclude Include="..\Common\Gfx\FontCollectionD2D.h" />
|
||||
<ClInclude Include="..\Common\Gfx\FontCollectionGDIP.h" />
|
||||
<ClInclude Include="..\Common\Gfx\TextFormat.h" />
|
||||
<ClInclude Include="..\Common\Gfx\TextFormatD2D.h" />
|
||||
<ClInclude Include="..\Common\Gfx\TextFormatGDIP.h" />
|
||||
|
@ -342,9 +342,24 @@
|
||||
<ClCompile Include="..\Common\StringUtil.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\Canvas.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\CanvasD2D.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\CanvasGDIP.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\FontCollection.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\FontCollectionD2D.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\FontCollectionGDIP.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\TextFormat.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
@ -354,21 +369,15 @@
|
||||
<ClCompile Include="..\Common\Gfx\TextFormatGDIP.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\WICBitmapLockGDIP.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\Canvas.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\CanvasD2D.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\WICBitmapDIB.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\WICBitmapLockDIB.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Gfx\WICBitmapLockGDIP.cpp">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ConfigParser.h">
|
||||
@ -614,9 +623,24 @@
|
||||
<ClInclude Include="..\Common\StringUtil.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\Canvas.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\CanvasD2D.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\CanvasGDIP.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\FontCollectionGDIP.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\FontCollection.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\FontCollectionD2D.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\TextFormat.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
@ -626,21 +650,15 @@
|
||||
<ClInclude Include="..\Common\Gfx\TextFormatGDIP.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\WICBitmapLockGDIP.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\Canvas.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\CanvasD2D.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\WICBitmapDIB.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\WICBitmapLockDIB.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Gfx\WICBitmapLockGDIP.h">
|
||||
<Filter>Common\Gfx</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Library.rc">
|
||||
|
@ -157,7 +157,7 @@ void CMeterString::Initialize()
|
||||
m_FontSize,
|
||||
m_Style & BOLD,
|
||||
m_Style & ITALIC,
|
||||
m_MeterWindow->GetPrivateFontCollection());
|
||||
m_MeterWindow->GetFontCollection());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2096,7 +2096,7 @@ bool CMeterWindow::ReadSkin()
|
||||
|
||||
if (find != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
m_FontCollection = new PrivateFontCollection();
|
||||
m_FontCollection = m_Canvas->CreateFontCollection();
|
||||
|
||||
do
|
||||
{
|
||||
@ -2104,8 +2104,7 @@ bool CMeterWindow::ReadSkin()
|
||||
{
|
||||
std::wstring file(resourcePath, 0, resourcePath.length() - 1);
|
||||
file += fd.cFileName;
|
||||
Status status = m_FontCollection->AddFontFile(file.c_str());
|
||||
if (status != Ok)
|
||||
if (!m_FontCollection->AddFile(file.c_str()))
|
||||
{
|
||||
std::wstring error = L"Unable to load font: ";
|
||||
error += file.c_str();
|
||||
@ -2125,7 +2124,7 @@ bool CMeterWindow::ReadSkin()
|
||||
{
|
||||
if (!m_FontCollection)
|
||||
{
|
||||
m_FontCollection = new PrivateFontCollection();
|
||||
m_FontCollection = m_Canvas->CreateFontCollection();
|
||||
}
|
||||
|
||||
int i = 1;
|
||||
@ -2134,13 +2133,11 @@ bool CMeterWindow::ReadSkin()
|
||||
// Try program folder first
|
||||
std::wstring szFontFile = Rainmeter->GetPath() + L"Fonts\\";
|
||||
szFontFile += localFont;
|
||||
Status status = m_FontCollection->AddFontFile(szFontFile.c_str());
|
||||
if (status != Ok)
|
||||
if (!m_FontCollection->AddFile(szFontFile.c_str()))
|
||||
{
|
||||
szFontFile = localFont;
|
||||
MakePathAbsolute(szFontFile);
|
||||
status = m_FontCollection->AddFontFile(szFontFile.c_str());
|
||||
if (status != Ok)
|
||||
if (!m_FontCollection->AddFile(szFontFile.c_str()))
|
||||
{
|
||||
std::wstring error = L"Unable to load font: ";
|
||||
error += localFont;
|
||||
|
@ -152,11 +152,10 @@ class CMeasure;
|
||||
class CMeter;
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
class Canvas;
|
||||
class FontCollection;
|
||||
class TextFormat;
|
||||
|
||||
} // namespace Gfx
|
||||
}
|
||||
|
||||
class CMeterWindow : public CGroup
|
||||
{
|
||||
@ -249,7 +248,7 @@ public:
|
||||
|
||||
void MakePathAbsolute(std::wstring& path);
|
||||
|
||||
Gdiplus::PrivateFontCollection* GetPrivateFontCollection() { return m_FontCollection; }
|
||||
Gfx::FontCollection* GetFontCollection() { return m_FontCollection; }
|
||||
|
||||
CMeter* GetMeter(const std::wstring& meterName);
|
||||
CMeasure* GetMeasure(const std::wstring& measureName) { return m_Parser.GetMeasure(measureName); }
|
||||
@ -460,7 +459,7 @@ private:
|
||||
int m_UpdateCounter;
|
||||
UINT m_MouseMoveCounter;
|
||||
|
||||
Gdiplus::PrivateFontCollection* m_FontCollection;
|
||||
Gfx::FontCollection* m_FontCollection;
|
||||
|
||||
bool m_ToolTipHidden;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user