1 |
673 |
markom |
/* winfont.h*/
|
2 |
|
|
/*
|
3 |
|
|
* Copyright (c) 2000 Greg Haerr <greg@censoft.com>
|
4 |
|
|
*
|
5 |
|
|
* Win32 font structures and API
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/* tmPitchAndFamily flags*/
|
9 |
|
|
#define TMPF_FIXED_PITCH 0x01 /* win32 bug: means variable*/
|
10 |
|
|
#define TMPF_VECTOR 0x02
|
11 |
|
|
#define TMPF_TRUETYPE 0x04
|
12 |
|
|
#define TMPF_DEVICE 0x08
|
13 |
|
|
|
14 |
|
|
typedef struct tagTEXTMETRIC {
|
15 |
|
|
LONG tmHeight;
|
16 |
|
|
LONG tmAscent;
|
17 |
|
|
LONG tmDescent;
|
18 |
|
|
LONG tmInternalLeading;
|
19 |
|
|
LONG tmExternalLeading;
|
20 |
|
|
LONG tmAveCharWidth;
|
21 |
|
|
LONG tmMaxCharWidth;
|
22 |
|
|
LONG tmWeight;
|
23 |
|
|
LONG tmOverhang;
|
24 |
|
|
LONG tmDigitizedAspectX;
|
25 |
|
|
LONG tmDigitizedAspectY;
|
26 |
|
|
BYTE tmFirstChar;
|
27 |
|
|
BYTE tmLastChar;
|
28 |
|
|
BYTE tmDefaultChar;
|
29 |
|
|
BYTE tmBreakChar;
|
30 |
|
|
BYTE tmItalic;
|
31 |
|
|
BYTE tmUnderlined;
|
32 |
|
|
BYTE tmStruckOut;
|
33 |
|
|
BYTE tmPitchAndFamily;
|
34 |
|
|
BYTE tmCharSet;
|
35 |
|
|
} TEXTMETRIC, *PTEXTMETRIC, NEAR *NPTEXTMETRIC, FAR *LPTEXTMETRIC;
|
36 |
|
|
|
37 |
|
|
BOOL WINAPI GetTextMetrics(HDC hdc, LPTEXTMETRIC lptm);
|
38 |
|
|
BOOL WINAPI GetCharWidth(HDC hdc,UINT iFirstChar,UINT iLastChar,LPINT lpBuffer);
|
39 |
|
|
BOOL WINAPI GetTextExtentPoint(HDC hdc,LPCTSTR lpszStr,int cchString,
|
40 |
|
|
LPSIZE lpSize);
|
41 |
|
|
BOOL WINAPI GetTextExtentExPoint(HDC hdc,LPCTSTR lpszStr,int cchString,
|
42 |
|
|
int nMaxExtent,LPINT lpnFit,LPINT alpDx,LPSIZE lpSize);
|
43 |
|
|
|
44 |
|
|
/* inherit logical font descriptor from engine*/
|
45 |
|
|
|
46 |
|
|
typedef struct {
|
47 |
|
|
LONG lfHeight; /* desired height in pixels*/
|
48 |
|
|
LONG lfWidth; /* desired width in pixels or 0*/
|
49 |
|
|
LONG lfEscapement; /* rotation in tenths of degree*/
|
50 |
|
|
LONG lfOrientation; /* not used*/
|
51 |
|
|
LONG lfWeight; /* font weight*/
|
52 |
|
|
BYTE lfItalic; /* =1 for italic*/
|
53 |
|
|
BYTE lfUnderline; /* =1 for underline*/
|
54 |
|
|
BYTE lfStrikeOut; /* not used*/
|
55 |
|
|
BYTE lfCharSet; /* font character set*/
|
56 |
|
|
BYTE lfOutPrecision; /* font type selection*/
|
57 |
|
|
BYTE lfClipPrecision; /* not used*/
|
58 |
|
|
BYTE lfQuality; /* not used*/
|
59 |
|
|
BYTE lfPitchAndFamily; /* font pitch and family*/
|
60 |
|
|
CHAR lfFaceName[MWLF_FACESIZE]; /* font name, may be aliased*/
|
61 |
|
|
} LOGFONT, *PLOGFONT, NEAR *NPLOGFONT, FAR *LPLOGFONT;
|
62 |
|
|
|
63 |
|
|
#define LF_FACESIZE MWLF_FACESIZE
|
64 |
|
|
|
65 |
|
|
/* font weights*/
|
66 |
|
|
#define FW_DONTCARE MWLF_WEIGHT_DEFAULT
|
67 |
|
|
#define FW_THIN MWLF_WEIGHT_THIN
|
68 |
|
|
#define FW_EXTRALIGHT MWLF_WEIGHT_EXTRALIGHT
|
69 |
|
|
#define FW_LIGHT MWLF_WEIGHT_LIGHT
|
70 |
|
|
#define FW_NORMAL MWLF_WEIGHT_NORMAL
|
71 |
|
|
#define FW_MEDIUM MWLF_WEIGHT_MEDIUM
|
72 |
|
|
#define FW_SEMIBOLD MWLF_WEIGHT_DEMIBOLD
|
73 |
|
|
#define FW_BOLD MWLF_WEIGHT_BOLD
|
74 |
|
|
#define FW_EXTRABOLD MWLF_WEIGHT_EXTRABOLD
|
75 |
|
|
#define FW_HEAVY MWLF_WEIGHT_BLACK
|
76 |
|
|
#define FW_ULTRALIGHT FW_EXTRALIGHT
|
77 |
|
|
#define FW_REGULAR FW_NORMAL
|
78 |
|
|
#define FW_DEMIBOLD FW_SEMIBOLD
|
79 |
|
|
#define FW_ULTRABOLD FW_EXTRABOLD
|
80 |
|
|
#define FW_BLACK FW_HEAVY
|
81 |
|
|
|
82 |
|
|
/* output precision - used for font selection*/
|
83 |
|
|
#define OUT_DEFAULT_PRECIS MWLF_TYPE_DEFAULT
|
84 |
|
|
#define OUT_STRING_PRECIS 1
|
85 |
|
|
#define OUT_CHARACTER_PRECIS 2
|
86 |
|
|
#define OUT_STROKE_PRECIS 3
|
87 |
|
|
#define OUT_TT_PRECIS MWLF_TYPE_SCALED
|
88 |
|
|
#define OUT_DEVICE_PRECIS MFLF_TYPE_RASTER
|
89 |
|
|
#define OUT_RASTER_PRECIS MFLF_TYPE_RASTER
|
90 |
|
|
#define OUT_TT_ONLY_PRECIS MWLF_TYPE_TRUETYPE
|
91 |
|
|
#define OUT_OUTLINE_PRECIS 8
|
92 |
|
|
#define OUT_SCREEN_OUTLINE_PRECIS 9
|
93 |
|
|
|
94 |
|
|
/* clip precision - unused*/
|
95 |
|
|
#define CLIP_DEFAULT_PRECIS 0
|
96 |
|
|
#define CLIP_CHARACTER_PRECIS 1
|
97 |
|
|
#define CLIP_STROKE_PRECIS 2
|
98 |
|
|
#define CLIP_MASK 0xf
|
99 |
|
|
#define CLIP_LH_ANGLES (1<<4)
|
100 |
|
|
#define CLIP_TT_ALWAYS (2<<4)
|
101 |
|
|
#define CLIP_EMBEDDED (8<<4)
|
102 |
|
|
|
103 |
|
|
/* output quality - unused*/
|
104 |
|
|
#define DEFAULT_QUALITY 0
|
105 |
|
|
#define DRAFT_QUALITY 1
|
106 |
|
|
#define PROOF_QUALITY 2
|
107 |
|
|
#define NONANTIALIASED_QUALITY 3
|
108 |
|
|
#define ANTIALIASED_QUALITY 4
|
109 |
|
|
|
110 |
|
|
/* font charset*/
|
111 |
|
|
#define ANSI_CHARSET MWLF_CHARSET_ANSI
|
112 |
|
|
#define DEFAULT_CHARSET MWLF_CHARSET_DEFAULT
|
113 |
|
|
#define SYMBOL_CHARSET 2
|
114 |
|
|
#define OEM_CHARSET MWLF_CHARSET_OEM
|
115 |
|
|
|
116 |
|
|
/* font pitch - lfPitchAndFamily*/
|
117 |
|
|
#define MWLF_PITCH_DEFAULT 0 /* any pitch*/
|
118 |
|
|
#define MWLF_PITCH_FIXED 1 /* fixed pitch*/
|
119 |
|
|
#define MWLF_PITCH_VARIABLE 2 /* variable pitch*/
|
120 |
|
|
|
121 |
|
|
/* font pitch*/
|
122 |
|
|
#define DEFAULT_PITCH MWLF_PITCH_DEFAULT
|
123 |
|
|
#define FIXED_PITCH MWLF_PITCH_FIXED
|
124 |
|
|
#define VARIABLE_PITCH MWLF_PITCH_VARIABLE
|
125 |
|
|
#define MONO_FONT 8
|
126 |
|
|
|
127 |
|
|
/*
|
128 |
|
|
* font family - lfPitchAndFamily
|
129 |
|
|
*
|
130 |
|
|
* MWF_FAMILY_SERIF - Times Roman, Century Schoolbook
|
131 |
|
|
* MWF_FAMILY_SANSSERIF - Helvetica, Swiss
|
132 |
|
|
* MWF_FAMILY_MODERN - Pica, Elite, Courier
|
133 |
|
|
*/
|
134 |
|
|
#define MWLF_FAMILY_DEFAULT (0<<4) /* any family*/
|
135 |
|
|
#define MWLF_FAMILY_SERIF (1<<4) /* variable stroke width, serif*/
|
136 |
|
|
#define MWLF_FAMILY_SANSSERIF (2<<4) /* variable stroke width, sans-serif*/
|
137 |
|
|
#define MWLF_FAMILY_MODERN (3<<4) /* constant stroke width*/
|
138 |
|
|
|
139 |
|
|
/* add definitions here for font mapper extensions*/
|
140 |
|
|
#define MWLF_FAMILY_BITSTREAM (6<<4) /* bitstream*/
|
141 |
|
|
#define MWLF_FAMILY_ADOBE (7<<4) /* adobe*/
|
142 |
|
|
|
143 |
|
|
/* font family*/
|
144 |
|
|
#define FF_DONTCARE MWLF_FAMILY_DEFAULT
|
145 |
|
|
#define FF_ROMAN MWLF_FAMILY_SERIF
|
146 |
|
|
#define FF_SWISS MWLF_FAMILY_SANSSERIF
|
147 |
|
|
#define FF_MODERN MWLF_FAMILY_MODERN
|
148 |
|
|
#define FF_SCRIPT (4<<4) /* Cursive, etc. */
|
149 |
|
|
#define FF_DECORATIVE (5<<4) /* Old English, etc. */
|
150 |
|
|
|
151 |
|
|
HFONT WINAPI CreateFont(int nHeight, int nWidth, int nEscapement,
|
152 |
|
|
int nOrientation, int fnWeight, DWORD fdwItalic,
|
153 |
|
|
DWORD fdwUnderline, DWORD fdwStrikeOut,DWORD fdwCharSet,
|
154 |
|
|
DWORD fdwOutputPrecision,DWORD fdwClipPrecision,
|
155 |
|
|
DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace);
|
156 |
|
|
HFONT WINAPI CreateFontIndirect(CONST LOGFONT *lplf);
|