TerminalBridge.java 文件源码

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

项目:connectbot 作者:
/**
 * Request a different font size. Will make call to parentChanged() to make
 * sure we resize PTY if needed.
 */
/* package */ final void setFontSize(float size) {
    if (size <= 0.0)
        return;

    defaultPaint.setTextSize(size);
    fontSize = size;

    // read new metrics to get exact pixel dimensions
    FontMetrics fm = defaultPaint.getFontMetrics();
    charTop = (int)Math.ceil(fm.top);

    float[] widths = new float[1];
    defaultPaint.getTextWidths("X", widths);
    charWidth = (int)Math.ceil(widths[0]);
    charHeight = (int)Math.ceil(fm.descent - fm.top);

    // refresh any bitmap with new font size
    if(parent != null)
        parentChanged(parent);

    for (FontSizeChangedListener ofscl : fontSizeChangedListeners)
        ofscl.onFontSizeChanged(size);

    host.setFontSize((int) fontSize);
    manager.hostdb.updateFontSize(host);

    forcedSize = false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号