https://git.reactos.org/?p=reactos.git;a=commitdiff;h=39eceedd899eefb399b45…
commit 39eceedd899eefb399b451eee10d76b55da146d4
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Dec 31 11:37:46 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Dec 31 11:37:46 2019 +0900
[SDK][INCLUDE] Improve Gdiplus::FontCollection (#2203)
CORE-16585
---
sdk/include/psdk/gdiplusheaders.h | 48 +++++++++++++++++++++++++++++++--------
1 file changed, 38 insertions(+), 10 deletions(-)
diff --git a/sdk/include/psdk/gdiplusheaders.h b/sdk/include/psdk/gdiplusheaders.h
index 915c1cf8f50..dccaa2e1460 100644
--- a/sdk/include/psdk/gdiplusheaders.h
+++ b/sdk/include/psdk/gdiplusheaders.h
@@ -650,30 +650,51 @@ class FontCollection : public GdiplusBase
friend class FontFamily;
public:
- FontCollection()
+ FontCollection() : nativeFontCollection(NULL), lastStatus(Ok)
+ {
+ }
+
+ virtual ~FontCollection()
{
}
Status
GetFamilies(INT numSought, FontFamily *gpfamilies, INT *numFound) const
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
INT
GetFamilyCount() const
{
- return 0;
+ INT numFound = 0;
+ lastStatus = DllExports::GdipGetFontCollectionFamilyCount(nativeFontCollection,
&numFound);
+ return numFound;
}
Status
- GetLastStatus()
+ GetLastStatus() const
{
- return NotImplemented;
+ return lastStatus;
+ }
+
+ protected:
+ GpFontCollection *nativeFontCollection;
+ mutable Status lastStatus;
+
+ Status
+ SetStatus(Status status) const
+ {
+ if (status != Ok)
+ lastStatus = status;
+ return status;
}
private:
- GpFontCollection *fontCollection;
+ // FontCollection is not copyable
+ FontCollection(const FontCollection &);
+ FontCollection &
+ operator=(const FontCollection &);
};
class FontFamily : public GdiplusBase
@@ -687,8 +708,8 @@ class FontFamily : public GdiplusBase
FontFamily(const WCHAR *name, const FontCollection *fontCollection)
{
- status = DllExports::GdipCreateFontFamilyFromName(
- name, fontCollection ? fontCollection->fontCollection : NULL,
&fontFamily);
+ GpFontCollection *theCollection = fontCollection ?
fontCollection->nativeFontCollection : NULL;
+ status = DllExports::GdipCreateFontFamilyFromName(name, theCollection,
&fontFamily);
}
FontFamily *
@@ -809,18 +830,25 @@ class PrivateFontCollection : public FontCollection
public:
PrivateFontCollection()
{
+ nativeFontCollection = NULL;
+ lastStatus =
DllExports::GdipNewPrivateFontCollection(&nativeFontCollection);
+ }
+
+ virtual ~PrivateFontCollection()
+ {
+ DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection);
}
Status
AddFontFile(const WCHAR *filename)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection,
filename));
}
Status
AddMemoryFont(const VOID *memory, INT length)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipPrivateAddMemoryFont(nativeFontCollection,
memory, length));
}
};