]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Added GNU free fonts for more consistent rendering on all devices.
authorThad Hughes <thad.hughes@gmail.com>
Tue, 6 Mar 2012 22:16:27 +0000 (14:16 -0800)
committerThad Hughes <thad.hughes@gmail.com>
Tue, 6 Mar 2012 22:16:27 +0000 (14:16 -0800)
assets/FreeSans.ttf [new file with mode: 0644]
assets/FreeSerif.ttf.jpg [new file with mode: 0644]
res/raw/whats_new.html
res/values/arrays.xml
res/values/strings.xml
res/xml/preferences.xml
src/com/hughes/android/dictionary/DictionaryActivity.java

diff --git a/assets/FreeSans.ttf b/assets/FreeSans.ttf
new file mode 100644 (file)
index 0000000..9db9585
Binary files /dev/null and b/assets/FreeSans.ttf differ
diff --git a/assets/FreeSerif.ttf.jpg b/assets/FreeSerif.ttf.jpg
new file mode 100644 (file)
index 0000000..b8906f5
Binary files /dev/null and b/assets/FreeSerif.ttf.jpg differ
index c45941a9c04566db44b3cb93ec9fba752015000e..5c52f8e289e106811392bb1743f1d30aaba82929 100644 (file)
@@ -9,12 +9,12 @@
 </head>
 <body>
 <!-- Don't use links in the text below, it crashes the app. -->
-Thanks for updating to QuickDic 3.1.1
+Thanks for updating to QuickDic 3.2
 <p>New features:</p>
 <ul>
-<li>Go straight to last-used dictionary on launch (bug-fix).</li>
-<li>Report issue menu item.</li>
-<li>Jump to random word.</li>
+<li>Default to embedded universal font (for better handling of non-Latin languages across all platforms).</li>
+<li>Fixed segmentation issues with accent marks (important for Thai, Arabic, Chinese).</li>
+<li>Fixed Irish/Gaelic dictionaries.</li>
 </ul>
 </body>
 </html>
index b9dc3455a182e06efabb7ec8cf1098595b56c7ec..0e4d6654829b94e9c46b8366a02f3dcbfe6f8061 100644 (file)
@@ -1,6 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
+  <string-array name="fontKeys">
+    <item>FreeSerif.ttf.jpg</item>
+    <item>FreeSans.ttf</item>
+    <item>SYSTEM</item>
+  </string-array>
+
+  <string-array name="fonts">
+    <item>FreeSerif</item>
+    <item>FreeSans</item>
+    <item>System default</item>
+    </string-array>
+    
   <string-array name="themeKeys">
     <item>themeLight</item>
     <item>themeDefault</item>
index 6d50a163725886dbca17ca0893f017710ee0c61d..bc7ecbeb6965ea735a43592662e48e8f3c296733 100644 (file)
        <string name="wordListFileSummary">The local file where the word list will be appended.</string>
        <string name="wordListFileDefault">/sdcard/quickDic/wordList.txt</string>
 
-  <string name="fontSizeKey">fontSize</string>
+  <string name="fontKey">font</string>
+  <string name="fontTitle">Dictionary font</string>
+  <string name="fontSummary">Font used to display dictionaries.</string>
+       <string name="fontSizeKey">fontSize</string>
   <string name="fontSizeTitle">Font size</string>
   <string name="fontSizeSummary">The size of the font for dictionary rows.</string>
 
index 23a7a03babc8de343a4e867189a567021464590f..4a6f57ebd88333ebcecb68114227de4d35e21b6c 100644 (file)
                android:defaultValue="@string/wordListFileDefault"\r
     android:persistent="true"\r
        />\r
-\r
\r
+   <ListPreference \r
+    android:key="@string/fontKey"\r
+    android:title="@string/fontTitle"\r
+    android:summary="@string/fontSummary"\r
+    android:persistent="true"\r
+    android:defaultValue="FreeSerif.ttf.jpg"\r
+    android:entries="@array/fonts"\r
+    android:entryValues="@array/fontKeys"\r
+  />\r
\r
   <EditTextPreference\r
     android:key="@string/fontSizeKey"\r
     android:title="@string/fontSizeTitle" \r
