Skip to content

Commit fcbf0f6

Browse files
committed
fix two bugs with new font creation code
1 parent a31d6ce commit fcbf0f6

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

core/src/processing/core/PFont.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public PFont(Font font, boolean smooth, char charset[]) {
172172
size = font.getSize();
173173

174174
// no, i'm not interested in getting off the couch
175-
lazy = true;
175+
//lazy = true;
176176
// not sure what else to do here
177177
//mbox2 = 0;
178178

@@ -206,7 +206,10 @@ public PFont(Font font, boolean smooth, char charset[]) {
206206
//ascent = lazyMetrics.getAscent();
207207
//descent = lazyMetrics.getDescent();
208208

209-
if (charset != null) {
209+
if (charset == null) {
210+
lazy = true;
211+
212+
} else {
210213
// charset needs to be sorted to make index lookup run more quickly
211214
// http://dev.processing.org/bugs/show_bug.cgi?id=494
212215
Arrays.sort(charset);
@@ -216,7 +219,11 @@ public PFont(Font font, boolean smooth, char charset[]) {
216219
glyphCount = 0;
217220
for (char c : charset) {
218221
if (font.canDisplay(c)) {
219-
glyphs[glyphCount++] = new Glyph(c);
222+
Glyph glyf = new Glyph(c);
223+
if (glyf.value < 128) {
224+
ascii[glyf.value] = glyphCount;
225+
}
226+
glyphs[glyphCount++] = glyf;
220227
}
221228
}
222229

@@ -506,7 +513,7 @@ protected int index(char c) {
506513
if (font.canDisplay(c)) {
507514
// create the glyph
508515
addGlyph(c);
509-
// now where did i put that?
516+
// now where did i put that?
510517
return indexActual(c);
511518

512519
} else {

0 commit comments

Comments
 (0)