comctl32: Introduce _PSP structure to store HPROPSHEETPAGE data.
[wine.git] / tools / winedump / font.c
blobca4065340c33ca69c5aa14d95451f35905ab946a
1 /*
2 * Dump a font file
4 * Copyright 2009 Dmitry Timoshkov
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <fcntl.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winnt.h"
32 #include "winedump.h"
34 #include <pshpack1.h>
35 typedef struct
37 INT16 dfType;
38 INT16 dfPoints;
39 INT16 dfVertRes;
40 INT16 dfHorizRes;
41 INT16 dfAscent;
42 INT16 dfInternalLeading;
43 INT16 dfExternalLeading;
44 BYTE dfItalic;
45 BYTE dfUnderline;
46 BYTE dfStrikeOut;
47 INT16 dfWeight;
48 BYTE dfCharSet;
49 INT16 dfPixWidth;
50 INT16 dfPixHeight;
51 BYTE dfPitchAndFamily;
52 INT16 dfAvgWidth;
53 INT16 dfMaxWidth;
54 BYTE dfFirstChar;
55 BYTE dfLastChar;
56 BYTE dfDefaultChar;
57 BYTE dfBreakChar;
58 INT16 dfWidthBytes;
59 LONG dfDevice;
60 LONG dfFace;
61 LONG dfBitsPointer;
62 LONG dfBitsOffset;
63 BYTE dfReserved;
64 /* Fields, introduced for Windows 3.x fonts */
65 LONG dfFlags;
66 INT16 dfAspace;
67 INT16 dfBspace;
68 INT16 dfCspace;
69 LONG dfColorPointer;
70 LONG dfReserved1[4];
71 } FONTINFO16;
73 typedef struct
75 SHORT dfVersion; /* Version */
76 int dfSize; /* Total File Size */
77 char dfCopyright[60]; /* Copyright notice */
78 FONTINFO16 fi; /* FONTINFO structure */
79 } WINFNT;
80 #include <poppack.h>
82 /* FIXME: recognize and dump also NE/PE wrapped fonts */
84 enum FileSig get_kind_fnt(void)
86 const WINFNT *fnt = PRD(0, sizeof(WINFNT));
87 if (fnt && (fnt->dfVersion == 0x200 || fnt->dfVersion == 0x300) &&
88 PRD(0, fnt->dfSize) != NULL)
89 return SIG_FNT;
90 return SIG_UNKNOWN;
93 void fnt_dump(void)
95 const WINFNT *fnt = PRD(0, sizeof(WINFNT));
97 printf("dfVersion %#x, dfSize %d bytes, dfCopyright %.60s\n",
98 fnt->dfVersion, fnt->dfSize, fnt->dfCopyright);
99 printf("dfType %d\n"
100 "dfPoints %d\n"
101 "dfVertRes %d\n"
102 "dfHorizRes %d\n"
103 "dfAscent %d\n"
104 "dfInternalLeading %d\n"
105 "dfExternalLeading %d\n"
106 "dfItalic %d\n"
107 "dfUnderline %d\n"
108 "dfStrikeOut %d\n"
109 "dfWeight %d\n"
110 "dfCharSet %d\n"
111 "dfPixWidth %d\n"
112 "dfPixHeight %d\n"
113 "dfPitchAndFamily %#x\n"
114 "dfAvgWidth %d\n"
115 "dfMaxWidth %d\n"
116 "dfFirstChar %#x\n"
117 "dfLastChar %#x\n"
118 "dfDefaultChar %#x\n"
119 "dfBreakChar %#x\n"
120 "dfWidthBytes %d\n",
121 fnt->fi.dfType, fnt->fi.dfPoints, fnt->fi.dfVertRes, fnt->fi.dfHorizRes,
122 fnt->fi.dfAscent, fnt->fi.dfInternalLeading, fnt->fi.dfExternalLeading,
123 fnt->fi.dfItalic, fnt->fi.dfUnderline, fnt->fi.dfStrikeOut, fnt->fi.dfWeight,
124 fnt->fi.dfCharSet, fnt->fi.dfPixWidth, fnt->fi.dfPixHeight, fnt->fi.dfPitchAndFamily,
125 fnt->fi.dfAvgWidth, fnt->fi.dfMaxWidth, fnt->fi.dfFirstChar, fnt->fi.dfLastChar,
126 fnt->fi.dfDefaultChar, fnt->fi.dfBreakChar, fnt->fi.dfWidthBytes);