[Libreoffice-commits] core.git: 3 commits - config_host/config_harfbuzz.h.in configure.ac vcl/generic vcl/inc vcl/source
Khaled Hosny
khaledhosny at eglug.org
Mon May 6 08:26:29 PDT 2013
config_host/config_harfbuzz.h.in | 6 ------
configure.ac | 9 +--------
vcl/generic/glyphs/gcach_ftyp.cxx | 2 --
vcl/generic/glyphs/gcach_layout.cxx | 29 ++++-------------------------
vcl/inc/generic/glyphcache.hxx | 8 --------
vcl/inc/sallayout.hxx | 11 +++++++++++
vcl/source/gdi/sallayout.cxx | 2 +-
7 files changed, 17 insertions(+), 50 deletions(-)
New commits:
commit bff8fa97e16f0f06fddc5545ea36c8bd2b18a580
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Mon May 6 11:08:29 2013 +0200
Enable HarfBuzz by default
HarfBuzz integration should be functional now, so to give it more wider
testing it is made now a required dependency on non-Windows non-Mac OSs.
By default text layout is now done by HarfBuzz but ICU LayoutEngine is
kept as a fallback and can be enabled with SAL_USE_ICULE env variable.
After 4.1.x is branched, ICU LayoutEngine should be removed completely.
Change-Id: I4fe3beeaf6092f33dd436906c11b83aeafdfbd5d
diff --git a/config_host/config_harfbuzz.h.in b/config_host/config_harfbuzz.h.in
deleted file mode 100644
index b408f52..0000000
--- a/config_host/config_harfbuzz.h.in
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef CONFIG_HARFBUZZ_H
-#define CONFIG_HARFBUZZ_H
-
-#define ENABLE_HARFBUZZ 0
-
-#endif
diff --git a/configure.ac b/configure.ac
index 75e26bd..cda53d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -720,11 +720,6 @@ AC_ARG_ENABLE(graphite,
[Enables the compilation of Graphite smart font rendering.])
)
-AC_ARG_ENABLE(harfbuzz,
- AS_HELP_STRING([--enable-harfbuzz],
- [Determines whether to use HarfBuzz text layout engine.])
-)
-
AC_ARG_ENABLE(fetch-external,
AS_HELP_STRING([--disable-fetch-external],
[Disables fetching external tarballs from web sources.])
@@ -8482,10 +8477,9 @@ dnl ===================================================================
dnl HarfBuzz
dnl ===================================================================
AC_MSG_CHECKING([whether to enable HarfBuzz support])
-if test "$_os" != "WINNT" -a "$_os" != "Darwin" && test "$enable_harfbuzz" = "" -o "$enable_harfbuzz" != "no"; then
+if test "$_os" != "WINNT" -a "$_os" != "Darwin"; then
AC_MSG_RESULT([yes])
ENABLE_HARFBUZZ="TRUE"
- AC_DEFINE(ENABLE_HARFBUZZ)
libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10])
else
AC_MSG_RESULT([no])
@@ -11978,7 +11972,6 @@ AC_CONFIG_HEADERS([config_host/config_clang.h])
AC_CONFIG_HEADERS([config_host/config_features.h])
AC_CONFIG_HEADERS([config_host/config_global.h])
AC_CONFIG_HEADERS([config_host/config_graphite.h])
-AC_CONFIG_HEADERS([config_host/config_harfbuzz.h])
AC_CONFIG_HEADERS([config_host/config_lgpl.h])
AC_CONFIG_HEADERS([config_host/config_kde4.h])
AC_CONFIG_HEADERS([config_host/config_mingw.h])
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 935a0e5..7df803f 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <config_harfbuzz.h>
#include <gcach_ftyp.hxx>
#include <sallayout.hxx>
#include <salgdi.hxx>
@@ -31,10 +30,9 @@
#include <sal/alloca.h>
#include <rtl/instance.hxx>
-#if ENABLE_HARFBUZZ
#include <harfbuzz/hb-icu.h>
#include <harfbuzz/hb-ot.h>
-#endif
+
#include <layout/LayoutEngine.h>
#include <layout/LEFontInstance.h>
#include <layout/LELanguages.h>
@@ -50,10 +48,7 @@
ServerFontLayout::ServerFontLayout( ServerFont& rFont )
: mrServerFont( rFont )
{
- bUseHarfBuzz = false;
-#if ENABLE_HARFBUZZ
- bUseHarfBuzz = (getenv("SAL_USE_HARFBUZZ") != NULL);
-#endif
+ bUseHarfBuzz = (getenv("SAL_USE_ICULE") == NULL);
}
void ServerFontLayout::DrawText( SalGraphics& rSalGraphics ) const
@@ -208,7 +203,6 @@ static bool needNextCode(sal_Unicode cChar)
return lcl_CharIsJoiner(cChar) || U16_IS_TRAIL(cChar);
}
-#if ENABLE_HARFBUZZ
static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)
{
char pTagName[5];
@@ -537,7 +531,6 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
return true;
}
-#endif // ENABLE_HARFBUZZ
// =======================================================================
// bridge to ICU LayoutEngine
@@ -1214,12 +1207,10 @@ ServerFontLayoutEngine* ServerFont::GetLayoutEngine(bool bUseHarfBuzz)
{
// find best layout engine for font, platform, script and language
if (!mpLayoutEngine) {
-#if ENABLE_HARFBUZZ
if (bUseHarfBuzz)
mpLayoutEngine = new HbLayoutEngine(*this);
else
-#endif
- mpLayoutEngine = new IcuLayoutEngine(*this);
+ mpLayoutEngine = new IcuLayoutEngine(*this);
}
return mpLayoutEngine;
}
commit f0393d7ff69011a16b100541ef18e5090544e4a1
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Mon May 6 16:54:53 2013 +0200
[harfbuzz] Fix text width calculation, 3rd try
It turns out storing the width in the layout is not so good idea,
because in some mysterious cases when font fallback is involved we call
GetTextWidth() without calling LayoutText() first, and we return the
width of the previous text run.
It seems all I needed is to pass down the X offset with the glyph item,
and take it into account when calculating the width.
Change-Id: Idbdb6bba00573fb6ca773701757d667e21ac0912
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index cb6c195..935a0e5 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -72,17 +72,6 @@ bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs )
}
// -----------------------------------------------------------------------
-long ServerFontLayout::GetTextWidth() const
-{
- long nWidth;
- if (bUseHarfBuzz)
- nWidth = GetWidth();
- else
- nWidth = GenericSalLayout::GetTextWidth();
-
- return nWidth;
-}
-
void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
GenericSalLayout::AdjustLayout( rArgs );
@@ -524,7 +513,7 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
int32_t nYAdvance = pHbPositions[i].y_advance >> 6;
Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset));
- const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance);
+ const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance, nXOffset);
rLayout.AppendGlyph(aGI);
aCurrPos.X() += nXAdvance;
@@ -533,7 +522,6 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
hb_buffer_destroy(pHbBuffer);
}
- rLayout.SetWidth(aCurrPos.X());
hb_font_destroy(pHbFont);
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 5345360..e03e034 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -317,7 +317,6 @@ private:
SAL_DLLPRIVATE ServerFontLayout& operator=( const ServerFontLayout& );
bool bUseHarfBuzz;
- long mnTextWidth;
public:
ServerFontLayout( ServerFont& );
@@ -325,12 +324,7 @@ public:
virtual void AdjustLayout( ImplLayoutArgs& );
virtual void ApplyDXArray( ImplLayoutArgs& );
virtual void DrawText( SalGraphics& ) const;
- virtual long GetTextWidth() const;
ServerFont& GetServerFont() const { return mrServerFont; }
-
- // used by layout engine
- void SetWidth( long nWidth ) { mnTextWidth = nWidth; }
- long GetWidth() const { return mnTextWidth; }
};
// =======================================================================
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 5d99acb..6b25f5b 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -310,6 +310,7 @@ struct GlyphItem
int mnCharPos; // index in string
int mnOrigWidth; // original glyph width
int mnNewWidth; // width after adjustments
+ int mnXOffset;
sal_GlyphId mnGlyphIndex;
Point maLinearPos; // absolute position of non rotated string
@@ -320,9 +321,19 @@ public:
long nFlags, int nOrigWidth )
: mnFlags(nFlags), mnCharPos(nCharPos),
mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth),
+ mnXOffset(0),
mnGlyphIndex(nGlyphIndex), maLinearPos(rLinearPos)
{}
+ GlyphItem( int nCharPos, sal_GlyphId nGlyphIndex, const Point& rLinearPos,
+ long nFlags, int nOrigWidth, int nXOffset )
+ : mnFlags(nFlags), mnCharPos(nCharPos),
+ mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth),
+ mnXOffset(nXOffset),
+ mnGlyphIndex(nGlyphIndex), maLinearPos(rLinearPos)
+ {}
+
+
enum{ FALLBACK_MASK=0xFF, IS_IN_CLUSTER=0x100, IS_RTL_GLYPH=0x200, IS_DIACRITIC=0x400 };
bool IsClusterStart() const { return ((mnFlags & IS_IN_CLUSTER) == 0); }
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index e90f782..6955679 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -996,7 +996,7 @@ long GenericSalLayout::GetTextWidth() const
long nXPos = pG->maLinearPos.X();
if( nMinPos > nXPos )
nMinPos = nXPos;
- nXPos += pG->mnNewWidth;
+ nXPos += pG->mnNewWidth - pG->mnXOffset;
if( nMaxPos < nXPos )
nMaxPos = nXPos;
}
commit 64fc186bb9cbb6af43d73149e9e593c48fbb0f22
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Mon May 6 14:50:16 2013 +0200
Remove unused variables
Change-Id: I7881af8907c0735e4d8e8c327103c8d8488ec496
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index c1d6ddb..a839cc5 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -660,8 +660,6 @@ ServerFont::ServerFont( const FontSelectPattern& rFSD, FtFontInfo* pFI )
mpNextGCFont( NULL ),
mnCos( 0x10000),
mnSin( 0 ),
- mnZWJ( 0 ),
- mnZWNJ( 0 ),
mbCollectedZW( false ),
mnPrioEmbedded(nDefaultPrioEmbedded),
mnPrioAntiAlias(nDefaultPrioAntiAlias),
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index a7e52d9..5345360 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -262,8 +262,6 @@ private:
long mnCos;
long mnSin;
- int mnZWJ;
- int mnZWNJ;
bool mbCollectedZW;
int mnWidth;
More information about the Libreoffice-commits
mailing list