From adbcf0f0c48e9ba90ddfd063e0a4b50a5e2d76bb Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Thu, 10 Aug 2023 18:05:36 -0400 Subject: [PATCH] as with #739, use calculated ascent/descent instead of native metrics (fixes #768) --- core/src/processing/opengl/PGL.java | 4 ++-- core/src/processing/opengl/PGraphicsOpenGL.java | 2 ++ core/src/processing/opengl/PJOGL.java | 2 ++ core/todo.txt | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index c415790f1..8f8418e16 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -2717,10 +2717,10 @@ public abstract class PGL { // TODO: the next three functions shouldn't be here... // Uses 'Object' so that the API can be used w/ Android Typeface objects - abstract protected int getFontAscent(Object font); + // abstract protected int getFontAscent(Object font); - abstract protected int getFontDescent(Object font); + // abstract protected int getFontDescent(Object font); abstract protected int getTextWidth(Object font, char[] buffer, int start, int stop); diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index e9aead681..88164f43e 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -3427,6 +3427,7 @@ public class PGraphicsOpenGL extends PGraphics { // TEXT IMPL + /* @Override public float textAscent() { if (textFont == null) defaultFontOrDeath("textAscent"); @@ -3447,6 +3448,7 @@ public class PGraphicsOpenGL extends PGraphics { if (descent == 0) descent = super.textDescent(); return descent; } + */ @Override diff --git a/core/src/processing/opengl/PJOGL.java b/core/src/processing/opengl/PJOGL.java index cfe58dc9f..849e21193 100644 --- a/core/src/processing/opengl/PJOGL.java +++ b/core/src/processing/opengl/PJOGL.java @@ -475,6 +475,7 @@ public class PJOGL extends PGL { } + /* @Override protected int getFontAscent(Object font) { return getFontMetrics((Font) font).getAscent(); @@ -485,6 +486,7 @@ public class PJOGL extends PGL { protected int getFontDescent(Object font) { return getFontMetrics((Font) font).getDescent(); } + */ @Override diff --git a/core/todo.txt b/core/todo.txt index a2eec8779..b70d71052 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,6 @@ 1294 (4.3.1) +X difference in text position with processing 4.3, JAVA2D vs P2D +X https://github.com/processing/processing4/issues/768 contribs