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