File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -1246,10 +1246,16 @@ public PShape loadShape(String filename) {
1246
1246
public void textFont (PFont which ) {
1247
1247
super .textFont (which );
1248
1248
fillPaint .setTypeface ((Typeface ) which .getNative ());
1249
+ fillPaint .setTextSize (which .getDefaultSize ());
1249
1250
}
1250
1251
1251
1252
1252
- //public void textFont(PFont which, float size)
1253
+ @ Override
1254
+ public void textFont (PFont which , float size ) {
1255
+ super .textFont (which , size );
1256
+ fillPaint .setTypeface ((Typeface ) which .getNative ());
1257
+ fillPaint .setTextSize (which .getDefaultSize ());
1258
+ }
1253
1259
1254
1260
1255
1261
//public void textLeading(float leading)
@@ -1281,14 +1287,7 @@ public void textSize(float size) {
1281
1287
fillPaint .setTextSize (size );
1282
1288
}
1283
1289
1284
- // take care of setting the textSize and textLeading vars
1285
- // this has to happen second, because it calls textAscent()
1286
- // (which requires the native font metrics to be set)
1287
- textSize = size ;
1288
- // PApplet.println("P2D textSize textAscent -> " + textAscent());
1289
- // PApplet.println("P2D textSize textDescent -> " + textDescent());
1290
- textLeading = (textAscent () + textDescent ()) * 1.275f ;
1291
- // PApplet.println("P2D textSize textLeading = " + textLeading);
1290
+ handleTextSize (size );
1292
1291
}
1293
1292
1294
1293
Original file line number Diff line number Diff line change @@ -3493,7 +3493,7 @@ protected void handleTextSize(float size) {
3493
3493
Object font = textFont .getNative ();
3494
3494
if (font != null ) {
3495
3495
Object dfont = pgl .getDerivedFont (font , size );
3496
- textFont .setNative (dfont );
3496
+ if ( dfont != null ) textFont .setNative (dfont );
3497
3497
}
3498
3498
super .handleTextSize (size );
3499
3499
}
You can’t perform that action at this time.
0 commit comments