[1/3] wineps.drv: Avoid marking composite unicode subglyphs as downloaded (resend)

Daniel Horn danielrh at dropbox.com
Mon Sep 8 23:18:51 CDT 2014


-------------- next part --------------
From 006690696232d65f147a54aa87fd357980e82d38 Mon Sep 17 00:00:00 2001
From: Daniel Reiter Horn <danielrh at dropbox.com>
Date: Thu, 4 Sep 2014 21:35:02 +0000
Subject: [PATCH 1/3] Avoid marking composite unicode subglyphs as downloaded
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes a bug with caching composite unicode glyphs (if a ñ came before any n in the document,
then all subsequent n's would appear as a box)
This was because the glyph was marked as having been sent down when it was only a component
of a more complex glyph
---
 dlls/wineps.drv/download.c |  4 ++--
 dlls/wineps.drv/psdrv.h    |  2 +-
 dlls/wineps.drv/type42.c   | 10 ++++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c
index e5b57f7..d3e818e 100644
--- a/dlls/wineps.drv/download.c
+++ b/dlls/wineps.drv/download.c
@@ -343,7 +343,7 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev, BOOL vertical)
         if(pdl->type == Type42) {
             char g_name[MAX_G_NAME + 1];
             get_glyph_name(dev->hdc, 0, g_name);
-            T42_download_glyph(dev, pdl, 0, g_name);
+            T42_download_glyph(dev, pdl, 0, g_name, TRUE);
         }
     }
 
@@ -384,7 +384,7 @@ BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, const WORD *glyphs,
     case Type42:
     for(i = 0; i < count; i++) {
         get_glyph_name(dev->hdc, glyphs[i], g_name);
-	T42_download_glyph(dev, physDev->font.fontinfo.Download, glyphs[i], g_name);
+	T42_download_glyph(dev, physDev->font.fontinfo.Download, glyphs[i], g_name, TRUE);
 	PSDRV_WriteGlyphShow(dev, g_name);
     }
     break;
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index faefd71..4198716 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -566,7 +566,7 @@ extern void T1_free(TYPE1 *t1) DECLSPEC_HIDDEN;
 extern TYPE42 *T42_download_header(PHYSDEV dev, char *ps_name,
                                    RECT *bbox, UINT emsize) DECLSPEC_HIDDEN;
 extern BOOL T42_download_glyph(PHYSDEV dev, DOWNLOAD *pdl,
-			       DWORD index, char *glyph_name) DECLSPEC_HIDDEN;
+			       DWORD index, char *glyph_name, BOOL cache_font_as_downloaded) DECLSPEC_HIDDEN;
 extern void T42_free(TYPE42 *t42) DECLSPEC_HIDDEN;
 
 extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
diff --git a/dlls/wineps.drv/type42.c b/dlls/wineps.drv/type42.c
index c0cda50..8e23c43 100644
--- a/dlls/wineps.drv/type42.c
+++ b/dlls/wineps.drv/type42.c
@@ -280,7 +280,7 @@ TYPE42 *T42_download_header(PHYSDEV dev, char *ps_name,
 
 
 BOOL T42_download_glyph(PHYSDEV dev, DOWNLOAD *pdl, DWORD index,
-			char *glyph_name)
+                        char *glyph_name, BOOL cache_font_as_downloaded)
 {
     DWORD start, end, i;
     char *buf;
@@ -327,7 +327,7 @@ BOOL T42_download_glyph(PHYSDEV dev, DOWNLOAD *pdl, DWORD index,
 
 	    TRACE("Sending subglyph %04x for glyph %04x\n", sg_index, index);
 	    get_glyph_name(dev->hdc, sg_index, sg_name);
-	    T42_download_glyph(dev, pdl, sg_index, sg_name);
+	    T42_download_glyph(dev, pdl, sg_index, sg_name, FALSE);
 	    sg_start += 4;
 	    if(sg_flags & ARG_1_AND_2_ARE_WORDS)
 	        sg_start += 4;
@@ -363,8 +363,10 @@ BOOL T42_download_glyph(PHYSDEV dev, DOWNLOAD *pdl, DWORD index,
     PSDRV_WriteSpool(dev, ">\n", 2);
     sprintf(buf, glyph_def, pdl->ps_name, index, glyph_name, index);
     PSDRV_WriteSpool(dev, buf, strlen(buf));
-
-    t42->glyph_sent[index] = TRUE;
+    if (cache_font_as_downloaded) { /* while making composite glyphs don't
+                                       record as having sent each subglyph */
+        t42->glyph_sent[index] = TRUE;
+    }
     HeapFree(GetProcessHeap(), 0, buf);
     return TRUE;
 }
-- 
1.8.4.2



More information about the wine-patches mailing list