summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-02-21 21:11:47 +0200
committerTor Lillqvist <tml@iki.fi>2013-02-21 22:54:36 +0200
commitaeebcdf5bbf3fc1b91d9bc01a160f74952910fc4 (patch)
treeedfeb08bd1c340462bc5eb14a771f9480b52ac51 /vcl
parent8656ff7212e319cd96d799ee0f2f8bb156ad6d71 (diff)
Just link directly to the bundled static libfreetype on Android
The dlsym() crack found the system (but non-public) libfreetype symbols, and that seems to be incompatible and caused the app to crash. Change-Id: I9b0bcac098d7cb3560640de3dfc10f51569c462d
Diffstat (limited to 'vcl')
-rw-r--r--vcl/generic/glyphs/gcach_ftyp.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index de44e3154abc..1cb2d87c943f 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -53,6 +53,11 @@
#include FT_TRUETYPE_TAGS_H
#include FT_TRUETYPE_IDS_H
+#ifdef ANDROID
+#include FT_SIZES_H
+#include FT_SYNTHESIS_H
+#endif
+
#ifndef FT_RENDER_MODE_MONO // happens in the MACOSX build
#define FT_RENDER_MODE_MONO ft_render_mode_mono
#endif
@@ -126,8 +131,8 @@ static int nFTVERSION = 0;
static FT_Error (*pFTNewSize)(FT_Face,FT_Size*);
static FT_Error (*pFTActivateSize)(FT_Size);
static FT_Error (*pFTDoneSize)(FT_Size);
-FT_Error (*pFTEmbolden)(FT_GlyphSlot);
-FT_Error (*pFTOblique)(FT_GlyphSlot);
+void (*pFTEmbolden)(FT_GlyphSlot);
+void (*pFTOblique)(FT_GlyphSlot);
static bool bEnableSizeFT = false;
struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } };
@@ -481,6 +486,19 @@ FreetypeManager::FreetypeManager()
{
/*FT_Error rcFT =*/ FT_Init_FreeType( &aLibFT );
+#ifdef ANDROID
+ // For Android we use the bundled static libfreetype.a, and we
+ // want to avoid accidentally finding the FT_* symbols in the
+ // system FreeType code (which *is* present in a system library,
+ // libskia.so, but is not a public API, and in fact does crash the
+ // app if used).
+ pFTNewSize = FT_New_Size;
+ pFTActivateSize = FT_Activate_Size;
+ pFTDoneSize = FT_Done_Size;
+ pFTEmbolden = FT_GlyphSlot_Embolden;
+ pFTOblique = FT_GlyphSlot_Oblique;
+ nFTVERSION = FTVERSION;
+#else
#ifdef RTLD_DEFAULT // true if a good dlfcn.h header was included
// Get version of freetype library to enable workarounds.
// Freetype <= 2.0.9 does not have FT_Library_Version().
@@ -517,7 +535,7 @@ FreetypeManager::FreetypeManager()
// assume systems where dlsym is not possible use supplied library
nFTVERSION = FTVERSION;
#endif
-
+#endif
// TODO: remove when the priorities are selected by UI
char* pEnv;
pEnv = ::getenv( "SAL_EMBEDDED_BITMAP_PRIORITY" );