Updated font kerning
This commit is contained in:
parent
209109d75c
commit
8eeca5ab09
@ -40,7 +40,8 @@ public final class DisplayManager implements RenderingLoop {
|
||||
public String[] errorStackTrace;
|
||||
public final static int[] glyphsHeight;
|
||||
|
||||
public static Screen screen;
|
||||
private static Screen screen;
|
||||
public static Semaphore screenChange = new Semaphore(0);
|
||||
public static String displayDebugString;
|
||||
public static ObjectArrayList<GUIErrorMessage> errorMessages;
|
||||
|
||||
@ -136,6 +137,7 @@ public final class DisplayManager implements RenderingLoop {
|
||||
try {
|
||||
screen.create();
|
||||
DisplayManager.screen = screen;
|
||||
screenChange.release();
|
||||
if (screen.initialized == false) {
|
||||
screen.initialize();
|
||||
}
|
||||
@ -160,6 +162,7 @@ public final class DisplayManager implements RenderingLoop {
|
||||
try {
|
||||
screen.create();
|
||||
DisplayManager.screen = screen;
|
||||
screenChange.release();
|
||||
if (screen.initialized == false) {
|
||||
screen.initialize();
|
||||
}
|
||||
@ -196,6 +199,7 @@ public final class DisplayManager implements RenderingLoop {
|
||||
DisplayManager.currentSession += 1;
|
||||
}
|
||||
DisplayManager.screen = DisplayManager.sessions[DisplayManager.currentSession];
|
||||
screenChange.release();
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,10 +232,11 @@ public final class DisplayManager implements RenderingLoop {
|
||||
DisplayManager.currentSession -= 1;
|
||||
}
|
||||
DisplayManager.screen = DisplayManager.sessions[DisplayManager.currentSession];
|
||||
screenChange.release();
|
||||
}
|
||||
}
|
||||
|
||||
public Screen getScreen() {
|
||||
public static Screen getScreen() {
|
||||
return DisplayManager.screen;
|
||||
}
|
||||
|
||||
@ -353,9 +358,10 @@ public final class DisplayManager implements RenderingLoop {
|
||||
renderer.glColor3i(255, 255, 255);
|
||||
|
||||
if (error != null) {
|
||||
Utils.getFont(false, false).use(engine);
|
||||
BinaryFont fnt = Utils.getFont(false, false);
|
||||
fnt.use(engine);
|
||||
renderer.glColor3i(129, 28, 22);
|
||||
renderer.glDrawStringRight(Main.screenSize[0] - 2, Main.screenSize[1] - DisplayManager.glyphsHeight[1] - 2, "ANDREA CAVALLI'S CALCULATOR");
|
||||
renderer.glDrawStringRight(Main.screenSize[0] - 2, Main.screenSize[1] - (fnt.getCharacterHeight() + 2), Main.calculatorNameUPPER + " CALCULATOR");
|
||||
renderer.glColor3i(149, 32, 26);
|
||||
renderer.glDrawStringCenter((Main.screenSize[0] / 2), 22, error);
|
||||
renderer.glColor3i(164, 34, 28);
|
||||
|
@ -40,7 +40,7 @@ public class BlockChar extends Block {
|
||||
|
||||
@Override
|
||||
public void recomputeDimensions() {
|
||||
width = BlockContainer.getDefaultCharWidth(small);
|
||||
width = BlockContainer.getDefaultCharWidth(small)-1;
|
||||
height = BlockContainer.getDefaultCharHeight(small);
|
||||
line = height / 2;
|
||||
}
|
||||
|
@ -217,7 +217,6 @@ public class BlockVariable extends Block {
|
||||
|
||||
@Override
|
||||
public void draw(GraphicEngine ge, Renderer r, Caret caret) {
|
||||
BlockContainer.getDefaultFont(true).use(ge);
|
||||
r.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
DisplayManager.guiSkin.use(ge);
|
||||
int popupX = location[0];
|
||||
@ -242,6 +241,7 @@ public class BlockVariable extends Block {
|
||||
r.glFillRect(popupX+2, popupY+5+height/2-7/2, 4, 7, 160, 21, 4, 7);
|
||||
r.glFillRect(popupX+width-2-4, popupY+5+height/2-7/2, 4, 7, 172, 21, 4, 7);
|
||||
r.glColor(color);
|
||||
BlockContainer.getDefaultFont(true).use(ge);
|
||||
r.glDrawStringCenter(popupX+width/2, popupY+2+5, text);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.awt.GraphicsEnvironment;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
@ -24,6 +25,7 @@ public class CPUEngine implements GraphicEngine {
|
||||
public final CPURenderer r = new CPURenderer();
|
||||
public BufferedImage g = new BufferedImage(r.size[0], r.size[1], BufferedImage.TYPE_INT_RGB);
|
||||
public volatile boolean initialized = false;
|
||||
public Semaphore exitSemaphore = new Semaphore(0);
|
||||
|
||||
@Override
|
||||
public void setTitle(String title) {
|
||||
@ -88,6 +90,7 @@ public class CPUEngine implements GraphicEngine {
|
||||
@Override
|
||||
public void destroy() {
|
||||
initialized = false;
|
||||
exitSemaphore.release();
|
||||
INSTANCE.setVisible(false);
|
||||
INSTANCE.dispose();
|
||||
}
|
||||
@ -123,7 +126,7 @@ public class CPUEngine implements GraphicEngine {
|
||||
|
||||
@Deprecated()
|
||||
public void refresh() {
|
||||
if (DisplayManager.screen == null || (DisplayManager.error != null && DisplayManager.error.length() > 0) || DisplayManager.screen == null || DisplayManager.screen.mustBeRefreshed()) {
|
||||
if (DisplayManager.getScreen() == null || (DisplayManager.error != null && DisplayManager.error.length() > 0) || DisplayManager.getScreen() == null || DisplayManager.getScreen().mustBeRefreshed()) {
|
||||
INSTANCE.c.repaint();
|
||||
}
|
||||
}
|
||||
@ -175,11 +178,8 @@ public class CPUEngine implements GraphicEngine {
|
||||
@Override
|
||||
public void waitUntilExit() {
|
||||
try {
|
||||
do {
|
||||
Thread.sleep(500);
|
||||
} while (initialized);
|
||||
} catch (final InterruptedException e) {
|
||||
|
||||
exitSemaphore.acquire();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,9 +158,9 @@ public class CPUFont implements BinaryFont {
|
||||
|
||||
@Override
|
||||
public int getStringWidth(String text) {
|
||||
final int w = (charW+1) * text.length();
|
||||
final int w = charW * text.length();
|
||||
if (text.length() > 0 && w > 0) {
|
||||
return w-1;
|
||||
return w;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ public class CPURenderer implements Renderer {
|
||||
int j;
|
||||
final int l = text.length;
|
||||
for (int i = 0; i < l; i++) {
|
||||
cpos = (i * (currentFont.charW + 1));
|
||||
cpos = (i * (currentFont.charW));
|
||||
final int charIndex = text[i];
|
||||
for (int dy = 0; dy < currentFont.charH; dy++) {
|
||||
for (int dx = 0; dx < currentFont.charW; dx++) {
|
||||
|
@ -6,6 +6,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.Utils;
|
||||
@ -25,6 +26,7 @@ public class GPUEngine implements GraphicEngine {
|
||||
private GPURenderer r;
|
||||
int[] size = new int[] { Main.screenSize[0], Main.screenSize[1] };
|
||||
private final CopyOnWriteArrayList<BinaryFont> registeredFonts = new CopyOnWriteArrayList<BinaryFont>();
|
||||
private Semaphore exitSemaphore = new Semaphore(0);
|
||||
|
||||
@Override
|
||||
public int[] getSize() {
|
||||
@ -94,6 +96,7 @@ public class GPUEngine implements GraphicEngine {
|
||||
public void destroy() {
|
||||
initialized = false;
|
||||
created = false;
|
||||
exitSemaphore.release();
|
||||
wnd.window.destroy();
|
||||
}
|
||||
|
||||
@ -128,11 +131,8 @@ public class GPUEngine implements GraphicEngine {
|
||||
@Override
|
||||
public void waitUntilExit() {
|
||||
try {
|
||||
do {
|
||||
Thread.sleep(500);
|
||||
} while (initialized | created);
|
||||
} catch (final InterruptedException e) {
|
||||
|
||||
exitSemaphore.acquire();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,10 +618,7 @@ public class MathInputScreen extends Screen {
|
||||
final ChooseVariableValueScreen cvs = new ChooseVariableValueScreen(this, new VariableValue((Variable) f, new Number(calc, 0)));
|
||||
DisplayManager.INSTANCE.setScreen(cvs);
|
||||
try {
|
||||
while (DisplayManager.screen == cvs) {
|
||||
Utils.out.println(1, Thread.currentThread().getName());
|
||||
Thread.sleep(200);
|
||||
}
|
||||
DisplayManager.screenChange.acquire();
|
||||
} catch (final InterruptedException e) {}
|
||||
if (cvs.resultNumberValue == null) {
|
||||
cancelled = true;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user