X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2FFTFont.cc;h=8de09e0e61046f3cbe482c375b6ce8b7c6047143;hb=28c37dbcf87665a4ccec58bef9ef8ff0697022dd;hp=0524c7edc135c4d057bc3e0e9e846572420334cf;hpb=6112dfe4b45b0305c7a6f61bd8a847f69f892cbb;p=evince.git diff --git a/pdf/xpdf/FTFont.cc b/pdf/xpdf/FTFont.cc index 0524c7ed..8de09e0e 100644 --- a/pdf/xpdf/FTFont.cc +++ b/pdf/xpdf/FTFont.cc @@ -6,14 +6,14 @@ // //======================================================================== -#ifdef __GNUC__ -#pragma implementation -#endif - #include #if FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H) +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include #include #include "gmem.h" @@ -261,15 +261,11 @@ FTFont::FTFont(FTFontFile *fontFileA, double *m) { yMax = (int)(1.2 * size); } // this should be (max - min + 1), but we add some padding to - // deal with rounding errors + // deal with rounding errors, bogus bboxes, etc. glyphW = xMax - xMin + 3; + glyphW += glyphW >> 1; glyphH = yMax - yMin + 3; - // another kludge: some CJK TT fonts have bogus bboxes, so add more - // padding - if (face->num_glyphs > 1000) { - glyphW += glyphW >> 1; - glyphH += glyphH >> 1; - } + glyphH += glyphH >> 1; if (engine->aa) { glyphSize = glyphW * glyphH; } else { @@ -444,9 +440,9 @@ Guchar *FTFont::getGlyphPixmap(CharCode c, Unicode u, int *x, int *y, int *w, int *h) { FT_GlyphSlot slot; FT_UInt idx; - int gSize; + int rowSize; int i, j, k; - Guchar *ret; + Guchar *ret, *p, *q; // check the cache i = (c & (cacheSets - 1)) * cacheAssoc; @@ -516,12 +512,16 @@ Guchar *FTFont::getGlyphPixmap(CharCode c, Unicode u, cacheTags[i+j].w = *w; cacheTags[i+j].h = *h; if (fontFile->engine->aa) { - gSize = *w * *h; + rowSize = *w; } else { - gSize = ((*w + 7) >> 3) * *h; + rowSize = (*w + 7) >> 3; } ret = cache + (i+j) * glyphSize; - memcpy(ret, slot->bitmap.buffer, gSize); + for (k = 0, p = ret, q = slot->bitmap.buffer; + k < slot->bitmap.rows; + ++k, p += rowSize, q += slot->bitmap.pitch) { + memcpy(p, q, rowSize); + } } else { ++cacheTags[i+j].mru; }