LOG.assertTrue(font != null);
+ int baseSize = font.getSize();
+ boolean wasSmaller = false;
for (int i = 0; i < myAttributes.size(); i++) {
SimpleTextAttributes attributes = myAttributes.get(i);
- if (font.getStyle() != attributes.getFontStyle()) { // derive font only if it is necessary
- font = font.deriveFont(attributes.getFontStyle());
+ boolean isSmaller = attributes.isSmaller();
+ if (font.getStyle() != attributes.getFontStyle() || isSmaller != wasSmaller) { // derive font only if it is necessary
+ font = font.deriveFont(attributes.getFontStyle(), isSmaller ? UIUtil.getFontSize(UIUtil.FontSize.SMALL) : baseSize);
}
+ wasSmaller = isSmaller;
final FontMetrics metrics = getFontMetrics(font);
width += metrics.stringWidth(myFragments.get(i));
Font font = getFont();
LOG.assertTrue(font != null);
+ int baseSize = font.getSize();
+ boolean wasSmaller = false;
for (int i = 0; i < myAttributes.size(); i++) {
SimpleTextAttributes attributes = myAttributes.get(i);
- if (font.getStyle() != attributes.getFontStyle()) { // derive font only if it is necessary
- font = font.deriveFont(attributes.getFontStyle());
+ boolean isSmaller = attributes.isSmaller();
+ if (font.getStyle() != attributes.getFontStyle() || isSmaller != wasSmaller) { // derive font only if it is necessary
+ font = font.deriveFont(attributes.getFontStyle(), isSmaller ? UIUtil.getFontSize(UIUtil.FontSize.SMALL) : baseSize);
}
+ wasSmaller = isSmaller;
+
final FontMetrics metrics = getFontMetrics(font);
final int curWidth = metrics.stringWidth(myFragments.get(i));
if (x >= curX && x < curX + curWidth) {
UIUtil.applyRenderingHints(g);
applyAdditionalHints(g);
+ final Font ownFont = getFont();
+ int baseSize = ownFont != null ? ownFont.getSize() : g.getFont().getSize();
+ boolean wasSmaller = false;
for (int i = 0; i < myFragments.size(); i++) {
final SimpleTextAttributes attributes = myAttributes.get(i);
+
Font font = g.getFont();
- if (font.getStyle() != attributes.getFontStyle()) { // derive font only if it is necessary
- font = font.deriveFont(attributes.getFontStyle());
+ boolean isSmaller = attributes.isSmaller();
+ if (font.getStyle() != attributes.getFontStyle() || isSmaller != wasSmaller) { // derive font only if it is necessary
+ font = font.deriveFont(attributes.getFontStyle(), isSmaller ? UIUtil.getFontSize(UIUtil.FontSize.SMALL) : baseSize);
}
+ wasSmaller = isSmaller;
+
g.setFont(font);
final FontMetrics metrics = g.getFontMetrics(font);