Typeface create - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Typeface create method.

This code example shows how to use the following methods:create
 
    // create array of all std faces 
    private final Typeface[] mFaces = new Typeface[] {
        Typeface.create(Typeface.SANS_SERIF, 0),
        Typeface.create(Typeface.SANS_SERIF, 1),
        Typeface.create(Typeface.SERIF, 0),
        Typeface.create(Typeface.SERIF, 1),
        Typeface.create(Typeface.SERIF, 2),
        Typeface.create(Typeface.SERIF, 3),
        Typeface.create(Typeface.MONOSPACE, 0)
    }; 
     
    @SmallTest 
    public void testBasic() throws Exception { 
        assertTrue("basic", Typeface.DEFAULT != null);
        assertTrue("basic", Typeface.DEFAULT_BOLD != null);
        assertTrue("basic", Typeface.SANS_SERIF != null);
        assertTrue("basic", Typeface.SERIF != null);
        assertTrue("basic", Typeface.MONOSPACE != null);
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create, getStyle
 
        Typeface old = paint.getTypeface();
        if (old == null) {
            oldStyle = 0;
        } else { 
            oldStyle = old.getStyle();
        } 
 
        int want = oldStyle | style;
 
        Typeface tf;
        if (old == null) {
            tf = Typeface.defaultFromStyle(want);
        } else { 
            tf = Typeface.create(old, want);
        } 
 
        int fake = want & ~tf.getStyle();
 
        if ((fake & Typeface.BOLD) != 0) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create, getStyle
        if (mTypeface != null || mStyle != 0) {
            Typeface tf = ds.getTypeface();
            int style = 0;
 
            if (tf != null) {
                style = tf.getStyle();
            } 
 
            style |= mStyle;
 
            if (mTypeface != null) {
                tf = Typeface.create(mTypeface, style);
            } else if (tf == null) {
                tf = Typeface.defaultFromStyle(style);
            } else { 
                tf = Typeface.create(tf, style);
            } 
 
            int fake = style & ~tf.getStyle();
 
            if ((fake & Typeface.BOLD) != 0) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
    @Override 
    protected void setupView(boolean isCenterView, int textSize) {
        setGravity(Gravity.CENTER);
        setTextColor(0xFF883333); 
        setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
        setTypeface(Typeface.SERIF);
 
        if (isCenterView) {
            setTypeface(Typeface.create(Typeface.SERIF, Typeface.BOLD));
            setBackgroundColor(0x55FFFFFF); 
            setShadowLayer(2.5f, 3, 3, 0xFF999999); 
        } 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
        @Override 
        protected void setupView(boolean isCenterView, int textSize) {
            setGravity(Gravity.CENTER);
            setTextColor(0xFF883333); 
            setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
            setTypeface(Typeface.SERIF);
            if (isCenterView) {
                setTypeface(Typeface.create(Typeface.SERIF, Typeface.BOLD));
                setBackgroundColor(0x55FFFFFF); 
                setShadowLayer(2.5f, 3, 3, 0xFF999999); 
            } 
        } 
 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
    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(); 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
        @Override 
        protected void setupView(boolean isCenterView, int textSize) {
            setGravity(Gravity.CENTER);
            setTextColor(0xFF883333); 
            setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
            setTypeface(Typeface.SERIF);
            if (isCenterView) {
                setTypeface(Typeface.create(Typeface.SERIF, Typeface.BOLD));
                setBackgroundColor(0x55FFFFFF); 
                setShadowLayer(2.5f, 3, 3, 0xFF999999); 
            } 
        } 
 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
        @Override 
        protected void setupView(boolean isCenterView, int textSize) {
            setGravity(Gravity.CENTER);
            setTextColor(0xFF883333); 
            setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
            setTypeface(Typeface.SERIF);
            if (isCenterView) {
                setTypeface(Typeface.create(Typeface.SERIF, Typeface.BOLD));
                setBackgroundColor(0x55FFFFFF); 
                setShadowLayer(2.5f, 3, 3, 0xFF999999); 
            } 
        } 
 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
            canvas.drawText("Hola Mundo (SERIF)", 0, 70, pincel1);            
            pincel1.setTypeface(Typeface.SANS_SERIF);
            canvas.drawText("Hola Mundo (SANS SERIF)", 0, 100, pincel1);            
            pincel1.setTypeface(Typeface.MONOSPACE);
            canvas.drawText("Hola Mundo (MONOSPACE)", 0, 140, pincel1);   
            Typeface tf=Typeface.create(Typeface.SERIF, Typeface.ITALIC);
            pincel1.setTypeface(tf);
            canvas.drawText("Hola Mundo (SERIF ITALIC)", 0, 180, pincel1);
            tf=Typeface.create(Typeface.SERIF, Typeface.ITALIC | Typeface.BOLD);
            pincel1.setTypeface(tf);
            canvas.drawText("Hola Mundo (SERIF ITALIC BOLD)", 0, 220, pincel1);            
        } 
    }  
	 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:create
		rectangle = new ShapeDrawable(new RectShape());
		rectangle.getPaint().setColor(Color.BLUE);
		rectangle.setBounds(x, y, x+width, y+height);
		paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		paint.setColor(Color.YELLOW);
		type = Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL);
		textSize = 14;
		paint.setTextSize(textSize);
		paint.setTypeface(type);
		label = "Weapon Slot";
	} 
 
	public void draw(Canvas canvas) {
		rectangle.draw(canvas);
		canvas.drawText(label, x+5, y+5+textSize, paint);
		Item weapon = ObjectManager.getObjectManager().getLink().getSlingshot();
		if (weapon != null) {
			canvas.drawBitmap(weapon.getBitmap(),x+7+30,y+7+2*textSize,null);
		} 
	} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Typeface create Questions & Answers:

create Method Overview
Create a typeface object given a family name, and option style information.
See Code Examples for other Android Typeface Methods: