Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/FTFont.cc
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2003-03-31 16:45:09 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2003-03-31 16:45:09 (GMT)
commit28c37dbcf87665a4ccec58bef9ef8ff0697022dd (patch)
tree4fd39a6f8e50717677d56ad0bbb520baa77589f0 /pdf/xpdf/FTFont.cc
parent6112dfe4b45b0305c7a6f61bd8a847f69f892cbb (diff)
Import of Xpdf 2.00 for merge
Diffstat (limited to 'pdf/xpdf/FTFont.cc')
-rw-r--r--pdf/xpdf/FTFont.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/pdf/xpdf/FTFont.cc b/pdf/xpdf/FTFont.cc
index 0524c7e..8de09e0 100644
--- a/pdf/xpdf/FTFont.cc
+++ b/pdf/xpdf/FTFont.cc
@@ -6,14 +6,14 @@
//
//========================================================================
-#ifdef __GNUC__
-#pragma implementation
-#endif
-
#include <aconf.h>
#if FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
#include <math.h>
#include <string.h>
#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;
}