[PATCH] Allow switching between HarfBuzz and LE at runtime
Khaled Hosny (via Code Review)
gerrit at gerrit.libreoffice.org
Sun Apr 21 01:20:00 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3521
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/21/3521/1
Allow switching between HarfBuzz and LE at runtime
Using the env variable SAL_USE_HARFBUZZ.
Change-Id: If83d4e0e6b9e9a06481840661d51fff6af35b3ae
---
M vcl/generic/glyphs/gcach_layout.cxx
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 1848ab0..032a396 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -35,12 +35,11 @@
#include <hb-ft.h>
#include <hb-icu.h>
#include <hb-ot.h>
-#else
+#endif // ENABLE_HARFBUZZ
#include <layout/LayoutEngine.h>
#include <layout/LEFontInstance.h>
#include <layout/LELanguages.h>
#include <layout/LEScripts.h>
-#endif // ENABLE_HARFBUZZ
#include <unicode/uscript.h>
#include <unicode/ubidi.h>
@@ -110,7 +109,6 @@
return lcl_CharIsJoiner(cChar) || U16_IS_TRAIL(cChar);
}
-#if ENABLE_HARFBUZZ
class HbLayoutEngine : public ServerFontLayoutEngine
{
private:
@@ -132,6 +130,7 @@
ServerFont& rFont = rLayout.GetServerFont();
FT_Face aFace = rFont.GetFtFace();
+#if ENABLE_HARFBUZZ
// allocate temporary arrays, note: round to even
int nGlyphCapacity = (3 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos) | 15) + 1;
@@ -263,10 +262,10 @@
if((rArgs.mpDXArray || rArgs.mnLayoutWidth)
&& ((meScriptCode == USCRIPT_ARABIC) || (meScriptCode == USCRIPT_SYRIAC)))
rArgs.mnFlags |= SAL_LAYOUT_KASHIDA_JUSTIFICATON;
+#endif // ENABLE_HARFBUZZ
return true;
}
-#else
// =======================================================================
// bridge to ICU LayoutEngine
// =======================================================================
@@ -929,19 +928,21 @@
return true;
}
-#endif // ENABLE_HARFBUZZ
// =======================================================================
ServerFontLayoutEngine* ServerFont::GetLayoutEngine()
{
+ const char* pUseHarfBuzz = getenv( "SAL_USE_HARFBUZZ" );
// find best layout engine for font, platform, script and language
- if (!mpLayoutEngine)
+ if (!mpLayoutEngine) {
#if ENABLE_HARFBUZZ
- mpLayoutEngine = new HbLayoutEngine(*this);
-#else
- mpLayoutEngine = new IcuLayoutEngine(*this);
+ if (pUseHarfBuzz)
+ mpLayoutEngine = new HbLayoutEngine(*this);
+ else
#endif // ENABLE_HARFBUZZ
+ mpLayoutEngine = new IcuLayoutEngine(*this);
+ }
return mpLayoutEngine;
}
--
To view, visit https://gerrit.libreoffice.org/3521
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If83d4e0e6b9e9a06481840661d51fff6af35b3ae
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Khaled Hosny <khaledhosny at eglug.org>
More information about the LibreOffice
mailing list