Compose Dyslexia

pull/199/head 1.1604
M66B 4 years ago
parent 616d18cfdf
commit 94568410a8

@ -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.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
tvReference.setMovementMethod(new ArrowKeyMovementMethod() { tvReference.setMovementMethod(new ArrowKeyMovementMethod() {

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

Loading…
Cancel
Save