Code example for Typeface

Methods: create

0
    private static final int FONT_INDEX_SANS = 0;   // index into sTypeface
    private static final int FONT_INDEX_SERIF = 1;  // index into sTypeface
    private static final int FONT_INDEX_MONO = 2;   // index into sTypeface
     
    private static boolean canSupportStyle(Typeface tf, int styleBits) {
        tf = Typeface.create(tf, styleBits);
        return (tf.getStyle() & styleBits) == styleBits;
    } 
 
    private void refreshFont() { 
        Typeface tf = Typeface.create(sTypeface[mFontIndex], mFontStyle);
        mColumn1.setTypeface(tf);
        mColumn2.setTypeface(tf);
        updateTitle(); 
    } 
     
    private MenuItem.OnMenuItemClickListener mFontClickListener = new MenuItem.OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) { 
            mFontIndex = item.getItemId(); 
            refreshFont(); 
            return true;