660 log.fine("Set foreground to " + c);
661 }
662 synchronized (getStateLock()) {
663 if (Objects.equals(foreground, c)) {
664 return;
665 }
666 foreground = c;
667 }
668 repaint();
669 }
670
671 /**
672 * Gets the font metrics for the specified font.
673 * @param font the font for which font metrics is to be
674 * obtained
675 * @return the font metrics for <code>font</code>
676 * @see #getFont
677 * @see #getPeer
678 * @see java.awt.peer.ComponentPeer#getFontMetrics(Font)
679 * @see Toolkit#getFontMetrics(Font)
680 * @since JDK1.0
681 */
682 public FontMetrics getFontMetrics(Font font) {
683 if (fontLog.isLoggable(PlatformLogger.Level.FINE)) {
684 fontLog.fine("Getting font metrics for " + font);
685 }
686 return sun.font.FontDesignMetrics.getMetrics(font);
687 }
688
689 @Override
690 public void setFont(Font f) {
691 if (f == null) {
692 f = XWindow.getDefaultFont();
693 }
694 synchronized (getStateLock()) {
695 if (f.equals(font)) {
696 return;
697 }
698 font = f;
699 }
700 // as it stands currently we don't need to do layout since
|
660 log.fine("Set foreground to " + c);
661 }
662 synchronized (getStateLock()) {
663 if (Objects.equals(foreground, c)) {
664 return;
665 }
666 foreground = c;
667 }
668 repaint();
669 }
670
671 /**
672 * Gets the font metrics for the specified font.
673 * @param font the font for which font metrics is to be
674 * obtained
675 * @return the font metrics for <code>font</code>
676 * @see #getFont
677 * @see #getPeer
678 * @see java.awt.peer.ComponentPeer#getFontMetrics(Font)
679 * @see Toolkit#getFontMetrics(Font)
680 * @since 1.0
681 */
682 public FontMetrics getFontMetrics(Font font) {
683 if (fontLog.isLoggable(PlatformLogger.Level.FINE)) {
684 fontLog.fine("Getting font metrics for " + font);
685 }
686 return sun.font.FontDesignMetrics.getMetrics(font);
687 }
688
689 @Override
690 public void setFont(Font f) {
691 if (f == null) {
692 f = XWindow.getDefaultFont();
693 }
694 synchronized (getStateLock()) {
695 if (f.equals(font)) {
696 return;
697 }
698 font = f;
699 }
700 // as it stands currently we don't need to do layout since
|