[SDK][INCLUDE] Improve Gdiplus::FontCollection (#2203)

CORE-16585
This commit is contained in:
Katayama Hirofumi MZ 2019-12-31 11:37:46 +09:00 committed by GitHub
parent 094960e386
commit 39eceedd89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -650,30 +650,51 @@ class FontCollection : public GdiplusBase
friend class FontFamily; friend class FontFamily;
public: public:
FontCollection() FontCollection() : nativeFontCollection(NULL), lastStatus(Ok)
{
}
virtual ~FontCollection()
{ {
} }
Status Status
GetFamilies(INT numSought, FontFamily *gpfamilies, INT *numFound) const GetFamilies(INT numSought, FontFamily *gpfamilies, INT *numFound) const
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
INT INT
GetFamilyCount() const GetFamilyCount() const
{ {
return 0; INT numFound = 0;
lastStatus = DllExports::GdipGetFontCollectionFamilyCount(nativeFontCollection, &numFound);
return numFound;
} }
Status 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: private:
GpFontCollection *fontCollection; // FontCollection is not copyable
FontCollection(const FontCollection &);
FontCollection &
operator=(const FontCollection &);
}; };
class FontFamily : public GdiplusBase class FontFamily : public GdiplusBase
@ -687,8 +708,8 @@ class FontFamily : public GdiplusBase
FontFamily(const WCHAR *name, const FontCollection *fontCollection) FontFamily(const WCHAR *name, const FontCollection *fontCollection)
{ {
status = DllExports::GdipCreateFontFamilyFromName( GpFontCollection *theCollection = fontCollection ? fontCollection->nativeFontCollection : NULL;
name, fontCollection ? fontCollection->fontCollection : NULL, &fontFamily); status = DllExports::GdipCreateFontFamilyFromName(name, theCollection, &fontFamily);
} }
FontFamily * FontFamily *
@ -809,18 +830,25 @@ class PrivateFontCollection : public FontCollection
public: public:
PrivateFontCollection() PrivateFontCollection()
{ {
nativeFontCollection = NULL;
lastStatus = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection);
}
virtual ~PrivateFontCollection()
{
DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection);
} }
Status Status
AddFontFile(const WCHAR *filename) AddFontFile(const WCHAR *filename)
{ {
return NotImplemented; return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename));
} }
Status Status
AddMemoryFont(const VOID *memory, INT length) AddMemoryFont(const VOID *memory, INT length)
{ {
return NotImplemented; return SetStatus(DllExports::GdipPrivateAddMemoryFont(nativeFontCollection, memory, length));
} }
}; };