[Libreoffice-commits] core.git: Branch 'feature/commonsallayout' - 5 commits - config_host.mk.in configure.ac external/harfbuzz RepositoryExternal.mk vcl/CppunitTest_vcl_wmf_test.mk vcl/inc vcl/Library_vcl.mk vcl/source
Khaled Hosny
khaledhosny at eglug.org
Fri Sep 23 12:10:46 UTC 2016
Rebased ref, commits from common ancestor:
commit a201c28ab4222dc014e25ff968e40cc69cb55a67
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Sep 22 07:57:04 2016 -0700
Build HarfBuzz with Core Text on Mac
To enable support for AAT fonts.
Change-Id: Ifcc7d1672e98f8c067482400b7e45226bed4dbf1
diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk b/external/harfbuzz/ExternalProject_harfbuzz.mk
index f6a2d49..5e98f9e 100644
--- a/external/harfbuzz/ExternalProject_harfbuzz.mk
+++ b/external/harfbuzz/ExternalProject_harfbuzz.mk
@@ -35,6 +35,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) :
--with-cairo=no \
--with-glib=no \
--with-graphite2=yes \
+ $(if $(filter MACOSX,$(OS)),--with-coretext=yes) \
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
$(if $(filter LINUX,$(OS)),CXXFLAGS="$(CXXFLAGS) -fvisibility=hidden") \
commit cb0a7e8769f81dc318fa61d2b25325ef2722d7ab
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Sep 22 19:48:10 2016 +0200
Always pass BCP 47 tags to HarfBuzz
This is what it is expecting anyway, no need to special case it for
Chinese.
Change-Id: I6732412375d19816b599005d78abd796f67599ee
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 16400bc..38d6117 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -379,7 +379,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
aHbScript = it->maScript;
// hb_language_from_string() accept ISO639-3 language tag except for Chinese.
LanguageTag &rTag = rArgs.maLanguageTag;
- OString sLanguage = OUStringToOString( MsLangId::isChinese(rTag.getLanguageType()) ? rTag.getBcp47():rTag.getLanguage() , RTL_TEXTENCODING_UTF8 );
+ OString sLanguage = OUStringToOString(rTag.getBcp47(), RTL_TEXTENCODING_ASCII_US);
int nHbFlags = HB_BUFFER_FLAGS_DEFAULT;
if (nMinRunPos == 0)
commit 84f2c90d5fd3bb9758e2766a7949913fae600553
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Sep 22 19:45:23 2016 +0200
Always build Graphite everywhere
It is no longer an optional feature on any platform. The
--enable-graphite stuff is kept as it controls the old Graphite
integration code and it should be removed without.
Change-Id: Ib4d76bba782a1439f02f93411b22d237a1987ea5
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index e0f1337..64eeacf 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1357,8 +1357,6 @@ endef
endif # SYSTEM_FONTCONFIG
-ifeq ($(ENABLE_GRAPHITE),TRUE)
-
ifneq ($(SYSTEM_GRAPHITE),)
define gb_LinkTarget__use_graphite
@@ -1386,12 +1384,6 @@ endef
endif # SYSTEM_GRAPHITE
-else # !ENABLE_GRAPHITE
-
-gb_LinkTarget__use_graphite :=
-
-endif # ENABLE_GRAPHITE
-
ifneq ($(SYSTEM_ICU),)
gb_LinkTarget__use_icu_headers:=
diff --git a/configure.ac b/configure.ac
index be56b53..51a51d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9231,19 +9231,20 @@ AC_SUBST(ICU_LIBS)
dnl ===================================================================
dnl Graphite
dnl ===================================================================
+libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],["-I${WORKDIR}/UnpackedTarball/graphite/include"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
+if test "$with_system_graphite" = "yes"; then
+ libo_MINGW_CHECK_DLL([libgraphite2])
+fi
+if test "$COM" = "MSC"; then # override the above
+ GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
+fi
+# This is the old Graphite support that will eventually be removed
AC_MSG_CHECKING([whether to enable graphite support])
if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
AC_MSG_RESULT([yes])
ENABLE_GRAPHITE="TRUE"
AC_DEFINE(ENABLE_GRAPHITE)
- libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],["-I${WORKDIR}/UnpackedTarball/graphite/include"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
- if test "$with_system_graphite" = "yes"; then
- libo_MINGW_CHECK_DLL([libgraphite2])
- fi
- if test "$COM" = "MSC"; then # override the above
- GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
- fi
else
AC_MSG_RESULT([no])
@@ -9330,6 +9331,9 @@ if test "$COM" = "MSC"; then # override the above
HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
fi
if test "$with_system_harfbuzz" = "yes"; then
+ if test "$with_system_graphite" = "no"; then
+ AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
+ fi
AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
_save_libs="$LIBS"
_save_cflags="$CFLAGS"
@@ -9338,6 +9342,10 @@ if test "$with_system_harfbuzz" = "yes"; then
AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
LIBS="$_save_libs"
CFLAGS="$_save_cflags"
+else
+ if test "$with_system_graphite" = "yes"; then
+ AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
+ fi
fi
AC_MSG_CHECKING([whether to use X11])
diff --git a/vcl/CppunitTest_vcl_wmf_test.mk b/vcl/CppunitTest_vcl_wmf_test.mk
index 51e9126..1de86d8 100644
--- a/vcl/CppunitTest_vcl_wmf_test.mk
+++ b/vcl/CppunitTest_vcl_wmf_test.mk
@@ -80,6 +80,7 @@ endif
$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
gio \
+ graphite \
harfbuzz \
icuuc \
lcms2 \
@@ -90,10 +91,6 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
))
endif
-ifeq ($(ENABLE_GRAPHITE),TRUE)
-$(eval $(call gb_CppunitTest_use_external,vcl_wmf_test,graphite))
-endif
-
ifeq ($(OS),MACOSX)
$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,vcl_wmf_test,\
ApplicationServices \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 67bcbe5..2b0874a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -116,6 +116,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
boost_headers \
gio \
glm_headers \
+ graphite \
harfbuzz \
icu_headers \
icuuc \
@@ -434,8 +435,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
))
endif
-$(eval $(call gb_Library_use_external,vcl,graphite))
-
endif
vcl_quartz_code= \
commit 0f4f5364c8a37d5bc7ea315d167b51ea85138d89
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Sep 22 19:29:04 2016 +0200
Always build HarfBuzz everywhere
It is no longer an optional feature on any platform.
Change-Id: I70cdcd2c0df69d961ecc5f36b4e8d035d251ef16
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 95241ab..e0f1337 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1490,7 +1490,6 @@ endef
endif # SYSTEM_ICU
-ifeq ($(ENABLE_HARFBUZZ),TRUE)
ifneq ($(SYSTEM_HARFBUZZ),)
define gb_LinkTarget__use_harfbuzz
@@ -1515,11 +1514,6 @@ $(call gb_LinkTarget_use_external_project,$(1),harfbuzz)
endef
endif # SYSTEM_HARFBUZZ
-else # ENABLE_HARFBUZZ != YES
-
-gb_LinkTarget__use_harfbuzz :=
-
-endif # ENABLE_HARFBUZZ
ifeq ($(DISABLE_OPENSSL),TRUE)
diff --git a/config_host.mk.in b/config_host.mk.in
index 25b9609..c467a14 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -133,7 +133,6 @@ export ENABLE_FIREBIRD_SDBC=@ENABLE_FIREBIRD_SDBC@
export ENABLE_GIO=@ENABLE_GIO@
export ENABLE_GRAPHITE=@ENABLE_GRAPHITE@
export ENABLE_ORCUS=@ENABLE_ORCUS@
-export ENABLE_HARFBUZZ=@ENABLE_HARFBUZZ@
export ENABLE_GLTF=@ENABLE_GLTF@
export SYSTEM_LIBGLTF=@SYSTEM_LIBGLTF@
export LIBGLTF_CFLAGS=@LIBGLTF_CFLAGS@
diff --git a/configure.ac b/configure.ac
index 285a871..be56b53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2135,12 +2135,6 @@ AC_ARG_WITH(iwyu,
Use only if you are hacking on it.]),
,)
-AC_ARG_WITH(harfbuzz,
- AS_HELP_STRING([--with-harfbuzz],
- [Enable HarfBuzz support regardless of the platform.
- Experimental only. Use only if working on it.]),
-,)
-
dnl ===================================================================
dnl Branding
dnl ===================================================================
@@ -9331,32 +9325,20 @@ AC_SUBST(ENABLE_ORCUS)
dnl ===================================================================
dnl HarfBuzz
dnl ===================================================================
-AC_MSG_CHECKING([whether to enable HarfBuzz support])
-if test "$with_harfbuzz" = "yes" -o \( $_os != WINNT -a $_os != Darwin -a $_os != iOS \); then
- AC_MSG_RESULT([yes])
- ENABLE_HARFBUZZ="TRUE"
- if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
- libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
- else
- libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
- fi
- if test "$COM" = "MSC"; then # override the above
- HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
- fi
- if test "$with_system_harfbuzz" = "yes"; then
- AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
- _save_libs="$LIBS"
- _save_cflags="$CFLAGS"
- LIBS="$LIBS $HARFBUZZ_LIBS"
- CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
- AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
- LIBS="$_save_libs"
- CFLAGS="$_save_cflags"
- fi
-else
- AC_MSG_RESULT([no])
+libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
+if test "$COM" = "MSC"; then # override the above
+ HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
+fi
+if test "$with_system_harfbuzz" = "yes"; then
+ AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
+ _save_libs="$LIBS"
+ _save_cflags="$CFLAGS"
+ LIBS="$LIBS $HARFBUZZ_LIBS"
+ CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
+ AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
+ LIBS="$_save_libs"
+ CFLAGS="$_save_cflags"
fi
-AC_SUBST(ENABLE_HARFBUZZ)
AC_MSG_CHECKING([whether to use X11])
dnl ***************************************
commit 3983d52e80842eb88e8d815aa512bc9c9f56de82
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Sun Sep 11 10:25:46 2016 +0200
Override GetCharWidths and ApplyDXArray in CSL
A much simpler and saner implementation. This also unbreaks Awami
Nastaliq.
Break kashida justification, will need to rewrite that one as well.
Change-Id: I843679e937f2881e77df61f5cbd9516b6df1b3b6
diff --git a/vcl/inc/CommonSalLayout.hxx b/vcl/inc/CommonSalLayout.hxx
index 83de5c1..89214d4 100644
--- a/vcl/inc/CommonSalLayout.hxx
+++ b/vcl/inc/CommonSalLayout.hxx
@@ -65,4 +65,7 @@ public:
virtual bool LayoutText(ImplLayoutArgs&) override;
virtual void DrawText( SalGraphics& ) const override;
std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&) const override;
+
+ virtual bool GetCharWidths(DeviceCoordinate* pCharWidths) const override;
+ virtual void ApplyDXArray(ImplLayoutArgs&) override;
};
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index cfb2930..1050943 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -326,7 +326,7 @@ public:
void AppendGlyph( const GlyphItem& );
void Reserve(int size) { m_GlyphItems.reserve(size + 1); }
virtual void AdjustLayout( ImplLayoutArgs& ) override;
- void ApplyDXArray( ImplLayoutArgs& );
+ virtual void ApplyDXArray( ImplLayoutArgs& );
void Justify( DeviceCoordinate nNewWidth );
void KashidaJustify( long nIndex, int nWidth );
void ApplyAsianKerning(const OUString& rStr);
@@ -352,7 +352,7 @@ protected:
virtual void DropGlyph( int nStart ) override;
virtual void Simplify( bool bIsBase ) override;
- bool GetCharWidths( DeviceCoordinate* pCharWidths ) const;
+ virtual bool GetCharWidths( DeviceCoordinate* pCharWidths ) const;
std::vector<GlyphItem> m_GlyphItems;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 9c68bdb..16400bc 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -486,3 +486,53 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
return true;
}
+
+bool CommonSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
+{
+ int nCharCount = mnEndCharPos - mnMinCharPos;
+
+ for (int i = 0; i < nCharCount; ++i)
+ pCharWidths[i] = 0;
+
+ for (auto const& aGlyphItem : m_GlyphItems)
+ pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += aGlyphItem.mnNewWidth;
+
+ return true;
+}
+
+void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
+{
+ int nCharCount = mnEndCharPos - mnMinCharPos;
+ std::unique_ptr<DeviceCoordinate[]> const pOldCharWidths(new DeviceCoordinate[nCharCount]);
+ std::unique_ptr<DeviceCoordinate[]> const pNewCharWidths(new DeviceCoordinate[nCharCount]);
+
+ GetCharWidths(pOldCharWidths.get());
+
+ for (int i = 0; i < nCharCount; ++i)
+ {
+ if (i == 0)
+ pNewCharWidths[i] = rArgs.mpDXArray[i];
+ else
+ pNewCharWidths[i] = rArgs.mpDXArray[i] - rArgs.mpDXArray[i - 1];
+ }
+
+ DeviceCoordinate nDelta = 0;
+ size_t i = 0;
+ while (i < m_GlyphItems.size())
+ {
+ int nCharPos = m_GlyphItems[i].mnCharPos - mnMinCharPos;
+ DeviceCoordinate nDiff = pNewCharWidths[nCharPos] - pOldCharWidths[nCharPos];
+
+ m_GlyphItems[i].maLinearPos.X() += nDelta;
+ size_t j = i;
+ while (++j < m_GlyphItems.size())
+ {
+ if (m_GlyphItems[j].mnCharPos != m_GlyphItems[i].mnCharPos)
+ break;
+ m_GlyphItems[j].maLinearPos.X() += nDelta;
+ }
+
+ nDelta += nDiff;
+ i = j;
+ }
+}
More information about the Libreoffice-commits
mailing list