Changeset 10374 for trunk/src/gdi32/oslibgpi.cpp
- Timestamp:
- Jan 11, 2004, 12:43:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/oslibgpi.cpp
r10372 r10374 1 /* $Id: oslibgpi.cpp,v 1.1 6 2004-01-08 11:11:55sandervl Exp $ */1 /* $Id: oslibgpi.cpp,v 1.17 2004-01-11 11:42:19 sandervl Exp $ */ 2 2 3 3 /* … … 11 11 12 12 #define INCL_GPI 13 #define INCL_GPIERRORS 13 14 #define INCL_WIN 14 15 #include <os2wrap.h> //Odin32 OS/2 api wrappers … … 256 257 ULONG cx; 257 258 ULONG cy; 258 259 259 260 //ignore underhang (just like GetTextExtentPoint does in Windows) 260 261 if (box[TXTBOX_BOTTOMLEFT].x < 0) { … … 320 321 } 321 322 322 LONG OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint) 323 { 324 return GpiLine(GetDCData(pHps)->hps,(PPOINTL)pptlEndPoint); 323 BOOL OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint) 324 { 325 LONG ret = GpiLine(GetDCData(pHps)->hps,(PPOINTL)pptlEndPoint); 326 if(ret != GPI_OK) { 327 dprintf(("GpiLine failed with error %x", WinGetLastError(0))); 328 } 329 return (ret == GPI_OK); 325 330 } 326 331 … … 388 393 389 394 lbNew.lColor = color; 390 BOOL rc = GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,0,&lbNew) && GpiSetPel(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR; 395 BOOL rc = GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,0,&lbNew); 396 if(rc == FALSE) { 397 dprintf(("GpiSetAttrs/GpiSetPel failed with %x", WinGetLastError(0))); 398 } 399 else { 400 rc = GpiSetPel(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR; 401 if(rc == FALSE && LOWORD(WinGetLastError(0)) == PMERR_INV_IN_PATH) { 402 dprintf(("WARNING: GpiSetPel invalid in path; retrying with GpiLine")); 403 rc = GpiLine(GetDCData(pHps)->hps,(PPOINTL)pt) != GPI_ERROR; 404 } 405 } 406 if(rc == FALSE) { 407 dprintf(("GpiSetPel/GpiLine failed with %x", WinGetLastError(0))); 408 } 391 409 392 410 GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,defaults,&lbOld); … … 448 466 BOOL OSLibGpiLoadFonts(LPSTR lpszFontFile) 449 467 { 450 return GpiLoadFonts(0, lpszFontFile); 451 } 452 //****************************************************************************** 453 //****************************************************************************** 468 BOOL ret; 469 470 //We must use GpiLoadPublicFonts here. GpiLoadFonts cannot be used for 471 //queued printer device contexts 472 //-> NOTE: this is no longer the case as we spool printer specific data now (not metafiles) 473 ret = GpiLoadFonts(0, lpszFontFile); 474 if(ret == FALSE) { 475 dprintf(("GpiLoadPublicFonts %s failed with %x", lpszFontFile, WinGetLastError(0))); 476 } 477 return ret; 478 } 479 //****************************************************************************** 480 //****************************************************************************** 481 BOOL OSLibGpiUnloadFonts(LPSTR lpszFontFile) 482 { 483 return GpiUnloadFonts(0, lpszFontFile); 484 } 485 //****************************************************************************** 486 //****************************************************************************** 487 BOOL OSLibGpiQueryFontName(LPSTR lpszFileName, LPSTR lpszFamily, LPSTR lpszFace, int cbString) 488 { 489 LONG cFonts = 0, cRemFonts; 490 PFFDESCS pffd = NULL; 491 ULONG cb; 492 493 cRemFonts = GpiQueryFontFileDescriptions(0, lpszFileName, &cFonts, NULL); 494 if(cRemFonts == GPI_ALTERROR) { 495 DebugInt3(); 496 return FALSE; 497 } 498 499 cFonts = max(cFonts, cRemFonts); 500 cb = cFonts * sizeof(FFDESCS) + 100; // must allocate extra 501 pffd = (PFFDESCS)malloc(cb); 502 if(pffd == NULL) { 503 DebugInt3(); 504 return FALSE; 505 } 506 507 memset(pffd, 0, cb); 508 509 //assuming one font for now 510 cFonts = 1; 511 if(GpiQueryFontFileDescriptions(0, lpszFileName, &cFonts, pffd) == 0) 512 { 513 strncpy(lpszFamily, (char *)pffd, cbString); 514 strncpy(lpszFace, (char *)pffd + FACESIZE, cbString); 515 } 516 free(pffd); 517 return TRUE; 518 } 519 //****************************************************************************** 520 //****************************************************************************** 521 BOOL ReallySetCharAttrs(PVOID lpHps) 522 { 523 BOOL bRet = FALSE; 524 pDCData pHps = (pDCData)lpHps; 525 526 if(pHps) 527 { 528 if(!pHps->bAttrSet) 529 { 530 if (!pHps->bFirstSet) { 531 pHps->bFirstSet = TRUE; 532 } 533 if (pHps->ulCharMask) { 534 bRet = GpiSetAttrs(pHps->hps, PRIM_CHAR, pHps->ulCharMask, 0, &pHps->CBundle); 535 } else { 536 bRet = TRUE; 537 } 538 if(bRet == TRUE) { 539 pHps->CSetBundle = pHps->CBundle; 540 pHps->ulCharMask = 0; 541 pHps->bAttrSet = TRUE; 542 } 543 } 544 } 545 return(bRet); 546 } 547 //****************************************************************************** 548 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.