Fixed crash in font browsing for raster fonts.

This commit is contained in:
Eric Pouech 2005-11-02 20:51:16 +00:00 committed by Alexandre Julliard
parent 4381c62560
commit 60c1ae0bb8
1 changed files with 8 additions and 3 deletions

View File

@ -393,9 +393,14 @@ static int CALLBACK font_enum_size(const LOGFONT* lf, const TEXTMETRIC* tm,
SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf);
/* now grow our arrays and insert the values at the same index than in the list box */
di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1));
if (idx != di->nFont)
memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font));
if (di->nFont)
{
di->font = HeapReAlloc(GetProcessHeap(), 0, di->font, sizeof(*di->font) * (di->nFont + 1));
if (idx != di->nFont)
memmove(&di->font[idx + 1], &di->font[idx], (di->nFont - idx) * sizeof(*di->font));
}
else
di->font = HeapAlloc(GetProcessHeap(), 0, sizeof(*di->font));
di->font[idx].height = tm->tmHeight;
di->font[idx].weight = tm->tmWeight;
lstrcpy(di->font[idx].faceName, lf->lfFaceName);