[PATCH 3/5] usp10/tests: Also restore the previous font when the finger print matches in _find_font_for_range().

Aric Stewart aric at codeweavers.com
Mon Feb 19 09:36:03 CST 2018


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

On 2/18/18 12:08 PM, Henri Verbeet wrote:
> Otherwise the subsequent SelectObject() call will set *origFont to *hfont.
> 
> Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
> ---
>   dlls/usp10/tests/usp10.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
> index 5c04441..de91cb8 100644
> --- a/dlls/usp10/tests/usp10.c
> +++ b/dlls/usp10/tests/usp10.c
> @@ -1289,11 +1289,12 @@ static int _find_font_for_range(HDC hdc, const CHAR *recommended, BYTE range, co
>               if (*hfont)
>               {
>                   winetest_trace("using font %s\n",lParam.lf.lfFaceName);
> -                *origFont = SelectObject(hdc,*hfont);
>                   if (fingerprint)
>                   {
>                       WORD output[10];
>                       int i;
> +
> +                    *origFont = SelectObject(hdc,*hfont);
>                       if (GetGlyphIndicesW(hdc, fingerprint->check, 10, output, 0) != GDI_ERROR)
>                       {
>                           for (i=0; i < 10; i++)
> @@ -1307,6 +1308,7 @@ static int _find_font_for_range(HDC hdc, const CHAR *recommended, BYTE range, co
>                               }
>                           if (i == 10) rc = 1;
>                       }
> +                    SelectObject(hdc, *origFont);
>                   }
>                   else rc = 1;
>               }
> 



More information about the wine-devel mailing list