Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * GDI font objects |
| 3 | * |
| 4 | * Copyright 1993 Alexandre Julliard |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 5 | * 1997 Alex Korobka |
Alexandre Julliard | 7e56f68 | 1996-01-31 19:02:28 +0000 | [diff] [blame] | 6 | */ |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 7 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 8 | #include <stdlib.h> |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 9 | #include <string.h> |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 10 | #include <assert.h> |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 11 | #include "winerror.h" |
| 12 | #include "winnls.h" |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 13 | #include "font.h" |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 14 | #include "heap.h" |
Alexandre Julliard | 7e56f68 | 1996-01-31 19:02:28 +0000 | [diff] [blame] | 15 | #include "options.h" |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 16 | #include "debugtools.h" |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 17 | #include "gdi.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 18 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 19 | DEFAULT_DEBUG_CHANNEL(font); |
| 20 | DECLARE_DEBUG_CHANNEL(gdi); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 21 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 22 | #define ENUM_UNICODE 0x00000001 |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 23 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 24 | typedef struct |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 25 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 26 | LPLOGFONT16 lpLogFontParam; |
| 27 | FONTENUMPROCEX16 lpEnumFunc; |
| 28 | LPARAM lpData; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 29 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 30 | LPNEWTEXTMETRICEX16 lpTextMetric; |
| 31 | LPENUMLOGFONTEX16 lpLogFont; |
| 32 | SEGPTR segTextMetric; |
| 33 | SEGPTR segLogFont; |
| 34 | } fontEnum16; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 35 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 36 | typedef struct |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 37 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 38 | LPLOGFONTW lpLogFontParam; |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 39 | FONTENUMPROCEXW lpEnumFunc; |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 40 | LPARAM lpData; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 41 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 42 | DWORD dwFlags; |
| 43 | } fontEnum32; |
| 44 | |
Douglas Ridgway | ab9e8bc | 1999-01-01 18:41:22 +0000 | [diff] [blame] | 45 | /* |
| 46 | * For TranslateCharsetInfo |
| 47 | */ |
| 48 | #define FS(x) {{0,0,0,0},{0x1<<(x),0}} |
| 49 | #define MAXTCIINDEX 32 |
| 50 | static CHARSETINFO FONT_tci[MAXTCIINDEX] = { |
| 51 | /* ANSI */ |
| 52 | { ANSI_CHARSET, 1252, FS(0)}, |
| 53 | { EASTEUROPE_CHARSET, 1250, FS(1)}, |
| 54 | { RUSSIAN_CHARSET, 1251, FS(2)}, |
| 55 | { GREEK_CHARSET, 1253, FS(3)}, |
| 56 | { TURKISH_CHARSET, 1254, FS(4)}, |
| 57 | { HEBREW_CHARSET, 1255, FS(5)}, |
| 58 | { ARABIC_CHARSET, 1256, FS(6)}, |
| 59 | { BALTIC_CHARSET, 1257, FS(7)}, |
| 60 | /* reserved by ANSI */ |
| 61 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 62 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 63 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 64 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 65 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 66 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 67 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 68 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 69 | /* ANSI and OEM */ |
| 70 | { THAI_CHARSET, 874, FS(16)}, |
| 71 | { SHIFTJIS_CHARSET, 932, FS(17)}, |
| 72 | { GB2312_CHARSET, 936, FS(18)}, |
| 73 | { HANGEUL_CHARSET, 949, FS(19)}, |
| 74 | { CHINESEBIG5_CHARSET, 950, FS(20)}, |
| 75 | { JOHAB_CHARSET, 1361, FS(21)}, |
| 76 | /* reserved for alternate ANSI and OEM */ |
| 77 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 78 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 79 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 80 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 81 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 82 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 83 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 84 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 85 | /* reserved for system */ |
| 86 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 87 | { DEFAULT_CHARSET, 0, FS(0)}, |
| 88 | }; |
| 89 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 90 | /*********************************************************************** |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 91 | * LOGFONT conversion functions. |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 92 | */ |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 93 | void FONT_LogFontATo16( const LOGFONTA* font32, LPLOGFONT16 font16 ) |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 94 | { |
Ulrich Weigand | d1682aa | 1999-11-21 02:21:17 +0000 | [diff] [blame] | 95 | font16->lfHeight = font32->lfHeight; |
| 96 | font16->lfWidth = font32->lfWidth; |
| 97 | font16->lfEscapement = font32->lfEscapement; |
| 98 | font16->lfOrientation = font32->lfOrientation; |
| 99 | font16->lfWeight = font32->lfWeight; |
| 100 | font16->lfItalic = font32->lfItalic; |
| 101 | font16->lfUnderline = font32->lfUnderline; |
| 102 | font16->lfStrikeOut = font32->lfStrikeOut; |
| 103 | font16->lfCharSet = font32->lfCharSet; |
| 104 | font16->lfOutPrecision = font32->lfOutPrecision; |
| 105 | font16->lfClipPrecision = font32->lfClipPrecision; |
| 106 | font16->lfQuality = font32->lfQuality; |
| 107 | font16->lfPitchAndFamily = font32->lfPitchAndFamily; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 108 | lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE ); |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 109 | } |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 110 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 111 | void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 112 | { |
Ulrich Weigand | d1682aa | 1999-11-21 02:21:17 +0000 | [diff] [blame] | 113 | font16->lfHeight = font32->lfHeight; |
| 114 | font16->lfWidth = font32->lfWidth; |
| 115 | font16->lfEscapement = font32->lfEscapement; |
| 116 | font16->lfOrientation = font32->lfOrientation; |
| 117 | font16->lfWeight = font32->lfWeight; |
| 118 | font16->lfItalic = font32->lfItalic; |
| 119 | font16->lfUnderline = font32->lfUnderline; |
| 120 | font16->lfStrikeOut = font32->lfStrikeOut; |
| 121 | font16->lfCharSet = font32->lfCharSet; |
| 122 | font16->lfOutPrecision = font32->lfOutPrecision; |
| 123 | font16->lfClipPrecision = font32->lfClipPrecision; |
| 124 | font16->lfQuality = font32->lfQuality; |
| 125 | font16->lfPitchAndFamily = font32->lfPitchAndFamily; |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 126 | WideCharToMultiByte( CP_ACP, 0, font32->lfFaceName, -1, |
| 127 | font16->lfFaceName, LF_FACESIZE, NULL, NULL ); |
| 128 | font16->lfFaceName[LF_FACESIZE-1] = 0; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 129 | } |
| 130 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 131 | void FONT_LogFont16ToA( const LOGFONT16 *font16, LPLOGFONTA font32 ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 132 | { |
Ulrich Weigand | d1682aa | 1999-11-21 02:21:17 +0000 | [diff] [blame] | 133 | font32->lfHeight = font16->lfHeight; |
| 134 | font32->lfWidth = font16->lfWidth; |
| 135 | font32->lfEscapement = font16->lfEscapement; |
| 136 | font32->lfOrientation = font16->lfOrientation; |
| 137 | font32->lfWeight = font16->lfWeight; |
| 138 | font32->lfItalic = font16->lfItalic; |
| 139 | font32->lfUnderline = font16->lfUnderline; |
| 140 | font32->lfStrikeOut = font16->lfStrikeOut; |
| 141 | font32->lfCharSet = font16->lfCharSet; |
| 142 | font32->lfOutPrecision = font16->lfOutPrecision; |
| 143 | font32->lfClipPrecision = font16->lfClipPrecision; |
| 144 | font32->lfQuality = font16->lfQuality; |
| 145 | font32->lfPitchAndFamily = font16->lfPitchAndFamily; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 146 | lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 149 | void FONT_LogFont16ToW( const LOGFONT16 *font16, LPLOGFONTW font32 ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 150 | { |
Ulrich Weigand | d1682aa | 1999-11-21 02:21:17 +0000 | [diff] [blame] | 151 | font32->lfHeight = font16->lfHeight; |
| 152 | font32->lfWidth = font16->lfWidth; |
| 153 | font32->lfEscapement = font16->lfEscapement; |
| 154 | font32->lfOrientation = font16->lfOrientation; |
| 155 | font32->lfWeight = font16->lfWeight; |
| 156 | font32->lfItalic = font16->lfItalic; |
| 157 | font32->lfUnderline = font16->lfUnderline; |
| 158 | font32->lfStrikeOut = font16->lfStrikeOut; |
| 159 | font32->lfCharSet = font16->lfCharSet; |
| 160 | font32->lfOutPrecision = font16->lfOutPrecision; |
| 161 | font32->lfClipPrecision = font16->lfClipPrecision; |
| 162 | font32->lfQuality = font16->lfQuality; |
| 163 | font32->lfPitchAndFamily = font16->lfPitchAndFamily; |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 164 | MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE ); |
| 165 | font32->lfFaceName[LF_FACESIZE-1] = 0; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 166 | } |
| 167 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 168 | void FONT_LogFontAToW( const LOGFONTA *fontA, LPLOGFONTW fontW ) |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 169 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 170 | memcpy(fontW, fontA, sizeof(LOGFONTA) - LF_FACESIZE); |
| 171 | MultiByteToWideChar(CP_ACP, 0, fontA->lfFaceName, -1, fontW->lfFaceName, |
| 172 | LF_FACESIZE); |
| 173 | } |
| 174 | |
| 175 | void FONT_LogFontWToA( const LOGFONTW *fontW, LPLOGFONTA fontA ) |
| 176 | { |
| 177 | memcpy(fontA, fontW, sizeof(LOGFONTA) - LF_FACESIZE); |
| 178 | WideCharToMultiByte(CP_ACP, 0, fontW->lfFaceName, -1, fontA->lfFaceName, |
| 179 | LF_FACESIZE, NULL, NULL); |
| 180 | } |
| 181 | |
| 182 | void FONT_EnumLogFontEx16ToA( const ENUMLOGFONTEX16 *font16, LPENUMLOGFONTEXA font32 ) |
| 183 | { |
| 184 | FONT_LogFont16ToA( (LPLOGFONT16)font16, (LPLOGFONTA)font32); |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 185 | lstrcpynA( font32->elfFullName, font16->elfFullName, LF_FULLFACESIZE ); |
| 186 | lstrcpynA( font32->elfStyle, font16->elfStyle, LF_FACESIZE ); |
| 187 | lstrcpynA( font32->elfScript, font16->elfScript, LF_FACESIZE ); |
| 188 | } |
| 189 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 190 | void FONT_EnumLogFontEx16ToW( const ENUMLOGFONTEX16 *font16, LPENUMLOGFONTEXW font32 ) |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 191 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 192 | FONT_LogFont16ToW( (LPLOGFONT16)font16, (LPLOGFONTW)font32); |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 193 | |
| 194 | MultiByteToWideChar( CP_ACP, 0, font16->elfFullName, -1, font32->elfFullName, LF_FULLFACESIZE ); |
| 195 | font32->elfFullName[LF_FULLFACESIZE-1] = 0; |
| 196 | MultiByteToWideChar( CP_ACP, 0, font16->elfStyle, -1, font32->elfStyle, LF_FACESIZE ); |
| 197 | font32->elfStyle[LF_FACESIZE-1] = 0; |
| 198 | MultiByteToWideChar( CP_ACP, 0, font16->elfScript, -1, font32->elfScript, LF_FACESIZE ); |
| 199 | font32->elfScript[LF_FACESIZE-1] = 0; |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 200 | } |
| 201 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 202 | void FONT_EnumLogFontExWTo16( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEX16 font16 ) |
| 203 | { |
| 204 | FONT_LogFontWTo16( (LPLOGFONTW)fontW, (LPLOGFONT16)font16); |
| 205 | |
| 206 | WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1, |
| 207 | font16->elfFullName, LF_FULLFACESIZE, NULL, NULL ); |
| 208 | font16->elfFullName[LF_FULLFACESIZE-1] = '\0'; |
| 209 | WideCharToMultiByte( CP_ACP, 0, fontW->elfStyle, -1, |
| 210 | font16->elfStyle, LF_FACESIZE, NULL, NULL ); |
| 211 | font16->elfStyle[LF_FACESIZE-1] = '\0'; |
| 212 | WideCharToMultiByte( CP_ACP, 0, fontW->elfScript, -1, |
| 213 | font16->elfScript, LF_FACESIZE, NULL, NULL ); |
| 214 | font16->elfScript[LF_FACESIZE-1] = '\0'; |
| 215 | } |
| 216 | |
| 217 | void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEXA fontA ) |
| 218 | { |
| 219 | FONT_LogFontWToA( (LPLOGFONTW)fontW, (LPLOGFONTA)fontA); |
| 220 | |
| 221 | WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1, |
| 222 | fontA->elfFullName, LF_FULLFACESIZE, NULL, NULL ); |
| 223 | fontA->elfFullName[LF_FULLFACESIZE-1] = '\0'; |
| 224 | WideCharToMultiByte( CP_ACP, 0, fontW->elfStyle, -1, |
| 225 | fontA->elfStyle, LF_FACESIZE, NULL, NULL ); |
| 226 | fontA->elfStyle[LF_FACESIZE-1] = '\0'; |
| 227 | WideCharToMultiByte( CP_ACP, 0, fontW->elfScript, -1, |
| 228 | fontA->elfScript, LF_FACESIZE, NULL, NULL ); |
| 229 | fontA->elfScript[LF_FACESIZE-1] = '\0'; |
| 230 | } |
| 231 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 232 | /*********************************************************************** |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 233 | * TEXTMETRIC conversion functions. |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 234 | */ |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 235 | void FONT_TextMetricATo16(const TEXTMETRICA *ptm32, LPTEXTMETRIC16 ptm16 ) |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 236 | { |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 237 | ptm16->tmHeight = ptm32->tmHeight; |
| 238 | ptm16->tmAscent = ptm32->tmAscent; |
| 239 | ptm16->tmDescent = ptm32->tmDescent; |
| 240 | ptm16->tmInternalLeading = ptm32->tmInternalLeading; |
| 241 | ptm16->tmExternalLeading = ptm32->tmExternalLeading; |
| 242 | ptm16->tmAveCharWidth = ptm32->tmAveCharWidth; |
| 243 | ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth; |
| 244 | ptm16->tmWeight = ptm32->tmWeight; |
| 245 | ptm16->tmOverhang = ptm32->tmOverhang; |
| 246 | ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX; |
| 247 | ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 248 | ptm16->tmFirstChar = ptm32->tmFirstChar; |
| 249 | ptm16->tmLastChar = ptm32->tmLastChar; |
| 250 | ptm16->tmDefaultChar = ptm32->tmDefaultChar; |
| 251 | ptm16->tmBreakChar = ptm32->tmBreakChar; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 252 | ptm16->tmItalic = ptm32->tmItalic; |
| 253 | ptm16->tmUnderlined = ptm32->tmUnderlined; |
| 254 | ptm16->tmStruckOut = ptm32->tmStruckOut; |
| 255 | ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily; |
| 256 | ptm16->tmCharSet = ptm32->tmCharSet; |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 257 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 258 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 259 | void FONT_TextMetricWTo16(const TEXTMETRICW *ptm32, LPTEXTMETRIC16 ptm16 ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 260 | { |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 261 | ptm16->tmHeight = ptm32->tmHeight; |
| 262 | ptm16->tmAscent = ptm32->tmAscent; |
| 263 | ptm16->tmDescent = ptm32->tmDescent; |
| 264 | ptm16->tmInternalLeading = ptm32->tmInternalLeading; |
| 265 | ptm16->tmExternalLeading = ptm32->tmExternalLeading; |
| 266 | ptm16->tmAveCharWidth = ptm32->tmAveCharWidth; |
| 267 | ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth; |
| 268 | ptm16->tmWeight = ptm32->tmWeight; |
| 269 | ptm16->tmOverhang = ptm32->tmOverhang; |
| 270 | ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX; |
| 271 | ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY; |
| 272 | ptm16->tmFirstChar = ptm32->tmFirstChar; |
| 273 | ptm16->tmLastChar = ptm32->tmLastChar; |
| 274 | ptm16->tmDefaultChar = ptm32->tmDefaultChar; |
| 275 | ptm16->tmBreakChar = ptm32->tmBreakChar; |
| 276 | ptm16->tmItalic = ptm32->tmItalic; |
| 277 | ptm16->tmUnderlined = ptm32->tmUnderlined; |
| 278 | ptm16->tmStruckOut = ptm32->tmStruckOut; |
| 279 | ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily; |
| 280 | ptm16->tmCharSet = ptm32->tmCharSet; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 281 | } |
| 282 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 283 | void FONT_TextMetric16ToA(const TEXTMETRIC16 *ptm16, LPTEXTMETRICA ptm32 ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 284 | { |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 285 | ptm32->tmHeight = ptm16->tmHeight; |
| 286 | ptm32->tmAscent = ptm16->tmAscent; |
| 287 | ptm32->tmDescent = ptm16->tmDescent; |
| 288 | ptm32->tmInternalLeading = ptm16->tmInternalLeading; |
| 289 | ptm32->tmExternalLeading = ptm16->tmExternalLeading; |
| 290 | ptm32->tmAveCharWidth = ptm16->tmAveCharWidth; |
| 291 | ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth; |
| 292 | ptm32->tmWeight = ptm16->tmWeight; |
| 293 | ptm32->tmOverhang = ptm16->tmOverhang; |
| 294 | ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX; |
| 295 | ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 296 | ptm32->tmFirstChar = ptm16->tmFirstChar; |
| 297 | ptm32->tmLastChar = ptm16->tmLastChar; |
| 298 | ptm32->tmDefaultChar = ptm16->tmDefaultChar; |
| 299 | ptm32->tmBreakChar = ptm16->tmBreakChar; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 300 | ptm32->tmItalic = ptm16->tmItalic; |
| 301 | ptm32->tmUnderlined = ptm16->tmUnderlined; |
| 302 | ptm32->tmStruckOut = ptm16->tmStruckOut; |
| 303 | ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily; |
| 304 | ptm32->tmCharSet = ptm16->tmCharSet; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 305 | } |
| 306 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 307 | void FONT_TextMetric16ToW(const TEXTMETRIC16 *ptm16, LPTEXTMETRICW ptm32 ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 308 | { |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 309 | ptm32->tmHeight = ptm16->tmHeight; |
| 310 | ptm32->tmAscent = ptm16->tmAscent; |
| 311 | ptm32->tmDescent = ptm16->tmDescent; |
| 312 | ptm32->tmInternalLeading = ptm16->tmInternalLeading; |
| 313 | ptm32->tmExternalLeading = ptm16->tmExternalLeading; |
| 314 | ptm32->tmAveCharWidth = ptm16->tmAveCharWidth; |
| 315 | ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth; |
| 316 | ptm32->tmWeight = ptm16->tmWeight; |
| 317 | ptm32->tmOverhang = ptm16->tmOverhang; |
| 318 | ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX; |
| 319 | ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY; |
| 320 | ptm32->tmFirstChar = ptm16->tmFirstChar; |
| 321 | ptm32->tmLastChar = ptm16->tmLastChar; |
| 322 | ptm32->tmDefaultChar = ptm16->tmDefaultChar; |
| 323 | ptm32->tmBreakChar = ptm16->tmBreakChar; |
| 324 | ptm32->tmItalic = ptm16->tmItalic; |
| 325 | ptm32->tmUnderlined = ptm16->tmUnderlined; |
| 326 | ptm32->tmStruckOut = ptm16->tmStruckOut; |
| 327 | ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily; |
| 328 | ptm32->tmCharSet = ptm16->tmCharSet; |
| 329 | } |
| 330 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 331 | void FONT_TextMetricAToW(const TEXTMETRICA *ptm32A, LPTEXTMETRICW ptm32W ) |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 332 | { |
| 333 | ptm32W->tmHeight = ptm32A->tmHeight; |
| 334 | ptm32W->tmAscent = ptm32A->tmAscent; |
| 335 | ptm32W->tmDescent = ptm32A->tmDescent; |
| 336 | ptm32W->tmInternalLeading = ptm32A->tmInternalLeading; |
| 337 | ptm32W->tmExternalLeading = ptm32A->tmExternalLeading; |
| 338 | ptm32W->tmAveCharWidth = ptm32A->tmAveCharWidth; |
| 339 | ptm32W->tmMaxCharWidth = ptm32A->tmMaxCharWidth; |
| 340 | ptm32W->tmWeight = ptm32A->tmWeight; |
| 341 | ptm32W->tmOverhang = ptm32A->tmOverhang; |
| 342 | ptm32W->tmDigitizedAspectX = ptm32A->tmDigitizedAspectX; |
| 343 | ptm32W->tmDigitizedAspectY = ptm32A->tmDigitizedAspectY; |
| 344 | ptm32W->tmFirstChar = ptm32A->tmFirstChar; |
| 345 | ptm32W->tmLastChar = ptm32A->tmLastChar; |
| 346 | ptm32W->tmDefaultChar = ptm32A->tmDefaultChar; |
| 347 | ptm32W->tmBreakChar = ptm32A->tmBreakChar; |
| 348 | ptm32W->tmItalic = ptm32A->tmItalic; |
| 349 | ptm32W->tmUnderlined = ptm32A->tmUnderlined; |
| 350 | ptm32W->tmStruckOut = ptm32A->tmStruckOut; |
| 351 | ptm32W->tmPitchAndFamily = ptm32A->tmPitchAndFamily; |
| 352 | ptm32W->tmCharSet = ptm32A->tmCharSet; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 353 | } |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 354 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 355 | void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) |
| 356 | { |
| 357 | ptmA->tmHeight = ptmW->tmHeight; |
| 358 | ptmA->tmAscent = ptmW->tmAscent; |
| 359 | ptmA->tmDescent = ptmW->tmDescent; |
| 360 | ptmA->tmInternalLeading = ptmW->tmInternalLeading; |
| 361 | ptmA->tmExternalLeading = ptmW->tmExternalLeading; |
| 362 | ptmA->tmAveCharWidth = ptmW->tmAveCharWidth; |
| 363 | ptmA->tmMaxCharWidth = ptmW->tmMaxCharWidth; |
| 364 | ptmA->tmWeight = ptmW->tmWeight; |
| 365 | ptmA->tmOverhang = ptmW->tmOverhang; |
| 366 | ptmA->tmDigitizedAspectX = ptmW->tmDigitizedAspectX; |
| 367 | ptmA->tmDigitizedAspectY = ptmW->tmDigitizedAspectY; |
| 368 | ptmA->tmFirstChar = ptmW->tmFirstChar; |
| 369 | ptmA->tmLastChar = ptmW->tmLastChar; |
| 370 | ptmA->tmDefaultChar = ptmW->tmDefaultChar; |
| 371 | ptmA->tmBreakChar = ptmW->tmBreakChar; |
| 372 | ptmA->tmItalic = ptmW->tmItalic; |
| 373 | ptmA->tmUnderlined = ptmW->tmUnderlined; |
| 374 | ptmA->tmStruckOut = ptmW->tmStruckOut; |
| 375 | ptmA->tmPitchAndFamily = ptmW->tmPitchAndFamily; |
| 376 | ptmA->tmCharSet = ptmW->tmCharSet; |
| 377 | } |
| 378 | |
| 379 | |
| 380 | void FONT_NewTextMetricExWTo16(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEX16 ptm16 ) |
| 381 | { |
| 382 | FONT_TextMetricWTo16((LPTEXTMETRICW)ptmW, (LPTEXTMETRIC16)ptm16); |
Huw D M Davies | 26ee2ca | 2001-04-04 00:09:53 +0000 | [diff] [blame] | 383 | ptm16->ntmTm.ntmFlags = ptmW->ntmTm.ntmFlags; |
| 384 | ptm16->ntmTm.ntmSizeEM = ptmW->ntmTm.ntmSizeEM; |
| 385 | ptm16->ntmTm.ntmCellHeight = ptmW->ntmTm.ntmCellHeight; |
| 386 | ptm16->ntmTm.ntmAvgWidth = ptmW->ntmTm.ntmAvgWidth; |
| 387 | memcpy(&ptm16->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE)); |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEXA ptmA ) |
| 391 | { |
| 392 | FONT_TextMetricWToA((LPTEXTMETRICW)ptmW, (LPTEXTMETRICA)ptmA); |
Huw D M Davies | 26ee2ca | 2001-04-04 00:09:53 +0000 | [diff] [blame] | 393 | ptmA->ntmTm.ntmFlags = ptmW->ntmTm.ntmFlags; |
| 394 | ptmA->ntmTm.ntmSizeEM = ptmW->ntmTm.ntmSizeEM; |
| 395 | ptmA->ntmTm.ntmCellHeight = ptmW->ntmTm.ntmCellHeight; |
| 396 | ptmA->ntmTm.ntmAvgWidth = ptmW->ntmTm.ntmAvgWidth; |
| 397 | memcpy(&ptmA->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE)); |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | void FONT_NewTextMetricEx16ToW(const NEWTEXTMETRICEX16 *ptm16, LPNEWTEXTMETRICEXW ptmW ) |
| 401 | { |
| 402 | FONT_TextMetric16ToW((LPTEXTMETRIC16)ptm16, (LPTEXTMETRICW)ptmW); |
Huw D M Davies | 26ee2ca | 2001-04-04 00:09:53 +0000 | [diff] [blame] | 403 | ptmW->ntmTm.ntmFlags = ptm16->ntmTm.ntmFlags; |
| 404 | ptmW->ntmTm.ntmSizeEM = ptm16->ntmTm.ntmSizeEM; |
| 405 | ptmW->ntmTm.ntmCellHeight = ptm16->ntmTm.ntmCellHeight; |
| 406 | ptmW->ntmTm.ntmAvgWidth = ptm16->ntmTm.ntmAvgWidth; |
| 407 | memcpy(&ptmW->ntmFontSig, &ptm16->ntmFontSig, sizeof(FONTSIGNATURE)); |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 411 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 412 | * CreateFontIndirect (GDI.57) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 413 | */ |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 414 | HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 ) |
| 415 | { |
| 416 | LOGFONTW lfW; |
| 417 | |
| 418 | if(plf16) { |
| 419 | FONT_LogFont16ToW( plf16, &lfW ); |
| 420 | return CreateFontIndirectW( &lfW ); |
| 421 | } else { |
| 422 | return CreateFontIndirectW( NULL ); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | |
| 427 | /*********************************************************************** |
| 428 | * CreateFontIndirectA (GDI32.@) |
| 429 | */ |
| 430 | HFONT WINAPI CreateFontIndirectA( const LOGFONTA *plfA ) |
| 431 | { |
| 432 | LOGFONTW lfW; |
| 433 | |
| 434 | if (plfA) { |
| 435 | FONT_LogFontAToW( plfA, &lfW ); |
| 436 | return CreateFontIndirectW( &lfW ); |
| 437 | } else |
| 438 | return CreateFontIndirectW( NULL ); |
| 439 | |
| 440 | } |
| 441 | |
| 442 | /*********************************************************************** |
| 443 | * CreateFontIndirectW (GDI32.@) |
| 444 | */ |
| 445 | HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 446 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 447 | HFONT hFont = 0; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 448 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 449 | if (plf) |
Alexandre Julliard | ca22b33 | 1996-07-12 19:02:39 +0000 | [diff] [blame] | 450 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 451 | FONTOBJ* fontPtr; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 452 | if ((fontPtr = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC, &hFont ))) |
| 453 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 454 | memcpy( &fontPtr->logfont, plf, sizeof(LOGFONTW) ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 455 | |
Francois Gouget | ee285b7 | 2001-05-11 20:03:40 +0000 | [diff] [blame] | 456 | TRACE("(%ld %ld %ld %ld) %s %s %s => %04x\n", |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 457 | plf->lfHeight, plf->lfWidth, |
| 458 | plf->lfEscapement, plf->lfOrientation, |
| 459 | debugstr_w(plf->lfFaceName), |
| 460 | plf->lfWeight > 400 ? "Bold" : "", |
| 461 | plf->lfItalic ? "Italic" : "", hFont); |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 462 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 463 | if (plf->lfEscapement != plf->lfOrientation) { |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 464 | /* this should really depend on whether GM_ADVANCED is set */ |
| 465 | fontPtr->logfont.lfOrientation = fontPtr->logfont.lfEscapement; |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 466 | WARN("orientation angle %f set to " |
| 467 | "escapement angle %f for new font %04x\n", |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 468 | plf->lfOrientation/10., plf->lfEscapement/10., hFont); |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 469 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 470 | GDI_ReleaseObj( hFont ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 471 | } |
| 472 | } |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 473 | else WARN("(NULL) => NULL\n"); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 474 | |
| 475 | return hFont; |
| 476 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 477 | |
| 478 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 479 | * CreateFont (GDI.56) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 480 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 481 | HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient, |
| 482 | INT16 weight, BYTE italic, BYTE underline, |
| 483 | BYTE strikeout, BYTE charset, BYTE outpres, |
| 484 | BYTE clippres, BYTE quality, BYTE pitch, |
| 485 | LPCSTR name ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 486 | { |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 487 | LOGFONT16 logfont; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 488 | |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 489 | logfont.lfHeight = height; |
| 490 | logfont.lfWidth = width; |
| 491 | logfont.lfEscapement = esc; |
| 492 | logfont.lfOrientation = orient; |
| 493 | logfont.lfWeight = weight; |
| 494 | logfont.lfItalic = italic; |
| 495 | logfont.lfUnderline = underline; |
| 496 | logfont.lfStrikeOut = strikeout; |
| 497 | logfont.lfCharSet = charset; |
| 498 | logfont.lfOutPrecision = outpres; |
| 499 | logfont.lfClipPrecision = clippres; |
| 500 | logfont.lfQuality = quality; |
| 501 | logfont.lfPitchAndFamily = pitch; |
| 502 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 503 | if (name) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 504 | lstrcpynA(logfont.lfFaceName,name,sizeof(logfont.lfFaceName)); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 505 | else |
| 506 | logfont.lfFaceName[0] = '\0'; |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 507 | |
Alexandre Julliard | ca22b33 | 1996-07-12 19:02:39 +0000 | [diff] [blame] | 508 | return CreateFontIndirect16( &logfont ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 509 | } |
| 510 | |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 511 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 512 | * CreateFontA (GDI32.@) |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 513 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 514 | HFONT WINAPI CreateFontA( INT height, INT width, INT esc, |
| 515 | INT orient, INT weight, DWORD italic, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 516 | DWORD underline, DWORD strikeout, DWORD charset, |
| 517 | DWORD outpres, DWORD clippres, DWORD quality, |
| 518 | DWORD pitch, LPCSTR name ) |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 519 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 520 | LOGFONTA logfont; |
| 521 | |
| 522 | logfont.lfHeight = height; |
| 523 | logfont.lfWidth = width; |
| 524 | logfont.lfEscapement = esc; |
| 525 | logfont.lfOrientation = orient; |
| 526 | logfont.lfWeight = weight; |
| 527 | logfont.lfItalic = italic; |
| 528 | logfont.lfUnderline = underline; |
| 529 | logfont.lfStrikeOut = strikeout; |
| 530 | logfont.lfCharSet = charset; |
| 531 | logfont.lfOutPrecision = outpres; |
| 532 | logfont.lfClipPrecision = clippres; |
| 533 | logfont.lfQuality = quality; |
| 534 | logfont.lfPitchAndFamily = pitch; |
| 535 | |
| 536 | if (name) |
| 537 | lstrcpynA(logfont.lfFaceName,name,sizeof(logfont.lfFaceName)); |
| 538 | else |
| 539 | logfont.lfFaceName[0] = '\0'; |
| 540 | |
| 541 | return CreateFontIndirectA( &logfont ); |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 542 | } |
| 543 | |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 544 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 545 | * CreateFontW (GDI32.@) |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 546 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 547 | HFONT WINAPI CreateFontW( INT height, INT width, INT esc, |
| 548 | INT orient, INT weight, DWORD italic, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 549 | DWORD underline, DWORD strikeout, DWORD charset, |
| 550 | DWORD outpres, DWORD clippres, DWORD quality, |
| 551 | DWORD pitch, LPCWSTR name ) |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 552 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 553 | LOGFONTW logfont; |
| 554 | |
| 555 | logfont.lfHeight = height; |
| 556 | logfont.lfWidth = width; |
| 557 | logfont.lfEscapement = esc; |
| 558 | logfont.lfOrientation = orient; |
| 559 | logfont.lfWeight = weight; |
| 560 | logfont.lfItalic = italic; |
| 561 | logfont.lfUnderline = underline; |
| 562 | logfont.lfStrikeOut = strikeout; |
| 563 | logfont.lfCharSet = charset; |
| 564 | logfont.lfOutPrecision = outpres; |
| 565 | logfont.lfClipPrecision = clippres; |
| 566 | logfont.lfQuality = quality; |
| 567 | logfont.lfPitchAndFamily = pitch; |
| 568 | |
| 569 | if (name) |
| 570 | lstrcpynW(logfont.lfFaceName, name, |
| 571 | sizeof(logfont.lfFaceName) / sizeof(WCHAR)); |
| 572 | else |
| 573 | logfont.lfFaceName[0] = '\0'; |
| 574 | |
| 575 | return CreateFontIndirectW( &logfont ); |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 579 | /*********************************************************************** |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 580 | * FONT_GetObject16 |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 581 | */ |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 582 | INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 583 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 584 | LOGFONT16 lf16; |
| 585 | |
| 586 | FONT_LogFontWTo16( &font->logfont, &lf16 ); |
| 587 | |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 588 | if (count > sizeof(LOGFONT16)) count = sizeof(LOGFONT16); |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 589 | memcpy( buffer, &lf16, count ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 590 | return count; |
| 591 | } |
| 592 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 593 | /*********************************************************************** |
Huw D M Davies | aec373c | 1999-07-23 19:25:11 +0000 | [diff] [blame] | 594 | * FONT_GetObjectA |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 595 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 596 | INT FONT_GetObjectA( FONTOBJ *font, INT count, LPSTR buffer ) |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 597 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 598 | LOGFONTA lfA; |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 599 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 600 | FONT_LogFontWToA( &font->logfont, &lfA ); |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 601 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 602 | if (count > sizeof(lfA)) count = sizeof(lfA); |
| 603 | memcpy( buffer, &lfA, count ); |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 604 | return count; |
| 605 | } |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 606 | /*********************************************************************** |
Huw D M Davies | aec373c | 1999-07-23 19:25:11 +0000 | [diff] [blame] | 607 | * FONT_GetObjectW |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 608 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 609 | INT FONT_GetObjectW( FONTOBJ *font, INT count, LPSTR buffer ) |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 610 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 611 | if (count > sizeof(LOGFONTW)) count = sizeof(LOGFONTW); |
| 612 | memcpy( buffer, &font->logfont, count ); |
Juergen Schmied | cba8488 | 1998-10-23 13:27:36 +0000 | [diff] [blame] | 613 | return count; |
| 614 | } |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 615 | |
| 616 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 617 | /*********************************************************************** |
| 618 | * FONT_EnumInstance16 |
| 619 | * |
| 620 | * Called by the device driver layer to pass font info |
| 621 | * down to the application. |
| 622 | */ |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 623 | static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, |
| 624 | DWORD fType, LPARAM lp ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 625 | { |
| 626 | #define pfe ((fontEnum16*)lp) |
| 627 | if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || |
| 628 | pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet ) |
| 629 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 630 | FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont); |
| 631 | FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric); |
| 632 | return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, |
| 633 | (UINT16)fType, (LPARAM)(pfe->lpData) ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 634 | } |
| 635 | #undef pfe |
| 636 | return 1; |
| 637 | } |
| 638 | |
| 639 | /*********************************************************************** |
Huw D M Davies | aec373c | 1999-07-23 19:25:11 +0000 | [diff] [blame] | 640 | * FONT_EnumInstance |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 641 | */ |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 642 | static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, |
| 643 | DWORD fType, LPARAM lp ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 644 | { |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 645 | /* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */ |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 646 | |
| 647 | #define pfe ((fontEnum32*)lp) |
| 648 | if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || |
| 649 | pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet ) |
| 650 | { |
| 651 | /* convert font metrics */ |
| 652 | |
| 653 | if( pfe->dwFlags & ENUM_UNICODE ) |
| 654 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 655 | return pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 656 | } |
| 657 | else |
| 658 | { |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 659 | ENUMLOGFONTEXA logfont; |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 660 | NEWTEXTMETRICEXA tmA; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 661 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 662 | FONT_EnumLogFontExWToA( plf, &logfont); |
| 663 | FONT_NewTextMetricExWToA( ptm, &tmA ); |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 664 | |
| 665 | return pfe->lpEnumFunc( (LPENUMLOGFONTEXW)&logfont, |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 666 | (LPNEWTEXTMETRICEXW)&tmA, fType, |
| 667 | pfe->lpData ); |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 668 | } |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 669 | } |
| 670 | #undef pfe |
| 671 | return 1; |
| 672 | } |
| 673 | |
| 674 | /*********************************************************************** |
| 675 | * EnumFontFamiliesEx16 (GDI.613) |
| 676 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 677 | INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf, |
| 678 | FONTENUMPROCEX16 efproc, LPARAM lParam, |
| 679 | DWORD dwFlags) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 680 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 681 | BOOL (*enum_func)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 682 | INT16 retVal = 0; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 683 | DC* dc = DC_GetDCPtr( hDC ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 684 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 685 | if (!dc) return 0; |
| 686 | enum_func = dc->funcs->pEnumDeviceFonts; |
| 687 | GDI_ReleaseObj( hDC ); |
| 688 | |
| 689 | if (enum_func) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 690 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 691 | LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 692 | if( lptm16 ) |
| 693 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 694 | LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 695 | if( lplf16 ) |
| 696 | { |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 697 | fontEnum16 fe16; |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 698 | LOGFONTW lfW; |
| 699 | FONT_LogFont16ToW(plf, &lfW); |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 700 | |
| 701 | fe16.lpLogFontParam = plf; |
| 702 | fe16.lpEnumFunc = efproc; |
| 703 | fe16.lpData = lParam; |
| 704 | |
| 705 | fe16.lpTextMetric = lptm16; |
| 706 | fe16.lpLogFont = lplf16; |
| 707 | fe16.segTextMetric = SEGPTR_GET(lptm16); |
| 708 | fe16.segLogFont = SEGPTR_GET(lplf16); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 709 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 710 | retVal = enum_func( hDC, &lfW, FONT_EnumInstance16, |
| 711 | (LPARAM)&fe16 ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 712 | SEGPTR_FREE(lplf16); |
| 713 | } |
| 714 | SEGPTR_FREE(lptm16); |
| 715 | } |
| 716 | } |
| 717 | return retVal; |
| 718 | } |
| 719 | |
| 720 | /*********************************************************************** |
Huw D M Davies | aec373c | 1999-07-23 19:25:11 +0000 | [diff] [blame] | 721 | * FONT_EnumFontFamiliesEx |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 722 | */ |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 723 | static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, |
| 724 | FONTENUMPROCEXW efproc, |
| 725 | LPARAM lParam, DWORD dwUnicode) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 726 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 727 | BOOL (*enum_func)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 728 | INT ret = 1; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 729 | DC *dc = DC_GetDCPtr( hDC ); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 730 | fontEnum32 fe32; |
| 731 | BOOL enum_gdi_fonts; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 732 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 733 | if (!dc) return 0; |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 734 | |
| 735 | fe32.lpLogFontParam = plf; |
| 736 | fe32.lpEnumFunc = efproc; |
| 737 | fe32.lpData = lParam; |
| 738 | fe32.dwFlags = dwUnicode; |
| 739 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 740 | enum_func = dc->funcs->pEnumDeviceFonts; |
| 741 | GDI_ReleaseObj( hDC ); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 742 | enum_gdi_fonts = GetDeviceCaps(hDC, TEXTCAPS) & TC_VA_ABLE; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 743 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 744 | if (!enum_func && !enum_gdi_fonts) return 0; |
| 745 | |
| 746 | if (enum_gdi_fonts) |
| 747 | ret = WineEngEnumFonts( plf, FONT_EnumInstance, (LPARAM)&fe32 ); |
| 748 | if (ret && enum_func) |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 749 | ret = enum_func( hDC, plf, FONT_EnumInstance, (LPARAM)&fe32 ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 750 | return ret; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 751 | } |
| 752 | |
| 753 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 754 | * EnumFontFamiliesExW (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 755 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 756 | INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf, |
| 757 | FONTENUMPROCEXW efproc, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 758 | LPARAM lParam, DWORD dwFlags ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 759 | { |
Ulrich Czekalla | e6ab9d3 | 1999-10-24 17:26:45 +0000 | [diff] [blame] | 760 | return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lParam, ENUM_UNICODE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 764 | * EnumFontFamiliesExA (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 765 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 766 | INT WINAPI EnumFontFamiliesExA( HDC hDC, LPLOGFONTA plf, |
| 767 | FONTENUMPROCEXA efproc, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 768 | LPARAM lParam, DWORD dwFlags) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 769 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 770 | LOGFONTW lfW; |
| 771 | FONT_LogFontAToW( plf, &lfW ); |
| 772 | |
| 773 | return FONT_EnumFontFamiliesEx( hDC, &lfW, |
| 774 | (FONTENUMPROCEXW)efproc, lParam, 0); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 775 | } |
| 776 | |
| 777 | /*********************************************************************** |
| 778 | * EnumFontFamilies16 (GDI.330) |
| 779 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 780 | INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily, |
| 781 | FONTENUMPROC16 efproc, LPARAM lpData ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 782 | { |
| 783 | LOGFONT16 lf; |
| 784 | |
| 785 | lf.lfCharSet = DEFAULT_CHARSET; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 786 | if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 787 | else lf.lfFaceName[0] = '\0'; |
| 788 | |
| 789 | return EnumFontFamiliesEx16( hDC, &lf, (FONTENUMPROCEX16)efproc, lpData, 0 ); |
| 790 | } |
| 791 | |
| 792 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 793 | * EnumFontFamiliesA (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 794 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 795 | INT WINAPI EnumFontFamiliesA( HDC hDC, LPCSTR lpFamily, |
| 796 | FONTENUMPROCA efproc, LPARAM lpData ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 797 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 798 | LOGFONTA lf; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 799 | |
| 800 | lf.lfCharSet = DEFAULT_CHARSET; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 801 | if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 802 | else lf.lfFaceName[0] = lf.lfFaceName[1] = '\0'; |
| 803 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 804 | return EnumFontFamiliesExA( hDC, &lf, (FONTENUMPROCEXA)efproc, lpData, 0 ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 808 | * EnumFontFamiliesW (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 809 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 810 | INT WINAPI EnumFontFamiliesW( HDC hDC, LPCWSTR lpFamily, |
| 811 | FONTENUMPROCW efproc, LPARAM lpData ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 812 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 813 | LOGFONTW lf; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 814 | |
| 815 | lf.lfCharSet = DEFAULT_CHARSET; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 816 | if( lpFamily ) lstrcpynW( lf.lfFaceName, lpFamily, LF_FACESIZE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 817 | else lf.lfFaceName[0] = 0; |
| 818 | |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 819 | return EnumFontFamiliesExW( hDC, &lf, (FONTENUMPROCEXW)efproc, lpData, 0 ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 820 | } |
| 821 | |
| 822 | /*********************************************************************** |
| 823 | * EnumFonts16 (GDI.70) |
| 824 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 825 | INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc, |
| 826 | LPARAM lpData ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 827 | { |
| 828 | return EnumFontFamilies16( hDC, lpName, (FONTENUMPROCEX16)efproc, lpData ); |
| 829 | } |
| 830 | |
| 831 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 832 | * EnumFontsA (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 833 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 834 | INT WINAPI EnumFontsA( HDC hDC, LPCSTR lpName, FONTENUMPROCA efproc, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 835 | LPARAM lpData ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 836 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 837 | return EnumFontFamiliesA( hDC, lpName, efproc, lpData ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 838 | } |
| 839 | |
| 840 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 841 | * EnumFontsW (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 842 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 843 | INT WINAPI EnumFontsW( HDC hDC, LPCWSTR lpName, FONTENUMPROCW efproc, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 844 | LPARAM lpData ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 845 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 846 | return EnumFontFamiliesW( hDC, lpName, efproc, lpData ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 847 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 848 | |
| 849 | |
| 850 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 851 | * GetTextCharacterExtra (GDI.89) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 852 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 853 | INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 854 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 855 | return (INT16)GetTextCharacterExtra( hdc ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 856 | } |
| 857 | |
| 858 | |
| 859 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 860 | * GetTextCharacterExtra (GDI32.@) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 861 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 862 | INT WINAPI GetTextCharacterExtra( HDC hdc ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 863 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 864 | INT ret; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 865 | DC *dc = DC_GetDCPtr( hdc ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 866 | if (!dc) return 0; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 867 | ret = abs( (dc->charExtra * dc->wndExtX + dc->vportExtX / 2) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 868 | / dc->vportExtX ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 869 | GDI_ReleaseObj( hdc ); |
| 870 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 871 | } |
| 872 | |
| 873 | |
| 874 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 875 | * SetTextCharacterExtra (GDI.8) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 876 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 877 | INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 878 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 879 | return (INT16)SetTextCharacterExtra( hdc, extra ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 880 | } |
| 881 | |
| 882 | |
| 883 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 884 | * SetTextCharacterExtra (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 885 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 886 | INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 887 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 888 | INT prev; |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 889 | DC * dc = DC_GetDCPtr( hdc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 890 | if (!dc) return 0; |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 891 | if (dc->funcs->pSetTextCharacterExtra) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 892 | prev = dc->funcs->pSetTextCharacterExtra( dc, extra ); |
| 893 | else |
| 894 | { |
| 895 | extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 896 | prev = (dc->charExtra * dc->wndExtX + dc->vportExtX / 2) / dc->vportExtX; |
| 897 | dc->charExtra = abs(extra); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 898 | } |
| 899 | GDI_ReleaseObj( hdc ); |
| 900 | return prev; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 901 | } |
| 902 | |
| 903 | |
| 904 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 905 | * SetTextJustification (GDI.10) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 906 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 907 | INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 908 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 909 | return SetTextJustification( hdc, extra, breaks ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 910 | } |
| 911 | |
| 912 | |
| 913 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 914 | * SetTextJustification (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 915 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 916 | BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 917 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 918 | BOOL ret = TRUE; |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 919 | DC * dc = DC_GetDCPtr( hdc ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 920 | if (!dc) return FALSE; |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 921 | if (dc->funcs->pSetTextJustification) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 922 | ret = dc->funcs->pSetTextJustification( dc, extra, breaks ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 923 | else |
| 924 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 925 | extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX); |
| 926 | if (!extra) breaks = 0; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 927 | dc->breakTotalExtra = extra; |
| 928 | dc->breakCount = breaks; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 929 | if (breaks) |
| 930 | { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 931 | dc->breakExtra = extra / breaks; |
| 932 | dc->breakRem = extra - (dc->breakCount * dc->breakExtra); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 933 | } |
| 934 | else |
| 935 | { |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 936 | dc->breakExtra = 0; |
| 937 | dc->breakRem = 0; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 938 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 939 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 940 | GDI_ReleaseObj( hdc ); |
| 941 | return ret; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 942 | } |
| 943 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 944 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 945 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 946 | * GetTextFace (GDI.92) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 947 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 948 | INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name ) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 949 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 950 | return GetTextFaceA(hdc,count,name); |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 951 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 952 | |
| 953 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 954 | * GetTextFaceA (GDI32.@) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 955 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 956 | INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name ) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 957 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 958 | INT res = GetTextFaceW(hdc, 0, NULL); |
| 959 | LPWSTR nameW = HeapAlloc( GetProcessHeap(), 0, res * 2 ); |
| 960 | GetTextFaceW( hdc, res, nameW ); |
| 961 | |
| 962 | if (name) |
| 963 | res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, |
| 964 | NULL, NULL); |
| 965 | else |
| 966 | res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL); |
| 967 | HeapFree( GetProcessHeap(), 0, nameW ); |
| 968 | return res; |
| 969 | } |
| 970 | |
| 971 | /*********************************************************************** |
| 972 | * GetTextFaceW (GDI32.@) |
| 973 | */ |
| 974 | INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name ) |
| 975 | { |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 976 | FONTOBJ *font; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 977 | INT ret = 0; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 978 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 979 | DC * dc = DC_GetDCPtr( hdc ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 980 | if (!dc) return 0; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 981 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 982 | if ((font = (FONTOBJ *) GDI_GetObjPtr( dc->hFont, FONT_MAGIC ))) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 983 | { |
| 984 | if (name) |
| 985 | { |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 986 | lstrcpynW( name, font->logfont.lfFaceName, count ); |
| 987 | ret = strlenW(name); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 988 | } |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 989 | else ret = strlenW(font->logfont.lfFaceName) + 1; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 990 | GDI_ReleaseObj( dc->hFont ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 991 | } |
| 992 | GDI_ReleaseObj( hdc ); |
| 993 | return ret; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 994 | } |
| 995 | |
| 996 | |
| 997 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 998 | * GetTextExtent (GDI.91) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 999 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1000 | DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1001 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1002 | SIZE16 size; |
| 1003 | if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0; |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 1004 | return MAKELONG( size.cx, size.cy ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | |
| 1008 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1009 | * GetTextExtentPoint (GDI.471) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1010 | * |
| 1011 | * FIXME: Should this have a bug for compatibility? |
| 1012 | * Original Windows versions of GetTextExtentPoint{A,W} have documented |
Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 1013 | * bugs (-> MSDN KB q147647.txt). |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1014 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1015 | BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, |
| 1016 | LPSIZE16 size ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1017 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1018 | SIZE size32; |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1019 | BOOL ret; |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 1020 | TRACE("%04x, %p (%s), %d, %p\n", hdc, str, debugstr_an(str, count), count, size); |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1021 | ret = GetTextExtentPoint32A( hdc, str, count, &size32 ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 1022 | size->cx = size32.cx; |
| 1023 | size->cy = size32.cy; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1024 | return (BOOL16)ret; |
| 1025 | } |
| 1026 | |
| 1027 | |
| 1028 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1029 | * GetTextExtentPoint32A (GDI32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1030 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1031 | BOOL WINAPI GetTextExtentPoint32A( HDC hdc, LPCSTR str, INT count, |
| 1032 | LPSIZE size ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1033 | { |
Hidenori Takeshima | 7901c0b | 2000-08-20 20:08:35 +0000 | [diff] [blame] | 1034 | BOOL ret = FALSE; |
Huw D M Davies | 2938242 | 2001-09-19 20:32:07 +0000 | [diff] [blame] | 1035 | INT wlen; |
| 1036 | LPWSTR p = FONT_mbtowc(hdc, str, count, &wlen, NULL); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1037 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1038 | if (p) { |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1039 | ret = GetTextExtentPoint32W( hdc, p, wlen, size ); |
| 1040 | HeapFree( GetProcessHeap(), 0, p ); |
Hidenori Takeshima | 7901c0b | 2000-08-20 20:08:35 +0000 | [diff] [blame] | 1041 | } |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1042 | |
Gerald Pfeifer | 1b490b4 | 2000-09-24 03:05:11 +0000 | [diff] [blame] | 1043 | TRACE("(%08x %s %d %p): returning %ld x %ld\n", |
Hidenori Takeshima | 7901c0b | 2000-08-20 20:08:35 +0000 | [diff] [blame] | 1044 | hdc, debugstr_an (str, count), count, size, size->cx, size->cy ); |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1045 | return ret; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | |
| 1049 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1050 | * GetTextExtentPoint32W [GDI32.@] Computes width/height for a string |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1051 | * |
| 1052 | * Computes width and height of the specified string. |
| 1053 | * |
| 1054 | * RETURNS |
| 1055 | * Success: TRUE |
| 1056 | * Failure: FALSE |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1057 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1058 | BOOL WINAPI GetTextExtentPoint32W( |
| 1059 | HDC hdc, /* [in] Handle of device context */ |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1060 | LPCWSTR str, /* [in] Address of text string */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1061 | INT count, /* [in] Number of characters in string */ |
| 1062 | LPSIZE size) /* [out] Address of structure for string size */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1063 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1064 | BOOL ret = FALSE; |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1065 | DC * dc = DC_GetDCPtr( hdc ); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1066 | if (!dc) return FALSE; |
| 1067 | |
| 1068 | if(dc->gdiFont) |
| 1069 | ret = WineEngGetTextExtentPoint(dc->gdiFont, str, count, size); |
| 1070 | else if(dc->funcs->pGetTextExtentPoint) |
| 1071 | ret = dc->funcs->pGetTextExtentPoint( dc, str, count, size ); |
| 1072 | |
| 1073 | GDI_ReleaseObj( hdc ); |
| 1074 | |
Gerald Pfeifer | 1b490b4 | 2000-09-24 03:05:11 +0000 | [diff] [blame] | 1075 | TRACE("(%08x %s %d %p): returning %ld x %ld\n", |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1076 | hdc, debugstr_wn (str, count), count, size, size->cx, size->cy ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1077 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1078 | } |
| 1079 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1080 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1081 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1082 | * GetTextExtentPointA (GDI32.@) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1083 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1084 | BOOL WINAPI GetTextExtentPointA( HDC hdc, LPCSTR str, INT count, |
| 1085 | LPSIZE size ) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1086 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1087 | TRACE("not bug compatible.\n"); |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1088 | return GetTextExtentPoint32A( hdc, str, count, size ); |
| 1089 | } |
| 1090 | |
| 1091 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1092 | * GetTextExtentPointW (GDI32.@) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1093 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1094 | BOOL WINAPI GetTextExtentPointW( HDC hdc, LPCWSTR str, INT count, |
| 1095 | LPSIZE size ) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1096 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1097 | TRACE("not bug compatible.\n"); |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 1098 | return GetTextExtentPoint32W( hdc, str, count, size ); |
| 1099 | } |
| 1100 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1101 | |
| 1102 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1103 | * GetTextExtentExPointA (GDI32.@) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1104 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1105 | BOOL WINAPI GetTextExtentExPointA( HDC hdc, LPCSTR str, INT count, |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1106 | INT maxExt, LPINT lpnFit, |
| 1107 | LPINT alpDx, LPSIZE size ) |
| 1108 | { |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1109 | BOOL ret; |
Huw D M Davies | 2938242 | 2001-09-19 20:32:07 +0000 | [diff] [blame] | 1110 | INT wlen; |
| 1111 | LPWSTR p = FONT_mbtowc( hdc, str, count, &wlen, NULL); |
| 1112 | ret = GetTextExtentExPointW( hdc, p, wlen, maxExt, lpnFit, alpDx, size); |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1113 | HeapFree( GetProcessHeap(), 0, p ); |
| 1114 | return ret; |
| 1115 | } |
| 1116 | |
| 1117 | |
| 1118 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1119 | * GetTextExtentExPointW (GDI32.@) |
Bill Medland | 06a49f6 | 2001-08-24 19:12:56 +0000 | [diff] [blame] | 1120 | * |
| 1121 | * Return the size of the string as it would be if it was output properly by |
| 1122 | * e.g. TextOut. |
| 1123 | * |
| 1124 | * This should include |
| 1125 | * - Intercharacter spacing |
| 1126 | * - justification spacing (not yet done) |
| 1127 | * - kerning? see below |
| 1128 | * |
| 1129 | * Kerning. Since kerning would be carried out by the rendering code it should |
| 1130 | * be done by the driver. However they don't support it yet. Also I am not |
| 1131 | * yet persuaded that (certainly under Win95) any kerning is actually done. |
| 1132 | * |
| 1133 | * str: According to MSDN this should be null-terminated. That is not true; a |
| 1134 | * null will not terminate it early. |
| 1135 | * size: Certainly under Win95 this appears buggy or weird if *lpnFit is less |
| 1136 | * than count. I have seen it be either the size of the full string or |
| 1137 | * 1 less than the size of the full string. I have not seen it bear any |
| 1138 | * resemblance to the portion that would fit. |
| 1139 | * lpnFit: What exactly is fitting? Stupidly, in my opinion, it includes the |
| 1140 | * trailing intercharacter spacing and any trailing justification. |
| 1141 | * |
| 1142 | * FIXME |
| 1143 | * Currently we do this by measuring each character etc. We should do it by |
| 1144 | * passing the request to the driver, perhaps by extending the |
| 1145 | * pGetTextExtentPoint function to take the alpDx argument. That would avoid |
| 1146 | * thinking about kerning issues and rounding issues in the justification. |
Huw D M Davies | c553924 | 1999-12-26 00:47:03 +0000 | [diff] [blame] | 1147 | */ |
| 1148 | |
| 1149 | BOOL WINAPI GetTextExtentExPointW( HDC hdc, LPCWSTR str, INT count, |
| 1150 | INT maxExt, LPINT lpnFit, |
| 1151 | LPINT alpDx, LPSIZE size ) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1152 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1153 | int index, nFit, extent; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1154 | SIZE tSize; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1155 | BOOL ret = FALSE; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1156 | |
Francois Gouget | 551586e | 2001-09-24 01:12:08 +0000 | [diff] [blame] | 1157 | TRACE("(%08x, %s, %d)\n",hdc,debugstr_wn(str,count),maxExt); |
| 1158 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1159 | size->cx = size->cy = nFit = extent = 0; |
| 1160 | for(index = 0; index < count; index++) |
| 1161 | { |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1162 | if(!GetTextExtentPoint32W( hdc, str, 1, &tSize )) goto done; |
Bill Medland | 06a49f6 | 2001-08-24 19:12:56 +0000 | [diff] [blame] | 1163 | /* GetTextExtentPoint includes intercharacter spacing. */ |
| 1164 | /* FIXME - justification needs doing yet. Remember that the base |
| 1165 | * data will not be in logical coordinates. |
| 1166 | */ |
Travis Michielsen | 2bbca90 | 2001-09-07 15:28:32 +0000 | [diff] [blame] | 1167 | extent += tSize.cx; |
| 1168 | if( !lpnFit || extent <= maxExt ) |
Bill Medland | 06a49f6 | 2001-08-24 19:12:56 +0000 | [diff] [blame] | 1169 | /* It is allowed to be equal. */ |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1170 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1171 | nFit++; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1172 | if( alpDx ) alpDx[index] = extent; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1173 | } |
Travis Michielsen | 2bbca90 | 2001-09-07 15:28:32 +0000 | [diff] [blame] | 1174 | if( tSize.cy > size->cy ) size->cy = tSize.cy; |
| 1175 | str++; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1176 | } |
| 1177 | size->cx = extent; |
Dmitry Timoshkov | 96cda94 | 2001-04-16 19:33:51 +0000 | [diff] [blame] | 1178 | if(lpnFit) *lpnFit = nFit; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1179 | ret = TRUE; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1180 | |
Francois Gouget | 551586e | 2001-09-24 01:12:08 +0000 | [diff] [blame] | 1181 | TRACE("returning %d %ld x %ld\n",nFit,size->cx,size->cy); |
Gerald Pfeifer | 1b490b4 | 2000-09-24 03:05:11 +0000 | [diff] [blame] | 1182 | |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1183 | done: |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1184 | return ret; |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1185 | } |
| 1186 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 1187 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1188 | * GetTextMetrics (GDI.93) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1189 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1190 | BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1191 | { |
Huw D M Davies | 39f5428 | 2001-03-16 16:43:14 +0000 | [diff] [blame] | 1192 | TEXTMETRICW tm32; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1193 | |
Huw D M Davies | 39f5428 | 2001-03-16 16:43:14 +0000 | [diff] [blame] | 1194 | if (!GetTextMetricsW( (HDC)hdc, &tm32 )) return FALSE; |
| 1195 | FONT_TextMetricWTo16( &tm32, metrics ); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1196 | return TRUE; |
| 1197 | } |
| 1198 | |
| 1199 | |
| 1200 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1201 | * GetTextMetricsA (GDI32.@) |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 1202 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1203 | BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics ) |
Huw D M Davies | 39f5428 | 2001-03-16 16:43:14 +0000 | [diff] [blame] | 1204 | { |
| 1205 | TEXTMETRICW tm32; |
| 1206 | |
| 1207 | if (!GetTextMetricsW( hdc, &tm32 )) return FALSE; |
| 1208 | FONT_TextMetricWToA( &tm32, metrics ); |
| 1209 | return TRUE; |
| 1210 | } |
| 1211 | |
| 1212 | /*********************************************************************** |
| 1213 | * GetTextMetricsW (GDI32.@) |
| 1214 | */ |
| 1215 | BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics ) |
| 1216 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1217 | BOOL ret = FALSE; |
| 1218 | DC * dc = DC_GetDCPtr( hdc ); |
| 1219 | if (!dc) return FALSE; |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 1220 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1221 | if (dc->gdiFont) |
| 1222 | ret = WineEngGetTextMetrics(dc->gdiFont, metrics); |
| 1223 | else if (dc->funcs->pGetTextMetrics) |
| 1224 | ret = dc->funcs->pGetTextMetrics( dc, metrics ); |
| 1225 | |
| 1226 | if (ret) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1227 | { |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 1228 | /* device layer returns values in device units |
| 1229 | * therefore we have to convert them to logical */ |
| 1230 | |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1231 | #define WDPTOLP(x) ((x<0)? \ |
| 1232 | (-abs((x)*dc->wndExtX/dc->vportExtX)): \ |
| 1233 | (abs((x)*dc->wndExtX/dc->vportExtX))) |
| 1234 | #define HDPTOLP(y) ((y<0)? \ |
| 1235 | (-abs((y)*dc->wndExtY/dc->vportExtY)): \ |
| 1236 | (abs((y)*dc->wndExtY/dc->vportExtY))) |
| 1237 | |
| 1238 | metrics->tmHeight = HDPTOLP(metrics->tmHeight); |
| 1239 | metrics->tmAscent = HDPTOLP(metrics->tmAscent); |
| 1240 | metrics->tmDescent = HDPTOLP(metrics->tmDescent); |
| 1241 | metrics->tmInternalLeading = HDPTOLP(metrics->tmInternalLeading); |
| 1242 | metrics->tmExternalLeading = HDPTOLP(metrics->tmExternalLeading); |
| 1243 | metrics->tmAveCharWidth = WDPTOLP(metrics->tmAveCharWidth); |
| 1244 | metrics->tmMaxCharWidth = WDPTOLP(metrics->tmMaxCharWidth); |
| 1245 | metrics->tmOverhang = WDPTOLP(metrics->tmOverhang); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1246 | ret = TRUE; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1247 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1248 | TRACE("text metrics:\n" |
Huw D M Davies | 39f5428 | 2001-03-16 16:43:14 +0000 | [diff] [blame] | 1249 | " Weight = %03li\t FirstChar = %i\t AveCharWidth = %li\n" |
| 1250 | " Italic = % 3i\t LastChar = %i\t\t MaxCharWidth = %li\n" |
| 1251 | " UnderLined = %01i\t DefaultChar = %i\t Overhang = %li\n" |
| 1252 | " StruckOut = %01i\t BreakChar = %i\t CharSet = %i\n" |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1253 | " PitchAndFamily = %02x\n" |
| 1254 | " --------------------\n" |
| 1255 | " InternalLeading = %li\n" |
| 1256 | " Ascent = %li\n" |
| 1257 | " Descent = %li\n" |
| 1258 | " Height = %li\n", |
| 1259 | metrics->tmWeight, metrics->tmFirstChar, metrics->tmAveCharWidth, |
| 1260 | metrics->tmItalic, metrics->tmLastChar, metrics->tmMaxCharWidth, |
| 1261 | metrics->tmUnderlined, metrics->tmDefaultChar, metrics->tmOverhang, |
| 1262 | metrics->tmStruckOut, metrics->tmBreakChar, metrics->tmCharSet, |
| 1263 | metrics->tmPitchAndFamily, |
| 1264 | metrics->tmInternalLeading, |
| 1265 | metrics->tmAscent, |
| 1266 | metrics->tmDescent, |
| 1267 | metrics->tmHeight ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1268 | } |
| 1269 | GDI_ReleaseObj( hdc ); |
| 1270 | return ret; |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 1271 | } |
| 1272 | |
| 1273 | |
| 1274 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1275 | * GetOutlineTextMetrics [GDI.308] Gets metrics for TrueType fonts. |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1276 | * |
| 1277 | * NOTES |
| 1278 | * lpOTM should be LPOUTLINETEXTMETRIC |
| 1279 | * |
| 1280 | * RETURNS |
| 1281 | * Success: Non-zero or size of required buffer |
| 1282 | * Failure: 0 |
| 1283 | */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1284 | UINT16 WINAPI GetOutlineTextMetrics16( |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1285 | HDC16 hdc, /* [in] Handle of device context */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1286 | UINT16 cbData, /* [in] Size of metric data array */ |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1287 | LPOUTLINETEXTMETRIC16 lpOTM) /* [out] Address of metric data array */ |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1288 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1289 | FIXME("(%04x,%04x,%p): stub\n", hdc,cbData,lpOTM); |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1290 | return 0; |
| 1291 | } |
| 1292 | |
| 1293 | |
| 1294 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1295 | * GetOutlineTextMetricsA (GDI32.@) |
| 1296 | * Gets metrics for TrueType fonts. |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1297 | * |
| 1298 | * |
| 1299 | * RETURNS |
| 1300 | * Success: Non-zero or size of required buffer |
| 1301 | * Failure: 0 |
| 1302 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1303 | UINT WINAPI GetOutlineTextMetricsA( |
| 1304 | HDC hdc, /* [in] Handle of device context */ |
| 1305 | UINT cbData, /* [in] Size of metric data array */ |
| 1306 | LPOUTLINETEXTMETRICA lpOTM) /* [out] Address of metric data array */ |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1307 | { |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1308 | char buf[512], *ptr; |
| 1309 | UINT ret, needed; |
| 1310 | OUTLINETEXTMETRICW *lpOTMW = (OUTLINETEXTMETRICW *)buf; |
| 1311 | INT left, len; |
| 1312 | |
| 1313 | if((ret = GetOutlineTextMetricsW(hdc, sizeof(buf), lpOTMW)) == 0) { |
| 1314 | if((ret = GetOutlineTextMetricsW(hdc, 0, NULL)) == 0) |
| 1315 | return 0; |
| 1316 | lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret); |
| 1317 | GetOutlineTextMetricsW(hdc, ret, lpOTMW); |
| 1318 | } |
| 1319 | |
| 1320 | needed = sizeof(OUTLINETEXTMETRICA); |
| 1321 | if(lpOTMW->otmpFamilyName) |
| 1322 | needed += WideCharToMultiByte(CP_ACP, 0, |
| 1323 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpFamilyName), -1, |
| 1324 | NULL, 0, NULL, NULL); |
| 1325 | if(lpOTMW->otmpFaceName) |
| 1326 | needed += WideCharToMultiByte(CP_ACP, 0, |
| 1327 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpFaceName), -1, |
| 1328 | NULL, 0, NULL, NULL); |
| 1329 | if(lpOTMW->otmpStyleName) |
| 1330 | needed += WideCharToMultiByte(CP_ACP, 0, |
| 1331 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpStyleName), -1, |
| 1332 | NULL, 0, NULL, NULL); |
| 1333 | if(lpOTMW->otmpFullName) |
| 1334 | needed += WideCharToMultiByte(CP_ACP, 0, |
| 1335 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpFullName), -1, |
| 1336 | NULL, 0, NULL, NULL); |
| 1337 | |
| 1338 | if(!lpOTM) { |
| 1339 | ret = needed; |
| 1340 | goto end; |
| 1341 | } |
| 1342 | |
| 1343 | if(needed > cbData) { |
| 1344 | ret = 0; |
| 1345 | goto end; |
| 1346 | } |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1347 | |
| 1348 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1349 | lpOTM->otmSize = needed; |
| 1350 | FONT_TextMetricWToA( &lpOTMW->otmTextMetrics, &lpOTM->otmTextMetrics ); |
Huw D M Davies | 916a1a6 | 2001-03-13 23:31:40 +0000 | [diff] [blame] | 1351 | lpOTM->otmFiller = 0; |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1352 | lpOTM->otmPanoseNumber = lpOTMW->otmPanoseNumber; |
| 1353 | lpOTM->otmfsSelection = lpOTMW->otmfsSelection; |
| 1354 | lpOTM->otmfsType = lpOTMW->otmfsType; |
| 1355 | lpOTM->otmsCharSlopeRise = lpOTMW->otmsCharSlopeRise; |
| 1356 | lpOTM->otmsCharSlopeRun = lpOTMW->otmsCharSlopeRun; |
| 1357 | lpOTM->otmItalicAngle = lpOTMW->otmItalicAngle; |
| 1358 | lpOTM->otmEMSquare = lpOTMW->otmEMSquare; |
| 1359 | lpOTM->otmAscent = lpOTMW->otmAscent; |
| 1360 | lpOTM->otmDescent = lpOTMW->otmDescent; |
| 1361 | lpOTM->otmLineGap = lpOTMW->otmLineGap; |
| 1362 | lpOTM->otmsCapEmHeight = lpOTMW->otmsCapEmHeight; |
| 1363 | lpOTM->otmsXHeight = lpOTMW->otmsXHeight; |
| 1364 | lpOTM->otmrcFontBox = lpOTMW->otmrcFontBox; |
| 1365 | lpOTM->otmMacAscent = lpOTMW->otmMacAscent; |
| 1366 | lpOTM->otmMacDescent = lpOTMW->otmMacDescent; |
| 1367 | lpOTM->otmMacLineGap = lpOTMW->otmMacLineGap; |
| 1368 | lpOTM->otmusMinimumPPEM = lpOTMW->otmusMinimumPPEM; |
| 1369 | lpOTM->otmptSubscriptSize = lpOTMW->otmptSubscriptSize; |
| 1370 | lpOTM->otmptSubscriptOffset = lpOTMW->otmptSubscriptOffset; |
| 1371 | lpOTM->otmptSuperscriptSize = lpOTMW->otmptSuperscriptSize; |
| 1372 | lpOTM->otmptSuperscriptOffset = lpOTMW->otmptSuperscriptOffset; |
| 1373 | lpOTM->otmsStrikeoutSize = lpOTMW->otmsStrikeoutSize; |
| 1374 | lpOTM->otmsStrikeoutPosition = lpOTMW->otmsStrikeoutPosition; |
| 1375 | lpOTM->otmsUnderscoreSize = lpOTMW->otmsUnderscoreSize; |
| 1376 | lpOTM->otmsUnderscorePosition = lpOTMW->otmsUnderscorePosition; |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1377 | |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1378 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1379 | ptr = (char*)(lpOTM + 1); |
| 1380 | left = needed - sizeof(*lpOTM); |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1381 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1382 | if(lpOTMW->otmpFamilyName) { |
| 1383 | lpOTM->otmpFamilyName = (LPSTR)(ptr - (char*)lpOTM); |
| 1384 | len = WideCharToMultiByte(CP_ACP, 0, |
| 1385 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpFamilyName), -1, |
| 1386 | ptr, left, NULL, NULL); |
| 1387 | left -= len; |
| 1388 | ptr += len; |
| 1389 | } else |
| 1390 | lpOTM->otmpFamilyName = 0; |
| 1391 | |
| 1392 | if(lpOTMW->otmpFaceName) { |
| 1393 | lpOTM->otmpFaceName = (LPSTR)(ptr - (char*)lpOTM); |
| 1394 | len = WideCharToMultiByte(CP_ACP, 0, |
| 1395 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpFaceName), -1, |
| 1396 | ptr, left, NULL, NULL); |
| 1397 | left -= len; |
| 1398 | ptr += len; |
| 1399 | } else |
| 1400 | lpOTM->otmpFaceName = 0; |
| 1401 | |
| 1402 | if(lpOTMW->otmpStyleName) { |
| 1403 | lpOTM->otmpStyleName = (LPSTR)(ptr - (char*)lpOTM); |
| 1404 | len = WideCharToMultiByte(CP_ACP, 0, |
| 1405 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpStyleName), -1, |
| 1406 | ptr, left, NULL, NULL); |
| 1407 | left -= len; |
| 1408 | ptr += len; |
| 1409 | } else |
| 1410 | lpOTM->otmpStyleName = 0; |
| 1411 | |
| 1412 | if(lpOTMW->otmpFullName) { |
| 1413 | lpOTM->otmpFullName = (LPSTR)(ptr - (char*)lpOTM); |
| 1414 | len = WideCharToMultiByte(CP_ACP, 0, |
| 1415 | (WCHAR*)((char*)lpOTMW + (ptrdiff_t)lpOTMW->otmpFullName), -1, |
| 1416 | ptr, left, NULL, NULL); |
| 1417 | left -= len; |
| 1418 | } else |
| 1419 | lpOTM->otmpFullName = 0; |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1420 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1421 | assert(left == 0); |
| 1422 | |
| 1423 | ret = needed; |
| 1424 | |
| 1425 | end: |
| 1426 | if(lpOTMW != (OUTLINETEXTMETRICW *)buf) |
| 1427 | HeapFree(GetProcessHeap(), 0, lpOTMW); |
| 1428 | |
| 1429 | return ret; |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1430 | } |
| 1431 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1432 | |
Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 1433 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1434 | * GetOutlineTextMetricsW [GDI32.@] |
Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 1435 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1436 | UINT WINAPI GetOutlineTextMetricsW( |
| 1437 | HDC hdc, /* [in] Handle of device context */ |
| 1438 | UINT cbData, /* [in] Size of metric data array */ |
| 1439 | LPOUTLINETEXTMETRICW lpOTM) /* [out] Address of metric data array */ |
Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 1440 | { |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1441 | DC *dc = DC_GetDCPtr( hdc ); |
| 1442 | UINT ret; |
| 1443 | |
| 1444 | TRACE("(%d,%d,%p)\n", hdc, cbData, lpOTM); |
| 1445 | if(!dc) return 0; |
| 1446 | |
| 1447 | if(dc->gdiFont) |
| 1448 | ret = WineEngGetOutlineTextMetrics(dc->gdiFont, cbData, lpOTM); |
| 1449 | |
| 1450 | else { /* This stuff was in GetOutlineTextMetricsA, I've moved it here |
| 1451 | but really this should just be a return 0. */ |
| 1452 | |
| 1453 | ret = sizeof(*lpOTM); |
| 1454 | if (lpOTM) { |
| 1455 | if(cbData < ret) |
| 1456 | ret = 0; |
| 1457 | else { |
| 1458 | memset(lpOTM, 0, ret); |
| 1459 | lpOTM->otmSize = sizeof(*lpOTM); |
| 1460 | GetTextMetricsW(hdc, &lpOTM->otmTextMetrics); |
| 1461 | /* |
| 1462 | Further fill of the structure not implemented, |
| 1463 | Needs real values for the structure members |
| 1464 | */ |
| 1465 | } |
| 1466 | } |
| 1467 | } |
| 1468 | GDI_ReleaseObj(hdc); |
| 1469 | return ret; |
Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 1470 | } |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1471 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1472 | |
Moshe Vainer | 4a150e7 | 1998-10-14 18:15:43 +0000 | [diff] [blame] | 1473 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1474 | * GetCharWidth (GDI.350) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1475 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1476 | BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, |
| 1477 | LPINT16 buffer ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1478 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1479 | BOOL retVal = FALSE; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1480 | |
| 1481 | if( firstChar != lastChar ) |
| 1482 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1483 | LPINT buf32 = (LPINT)HeapAlloc(GetProcessHeap(), 0, |
| 1484 | sizeof(INT)*(1 + (lastChar - firstChar))); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1485 | if( buf32 ) |
| 1486 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1487 | LPINT obuf32 = buf32; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1488 | int i; |
| 1489 | |
| 1490 | retVal = GetCharWidth32A(hdc, firstChar, lastChar, buf32); |
| 1491 | if (retVal) |
| 1492 | { |
| 1493 | for (i = firstChar; i <= lastChar; i++) |
| 1494 | *buffer++ = *buf32++; |
| 1495 | } |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 1496 | HeapFree(GetProcessHeap(), 0, obuf32); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1497 | } |
| 1498 | } |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1499 | else /* happens quite often to warrant a special treatment */ |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1500 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1501 | INT chWidth; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1502 | retVal = GetCharWidth32A(hdc, firstChar, lastChar, &chWidth ); |
Alexandre Julliard | 33072e1 | 1997-06-29 18:08:02 +0000 | [diff] [blame] | 1503 | *buffer = chWidth; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1504 | } |
| 1505 | return retVal; |
| 1506 | } |
| 1507 | |
| 1508 | |
| 1509 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1510 | * GetCharWidthA (GDI32.@) |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1511 | * GetCharWidth32A (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1512 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1513 | BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar, |
| 1514 | LPINT buffer ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1515 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1516 | UINT i, extra; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1517 | BOOL ret = FALSE; |
| 1518 | DC * dc = DC_GetDCPtr( hdc ); |
| 1519 | if (!dc) return FALSE; |
| 1520 | |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1521 | if (dc->gdiFont) |
| 1522 | ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer ); |
| 1523 | else if (dc->funcs->pGetCharWidth) |
| 1524 | ret = dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer); |
| 1525 | |
| 1526 | if (ret) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1527 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1528 | /* convert device units to logical */ |
| 1529 | |
| 1530 | extra = dc->vportExtX >> 1; |
| 1531 | for( i = firstChar; i <= lastChar; i++, buffer++ ) |
| 1532 | *buffer = (*buffer * dc->wndExtX + extra) / dc->vportExtX; |
| 1533 | ret = TRUE; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1534 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1535 | GDI_ReleaseObj( hdc ); |
| 1536 | return ret; |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1537 | } |
| 1538 | |
| 1539 | |
| 1540 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1541 | * GetCharWidthW (GDI32.@) |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1542 | * GetCharWidth32W (GDI32.@) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1543 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1544 | BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar, |
| 1545 | LPINT buffer ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1546 | { |
| 1547 | return GetCharWidth32A( hdc, firstChar, lastChar, buffer ); |
| 1548 | } |
| 1549 | |
| 1550 | |
Patrik Stridvall | 54fe838 | 2000-04-06 20:21:16 +0000 | [diff] [blame] | 1551 | /* FIXME: all following APIs ******************************************/ |
| 1552 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1553 | |
Patrik Stridvall | 54fe838 | 2000-04-06 20:21:16 +0000 | [diff] [blame] | 1554 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1555 | * SetMapperFlags (GDI.349) |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 1556 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1557 | DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1558 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1559 | return SetMapperFlags( hDC, dwFlag ); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1560 | } |
| 1561 | |
| 1562 | |
| 1563 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1564 | * SetMapperFlags (GDI32.@) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 1565 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1566 | DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag ) |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 1567 | { |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 1568 | DC *dc = DC_GetDCPtr( hDC ); |
| 1569 | DWORD ret = 0; |
| 1570 | if(!dc) return 0; |
| 1571 | if(dc->funcs->pSetMapperFlags) |
| 1572 | ret = dc->funcs->pSetMapperFlags( dc, dwFlag ); |
| 1573 | else |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1574 | FIXME("(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 1575 | GDI_ReleaseObj( hDC ); |
Huw D M Davies | 7603dea | 1999-04-25 09:24:23 +0000 | [diff] [blame] | 1576 | return ret; |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 1577 | } |
| 1578 | |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1579 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1580 | * GetAspectRatioFilterEx (GDI.486) |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1581 | */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1582 | BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio ) |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1583 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1584 | FIXME("(%04x, %p): -- Empty Stub !\n", hdc, pAspectRatio); |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1585 | return FALSE; |
| 1586 | } |
| 1587 | |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1588 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1589 | * GetAspectRatioFilterEx (GDI32.@) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1590 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1591 | BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, LPSIZE pAspectRatio ) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1592 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1593 | FIXME("(%04x, %p): -- Empty Stub !\n", hdc, pAspectRatio); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 1594 | return FALSE; |
| 1595 | } |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1596 | |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 1597 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1598 | * GetCharABCWidths (GDI.307) |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 1599 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1600 | BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, |
| 1601 | LPABC16 abc ) |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 1602 | { |
Marcus Meissner | 67f0be1 | 2001-04-23 18:11:58 +0000 | [diff] [blame] | 1603 | LPABC abc32 = HeapAlloc(GetProcessHeap(),0,sizeof(ABC)*(lastChar-firstChar+1)); |
| 1604 | int i; |
| 1605 | |
| 1606 | if (!GetCharABCWidthsA( hdc, firstChar, lastChar, abc32 )) { |
| 1607 | HeapFree(GetProcessHeap(),0,abc32); |
| 1608 | return FALSE; |
| 1609 | } |
| 1610 | |
| 1611 | for (i=firstChar;i<=lastChar;i++) { |
| 1612 | abc[i-firstChar].abcA = abc32[i-firstChar].abcA; |
| 1613 | abc[i-firstChar].abcB = abc32[i-firstChar].abcB; |
| 1614 | abc[i-firstChar].abcC = abc32[i-firstChar].abcC; |
| 1615 | } |
| 1616 | HeapFree(GetProcessHeap(),0,abc32); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1617 | return TRUE; |
| 1618 | } |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 1619 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1620 | |
| 1621 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1622 | * GetCharABCWidthsA (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1623 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1624 | BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar, |
| 1625 | LPABC abc ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1626 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1627 | return GetCharABCWidthsW( hdc, firstChar, lastChar, abc ); |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 1628 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1629 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1630 | |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 1631 | /****************************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1632 | * GetCharABCWidthsW [GDI32.@] Retrieves widths of characters in range |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 1633 | * |
| 1634 | * PARAMS |
| 1635 | * hdc [I] Handle of device context |
| 1636 | * firstChar [I] First character in range to query |
| 1637 | * lastChar [I] Last character in range to query |
| 1638 | * abc [O] Address of character-width structure |
| 1639 | * |
| 1640 | * NOTES |
| 1641 | * Only works with TrueType fonts |
| 1642 | * |
| 1643 | * RETURNS |
| 1644 | * Success: TRUE |
| 1645 | * Failure: FALSE |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1646 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1647 | BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar, |
| 1648 | LPABC abc ) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1649 | { |
Marcus Meissner | 67f0be1 | 2001-04-23 18:11:58 +0000 | [diff] [blame] | 1650 | int i; |
| 1651 | LPINT widths = HeapAlloc(GetProcessHeap(),0,(lastChar-firstChar+1)*sizeof(INT)); |
| 1652 | |
| 1653 | FIXME("(%04x,%04x,%04x,%p), returns slightly bogus values.\n", hdc, firstChar, lastChar, abc); |
| 1654 | |
| 1655 | GetCharWidth32A(hdc,firstChar,lastChar,widths); |
| 1656 | |
| 1657 | for (i=firstChar;i<=lastChar;i++) { |
| 1658 | abc[i-firstChar].abcA = 0; /* left distance */ |
| 1659 | abc[i-firstChar].abcB = widths[i-firstChar];/* width */ |
| 1660 | abc[i-firstChar].abcC = 0; /* right distance */ |
| 1661 | } |
| 1662 | HeapFree(GetProcessHeap(),0,widths); |
| 1663 | return TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1664 | } |
| 1665 | |
| 1666 | |
| 1667 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1668 | * GetGlyphOutline (GDI.309) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1669 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1670 | DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat, |
| 1671 | LPGLYPHMETRICS16 lpgm, DWORD cbBuffer, |
| 1672 | LPVOID lpBuffer, const MAT2 *lpmat2 ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1673 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1674 | FIXME("(%04x, '%c', %04x, %p, %ld, %p, %p): stub\n", |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1675 | hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1676 | return (DWORD)-1; /* failure */ |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1677 | } |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 1678 | |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1679 | |
| 1680 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1681 | * GetGlyphOutlineA (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1682 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1683 | DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat, |
| 1684 | LPGLYPHMETRICS lpgm, DWORD cbBuffer, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1685 | LPVOID lpBuffer, const MAT2 *lpmat2 ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1686 | { |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1687 | return GetGlyphOutlineW(hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, |
| 1688 | lpmat2); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1689 | } |
| 1690 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1691 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1692 | * GetGlyphOutlineW (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1693 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1694 | DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat, |
| 1695 | LPGLYPHMETRICS lpgm, DWORD cbBuffer, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1696 | LPVOID lpBuffer, const MAT2 *lpmat2 ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1697 | { |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1698 | DC *dc = DC_GetDCPtr(hdc); |
| 1699 | DWORD ret; |
| 1700 | |
| 1701 | TRACE("(%04x, '%c', %04x, %p, %ld, %p, %p)\n", |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1702 | hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 ); |
Huw D M Davies | 814654e | 2001-09-12 20:21:06 +0000 | [diff] [blame] | 1703 | |
| 1704 | if(!dc) return GDI_ERROR; |
| 1705 | |
| 1706 | if(dc->gdiFont) |
| 1707 | ret = WineEngGetGlyphOutline(dc->gdiFont, uChar, fuFormat, lpgm, |
| 1708 | cbBuffer, lpBuffer, lpmat2); |
| 1709 | else |
| 1710 | ret = GDI_ERROR; |
| 1711 | |
| 1712 | GDI_ReleaseObj(hdc); |
| 1713 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1714 | } |
| 1715 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1716 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1717 | * CreateScalableFontResource (GDI.310) |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1718 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1719 | BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, |
| 1720 | LPCSTR lpszResourceFile, |
| 1721 | LPCSTR fontFile, LPCSTR path ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1722 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1723 | return CreateScalableFontResourceA( fHidden, lpszResourceFile, |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1724 | fontFile, path ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1725 | } |
| 1726 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1727 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1728 | * CreateScalableFontResourceA (GDI32.@) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1729 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1730 | BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1731 | LPCSTR lpszResourceFile, |
| 1732 | LPCSTR lpszFontFile, |
| 1733 | LPCSTR lpszCurrentPath ) |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1734 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1735 | /* fHidden=1 - only visible for the calling app, read-only, not |
| 1736 | * enumbered with EnumFonts/EnumFontFamilies |
| 1737 | * lpszCurrentPath can be NULL |
| 1738 | */ |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1739 | FIXME("(%ld,%s,%s,%s): stub\n", |
Francois Gouget | b60c4ce | 2001-10-14 16:15:05 +0000 | [diff] [blame] | 1740 | fHidden, debugstr_a(lpszResourceFile), debugstr_a(lpszFontFile), |
| 1741 | debugstr_a(lpszCurrentPath) ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1742 | return FALSE; /* create failed */ |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1743 | } |
| 1744 | |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1745 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1746 | * CreateScalableFontResourceW (GDI32.@) |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1747 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1748 | BOOL WINAPI CreateScalableFontResourceW( DWORD fHidden, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1749 | LPCWSTR lpszResourceFile, |
| 1750 | LPCWSTR lpszFontFile, |
| 1751 | LPCWSTR lpszCurrentPath ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1752 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1753 | FIXME("(%ld,%p,%p,%p): stub\n", |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1754 | fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1755 | return FALSE; /* create failed */ |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1756 | } |
| 1757 | |
| 1758 | |
| 1759 | /************************************************************************* |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1760 | * GetRasterizerCaps (GDI.313) |
Alexandre Julliard | fa68b75 | 1995-04-03 16:55:37 +0000 | [diff] [blame] | 1761 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1762 | BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1763 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1764 | return GetRasterizerCaps( lprs, cbNumBytes ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1765 | } |
Alexandre Julliard | 5819953 | 1994-04-21 01:20:00 +0000 | [diff] [blame] | 1766 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1767 | |
| 1768 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1769 | * GetRasterizerCaps (GDI32.@) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1770 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1771 | BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes) |
Alexandre Julliard | fa68b75 | 1995-04-03 16:55:37 +0000 | [diff] [blame] | 1772 | { |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 1773 | lprs->nSize = sizeof(RASTERIZER_STATUS); |
| 1774 | lprs->wFlags = TT_AVAILABLE|TT_ENABLED; |
| 1775 | lprs->nLanguageID = 0; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1776 | return TRUE; |
Alexandre Julliard | fa68b75 | 1995-04-03 16:55:37 +0000 | [diff] [blame] | 1777 | } |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 1778 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1779 | |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 1780 | /************************************************************************* |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1781 | * GetKerningPairs (GDI.332) |
Bill Medland | 06a49f6 | 2001-08-24 19:12:56 +0000 | [diff] [blame] | 1782 | * |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 1783 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1784 | INT16 WINAPI GetKerningPairs16( HDC16 hDC, INT16 cPairs, |
| 1785 | LPKERNINGPAIR16 lpKerningPairs ) |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 1786 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1787 | /* At this time kerning is ignored (set to 0) */ |
Alexandre Julliard | 339eefc | 1996-06-23 14:56:20 +0000 | [diff] [blame] | 1788 | int i; |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1789 | FIXME("(%x,%d,%p): almost empty stub!\n", hDC, cPairs, lpKerningPairs); |
Bill Medland | 06a49f6 | 2001-08-24 19:12:56 +0000 | [diff] [blame] | 1790 | if (lpKerningPairs) |
| 1791 | for (i = 0; i < cPairs; i++) |
| 1792 | lpKerningPairs[i].iKernAmount = 0; |
| 1793 | /* FIXME: Should this function call SetLastError (0)? This is yet another |
| 1794 | * Microsoft function that can return 0 on success or failure |
| 1795 | */ |
Alexandre Julliard | 339eefc | 1996-06-23 14:56:20 +0000 | [diff] [blame] | 1796 | return 0; |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 1797 | } |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 1798 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1799 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1800 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1801 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1802 | * GetKerningPairsA (GDI32.@) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1803 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1804 | DWORD WINAPI GetKerningPairsA( HDC hDC, DWORD cPairs, |
| 1805 | LPKERNINGPAIR lpKerningPairs ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1806 | { |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1807 | int i; |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1808 | FIXME("(%x,%ld,%p): almost empty stub!\n", hDC, cPairs, lpKerningPairs); |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1809 | for (i = 0; i < cPairs; i++) |
| 1810 | lpKerningPairs[i].iKernAmount = 0; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1811 | return 0; |
| 1812 | } |
| 1813 | |
| 1814 | |
| 1815 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1816 | * GetKerningPairsW (GDI32.@) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1817 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1818 | DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs, |
| 1819 | LPKERNINGPAIR lpKerningPairs ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1820 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1821 | return GetKerningPairsA( hDC, cPairs, lpKerningPairs ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1822 | } |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1823 | |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1824 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1825 | * TranslateCharsetInfo [GDI32.@] |
Patrik Stridvall | 044855c | 2001-07-11 18:56:41 +0000 | [diff] [blame] | 1826 | * TranslateCharsetInfo [USER32.@] |
Douglas Ridgway | 4f7d9ed | 1998-12-18 17:38:39 +0000 | [diff] [blame] | 1827 | * |
| 1828 | * Fills a CHARSETINFO structure for a character set, code page, or |
| 1829 | * font. This allows making the correspondance between different labelings |
| 1830 | * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges) |
| 1831 | * of the same encoding. |
| 1832 | * |
| 1833 | * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used, |
| 1834 | * only one codepage should be set in *lpSrc. |
| 1835 | * |
| 1836 | * RETURNS |
| 1837 | * TRUE on success, FALSE on failure. |
| 1838 | * |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1839 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1840 | BOOL WINAPI TranslateCharsetInfo( |
Patrik Stridvall | 2b3aa61 | 2000-12-01 23:58:28 +0000 | [diff] [blame] | 1841 | LPDWORD lpSrc, /* [in] |
Douglas Ridgway | 4f7d9ed | 1998-12-18 17:38:39 +0000 | [diff] [blame] | 1842 | if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE |
| 1843 | if flags == TCI_SRCCHARSET: a character set value |
| 1844 | if flags == TCI_SRCCODEPAGE: a code page value |
| 1845 | */ |
Patrik Stridvall | 2b3aa61 | 2000-12-01 23:58:28 +0000 | [diff] [blame] | 1846 | LPCHARSETINFO lpCs, /* [out] structure to receive charset information */ |
| 1847 | DWORD flags /* [in] determines interpretation of lpSrc */ |
Douglas Ridgway | 4f7d9ed | 1998-12-18 17:38:39 +0000 | [diff] [blame] | 1848 | ) { |
Douglas Ridgway | ab9e8bc | 1999-01-01 18:41:22 +0000 | [diff] [blame] | 1849 | int index = 0; |
| 1850 | switch (flags) { |
| 1851 | case TCI_SRCFONTSIG: |
| 1852 | while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++; |
| 1853 | break; |
| 1854 | case TCI_SRCCODEPAGE: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1855 | while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++; |
Douglas Ridgway | ab9e8bc | 1999-01-01 18:41:22 +0000 | [diff] [blame] | 1856 | break; |
| 1857 | case TCI_SRCCHARSET: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1858 | while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++; |
Douglas Ridgway | ab9e8bc | 1999-01-01 18:41:22 +0000 | [diff] [blame] | 1859 | break; |
| 1860 | default: |
| 1861 | return FALSE; |
| 1862 | } |
| 1863 | if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE; |
| 1864 | memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO)); |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1865 | return TRUE; |
| 1866 | } |
| 1867 | |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1868 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1869 | * GetFontLanguageInfo (GDI32.@) |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1870 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1871 | DWORD WINAPI GetFontLanguageInfo(HDC hdc) { |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1872 | /* return value 0 is correct for most cases anyway */ |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1873 | FIXME("(%x):stub!\n", hdc); |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1874 | return 0; |
| 1875 | } |
| 1876 | |
| 1877 | /************************************************************************* |
| 1878 | * GetFontLanguageInfo (GDI.616) |
| 1879 | */ |
| 1880 | DWORD WINAPI GetFontLanguageInfo16(HDC16 hdc) { |
| 1881 | /* return value 0 is correct for most cases anyway */ |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1882 | FIXME("(%x):stub!\n",hdc); |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 1883 | return 0; |
| 1884 | } |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1885 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1886 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1887 | * GetFontData [GDI32.@] Retrieve data for TrueType font |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1888 | * |
| 1889 | * RETURNS |
| 1890 | * |
| 1891 | * success: Number of bytes returned |
| 1892 | * failure: GDI_ERROR |
| 1893 | * |
| 1894 | * NOTES |
| 1895 | * |
| 1896 | * Calls SetLastError() |
| 1897 | * |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1898 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1899 | DWORD WINAPI GetFontData(HDC hdc, DWORD table, DWORD offset, |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1900 | LPVOID buffer, DWORD length) |
| 1901 | { |
Huw D M Davies | 4e2024e | 2001-10-23 20:06:32 +0000 | [diff] [blame] | 1902 | DC *dc = DC_GetDCPtr(hdc); |
| 1903 | DWORD ret = GDI_ERROR; |
| 1904 | |
| 1905 | if(!dc) return GDI_ERROR; |
| 1906 | |
| 1907 | if(dc->gdiFont) |
| 1908 | ret = WineEngGetFontData(dc->gdiFont, table, offset, buffer, length); |
| 1909 | |
| 1910 | GDI_ReleaseObj(hdc); |
| 1911 | return ret; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1912 | } |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1913 | |
| 1914 | /************************************************************************* |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 1915 | * GetFontData [GDI.311] |
Huw D M Davies | cdf191a | 1999-11-21 02:01:41 +0000 | [diff] [blame] | 1916 | * |
| 1917 | */ |
| 1918 | DWORD WINAPI GetFontData16(HDC16 hdc, DWORD dwTable, DWORD dwOffset, |
| 1919 | LPVOID lpvBuffer, DWORD cbData) |
| 1920 | { |
| 1921 | return GetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData); |
| 1922 | } |
| 1923 | |
| 1924 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1925 | * GetCharacterPlacementA [GDI32.@] |
Juergen Schmied | 2259e44 | 1999-08-15 14:22:48 +0000 | [diff] [blame] | 1926 | * |
| 1927 | * NOTES: |
| 1928 | * the web browser control of ie4 calls this with dwFlags=0 |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1929 | */ |
| 1930 | DWORD WINAPI |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1931 | GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount, |
| 1932 | INT nMaxExtent, GCP_RESULTSA *lpResults, |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1933 | DWORD dwFlags) |
| 1934 | { |
Juergen Schmied | 2259e44 | 1999-08-15 14:22:48 +0000 | [diff] [blame] | 1935 | DWORD ret=0; |
| 1936 | SIZE size; |
| 1937 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1938 | TRACE("%s 0x%08x 0x%08x 0x%08lx:stub!\n", |
| 1939 | debugstr_a(lpString), uCount, nMaxExtent, dwFlags); |
Juergen Schmied | 2259e44 | 1999-08-15 14:22:48 +0000 | [diff] [blame] | 1940 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1941 | TRACE("lpOrder=%p lpDx=%p lpCaretPos=%p lpClass=%p " |
| 1942 | "lpOutString=%p lpGlyphs=%p\n", |
| 1943 | lpResults->lpOrder, lpResults->lpDx, lpResults->lpCaretPos, |
| 1944 | lpResults->lpClass, lpResults->lpOutString, lpResults->lpGlyphs); |
Juergen Schmied | 2259e44 | 1999-08-15 14:22:48 +0000 | [diff] [blame] | 1945 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1946 | if(dwFlags) FIXME("flags 0x%08lx ignored\n", dwFlags); |
| 1947 | if(lpResults->lpOrder) FIXME("reordering not implemented\n"); |
| 1948 | if(lpResults->lpCaretPos) FIXME("caret positions not implemented\n"); |
| 1949 | if(lpResults->lpClass) FIXME("classes not implemented\n"); |
| 1950 | if(lpResults->lpGlyphs) FIXME("glyphs not implemented\n"); |
Juergen Schmied | 2259e44 | 1999-08-15 14:22:48 +0000 | [diff] [blame] | 1951 | |
| 1952 | /* copy will do if the GCP_REORDER flag is not set */ |
| 1953 | if(lpResults->lpOutString) |
| 1954 | { |
| 1955 | lstrcpynA(lpResults->lpOutString, lpString, uCount); |
| 1956 | } |
| 1957 | |
| 1958 | if (lpResults->lpDx) |
| 1959 | { |
| 1960 | int i, c; |
| 1961 | for (i=0; i<uCount;i++) |
| 1962 | { |
| 1963 | if (GetCharWidth32A(hdc, lpString[i], lpString[i], &c)) |
| 1964 | lpResults->lpDx[i]= c; |
| 1965 | } |
| 1966 | } |
| 1967 | |
| 1968 | if (GetTextExtentPoint32A(hdc, lpString, uCount, &size)) |
| 1969 | ret = MAKELONG(size.cx, size.cy); |
| 1970 | |
| 1971 | return ret; |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1972 | } |
| 1973 | |
| 1974 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 1975 | * GetCharacterPlacementW [GDI32.@] |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1976 | */ |
| 1977 | DWORD WINAPI |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1978 | GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount, |
| 1979 | INT nMaxExtent, GCP_RESULTSW *lpResults, |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1980 | DWORD dwFlags) |
| 1981 | { |
Guy L. Albertelli | bc939e5 | 2001-10-21 15:02:34 +0000 | [diff] [blame] | 1982 | DWORD ret=0; |
| 1983 | SIZE size; |
| 1984 | |
| 1985 | TRACE("%s 0x%08x 0x%08x 0x%08lx:partial stub!\n", |
| 1986 | debugstr_w(lpString), uCount, nMaxExtent, dwFlags); |
| 1987 | |
| 1988 | TRACE("lpOrder=%p lpDx=%p lpCaretPos=%p lpClass=%p " |
| 1989 | "lpOutString=%p lpGlyphs=%p\n", |
| 1990 | lpResults->lpOrder, lpResults->lpDx, lpResults->lpCaretPos, |
| 1991 | lpResults->lpClass, lpResults->lpOutString, lpResults->lpGlyphs); |
| 1992 | |
| 1993 | if(dwFlags) FIXME("flags 0x%08lx ignored\n", dwFlags); |
| 1994 | if(lpResults->lpOrder) FIXME("reordering not implemented\n"); |
| 1995 | if(lpResults->lpCaretPos) FIXME("caret positions not implemented\n"); |
| 1996 | if(lpResults->lpClass) FIXME("classes not implemented\n"); |
| 1997 | if(lpResults->lpGlyphs) FIXME("glyphs not implemented\n"); |
| 1998 | |
| 1999 | /* copy will do if the GCP_REORDER flag is not set */ |
| 2000 | if(lpResults->lpOutString) |
| 2001 | { |
| 2002 | lstrcpynW(lpResults->lpOutString, lpString, uCount); |
| 2003 | } |
| 2004 | |
| 2005 | if (lpResults->lpDx) |
| 2006 | { |
| 2007 | int i, c; |
| 2008 | for (i=0; i<uCount;i++) |
| 2009 | { |
| 2010 | if (GetCharWidth32W(hdc, lpString[i], lpString[i], &c)) |
| 2011 | lpResults->lpDx[i]= c; |
| 2012 | } |
| 2013 | } |
| 2014 | |
| 2015 | if (GetTextExtentPoint32W(hdc, lpString, uCount, &size)) |
| 2016 | ret = MAKELONG(size.cx, size.cy); |
| 2017 | |
| 2018 | return ret; |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2019 | } |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2020 | |
| 2021 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2022 | * GetCharABCWidthsFloatA [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2023 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2024 | BOOL WINAPI GetCharABCWidthsFloatA(HDC hdc, UINT iFirstChar, UINT iLastChar, |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2025 | LPABCFLOAT lpABCF) |
| 2026 | { |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 2027 | FIXME_(gdi)("GetCharABCWidthsFloatA, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2028 | return 0; |
| 2029 | } |
| 2030 | |
| 2031 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2032 | * GetCharABCWidthsFloatW [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2033 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2034 | BOOL WINAPI GetCharABCWidthsFloatW(HDC hdc, UINT iFirstChar, |
| 2035 | UINT iLastChar, LPABCFLOAT lpABCF) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2036 | { |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 2037 | FIXME_(gdi)("GetCharABCWidthsFloatW, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2038 | return 0; |
| 2039 | } |
| 2040 | |
| 2041 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2042 | * GetCharWidthFloatA [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2043 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2044 | BOOL WINAPI GetCharWidthFloatA(HDC hdc, UINT iFirstChar, |
| 2045 | UINT iLastChar, PFLOAT pxBuffer) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2046 | { |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 2047 | FIXME_(gdi)("GetCharWidthFloatA, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2048 | return 0; |
| 2049 | } |
| 2050 | |
| 2051 | /************************************************************************* |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2052 | * GetCharWidthFloatW [GDI32.@] |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2053 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2054 | BOOL WINAPI GetCharWidthFloatW(HDC hdc, UINT iFirstChar, |
| 2055 | UINT iLastChar, PFLOAT pxBuffer) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2056 | { |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 2057 | FIXME_(gdi)("GetCharWidthFloatW, stub\n"); |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 2058 | return 0; |
| 2059 | } |
| 2060 | |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2061 | |
| 2062 | /*********************************************************************** |
| 2063 | * * |
| 2064 | * Font Resource API * |
| 2065 | * * |
| 2066 | ***********************************************************************/ |
| 2067 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 2068 | * AddFontResource (GDI.119) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2069 | * |
| 2070 | * Can be either .FON, or .FNT, or .TTF, or .FOT font file. |
| 2071 | * |
| 2072 | * FIXME: Load header and find the best-matching font in the fontList; |
| 2073 | * fixup dfPoints if all metrics are identical, otherwise create |
| 2074 | * new fontAlias. When soft font support is ready this will |
| 2075 | * simply create a new fontResource ('filename' will go into |
| 2076 | * the pfr->resource field) with FR_SOFTFONT/FR_SOFTRESOURCE |
| 2077 | * flag set. |
| 2078 | */ |
| 2079 | INT16 WINAPI AddFontResource16( LPCSTR filename ) |
| 2080 | { |
| 2081 | return AddFontResourceA( filename ); |
| 2082 | } |
| 2083 | |
| 2084 | |
| 2085 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2086 | * AddFontResourceA (GDI32.@) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2087 | */ |
| 2088 | INT WINAPI AddFontResourceA( LPCSTR str ) |
| 2089 | { |
Andreas Mohr | c9ec884 | 2001-01-24 19:37:13 +0000 | [diff] [blame] | 2090 | FIXME("(%s): stub! Read the Wine User Guide on how to install " |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2091 | "this font manually.\n", debugres_a(str)); |
| 2092 | return 1; |
| 2093 | } |
| 2094 | |
| 2095 | |
| 2096 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2097 | * AddFontResourceW (GDI32.@) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2098 | */ |
| 2099 | INT WINAPI AddFontResourceW( LPCWSTR str ) |
| 2100 | { |
Andreas Mohr | c9ec884 | 2001-01-24 19:37:13 +0000 | [diff] [blame] | 2101 | FIXME("(%s): stub! Read the Wine User Guide on how to install " |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2102 | "this font manually.\n", debugres_w(str)); |
| 2103 | return 1; |
| 2104 | } |
| 2105 | |
| 2106 | /*********************************************************************** |
Patrik Stridvall | 17fd4e3 | 2001-06-28 18:04:41 +0000 | [diff] [blame] | 2107 | * RemoveFontResource (GDI.136) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2108 | */ |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 2109 | BOOL16 WINAPI RemoveFontResource16( LPCSTR str ) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2110 | { |
Andreas Mohr | c9ec884 | 2001-01-24 19:37:13 +0000 | [diff] [blame] | 2111 | FIXME("(%s): stub\n", debugres_a(str)); |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2112 | return TRUE; |
| 2113 | } |
| 2114 | |
| 2115 | |
| 2116 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2117 | * RemoveFontResourceA (GDI32.@) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2118 | */ |
| 2119 | BOOL WINAPI RemoveFontResourceA( LPCSTR str ) |
| 2120 | { |
| 2121 | /* This is how it should look like */ |
| 2122 | /* |
| 2123 | fontResource** ppfr; |
| 2124 | BOOL32 retVal = FALSE; |
| 2125 | |
| 2126 | EnterCriticalSection( &crtsc_fonts_X11 ); |
| 2127 | for( ppfr = &fontList; *ppfr; ppfr = &(*ppfr)->next ) |
| 2128 | if( !strcasecmp( (*ppfr)->lfFaceName, str ) ) |
| 2129 | { |
| 2130 | if(((*ppfr)->fr_flags & (FR_SOFTFONT | FR_SOFTRESOURCE)) && |
| 2131 | (*ppfr)->hOwnerProcess == GetCurrentProcess() ) |
| 2132 | { |
| 2133 | if( (*ppfr)->fo_count ) |
| 2134 | (*ppfr)->fr_flags |= FR_REMOVED; |
| 2135 | else |
| 2136 | XFONT_RemoveFontResource( ppfr ); |
| 2137 | } |
| 2138 | retVal = TRUE; |
| 2139 | } |
| 2140 | LeaveCriticalSection( &crtsc_fonts_X11 ); |
| 2141 | return retVal; |
| 2142 | */ |
| 2143 | FIXME("(%s): stub\n", debugres_a(str)); |
| 2144 | return TRUE; |
| 2145 | } |
| 2146 | |
| 2147 | |
| 2148 | /*********************************************************************** |
Huw D M Davies | 2aa85ee | 2001-02-14 22:56:38 +0000 | [diff] [blame] | 2149 | * RemoveFontResourceW (GDI32.@) |
Alexandre Julliard | aafd54d | 2000-03-19 21:20:54 +0000 | [diff] [blame] | 2150 | */ |
| 2151 | BOOL WINAPI RemoveFontResourceW( LPCWSTR str ) |
| 2152 | { |
| 2153 | FIXME("(%s): stub\n", debugres_w(str) ); |
| 2154 | return TRUE; |
| 2155 | } |