Code example for Paint

Methods: setAntiAlias, setColor, setTextAlign, setTextSize, setTypeface

0
    	 
    	return strList;
    } 
     
    private static Paint newPaint(String fontName, int fontSize, int alignment){
    	Paint paint = new Paint();
    	paint.setColor(Color.WHITE);
        paint.setTextSize(fontSize);      
        paint.setAntiAlias(true);    
         
        /* 
         * Set type face for paint, now it support .ttf file. 
         */ 
        if (fontName.endsWith(".ttf")){
        	 try { 
        		//Typeface typeFace = Typeface.createFromAsset(context.getAssets(), fontName); 
        		 Typeface typeFace = Cocos2dxTypefaces.get(context, fontName);
              	paint.setTypeface(typeFace);
             } catch (Exception e){
             	Log.e("Cocos2dxBitmap", 
             		"error to create ttf type face: " + fontName);
             	 
             	/* 
             	 * The file may not find, use system font 
             	 */ 
             	paint.setTypeface(Typeface.create(fontName, Typeface.NORMAL));
             } 
        } 
        else { 
        	paint.setTypeface(Typeface.create(fontName, Typeface.NORMAL));
        } 
         
        switch (alignment){
    	case ALIGNCENTER:
    		paint.setTextAlign(Align.CENTER);
    		break; 
    	 
    	case ALIGNLEFT:  
    		paint.setTextAlign(Align.LEFT);
    		break; 
    		 
    	case ALIGNRIGHT:
    		paint.setTextAlign(Align.RIGHT);
    		break; 
    	 
    	default: 
    		paint.setTextAlign(Align.LEFT);
    		break; 
    	} 
         
        return paint;
    }