기술/beginning games2011. 5. 25. 13:28
download download
public class FontTest extends Activity {
class RenderView extends View {
Paint paint;
Typeface font;
Rect bounds = new Rect();
public RenderView(Context context) {
super(context);
paint = new Paint();
font = Typeface.createFromAsset(context.getAssets(), "anklepan.ttf");
}
protected void onDraw(Canvas c){
paint.setColor(Color.YELLOW);
paint.setTypeface(font);
paint.setTextSize(28);
paint.setTextAlign(Paint.Align.CENTER);
c.drawText("Test!!!", c.getWidth()/2, 100, paint);
String text = "한글 o_O";
paint.setColor(Color.WHITE);
paint.setTextSize(18);
paint.setTextAlign(Paint.Align.LEFT);
paint.getTextBounds(text, 0, text.length(), bounds);
c.drawText(text, c.getWidth() - bounds.width(), 140,paint);
invalidate();
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   setContentView(new RenderView(this));
}
}
download download download
Posted by yachtie_leo