1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

Revert "improves font rendering"

This reverts commit c2d9a1b020f82fa82ef0df04765adc40e87d145f.
This commit is contained in:
Federico Fissore 2015-04-24 13:11:57 +02:00
parent 67997a6605
commit 330aeb0ba1

View File

@ -153,16 +153,16 @@ public class EditorHeader extends JComponent {
Graphics g = offscreen.getGraphics(); Graphics g = offscreen.getGraphics();
if (font == null) { if (font == null) {
font = Theme.getDefaultFont(); // Get optimal font. font = Theme.getFont("header.text.font");
if(font == null) font = Theme.getFont("header.text.font");
} }
g.setFont(font); // need to set this each time through g.setFont(font); // need to set this each time through
metrics = g.getFontMetrics(); metrics = g.getFontMetrics();
fontAscent = metrics.getAscent(); fontAscent = metrics.getAscent();
//} //}
Graphics2D g2 = (Graphics2D) g; //Graphics2D g2 = (Graphics2D) g;
//g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
// RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// set the background for the offscreen // set the background for the offscreen
g.setColor(backgroundColor); g.setColor(backgroundColor);
@ -182,8 +182,9 @@ public class EditorHeader extends JComponent {
code.getPrettyName() : code.getFileName(); code.getPrettyName() : code.getFileName();
// if modified, add the li'l glyph next to the name // if modified, add the li'l glyph next to the name
String text = " " + codeName + " "; String text = " " + codeName + (code.isModified() ? " \u00A7" : " ");
Graphics2D g2 = (Graphics2D) g;
int textWidth = (int) int textWidth = (int)
font.getStringBounds(text, g2.getFontRenderContext()).getWidth(); font.getStringBounds(text, g2.getFontRenderContext()).getWidth();
@ -206,17 +207,8 @@ public class EditorHeader extends JComponent {
g.setColor(textColor[state]); g.setColor(textColor[state]);
int baseline = (sizeH + fontAscent) / 2; int baseline = (sizeH + fontAscent) / 2;
//g.drawString(sketch.code[i].name, textLeft, baseline); //g.drawString(sketch.code[i].name, textLeft, baseline);
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.drawString(text, textLeft, baseline); g.drawString(text, textLeft, baseline);
if(code.isModified()){
g.setColor(Color.RED);
g.drawString("*", textLeft - 3, baseline);
}
g.drawImage(pieces[state][RIGHT], x, 0, null); g.drawImage(pieces[state][RIGHT], x, 0, null);
x += PIECE_WIDTH - 1; // overlap by 1 pixel x += PIECE_WIDTH - 1; // overlap by 1 pixel
} }