[dwrite] Use new again and enable the build on msys2 bots (#890)
diff --git a/appveyor.yml b/appveyor.yml
index 5971337..b685720 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -20,11 +20,11 @@
- compiler: msys2
- MINGW_PREFIX: /c/msys2/mingw64/
+ MINGW_PREFIX: /mingw64
MINGW_CHOST: x86_64-w64-mingw32
MSYS2_ARCH: x86_64
- compiler: msys2
- MINGW_PREFIX: /c/msys2/mingw32/
+ MINGW_PREFIX: /mingw32
MINGW_CHOST: i686-w64-mingw32
MSYS2_ARCH: i686
@@ -44,7 +44,8 @@
- 'if "%compiler%"=="msvc" if not "%platform%"=="ARM" ctest --output-on-failure -C %configuration%'
- 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config,python2}"'
- - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || .ci/fail.sh"'
+ - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "curl https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/dwrite_1.h?format=raw > %MINGW_PREFIX%/%MINGW_CHOST%/include/dwrite_1.h"'
+ - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --with-directwrite --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || .ci/fail.sh"'
cache:
- c:\tools\vcpkg\installed\
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 40e9e39..0d3b1c2 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -48,7 +48,7 @@
private:
IDWriteFontFileStream *mFontFileStream;
public:
- void init (IDWriteFontFileStream *fontFileStream)
+ DWriteFontFileLoader (IDWriteFontFileStream *fontFileStream)
{
mFontFileStream = fontFileStream;
}
@@ -74,7 +74,7 @@
uint8_t *mData;
uint32_t mSize;
public:
- void init (uint8_t *aData, uint32_t aSize)
+ DWriteFontFileStream (uint8_t *aData, uint32_t aSize)
{
mData = aData;
mSize = aSize;
@@ -151,14 +151,11 @@
HRESULT hr;
hb_blob_t *blob = hb_face_reference_blob (face);
- DWriteFontFileStream *fontFileStream = (DWriteFontFileStream*)
- malloc (sizeof (DWriteFontFileStream));
- fontFileStream->init ((uint8_t*) hb_blob_get_data (blob, nullptr),
+ DWriteFontFileStream *fontFileStream = new DWriteFontFileStream (
+ (uint8_t *) hb_blob_get_data (blob, nullptr),
hb_blob_get_length (blob));
- DWriteFontFileLoader *fontFileLoader = (DWriteFontFileLoader*)
- malloc (sizeof (DWriteFontFileLoader));
- fontFileLoader->init (fontFileStream);
+ DWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream);
dwriteFactory->RegisterFontFileLoader (fontFileLoader);
IDWriteFontFile *fontFile;
@@ -216,9 +213,9 @@
data->dwriteFactory->Release ();
}
if (data->fontFileLoader)
- free (data->fontFileLoader);
+ delete data->fontFileLoader;
if (data->fontFileStream)
- free (data->fontFileStream);
+ delete data->fontFileStream;
if (data->faceBlob)
hb_blob_destroy (data->faceBlob);
if (data)
@@ -924,7 +921,7 @@
unsigned int num_features,
float width)
{
- static char *shapers = (char *) "directwrite";
+ static const char *shapers = "directwrite";
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face,
&buffer->props, features, num_features, &shapers);
hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer,