if (!ret) return NotTrueTypeFont;
- *font = GdipAlloc(sizeof(GpFont));
+ *font = heap_alloc_zero(sizeof(GpFont));
if (!*font) return OutOfMemory;
(*font)->unit = unit;
stat = clone_font_family(fontFamily, &(*font)->family);
if (stat != Ok)
{
- GdipFree(*font);
+ heap_free(*font);
return stat;
}
if (!ret) return NotTrueTypeFont;
- *font = GdipAlloc(sizeof(GpFont));
+ *font = heap_alloc_zero(sizeof(GpFont));
if (!*font) return OutOfMemory;
(*font)->unit = UnitWorld;
stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family);
if (stat != Ok)
{
- GdipFree(*font);
+ heap_free(*font);
return NotTrueTypeFont;
}
return InvalidParameter;
GdipDeleteFontFamily(font->family);
- GdipFree(font);
+ heap_free(font);
return Ok;
}
if(!font || !cloneFont)
return InvalidParameter;
- *cloneFont = GdipAlloc(sizeof(GpFont));
+ *cloneFont = heap_alloc_zero(sizeof(GpFont));
if(!*cloneFont) return OutOfMemory;
**cloneFont = *font;
stat = GdipCloneFontFamily(font->family, &(*cloneFont)->family);
- if (stat != Ok) GdipFree(*cloneFont);
+ if (stat != Ok) heap_free(*cloneFont);
return stat;
}
static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf,
const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
{
+ const ENUMLOGFONTW *elfW = (const ENUMLOGFONTW *)elf;
+ LOGFONTW *lf = (LOGFONTW *)lParam;
+
if (type & RASTER_FONTTYPE)
return 1;
- *(LOGFONTW *)lParam = *elf;
-
+ *lf = *elf;
+ /* replace substituted font name by a real one */
+ lstrcpynW(lf->lfFaceName, elfW->elfFullName, LF_FACESIZE);
return 0;
}
otm.otmSize = sizeof(otm);
if (!GetOutlineTextMetricsW(hdc, otm.otmSize, &otm)) return FALSE;
- GetTextFaceW(hdc, LF_FACESIZE, fm->facename);
-
fm->em_height = otm.otmEMSquare;
fm->dpi = GetDeviceCaps(hdc, LOGPIXELSY);
{
HFONT hfont, old_font;
+ strcpyW(fm->facename, lf.lfFaceName);
+
hfont = CreateFontIndirectW(&lf);
old_font = SelectObject(hdc, hfont);
ret = get_font_metrics(hdc, fm) ? Ok : NotTrueTypeFont;
stat = find_installed_font(name, &fm);
if (stat != Ok) return stat;
- ffamily = GdipAlloc(sizeof (GpFontFamily));
+ ffamily = heap_alloc_zero(sizeof (GpFontFamily));
if (!ffamily) return OutOfMemory;
lstrcpyW(ffamily->FamilyName, fm.facename);
static GpStatus clone_font_family(const GpFontFamily *family, GpFontFamily **clone)
{
- *clone = GdipAlloc(sizeof(GpFontFamily));
+ *clone = heap_alloc_zero(sizeof(GpFontFamily));
if (!*clone) return OutOfMemory;
**clone = *family;
return InvalidParameter;
TRACE("Deleting %p (%s)\n", FontFamily, debugstr_w(FontFamily->FamilyName));
- GdipFree (FontFamily);
+ heap_free (FontFamily);
return Ok;
}
if (!fontCollection)
return InvalidParameter;
- *fontCollection = GdipAlloc(sizeof(GpFontCollection));
+ *fontCollection = heap_alloc_zero(sizeof(GpFontCollection));
if (!*fontCollection) return OutOfMemory;
(*fontCollection)->FontFamilies = NULL;
if (!fontCollection)
return InvalidParameter;
- for (i = 0; i < (*fontCollection)->count; i++) GdipFree((*fontCollection)->FontFamilies[i]);
- GdipFree(*fontCollection);
+ for (i = 0; i < (*fontCollection)->count; i++) heap_free((*fontCollection)->FontFamilies[i]);
+ heap_free(*fontCollection);
return Ok;
}
{
while (installedFontCollection.count)
GdipDeleteFontFamily(installedFontCollection.FontFamilies[--installedFontCollection.count]);
- HeapFree(GetProcessHeap(), 0, installedFontCollection.FontFamilies);
+ heap_free(installedFontCollection.FontFamilies);
installedFontCollection.FontFamilies = NULL;
installedFontCollection.allocated = 0;
}
if (fonts->allocated == fonts->count)
{
INT new_alloc_count = fonts->allocated+50;
- GpFontFamily** new_family_list = HeapAlloc(GetProcessHeap(), 0, new_alloc_count*sizeof(void*));
+ GpFontFamily** new_family_list = heap_alloc(new_alloc_count*sizeof(void*));
if (!new_family_list)
return 0;
memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*));
- HeapFree(GetProcessHeap(), 0, fonts->FontFamilies);
+ heap_free(fonts->FontFamilies);
fonts->FontFamilies = new_family_list;
fonts->allocated = new_alloc_count;
}