Changeset 10400 for trunk/src/gdi32/ft2supp.cpp
- Timestamp:
- Jan 15, 2004, 12:18:58 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/ft2supp.cpp
r10391 r10400 41 41 void WIN32API SetFreeTypeIntegration(BOOL fEnabled) 42 42 { 43 fFT2LIBIntegration = fEnabled; 43 fFT2LIBIntegration = fEnabled; 44 44 45 45 FT2Module.init(); … … 48 48 // Constructor 49 49 //****************************************************************************** 50 CFT2Module::CFT2Module(char* sModuleName): bEnabled(FALSE), hftModule(0), pfnGetGlyphIndices(NULL), 50 CFT2Module::CFT2Module(char* sModuleName): bEnabled(FALSE), hftModule(0), pfnGetGlyphIndices(NULL), 51 51 pfnFt2GetTextExtentW(NULL), pfnFt2EnableFontEngine(NULL), 52 pfnFt2GetGlyphOutline(NULL), pfnFt2CharStringPosAtA(NULL), 52 pfnFt2GetGlyphOutline(NULL), pfnFt2CharStringPosAtA(NULL), 53 53 pfnFt2CharStringPosAtW(NULL), pfnFt2GetFontData(NULL), 54 54 pfnFt2RegisterUconv(NULL), pfnFt2QueryStringWidthW(NULL), … … 71 71 72 72 rc = DosLoadModule((PSZ)Loaderror, sizeof(Loaderror), pszModuleName, &hftModule); 73 if (rc != 0) 73 if (rc != 0) 74 74 dprintf(("Freetype2 library load error: return code = %u\n", rc)); 75 75 else 76 bEnabled = TRUE; 76 bEnabled = TRUE; 77 77 78 78 if(bEnabled) { … … 111 111 112 112 // Do not register functions for Mozilla plugins 113 if(IsDummyExeLoaded() == FALSE) 113 if(IsDummyExeLoaded() == FALSE) 114 114 { 115 115 pfnFt2RegisterUconv = (PFN_FT2REGISTERUCONV)QueryProcAddress("Ft2RegisterUconv"); 116 if(pfnFt2RegisterUconv) 116 if(pfnFt2RegisterUconv) 117 117 pfnFt2RegisterUconv(WideCharToMultiByte, MultiByteToWideChar); 118 118 else dprintf(("Ft2QueryFontType not found!!")); … … 123 123 124 124 failure: 125 if(pfnFt2RegisterUconv) 125 if(pfnFt2RegisterUconv) 126 126 pfnFt2RegisterUconv(NULL, NULL); 127 127 if(pfnFt2EnableFontEngine) … … 131 131 pfnFt2GetTextExtentW = NULL; 132 132 pfnFt2EnableFontEngine = NULL; 133 pfnFt2GetGlyphOutline = NULL; 134 pfnFt2CharStringPosAtA = NULL; 135 pfnFt2CharStringPosAtW = NULL; 133 pfnFt2GetGlyphOutline = NULL; 134 pfnFt2CharStringPosAtA = NULL; 135 pfnFt2CharStringPosAtW = NULL; 136 136 pfnFt2GetFontData = NULL; 137 pfnFt2RegisterUconv = NULL; 137 pfnFt2RegisterUconv = NULL; 138 138 pfnFt2QueryStringWidthW= NULL; 139 139 pfnFt2GetVersion = NULL; … … 162 162 PFN ModuleAddr; 163 163 164 rc = DosQueryProcAddr(hftModule, ordinal, NULL, &ModuleAddr); 164 rc = DosQueryProcAddr(hftModule, ordinal, NULL, &ModuleAddr); 165 165 if (rc != 0) { 166 166 dprintf(("FreeType2 QueryProcAddr error: return code = %u\n", rc)); … … 176 176 PFN ModuleAddr; 177 177 178 rc = DosQueryProcAddr(hftModule, 0, procname, &ModuleAddr); 178 rc = DosQueryProcAddr(hftModule, 0, procname, &ModuleAddr); 179 179 if (rc != 0) { 180 180 dprintf(("FreeType2 QueryProcAddr error: return code = %u\n", rc)); … … 203 203 // This is basically the same as Ft2QueryTextBoxW, but it behaves as the Win32 204 204 // API GetTextExtent (which ignores character attributes and underhang/overhang) 205 // 205 // 206 206 // The fallback case is not accurate!! (but the same as our old code) 207 207 // … … 242 242 243 243 ret = OSLibGpiQueryCharStringPosAt( pHps, &start, 0, lenA, strA, NULL, pplos2 ); 244 245 cx = labs( pplos2[ lenA ].x - pplos2[ 0 ].x );246 cy = labs( pplos2[ lenA ].y - pplos2[ 0 ].y );247 248 244 if( ret ) 249 245 { 246 TEXTMETRICW tmW; 247 248 cx = labs( pplos2[ lenA ].x - pplos2[ 0 ].x ); 249 cy = labs( pplos2[ lenA ].y - pplos2[ 0 ].y ); 250 250 251 aptlPoints[ TXTBOX_BOTTOMLEFT ].x = 0; 251 252 aptlPoints[ TXTBOX_BOTTOMLEFT ].y = 0; … … 258 259 aptlPoints[ TXTBOX_CONCAT ].x = cx; 259 260 aptlPoints[ TXTBOX_CONCAT ].y = cy; 260 } 261 262 calcDimensions(aptlPoints, pwidthHeight); 263 264 TEXTMETRICW tmW; 265 if(GetTextMetricsW( hps, &tmW ) == TRUE) 266 { 267 pwidthHeight->y = tmW.tmHeight; // *Must* use the maximum height of the font 268 } 261 262 calcDimensions(aptlPoints, pwidthHeight); 263 264 if(GetTextMetricsW( hps, &tmW ) == TRUE) 265 { 266 pwidthHeight->y = tmW.tmHeight; // *Must* use the maximum height of the font 267 } 269 268 #ifdef DEBUG 270 else DebugInt3();269 else DebugInt3(); 271 270 #endif 271 } 272 272 273 273 free( pplos2 ); … … 280 280 BOOL CFT2Module::Ft2CharStringPosAtA(HPS hps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCSTR pchString,CONST INT *alAdx, DWORD fuWin32Options) 281 281 { 282 DWORD ret; 282 DWORD ret; 283 283 USHORT sel; 284 284 285 // All FreeType calls should be wrapped for saving FS 285 // All FreeType calls should be wrapped for saving FS 286 286 if(pfnFt2CharStringPosAtA) { 287 287 sel = RestoreOS2FS(); … … 289 289 SetFS(sel); 290 290 if(ret || (ret == FALSE && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED)) 291 return ret; 291 return ret; 292 292 } 293 293 //else fall back to GPI … … 300 300 BOOL CFT2Module::Ft2CharStringPosAtW(HPS hps, PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCWSTR pchString,CONST INT *alAdx, DWORD fuWin32Options) 301 301 { 302 DWORD ret; 302 DWORD ret; 303 303 USHORT sel; 304 304 305 // All FreeType calls should be wrapped for saving FS 305 // All FreeType calls should be wrapped for saving FS 306 306 if(pfnFt2CharStringPosAtW) { 307 307 sel = RestoreOS2FS(); … … 309 309 SetFS(sel); 310 310 if(ret || (ret == FALSE && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED)) 311 return ret; 311 return ret; 312 312 } 313 313 //else fall back to GPI … … 336 336 } 337 337 //****************************************************************************** 338 // Query the font type current selected into the presentation space, or, 338 // Query the font type current selected into the presentation space, or, 339 339 // when hps == NULL, query the type of the font with the specified name 340 340 //****************************************************************************** 341 341 DWORD CFT2Module::Ft2QueryFontType(HPS hps, LPCSTR lpszFontName) 342 342 { 343 DWORD ret; 343 DWORD ret; 344 344 USHORT sel; 345 345 346 // All FreeType calls should be wrapped for saving FS 346 // All FreeType calls should be wrapped for saving FS 347 347 if(pfnFt2QueryFontType) { 348 348 sel = RestoreOS2FS(); … … 350 350 SetFS(sel); 351 351 if(ret || (ret == GDI_ERROR && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED)) 352 return ret; 352 return ret; 353 353 } 354 354 //no fallback … … 359 359 BOOL CFT2Module::Ft2GetStringWidthW(HDC hdc, LPWSTR lpszString, UINT cbString, PINT pWidthArray) 360 360 { 361 DWORD ret; 361 DWORD ret; 362 362 USHORT sel; 363 363 pDCData pHps; … … 370 370 } 371 371 372 // All FreeType calls should be wrapped for saving FS 372 // All FreeType calls should be wrapped for saving FS 373 373 if(pfnFt2QueryStringWidthW) { 374 374 sel = RestoreOS2FS(); … … 382 382 383 383 if(OSLibDevQueryCaps(pHps, OSLIB_CAPS_HORIZONTAL_RESOLUTION, 2, &alArray[0]) && 384 alArray[0] != alArray[1]) 384 alArray[0] != alArray[1]) 385 385 { 386 386 dprintf(("Different hor/vert resolutions (%d,%d)", alArray[0], alArray[1])); … … 391 391 } 392 392 } 393 return ret; 393 return ret; 394 394 } 395 395 } … … 438 438 DWORD dwFlags) 439 439 { 440 DWORD ret; 440 DWORD ret; 441 441 USHORT sel; 442 442 SIZE size; … … 454 454 455 455 dprintf(("lStructSize=%ld, lpOutString=%p, lpOrder=%p, lpDx=%p, lpCaretPos=%p, lpClass=%p, lpGlyphs=%p, nGlyphs=%u, nMaxFit=%d\n", 456 457 458 456 lpResults->lStructSize, lpResults->lpOutString, lpResults->lpOrder, 457 lpResults->lpDx, lpResults->lpCaretPos, lpResults->lpClass, 458 lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit)); 459 459 460 460 if(dwFlags&(~0)) dprintf(("unsupported flags 0x%08lx\n", dwFlags)); 461 if(lpResults->lpCaretPos) 462 if(lpResults->lpClass) 461 if(lpResults->lpCaretPos) dprintf(("caret positions not implemented\n")); 462 if(lpResults->lpClass) dprintf(("classes not implemented\n")); 463 463 464 464 nSet = (UINT)uCount; 465 465 if(nSet > lpResults->nGlyphs) 466 466 nSet = lpResults->nGlyphs; 467 467 468 468 /* return number of initialized fields */ … … 488 488 489 489 if(lpResults->lpGlyphs) 490 490 GetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0); 491 491 492 492 if (GetTextExtentPoint32W(hdc, lpString, uCount, &size))
Note:
See TracChangeset
for help on using the changeset viewer.