mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
sets the resized native font in PGraphicsOpenGL, fix #2109
This commit is contained in:
@@ -1900,6 +1900,11 @@ public abstract class PGL {
|
||||
}
|
||||
|
||||
|
||||
protected Object getDerivedFont(Object font, float size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// Tessellator interface
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
package processing.opengl;
|
||||
|
||||
import processing.core.*;
|
||||
|
||||
import java.net.URL;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
@@ -3281,6 +3282,18 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void textSize(float size) {
|
||||
if (textFont == null) defaultFontOrDeath("textSize", size);
|
||||
Object font = textFont.getNative();
|
||||
if (font != null) {
|
||||
Object dfont = pgl.getDerivedFont(font, size);
|
||||
textFont.setNative(dfont);
|
||||
}
|
||||
super.textSize(size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of actual drawing for a line of text.
|
||||
*/
|
||||
|
||||
@@ -968,6 +968,12 @@ public class PJOGL extends PGL {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Object getDerivedFont(Object font, float size) {
|
||||
return ((Font)font).deriveFont(size);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// Tessellator
|
||||
|
||||
@@ -354,6 +354,12 @@ public class PLWJGL extends PGL {
|
||||
FontMetrics metrics = pg.parent.getFontMetrics((Font)font);
|
||||
return metrics.charsWidth(buffer, start, length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Object getDerivedFont(Object font, float size) {
|
||||
return ((Font)font).deriveFont(size);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user