Added Liberation Sans Narrow

This commit is contained in:
M66B 2023-10-07 09:50:04 +02:00
parent 777de5b30c
commit 713e695b3f
12 changed files with 62 additions and 4 deletions

View File

@ -47,3 +47,4 @@ FairEmail uses:
* [MaterialDings](https://github.com/Accusoft/MaterialDings). Copyright (c) 2018 Accusoft Corporation. [MIT License](https://github.com/Accusoft/MaterialDings/blob/master/LICENSE.md).
* [Send](https://github.com/timvisee/send). [Mozilla Public License 2.0](https://github.com/timvisee/send/blob/master/LICENSE).
* [DetectHtml](https://github.com/dbennett455/DetectHtml). [The MIT License](https://github.com/dbennett455/DetectHtml/blob/master/LICENSE).
* [Liberation Sans Narrow font](https://github.com/liberationfonts/liberation-sans-narrow). Copyright (C) 1989, 1991 Free Software Foundation, Inc. [GNU General Public License version 2 with exceptions](https://fedoraproject.org/wiki/Licensing/LiberationFontLicense).

View File

@ -6,6 +6,12 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### [Vallibonavenatrix](https://en.wikipedia.org/wiki/Vallibonavenatrix)
### Next version
* Added [Liberation Sans Narrow](https://github.com/liberationfonts/liberation-sans-narrow) font (advanced display options)
* Small improvements and minor bug fixes
* Updated [translations](https://crowdin.com/project/open-source-email)
### 1.2107 - 2023-10-04
* Added rule action to execute webhooks

View File

@ -47,3 +47,4 @@ FairEmail uses:
* [MaterialDings](https://github.com/Accusoft/MaterialDings). Copyright (c) 2018 Accusoft Corporation. [MIT License](https://github.com/Accusoft/MaterialDings/blob/master/LICENSE.md).
* [Send](https://github.com/timvisee/send). [Mozilla Public License 2.0](https://github.com/timvisee/send/blob/master/LICENSE).
* [DetectHtml](https://github.com/dbennett455/DetectHtml). [The MIT License](https://github.com/dbennett455/DetectHtml/blob/master/LICENSE).
* [Liberation Sans Narrow font](https://github.com/liberationfonts/liberation-sans-narrow). Copyright (C) 1989, 1991 Free Software Foundation, Inc. [GNU General Public License version 2 with exceptions](https://fedoraproject.org/wiki/Licensing/LiberationFontLicense).

View File

@ -6,6 +6,12 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### [Vallibonavenatrix](https://en.wikipedia.org/wiki/Vallibonavenatrix)
### Next version
* Added [Liberation Sans Narrow](https://github.com/liberationfonts/liberation-sans-narrow) font (advanced display options)
* Small improvements and minor bug fixes
* Updated [translations](https://crowdin.com/project/open-source-email)
### 1.2107 - 2023-10-04
* Added rule action to execute webhooks

View File

@ -150,7 +150,7 @@ public class FragmentOptions extends FragmentBase {
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "align_header",
"message_zoom", "overview_mode", "addresses", "button_extra", "attachments_alt", "thumbnails",
"contrast", "hyphenation", "display_font", "monospaced_pre",
"list_count", "bundled_fonts", "parse_classes",
"list_count", "bundled_fonts", "narrow_fonts", "parse_classes",
"background_color", "text_color", "text_size", "text_font", "text_align", "text_titles", "text_separators",
"collapse_quotes", "image_placeholders", "inline_images",
"seekbar", "actionbar", "actionbar_swap", "actionbar_color", "group_category",

View File

@ -184,6 +184,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swListCount;
private SwitchCompat swBundledFonts;
private SwitchCompat swNarrowFonts;
private SwitchCompat swParseClasses;
private SwitchCompat swBackgroundColor;
private SwitchCompat swTextColor;
@ -220,7 +221,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"text_separators",
"collapse_quotes", "image_placeholders", "inline_images", "button_extra",
"unzip", "attachments_alt", "thumbnails",
"list_count", "bundled_fonts", "parse_classes",
"list_count", "bundled_fonts", "narrow_fonts", "parse_classes",
"background_color", "text_color", "text_size", "text_font", "text_align", "text_titles",
"authentication", "authentication_indicator"
};
@ -353,6 +354,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swListCount = view.findViewById(R.id.swListCount);
swBundledFonts = view.findViewById(R.id.swBundledFonts);
swNarrowFonts = view.findViewById(R.id.swNarrowFonts);
swParseClasses = view.findViewById(R.id.swParseClasses);
swBackgroundColor = view.findViewById(R.id.swBackgroundColor);
swTextColor = view.findViewById(R.id.swTextColor);
@ -1316,6 +1318,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("bundled_fonts", checked).apply();
swNarrowFonts.setEnabled(checked);
}
});
swNarrowFonts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("narrow_fonts", checked).apply();
}
});
@ -1637,6 +1647,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swListCount.setChecked(prefs.getBoolean("list_count", false));
swBundledFonts.setChecked(prefs.getBoolean("bundled_fonts", true));
swNarrowFonts.setChecked(prefs.getBoolean("narrow_fonts", false));
swNarrowFonts.setEnabled(swBundledFonts.isChecked());
swParseClasses.setChecked(prefs.getBoolean("parse_classes", true));
swBackgroundColor.setChecked(prefs.getBoolean("background_color", false));
swTextColor.setChecked(prefs.getBoolean("text_color", true));

View File

@ -1806,6 +1806,8 @@ public class StyleHelper {
return "Caladea, Cambo, Cambria, serif";
if (faces.contains("comic sans"))
return "OpenDyslexic, \"Comic Sans\", \"Comic Sans MS\", sans-serif";
if (faces.contains("sans narrow"))
return "\"Liberation Sans Narrow\", \"Arial Narrow\"";
return family;
}
@ -1820,6 +1822,7 @@ public class StyleHelper {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean bundled_fonts = prefs.getBoolean("bundled_fonts", true);
boolean narrow_fonts = prefs.getBoolean("narrow_fonts", false);
List<String> faces = new ArrayList<>();
for (String face : family.split(","))
@ -1871,6 +1874,11 @@ public class StyleHelper {
faces.contains("comic sans") ||
faces.contains("comic sans ms"))
return ResourcesCompat.getFont(context.getApplicationContext(), R.font.opendyslexic);
if (narrow_fonts &&
(faces.contains("sans narrow") ||
faces.contains("arial narrow"))) // condensed, compressed
return ResourcesCompat.getFont(context.getApplicationContext(), R.font.liberation_sans_narrow_regular);
}
for (String face : faces) {
@ -1903,6 +1911,7 @@ public class StyleHelper {
public static List<FontDescriptor> getFonts(Context context, boolean all) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean bundled_fonts = prefs.getBoolean("bundled_fonts", true);
boolean narrow_fonts = prefs.getBoolean("narrow_fonts", false);
List<FontDescriptor> result = new ArrayList<>();
String[] fontNameNames = context.getResources().getStringArray(R.array.fontNameNames);
@ -1918,6 +1927,9 @@ public class StyleHelper {
result.add(new FontDescriptor("lato", "Lato (Calibri)", true));
result.add(new FontDescriptor("caladea", "Caladea (Cambria)", true));
if (all || narrow_fonts)
result.add(new FontDescriptor("sans narrow", "Liberation Sans Narrow (Arial Narrow)", true));
if (BuildConfig.DEBUG) {
result.add(new FontDescriptor("montserrat", "Montserrat", true));
}

View File

@ -2089,6 +2089,19 @@
app:layout_constraintTop_toBottomOf="@id/swListCount"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNarrowFonts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_narrow_fonts"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBundledFonts"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swParseClasses"
android:layout_width="0dp"
@ -2098,7 +2111,7 @@
android:text="@string/title_advanced_parse_classes"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBundledFonts"
app:layout_constraintTop_toBottomOf="@id/swNarrowFonts"
app:switchPadding="12dp" />
<TextView

View File

@ -640,6 +640,7 @@
<string name="title_advanced_navbar_colorize">Colorize the Android navigation bar</string>
<string name="title_advanced_list_count">Show the number of messages or conversations in the top action bar</string>
<string name="title_advanced_bundled_fonts">Use bundled fonts</string>
<string name="title_advanced_narrow_fonts">Use narrow fonts</string>
<string name="title_advanced_parse_classes">Parse style sheets</string>
<string name="title_advanced_authentication">Show authentication warnings</string>
<string name="title_advanced_authentication_hint">The underlying checks can be configured in the receive settings</string>

View File

@ -11,7 +11,7 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx1280m
org.gradle.warning.mode=all
android.useAndroidX=true

View File

@ -6,6 +6,12 @@ For support you can use the contact form.
Vallibonavenatrix
Next version
* Added Liberation Sans Narrow
* Small improvements and minor bug fixes
* Updated translations
1.2107 - 2023-10-04
* Added rule action to execute webhooks