-
- // store glyph pixmap in cache
- ret = NULL;
- for (j = 0; j < cacheAssoc; ++j) {
- if ((cacheTags[i+j].mru & 0x7fff) == cacheAssoc - 1) {
- cacheTags[i+j].mru = 0x8000;
- cacheTags[i+j].code = c;
- cacheTags[i+j].x = *x;
- cacheTags[i+j].y = *y;
- cacheTags[i+j].w = *w;
- cacheTags[i+j].h = *h;
- if (fontFile->engine->aa) {
- rowSize = *w;
+ if (*w > glyphW || *h > glyphH) {
+ // the glyph doesn't fit in the bounding box -- return a
+ // temporary, uncached bitmap (this shouldn't happen but some
+ // fonts have incorrect bboxes)
+ ret = (Guchar *)gmalloc(*h * rowSize);
+ *tempBitmap = gTrue;
+ } else {
+ // store glyph pixmap in cache
+ ret = NULL; // make gcc happy
+ for (j = 0; j < cacheAssoc; ++j) {
+ if ((cacheTags[i+j].mru & 0x7fff) == cacheAssoc - 1) {
+ cacheTags[i+j].mru = 0x8000;
+ cacheTags[i+j].code = c;
+ cacheTags[i+j].x = *x;
+ cacheTags[i+j].y = *y;
+ cacheTags[i+j].w = *w;
+ cacheTags[i+j].h = *h;
+ ret = cache + (i+j) * glyphSize;