"Migrated" dwrite.cpp back. Not much to say here; it'll do for now.
This commit is contained in:
parent
1d1b6c3162
commit
8352cd72b8
|
@ -1,14 +1 @@
|
||||||
// dwrite.cpp
|
|
||||||
extern IDWriteFactory *dwfactory;
|
|
||||||
extern HRESULT initDrawText(void);
|
|
||||||
extern void uninitDrawText(void);
|
|
||||||
struct fontCollection {
|
|
||||||
IDWriteFontCollection *fonts;
|
|
||||||
WCHAR userLocale[LOCALE_NAME_MAX_LENGTH];
|
|
||||||
int userLocaleSuccess;
|
|
||||||
};
|
|
||||||
extern fontCollection *loadFontCollection(void);
|
|
||||||
extern WCHAR *fontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *family);
|
|
||||||
extern void fontCollectionFree(fontCollection *fc);
|
|
||||||
extern WCHAR *fontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names);
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,20 @@ extern "C" {
|
||||||
#include "../common/attrstr.h"
|
#include "../common/attrstr.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dwrite.cpp
|
||||||
|
extern IDWriteFactory *dwfactory;
|
||||||
|
extern HRESULT uiprivInitDrawText(void);
|
||||||
|
extern void uiprivUninitDrawText(void);
|
||||||
|
struct fontCollection {
|
||||||
|
IDWriteFontCollection *fonts;
|
||||||
|
WCHAR userLocale[LOCALE_NAME_MAX_LENGTH];
|
||||||
|
int userLocaleSuccess;
|
||||||
|
};
|
||||||
|
extern fontCollection *uiprivLoadFontCollection(void);
|
||||||
|
extern WCHAR *uiprivFontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *family);
|
||||||
|
extern void uiprivFontCollectionFree(fontCollection *fc);
|
||||||
|
extern WCHAR *uiprivFontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names);
|
||||||
|
|
||||||
// opentype.cpp
|
// opentype.cpp
|
||||||
extern IDWriteTypography *uiprivOpenTypeFeaturesToIDWriteTypography(const uiOpenTypeFeatures *otf);
|
extern IDWriteTypography *uiprivOpenTypeFeaturesToIDWriteTypography(const uiOpenTypeFeatures *otf);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// 14 april 2016
|
// 14 april 2016
|
||||||
#include "uipriv_windows.hpp"
|
#include "uipriv_windows.hpp"
|
||||||
// TODO really migrate? (TODO what did I mean by this?)
|
#include "attrstr.hpp"
|
||||||
|
|
||||||
IDWriteFactory *dwfactory = NULL;
|
IDWriteFactory *dwfactory = NULL;
|
||||||
|
|
||||||
HRESULT initDrawText(void)
|
// TOOD rename to something else, maybe
|
||||||
|
HRESULT uiprivInitDrawText(void)
|
||||||
{
|
{
|
||||||
// TOOD use DWRITE_FACTORY_TYPE_ISOLATED instead?
|
// TOOD use DWRITE_FACTORY_TYPE_ISOLATED instead?
|
||||||
return DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
|
return DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
|
||||||
|
@ -12,17 +13,17 @@ HRESULT initDrawText(void)
|
||||||
(IUnknown **) (&dwfactory));
|
(IUnknown **) (&dwfactory));
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitDrawText(void)
|
void uiprivUninitDrawText(void)
|
||||||
{
|
{
|
||||||
dwfactory->Release();
|
dwfactory->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
fontCollection *loadFontCollection(void)
|
fontCollection *uiprivLoadFontCollection(void)
|
||||||
{
|
{
|
||||||
fontCollection *fc;
|
fontCollection *fc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
fc = uiNew(fontCollection);
|
fc = uiprivNew(fontCollection);
|
||||||
// always get the latest available font information
|
// always get the latest available font information
|
||||||
hr = dwfactory->GetSystemFontCollection(&(fc->fonts), TRUE);
|
hr = dwfactory->GetSystemFontCollection(&(fc->fonts), TRUE);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
|
@ -31,7 +32,13 @@ fontCollection *loadFontCollection(void)
|
||||||
return fc;
|
return fc;
|
||||||
}
|
}
|
||||||
|
|
||||||
WCHAR *fontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *family)
|
void uiprivFontCollectionFree(fontCollection *fc)
|
||||||
|
{
|
||||||
|
fc->fonts->Release();
|
||||||
|
uiprivFree(fc);
|
||||||
|
}
|
||||||
|
|
||||||
|
WCHAR *uiprivFontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *family)
|
||||||
{
|
{
|
||||||
IDWriteLocalizedStrings *names;
|
IDWriteLocalizedStrings *names;
|
||||||
WCHAR *str;
|
WCHAR *str;
|
||||||
|
@ -45,7 +52,7 @@ WCHAR *fontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *family)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
WCHAR *fontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names)
|
WCHAR *uiprivFontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names)
|
||||||
{
|
{
|
||||||
UINT32 index;
|
UINT32 index;
|
||||||
BOOL exists;
|
BOOL exists;
|
||||||
|
@ -81,9 +88,3 @@ WCHAR *fontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *
|
||||||
|
|
||||||
return wname;
|
return wname;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fontCollectionFree(fontCollection *fc)
|
|
||||||
{
|
|
||||||
fc->fonts->Release();
|
|
||||||
uiFree(fc);
|
|
||||||
}
|
|
Loading…
Reference in New Issue