index eb907f8150ef02bf9ed4af80d4f6209b77af8918..052018a469a30325535da42a717e26662b10c302 100644 (file)
@@ -118,6 +118,7 @@ public class DictionaryActivity extends ListActivity {
   private SearchOperation currentSearchOperation = null;\r
 \r
   C.Theme theme = C.Theme.LIGHT;\r
+  Typeface typeface;\r
   int fontSizeSp;\r
   EditText searchText;\r
   Button langButton;\r
@@ -169,7 +170,10 @@ public class DictionaryActivity extends ListActivity {
   }\r
 \r
   @Override\r
-  public void onCreate(Bundle savedInstanceState) { \r
+  public void onCreate(Bundle savedInstanceState) {\r
+    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);\r
+    prefs.edit().remove(C.INDEX_INDEX).commit();  // Don't auto-launch if this fails.\r
+\r
     setTheme(((DictionaryApplication)getApplication()).getSelectedTheme().themeId);\r
 \r
     Log.d(LOG, "onCreate:" + this);\r
@@ -243,17 +247,26 @@ public class DictionaryActivity extends ListActivity {
       }\r
     }).start();\r
     \r
-    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);\r
-    \r
+    final String fontName = prefs.getString(getString(R.string.fontKey), "FreeSerif.ttf.jpg");\r
+    if ("SYSTEM".equals(fontName)) {\r
+      typeface = Typeface.DEFAULT;\r
+    } else {\r
+      typeface = Typeface.createFromAsset(getAssets(), fontName);\r
+    }\r
+    if (typeface == null) {\r
+      Log.w(LOG, "Unable to create typeface, using default.");\r
+      typeface = Typeface.DEFAULT;\r
+    }\r
     final String fontSize = prefs.getString(getString(R.string.fontSizeKey), "14");\r
     try {\r
       fontSizeSp = Integer.parseInt(fontSize.trim());\r
     } catch (NumberFormatException e) {\r
-      fontSizeSp = 12;\r
+      fontSizeSp = 14;\r
     }\r
 \r
     setContentView(R.layout.dictionary_activity);\r
     searchText = (EditText) findViewById(R.id.SearchText);\r
+    searchText.setTypeface(typeface);\r
     searchText.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSizeSp);\r
     \r
     langButton = (Button) findViewById(R.id.LangButton);\r
@@ -440,7 +453,7 @@ public class DictionaryActivity extends ListActivity {
           final Button button = new Button(parent.getContext());\r
           final String name = application.getDictionaryName(dictionaryInfo.uncompressedFilename);\r
           button.setText(name);\r
-          final IntentLauncher intentLauncher = new IntentLauncher(parent.getContext(), getLaunchIntent(application.getPath(dictionaryInfo.uncompressedFilename), 0, "")) {\r
+          final IntentLauncher intentLauncher = new IntentLauncher(parent.getContext(), getLaunchIntent(application.getPath(dictionaryInfo.uncompressedFilename), 0, searchText.getText().toString())) {\r
             @Override\r
             protected void onGo() {\r
               dialog.dismiss();\r
@@ -979,6 +992,8 @@ public class DictionaryActivity extends ListActivity {
         createTokenLinkSpans(col1, col1Spannable, col1Text);\r
         createTokenLinkSpans(col2, (Spannable) col2.getText(), col2Text);\r
         \r
+        col1.setTypeface(typeface);\r
+        col2.setTypeface(typeface);\r
         col1.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSizeSp);\r
         col2.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSizeSp);\r
         // col2.setBackgroundResource(theme.otherLangBg);\r
@@ -1018,6 +1033,7 @@ public class DictionaryActivity extends ListActivity {
       // Doesn't work:\r
       //textView.setTextColor(android.R.color.secondary_text_light);\r
       textView.setTextAppearance(context, theme.tokenRowFg);\r
+      textView.setTypeface(typeface);\r
       textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 5 * fontSizeSp / 4);\r
       \r
       final TableRow tableRow = new TableRow(result.getContext());\r