Ejemplo n.º 1
0
 public void onDraw(Canvas canvas) {
   canvas.drawColor(Color.LTGRAY);
   Paint Pnt = new Paint();
   int y = 1;
   Pnt.setAntiAlias(true);
   Pnt.setTextSize(30);
   Pnt.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
   canvas.drawText("Font:Default", 10, y++ * 40, Pnt);
   Pnt.setTypeface(Typeface.create(Typeface.DEFAULT_BOLD, Typeface.NORMAL));
   canvas.drawText("Font:Default Bold", 10, y++ * 40, Pnt);
   Pnt.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL));
   canvas.drawText("Font:Monospace", 10, y++ * 40, Pnt);
   Pnt.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL));
   canvas.drawText("Font:Sans Serif", 10, y++ * 40, Pnt);
   Pnt.setTypeface(Typeface.create(Typeface.SERIF, Typeface.NORMAL));
   canvas.drawText("Font:Serif", 10, y++ * 40, Pnt);
 }
Ejemplo n.º 2
0
    public void onDraw(Canvas canvas) {
      canvas.drawColor(Color.LTGRAY);
      Paint Pnt = new Paint();
      String str = "Custom Font Test";

      Pnt.setAntiAlias(true);
      Pnt.setTypeface(mFont);
      Pnt.setTextSize(30);
      canvas.drawText(str, 10, 40, Pnt);
    }