Alexandre Julliard : wineps: Support getting character codes instead of glyphs in ExtTextOut.

Alexandre Julliard julliard at winehq.org
Wed Dec 5 13:43:10 CST 2012


Module: wine
Branch: master
Commit: 55353027581472ea0ce1add7940e5fa43373236d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=55353027581472ea0ce1add7940e5fa43373236d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec  5 17:23:49 2012 +0100

wineps: Support getting character codes instead of glyphs in ExtTextOut.

---

 dlls/wineps.drv/download.c |    2 +-
 dlls/wineps.drv/psdrv.h    |    2 +-
 dlls/wineps.drv/text.c     |   15 ++++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/wineps.drv/download.c b/dlls/wineps.drv/download.c
index f984225..5163cef 100644
--- a/dlls/wineps.drv/download.c
+++ b/dlls/wineps.drv/download.c
@@ -366,7 +366,7 @@ void get_glyph_name(HDC hdc, WORD index, char *name)
  *  Download and write out a number of glyphs
  *
  */
-BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glyphs,
+BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, const WORD *glyphs,
 				  UINT count)
 {
     PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index 1e76bef..bfc2ad6 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -539,7 +539,7 @@ extern BOOL PSDRV_WriteBuiltinGlyphShow(PHYSDEV dev, LPCWSTR str, INT count) DEC
 
 extern BOOL PSDRV_SelectDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN;
 extern BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev) DECLSPEC_HIDDEN;
-extern BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glpyhs, UINT count) DECLSPEC_HIDDEN;
+extern BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, const WORD *glpyhs, UINT count) DECLSPEC_HIDDEN;
 extern BOOL PSDRV_EmptyDownloadList(PHYSDEV dev, BOOL write_undef) DECLSPEC_HIDDEN;
 
 extern DWORD write_spool( PHYSDEV dev, const void *data, DWORD num ) DECLSPEC_HIDDEN;
diff --git a/dlls/wineps.drv/text.c b/dlls/wineps.drv/text.c
index a35945a..6b5fe45 100644
--- a/dlls/wineps.drv/text.c
+++ b/dlls/wineps.drv/text.c
@@ -100,14 +100,18 @@ static BOOL PSDRV_Text(PHYSDEV dev, INT x, INT y, UINT flags, LPCWSTR str,
     if (!count)
 	return TRUE;
 
-    if(physDev->font.fontloc == Download)
-        glyphs = (LPWORD)str;
+    if(physDev->font.fontloc == Download && !(flags & ETO_GLYPH_INDEX))
+    {
+        glyphs = HeapAlloc( GetProcessHeap(), 0, count * sizeof(WORD) );
+        GetGlyphIndicesW( dev->hdc, str, count, glyphs, 0 );
+        str = glyphs;
+    }
 
     PSDRV_WriteMoveTo(dev, x, y);
 
     if(!lpDx) {
         if(physDev->font.fontloc == Download)
-	    PSDRV_WriteDownloadGlyphShow(dev, glyphs, count);
+	    PSDRV_WriteDownloadGlyphShow(dev, str, count);
 	else
 	    PSDRV_WriteBuiltinGlyphShow(dev, str, count);
     }
@@ -117,7 +121,7 @@ static BOOL PSDRV_Text(PHYSDEV dev, INT x, INT y, UINT flags, LPCWSTR str,
 
         for(i = 0; i < count-1; i++) {
 	    if(physDev->font.fontloc == Download)
-	        PSDRV_WriteDownloadGlyphShow(dev, glyphs + i, 1);
+	        PSDRV_WriteDownloadGlyphShow(dev, str + i, 1);
 	    else
 	        PSDRV_WriteBuiltinGlyphShow(dev, str + i, 1);
             if(flags & ETO_PDY)
@@ -130,10 +134,11 @@ static BOOL PSDRV_Text(PHYSDEV dev, INT x, INT y, UINT flags, LPCWSTR str,
 	    PSDRV_WriteMoveTo(dev, x + offset.x, y + offset.y);
 	}
 	if(physDev->font.fontloc == Download)
-	    PSDRV_WriteDownloadGlyphShow(dev, glyphs + i, 1);
+	    PSDRV_WriteDownloadGlyphShow(dev, str + i, 1);
 	else
 	    PSDRV_WriteBuiltinGlyphShow(dev, str + i, 1);
     }
 
+    HeapFree( GetProcessHeap(), 0, glyphs );
     return TRUE;
 }




More information about the wine-cvs mailing list