GetCharacterPlacementW() fix (second try)

Phil Krylov phil at newstar.rinet.ru
Thu Nov 6 10:32:13 CST 2003


Hello,

This version gives really proper results.

ChangeLog:

Phil Krylov <phil at newstar.rinet.ru>
    Added support for returning caret positions from
    GetCharacterPlacementW(). This does not work for
    complex scripts, but still it is better than nothing.

Index: font.c
===================================================================
RCS file: /home/wine/wine/objects/font.c,v
retrieving revision 1.107
diff -p -u -u -r1.107 font.c
--- font.c      15 Oct 2003 03:32:31 -0000      1.107
+++ font.c      6 Nov 2003 16:22:50 -0000
@@ -1980,7 +1980,7 @@ GetCharacterPlacementA(HDC hdc, LPCSTR l
  *
  *   All flags except GCP_REORDER are not yet implemented.
  *   Reordering is not 100% complient to the Windows BiDi method.
- *   Caret positioning is not yet implemented.
+ *   Caret positioning is not yet implemented for BiDi.
  *   Classes are not yet implemented.
  *
  */
@@ -2008,8 +2008,9 @@ 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");
+    if (lpResults->lpCaretPos && (dwFlags & GCP_REORDER))
+        FIXME("Caret positions for complex scripts not implemented\n");
 
        nSet = (UINT)uCount;
        if(nSet > lpResults->nGlyphs)
@@ -2047,6 +2048,16 @@ GetCharacterPlacementW(
                }
        }
 
+    if (lpResults->lpCaretPos && !(dwFlags & GCP_REORDER))
+    {
+        int pos = 0;
+       
+        lpResults->lpCaretPos[0] = 0;
+        for (i = 1; i < nSet; i++)
+            if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size))
+                lpResults->lpCaretPos[i] = (pos += size.cx);
+    }
+   
     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