|
|
@ -1816,14 +1816,7 @@ public class StyleHelper {
|
|
|
|
return new CustomTypefaceSpan(family, getTypeface(family, context));
|
|
|
|
return new CustomTypefaceSpan(family, getTypeface(family, context));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Typeface getTypeface(String family, Context context) {
|
|
|
|
static List<String> getTypeFaces(String family) {
|
|
|
|
if (TextUtils.isEmpty(family))
|
|
|
|
|
|
|
|
return Typeface.DEFAULT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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<>();
|
|
|
|
List<String> faces = new ArrayList<>();
|
|
|
|
for (String face : family.split(","))
|
|
|
|
for (String face : family.split(","))
|
|
|
|
faces.add(face
|
|
|
|
faces.add(face
|
|
|
@ -1831,8 +1824,19 @@ public class StyleHelper {
|
|
|
|
.toLowerCase(Locale.ROOT)
|
|
|
|
.toLowerCase(Locale.ROOT)
|
|
|
|
.replace("'", "")
|
|
|
|
.replace("'", "")
|
|
|
|
.replace("\"", ""));
|
|
|
|
.replace("\"", ""));
|
|
|
|
|
|
|
|
return faces;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Typeface getTypeface(String family, Context context) {
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(family))
|
|
|
|
|
|
|
|
return Typeface.DEFAULT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean bundled_fonts = prefs.getBoolean("bundled_fonts", true);
|
|
|
|
|
|
|
|
boolean narrow_fonts = prefs.getBoolean("narrow_fonts", false);
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
List<String> faces = getTypeFaces(family);
|
|
|
|
|
|
|
|
|
|
|
|
if (faces.contains("fairemail"))
|
|
|
|
if (faces.contains("fairemail"))
|
|
|
|
return ResourcesCompat.getFont(context.getApplicationContext(), R.font.fantasy);
|
|
|
|
return ResourcesCompat.getFont(context.getApplicationContext(), R.font.fantasy);
|
|
|
|