1

I tried this in TextDrawer class but its not working

  try {  titleTypeface = Typeface.createFromAsset(context.getAssets(), "Face Your Fears.ttf");

} catch (Exception e) {
// Pretend that never happened, and use the default font
Log.d(TAG, "TITLE FONT: ");
Log.d(TAG, "default font");
}
titlePaint.setTypeface(titleTypeface);
textPaint.setTypeface(titleTypeface);

Any suggestions ?

bpr10
  • 1,086
  • 8
  • 14

1 Answers1

2

my TextDrawer constructor looks like the following, which works for me

public TextDrawer(Resources resources, ShowcaseAreaCalculator calculator, Context context) {
    padding = resources.getDimension(R.dimen.text_padding);
    actionBarOffset = resources.getDimension(R.dimen.action_bar_offset);

    this.calculator = calculator;
    this.context = context;

    String fontPath = "fonts/SuperAwesomeFont.ttf";
    Typeface mTypeFace = Typeface.createFromAsset(context.getAssets(),fontPath);

    titlePaint = new TextPaint();
    titlePaint.setAntiAlias(true);
    titlePaint.setTypeface(mTypeFace);

    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setTypeface(mTypeFace);
}
doodlleus
  • 575
  • 4
  • 14
  • Ya. That worked for me also. The bug with my code was i changed my typeface to serif from style file so the typeface setting from the code was not working – bpr10 Feb 06 '15 at 13:04