Search in sources :

Example 91 with Typeface

use of android.graphics.Typeface in project letterpress by Pixplicity.

the class FontEditText method setCustomTypeface.

private void setCustomTypeface(AttributeSet attrs, int defStyle) {
    final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle);
    setCustomTypeface(tf);
}
Also used : Typeface(android.graphics.Typeface)

Example 92 with Typeface

use of android.graphics.Typeface in project letterpress by Pixplicity.

the class FontMultiAutoCompleteTextView method setCustomTypeface.

private void setCustomTypeface(AttributeSet attrs, int defStyle) {
    final Typeface tf = FontUtil.getTypeface(getContext(), attrs, defStyle);
    setCustomTypeface(tf);
}
Also used : Typeface(android.graphics.Typeface)

Example 93 with Typeface

use of android.graphics.Typeface in project letterpress by Pixplicity.

the class FontRadioButton method setCustomTypeface.

public void setCustomTypeface(String font) {
    final Typeface tf = FontUtil.getTypeface(getContext(), font);
    setCustomTypeface(tf);
}
Also used : Typeface(android.graphics.Typeface)

Example 94 with Typeface

use of android.graphics.Typeface in project android_frameworks_base by ResurrectionRemix.

the class StyleSpan method apply.

private static void apply(Paint paint, int style) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }
    int want = oldStyle | style;
    Typeface tf;
    if (old == null) {
        tf = Typeface.defaultFromStyle(want);
    } else {
        tf = Typeface.create(old, want);
    }
    int fake = want & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }
    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }
    paint.setTypeface(tf);
}
Also used : Typeface(android.graphics.Typeface) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 95 with Typeface

use of android.graphics.Typeface in project android_frameworks_base by ResurrectionRemix.

the class TextAppearanceSpan method updateMeasureState.

@Override
public void updateMeasureState(TextPaint ds) {
    if (mTypeface != null || mStyle != 0) {
        Typeface tf = ds.getTypeface();
        int style = 0;
        if (tf != null) {
            style = tf.getStyle();
        }
        style |= mStyle;
        if (mTypeface != null) {
            tf = Typeface.create(mTypeface, style);
        } else if (tf == null) {
            tf = Typeface.defaultFromStyle(style);
        } else {
            tf = Typeface.create(tf, style);
        }
        int fake = style & ~tf.getStyle();
        if ((fake & Typeface.BOLD) != 0) {
            ds.setFakeBoldText(true);
        }
        if ((fake & Typeface.ITALIC) != 0) {
            ds.setTextSkewX(-0.25f);
        }
        ds.setTypeface(tf);
    }
    if (mTextSize > 0) {
        ds.setTextSize(mTextSize);
    }
}
Also used : Typeface(android.graphics.Typeface) TextPaint(android.text.TextPaint)

Aggregations

Typeface (android.graphics.Typeface)266 Paint (android.graphics.Paint)57 TextPaint (android.text.TextPaint)40 TypedArray (android.content.res.TypedArray)34 TextView (android.widget.TextView)21 View (android.view.View)20 Canvas (android.graphics.Canvas)15 Bitmap (android.graphics.Bitmap)13 Context (android.content.Context)11 Resources (android.content.res.Resources)10 Test (org.junit.Test)8 ColorStateList (android.content.res.ColorStateList)7 Legend (com.github.mikephil.charting.components.Legend)7 File (java.io.File)7 Intent (android.content.Intent)6 Attributes (com.cengalabs.flatui.Attributes)6 XAxis (com.github.mikephil.charting.components.XAxis)6 YAxis (com.github.mikephil.charting.components.YAxis)6 ContentResolver (android.content.ContentResolver)5 Drawable (android.graphics.drawable.Drawable)5