Exemplo n.º 1
0
  /**
   * Same as parent, but override for native version of the font.
   *
   * <p>Also gets called by textFont, so the metrics will get recorded properly.
   */
  public void textSize(float size) {
    if (textFont == null) {
      defaultFontOrDeath("textAscent", size);
    }

    // if a native version available, derive this font
    //    if (textFontNative != null) {
    //      textFontNative = textFontNative.deriveFont(size);
    //      g2.setFont(textFontNative);
    //      textFontNativeMetrics = g2.getFontMetrics(textFontNative);
    //    }
    Font font = textFont.getFont();
    if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) {
      Font dfont = font.deriveFont(size);
      g2.setFont(dfont);
      textFont.setFont(dfont);
    }

    // take care of setting the textSize and textLeading vars
    // this has to happen second, because it calls textAscent()
    // (which requires the native font metrics to be set)
    super.textSize(size);
  }