Custom font rendering on Android 4.0 (Ice cream sandwich)

后端 未结 4 2135
囚心锁ツ
囚心锁ツ 2021-02-13 03:08

While testing an application that uses Helvetica Neue as its primary font on Android 4.0 I have found that there is an inconsistency in typeface rendering compared to multiple d

4条回答
  •  礼貌的吻别
    2021-02-13 03:31

    Although we never found a solution to the Helvetica rendering bug we were able to convince the client to switch to Roboto after we showed them the bug on a Galaxy Nexus.


    Update:

    public class TextViewCompat extends TextView {
    
        public TextViewCompat(Context context) {
            super(context);
            setup(context, null, 0);
        }
    
        public TextViewCompat(Context context, AttributeSet attrs) {
            super(context, attrs);
            setup(context, attrs, 0);
        }
    
        public TextViewCompat(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
            setup(context, attrs, defStyle);
        }
    
        private void setup(Context context, AttributeSet attrs, int defStyle) {
            setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
        }
    }
    

提交回复
热议问题