JavaFontRenderingBox.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:FlexibleRichTextView 作者:
public JavaFontRenderingBox(String str, int type, float size, Typeface f,
            boolean kerning) {
        this.str = str;
        this.size = size;
        //计算出文字需要的宽高
//      Paint pFont=AjLatexMath.getPaint();
//      pFont.setTextSize(AjLatexMath.getTextSize());
        Paint pFont =new Paint();
        Rect rect = new Rect();
        pFont.getTextBounds(str, 0, str.length(), rect);
         this.height = (float) (-rect.top * size / 2);
         this.depth = (float) ((rect.height() * size / 2) - this.height);
         this.width = (float) ((rect.width() + rect.right + 0.4f) * size /
         4);
        System.out.println(" width="+width+" height="+height+" text="+str);
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号