/* Font backend for the Microsoft W32 API.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
font->font.font = 0;
}
+ if (font->font.full_name && font->font.full_name != font->font.name)
+ xfree (font->font.full_name);
+
if (font->font.name)
xfree (font->font.name);
+
xfree (font);
}
font->font.name = (char *) xmalloc (len + 1);
bcopy (logfont.lfFaceName, font->font.name, len);
font->font.name[len] = '\0';
- font->font.full_name = font->font.name;
+
+ {
+ char *name;
+
+ /* We don't know how much space we need for the full name, so start with
+ 96 bytes and go up in steps of 32. */
+ len = 96;
+ name = malloc (len);
+ while (name && font_unparse_fcname (font_entity, pixel_size, name, len) < 0)
+ {
+ char *new = realloc (name, len += 32);
+
+ if (! new)
+ free (name);
+ name = new;
+ }
+ if (name)
+ font->font.full_name = name;
+ else
+ font->font.full_name = font->font.name;
+ }
font->font.charset = 0;
font->font.codepage = 0;
font->font.size = w32_font->metrics.tmMaxCharWidth;