]> www.fi.muni.cz Git - evince.git/commitdiff
Fix T1 font rendering in dvi backend. Patch by Mattias Nissler.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 14 Apr 2008 18:58:00 +0000 (18:58 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Mon, 14 Apr 2008 18:58:00 +0000 (18:58 +0000)
2008-04-14  Carlos Garcia Campos  <carlosgc@gnome.org>

* backend/dvi/mdvi-lib/bitmap.[ch]: (bitmap_convert_lsb8),
(bitmap_convert_msb8):
* backend/dvi/mdvi-lib/t1.c: (t1_glyph_bitmap):
* backend/dvi/mdvi-lib/tt.c: (tt_get_bitmap):

Fix T1 font rendering in dvi backend. Patch by Mattias Nissler.

svn path=/trunk/; revision=3006

ChangeLog
backend/dvi/mdvi-lib/bitmap.c
backend/dvi/mdvi-lib/bitmap.h
backend/dvi/mdvi-lib/t1.c
backend/dvi/mdvi-lib/tt.c

index 568aa5c0ec54399a788520cca76f3f9512c774c1..ab66018343ae52ab872ec96195593ed61ed466fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-04-14  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * backend/dvi/mdvi-lib/bitmap.[ch]: (bitmap_convert_lsb8),
+       (bitmap_convert_msb8):
+       * backend/dvi/mdvi-lib/t1.c: (t1_glyph_bitmap):
+       * backend/dvi/mdvi-lib/tt.c: (tt_get_bitmap):
+
+       Fix T1 font rendering in dvi backend. Patch by Mattias Nissler.
+       
 2008-04-14  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * shell/ev-jobs.[ch]: (ev_job_render_dispose),
index 0c598209ade98950bf1a3cc8a9c6ed4766aac921..3b16042d5c193fe5ac0c1fe1fbe76568f3a2bc5e 100644 (file)
@@ -125,7 +125,7 @@ static Uchar bit_swap[] = {
  * hopelessly slow.
  */
 
-BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h)
+BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride)
 {
        BITMAP  *bm;
        int     i;
@@ -147,12 +147,13 @@ BITMAP    *bitmap_convert_lsb8(Uchar *bits, int w, int h)
        for(i = 0; i < h; i++) {
 #ifdef WORD_LITTLE_ENDIAN
                memcpy(unit, curr, bytes);
-               curr += bytes;
+               curr += stride;
 #else
                int     j;
                
                for(j = 0; j < bytes; curr++, j++)
                        unit[j] = bit_swap[*curr];
+               cur += stride - bytes;
 #endif
                memzero(unit + bytes, bm->stride - bytes);
                unit  += bm->stride;
@@ -162,7 +163,7 @@ BITMAP      *bitmap_convert_lsb8(Uchar *bits, int w, int h)
        return bm;
 }
 
-BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h)
+BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride)
 {
        BITMAP  *bm;
        Uchar   *unit;
@@ -180,9 +181,10 @@ BITMAP     *bitmap_convert_msb8(Uchar *data, int w, int h)
                
                for(j = 0; j < bytes; curr++, j++)
                        unit[j] = bit_swap[*curr];
+               curr += stride - bytes;
 #else
                memcpy(unit, curr, bytes);
-               curr += bytes;
+               curr += stride;
 #endif
                memzero(unit + bytes, bm->stride - bytes);
                unit += bm->stride;
index 4d5f23ace96b6792152b2d2e0b2d2982d9047a76..692cb3987cce0cb41b7f89a5fccdec78e0d1b901 100644 (file)
@@ -136,8 +136,8 @@ extern void bitmap_rotate_clockwise __PROTO((BITMAP *));
 extern void bitmap_rotate_counter_clockwise __PROTO((BITMAP *));
 extern void bitmap_flip_rotate_clockwise __PROTO((BITMAP *));
 extern void bitmap_flip_rotate_counter_clockwise __PROTO((BITMAP *));
-extern BITMAP *bitmap_convert_lsb8 __PROTO((Uchar *, int, int));
-extern BITMAP *bitmap_convert_msb8 __PROTO((Uchar *, int, int));
+extern BITMAP *bitmap_convert_lsb8 __PROTO((Uchar *, int, int, int));
+extern BITMAP *bitmap_convert_msb8 __PROTO((Uchar *, int, int, int));
 
 #include <stdio.h>
 extern void    bitmap_print __PROTO((FILE *, BITMAP *));
index 1e96f3e85aa53babb079617812ab744765fef2ad..e7cd4f80f4bd9fcbd443258c5ad940a59cea9f49 100644 (file)
@@ -437,25 +437,16 @@ static int t1_load_font(DviParams *params, DviFont *font)
 
 static inline BITMAP *t1_glyph_bitmap(GLYPH *glyph)
 {
-       BITMAP  *bm;
-       int     w, h;
+       int     w, h, pad;
        
        w = GLYPH_WIDTH(glyph);
        h = GLYPH_HEIGHT(glyph);
 
        if(!w || !h)
                return MDVI_GLYPH_EMPTY;
-       switch(glyph->bpp << 3) {
-               case 8: 
-                       bm = bitmap_convert_lsb8((unsigned char *)glyph->bits, w, h);
-                       break;
-               default:
-                       warning(_("(t1) unsupported bitmap pad size %d\n"),
-                               glyph->bpp);
-                       bm = MDVI_GLYPH_EMPTY;
-                       break;
-       }
-       return bm;
+
+       pad = T1_GetBitmapPad();
+       return bitmap_convert_lsb8((unsigned char *)glyph->bits, w, h, ROUND(w, pad) * (pad >> 3));
 }
 
 static void t1_font_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch, DviGlyph *dest)
index e383006b7e7aa850e805b520a5064a51f2a0344d..ab096d30a23889a58c74937adf041d8f8a33b826 100644 (file)
@@ -382,7 +382,7 @@ static int tt_get_bitmap(DviParams *params, DviFont *font,
        
        TT_Translate_Outline(&outline, -bbox.xMin, -bbox.yMin);
        TT_Get_Outline_Bitmap(tt_handle, &outline, &raster);
-       glyph->data = bitmap_convert_msb8(raster.bitmap, w, h);
+       glyph->data = bitmap_convert_msb8(raster.bitmap, w, h, ROUND(w, 8));
        TT_Done_Outline(&outline);
        mdvi_free(raster.bitmap);