public static Typeface getTypeface(String fontFamily, String fontStyle, String fontVariant, int fontWeight) { return getTypeface(fontFamily, getTypefaceStyle(fontStyle, fontVariant, fontWeight)); }
@Override public final void setFontProperties(@NonNull String fontFamily, float fontLineHeight, float fontSize, String fontStyle, @NonNull String fontVariant, int fontWeight) { Typeface typeface = typefaceMap == null ? FontUtils.getTypeface(fontFamily, fontStyle, fontVariant, fontWeight) : FontUtils.getTypeface(typefaceMap, fontFamily, fontStyle, fontVariant, fontWeight); // scale font size to the canvas transform scale, to ensure best font rendering // (text size is expressed in pixels, while fontSize is in mm) textPaint.setTypeface(typeface); textPaint.setTextSize(Math.round((fontSize / 25.4f) * displayMetrics.ydpi)); }
public static Typeface getTypeface(Map<String, Typeface> typefaceMap, String fontFamily, String fontStyle, String fontVariant, int fontWeight) { Typeface ref = typefaceMap.get(fontFamily); if (ref == null) return getTypeface(fontFamily, getTypefaceStyle(fontStyle, fontVariant, fontWeight)); return Typeface.create(ref, FontUtils.getTypefaceStyle(fontStyle, fontVariant, fontWeight)); }
public static Typeface getTypeface(Style style) { return getTypeface(style.getFontFamily(), getTypefaceStyle(style)); }
Typeface typeface = FontUtils.getTypeface(typefaceMap, fontFamily, style.getFontStyle(), style.getFontVariant(), style.getFontWeight()); if (typeface == null) span = new TextAppearanceSpan(fontFamily, typefaceStyle, fontSize, fontColor, fontLinkColor);