Ticket #13377: fontconfig-20190126a.patch
| File fontconfig-20190126a.patch, 6.2 KB (added by , 8 years ago) |
|---|
-
android/android-package-source/src/org/qtproject/qt5/android/bindings/QtActivity.java
diff --git a/android/android-package-source/src/org/qtproject/qt5/android/bindings/QtActivity.java b/android/android-package-source/src/org/qtproject/qt5/android/bindings/QtActivity.java index a0cd407e..a1572256 100644
a b import android.app.Dialog; 41 41 import android.app.Fragment; 42 42 import android.content.Context; 43 43 import android.content.Intent; 44 import android.content.res.AssetManager; 44 45 import android.content.res.Configuration; 45 46 import android.content.res.Resources.Theme; 46 47 import android.graphics.Bitmap; … … import android.graphics.Canvas; 48 49 import android.os.Build; 49 50 import android.os.Bundle; 50 51 import android.util.AttributeSet; 52 import android.util.Log; 51 53 import android.view.ActionMode; 52 54 import android.view.ActionMode.Callback; 53 55 import android.view.ContextMenu; … … import android.view.MotionEvent; 59 61 import android.view.View; 60 62 import android.view.WindowManager.LayoutParams; 61 63 import android.view.accessibility.AccessibilityEvent; 64 import org.qtproject.qt5.android.bindings.MD5; 65 import java.io.FileOutputStream; 66 import java.io.IOException; 67 import java.io.InputStream; 68 import java.io.OutputStream; 69 import java.io.File; 62 70 63 71 64 72 public class QtActivity extends Activity … … public class QtActivity extends Activity 294 302 } 295 303 */ 296 304 View decorView = getWindow().getDecorView(); 297 int uiOptions = 305 int uiOptions = 298 306 View.SYSTEM_UI_FLAG_LAYOUT_STABLE 299 307 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 300 308 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; … … public class QtActivity extends Activity 335 343 @Override 336 344 public void onCreate(Bundle savedInstanceState) 337 345 { 346 copyFontConfig(); 347 338 348 super.onCreate(savedInstanceState); 339 349 onCreateHook(savedInstanceState); 340 350 hideSystemUI(); … … public class QtActivity extends Activity 1116 1126 } 1117 1127 } ); 1118 1128 } 1129 1130 private static String TAG1 = "mfeCP"; 1131 private void copyFontConfig() { 1132 Log.e(TAG1, "copyFontConfig"); 1133 String toPath = "/data/data/" + getPackageName(); // The application path 1134 Log.e(TAG1, "basepath " + toPath); 1135 AssetManager assetManager = getAssets(); 1136 copyAssetIfDifferent(assetManager, "mythtv/fonts.conf", toPath + "/files/fonts.conf"); 1137 copyAssetFolder(assetManager, "mythtv/fonts", toPath + "/files/fonts"); 1138 } 1139 1140 private static boolean copyAssetFolder(AssetManager assetManager, 1141 String fromAssetPath, String toPath) { 1142 try { 1143 String[] files = assetManager.list(fromAssetPath); 1144 new File(toPath).mkdirs(); 1145 boolean res = true; 1146 for (String file : files) { 1147 Log.e(TAG1, "do file " + file); 1148 if (file.contains(".")) 1149 res &= copyAssetIfDifferent(assetManager, 1150 fromAssetPath + "/" + file, 1151 toPath + "/" + file); 1152 else 1153 res &= copyAssetFolder(assetManager, 1154 fromAssetPath + "/" + file, 1155 toPath + "/" + file); 1156 } 1157 return res; 1158 } catch (Exception e) { 1159 Log.e(TAG1, "Exception in copyAssetFolder", e); 1160 e.printStackTrace(); 1161 return false; 1162 } 1163 } 1164 1165 private static boolean copyAssetIfDifferent(AssetManager assetManager, String fromAssetPath, String toFilePath) { 1166 boolean same = false; 1167 try { 1168 Log.e(TAG1, "caif " + fromAssetPath + " " + toFilePath); 1169 InputStream assetStream = assetManager.open(fromAssetPath); 1170 same = MD5.compareMD5(assetStream, new File(toFilePath)); 1171 } catch (IOException e) { 1172 Log.e(TAG1, "Exception in copyAssetIfDifferent", e); 1173 } 1174 if (!same) { 1175 return copyAsset(assetManager, fromAssetPath, toFilePath); 1176 } 1177 return true; 1178 } 1179 1180 private static boolean copyAsset(AssetManager assetManager, 1181 String fromAssetPath, String toPath) { 1182 InputStream in = null; 1183 OutputStream out = null; 1184 try { 1185 Log.e(TAG1, "ca " + fromAssetPath + " " + toPath); 1186 in = assetManager.open(fromAssetPath); 1187 new File(toPath).createNewFile(); 1188 out = new FileOutputStream(toPath); 1189 copyFile(in, out); 1190 in.close(); 1191 in = null; 1192 out.flush(); 1193 out.close(); 1194 out = null; 1195 return true; 1196 } catch(Exception e) { 1197 Log.e(TAG1, "Exception in copyAsset", e); 1198 e.printStackTrace(); 1199 return false; 1200 } 1201 } 1202 1203 private static void copyFile(InputStream in, OutputStream out) throws IOException { 1204 byte[] buffer = new byte[1024]; 1205 int read; 1206 while((read = in.read(buffer)) != -1){ 1207 out.write(buffer, 0, read); 1208 } 1209 } 1210 1119 1211 } -
android/makelibs.sh
diff --git a/android/makelibs.sh b/android/makelibs.sh index d006679b..21e6bb34 100755
a b fi 1222 1222 #fi 1223 1223 #./autogen.sh && 1224 1224 PKG_CONFIG_PATH=$PKG_CONFIG_LIBDIR/pkgconfig \ 1225 CFLAGS="-isysroot $SYSROOT $CPUOPT $ANDROID_API_DEF " \1226 CXXFLAGS="-isysroot $SYSROOT $CPUOPT $ANDROID_API_DEF " \1227 LDFLAGS="-L$INSTALLROOT/lib -Wl,-rpath-link=$SYSROOT/usr/lib -Wl,-rpath-link=$INSTALLROOT/lib " \1225 CFLAGS="-isysroot $SYSROOT $CPUOPT $ANDROID_API_DEF -DFONTCONFIG_FILE=\\\"~/fonts.conf\\\"" \ 1226 CXXFLAGS="-isysroot $SYSROOT $CPUOPT $ANDROID_API_DEF -DFONTCONFIG_FILE=\\\"~/fonts.conf\\\"" \ 1227 LDFLAGS="-L$INSTALLROOT/lib -Wl,-rpath-link=$SYSROOT/usr/lib -Wl,-rpath-link=$INSTALLROOT/lib -llog" \ 1228 1228 RANLIB=${CROSSPATH2}ranlib \ 1229 1229 OBJDUMP=${CROSSPATH2}objdump \ 1230 1230 AR=${CROSSPATH2}ar \ … … CPP="$CROSSPATH/$MY_ANDROID_NDK_TOOLS_PREFIX-cpp" \ 1249 1249 PATH=$OPATH 1250 1250 unset OPATH 1251 1251 popd 1252 1253 # install our fonts.conf 1254 mkdir -p $INSTALLROOT/assets/mythtv 1255 cp $INSTALLROOT/../android-package-source/fonts.conf $INSTALLROOT/assets/mythtv 1256 1252 1257 return $ERR 1253 1258 } 1254 1259
