mediatracker.addImage(img, 1);
try { mediatracker.waitForAll(); } catch (InterruptedException e) { }
mediatracker.removeImage(img);
- this.i = img;
+ synchronized(AWTPixelBuffer.class) {
+ if (AWTPixelBuffer.component == null) {
+ AWTPixelBuffer.component = new Frame();
+ AWTPixelBuffer.component.setVisible(false);
+ AWTPixelBuffer.component.addNotify();
+ }
+ }
+ this.i = AWTPixelBuffer.component.createImage(w, h);
+ this.i.getGraphics().drawImage(img, 0, 0, null);
}
}
_user_info[6] = (char*)face->glyph->bitmap.width;
_user_info[7] = (char*)face->glyph->bitmap.rows;
_user_info[8] = (char*)(face->size->metrics.ascender >> 6);
- _user_info[9] = (char*)(face->size->metrics.height >> 6);
+ _user_info[9] = (char*)(face->size->metrics.descender >> 6);
_user_info[10] = (char*)(face->glyph->metrics.horiBearingY >> 6);
_user_info[11] = (char*)(face->glyph->advance.x >> 6);
Glyph glyph = new Glyph();
glyph.max_ascent = vm.getUserInfo(8);
- glyph.max_descent = vm.getUserInfo(9) - glyph.max_ascent;
+ glyph.max_descent = vm.getUserInfo(9);
glyph.baseline = vm.getUserInfo(10);
glyph.advance = vm.getUserInfo(11);
glyph.c = (char)g;
int width = vm.getUserInfo(6);
int height = vm.getUserInfo(7);
- byte[] data = new byte[width * height];
- int addr = vm.getUserInfo(5);
- vm.copyin(addr,data,width*height);
-
- /*for(int i=0; i<width * height; i += 4) {
- int val = vm.memRead(addr + i);
- for (int k = 3; k >= 0; k--) {
- if (i + k < width * height)
- data[i + k] = (val & 0xff) << 24;
- val >>>= 8;
- }
- }*/
-
- glyph.p = Platform.createAlphaOnlyPicture(data, width, height);
+ if (width == 0 || height == 0) {
+ Log.log(Freetype.class, "warning glyph " + g + " has zero width/height");
+
+ } else {
+ byte[] data = new byte[width * height];
+ int addr = vm.getUserInfo(5);
+ vm.copyin(addr,data,width*height);
+ glyph.p = Platform.createAlphaOnlyPicture(data, width, height);
+ }
+
glyphCache.put(res, new Integer((g << 16) | pointsize), glyph);
}
} catch (Exception e) {