summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-02-15 16:01:55 +0100
committerJan Holesovsky <kendy@collabora.com>2019-06-05 22:19:32 +0200
commit276c3910bd7bc5e5bacecd280db812519ac6e36c (patch)
tree1d2b8986a4e800b31ffc20cb8f3b4eb80360b9bd
parent0b2431e796b0a185a82b1dd6ea3cdd5003f15968 (diff)
android: Set the FONTCONFIG_FILE envvar to the fonts.conf (if exists).
Change-Id: Ic9fd97a2ff8a6d96ffcc7ad300ef30201d786528 Reviewed-on: https://gerrit.libreoffice.org/67876 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java13
-rw-r--r--sal/android/libreofficekit-jni.c15
2 files changed, 15 insertions, 13 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
index ce84b7409c1f..f6658d64806a 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java
@@ -67,19 +67,6 @@ public final class LibreOfficeKit
String cacheDir = activity.getApplication().getCacheDir().getAbsolutePath();
String apkFile = activity.getApplication().getPackageResourcePath();
- // If there is a fonts.conf file in the apk that can be extracted, automatically
- // set the FONTCONFIG_FILE env var.
- InputStream inputStream;
- try {
- inputStream = activity.getAssets().open("unpack/etc/fonts/fonts.conf");
- } catch (java.io.IOException exception) {
- inputStream = null;
- }
-
- if (inputStream != null) {
- putenv("FONTCONFIG_FILE=" + dataDir + "/etc/fonts/fonts.conf");
- }
-
if (!initializeNative(dataDir, cacheDir, apkFile, mgr)) {
Log.e(LOGTAG, "Initialize native failed!");
return;
diff --git a/sal/android/libreofficekit-jni.c b/sal/android/libreofficekit-jni.c
index abbf3edaed10..c11f7dd4eb09 100644
--- a/sal/android/libreofficekit-jni.c
+++ b/sal/android/libreofficekit-jni.c
@@ -74,6 +74,9 @@ jboolean libreofficekit_initialize(JNIEnv* env,
const char *cacheDirPath;
const char *apkFilePath;
+ const char *fontsConf = "/etc/fonts/fonts.conf";
+ char *fontsConfPath;
+
setenv("OOO_DISABLE_RECOVERY", "1", 1);
native_asset_manager = AAssetManager_fromJava(env, assetManager);
@@ -89,6 +92,18 @@ jboolean libreofficekit_initialize(JNIEnv* env,
// TMPDIR is used by osl_getTempDirURL()
setenv("TMPDIR", cache_dir, 1);
+ fontsConfPath = malloc(strlen(data_dir) + sizeof(fontsConf));
+ strcpy(fontsConfPath, data_dir);
+ strcat(fontsConfPath, fontsConf);
+
+ fd = open(fontsConfPath, O_RDONLY);
+ if (fd != -1) {
+ close(fd);
+ LOGI("Setting FONTCONFIG_FILE to %s", fontsConfPath);
+ setenv("FONTCONFIG_FILE", fontsConfPath, 1);
+ }
+ free(fontsConfPath);
+
apkFilePath = (*env)->GetStringUTFChars(env, apkFile, NULL);
fd = open(apkFilePath, O_RDONLY);