Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/gdi32/font.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 8788426a2c..cc366eb4d7 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -3309,6 +3309,7 @@ GetCharacterPlacementW( DWORD ret=0; SIZE size; UINT i, nSet; + WCHAR *norm = NULL;
TRACE("%s, %d, %d, 0x%08x\n", debugstr_wn(lpString, uCount), uCount, nMaxExtent, dwFlags); @@ -3325,13 +3326,32 @@ GetCharacterPlacementW( lpResults->lpDx, lpResults->lpCaretPos, lpResults->lpClass, lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit);
- if(dwFlags&(~GCP_REORDER)) + if (dwFlags & ~(GCP_REORDER | GCP_LIGATE)) FIXME("flags 0x%08x ignored\n", dwFlags); if(lpResults->lpClass) FIXME("classes not implemented\n"); if (lpResults->lpCaretPos && (dwFlags & GCP_REORDER)) FIXME("Caret positions for complex scripts not implemented\n");
+ if (dwFlags & GCP_LIGATE) + { + nSet = NormalizeString(NormalizationC, lpString, uCount, NULL, 0); + if (!nSet) return 0; + norm = heap_alloc(nSet * sizeof(WCHAR)); + if (!norm) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + if (!NormalizeString(NormalizationC, lpString, uCount, norm, nSet)) + { + heap_free(norm); + return 0; + } + lpString = norm; + uCount = nSet; + } + nSet = (UINT)uCount; if(nSet > lpResults->nGlyphs) nSet = lpResults->nGlyphs; @@ -3385,6 +3405,8 @@ GetCharacterPlacementW( if (GetTextExtentPoint32W(hdc, lpString, uCount, &size)) ret = MAKELONG(size.cx, size.cy);
+ heap_free(norm); + return ret; }
Hi Dmitry,
On Thu, Jun 18, 2020 at 05:46:36PM +0800, Dmitry Timoshkov wrote:
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru
dlls/gdi32/font.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 8788426a2c..cc366eb4d7 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -3309,6 +3309,7 @@ GetCharacterPlacementW( DWORD ret=0; SIZE size; UINT i, nSet;
WCHAR *norm = NULL;
TRACE("%s, %d, %d, 0x%08x\n", debugstr_wn(lpString, uCount), uCount, nMaxExtent, dwFlags);
@@ -3325,13 +3326,32 @@ GetCharacterPlacementW( lpResults->lpDx, lpResults->lpCaretPos, lpResults->lpClass, lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit);
- if(dwFlags&(~GCP_REORDER))
if (dwFlags & ~(GCP_REORDER | GCP_LIGATE)) FIXME("flags 0x%08x ignored\n", dwFlags); if(lpResults->lpClass) FIXME("classes not implemented\n"); if (lpResults->lpCaretPos && (dwFlags & GCP_REORDER)) FIXME("Caret positions for complex scripts not implemented\n");
if (dwFlags & GCP_LIGATE)
{
nSet = NormalizeString(NormalizationC, lpString, uCount, NULL, 0);
if (!nSet) return 0;
norm = heap_alloc(nSet * sizeof(WCHAR));
if (!norm)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0;
}
if (!NormalizeString(NormalizationC, lpString, uCount, norm, nSet))
{
heap_free(norm);
return 0;
}
lpString = norm;
uCount = nSet;
}
This won't work very well if the ligature glyph doesn't exist in the font.
I suspect what you're supposed to do is to use font's gsub table to find glyphs to combine rather than use Unicode normalization.
Huw.
Huw Davies huw@codeweavers.com wrote:
This won't work very well if the ligature glyph doesn't exist in the font.
I suspect what you're supposed to do is to use font's gsub table to find glyphs to combine rather than use Unicode normalization.
Thanks for the review. What do you think if I skip this patch and resend 2/2 alone? Are there any suggestions regarding that one?
On 18 Jun 2020, at 15:00, Dmitry Timoshkov dmitry@baikal.ru wrote:
Huw Davies huw@codeweavers.com wrote:
This won't work very well if the ligature glyph doesn't exist in the font.
I suspect what you're supposed to do is to use font's gsub table to find glyphs to combine rather than use Unicode normalization.
Thanks for the review. What do you think if I skip this patch and resend 2/2 alone? Are there any suggestions regarding that one?
Hi Dmitry,
Yes, please do that. On first look it seems fine.
Thanks, Huw.