From: megacz Date: Fri, 30 Jan 2004 07:39:36 +0000 (+0000) Subject: 2003/10/17 07:20:15 X-Git-Tag: RC3~459 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=31aeacd9a704133e2c74f42a46fb6798a447ce40 2003/10/17 07:20:15 darcs-hash:20040130073936-2ba56-271739e125693d8a51b78c1901e43e4f60b01cd7.gz --- diff --git a/src/org/xwt/Glyph.java b/src/org/xwt/Glyph.java index e998845..6088717 100644 --- a/src/org/xwt/Glyph.java +++ b/src/org/xwt/Glyph.java @@ -25,6 +25,6 @@ public class Glyph { ret = (Glyph)glyphCache.get(res, new Integer((((int)c) << 16) | pointsize)); if (ret != null) return ret; - throw new JS.Exn("error rendering glyph " + c); + throw new JS.Exn("error rendering glyph " + c + "; glyph is null"); } } diff --git a/src/org/xwt/plat/AWT.java b/src/org/xwt/plat/AWT.java index 3dfd153..771bdbb 100644 --- a/src/org/xwt/plat/AWT.java +++ b/src/org/xwt/plat/AWT.java @@ -131,7 +131,15 @@ public class AWT extends JVM { 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); } } diff --git a/src/org/xwt/translators/Freetype.c b/src/org/xwt/translators/Freetype.c index 03a3fbe..fad6018 100644 --- a/src/org/xwt/translators/Freetype.c +++ b/src/org/xwt/translators/Freetype.c @@ -72,7 +72,7 @@ int main(int argc, char** argv) { _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); diff --git a/src/org/xwt/translators/Freetype.java b/src/org/xwt/translators/Freetype.java index 1608a75..3a7f3ca 100644 --- a/src/org/xwt/translators/Freetype.java +++ b/src/org/xwt/translators/Freetype.java @@ -44,28 +44,24 @@ public class Freetype { 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= 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) {