mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[LPK] Make GetCharacterPlacement caret positions respect bidi. (#842)
- Try to make use of ScriptStringCPtoX when trying to fill the lpCaretPos struct member; if USP10 error happens fallback to the unreorder method. - Remove now incorrect debug print.
This commit is contained in:
parent
a244e4f6dd
commit
ab5fdcc01f
|
@ -460,7 +460,12 @@ BOOL BIDI_Reorder(
|
|||
|
||||
if (lpGlyphs)
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
/* ReactOS r57677 and r57679 */
|
||||
cMaxGlyphs = 3 * uCount / 2 + 16;
|
||||
#else
|
||||
cMaxGlyphs = 1.5 * uCount + 16;
|
||||
#endif
|
||||
run_glyphs = HeapAlloc(GetProcessHeap(),0,sizeof(WORD) * cMaxGlyphs);
|
||||
if (!run_glyphs)
|
||||
{
|
||||
|
|
|
@ -134,9 +134,11 @@ LpkGetCharacterPlacement(
|
|||
DWORD dwFlags,
|
||||
DWORD dwUnused)
|
||||
{
|
||||
DWORD ret = 0;
|
||||
HRESULT hr;
|
||||
SCRIPT_STRING_ANALYSIS ssa;
|
||||
LPWORD lpGlyphs = NULL;
|
||||
SIZE size;
|
||||
DWORD ret = 0;
|
||||
UINT nSet, i;
|
||||
INT cGlyphs;
|
||||
|
||||
|
@ -190,16 +192,36 @@ LpkGetCharacterPlacement(
|
|||
}
|
||||
}
|
||||
|
||||
/* FIXME: Currently not bidi compliant! */
|
||||
if (lpResults->lpCaretPos)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
lpResults->lpCaretPos[0] = 0;
|
||||
for (i = 1; i < nSet; i++)
|
||||
hr = ScriptStringAnalyse(hdc, lpString, nSet,
|
||||
#ifdef __REACTOS__
|
||||
/* ReactOS r57677 and r57679 */
|
||||
(3 * nSet / 2 + 16),
|
||||
#else
|
||||
(1.5 * nSet + 16),
|
||||
#endif
|
||||
-1, SSA_GLYPHS, -1,
|
||||
NULL, NULL, NULL, NULL, NULL, &ssa);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size))
|
||||
lpResults->lpCaretPos[i] = (pos += size.cx);
|
||||
for (i = 0; i < nSet; i++)
|
||||
{
|
||||
if (ScriptStringCPtoX(ssa, i, FALSE, &pos) == S_OK)
|
||||
lpResults->lpCaretPos[i] = pos;
|
||||
}
|
||||
ScriptStringFree(&ssa);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpResults->lpCaretPos[0] = 0;
|
||||
for (i = 1; i < nSet; i++)
|
||||
{
|
||||
if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size))
|
||||
lpResults->lpCaretPos[i] = (pos += size.cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -450,8 +450,6 @@ GetCharacterPlacementW(
|
|||
|
||||
if (dwFlags&(~GCP_REORDER)) DPRINT("flags 0x%08lx ignored\n", dwFlags);
|
||||
if (lpResults->lpClass) DPRINT("classes not implemented\n");
|
||||
if (lpResults->lpCaretPos && (dwFlags & GCP_REORDER))
|
||||
DPRINT("Caret positions for complex scripts not implemented\n");
|
||||
|
||||
nSet = (UINT)uCount;
|
||||
if (nSet > lpResults->nGlyphs)
|
||||
|
|
Loading…
Reference in a new issue