Compose Dyslexia

This commit is contained in:
M66B 2021-06-01 14:46:08 +02:00
parent 616d18cfdf
commit 94568410a8
2 changed files with 14 additions and 4 deletions

View File

@ -867,7 +867,7 @@ public class FragmentCompose extends FragmentBase {
}
});
etBody.setTypeface(Typeface.create(compose_font, Typeface.NORMAL));
etBody.setTypeface(StyleHelper.getTypeface(compose_font, getContext()));
tvReference.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
tvReference.setMovementMethod(new ArrowKeyMovementMethod() {

View File

@ -769,12 +769,22 @@ public class StyleHelper {
String face = family.toLowerCase(Locale.ROOT);
if ("fairemail".equals(face)) {
Typeface typeface = ResourcesCompat.getFont(context, R.font.fantasy);
return new CustomTypefaceSpan(face, typeface);
return new CustomTypefaceSpan(family, typeface);
} else if (face.contains("comic sans")) {
Typeface typeface = ResourcesCompat.getFont(context, R.font.opendyslexic);
return new CustomTypefaceSpan(face, typeface);
return new CustomTypefaceSpan(family, typeface);
} else
return new TypefaceSpan(face);
return new TypefaceSpan(family);
}
static Typeface getTypeface(String family, Context context) {
String face = family.toLowerCase(Locale.ROOT);
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
return Typeface.create(family, Typeface.NORMAL);
}
//TextUtils.dumpSpans(text, new LogPrinter(android.util.Log.INFO, "FairEmail"), "afterTextChanged ");