Ignore:
Timestamp:
Jan 11, 2004, 12:43:22 PM (22 years ago)
Author:
sandervl
Message:

Update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/oslibgpi.cpp

    r10372 r10374  
    1 /* $Id: oslibgpi.cpp,v 1.16 2004-01-08 11:11:55 sandervl Exp $ */
     1/* $Id: oslibgpi.cpp,v 1.17 2004-01-11 11:42:19 sandervl Exp $ */
    22
    33/*
     
    1111
    1212#define  INCL_GPI
     13#define  INCL_GPIERRORS
    1314#define  INCL_WIN
    1415#include <os2wrap.h>    //Odin32 OS/2 api wrappers
     
    256257  ULONG    cx;
    257258  ULONG    cy;
    258 
     259 
    259260  //ignore underhang (just like GetTextExtentPoint does in Windows)
    260261  if (box[TXTBOX_BOTTOMLEFT].x < 0) {
     
    320321}
    321322
    322 LONG OSLibGpiLine(PVOID pHps,PPOINTLOS2 pptlEndPoint)
    323 {
    324   return GpiLine(GetDCData(pHps)->hps,(PPOINTL)pptlEndPoint);
     323BOOL 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);
    325330}
    326331
     
    388393
    389394  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  }
    391409
    392410  GpiSetAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_COLOR,defaults,&lbOld);
     
    448466BOOL OSLibGpiLoadFonts(LPSTR lpszFontFile)
    449467{
    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//******************************************************************************
     481BOOL OSLibGpiUnloadFonts(LPSTR lpszFontFile)
     482{
     483   return GpiUnloadFonts(0, lpszFontFile);
     484}
     485//******************************************************************************
     486//******************************************************************************
     487BOOL 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//******************************************************************************
     521BOOL 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.