X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Ftranslators%2FFreetype.java;h=3a7f3cae9bb9f3015e42f899a3010bc76150c22d;hb=31aeacd9a704133e2c74f42a46fb6798a447ce40;hp=1608a750f82216cd52430fa47e0df1db101be386;hpb=4963611978625d087561f5a669a0ba93a04bd1ba;p=org.ibex.core.git 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) {