[PATCH 1/2] gdi32: Add support for GCP_LIGATE to GetCharacterPlacement.

Huw Davies huw at codeweavers.com
Thu Jun 18 07:36:27 CDT 2020


Hi Dmitry,

On Thu, Jun 18, 2020 at 05:46:36PM +0800, Dmitry Timoshkov wrote:
> Signed-off-by: Dmitry Timoshkov <dmitry at 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.



More information about the wine-devel mailing list