mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-03 23:56:07 +02:00
Added option to disable bundle fonts
This commit is contained in:
@@ -165,6 +165,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
private SwitchCompat swAttachmentsAlt;
|
||||
private SwitchCompat swThumbnails;
|
||||
|
||||
private SwitchCompat swBundledFonts;
|
||||
private SwitchCompat swParseClasses;
|
||||
private SwitchCompat swAuthentication;
|
||||
private SwitchCompat swAuthenticationIndicator;
|
||||
@@ -192,7 +193,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
"display_font", "contrast", "monospaced_pre",
|
||||
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
|
||||
"collapse_quotes", "image_placeholders", "inline_images", "button_extra", "attachments_alt", "thumbnails",
|
||||
"parse_classes",
|
||||
"bundled_fonts", "parse_classes",
|
||||
"authentication", "authentication_indicator"
|
||||
};
|
||||
|
||||
@@ -306,6 +307,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
swButtonExtra = view.findViewById(R.id.swButtonExtra);
|
||||
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
|
||||
swThumbnails = view.findViewById(R.id.swThumbnails);
|
||||
swBundledFonts = view.findViewById(R.id.swBundledFonts);
|
||||
swParseClasses = view.findViewById(R.id.swParseClasses);
|
||||
swAuthentication = view.findViewById(R.id.swAuthentication);
|
||||
swAuthenticationIndicator = view.findViewById(R.id.swAuthenticationIndicator);
|
||||
@@ -1137,6 +1139,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
}
|
||||
});
|
||||
|
||||
swBundledFonts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("bundled_fonts", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swParseClasses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -1378,6 +1387,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
|
||||
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));
|
||||
|
||||
swBundledFonts.setChecked(prefs.getBoolean("bundled_fonts", true));
|
||||
swParseClasses.setChecked(prefs.getBoolean("parse_classes", true));
|
||||
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
|
||||
swAuthenticationIndicator.setChecked(prefs.getBoolean("authentication_indicator", false));
|
||||
|
||||
@@ -954,6 +954,9 @@ public class StyleHelper {
|
||||
if (TextUtils.isEmpty(family))
|
||||
return Typeface.DEFAULT;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean bundled_fonts = prefs.getBoolean("bundled_fonts", true);
|
||||
|
||||
List<String> faces = new ArrayList<>();
|
||||
for (String face : family.split(","))
|
||||
faces.add(face
|
||||
@@ -965,34 +968,36 @@ public class StyleHelper {
|
||||
if (faces.contains("fairemail"))
|
||||
return ResourcesCompat.getFont(context, R.font.fantasy);
|
||||
|
||||
if (faces.contains("arimo") ||
|
||||
faces.contains("arial") ||
|
||||
faces.contains("verdana") ||
|
||||
faces.contains("helvetica"))
|
||||
return ResourcesCompat.getFont(context, R.font.arimo);
|
||||
if (bundled_fonts) {
|
||||
if (faces.contains("arimo") ||
|
||||
faces.contains("arial") ||
|
||||
faces.contains("verdana") ||
|
||||
faces.contains("helvetica"))
|
||||
return ResourcesCompat.getFont(context, R.font.arimo);
|
||||
|
||||
if (faces.contains("tinos") ||
|
||||
faces.contains("times new roman"))
|
||||
return ResourcesCompat.getFont(context, R.font.tinos);
|
||||
if (faces.contains("tinos") ||
|
||||
faces.contains("times new roman"))
|
||||
return ResourcesCompat.getFont(context, R.font.tinos);
|
||||
|
||||
if (faces.contains("cousine") ||
|
||||
faces.contains("courier new"))
|
||||
return ResourcesCompat.getFont(context, R.font.cousine);
|
||||
if (faces.contains("cousine") ||
|
||||
faces.contains("courier new"))
|
||||
return ResourcesCompat.getFont(context, R.font.cousine);
|
||||
|
||||
if (faces.contains("lato") ||
|
||||
faces.contains("carlito") ||
|
||||
faces.contains("calibri"))
|
||||
return ResourcesCompat.getFont(context, R.font.lato);
|
||||
if (faces.contains("lato") ||
|
||||
faces.contains("carlito") ||
|
||||
faces.contains("calibri"))
|
||||
return ResourcesCompat.getFont(context, R.font.lato);
|
||||
|
||||
if (faces.contains("caladea") ||
|
||||
faces.contains("cambo") ||
|
||||
faces.contains("cambria"))
|
||||
return ResourcesCompat.getFont(context, R.font.caladea);
|
||||
if (faces.contains("caladea") ||
|
||||
faces.contains("cambo") ||
|
||||
faces.contains("cambria"))
|
||||
return ResourcesCompat.getFont(context, R.font.caladea);
|
||||
|
||||
if (faces.contains("opendyslexic") ||
|
||||
faces.contains("comic sans") ||
|
||||
faces.contains("comic sans ms"))
|
||||
return ResourcesCompat.getFont(context, R.font.opendyslexic);
|
||||
if (faces.contains("opendyslexic") ||
|
||||
faces.contains("comic sans") ||
|
||||
faces.contains("comic sans ms"))
|
||||
return ResourcesCompat.getFont(context, R.font.opendyslexic);
|
||||
}
|
||||
|
||||
for (String face : faces) {
|
||||
Typeface tf = Typeface.create(face, Typeface.NORMAL);
|
||||
|
||||
Reference in New Issue
Block a user