-/**
+/*
* Jexer - Java Text User Interface
*
* License: LGPLv3 or later
*/
private int maxDescent = 0;
+ /**
+ * System-dependent Y adjustment for text in the character cell.
+ */
+ private int textAdjustY = 0;
+
+ /**
+ * System-dependent X adjustment for text in the character cell.
+ */
+ private int textAdjustX = 0;
+
/**
* Top pixel absolute location.
*/
getFontDimensions();
// Setup double-buffering
- if (screen.doubleBuffer) {
+ if (SwingScreen.doubleBuffer) {
setIgnoreRepaint(true);
createBufferStrategy(2);
bufferStrategy = getBufferStrategy();
// This also produces the same number, but works better for ugly
// monospace.
textHeight = fm.getMaxAscent() + maxDescent - leading;
+
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ textAdjustY = -1;
+ textAdjustX = 0;
+ }
}
/**
gr.setColor(attrToForegroundColor(lCellColor));
char [] chars = new char[1];
chars[0] = lCell.getChar();
- gr.drawChars(chars, 0, 1, xPixel,
- yPixel + textHeight - maxDescent);
+ gr.drawChars(chars, 0, 1, xPixel + textAdjustX,
+ yPixel + textHeight - maxDescent
+ + textAdjustY);
+
if (lCell.isUnderline()) {
gr.fillRect(xPixel, yPixel + textHeight - 2,
textWidth, 2);
Cell lCell = screen.logical[cursorX][cursorY];
gr.setColor(attrToForegroundColor(lCell));
switch (cursorStyle) {
+ default:
+ // Fall through...
case UNDERLINE:
gr.fillRect(xPixel, yPixel + textHeight - 2,
textWidth, 2);
SwingScreen.this.frame.resizeToScreen();
SwingScreen.this.frame.setVisible(true);
}
- } );
+ });
} catch (Exception e) {
e.printStackTrace();
}
if (reallyCleared) {
// Really refreshed, do it all
- if (doubleBuffer) {
+ if (SwingScreen.doubleBuffer) {
Graphics gr = frame.bufferStrategy.getDrawGraphics();
frame.paint(gr);
gr.dispose();
// Repaint the desired area
// System.err.printf("REPAINT X %d %d Y %d %d\n", xMin, xMax,
// yMin, yMax);
- if (doubleBuffer) {
+ if (SwingScreen.doubleBuffer) {
Graphics gr = frame.bufferStrategy.getDrawGraphics();
Rectangle bounds = new Rectangle(xMin, yMin, xMax - xMin,
yMax - yMin);