fixes for textFontNative, tests for launcher

This commit is contained in:
benfry
2005-10-20 20:04:02 +00:00
parent 0004b3faa8
commit b2c46f17ee
5 changed files with 13 additions and 5 deletions

View File

@@ -197,7 +197,8 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
loaddir, loaddir, loaddir, loaddir,
env_classpath);
//MessageBox(NULL, cp, "it's twoo! it's twoo!", MB_OK);
//MessageBox(NULL, qtjava_path, "qtjava", MB_OK);
//MessageBox(NULL, cp, "cp outgoing", MB_OK);
if (!SetEnvironmentVariable("CLASSPATH", cp)) {
MessageBox(NULL, "Could not set CLASSPATH environment variable",

View File

@@ -1736,8 +1736,9 @@ public class PGraphics extends PImage implements PConstants {
public void textFont(PFont which) {
if (which != null) {
textFont = which;
textSize(which.size);
textFontNative = which.font;
textFontNativeMetrics = null;
textSize(which.size);
} else {
throw new RuntimeException("a null PFont was passed to textFont()");

View File

@@ -679,20 +679,23 @@ public class PGraphics2 extends PGraphics {
* will get recorded properly.
*/
public void textSize(float size) {
// take care of setting the textSize and textLeading vars
super.textSize(size);
// if a native version available, subset this font
if (textFontNative != null) {
textFontNative = textFontNative.deriveFont(size);
g2.setFont(textFontNative);
textFontNativeMetrics = g2.getFontMetrics(textFontNative);
}
// take care of setting the textSize and textLeading vars
// this has to happen second, because it calls textAscent()
// (which requires the native font metrics to be set)
super.textSize(size);
}
protected float textWidthImpl(char buffer[], int start, int stop) {
if (textFontNative == null) {
//System.out.println("native is null");
return super.textWidthImpl(buffer, start, stop);
}
// maybe should use one of the newer/fancier functions for this?

View File

@@ -54,7 +54,10 @@ _ and i don't want an additional "pathVertex()" function
_ "this file is named" errors don't like subdirectories
_ need to strip off past the file separator or something
_ stop() not getting called
_ http://dev.processing.org/bugs/show_bug.cgi?id=183
_ major problem for libraries
_ and start() is supposedly called by the applet viewer
_ http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#start()
_ need to track this stuff down a bit