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);
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations