wine/dlls/gdi freetype.c

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 1 05:58:23 CST 2005


ChangeSet ID:	21581
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/12/01 05:58:23

Modified files:
	dlls/gdi       : freetype.c 

Log message:
	Rein Klazes <wijn at wanadoo.nl>
	Make WineEngGetFontData always return the used byte count.

Patch: http://cvs.winehq.org/patch.py?id=21581

Old revision  New revision  Changes     Path
 1.106         1.107         +14 -2      wine/dlls/gdi/freetype.c

Index: wine/dlls/gdi/freetype.c
diff -u -p wine/dlls/gdi/freetype.c:1.106 wine/dlls/gdi/freetype.c:1.107
--- wine/dlls/gdi/freetype.c:1.106	1 Dec 2005 11:58:23 -0000
+++ wine/dlls/gdi/freetype.c	1 Dec 2005 11:58:23 -0000
@@ -3692,9 +3692,15 @@ DWORD WineEngGetFontData(GdiFont font, D
     }
 
     /* If the FT_Load_Sfnt_Table function is there we'll use it */
-    if(pFT_Load_Sfnt_Table)
+    if(pFT_Load_Sfnt_Table) {
+        /* make sure value of len is the value freetype says it needs */ 
+        if( buf && len) {
+            DWORD needed = 0;
+            err = pFT_Load_Sfnt_Table(ft_face, table, offset, NULL, &needed);
+            if( !err && needed < len) len = needed;
+        }
         err = pFT_Load_Sfnt_Table(ft_face, table, offset, buf, &len);
-    else { /* Do it the hard way */
+    } else { /* Do it the hard way */
         TT_Face tt_face = (TT_Face) ft_face;
         SFNT_Interface *sfnt;
         if (FT_Version.major==2 && FT_Version.minor==0)
@@ -3707,6 +3713,12 @@ DWORD WineEngGetFontData(GdiFont font, D
             /* A field was added in the middle of the structure in 2.1.x */
             sfnt = *(SFNT_Interface**)((char*)tt_face + 532);
         }
+        /* make sure value of len is the value freetype says it needs */ 
+        if( buf && len) {
+            DWORD needed = 0;
+            err = sfnt->load_any(tt_face, table, offset, NULL, &needed);
+            if( !err && needed < len) len = needed;
+        }
         err = sfnt->load_any(tt_face, table, offset, buf, &len);
     }
     if(err) {



More information about the wine-cvs mailing list