[PATCH] usp10: Use single path for all fonts in ScriptGetCMap().

Aric Stewart aric at codeweavers.com
Mon Feb 25 09:10:51 CST 2019


Signed-off-by: Aric Stewart <aric at codeweavers.com>

On 2/22/19 6:52 AM, Nikolay Sivov wrote:
> Testing tmPitchAndFamily bitmask does not tell if font has mappings defined.
> Besides that, GetGlyphIndices() handles bitmap system fonts exactly the same
> way alternate path did.
> 
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46678
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
>   dlls/usp10/usp10.c | 45 +++++++++++++++------------------------------
>   1 file changed, 15 insertions(+), 30 deletions(-)
> 
> diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
> index abc2605919..0a269961b7 100644
> --- a/dlls/usp10/usp10.c
> +++ b/dlls/usp10/usp10.c
> @@ -3544,42 +3544,27 @@ HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars
>   
>       hr = S_OK;
>   
> -    if ((get_cache_pitch_family(psc) & TMPF_TRUETYPE))
> +    for (i = 0; i < cChars; i++)
>       {
> -        for (i = 0; i < cChars; i++)
> +        WCHAR inChar;
> +        if (dwFlags == SGCM_RTL)
> +            inChar = mirror_char(pwcInChars[i]);
> +        else
> +            inChar = pwcInChars[i];
> +        if (!(pwOutGlyphs[i] = get_cache_glyph(psc, inChar)))
>           {
> -            WCHAR inChar;
> -            if (dwFlags == SGCM_RTL)
> -                inChar = mirror_char(pwcInChars[i]);
> -            else
> -                inChar = pwcInChars[i];
> -            if (!(pwOutGlyphs[i] = get_cache_glyph(psc, inChar)))
> +            WORD glyph;
> +            if (!hdc) return E_PENDING;
> +            if (GetGlyphIndicesW(hdc, &inChar, 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) return S_FALSE;
> +            if (glyph == 0xffff)
>               {
> -                WORD glyph;
> -                if (!hdc) return E_PENDING;
> -                if (GetGlyphIndicesW(hdc, &inChar, 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) return S_FALSE;
> -                if (glyph == 0xffff)
> -                {
> -                    hr = S_FALSE;
> -                    glyph = 0x0;
> -                }
> -                pwOutGlyphs[i] = set_cache_glyph(psc, inChar, glyph);
> +                hr = S_FALSE;
> +                glyph = 0x0;
>               }
> +            pwOutGlyphs[i] = set_cache_glyph(psc, inChar, glyph);
>           }
>       }
> -    else
> -    {
> -        TRACE("no glyph translation\n");
> -        for (i = 0; i < cChars; i++)
> -        {
> -            WCHAR inChar;
> -            if (dwFlags == SGCM_RTL)
> -                inChar = mirror_char(pwcInChars[i]);
> -            else
> -                inChar = pwcInChars[i];
> -            pwOutGlyphs[i] = inChar;
> -        }
> -    }
> +
>       return hr;
>   }
>   
> 



More information about the wine-devel mailing list