as with #739, use calculated ascent/descent instead of native metrics (fixes #768)

This commit is contained in:
Ben Fry
2023-08-10 18:05:36 -04:00
parent 1f303c1db3
commit adbcf0f0c4
4 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -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);
@@ -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
+2
View File
@@ -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
+2
View File
@@ -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