mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 01:43:37 +00:00
winedump: Add an ability to dump font files.
This commit is contained in:
parent
65dbecbb5a
commit
60482be24b
|
@ -13,6 +13,7 @@ C_SRCS = \
|
|||
dos.c \
|
||||
dump.c \
|
||||
emf.c \
|
||||
font.c \
|
||||
le.c \
|
||||
lib.c \
|
||||
lnk.c \
|
||||
|
|
|
@ -242,6 +242,7 @@ dumpers[] =
|
|||
{SIG_MDMP, get_kind_mdmp, mdmp_dump},
|
||||
{SIG_LNK, get_kind_lnk, lnk_dump},
|
||||
{SIG_EMF, get_kind_emf, emf_dump},
|
||||
{SIG_FNT, get_kind_fnt, fnt_dump},
|
||||
{SIG_UNKNOWN, NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
139
tools/winedump/font.c
Normal file
139
tools/winedump/font.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Dump a font file
|
||||
*
|
||||
* Copyright 2009 Dmitry Timoshkov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
|
||||
#include "winedump.h"
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct
|
||||
{
|
||||
INT16 dfType;
|
||||
INT16 dfPoints;
|
||||
INT16 dfVertRes;
|
||||
INT16 dfHorizRes;
|
||||
INT16 dfAscent;
|
||||
INT16 dfInternalLeading;
|
||||
INT16 dfExternalLeading;
|
||||
BYTE dfItalic;
|
||||
BYTE dfUnderline;
|
||||
BYTE dfStrikeOut;
|
||||
INT16 dfWeight;
|
||||
BYTE dfCharSet;
|
||||
INT16 dfPixWidth;
|
||||
INT16 dfPixHeight;
|
||||
BYTE dfPitchAndFamily;
|
||||
INT16 dfAvgWidth;
|
||||
INT16 dfMaxWidth;
|
||||
BYTE dfFirstChar;
|
||||
BYTE dfLastChar;
|
||||
BYTE dfDefaultChar;
|
||||
BYTE dfBreakChar;
|
||||
INT16 dfWidthBytes;
|
||||
LONG dfDevice;
|
||||
LONG dfFace;
|
||||
LONG dfBitsPointer;
|
||||
LONG dfBitsOffset;
|
||||
BYTE dfReserved;
|
||||
/* Fields, introduced for Windows 3.x fonts */
|
||||
LONG dfFlags;
|
||||
INT16 dfAspace;
|
||||
INT16 dfBspace;
|
||||
INT16 dfCspace;
|
||||
LONG dfColorPointer;
|
||||
LONG dfReserved1[4];
|
||||
} FONTINFO16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SHORT dfVersion; /* Version */
|
||||
LONG dfSize; /* Total File Size */
|
||||
char dfCopyright[60]; /* Copyright notice */
|
||||
FONTINFO16 fi; /* FONTINFO structure */
|
||||
} WINFNT;
|
||||
#include <poppack.h>
|
||||
|
||||
/* FIXME: recognize and dump also NE/PE wrapped fonts */
|
||||
|
||||
enum FileSig get_kind_fnt(void)
|
||||
{
|
||||
const WINFNT *fnt = PRD(0, sizeof(WINFNT));
|
||||
if (fnt && (fnt->dfVersion == 0x200 || fnt->dfVersion == 0x300) &&
|
||||
PRD(0, fnt->dfSize) != NULL)
|
||||
return SIG_FNT;
|
||||
return SIG_UNKNOWN;
|
||||
}
|
||||
|
||||
void fnt_dump(void)
|
||||
{
|
||||
const WINFNT *fnt = PRD(0, sizeof(WINFNT));
|
||||
|
||||
printf("dfVersion %#x, dfSize %d bytes, dfCopyright %.60s\n",
|
||||
fnt->dfVersion, fnt->dfSize, fnt->dfCopyright);
|
||||
printf("dfType %d\n"
|
||||
"dfPoints %d\n"
|
||||
"dfVertRes %d\n"
|
||||
"dfHorizRes %d\n"
|
||||
"dfAscent %d\n"
|
||||
"dfInternalLeading %d\n"
|
||||
"dfExternalLeading %d\n"
|
||||
"dfItalic %d\n"
|
||||
"dfUnderline %d\n"
|
||||
"dfStrikeOut %d\n"
|
||||
"dfWeight %d\n"
|
||||
"dfCharSet %d\n"
|
||||
"dfPixWidth %d\n"
|
||||
"dfPixHeight %d\n"
|
||||
"dfPitchAndFamily %#x\n"
|
||||
"dfAvgWidth %d\n"
|
||||
"dfMaxWidth %d\n"
|
||||
"dfFirstChar %#x\n"
|
||||
"dfLastChar %#x\n"
|
||||
"dfDefaultChar %#x\n"
|
||||
"dfBreakChar %#x\n"
|
||||
"dfWidthBytes %d\n",
|
||||
fnt->fi.dfType, fnt->fi.dfPoints, fnt->fi.dfVertRes, fnt->fi.dfHorizRes,
|
||||
fnt->fi.dfAscent, fnt->fi.dfInternalLeading, fnt->fi.dfExternalLeading,
|
||||
fnt->fi.dfItalic, fnt->fi.dfUnderline, fnt->fi.dfStrikeOut, fnt->fi.dfWeight,
|
||||
fnt->fi.dfCharSet, fnt->fi.dfPixWidth, fnt->fi.dfPixHeight, fnt->fi.dfPitchAndFamily,
|
||||
fnt->fi.dfAvgWidth, fnt->fi.dfMaxWidth, fnt->fi.dfFirstChar, fnt->fi.dfLastChar,
|
||||
fnt->fi.dfDefaultChar, fnt->fi.dfBreakChar, fnt->fi.dfWidthBytes);
|
||||
}
|
|
@ -217,7 +217,7 @@ char *str_toupper (char *str);
|
|||
const char *get_machine_str(int mach);
|
||||
|
||||
/* file dumping functions */
|
||||
enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG, SIG_PDB, SIG_NE, SIG_LE, SIG_MDMP, SIG_COFFLIB, SIG_LNK, SIG_EMF};
|
||||
enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG, SIG_PDB, SIG_NE, SIG_LE, SIG_MDMP, SIG_COFFLIB, SIG_LNK, SIG_EMF, SIG_FNT};
|
||||
|
||||
const void* PRD(unsigned long prd, unsigned long len);
|
||||
unsigned long Offset(const void* ptr);
|
||||
|
@ -252,6 +252,8 @@ enum FileSig get_kind_emf(void);
|
|||
void emf_dump( void );
|
||||
enum FileSig get_kind_pdb(void);
|
||||
void pdb_dump(void);
|
||||
enum FileSig get_kind_fnt(void);
|
||||
void fnt_dump( void );
|
||||
int codeview_dump_symbols(const void* root, unsigned long size);
|
||||
int codeview_dump_types_from_offsets(const void* table, const DWORD* offsets, unsigned num_types);
|
||||
int codeview_dump_types_from_block(const void* table, unsigned long len);
|
||||
|
|
Loading…
Reference in a new issue