| 1 | /* $Id: font.cpp,v 1.31 2003-08-13 09:11:42 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * GDI32 font apis | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Edgar Buerkle (Edgar.Buerkle@gmx.ne) | 
|---|
| 7 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 8 | * Copyright 1998 Patrick Haller | 
|---|
| 9 | * | 
|---|
| 10 | * TODO: EnumFontsA/W, EnumFontFamiliesExA/W not complete | 
|---|
| 11 | * | 
|---|
| 12 | * Parts based on Wine code (991031) | 
|---|
| 13 | * | 
|---|
| 14 | * Copyright 1993 Alexandre Julliard | 
|---|
| 15 | *           1997 Alex Korobka | 
|---|
| 16 | * | 
|---|
| 17 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 18 | * | 
|---|
| 19 | */ | 
|---|
| 20 |  | 
|---|
| 21 | /***************************************************************************** | 
|---|
| 22 | * Includes                                                                  * | 
|---|
| 23 | *****************************************************************************/ | 
|---|
| 24 |  | 
|---|
| 25 | #include <odin.h> | 
|---|
| 26 | #include <odinwrap.h> | 
|---|
| 27 | #include <os2sel.h> | 
|---|
| 28 |  | 
|---|
| 29 | #include <os2win.h> | 
|---|
| 30 | #include <stdlib.h> | 
|---|
| 31 | #include <stdarg.h> | 
|---|
| 32 | #include <ctype.h> | 
|---|
| 33 | #include <string.h> | 
|---|
| 34 | #include "misc.h" | 
|---|
| 35 | #include "unicode.h" | 
|---|
| 36 | #include <heapstring.h> | 
|---|
| 37 | #include <win\options.h> | 
|---|
| 38 | #include <wprocess.h> | 
|---|
| 39 | #include <odininst.h> | 
|---|
| 40 | #include <stats.h> | 
|---|
| 41 | #include "oslibgpi.h" | 
|---|
| 42 |  | 
|---|
| 43 | #define DBG_LOCALLOG    DBG_font | 
|---|
| 44 | #include "dbglocal.h" | 
|---|
| 45 |  | 
|---|
| 46 | ODINDEBUGCHANNEL(GDI32-FONT) | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | typedef struct { | 
|---|
| 50 | DWORD userProc; | 
|---|
| 51 | DWORD userData; | 
|---|
| 52 | DWORD dwFlags; | 
|---|
| 53 | } ENUMUSERDATA; | 
|---|
| 54 |  | 
|---|
| 55 | /* | 
|---|
| 56 | *  For TranslateCharsetInfo | 
|---|
| 57 | */ | 
|---|
| 58 | #define FS(x) {{0,0,0,0},{0x1<<(x),0}} | 
|---|
| 59 | #define MAXTCIINDEX 32 | 
|---|
| 60 | static CHARSETINFO FONT_tci[MAXTCIINDEX] = { | 
|---|
| 61 | /* ANSI */ | 
|---|
| 62 | { ANSI_CHARSET, 1252, FS(0)}, | 
|---|
| 63 | { EASTEUROPE_CHARSET, 1250, FS(1)}, | 
|---|
| 64 | { RUSSIAN_CHARSET, 1251, FS(2)}, | 
|---|
| 65 | { GREEK_CHARSET, 1253, FS(3)}, | 
|---|
| 66 | { TURKISH_CHARSET, 1254, FS(4)}, | 
|---|
| 67 | { HEBREW_CHARSET, 1255, FS(5)}, | 
|---|
| 68 | { ARABIC_CHARSET, 1256, FS(6)}, | 
|---|
| 69 | { BALTIC_CHARSET, 1257, FS(7)}, | 
|---|
| 70 | /* reserved by ANSI */ | 
|---|
| 71 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 72 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 73 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 74 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 75 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 76 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 77 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 78 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 79 | /* ANSI and OEM */ | 
|---|
| 80 | { THAI_CHARSET,  874,  FS(16)}, | 
|---|
| 81 | { SHIFTJIS_CHARSET, 932, FS(17)}, | 
|---|
| 82 | { GB2312_CHARSET, 936, FS(18)}, | 
|---|
| 83 | { HANGEUL_CHARSET, 949, FS(19)}, | 
|---|
| 84 | { CHINESEBIG5_CHARSET, 950, FS(20)}, | 
|---|
| 85 | { JOHAB_CHARSET, 1361, FS(21)}, | 
|---|
| 86 | /* reserved for alternate ANSI and OEM */ | 
|---|
| 87 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 88 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 89 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 90 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 91 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 92 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 93 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 94 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 95 | /* reserved for system */ | 
|---|
| 96 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 97 | { DEFAULT_CHARSET, 0, FS(0)}, | 
|---|
| 98 | }; | 
|---|
| 99 |  | 
|---|
| 100 | HFONT hFntDefaultGui = NULL; | 
|---|
| 101 |  | 
|---|
| 102 | /***************************************************************************** | 
|---|
| 103 | * Name      : static void iFontRename | 
|---|
| 104 | * Purpose   : font remapping table to map win32 fonts to OS/2 pendants | 
|---|
| 105 | * Parameters: LPSTR lpstrFaceOriginal - the win32 face name | 
|---|
| 106 | *             LPSTR lpstrFaceBuffer   - [LF_FACESIZE] buffer to new name | 
|---|
| 107 | * Variables : | 
|---|
| 108 | * Result    : | 
|---|
| 109 | * Remark    : remapped name is passed back in the buffer | 
|---|
| 110 | *             if no mapping pendant is available, return input parameter | 
|---|
| 111 | *             as default. | 
|---|
| 112 | * Status    : | 
|---|
| 113 | * | 
|---|
| 114 | * Author    : Patrick Haller [Fri, 1998/06/12 03:44] | 
|---|
| 115 | *****************************************************************************/ | 
|---|
| 116 |  | 
|---|
| 117 | static void iFontRename(LPCSTR lpstrFaceOriginal, | 
|---|
| 118 | LPSTR  lpstrFaceTemp) | 
|---|
| 119 | { | 
|---|
| 120 | int   iRet; | 
|---|
| 121 |  | 
|---|
| 122 | // NULL is a valid parameter | 
|---|
| 123 | if (lpstrFaceOriginal == NULL) | 
|---|
| 124 | return; | 
|---|
| 125 |  | 
|---|
| 126 | strncpy(lpstrFaceTemp, lpstrFaceOriginal, LF_FACESIZE); | 
|---|
| 127 | lpstrFaceTemp[LF_FACESIZE-1] = 0; | 
|---|
| 128 |  | 
|---|
| 129 | { | 
|---|
| 130 | char *y = lpstrFaceTemp; | 
|---|
| 131 | while(*y) { | 
|---|
| 132 | if(IsDBCSLeadByte( *y )) { | 
|---|
| 133 | y += 2; // DBCS skip | 
|---|
| 134 | } else { | 
|---|
| 135 | *y = toupper( *y ); | 
|---|
| 136 | y++; | 
|---|
| 137 | } | 
|---|
| 138 | } | 
|---|
| 139 | } | 
|---|
| 140 |  | 
|---|
| 141 | //lookup table | 
|---|
| 142 | iRet = PROFILE_GetOdinIniString(ODINFONTSECTION, | 
|---|
| 143 | lpstrFaceTemp, | 
|---|
| 144 | lpstrFaceOriginal, | 
|---|
| 145 | lpstrFaceTemp, | 
|---|
| 146 | LF_FACESIZE); | 
|---|
| 147 | } | 
|---|
| 148 | //****************************************************************************** | 
|---|
| 149 | //****************************************************************************** | 
|---|
| 150 | HFONT WIN32API CreateFontA(int  nHeight, | 
|---|
| 151 | int    nWidth, | 
|---|
| 152 | int    nEscapement, | 
|---|
| 153 | int    nOrientation, | 
|---|
| 154 | int    fnWeight, | 
|---|
| 155 | DWORD  fdwItalic, | 
|---|
| 156 | DWORD  fdwUnderline, | 
|---|
| 157 | DWORD  fdwStrikeOut, | 
|---|
| 158 | DWORD  fdwCharSet, | 
|---|
| 159 | DWORD  fdwOutputPrecision, | 
|---|
| 160 | DWORD  fdwClipPrecision, | 
|---|
| 161 | DWORD  fdwQuality, | 
|---|
| 162 | DWORD  fdwPitchAndFamily, | 
|---|
| 163 | LPCSTR lpszFace) | 
|---|
| 164 | { | 
|---|
| 165 | CHAR  lpstrFaceNew[LF_FACESIZE]; | 
|---|
| 166 | HFONT hFont; | 
|---|
| 167 |  | 
|---|
| 168 | if(lpszFace == NULL) | 
|---|
| 169 | lpszFace = ""; | 
|---|
| 170 |  | 
|---|
| 171 | if(strlen(lpszFace) >= LF_FACESIZE) | 
|---|
| 172 | { | 
|---|
| 173 | dprintf(("ERROR: Invalid string length for font name!!")); | 
|---|
| 174 | SetLastError(ERROR_INVALID_PARAMETER); | 
|---|
| 175 | return 0; | 
|---|
| 176 | } | 
|---|
| 177 |  | 
|---|
| 178 | iFontRename(lpszFace, lpstrFaceNew); | 
|---|
| 179 |  | 
|---|
| 180 | dprintf(("lpszFace = %s -> %s\n", lpszFace, lpstrFaceNew)); | 
|---|
| 181 |  | 
|---|
| 182 | LOGFONTA logFont = | 
|---|
| 183 | { | 
|---|
| 184 | nHeight, | 
|---|
| 185 | nWidth, | 
|---|
| 186 | nEscapement, | 
|---|
| 187 | nOrientation, | 
|---|
| 188 | fnWeight, | 
|---|
| 189 | (BYTE)fdwItalic, | 
|---|
| 190 | (BYTE)fdwUnderline, | 
|---|
| 191 | (BYTE)fdwStrikeOut, | 
|---|
| 192 | (BYTE)fdwCharSet, | 
|---|
| 193 | (BYTE)fdwOutputPrecision, | 
|---|
| 194 | (BYTE)fdwClipPrecision, | 
|---|
| 195 | (BYTE)fdwQuality, | 
|---|
| 196 | (BYTE)fdwPitchAndFamily | 
|---|
| 197 | }; | 
|---|
| 198 | strcpy(logFont.lfFaceName, lpszFace); | 
|---|
| 199 |  | 
|---|
| 200 | return CreateFontIndirectA(&logFont); | 
|---|
| 201 | } | 
|---|
| 202 | //****************************************************************************** | 
|---|
| 203 | //****************************************************************************** | 
|---|
| 204 | HFONT WIN32API CreateFontW(int     nHeight, | 
|---|
| 205 | int     nWidth, | 
|---|
| 206 | int     nEscapement, | 
|---|
| 207 | int     nOrientation, | 
|---|
| 208 | int     fnWeight, | 
|---|
| 209 | DWORD   fdwItalic, | 
|---|
| 210 | DWORD   fdwUnderline, | 
|---|
| 211 | DWORD   fdwStrikeOut, | 
|---|
| 212 | DWORD   fdwCharSet, | 
|---|
| 213 | DWORD   fdwOutputPrecision, | 
|---|
| 214 | DWORD   fdwClipPrecision, | 
|---|
| 215 | DWORD   fdwQuality, | 
|---|
| 216 | DWORD   fdwPitchAndFamily, | 
|---|
| 217 | LPCWSTR lpszFace) | 
|---|
| 218 | { | 
|---|
| 219 | char *astring; | 
|---|
| 220 | HFONT hFont; | 
|---|
| 221 |  | 
|---|
| 222 | // NULL is valid for lpszFace | 
|---|
| 223 | if(lpszFace != NULL) | 
|---|
| 224 | astring = UnicodeToAsciiString((LPWSTR)lpszFace); | 
|---|
| 225 | else | 
|---|
| 226 | astring = NULL; | 
|---|
| 227 |  | 
|---|
| 228 | // @@@PH switch to ODIN_ later | 
|---|
| 229 | hFont =    CreateFontA(nHeight, | 
|---|
| 230 | nWidth, | 
|---|
| 231 | nEscapement, | 
|---|
| 232 | nOrientation, | 
|---|
| 233 | fnWeight, | 
|---|
| 234 | fdwItalic, | 
|---|
| 235 | fdwUnderline, | 
|---|
| 236 | fdwStrikeOut, | 
|---|
| 237 | fdwCharSet, | 
|---|
| 238 | fdwOutputPrecision, | 
|---|
| 239 | fdwClipPrecision, | 
|---|
| 240 | fdwQuality, | 
|---|
| 241 | fdwPitchAndFamily, | 
|---|
| 242 | astring); | 
|---|
| 243 | if (astring != NULL) | 
|---|
| 244 | FreeAsciiString(astring); | 
|---|
| 245 |  | 
|---|
| 246 | return(hFont); | 
|---|
| 247 | } | 
|---|
| 248 |  | 
|---|
| 249 | //****************************************************************************** | 
|---|
| 250 | //****************************************************************************** | 
|---|
| 251 | HFONT WIN32API CreateFontIndirectA(const LOGFONTA* lplf) | 
|---|
| 252 | { | 
|---|
| 253 | HFONT    hFont; | 
|---|
| 254 | LOGFONTA afont; | 
|---|
| 255 |  | 
|---|
| 256 | // don't touch user buffer! | 
|---|
| 257 | memcpy(&afont, lplf, sizeof(LOGFONTA)); | 
|---|
| 258 | iFontRename(lplf->lfFaceName, afont.lfFaceName); | 
|---|
| 259 |  | 
|---|
| 260 | dprintf(("lpszFace = (%x) %s -> %s\n", lplf->lfFaceName, lplf->lfFaceName, afont.lfFaceName)); | 
|---|
| 261 |  | 
|---|
| 262 | dprintf(("GDI32: CreateFontIndirectA\n")); | 
|---|
| 263 | dprintf(("GDI32: lfHeight        = %d\n", lplf->lfHeight)); | 
|---|
| 264 | dprintf(("GDI32: lfWidth          = %d\n", lplf->lfWidth)); | 
|---|
| 265 | dprintf(("GDI32: lfEscapement    = %d\n", lplf->lfEscapement)); | 
|---|
| 266 | dprintf(("GDI32: lfOrientation   = %d\n", lplf->lfOrientation)); | 
|---|
| 267 | dprintf(("GDI32: lfWeight        = %d\n", lplf->lfWeight)); | 
|---|
| 268 | dprintf(("GDI32: lfItalic        = %d\n", lplf->lfItalic)); | 
|---|
| 269 | dprintf(("GDI32: lfUnderline     = %d\n", lplf->lfUnderline)); | 
|---|
| 270 | dprintf(("GDI32: lfStrikeOut     = %d\n", lplf->lfStrikeOut)); | 
|---|
| 271 | dprintf(("GDI32: lfCharSet       = %X\n", lplf->lfCharSet)); | 
|---|
| 272 | dprintf(("GDI32: lfOutPrecision  = %X\n", lplf->lfOutPrecision)); | 
|---|
| 273 | dprintf(("GDI32: lfClipPrecision = %X\n", lplf->lfClipPrecision)); | 
|---|
| 274 | dprintf(("GDI32: lfQuality       = %X\n", lplf->lfQuality)); | 
|---|
| 275 | dprintf(("GDI32: lfPitchAndFamily= %X\n", lplf->lfPitchAndFamily)); | 
|---|
| 276 | dprintf(("GDI32: lfFaceName      = %s\n", lplf->lfFaceName)); | 
|---|
| 277 |  | 
|---|
| 278 | hFont = O32_CreateFontIndirect(&afont); | 
|---|
| 279 | if(hFont) { | 
|---|
| 280 | STATS_CreateFontIndirect(hFont, &afont); | 
|---|
| 281 | } | 
|---|
| 282 | return(hFont); | 
|---|
| 283 | } | 
|---|
| 284 | //****************************************************************************** | 
|---|
| 285 | //****************************************************************************** | 
|---|
| 286 | HFONT WIN32API CreateFontIndirectW(const LOGFONTW * lplf) | 
|---|
| 287 | { | 
|---|
| 288 | LOGFONTA afont; | 
|---|
| 289 | HFONT    hfont; | 
|---|
| 290 |  | 
|---|
| 291 | //memcpy(&afont, lplf, ((ULONG)&afont.lfFaceName - (ULONG)&afont)); | 
|---|
| 292 | memcpy(&afont, lplf, sizeof(LOGFONTA)); | 
|---|
| 293 | memset(afont.lfFaceName, 0, LF_FACESIZE); | 
|---|
| 294 | dprintf(("lpszFace = (%x)", lplf->lfFaceName)); | 
|---|
| 295 |  | 
|---|
| 296 | UnicodeToAsciiN((WCHAR *)lplf->lfFaceName, afont.lfFaceName, LF_FACESIZE-1); | 
|---|
| 297 | hfont = CreateFontIndirectA(&afont); | 
|---|
| 298 | return(hfont); | 
|---|
| 299 | } | 
|---|
| 300 | //****************************************************************************** | 
|---|
| 301 | //****************************************************************************** | 
|---|
| 302 | int  EXPENTRY_O32 EnumFontProcA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA | 
|---|
| 303 | lpTextM, DWORD arg3, LPARAM arg4) | 
|---|
| 304 | { | 
|---|
| 305 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4; | 
|---|
| 306 | FONTENUMPROCA proc = (FONTENUMPROCA)lpEnumData->userProc; | 
|---|
| 307 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel | 
|---|
| 308 |  | 
|---|
| 309 | int rc = proc(lpLogFont, lpTextM, arg3, lpEnumData->userData); | 
|---|
| 310 | SetFS(selTIB);           // switch back to the saved FS selector | 
|---|
| 311 | return rc; | 
|---|
| 312 | } | 
|---|
| 313 | //****************************************************************************** | 
|---|
| 314 | //****************************************************************************** | 
|---|
| 315 | int  EXPENTRY_O32 EnumFontProcW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM, | 
|---|
| 316 | DWORD arg3, LPARAM arg4) | 
|---|
| 317 | { | 
|---|
| 318 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4; | 
|---|
| 319 | FONTENUMPROCW proc = (FONTENUMPROCW)lpEnumData->userProc; | 
|---|
| 320 | ENUMLOGFONTW LogFont; | 
|---|
| 321 | NEWTEXTMETRICW textM; | 
|---|
| 322 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel | 
|---|
| 323 | int rc; | 
|---|
| 324 |  | 
|---|
| 325 | memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName - | 
|---|
| 326 | (ULONG)&LogFont)); | 
|---|
| 327 | AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1); | 
|---|
| 328 | AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1); | 
|---|
| 329 | AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1); | 
|---|
| 330 |  | 
|---|
| 331 | textM.tmHeight = lpTextM->tmHeight; | 
|---|
| 332 | textM.tmAscent = lpTextM->tmAscent; | 
|---|
| 333 | textM.tmDescent = lpTextM->tmDescent; | 
|---|
| 334 | textM.tmInternalLeading = lpTextM->tmInternalLeading; | 
|---|
| 335 | textM.tmExternalLeading = lpTextM->tmExternalLeading; | 
|---|
| 336 | textM.tmAveCharWidth = lpTextM->tmAveCharWidth; | 
|---|
| 337 | textM.tmMaxCharWidth = lpTextM->tmMaxCharWidth; | 
|---|
| 338 | textM.tmWeight = lpTextM->tmWeight; | 
|---|
| 339 | textM.tmOverhang = lpTextM->tmOverhang; | 
|---|
| 340 | textM.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX; | 
|---|
| 341 | textM.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY; | 
|---|
| 342 | textM.tmFirstChar = lpTextM->tmFirstChar; | 
|---|
| 343 | textM.tmLastChar = lpTextM->tmLastChar; | 
|---|
| 344 | textM.tmDefaultChar = lpTextM->tmDefaultChar; | 
|---|
| 345 | textM.tmBreakChar = lpTextM->tmBreakChar; | 
|---|
| 346 | textM.tmItalic = lpTextM->tmItalic; | 
|---|
| 347 | textM.tmUnderlined = lpTextM->tmUnderlined; | 
|---|
| 348 | textM.tmStruckOut = lpTextM->tmStruckOut; | 
|---|
| 349 | textM.tmPitchAndFamily = lpTextM->tmPitchAndFamily; | 
|---|
| 350 | textM.tmCharSet = lpTextM->tmCharSet; | 
|---|
| 351 | textM.ntmFlags = 0; | 
|---|
| 352 | textM.ntmSizeEM = 0; | 
|---|
| 353 | textM.ntmCellHeight = 0; | 
|---|
| 354 | textM.ntmAvgWidth = 0; | 
|---|
| 355 |  | 
|---|
| 356 | rc = proc(&LogFont, &textM, arg3, lpEnumData->userData); | 
|---|
| 357 | SetFS(selTIB);           // switch back to the saved FS selector | 
|---|
| 358 | return rc; | 
|---|
| 359 | } | 
|---|
| 360 | //****************************************************************************** | 
|---|
| 361 | //TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part) | 
|---|
| 362 | //****************************************************************************** | 
|---|
| 363 | int  EXPENTRY_O32 EnumFontProcExA(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA | 
|---|
| 364 | lpTextM, DWORD arg3, LPARAM arg4) | 
|---|
| 365 | { | 
|---|
| 366 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4; | 
|---|
| 367 | FONTENUMPROCEXA proc = (FONTENUMPROCEXA)lpEnumData->userProc; | 
|---|
| 368 | ENUMLOGFONTEXA logFont; | 
|---|
| 369 | NEWTEXTMETRICEXA textM; | 
|---|
| 370 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel | 
|---|
| 371 |  | 
|---|
| 372 | memcpy(&logFont, lpLogFont, sizeof(ENUMLOGFONTA)); | 
|---|
| 373 | memset(logFont.elfScript, 0, sizeof(logFont.elfScript)); | 
|---|
| 374 | memcpy(&textM.ntmTm, lpTextM, sizeof(textM.ntmTm)); | 
|---|
| 375 | memset(&textM.ntmFontSig, 0, sizeof(textM.ntmFontSig)); | 
|---|
| 376 |  | 
|---|
| 377 | dprintf(("EnumFontProcExA %s height %d", logFont.elfLogFont.lfFaceName, textM.ntmTm.tmHeight)); | 
|---|
| 378 |  | 
|---|
| 379 | int rc = proc(&logFont, &textM, arg3, lpEnumData->userData); | 
|---|
| 380 | SetFS(selTIB);           // switch back to the saved FS selector | 
|---|
| 381 | return rc; | 
|---|
| 382 | } | 
|---|
| 383 | //****************************************************************************** | 
|---|
| 384 | //TODO: FontEnumdwFlagsEx, script, font signature & NEWTEXTMETRICEX (last part) | 
|---|
| 385 | //****************************************************************************** | 
|---|
| 386 | int EXPENTRY_O32 EnumFontProcExW(LPENUMLOGFONTA lpLogFont, LPNEWTEXTMETRICA lpTextM, | 
|---|
| 387 | DWORD arg3, LPARAM arg4) | 
|---|
| 388 | { | 
|---|
| 389 | ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4; | 
|---|
| 390 | FONTENUMPROCEXW proc = (FONTENUMPROCEXW)lpEnumData->userProc; | 
|---|
| 391 | ENUMLOGFONTEXW LogFont; | 
|---|
| 392 | NEWTEXTMETRICEXW textM; | 
|---|
| 393 | USHORT selTIB = SetWin32TIB(); // save current FS selector and set win32 sel | 
|---|
| 394 | int rc; | 
|---|
| 395 |  | 
|---|
| 396 | memcpy(&LogFont, lpLogFont, ((ULONG)&LogFont.elfLogFont.lfFaceName - (ULONG)&LogFont)); | 
|---|
| 397 | memset(LogFont.elfScript, 0, sizeof(LogFont.elfScript)); | 
|---|
| 398 | AsciiToUnicodeN(lpLogFont->elfLogFont.lfFaceName, LogFont.elfLogFont.lfFaceName, LF_FACESIZE-1); | 
|---|
| 399 | AsciiToUnicodeN((char *) lpLogFont->elfFullName, LogFont.elfFullName, LF_FULLFACESIZE-1); | 
|---|
| 400 | AsciiToUnicodeN((char *) lpLogFont->elfStyle, LogFont.elfStyle, LF_FACESIZE-1); | 
|---|
| 401 |  | 
|---|
| 402 | textM.ntmTm.tmHeight = lpTextM->tmHeight; | 
|---|
| 403 | textM.ntmTm.tmAscent = lpTextM->tmAscent; | 
|---|
| 404 | textM.ntmTm.tmDescent = lpTextM->tmDescent; | 
|---|
| 405 | textM.ntmTm.tmInternalLeading = lpTextM->tmInternalLeading; | 
|---|
| 406 | textM.ntmTm.tmExternalLeading = lpTextM->tmExternalLeading; | 
|---|
| 407 | textM.ntmTm.tmAveCharWidth = lpTextM->tmAveCharWidth; | 
|---|
| 408 | textM.ntmTm.tmMaxCharWidth = lpTextM->tmMaxCharWidth; | 
|---|
| 409 | textM.ntmTm.tmWeight = lpTextM->tmWeight; | 
|---|
| 410 | textM.ntmTm.tmOverhang = lpTextM->tmOverhang; | 
|---|
| 411 | textM.ntmTm.tmDigitizedAspectX = lpTextM->tmDigitizedAspectX; | 
|---|
| 412 | textM.ntmTm.tmDigitizedAspectY = lpTextM->tmDigitizedAspectY; | 
|---|
| 413 | textM.ntmTm.tmFirstChar = lpTextM->tmFirstChar; | 
|---|
| 414 | textM.ntmTm.tmLastChar = lpTextM->tmLastChar; | 
|---|
| 415 | textM.ntmTm.tmDefaultChar = lpTextM->tmDefaultChar; | 
|---|
| 416 | textM.ntmTm.tmBreakChar = lpTextM->tmBreakChar; | 
|---|
| 417 | textM.ntmTm.tmItalic = lpTextM->tmItalic; | 
|---|
| 418 | textM.ntmTm.tmUnderlined = lpTextM->tmUnderlined; | 
|---|
| 419 | textM.ntmTm.tmStruckOut = lpTextM->tmStruckOut; | 
|---|
| 420 | textM.ntmTm.tmPitchAndFamily = lpTextM->tmPitchAndFamily; | 
|---|
| 421 | textM.ntmTm.tmCharSet = lpTextM->tmCharSet; | 
|---|
| 422 | textM.ntmTm.ntmFlags = 0; | 
|---|
| 423 | textM.ntmTm.ntmSizeEM = 0; | 
|---|
| 424 | textM.ntmTm.ntmCellHeight = 0; | 
|---|
| 425 | textM.ntmTm.ntmAvgWidth = 0; | 
|---|
| 426 | memset(&textM.ntmFontSig, 0, sizeof(textM.ntmFontSig)); | 
|---|
| 427 |  | 
|---|
| 428 | dprintf(("EnumFontProcExW %s height %d", lpLogFont->elfLogFont.lfFaceName, textM.ntmTm.tmHeight)); | 
|---|
| 429 | rc = proc(&LogFont, &textM, arg3, lpEnumData->userData); | 
|---|
| 430 | SetFS(selTIB);           // switch back to the saved FS selector | 
|---|
| 431 | return rc; | 
|---|
| 432 | } | 
|---|
| 433 | //****************************************************************************** | 
|---|
| 434 | //****************************************************************************** | 
|---|
| 435 | int WIN32API EnumFontsA(HDC hdc, | 
|---|
| 436 | LPCSTR arg2, | 
|---|
| 437 | FONTENUMPROCA arg3, | 
|---|
| 438 | LPARAM  arg4) | 
|---|
| 439 | { | 
|---|
| 440 | //@@@PH shouldn't this rather be O32_EnumFonts ? | 
|---|
| 441 | return EnumFontFamiliesA(hdc, arg2, arg3, arg4); | 
|---|
| 442 | } | 
|---|
| 443 | //****************************************************************************** | 
|---|
| 444 | //****************************************************************************** | 
|---|
| 445 | int WIN32API EnumFontsW(HDC hdc, | 
|---|
| 446 | LPCWSTR arg2, | 
|---|
| 447 | FONTENUMPROCW arg3, | 
|---|
| 448 | LPARAM  arg4) | 
|---|
| 449 | { | 
|---|
| 450 | //@@@PH shouldn't this rather be O32_EnumFonts ? | 
|---|
| 451 | return EnumFontFamiliesW(hdc, arg2, arg3, arg4); | 
|---|
| 452 | } | 
|---|
| 453 | //****************************************************************************** | 
|---|
| 454 | //****************************************************************************** | 
|---|
| 455 | int WIN32API EnumFontFamiliesA(HDC hdc, | 
|---|
| 456 | LPCSTR lpszFontFamily, | 
|---|
| 457 | FONTENUMPROCA arg3, | 
|---|
| 458 | LPARAM arg4) | 
|---|
| 459 | { | 
|---|
| 460 | ENUMUSERDATA enumData; | 
|---|
| 461 | CHAR         lpstrFamilyNew[LF_FACESIZE] = ""; | 
|---|
| 462 | int rc; | 
|---|
| 463 |  | 
|---|
| 464 | dprintf(("GDI32: EnumFontFamiliesA %s", lpszFontFamily)); | 
|---|
| 465 |  | 
|---|
| 466 | iFontRename(lpszFontFamily, lpstrFamilyNew); | 
|---|
| 467 |  | 
|---|
| 468 | enumData.userProc = (DWORD)arg3; | 
|---|
| 469 | enumData.userData = arg4; | 
|---|
| 470 |  | 
|---|
| 471 | rc = O32_EnumFontFamilies(hdc, lpstrFamilyNew, &EnumFontProcA, (LPARAM)&enumData); | 
|---|
| 472 |  | 
|---|
| 473 | return rc; | 
|---|
| 474 | } | 
|---|
| 475 | //****************************************************************************** | 
|---|
| 476 | //****************************************************************************** | 
|---|
| 477 | int WIN32API EnumFontFamiliesW(HDC hdc, | 
|---|
| 478 | LPCWSTR lpszFontFamilyW, | 
|---|
| 479 | FONTENUMPROCW arg3, | 
|---|
| 480 | LPARAM arg4) | 
|---|
| 481 | { | 
|---|
| 482 | CHAR         lpstrFamilyNew[LF_FACESIZE] = ""; | 
|---|
| 483 | ENUMUSERDATA enumData; | 
|---|
| 484 | int          rc; | 
|---|
| 485 | char        *lpszFontFamilyA = UnicodeToAsciiString((LPWSTR)lpszFontFamilyW); | 
|---|
| 486 |  | 
|---|
| 487 | dprintf(("GDI32: EnumFontFamiliesW %s", lpszFontFamilyA)); | 
|---|
| 488 |  | 
|---|
| 489 | iFontRename(lpszFontFamilyA, lpstrFamilyNew); | 
|---|
| 490 |  | 
|---|
| 491 | enumData.userProc = (DWORD)arg3; | 
|---|
| 492 | enumData.userData = arg4; | 
|---|
| 493 |  | 
|---|
| 494 | rc = O32_EnumFontFamilies(hdc, lpstrFamilyNew, &EnumFontProcW, (LPARAM)&enumData); | 
|---|
| 495 |  | 
|---|
| 496 | if(lpszFontFamilyA) FreeAsciiString(lpszFontFamilyA); | 
|---|
| 497 | return rc; | 
|---|
| 498 | } | 
|---|
| 499 | //****************************************************************************** | 
|---|
| 500 | //****************************************************************************** | 
|---|
| 501 | INT WIN32API EnumFontFamiliesExA(HDC hdc, | 
|---|
| 502 | LPLOGFONTA arg2, | 
|---|
| 503 | FONTENUMPROCEXA arg3, | 
|---|
| 504 | LPARAM arg4, | 
|---|
| 505 | DWORD dwFlags) | 
|---|
| 506 | { | 
|---|
| 507 | ENUMUSERDATA enumData; | 
|---|
| 508 | int rc; | 
|---|
| 509 |  | 
|---|
| 510 | dprintf(("GDI32: EnumFontFamiliesExA not complete %s", arg2->lfFaceName)); | 
|---|
| 511 |  | 
|---|
| 512 | enumData.userProc = (DWORD)arg3; | 
|---|
| 513 | enumData.userData = arg4; | 
|---|
| 514 | enumData.dwFlags  = dwFlags; | 
|---|
| 515 |  | 
|---|
| 516 | rc = O32_EnumFontFamilies(hdc, arg2->lfFaceName, &EnumFontProcExA, (LPARAM)&enumData); | 
|---|
| 517 |  | 
|---|
| 518 | return rc; | 
|---|
| 519 | } | 
|---|
| 520 | //****************************************************************************** | 
|---|
| 521 | //****************************************************************************** | 
|---|
| 522 | INT WIN32API EnumFontFamiliesExW(HDC hdc, | 
|---|
| 523 | LPLOGFONTW arg2, | 
|---|
| 524 | FONTENUMPROCEXW arg3, | 
|---|
| 525 | LPARAM arg4, | 
|---|
| 526 | DWORD dwFlags) | 
|---|
| 527 | { | 
|---|
| 528 | ENUMUSERDATA enumData; | 
|---|
| 529 | int rc; | 
|---|
| 530 | char *astring = UnicodeToAsciiString((LPWSTR)arg2->lfFaceName); | 
|---|
| 531 |  | 
|---|
| 532 | dprintf(("GDI32: EnumFontFamiliesExW not complete %s", astring)); | 
|---|
| 533 |  | 
|---|
| 534 | enumData.userProc = (DWORD)arg3; | 
|---|
| 535 | enumData.userData = arg4; | 
|---|
| 536 | enumData.dwFlags  = dwFlags; | 
|---|
| 537 |  | 
|---|
| 538 | rc = O32_EnumFontFamilies(hdc, astring, &EnumFontProcExW, (LPARAM)&enumData); | 
|---|
| 539 |  | 
|---|
| 540 | FreeAsciiString(astring); | 
|---|
| 541 | return rc; | 
|---|
| 542 | } | 
|---|
| 543 | //****************************************************************************** | 
|---|
| 544 | //****************************************************************************** | 
|---|
| 545 | DWORD WIN32API GetFontData(HDC hdc, DWORD dwTable, | 
|---|
| 546 | DWORD dwOffset, | 
|---|
| 547 | LPVOID lpvBuffer, | 
|---|
| 548 | DWORD dbData) | 
|---|
| 549 | { | 
|---|
| 550 | dprintf(("GDI32: GetFontData, not implemented (GDI_ERROR)\n")); | 
|---|
| 551 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED); | 
|---|
| 552 |  | 
|---|
| 553 | return(GDI_ERROR); | 
|---|
| 554 | } | 
|---|
| 555 | //****************************************************************************** | 
|---|
| 556 | //****************************************************************************** | 
|---|
| 557 | int WIN32API AddFontResourceA(LPCSTR szFont) | 
|---|
| 558 | { | 
|---|
| 559 | HINSTANCE hInstance; | 
|---|
| 560 |  | 
|---|
| 561 | dprintf(("GDI32: AddFontResourceA %s", szFont)); | 
|---|
| 562 | hInstance = LoadLibraryA(szFont); | 
|---|
| 563 | if(hInstance) { | 
|---|
| 564 | dprintf(("AddFontResourceA: executable file; NOT IMPLEMENTED")); | 
|---|
| 565 | FreeLibrary(hInstance); | 
|---|
| 566 | return 1; | 
|---|
| 567 | } | 
|---|
| 568 | return 1; | 
|---|
| 569 | } | 
|---|
| 570 | //****************************************************************************** | 
|---|
| 571 | //****************************************************************************** | 
|---|
| 572 | int WIN32API AddFontResourceW(LPCWSTR szFont) | 
|---|
| 573 | { | 
|---|
| 574 | char *astring = UnicodeToAsciiString((LPWSTR)szFont); | 
|---|
| 575 | BOOL  rc; | 
|---|
| 576 |  | 
|---|
| 577 | dprintf(("GDI32: AddFontResourceW")); | 
|---|
| 578 | // NOTE: This will not work as is (needs UNICODE support) | 
|---|
| 579 | rc = AddFontResourceA(astring); | 
|---|
| 580 | FreeAsciiString(astring); | 
|---|
| 581 | return rc; | 
|---|
| 582 | } | 
|---|
| 583 | //****************************************************************************** | 
|---|
| 584 | //****************************************************************************** | 
|---|
| 585 | BOOL WIN32API RemoveFontResourceA(LPCSTR lpszFont) | 
|---|
| 586 | { | 
|---|
| 587 | dprintf(("GDI32: RemoveFontResourceA %s", lpszFont)); | 
|---|
| 588 | return FALSE; | 
|---|
| 589 | } | 
|---|
| 590 | //****************************************************************************** | 
|---|
| 591 | //****************************************************************************** | 
|---|
| 592 | BOOL WIN32API RemoveFontResourceW(LPCWSTR szFont) | 
|---|
| 593 | { | 
|---|
| 594 | char *astring = UnicodeToAsciiString((LPWSTR)szFont); | 
|---|
| 595 | BOOL  rc; | 
|---|
| 596 |  | 
|---|
| 597 | dprintf(("GDI32: RemoveFontResourceW")); | 
|---|
| 598 | rc = RemoveFontResourceA(astring); | 
|---|
| 599 | FreeAsciiString(astring); | 
|---|
| 600 | return(rc); | 
|---|
| 601 | } | 
|---|
| 602 | /***************************************************************************** | 
|---|
| 603 | * Name      : BOOL CreateScalableFontResourceA | 
|---|
| 604 | * Purpose   : The CreateScalableFontResourceA function creates a font resource | 
|---|
| 605 | *             file for a scalable font. | 
|---|
| 606 | * Parameters: DWORD   fdwHidden       flag for read-only embedded font | 
|---|
| 607 | *             LPCSTR lpszFontRes     address of filename for font resource | 
|---|
| 608 | *             LPCSTR lpszFontFile    address of filename for scalable font | 
|---|
| 609 | *             LPCSTR lpszCurrentPath address of path to font file | 
|---|
| 610 | * Variables : | 
|---|
| 611 | * Result    : TRUE / FALSE | 
|---|
| 612 | * Remark    : | 
|---|
| 613 | * Status    : UNTESTED STUB | 
|---|
| 614 | * | 
|---|
| 615 | * Author    : Patrick Haller [Mon, 1998/06/15 08:00] | 
|---|
| 616 | *****************************************************************************/ | 
|---|
| 617 |  | 
|---|
| 618 | BOOL WIN32API CreateScalableFontResourceA(DWORD fdwHidden, | 
|---|
| 619 | LPCSTR lpszFontRes, | 
|---|
| 620 | LPCSTR lpszFontFile, | 
|---|
| 621 | LPCSTR lpszCurrentPath) | 
|---|
| 622 | { | 
|---|
| 623 | dprintf(("GDI32: CreateScalableFontResourceA %x %s %s %s not implemented", fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath)); | 
|---|
| 624 |  | 
|---|
| 625 | //  return OSLibGpiLoadFonts((LPSTR)lpszFontFile); | 
|---|
| 626 | return FALSE; | 
|---|
| 627 | } | 
|---|
| 628 |  | 
|---|
| 629 |  | 
|---|
| 630 | /***************************************************************************** | 
|---|
| 631 | * Name      : BOOL CreateScalableFontResourceW | 
|---|
| 632 | * Purpose   : The CreateScalableFontResourceW function creates a font resource | 
|---|
| 633 | *             file for a scalable font. | 
|---|
| 634 | * Parameters: DWORD   fdwHidden       flag for read-only embedded font | 
|---|
| 635 | *             LPCSTR lpszFontRes     address of filename for font resource | 
|---|
| 636 | *             LPCSTR lpszFontFile    address of filename for scalable font | 
|---|
| 637 | *             LPCSTR lpszCurrentPath address of path to font file | 
|---|
| 638 | * Variables : | 
|---|
| 639 | * Result    : TRUE / FALSE | 
|---|
| 640 | * Remark    : | 
|---|
| 641 | * Status    : UNTESTED STUB | 
|---|
| 642 | * | 
|---|
| 643 | * Author    : Patrick Haller [Mon, 1998/06/15 08:00] | 
|---|
| 644 | *****************************************************************************/ | 
|---|
| 645 |  | 
|---|
| 646 | BOOL WIN32API CreateScalableFontResourceW(DWORD fdwHidden, | 
|---|
| 647 | LPCWSTR lpszFontRes, | 
|---|
| 648 | LPCWSTR lpszFontFile, | 
|---|
| 649 | LPCWSTR lpszCurrentPath) | 
|---|
| 650 | { | 
|---|
| 651 | LPSTR lpszFontFileA = NULL, lpszFontResA = NULL, lpszCurrentPathA = NULL; | 
|---|
| 652 |  | 
|---|
| 653 | dprintf(("GDI32: CreateScalableFontResourceW %x %ls %ls %ls not implemented", fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath)); | 
|---|
| 654 |  | 
|---|
| 655 | STACK_strdupWtoA(lpszFontFile, lpszFontFileA); | 
|---|
| 656 | STACK_strdupWtoA(lpszFontRes, lpszFontResA); | 
|---|
| 657 | STACK_strdupWtoA(lpszCurrentPath, lpszCurrentPathA); | 
|---|
| 658 | return CreateScalableFontResourceA(fdwHidden, lpszFontResA, lpszFontFileA, lpszCurrentPathA); | 
|---|
| 659 | } | 
|---|
| 660 |  | 
|---|
| 661 |  | 
|---|
| 662 | /***************************************************************************** | 
|---|
| 663 | * Name      : DWORD GetFontLanguageInfo | 
|---|
| 664 | * Purpose   : The GetFontLanguageInfo function returns information about the | 
|---|
| 665 | *             currently selected font for the specified display context. | 
|---|
| 666 | *             Applications typically use this information and the | 
|---|
| 667 | *             GetCharacterPlacement function to prepare a character string for display. | 
|---|
| 668 | * Parameters: HDC     hdc        handle to device context | 
|---|
| 669 | * Variables : | 
|---|
| 670 | * Result    : | 
|---|
| 671 | * Remark    : | 
|---|
| 672 | * Status    : UNTESTED STUB | 
|---|
| 673 | * | 
|---|
| 674 | * Author    : Patrick Haller [Mon, 1998/06/15 08:00] | 
|---|
| 675 | *****************************************************************************/ | 
|---|
| 676 |  | 
|---|
| 677 | DWORD WIN32API GetFontLanguageInfo(HDC hdc) | 
|---|
| 678 | { | 
|---|
| 679 | dprintf(("GDI32: GetFontLanguageInfo(%08xh) not implemented.\n", | 
|---|
| 680 | hdc)); | 
|---|
| 681 |  | 
|---|
| 682 | return (0); | 
|---|
| 683 | } | 
|---|
| 684 |  | 
|---|
| 685 |  | 
|---|
| 686 | /************************************************************************* | 
|---|
| 687 | * TranslateCharsetInfo [GDI32.382] | 
|---|
| 688 | * | 
|---|
| 689 | * Fills a CHARSETINFO structure for a character set, code page, or | 
|---|
| 690 | * font. This allows making the correspondance between different labelings | 
|---|
| 691 | * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges) | 
|---|
| 692 | * of the same encoding. | 
|---|
| 693 | * | 
|---|
| 694 | * Only one codepage will be set in lpCs->fs. If TCI_SRCFONTSIG is used, | 
|---|
| 695 | * only one codepage should be set in *lpSrc. | 
|---|
| 696 | * | 
|---|
| 697 | * RETURNS | 
|---|
| 698 | *   TRUE on success, FALSE on failure. | 
|---|
| 699 | * | 
|---|
| 700 | * | 
|---|
| 701 | * LPDWORD lpSrc, if flags == TCI_SRCFONTSIG: pointer to fsCsb of a FONTSIGNATURE | 
|---|
| 702 | *                if flags == TCI_SRCCHARSET: a character set value | 
|---|
| 703 | *                if flags == TCI_SRCCODEPAGE: a code page value | 
|---|
| 704 | * LPCHARSETINFO lpCs, structure to receive charset information | 
|---|
| 705 | * DWORD flags  determines interpretation of lpSrc | 
|---|
| 706 | */ | 
|---|
| 707 | BOOL WIN32API TranslateCharsetInfo(LPDWORD lpSrc, LPCHARSETINFO lpCs, | 
|---|
| 708 | DWORD flags) | 
|---|
| 709 | { | 
|---|
| 710 | int index = 0; | 
|---|
| 711 | switch (flags) { | 
|---|
| 712 | case TCI_SRCFONTSIG: | 
|---|
| 713 | while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++; | 
|---|
| 714 | break; | 
|---|
| 715 | case TCI_SRCCODEPAGE: | 
|---|
| 716 | while ((UINT) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++; | 
|---|
| 717 | break; | 
|---|
| 718 | case TCI_SRCCHARSET: | 
|---|
| 719 | while ((UINT) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++; | 
|---|
| 720 | break; | 
|---|
| 721 | default: | 
|---|
| 722 | return FALSE; | 
|---|
| 723 | } | 
|---|
| 724 | if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE; | 
|---|
| 725 | memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO)); | 
|---|
| 726 | return TRUE; | 
|---|
| 727 | } | 
|---|
| 728 | //****************************************************************************** | 
|---|
| 729 | //****************************************************************************** | 
|---|
| 730 | BOOL WIN32API GetTextMetricsA( HDC hdc, LPTEXTMETRICA  pwtm) | 
|---|
| 731 | { | 
|---|
| 732 | BOOL rc; | 
|---|
| 733 |  | 
|---|
| 734 | rc = O32_GetTextMetrics(hdc, pwtm); | 
|---|
| 735 | dprintf(("GDI32: GetTextMetricsA %x %x returned %d", hdc, pwtm, rc)); | 
|---|
| 736 | return(rc); | 
|---|
| 737 | } | 
|---|
| 738 | //****************************************************************************** | 
|---|
| 739 | //****************************************************************************** | 
|---|
| 740 | BOOL WIN32API GetTextMetricsW( HDC hdc, LPTEXTMETRICW pwtm) | 
|---|
| 741 | { | 
|---|
| 742 | BOOL rc; | 
|---|
| 743 | TEXTMETRICA atm; | 
|---|
| 744 |  | 
|---|
| 745 | dprintf(("GDI32: GetTextMetricsW")); | 
|---|
| 746 |  | 
|---|
| 747 | rc = O32_GetTextMetrics(hdc, &atm); | 
|---|
| 748 | pwtm->tmHeight = atm.tmHeight; | 
|---|
| 749 | pwtm->tmAscent = atm.tmAscent; | 
|---|
| 750 | pwtm->tmDescent = atm.tmDescent; | 
|---|
| 751 | pwtm->tmInternalLeading = atm.tmInternalLeading; | 
|---|
| 752 | pwtm->tmExternalLeading = atm.tmExternalLeading; | 
|---|
| 753 | pwtm->tmAveCharWidth = atm.tmAveCharWidth; | 
|---|
| 754 | pwtm->tmMaxCharWidth = atm.tmMaxCharWidth; | 
|---|
| 755 | pwtm->tmWeight = atm.tmWeight; | 
|---|
| 756 | pwtm->tmOverhang = atm.tmOverhang; | 
|---|
| 757 | pwtm->tmDigitizedAspectX = atm.tmDigitizedAspectX; | 
|---|
| 758 | pwtm->tmDigitizedAspectY = atm.tmDigitizedAspectY; | 
|---|
| 759 | pwtm->tmFirstChar = atm.tmFirstChar; | 
|---|
| 760 | pwtm->tmLastChar = atm.tmLastChar; | 
|---|
| 761 | pwtm->tmDefaultChar = atm.tmDefaultChar; | 
|---|
| 762 | pwtm->tmBreakChar = atm.tmBreakChar; | 
|---|
| 763 | pwtm->tmItalic = atm.tmItalic; | 
|---|
| 764 | pwtm->tmUnderlined = atm.tmUnderlined; | 
|---|
| 765 | pwtm->tmStruckOut = atm.tmStruckOut; | 
|---|
| 766 | pwtm->tmPitchAndFamily = atm.tmPitchAndFamily; | 
|---|
| 767 | pwtm->tmCharSet = atm.tmCharSet; | 
|---|
| 768 |  | 
|---|
| 769 | dprintf(("GDI32: GetTextMetricsW %x %x returned %d", hdc, pwtm, rc)); | 
|---|
| 770 | return(rc); | 
|---|
| 771 | } | 
|---|
| 772 | //****************************************************************************** | 
|---|
| 773 | //****************************************************************************** | 
|---|
| 774 | int WIN32API GetTextFaceA( HDC hdc, int arg2, LPSTR  arg3) | 
|---|
| 775 | { | 
|---|
| 776 | dprintf(("GDI32: GetTextFaceA %x %d %x", hdc, arg2, arg3)); | 
|---|
| 777 | return O32_GetTextFace(hdc, arg2, arg3); | 
|---|
| 778 | } | 
|---|
| 779 | //****************************************************************************** | 
|---|
| 780 | //****************************************************************************** | 
|---|
| 781 | int WIN32API GetTextFaceW( HDC hdc, int arg2, LPWSTR  arg3) | 
|---|
| 782 | { | 
|---|
| 783 | char *astring = NULL; | 
|---|
| 784 | int   lenA = GetTextFaceA( hdc, 0, NULL ); | 
|---|
| 785 | int   rc; | 
|---|
| 786 |  | 
|---|
| 787 | dprintf(("GDI32: GetTextFaceW")); | 
|---|
| 788 | astring = ( char * )malloc( lenA ); | 
|---|
| 789 | if( astring ) | 
|---|
| 790 | return 0; | 
|---|
| 791 |  | 
|---|
| 792 | rc = GetTextFaceA(hdc, lenA, astring); | 
|---|
| 793 |  | 
|---|
| 794 | if( rc ) | 
|---|
| 795 | { | 
|---|
| 796 | if( arg3 ) | 
|---|
| 797 | { | 
|---|
| 798 | AsciiToUnicodeN(astring, arg3, arg2); | 
|---|
| 799 | rc = lstrlenW( arg3 ); | 
|---|
| 800 | } | 
|---|
| 801 | else | 
|---|
| 802 | rc = lstrlenAtoW( astring, -1 ); | 
|---|
| 803 |  | 
|---|
| 804 | rc++; // including null-terminator | 
|---|
| 805 | } | 
|---|
| 806 |  | 
|---|
| 807 | free(astring); | 
|---|
| 808 |  | 
|---|
| 809 | return rc; | 
|---|
| 810 | } | 
|---|
| 811 | //****************************************************************************** | 
|---|
| 812 | //****************************************************************************** | 
|---|
| 813 | UINT WIN32API GetOutlineTextMetricsA( HDC hdc, UINT arg2, LPOUTLINETEXTMETRICA  arg3) | 
|---|
| 814 | { | 
|---|
| 815 | dprintf(("GDI32: GetOutlineTextMetricsA %x %x %x", hdc, arg2, arg3)); | 
|---|
| 816 | return O32_GetOutlineTextMetrics(hdc, arg2, arg3); | 
|---|
| 817 | } | 
|---|
| 818 | //****************************************************************************** | 
|---|
| 819 | //****************************************************************************** | 
|---|
| 820 | UINT WIN32API GetOutlineTextMetricsW( HDC hdc, UINT arg2, LPOUTLINETEXTMETRICW  arg3) | 
|---|
| 821 | { | 
|---|
| 822 | dprintf(("!ERROR!: GDI32: GetOutlineTextMetricsW STUB")); | 
|---|
| 823 | // NOTE: This will not work as is (needs UNICODE support) | 
|---|
| 824 | //    return O32_GetOutlineTextMetrics(hdc, arg2, arg3); | 
|---|
| 825 | return 0; | 
|---|
| 826 | } | 
|---|
| 827 | //****************************************************************************** | 
|---|
| 828 | //****************************************************************************** | 
|---|