From a05a375104f3a6789f32956ffb1844c6134cd96a Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Fri, 17 Mar 2017 20:41:39 -0400 Subject: [PATCH] set the font, even if not deriving --- core/src/processing/awt/PGraphicsJava2D.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/src/processing/awt/PGraphicsJava2D.java b/core/src/processing/awt/PGraphicsJava2D.java index 44e123c1a..4788de092 100644 --- a/core/src/processing/awt/PGraphicsJava2D.java +++ b/core/src/processing/awt/PGraphicsJava2D.java @@ -1910,15 +1910,17 @@ public class PGraphicsJava2D extends PGraphics { // if a native version available, derive this font Font font = (Font) textFont.getNative(); // don't derive again if the font size has not changed - if (font != null && font.getSize2D() != size) { - Map map = - new HashMap(); - map.put(TextAttribute.SIZE, size); - map.put(TextAttribute.KERNING, - TextAttribute.KERNING_ON); + if (font != null) { + if (font.getSize2D() != size) { + Map map = + new HashMap(); + map.put(TextAttribute.SIZE, size); + map.put(TextAttribute.KERNING, + TextAttribute.KERNING_ON); // map.put(TextAttribute.TRACKING, // TextAttribute.TRACKING_TIGHT); - font = font.deriveFont(map); + font = font.deriveFont(map); + } g2.setFont(font); textFont.setNative(font); fontObject = font;