Android Typeface - top ranked examples from Open Source projects

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

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) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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);
    } 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getStyle
            oldStyle = 0;
        } else { 
            oldStyle = old.getStyle();
        } 
 
        int fake = oldStyle & ~aType.getStyle();
        if ( ( fake & Typeface.BOLD ) != 0 ) 
        { 
        	aPaint.setFakeBoldText( true );
        } 
 
        if ( ( fake & Typeface.ITALIC ) != 0 ) 
        { 
        	aPaint.setTextSkewX(-0.25f);
        } 
 
        aPaint.setTypeface( aType );
    } 
     
    private final Typeface mNewType;
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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); 
        } 
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Typeface Questions & Answers:

Other Android Typeface Examples

18:	        // Loading Font Face
19:	        Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
20:	
21:	        // Applying font
22:	        txtGhost.setTypeface(tf);

Read More

See Code Examples for Android Typeface Methods: