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

@@ -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?