From f6ffba634bb33d6d4b051abce9c23fcae280c3fe Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 9 Dec 2015 14:57:15 +0800 Subject: [PATCH] MSVC builds: Add support to build DirectWrite shaping backend Add into the NMake Makefiles to build the DirectWrite shaping backend, but as PR #134 mentions, this is considered to be in an experimental state, so don't include this in the build by default for now. This is most probably going to replace the Uniscribe backend eventually, since DirectWrite is meant to be Uniscribe's replacement, and is needed for Windows Store apps if a system shaping API is to be used. --- win32/README.txt | 4 ++++ win32/config-msvc.mak | 10 ++++++++++ win32/config.h.win32.in | 3 +++ win32/info-msvc.mak | 7 +++++++ 4 files changed, 24 insertions(+) diff --git a/win32/README.txt b/win32/README.txt index 1cb965c3d..e2ead01d0 100644 --- a/win32/README.txt +++ b/win32/README.txt @@ -68,6 +68,10 @@ ICU: Enables the build HarfBuzz-ICU, which is now the recommended layout engine for ICU (International Components for Unicode), which deprecated ICU LE. Requires the ICU libraries. +DIRECTWRITE: Enable (experimental) DirectWrite platform shaper support, + requires a rather recent Windows SDK, and at least Windows Vista/ + Server 2008 with SP2 and platform update. + PYTHON: Full path to the Python interpretor to be used, if it is not in %PATH%. PERL: Full path to the PERL interpretor to be used, if it is not in %PATH%. diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak index 70f4c1b4e..e0c6468e3 100644 --- a/win32/config-msvc.mak +++ b/win32/config-msvc.mak @@ -20,6 +20,9 @@ CAIRO_LIB = cairo.lib # Graphite2 is needed for building SIL Graphite2 support GRAPHITE2_LIB = graphite2.lib +# Directwrite is needed for DirectWrite shaping support +DIRECTWRITE_LIB = dwrite.lib + # Please do not change anything beneath this line unless maintaining the NMake Makefiles # Bare minimum features and sources built into HarfBuzz on Windows HB_DEFINES = @@ -185,4 +188,11 @@ HB_CFLAGS = \ HB_SOURCES = $(HB_SOURCES) $(LIBHB_UCDN_sources) $(HB_UCDN_sources) !endif +!if "$(DIRECTWRITE)" == "1" +HB_CFLAGS = $(HB_CFLAGS) /DHAVE_DIRECTWRITE +HB_SOURCES = $(HB_SOURCES) $(HB_DIRECTWRITE_sources) +HB_HEADERS = $(HB_HEADERS) $(HB_DIRECTWRITE_headers) +HB_DEP_LIBS = $(HB_DEP_LIBS) $(DIRECTWRITE_LIB) +!endif + HB_LIB_CFLAGS = $(HB_CFLAGS) /DHB_EXTERN="__declspec (dllexport) extern" diff --git a/win32/config.h.win32.in b/win32/config.h.win32.in index 4f42b83ea..73ad205d5 100644 --- a/win32/config.h.win32.in +++ b/win32/config.h.win32.in @@ -18,6 +18,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_DLFCN_H */ +/* Have DirectWrite Library */ +/* #undef HAVE_DIRECTWRITE */ + /* Have simple TrueType Layout backend */ #define HAVE_FALLBACK 1 diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak index c009639b7..bc85dc9c9 100644 --- a/win32/info-msvc.mak +++ b/win32/info-msvc.mak @@ -23,6 +23,10 @@ INC_FEATURES = $(INC_FEATURES) FreeType INC_FEATURES = $(INC_FEATURES) Graphite2 !endif +!if "$(DIRECTWRITE)" == "1" +INC_FEATURES = $(INC_FEATURES) DirectWrite +!endif + !if "$(ICU)" == "1" BUILT_LIBRARIES = $(BUILT_LIBRARIES) HarfBuzz-ICU !endif @@ -76,6 +80,9 @@ help: @echo HarfBuzz DLL is built with OpenType, fallback and Uniscribe support @echo with a bundled Unicode implementation (UCDN). @echo ====== + @echo DIRECTWRITE: + @echo Enable DirectWrite support, requires a recent enough Windows SDK. + @echo. @echo GRAPHITE2: @echo Enable graphite2 support, requires the SIL Graphite2 library @echo.