]> code.delx.au - gnu-emacs/blobdiff - src/w32bdf.c
(find_field): Fix comment.
[gnu-emacs] / src / w32bdf.c
index 73f40a22df604ff597f5888841d2889d9f81c53e..89d885741889a365d8912e18c42b08e0bf8503bb 100644 (file)
@@ -1,5 +1,6 @@
 /* Implementation of BDF font handling on the Microsoft W32 API.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2004, 2005,
+                 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,8 +16,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* Based heavily on code by H. Miyashita for Meadow (a descendant of
    MULE for W32). */
@@ -247,7 +248,7 @@ w32_init_bdf_font(char *filename)
     hbdf_bmp_heap = HeapCreate(0, BDF_BITMAP_HEAP_INITIAL_SIZE, 0);
 
   if (!hbdf_cp_heap || !hbdf_bmp_heap)
-    error("Fail to create heap for BDF.");
+    error("Fail to create heap for BDF");
 
   hfile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -257,13 +258,13 @@ w32_init_bdf_font(char *filename)
       (fileinfo.nFileSizeLow > BDF_FILE_SIZE_MAX))
     {
       CloseHandle(hfile);
-      error("Fail to open BDF file.");
+      error("Fail to open BDF file");
     }
   hfilemap = CreateFileMapping(hfile, NULL, PAGE_READONLY, 0, 0, NULL);
   if (hfilemap == INVALID_HANDLE_VALUE)
     {
       CloseHandle(hfile);
-      error("Can't map font.");
+      error("Can't map font");
     }
 
   font = MapViewOfFile(hfilemap, FILE_MAP_READ, 0, 0, 0);
@@ -272,7 +273,7 @@ w32_init_bdf_font(char *filename)
     {
       CloseHandle(hfile);
       CloseHandle(hfilemap);
-      error("Can't view font.");
+      error("Can't view font");
     }
 
   bdffontp = (bdffont *) xmalloc(sizeof(bdffont));
@@ -604,7 +605,7 @@ create_offscreen_bitmap(HDC hdc, int width, int height, unsigned char **bitsp)
   info.c[1].rgbRed = info.c[1].rgbGreen = info.c[1].rgbBlue = 255;
 
   return CreateDIBSection(hdc, (LPBITMAPINFO)&info,
-                         DIB_RGB_COLORS, bitsp, NULL, 0);
+                         DIB_RGB_COLORS, (void **)bitsp, NULL, 0);
 }
 
 glyph_metric *
@@ -768,12 +769,16 @@ struct font_info *w32_load_bdf_font (struct frame *f, char *fontname,
 
   /* Now fill in the slots of *FONTP.  */
   BLOCK_INPUT;
+  bzero (fontp, sizeof (*fontp));
   fontp->font = font;
   fontp->font_idx = dpyinfo->n_fonts;
   fontp->name = (char *) xmalloc (strlen (fontname) + 1);
   bcopy (fontname, fontp->name, strlen (fontname) + 1);
   fontp->full_name = fontp->name;
-  fontp->size = FONT_WIDTH (font);
+  /* FIXME: look at BDF spec to see if there are better ways of finding
+     average_width and space_width, hopefully that don't involve working out
+     the values for ourselves from the data.  */
+  fontp->size = fontp->average_width = fontp->space_width = FONT_WIDTH (font);
   fontp->height = FONT_HEIGHT (font);
 
     /* The slot `encoding' specifies how to map a character
@@ -866,3 +871,6 @@ int w32_BDF_to_x_font (char *file, char* xstr, int len)
   CloseHandle (hfilemap);
   return retval;
 }
+
+/* arch-tag: 2e9a45de-0c54-4a0e-95c8-2d67b2b1fa32
+   (do not change this comment) */