예제 #1
0
  /**
   * 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;
  }
예제 #2
0
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    bridge.parentChanged(this);

    scaleCursors();
  }