(resend/renumber)[6/14]dwrite: code to add fonts to a fontfamily

Alexandre Julliard julliard at winehq.org
Thu Sep 4 09:01:41 CDT 2014


Aric Stewart <aric at codeweavers.com> writes:

> @@ -968,6 +968,28 @@ static const IDWriteFontFamilyVtbl fontfamilyvtbl = {
>      dwritefontfamily_GetMatchingFonts
>  };
>  
> +static HRESULT fontfamily_AddFont(struct dwrite_fontfamily *family, IDWriteFont *font)
> +{
> +    struct dwrite_font *font_data = impl_from_IDWriteFont(font);
> +
> +    if (family->font_count + 1 >= family->alloc)
> +    {
> +        struct dwrite_font_data **new_list;
> +        UINT32 new_alloc;
> +        new_alloc = family->alloc * 2;
> +        new_list = heap_realloc(family->fonts, sizeof(*family->fonts) * new_alloc);
> +        if (!new_list)
> +            return E_OUTOFMEMORY;
> +        family->fonts = new_list;
> +        family->alloc = new_alloc;
> +    }
> +
> +    family->fonts[family->font_count] = font_data->data;
> +    InterlockedIncrement(&font_data->data->ref);
> +    family->font_count++;
> +    return S_OK;
> +}

Please don't add dead code.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list