use of android.graphics.Typeface in project XobotOS by xamarin.
the class TextView method setTypefaceByIndex.
private void setTypefaceByIndex(int typefaceIndex, int styleIndex) {
Typeface tf = null;
switch(typefaceIndex) {
case SANS:
tf = Typeface.SANS_SERIF;
break;
case SERIF:
tf = Typeface.SERIF;
break;
case MONOSPACE:
tf = Typeface.MONOSPACE;
break;
}
setTypeface(tf, styleIndex);
}
use of android.graphics.Typeface in project Weather by Sparker0i.
the class LargeWidgetProvider method createWeatherIcon.
public static Bitmap createWeatherIcon(Context context, String text) {
Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
Typeface weatherFont = Typeface.createFromAsset(context.getAssets(), "fonts/weather.ttf");
int textColor = ContextCompat.getColor(context, R.color.textColor);
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setTypeface(weatherFont);
paint.setStyle(Paint.Style.FILL);
paint.setColor(textColor);
paint.setTextSize(180);
paint.setTextAlign(Paint.Align.CENTER);
canvas.drawText(text, 128, 200, paint);
return bitmap;
}
use of android.graphics.Typeface in project Weather by Sparker0i.
the class SmallWidgetProvider method createWeatherIcon.
public static Bitmap createWeatherIcon(Context context, String text) {
Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
Typeface weatherFont = Typeface.createFromAsset(context.getAssets(), "fonts/weather.ttf");
int textColor = ContextCompat.getColor(context, R.color.textColor);
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setTypeface(weatherFont);
paint.setStyle(Paint.Style.FILL);
paint.setColor(textColor);
paint.setTextSize(180);
paint.setTextAlign(Paint.Align.CENTER);
canvas.drawText(text, 128, 200, paint);
return bitmap;
}
use of android.graphics.Typeface in project letterpress by Pixplicity.
the class FontTextView method setCustomTypeface.
public void setCustomTypeface(String font) {
final Typeface tf = FontUtil.getTypeface(getContext(), font);
setCustomTypeface(tf);
}
use of android.graphics.Typeface in project letterpress by Pixplicity.
the class FontSpan method apply.
private void apply(final Paint paint) {
final Typeface oldTypeface = paint.getTypeface();
final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
final int fakeStyle = oldStyle & ~typeface.getStyle();
if ((fakeStyle & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
}
if ((fakeStyle & Typeface.ITALIC) != 0) {
paint.setTextSkewX(-0.25f);
}
paint.setTypeface(typeface);
}
Aggregations