From c3e7042fe389956ead1d7a55ab640c595dd50e8d Mon Sep 17 00:00:00 2001 From: George Bateman Date: Wed, 29 Jan 2014 14:49:37 +0000 Subject: [PATCH] PGraphicsJava2D.java - textWidthImpl * `textWidthImpl(char[],int,int)` can now use the default font. * `textDescent()` and `textSize()` identify themselves correctly to `defaultFontOrDeath`. --- core/src/processing/core/PGraphicsJava2D.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/processing/core/PGraphicsJava2D.java b/core/src/processing/core/PGraphicsJava2D.java index cb47ee7e1..1df5e5a46 100644 --- a/core/src/processing/core/PGraphicsJava2D.java +++ b/core/src/processing/core/PGraphicsJava2D.java @@ -1564,7 +1564,7 @@ public class PGraphicsJava2D extends PGraphics { @Override public float textDescent() { if (textFont == null) { - defaultFontOrDeath("textAscent"); + defaultFontOrDeath("textDescent"); } Font font = (Font) textFont.getNative(); //if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { @@ -1603,7 +1603,7 @@ public class PGraphicsJava2D extends PGraphics { @Override public void textSize(float size) { if (textFont == null) { - defaultFontOrDeath("textAscent", size); + defaultFontOrDeath("textSize", size); } // if a native version available, derive this font @@ -1635,6 +1635,10 @@ public class PGraphicsJava2D extends PGraphics { @Override protected float textWidthImpl(char buffer[], int start, int stop) { + if (textFont == null) { + defaultFontOrDeath("textWidth"); + } + Font font = (Font) textFont.getNative(); //if (font != null && (textFont.isStream() || hints[ENABLE_NATIVE_FONTS])) { if (font != null) {