[cairo] [cairo-commit] src/cairo-win32-font.c
Behdad Esfahbod
behdad at behdad.org
Sun Dec 21 09:30:01 PST 2008
Adrian Johnson wrote:
> commit d99583bae680fea852e957afdf674e2031aa7928
> Author: Adrian Johnson <ajohnson at redneon.com>
> Date: Sun Dec 21 17:03:17 2008 +1030
>
> Fix win32 font breakage
>
> as a result of the toy font face changes in f7ab65e9b0c0f08be8d294e90131baa2decf1f1d
Thanks Adrian.
> diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
> index 94769f0..be50c6c 100644
> --- a/src/cairo-win32-font.c
> +++ b/src/cairo-win32-font.c
> @@ -541,7 +541,6 @@ _cairo_win32_font_face_create_for_toy (cairo_toy_font_face_t *toy_face,
>
> memcpy (logfont.lfFaceName, face_name, sizeof (uint16_t) * (face_name_len + 1));
> free (face_name);
> - logfont.lfFaceName[ARRAY_LENGTH (logfont.lfFaceName) - 1] = 0;
I stumbled upon this place in the code too. THis is what it does currently:
if (face_name_len > LF_FACESIZE - 1) {
free (face_name);
return _cairo_error (CAIRO_STATUS_INVALID_STRING);
}
which is absolutely wrong. If the toy font family is long, it's not a
programming error the user should be punished for. The best is to just
truncate the family name and continue.
Anyone disagree? Can someone with win32 fix please?
behdad
More information about the cairo
mailing list