Esempio n. 1
2
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MyView vw = new MyView(this);
    setContentView(vw);

    mFont = Typeface.createFromAsset(getAssets(), "balloons.ttf");
  }
Esempio n. 2
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);
 }
Esempio n. 3
0
  public final Typeface getTypeFaceFromAsset(String assetName) {
    try {
      return Typeface.createFromAsset(this.getResources().getAssets(), assetName);
    } catch (Throwable e) {
    }

    return null;
  }
Esempio n. 4
0
  public final Typeface getTypeFaceFromByteArray(byte[] data) {
    try {
      File f = getDataCacheFile(data);

      if (f != null) return Typeface.createFromFile(f);
    } catch (Exception e) {
      Log.e("JUCE", e.toString());
    }

    return null;
  }