mirror of https://github.com/M66B/FairEmail.git
Simplify font mapper
This commit is contained in:
parent
75467f3695
commit
6c00ea8ab4
|
@ -774,19 +774,20 @@ public class StyleHelper {
|
|||
|
||||
static Typeface getTypeface(String family, Context context) {
|
||||
String faces = family.toLowerCase(Locale.ROOT);
|
||||
|
||||
if (faces.equals("fairemail"))
|
||||
return ResourcesCompat.getFont(context, R.font.fantasy);
|
||||
|
||||
if (faces.contains("comic sans"))
|
||||
return ResourcesCompat.getFont(context, R.font.opendyslexic);
|
||||
|
||||
for (String face : faces.split(",")) {
|
||||
face = face.trim().replace("\"", "");
|
||||
if ("fairemail".equals(face))
|
||||
return ResourcesCompat.getFont(context, R.font.fantasy);
|
||||
else if (face.contains("comic sans"))
|
||||
return ResourcesCompat.getFont(context, R.font.opendyslexic);
|
||||
else if (face.equals("times new roman") || face.equals("serif"))
|
||||
return Typeface.SERIF;
|
||||
else if (face.equals("arial") || face.equals("sans-serif"))
|
||||
return Typeface.SANS_SERIF;
|
||||
Typeface tf = Typeface.create(face, Typeface.NORMAL);
|
||||
if (!tf.equals(Typeface.DEFAULT))
|
||||
return tf;
|
||||
}
|
||||
|
||||
return Typeface.create(family, Typeface.NORMAL);
|
||||
return Typeface.DEFAULT;
|
||||
}
|
||||
|
||||
//TextUtils.dumpSpans(text, new LogPrinter(android.util.Log.INFO, "FairEmail"), "afterTextChanged ");
|
||||
|
|
Loading…
Reference in New Issue