diff --git a/windows/OLD_uipriv_attrstr.h b/windows/OLD_uipriv_attrstr.h index 83c73b1f..8b137891 100644 --- a/windows/OLD_uipriv_attrstr.h +++ b/windows/OLD_uipriv_attrstr.h @@ -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); diff --git a/windows/attrstr.hpp b/windows/attrstr.hpp index df143613..449000ed 100644 --- a/windows/attrstr.hpp +++ b/windows/attrstr.hpp @@ -3,6 +3,20 @@ extern "C" { #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 extern IDWriteTypography *uiprivOpenTypeFeaturesToIDWriteTypography(const uiOpenTypeFeatures *otf); diff --git a/windows/OLD_dwrite.cpp b/windows/dwrite.cpp similarity index 84% rename from windows/OLD_dwrite.cpp rename to windows/dwrite.cpp index 498ef376..3aeedfdb 100644 --- a/windows/OLD_dwrite.cpp +++ b/windows/dwrite.cpp @@ -1,10 +1,11 @@ // 14 april 2016 #include "uipriv_windows.hpp" -// TODO really migrate? (TODO what did I mean by this?) +#include "attrstr.hpp" IDWriteFactory *dwfactory = NULL; -HRESULT initDrawText(void) +// TOOD rename to something else, maybe +HRESULT uiprivInitDrawText(void) { // TOOD use DWRITE_FACTORY_TYPE_ISOLATED instead? return DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, @@ -12,17 +13,17 @@ HRESULT initDrawText(void) (IUnknown **) (&dwfactory)); } -void uninitDrawText(void) +void uiprivUninitDrawText(void) { dwfactory->Release(); } -fontCollection *loadFontCollection(void) +fontCollection *uiprivLoadFontCollection(void) { fontCollection *fc; HRESULT hr; - fc = uiNew(fontCollection); + fc = uiprivNew(fontCollection); // always get the latest available font information hr = dwfactory->GetSystemFontCollection(&(fc->fonts), TRUE); if (hr != S_OK) @@ -31,7 +32,13 @@ fontCollection *loadFontCollection(void) 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; WCHAR *str; @@ -45,7 +52,7 @@ WCHAR *fontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *family) return str; } -WCHAR *fontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names) +WCHAR *uiprivFontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names) { UINT32 index; BOOL exists; @@ -81,9 +88,3 @@ WCHAR *fontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings * return wname; } - -void fontCollectionFree(fontCollection *fc) -{ - fc->fonts->Release(); - uiFree(fc); -}