GetCharacterPlacementW() fix

Phil Krylov phil at newstar.rinet.ru
Wed Nov 5 16:44:47 CST 2003


Hello,

ChangeLog:

Phil Krylov <phil at newstar.rinet.ru>
    Added support for returning caret positions from
    GetCharacterPlacementW(). I'm not sure if this will work
    for complex scripts, but still it is better than nothing.

    
--- font.c      15 Oct 2003 03:32:31 -0000      1.107
+++ font.c      5 Nov 2003 22:37:16 -0000
@@ -2008,7 +2008,6 @@ GetCharacterPlacementW(
            lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit);
 
     if(dwFlags&(~GCP_REORDER))                 FIXME("flags 0x%08lx ignored\n", dwFlags);
-    if(lpResults->lpCaretPos)  FIXME("caret positions not implemented\n");
     if(lpResults->lpClass)     FIXME("classes not implemented\n");
 
        nSet = (UINT)uCount;
@@ -2047,6 +2046,27 @@ GetCharacterPlacementW(
                }
        }
 
+    /* FIXME: Will use the same placement chars as for lpResults->lpDx */
+    if (lpResults->lpCaretPos)
+    {
+        int pos = 0;
+       
+        lpResults->lpCaretPos[0] = 0;
+        if (lpResults->lpDx)
+        {
+            for (i = 1; i < nSet; i++)
+                lpResults->lpCaretPos[i] = (pos += lpResults->lpDx[i - 1]);
+        }
+        else
+        {
+            int c;
+          
+            for (i = 1; i < nSet; i++)
+                if (GetCharWidth32W(hdc, lpString[i - 1], lpString[i - 1], &c))
+                    lpResults->lpCaretPos[i] = (pos += c);
+        }
+    }
+   
     if(lpResults->lpGlyphs)
        GetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0);
   

-- 
Best regards,
 Phil                          mailto:phil at newstar.rinet.ru




More information about the wine-patches mailing list