Changeset 21304 for trunk/src


Ignore:
Timestamp:
Jun 18, 2009, 12:12:33 PM (16 years ago)
Author:
ydario
Message:

Gdi32 updates.

Location:
trunk/src/gdi32
Files:
12 edited

Legend:

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

    r10469 r21304  
    5656static BOOL GetPMQueueName(LPSTR pDeviceName, LPSTR lpszPMQueue, INT cbPMQueue)
    5757{
     58    static HINSTANCE                hInstance = 0;
     59    static PFN_SPLQUERYPMQUEUENAME  pfnSplQueryPMQueueName = NULL;
     60
     61    if(hInstance == 0) hInstance = LoadLibraryA("WINSPOOL.DRV");
     62
     63    if(hInstance) {
     64        pfnSplQueryPMQueueName = (PFN_SPLQUERYPMQUEUENAME)GetProcAddress(hInstance, "SplQueryPMQueueName");
     65        if(pfnSplQueryPMQueueName) {
     66            return pfnSplQueryPMQueueName(pDeviceName, lpszPMQueue, cbPMQueue);
     67        }
     68    }
     69    DebugInt3();
    5870    return FALSE;
    5971}
  • trunk/src/gdi32/dibitmap.cpp

    r10579 r21304  
    183183    pDCData pHps;
    184184
     185    dprintf(("GDI32: CreateCompatibleBitmap. HDC = %08x, w:%d, h:%d",hdc, nWidth, nHeight));
     186
    185187    pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
    186188    if(!pHps)
  • trunk/src/gdi32/fontres.cpp

    r10373 r21304  
    2626#include <dbglog.h>
    2727#include <unicode.h>
    28 #include <stats.h>
     28#include <heapstring.h>
     29#include <neexe.h>
    2930#include <objhandle.h>
     31#include <font.h>
     32#include <vmutex.h>
     33#include "ft2supp.h"
     34
    3035#include "oslibgpi.h"
    3136
     
    4853
    4954static SCALABLEFONTS    *publicfonts = NULL;
    50 static CRITICAL_SECTION  fntcritsect = {0};
    51 
    52 #define FntLock()       EnterCriticalSection(&fntcritsect)
    53 #define FntUnlock()     LeaveCriticalSection(&fntcritsect)
     55static VMutex fntmutex;
     56
     57#define FntLock()       fntmutex.enter()
     58#define FntUnlock()     fntmutex.leave()
    5459
    5560
     
    8590//******************************************************************************
    8691//******************************************************************************
     92static LPVOID ReadEntireFile(LPSTR lpszFileName, DWORD *lpdwSize = NULL)
     93{
     94    HFILE hFile = INVALID_HANDLE_VALUE;
     95
     96    DWORD dwSize, dwBytesRead, ret;
     97    LPVOID lpFileData = NULL;
     98
     99    hFile = CreateFileA(lpszFileName,
     100                        GENERIC_READ,     
     101                        FILE_SHARE_READ | FILE_SHARE_WRITE,
     102                        NULL,                             
     103                        OPEN_EXISTING,
     104                        0,
     105                        NULL);                             
     106
     107    if(hFile == INVALID_HANDLE_VALUE) {
     108        DebugInt3();
     109        goto failure;
     110    } 
     111    //determine filesize
     112    dwSize = SetFilePointer(hFile, 0, NULL, FILE_END);
     113    SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
     114
     115    //allocate memory to hold the entire file
     116    lpFileData = (char *)malloc(dwSize);
     117    if(lpFileData == NULL) {
     118        DebugInt3();
     119        goto failure;
     120    }
     121    //and read it
     122    ret = ReadFile(hFile, lpFileData, dwSize, &dwBytesRead, NULL);
     123    if(ret == FALSE || dwBytesRead != dwSize) {
     124        DebugInt3();
     125        goto failure;
     126    }
     127    if(lpdwSize) *lpdwSize = dwSize;
     128
     129    CloseHandle(hFile);
     130    return lpFileData;
     131
     132failure:
     133    if(hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);
     134    if(lpFileData) free(lpFileData);
     135    return NULL;
     136}
     137//******************************************************************************
     138//******************************************************************************
    87139DWORD WIN32API GetFontData(HDC hdc, DWORD dwTable,
    88140                           DWORD dwOffset,
    89141                           LPVOID lpvBuffer,
    90                            DWORD dbData)
    91 {
    92   dprintf(("GDI32: GetFontData, not implemented (GDI_ERROR)\n"));
    93   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     142                           DWORD cbData)
     143{
     144    HFONT hFont;
     145    SCALABLEFONTS *font;
     146
     147    dprintf(("GDI32: GetFontData, partially implemented"));
     148
     149    hFont = GetCurrentObject(hdc, OBJ_FONT);
     150    if(hFont == 0) {
     151        SetLastError(ERROR_INVALID_PARAMETER);
     152        return GDI_ERROR;
     153    }
     154    font = (SCALABLEFONTS *)ObjQueryHandleGDI32Data(hFont, HNDL_FONT);
     155    if(font == NULL) {
     156        return FT2Module.Ft2GetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
     157    }
     158
     159    if(font->pFontData == NULL)
     160    {
     161        font->pFontData = (char *)ReadEntireFile(font->szFileName, &font->dwFontSize);
     162        if(!font->pFontData) return GDI_ERROR;
     163    }
     164
     165    cbData = min(cbData, font->dwFontSize);
     166    if(dwTable == 0 && dwOffset == 0) {
     167        if(lpvBuffer == NULL) return font->dwFontSize;
     168
     169        memcpy(lpvBuffer, font->pFontData, cbData);
     170        return cbData;
     171    }
     172
     173    //todo: parse TTF structure (haven't seen anybody rely on that yet)
    94174
    95175  return(GDI_ERROR);
    96176}
    97177//******************************************************************************
     178//TODO: supposed to support more than only .fon files
    98179//******************************************************************************
    99180int WIN32API AddFontResourceA(LPCSTR szFont)
    100181{
    101     HINSTANCE hInstance;
     182    DWORD   ret, alignment, nrFonts, fontOrdinal, i;
     183    PIMAGE_DOS_HEADER pDosHdr = NULL;
     184    PIMAGE_OS2_HEADER pNEHdr;
     185    struct resource_typeinfo_s *pResInfo;
     186    struct resource_nameinfo_s *pNameInfo;
     187    LPFONTDIR16 pFontDir = NULL;
     188    char  *pFontNameId;
     189    char  *pResNameTable;
     190    char  *pFontPath, *newname = NULL, *extension;
     191    char   szFamily[32], szFace[32];
    102192
    103193    dprintf(("GDI32: AddFontResourceA %s", szFont));
    104     hInstance = LoadLibraryA(szFont);
    105     if(hInstance) {
    106         dprintf(("AddFontResourceA: executable file; NOT IMPLEMENTED"));
    107         FreeLibrary(hInstance);
    108         return 1;
    109     }
     194
     195    if(GetFileAttributesA(szFont) == -1) {
     196        dprintf(("WARNING: Font res file doesn't exists"));
     197        SetLastError(ERROR_INVALID_PARAMETER);
     198        return FALSE;
     199    }
     200
     201    //Support for raw .ttf files as well
     202    newname = strupr(strdup(szFont));
     203    extension = strrchr(newname, '.');
     204    if (!strcmp(extension, ".TTF"))
     205    {   
     206            //get font family and face names
     207            OSLibGpiQueryFontName(newname, szFamily, szFace, sizeof(szFamily));
     208    }
     209    else
     210    {
     211            pDosHdr = (PIMAGE_DOS_HEADER)ReadEntireFile((LPSTR)szFont);
     212            if(!pDosHdr) return FALSE;
     213   
     214            pNEHdr  = (PIMAGE_OS2_HEADER) ((char *)pDosHdr + pDosHdr->e_lfanew);
     215            if(pDosHdr->e_magic != IMAGE_DOS_SIGNATURE ||
     216               pNEHdr->ne_magic != IMAGE_OS2_SIGNATURE) {
     217                dprintf(("Unknown file format"));
     218                goto failure;
     219    }
     220
     221            pResInfo = (struct resource_typeinfo_s *)((char *)pNEHdr + pNEHdr->ne_rsrctab);
     222            alignment = *(WORD *)pResInfo;
     223            pResInfo = (struct resource_typeinfo_s *)((char *)pResInfo+sizeof(WORD));
     224
     225            //first resource is a font directory
     226            if(pResInfo->type_id != NE_RSCTYPE_FONTDIR && pResInfo->count != 1) {
     227                dprintf(("Unknown file format"));
     228                goto failure;
     229            }
     230            pNameInfo = (struct resource_nameinfo_s *)(pResInfo+1);
     231            pFontDir    = (LPFONTDIR16)((char *)pDosHdr + (pNameInfo->offset << alignment));
     232            //first word = length followed by the string (not terminated)
     233            pFontNameId = (char *)pResInfo - sizeof(WORD) + pNameInfo->id;
     234       
     235            nrFonts     = *(WORD *)pFontDir;
     236            fontOrdinal = *((WORD *)pFontDir+1);
     237            pFontDir    = (LPFONTDIR16)((char *)pFontDir + 2*sizeof(WORD));
     238
     239            pResNameTable = (char *)pNEHdr + pNEHdr->ne_restab;
     240
     241            //second resource is the absolute path of the TTF file
     242            pResInfo  = (struct resource_typeinfo_s *)(pNameInfo+1);
     243            if(pResInfo->type_id != 0x80CC && pResInfo->count != 1) {
     244                dprintf(("Unknown file format"));
     245                goto failure;
     246            }
     247            pNameInfo = (struct resource_nameinfo_s *)(pResInfo+1);
     248            pFontPath = ((char *)pDosHdr + (pNameInfo->offset << alignment));
     249
     250            free(newname);
     251   
     252            //GPI makes assumptions about the file based on the extention (d'oh)
     253            newname = strdup(pFontPath);
     254            extension = strrchr(newname, '.');
     255   
     256            strcpy(extension, ".TTF");
     257            CopyFileA(pFontPath, newname, FALSE);
     258    }
     259               
     260    //Load the TrueType font
     261    ret = OSLibGpiLoadFonts(newname);
     262    if(ret == FALSE) {
     263        dprintf(("OSLibGpiLoadFonts %s failed!!", pFontPath));
     264        goto failure;
     265    }
     266
     267    //add to the list of known public fonts that we added before
     268    if(publicfonts == NULL) {
     269        publicfonts = (SCALABLEFONTS*)malloc(MAX_PUBLICFONTS*sizeof(SCALABLEFONTS));
     270        if(publicfonts == NULL) {
     271            DebugInt3();
     272            goto failure;
     273        }
     274        memset(publicfonts, 0, MAX_PUBLICFONTS*sizeof(SCALABLEFONTS));
     275    }
     276    FntLock();
     277    for(i=0;i<MAX_PUBLICFONTS;i++) {
     278        if(publicfonts[i].szFaceName[0] == 0) {
     279            break;
     280        }
     281    }
     282    if(i == MAX_PUBLICFONTS) {
     283        FntUnlock();
     284        DebugInt3();
     285        goto failure;
     286    }
     287    strncpy(publicfonts[i].szFileName, newname, sizeof(publicfonts[i].szFileName));
     288    if (pFontDir)
     289      strncpy(publicfonts[i].szFaceName, pFontDir->szDeviceName, sizeof(publicfonts[i].szFaceName));
     290    else
     291      strncpy(publicfonts[i].szFaceName, szFace, sizeof(publicfonts[i].szFaceName));
     292    strncpy(publicfonts[i].szFontResName, szFont, sizeof(publicfonts[i].szFontResName));
     293    publicfonts[i].pFontData = NULL;
     294    FntUnlock();
     295
     296    free(newname);
     297    free(pDosHdr);
    110298    return 1;
     299
     300failure:
     301    if(pDosHdr) free(pDosHdr);
     302    if(newname) free(newname);
     303    return 0;
    111304}
    112305//******************************************************************************
     
    115308{
    116309 char *astring = UnicodeToAsciiString((LPWSTR)szFont);
    117  BOOL  rc;
     310    int  ret;
    118311
    119312    dprintf(("GDI32: AddFontResourceW"));
    120     // NOTE: This will not work as is (needs UNICODE support)
    121     rc = AddFontResourceA(astring);
     313    ret = AddFontResourceA(astring);
    122314    FreeAsciiString(astring);
    123     return rc;
     315    return ret;
    124316}
    125317//******************************************************************************
     
    127319BOOL WIN32API RemoveFontResourceA(LPCSTR lpszFont)
    128320{
     321    BOOL ret;
     322
    129323    dprintf(("GDI32: RemoveFontResourceA %s", lpszFont));
     324   
     325    if(!publicfonts) {
     326        dprintf(("WARNING: font not found in our list!!"));
    130327    return FALSE;
     328    }
     329    FntLock();
     330    for(int i=0;i<MAX_PUBLICFONTS;i++) {
     331        if(strcmp(publicfonts[i].szFontResName, lpszFont) == 0) 
     332        {
     333            ret = OSLibGpiUnloadFonts(publicfonts[i].szFileName);
     334            DeleteFileA(publicfonts[i].szFileName);
     335
     336            if(publicfonts[i].pFontData) free(publicfonts[i].pFontData);
     337            publicfonts[i].pFontData     = 0;
     338            publicfonts[i].szFileName[0] = 0;
     339            publicfonts[i].szFaceName[0] = 0;
     340            break;
     341        }
     342    }
     343    FntUnlock();
     344    if(i == MAX_PUBLICFONTS) {
     345        dprintf(("WARNING: font not found in our list!!"));
     346// no need to trap on a warning        DebugInt3();
     347        return FALSE;
     348    }
     349    return ret;
    131350}
    132351//******************************************************************************
     
    135354{
    136355 char *astring = UnicodeToAsciiString((LPWSTR)szFont);
    137  BOOL  rc;
     356    BOOL  ret;
    138357
    139358    dprintf(("GDI32: RemoveFontResourceW"));
    140     rc = RemoveFontResourceA(astring);
     359    ret = RemoveFontResourceA(astring);
    141360    FreeAsciiString(astring);
    142     return(rc);
     361    return ret;
    143362}
    144363/*****************************************************************************
     
    163382                                          LPCSTR lpszCurrentPath)
    164383{
    165   dprintf(("GDI32: CreateScalableFontResourceA %x %s %s %s not implemented", fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath));
    166 
    167 //  return OSLibGpiLoadFonts((LPSTR)lpszFontFile);
     384    HRSRC   hRsrc;
     385    HINSTANCE hGdi32;
     386    HGLOBAL handle;
     387    DWORD   dwSize;
     388    LPVOID  lpData, lpCopy = NULL;
     389    HANDLE  hFile = 0;
     390    DWORD   ret, dwBytesWritten, alignment, nrFonts, fontOrdinal, len;
     391    PIMAGE_DOS_HEADER pDosHdr;
     392    PIMAGE_OS2_HEADER pNEHdr;
     393    struct resource_typeinfo_s *pResInfo;
     394    struct resource_nameinfo_s *pNameInfo;
     395    LPFONTDIR16 pFontDir;
     396    char  *pFontNameId;
     397    char  *pResNameTable;
     398    char  *pFontPath, *newname, *extension;
     399    char   szFamily[32], szFace[32];
     400
     401    dprintf(("GDI32: CreateScalableFontResourceA %x %s %s %s partly implemented", fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath));
     402
     403    if(lpszCurrentPath != NULL) {
     404        //figure out which possibilities exist
     405        DebugInt3();
     406        return FALSE;
     407    }
     408
     409    //This function is supposed to create a font resource file (.fot; NE dll with
     410    //references to the TTF file (absolute path))
     411
     412    if(GetFileAttributesA(lpszFontRes) != -1) {
     413        dprintf(("WARNING: Font res file already exists"));
     414        SetLastError(ERROR_INVALID_PARAMETER);
     415        return FALSE;
     416    }
     417
     418    //fetch our font resource file example
     419    hGdi32 = GetModuleHandleA("GDI32");
     420    hRsrc = FindResourceA( hGdi32, TESTFONT_RESNAME, RT_RCDATAA );
     421    if(!hRsrc) {
     422        dprintf(("WARNING: Test font file resource not found!!"));
     423        DebugInt3();
     424        return FALSE;
     425    }
     426    handle = LoadResource(hGdi32, hRsrc);
     427    dwSize = SizeofResource(hGdi32, hRsrc);
     428    lpData = LockResource(handle);
     429    if(!dwSize || !handle || !lpData) {
     430        dprintf(("WARNING: Test font file resource not loaded/locked!!"));
     431        DebugInt3();
     432        return FALSE;
     433    }
     434    lpCopy = malloc(dwSize);
     435    if(lpCopy == NULL) {
     436        DebugInt3();
     437        return FALSE;
     438    }
     439    memcpy(lpCopy, lpData, dwSize);
     440
     441    pDosHdr = (PIMAGE_DOS_HEADER)lpCopy;
     442    pNEHdr  = (PIMAGE_OS2_HEADER) ((char *)pDosHdr + pDosHdr->e_lfanew);
     443    if(pDosHdr->e_magic != IMAGE_DOS_SIGNATURE ||
     444       pNEHdr->ne_magic != IMAGE_OS2_SIGNATURE) {
     445        dprintf(("Unknown file format"));
     446        goto failure;
     447    }
     448
     449    pResInfo = (struct resource_typeinfo_s *)((char *)pNEHdr + pNEHdr->ne_rsrctab);
     450    alignment = *(WORD *)pResInfo;
     451    pResInfo = (struct resource_typeinfo_s *)((char *)pResInfo+sizeof(WORD));
     452
     453    //first resource is a font directory
     454    if(pResInfo->type_id != NE_RSCTYPE_FONTDIR && pResInfo->count != 1) {
     455        dprintf(("Unknown file format"));
     456        goto failure;
     457    }
     458    pNameInfo = (struct resource_nameinfo_s *)(pResInfo+1);
     459    pFontDir    = (LPFONTDIR16)((char *)pDosHdr + (pNameInfo->offset << alignment));
     460    //first word = length followed by the string (not terminated)
     461    pFontNameId = (char *)pResInfo - sizeof(WORD) + pNameInfo->id;
     462
     463    //GPI makes assumptions about the file based on the extention (d'oh)
     464    newname = strdup(lpszFontFile);
     465    extension = strrchr(newname, '.');
     466   
     467    strcpy(extension, ".TTF");
     468    CopyFileA(lpszFontFile, newname, FALSE);
     469
     470    //get font family and face names
     471    OSLibGpiQueryFontName(newname, szFamily, szFace, sizeof(szFamily));
     472
     473    DeleteFileA(newname);
     474    free(newname);
     475
     476    nrFonts     = *(WORD *)pFontDir;
     477    fontOrdinal = *((WORD *)pFontDir+1);
     478    pFontDir    = (LPFONTDIR16)((char *)pFontDir + 2*sizeof(WORD));
     479
     480    //copy family and face names to fontdir structure
     481    len = strlen(szFamily);
     482    strcpy(pFontDir->szDeviceName, szFamily);
     483    strcpy(pFontDir->szDeviceName + len + 1, szFace);
     484
     485    dprintf(("Family %s, Face %s", szFamily, szFace));
     486
     487    pResNameTable = (char *)pNEHdr + pNEHdr->ne_restab;
     488
     489    //second resource is the absolute path of the TTF file
     490    pResInfo  = (struct resource_typeinfo_s *)(pNameInfo+1);
     491    if(pResInfo->type_id != 0x80CC && pResInfo->count != 1) {
     492        dprintf(("Unknown file format"));
     493        goto failure;
     494    }
     495    pNameInfo = (struct resource_nameinfo_s *)(pResInfo+1);
     496    pFontPath = ((char *)pDosHdr + (pNameInfo->offset << alignment));
     497    //overwrite absolute font path
     498    strcpy(pFontPath, lpszFontFile);
     499    pNameInfo->length = strlen(lpszFontFile)+1;
     500
     501    hFile = CreateFileA(lpszFontRes,                     
     502                        GENERIC_READ | GENERIC_WRITE,     
     503                        FILE_SHARE_READ | FILE_SHARE_WRITE,
     504                        NULL,                             
     505                        CREATE_NEW,
     506                        0,
     507                        NULL);                             
     508
     509    if(hFile == INVALID_HANDLE_VALUE) {
     510        DebugInt3();
     511        goto failure;
     512    } 
     513    ret = WriteFile(hFile, lpCopy, dwSize, &dwBytesWritten, NULL);
     514    if(ret == FALSE || dwBytesWritten != dwSize) {
     515        DebugInt3();
     516        goto failure;
     517    }   
     518    CloseHandle(hFile);
     519
     520    if(lpCopy) free(lpCopy);
     521
     522    SetLastError(ERROR_SUCCESS);
     523    return TRUE;
     524
     525failure:
     526    if(hFile != INVALID_HANDLE_VALUE) {
     527        CloseHandle(hFile);
     528        DeleteFileA(lpszFontRes);
     529    }
     530    if(lpCopy) free(lpCopy);
     531    SetLastError(ERROR_INVALID_PARAMETER); //not correct
    168532  return FALSE;
    169533}
     
    200564  return CreateScalableFontResourceA(fdwHidden, lpszFontResA, lpszFontFileA, lpszCurrentPathA);
    201565}
    202 
    203 
     566//******************************************************************************
     567//******************************************************************************
  • trunk/src/gdi32/ft2supp.cpp

    r10600 r21304  
    9696       else pfnFt2EnableFontEngine(bEnabled);
    9797
     98       pfnGetGlyphIndices = (PFN_FT2GETGLYPHINDICES)QueryProcAddress("Ft2GetGlyphIndices");
     99       if(!pfnGetGlyphIndices) dprintf(("Ft2GetGlyphIndices not found!!"));
     100
    98101       pfnFt2GetTextExtentW  = (PFN_FT2GETTEXTEXTENTW)QueryProcAddress("Ft2GetTextExtentW");
    99102       if(!pfnFt2GetTextExtentW) dprintf(("Ft2GetTextExtentW not found!!"));
     
    104107       if(!pfnFt2CharStringPosAtW) dprintf(("Ft2CharStringPosAtW not found!!"));
    105108
     109       pfnFt2GetGlyphOutline = (PFN_FT2GETGLYPHOUTLINE)QueryProcAddress("Ft2GetGlyphOutline");
     110       if(!pfnFt2GetGlyphOutline) dprintf(("Ft2GetGlyphOutline not found!!"));
     111
     112       pfnFt2GetFontData = (PFN_FT2GETFONTDATA)QueryProcAddress("Ft2GetFontData");
     113       if(!pfnFt2GetFontData) dprintf(("Ft2GetFontData not found!!"));
     114
    106115       pfnFt2QueryFontType = (PFN_FT2QUERYFONTTYPE)QueryProcAddress("Ft2QueryFontType");
    107116       if(!pfnFt2QueryFontType) dprintf(("Ft2QueryFontType not found!!"));
     
    109118       pfnFt2QueryStringWidthW = (PFN_FT2QUERYSTRINGWIDTHW)QueryProcAddress("Ft2QueryStringWidthW");
    110119       if(!pfnFt2QueryStringWidthW) dprintf(("Ft2QueryStringWidthW not found!!"));
     120
     121       pfnFt2GetCharacterPlacementW = (PFN_FT2GETCHARACTERPLACEMENTW)QueryProcAddress("Ft2GetCharacterPlacementW");
     122       if(!pfnFt2GetCharacterPlacementW) dprintf(("pfnFt2GetCharacterPlacementW not found!!"));
    111123
    112124       // Do not register functions for Mozilla plugins
     
    187199DWORD CFT2Module::Ft2GetGlyphIndices(HPS hps, LPCWSTR str, int c, LPWORD pgi, DWORD fl)
    188200{
     201    DWORD  ret;
     202    USHORT sel;
     203
     204    // All FreeType calls should be wrapped for saving FS
     205    if(pfnGetGlyphIndices) {
     206        sel  = RestoreOS2FS();
     207        ret  = pfnGetGlyphIndices(hps, (WCHAR*)str, c, (ULONG*)pgi, fl);
     208        SetFS(sel);
     209        return ret;
     210    }
    189211    //no fallback
    190212    SetLastError(ERROR_CALL_NOT_IMPLEMENTED_W);
     
    195217DWORD CFT2Module::Ft2GetGlyphOutline(HPS hps, UINT glyph, UINT format, LPGLYPHMETRICS lpgm, DWORD buflen, LPVOID buf, const MAT2* lpmat)
    196218{
     219    DWORD  ret;
     220    USHORT sel;
     221
     222    // All FreeType calls should be wrapped for saving FS
     223    if (pfnFt2GetGlyphOutline)
     224    {
     225        sel  = RestoreOS2FS();
     226        ret  = pfnFt2GetGlyphOutline (hps, glyph, format, lpgm, buflen, buf, lpmat);
     227        SetFS(sel);
     228        return ret;
     229    }
     230   
    197231    //no fallback
    198232    SetLastError(ERROR_INVALID_FUNCTION_W);
     
    353387                                 LPVOID lpvBuffer, DWORD cbData)
    354388{
     389    DWORD  ret;
     390    USHORT sel;
     391
     392    // All FreeType calls should be wrapped for saving FS
     393    if(pfnFt2GetFontData) {
     394        sel  = RestoreOS2FS();
     395        ret  = pfnFt2GetFontData(hps, dwTable, dwOffset, lpvBuffer, cbData);
     396        SetFS(sel);
     397        if(ret || (ret == GDI_ERROR && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED))
     398            return ret;
     399    }
    355400    //no fallback
    356401    SetLastError(ERROR_CALL_NOT_IMPLEMENTED_W);
     
    501546            lpResults->lpOrder[i] = i;
    502547
     548    // All FreeType calls should be wrapped for saving FS
     549    if(pfnFt2GetCharacterPlacementW) {
     550        sel  = RestoreOS2FS();
     551        ret  = pfnFt2GetCharacterPlacementW((HPS)hdc, lpString, nSet, nMaxExtent, lpResults, dwFlags);
     552        SetFS(sel);
     553        if(ret || (ret == 0 && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED))
     554        {
     555#ifdef DEBUG
     556           if(ret && lpResults->lpDx) {
     557               for (i = 0; i < nSet; i++)
     558               {
     559                   dprintf(("%c pWidthArray[%d] = %d", lpString[i], i, lpResults->lpDx[i]));
     560               }
     561           }
     562#endif
     563           if(pHps && pHps->isPrinter && pHps->hdc)
     564           {//scale for printer dcs
     565               LONG alArray[2];
     566
     567               if(OSLibDevQueryCaps(pHps, OSLIB_CAPS_HORIZONTAL_RESOLUTION, 2, &alArray[0]) &&
     568                  alArray[0] != alArray[1])
     569               {
     570                   dprintf(("Different hor/vert resolutions (%d,%d)", alArray[0], alArray[1]));
     571                   if(lpResults->lpDx) {
     572                       for (i = 0; i < nSet; i++)
     573                       {
     574                           lpResults->lpDx[i] = lpResults->lpDx[i] * alArray[0] / alArray[1];
     575                       }
     576                   }
     577                   ULONG x = (ret & 0xffff);
     578                   x = x * alArray[0] / alArray[1];
     579                   ret &= ~0xffff;
     580                   ret |= (x & 0xffff);
     581               }
     582           }
     583           return ret;
     584        }
     585    }
    503586    //fallback method
    504587
  • trunk/src/gdi32/ft2supp.h

    r10391 r21304  
    1515#include <winconst.h>
    1616#include <win32type.h>
     17#include <ft2lib.h>
    1718
    1819#ifndef GDI_ERROR
     
    2526#define FT2LIBNAME              "ft2lib.dll"
    2627#define FT2LIB_MAJOR_VERSION    2
    27 #define FT2LIB_MINOR_VERSION    1
     28#define FT2LIB_MINOR_VERSION    3
    2829
    2930// Add here function pointer typedefs to funcs that we will use
     
    5051
    5152typedef VOID  (* SYSTEM PFN_FT2GETVERSION)(LONG *plMajor, LONG *plMinor, LONG *plBuildNumber);
    52 
    53 #define FT2_FONTTYPE_UNKNOWN    0
    54 #define FT2_FONTTYPE_TRUETYPE   1
    55 #define FT2_FONTTYPE_TYPE1      2
    56 #define FT2_FONTTYPE_BITMAP     3
    5753
    5854class CFT2Module {
  • trunk/src/gdi32/gdistats.cpp

    r10374 r21304  
    1313#include <objhandle.h>
    1414
     15#ifdef RAS
     16
     17RAS_TRACK_HANDLE rthFont;
     18RAS_TRACK_HANDLE rthDC;
     19RAS_TRACK_HANDLE rthPen;
     20RAS_TRACK_HANDLE rthBrush;
     21RAS_TRACK_HANDLE rthRgn;
     22RAS_TRACK_HANDLE rthBmp;
     23
     24void STATS_CreateFontIndirect(HFONT hFont, LOGFONTA* lplf)
     25{
     26    if (!rthFont) STATS_InitializeGDI32 ();
     27    RasAddObject (rthFont, hFont, lplf, sizeof (LOGFONTA));
     28}
     29void STATS_DeleteFont(HFONT hFont)
     30{
     31    RasRemoveObject (rthFont, hFont);
     32}
     33void STATS_CreateCompatibleDC(HDC hdc, HDC hdcCreated)
     34{
     35    if (!rthDC) STATS_InitializeGDI32 ();
     36    RasAddObject (rthDC, hdcCreated, &hdc, sizeof (hdc));
     37}
     38void STATS_CreateICA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
     39                     const DEVMODEA *lpdvmInit)
     40{
     41    if (!rthDC) STATS_InitializeGDI32 ();
     42    RasAddObject (rthDC, hdc, NULL, 0);
     43}
     44void STATS_CreateDCA(HDC hdc, LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
     45                     const DEVMODEA *lpdvmInit)
     46{
     47    if (!rthDC) STATS_InitializeGDI32 ();
     48    RasAddObject (rthDC, hdc, NULL, 0);
     49}
     50void STATS_DeleteDC(HDC hdc)
     51{
     52    RasRemoveObject (rthDC, hdc);
     53}
     54void STATS_CreatePatternBrush(HBRUSH hBrush, HBITMAP hBitmap)
     55{
     56    if (!rthBrush) STATS_InitializeGDI32 ();
     57    RasAddObject (rthBrush, hBrush, &hBitmap, sizeof (hBitmap));
     58}
     59void STATS_CreateDIBPatternBrushPt(HBRUSH hBrush, LPCVOID buffer, DWORD usage)
     60{
     61    if (!rthBrush) STATS_InitializeGDI32 ();
     62    RasAddObject (rthBrush, hBrush, &buffer, sizeof (buffer));
     63}
     64void STATS_CreateBrushIndirect(HBRUSH hBrush, LPLOGBRUSH pLogBrush)
     65{
     66    if (!rthBrush) STATS_InitializeGDI32 ();
     67    RasAddObject (rthBrush, hBrush, pLogBrush, sizeof (LOGBRUSH));
     68}
     69void STATS_CreateHatchBrush(HBRUSH hBrush, int fnStyle, COLORREF clrref)
     70{
     71    struct Parms
     72    {
     73        int fnStyle;
     74        COLORREF clrref;
     75    } parms = {fnStyle, clrref};
     76    if (!rthBrush) STATS_InitializeGDI32 ();
     77    RasAddObject (rthBrush, hBrush, &parms, sizeof (parms));
     78}
     79void STATS_CreateSolidBrush(HBRUSH hBrush, COLORREF color)
     80{
     81    if (!rthBrush) STATS_InitializeGDI32 ();
     82    RasAddObject (rthBrush, hBrush, &color, sizeof (COLORREF));
     83}
     84void STATS_DeleteBrush(HBRUSH hBrush)
     85{
     86    RasRemoveObject (rthBrush, hBrush);
     87}
     88void STATS_CreatePenIndirect(HPEN hPen, const LOGPEN *lplgpn)
     89{
     90    if (!rthPen) STATS_InitializeGDI32 ();
     91    RasAddObject (rthPen, hPen, (void *)lplgpn, sizeof (LOGPEN));
     92}
     93void STATS_CreatePen(HPEN hPen, int fnPenStyle, int nWidth, COLORREF crColor)
     94{
     95    struct Parms
     96    {
     97        int fnPenStyle;
     98        int nWidth;
     99        COLORREF crColor;
     100    } parms = {fnPenStyle, nWidth, crColor};
     101   
     102    if (!rthPen) STATS_InitializeGDI32 ();
     103    RasAddObject (rthPen, hPen, &parms, sizeof (parms));
     104}
     105void STATS_ExtCreatePen(HPEN hPen, DWORD dwPenStyle, DWORD dwWidth, const LOGBRUSH *lplb,
     106                        DWORD dwStyleCount, const DWORD *lpStyle)
     107{
     108    struct Parms
     109    {
     110        DWORD dwPenStyle;
     111        DWORD dwWidth;
     112        const LOGBRUSH *lplb;
     113        DWORD dwStyleCount;
     114        const DWORD *lpStyle;
     115    } parms = {dwPenStyle, dwWidth, lplb,
     116               dwStyleCount, lpStyle};
     117   
     118    if (!rthPen) STATS_InitializeGDI32 ();
     119    RasAddObject (rthPen, hPen, &parms, sizeof (parms));
     120}
     121void STATS_DeletePen(HPEN hPen)
     122{
     123    RasRemoveObject (rthPen, hPen);
     124}
     125
     126void STATS_CreatePolyPolygonRgn(HRGN hRgn, const POINT *lppt, const int *pPolyCount, int nCount, int fnPolyFillMode)
     127{
     128    if (!rthRgn) STATS_InitializeGDI32 ();
     129    RasAddObject (rthRgn, hRgn, NULL, 0);
     130}
     131void STATS_CreateRectRgn(HRGN hRgn, int left, int top, int right, int bottom)
     132{
     133    if (!rthRgn) STATS_InitializeGDI32 ();
     134    RasAddObject (rthRgn, hRgn, NULL, 0);
     135}
     136void STATS_CreateRoundRectRgn(HRGN hRgn, int left, int top, int right, int bottom, int nWidthEllipse, int nHeightEllipse)
     137{
     138    if (!rthRgn) STATS_InitializeGDI32 ();
     139    RasAddObject (rthRgn, hRgn, NULL, 0);
     140}
     141void STATS_ExtCreateRegion(HRGN hRgn, PVOID pXform, DWORD count, const RGNDATA * pData)
     142{
     143    if (!rthRgn) STATS_InitializeGDI32 ();
     144    RasAddObject (rthRgn, hRgn, NULL, 0);
     145}
     146void STATS_CreateEllipticRgn(HRGN hRgn, int left, int top, int right, int bottom)
     147{
     148    if (!rthRgn) STATS_InitializeGDI32 ();
     149    RasAddObject (rthRgn, hRgn, NULL, 0);
     150}
     151void STATS_CreatePolygonRgn(HRGN hRgn, const POINT * lppt, int cPoints, int fnPolyFillMode)
     152{
     153    if (!rthRgn) STATS_InitializeGDI32 ();
     154    RasAddObject (rthRgn, hRgn, NULL, 0);
     155}
     156void STATS_DeleteRgn(HRGN hRgn)
     157{
     158    RasRemoveObject (rthRgn, hRgn);
     159}
     160
     161void STATS_CreateDIBitmap(HBITMAP hBitmap,HDC hdc, const BITMAPINFOHEADER *lpbmih,
     162                          DWORD fdwInit, const void *lpbInit,
     163                          const BITMAPINFO *lpbmi, UINT fuUsage)
     164{
     165    if (!rthBmp) STATS_InitializeGDI32 ();
     166    RasAddObject (rthBmp, hBitmap, NULL, 0);
     167}
     168void STATS_CreateCompatibleBitmap(HBITMAP hBitmap,HDC hdc, int nWidth, int nHeight)
     169{
     170    if (!rthBmp) STATS_InitializeGDI32 ();
     171    RasAddObject (rthBmp, hBitmap, NULL, 0);
     172}
     173void STATS_CreateBitmap(HBITMAP hBitmap,int nWidth, int nHeight, UINT cPlanes,
     174                        UINT cBitsPerPel, const void *lpvBits)
     175{
     176    if (!rthBmp) STATS_InitializeGDI32 ();
     177    RasAddObject (rthBmp, hBitmap, NULL, 0);
     178}
     179void STATS_CreateDIBSection(HBITMAP hBitmap,HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
     180                            VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
     181{
     182    if (!rthBmp) STATS_InitializeGDI32 ();
     183    RasAddObject (rthBmp, hBitmap, NULL, 0);
     184}
     185void STATS_CreateBitmapIndirect(HBITMAP hBitmap, const BITMAP *pBitmap)
     186{
     187    if (!rthBmp) STATS_InitializeGDI32 ();
     188    RasAddObject (rthBmp, hBitmap, NULL, 0);
     189}
     190void STATS_DeleteBitmap(HBITMAP hBitmap)
     191{
     192    RasRemoveObject (rthBmp, hBitmap);
     193}
     194
     195void STATS_DeleteObject(HANDLE hObj, DWORD objtype)
     196{
     197    switch(objtype) {
     198    case OBJ_PEN:
     199    case OBJ_EXTPEN:
     200        STATS_DeletePen(hObj);
     201        break;
     202    case OBJ_BRUSH:
     203        STATS_DeleteBrush(hObj);
     204        break;
     205    case OBJ_FONT:
     206        STATS_DeleteFont(hObj);
     207        break;
     208    case OBJ_REGION:
     209        STATS_DeleteRgn(hObj);
     210        break;
     211    case OBJ_BITMAP:
     212        STATS_DeleteBitmap(hObj);
     213        break;
     214
     215    case OBJ_MEMDC:
     216    case OBJ_DC:
     217        STATS_DeleteDC(hObj);
     218        break;
     219
     220    case OBJ_PAL:
     221    case OBJ_METAFILE:
     222    case OBJ_ENHMETADC:
     223    case OBJ_ENHMETAFILE:
     224    case OBJ_METADC:
     225        break;
     226    default:
     227        RasLog ("!ERROR! Unknown object %x of type %d", hObj, objtype);
     228        break;
     229    }
     230}
     231
     232void STATS_DumpStatsGDI32()
     233{
     234    RasLogObjects(rthDC, RAS_FLAG_LOG_OBJECTS);
     235    RasLogObjects(rthPen, RAS_FLAG_LOG_OBJECTS);
     236    RasLogObjects(rthBrush, RAS_FLAG_LOG_OBJECTS);
     237    RasLogObjects(rthRgn, RAS_FLAG_LOG_OBJECTS);
     238    RasLogObjects(rthBmp, RAS_FLAG_LOG_OBJECTS);
     239}
     240
     241void STATS_InitializeGDI32(void)
     242{
     243    RasEnterSerialize ();
     244    if (!rthDC)
     245    {
     246        RasRegisterObjectTracking(&rthDC, "DC", 0, 0, NULL, NULL);
     247    }
     248    if (!rthPen)
     249    {
     250        RasRegisterObjectTracking(&rthPen, "Pen", 0, 0, NULL, NULL);
     251    }
     252    if (!rthBrush)
     253    {
     254        RasRegisterObjectTracking(&rthBrush, "Brush", 0, 0, NULL, NULL);
     255    }
     256    if (!rthRgn)
     257    {
     258        RasRegisterObjectTracking(&rthRgn, "Region", 0, 0, NULL, NULL);
     259    }
     260    if (!rthBmp)
     261    {
     262        RasRegisterObjectTracking(&rthBmp, "Bitmap", 0, 0, NULL, NULL);
     263    }
     264    RasExitSerialize ();
     265}
     266
     267void STATS_UninitializeGDI32(void)
     268{
     269// done in RAS kernel   
     270//    RasDeregisterObjectTracking(rthDC);
     271//    RasDeregisterObjectTracking(rthPen);
     272//    RasDeregisterObjectTracking(rthBrush);
     273//    RasDeregisterObjectTracking(rthRgn);
     274//    RasDeregisterObjectTracking(rthBmp);
     275}
     276
     277#else
    15278#ifdef DEBUG
    16279
     
    316579//******************************************************************************
    317580//******************************************************************************
     581void STATS_InitializeGDI32(void)
     582{
     583    return;
     584}
     585
     586void STATS_UninitializeGDI32(void)
     587{
     588    return;
     589}
    318590
    319591
    320592#endif //DEBUG
     593#endif //RAS
  • trunk/src/gdi32/icm.cpp

    r10582 r21304  
    1 /* $Id: icm.cpp,v 1.6 2004-04-14 09:44:13 sandervl Exp $ */
     1/* $Id: icm.cpp,v 1.5 2004/04/14 09:43:45 sandervl Exp $ */
    22
    33/*
  • trunk/src/gdi32/initgdi32.cpp

    r10374 r21304  
    9595   switch (ulFlag) {
    9696      case 0 :
     97         STATS_InitializeGDI32 ();         
     98
    9799         ParseLogStatusGDI32();
    98100
     
    119121         dprintf(("gdi32 init %s %s (%x)", __DATE__, __TIME__, inittermGdi32));
    120122
     123         RasEntry (RAS_EVENT_Gdi32InitComplete, &dllHandle, sizeof (dllHandle));
     124
    121125         break;
    122126      case 1 :
     
    125129             UnregisterLxDll(dllHandle);
    126130         }
     131         STATS_UninitializeGDI32 ();         
    127132         break;
    128133      default  :
  • trunk/src/gdi32/objhandle.cpp

    r10374 r21304  
    474474
    475475    handleType = GetObjectType(hObj);
    476     dprintf2(("GDI32: SelectObject %x %x type %s", hdc, hObj, DbgGetGDITypeName(handleType)));
     476    dprintf(("GDI32: SelectObject %x %x type %s", hdc, hObj, DbgGetGDITypeName(handleType)));
    477477    if(handleType == OBJ_REGION) {
    478478        //Return complexity here; not previously selected clip region
  • trunk/src/gdi32/oslibgpi.cpp

    r10594 r21304  
    374374  GpiQueryAttrs(GetDCData(pHps)->hps,PRIM_LINE,LBB_MIX_MODE, (PBUNDLE)&lineBundle);
    375375
     376  ULONG penAttrs = ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL;
     377
    376378  newAreaBundle           = oldAreaBundle;
    377379  newAreaBundle.lColor    = color;
    378380  newAreaBundle.usMixMode = lineBundle.usMixMode;
     381  if(!GetDCData(pHps)->isMetaPS && !GetDCData(pHps)->isPrinter)
     382  {
    379383  newAreaBundle.usSet     = LCID_DEFAULT;
     384      penAttrs |= ABB_SET;
     385  }
    380386  newAreaBundle.usSymbol  = PATSYM_SOLID;
    381387
    382   if (!GpiSetAttrs(GetDCData(pHps)->hps,PRIM_AREA,ABB_COLOR | ABB_MIX_MODE | ABB_SET | ABB_SYMBOL,0,(PBUNDLE)&newAreaBundle))
     388  if (!GpiSetAttrs(GetDCData(pHps)->hps,PRIM_AREA, penAttrs,0,(PBUNDLE)&newAreaBundle))
    383389  {
    384390      dprintf(("drawLinePointCircle: GpiSetAttrs failed with %x!!", WinGetLastError(0)));
     
    386392  }
    387393
    388   if (GpiFullArc(GetDCData(pHps)->hps,DRO_FILL,MAKEFIXED((width-1)>>1,0)) == GPI_ERROR)
     394  if (GpiFullArc(GetDCData(pHps)->hps, GetDCData(pHps)->inPath ? DRO_OUTLINE : DRO_FILL, MAKEFIXED((width-1)>>1,0)) == GPI_ERROR)
    389395  {
    390396      dprintf(("drawLinePointCircle: GpiFullArc failed with %x!!", WinGetLastError(0)));
    391397      rc = FALSE;
    392398  }
    393   GpiSetAttrs(GetDCData(pHps)->hps,PRIM_AREA,ABB_COLOR | ABB_MIX_MODE | ABB_SET | ABB_SYMBOL,0,(PBUNDLE)&oldAreaBundle);
     399  GpiSetAttrs(GetDCData(pHps)->hps,PRIM_AREA,penAttrs,0,(PBUNDLE)&oldAreaBundle);
    394400
    395401  return rc;
  • trunk/src/gdi32/printer.cpp

    r10597 r21304  
    1 /* $Id: printer.cpp,v 1.3 2004-05-05 09:19:11 sandervl Exp $ */
     1/* $Id: printer.cpp,v 1.14 2004/05/04 13:49:24 sandervl Exp $ */
    22
    33/*
     
    55 *
    66 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl)
    7  *
     7 * Copyright 2002-2003 InnoTek Systemberatung GmbH (sandervl@innotek.de)
    88 *
    99 * Parts based on Wine code (StartDocW)
     
    1919#include <os2win.h>
    2020#include <stdarg.h>
     21#include <stdio.h>
    2122#include <string.h>
    2223#include <dcdata.h>
     
    2829#include "dbglocal.h"
    2930
     31// Private WGSS escape extensions
     32#define PRIVATE_QUERYORIENTATION        0x99990001
     33#define PRIVATE_QUERYCOPIES             0x99990002
     34#define PRIVATE_QUERYCOLLATE            0x99990003
     35
    3036static char *lpszPassThrough = NULL;
    3137static int   cbPassThrough   = 0;
     
    3339//NOTE: We need to insert this postscript statement into the stream or else
    3440//      the output will be completely inverted (x & y)
    35 static char  szSetupString[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n%%EndSetup\n";
    36 
     41static char  szSetupStringPortrait[]  = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n%%EndSetup\n";
     42static char  szSetupStringLandscape[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n-90 rotate\n%%EndSetup\n";
     43
     44
     45static BOOL  fPostscriptPassthrough = TRUE;
     46
     47//******************************************************************************
     48//******************************************************************************
     49BOOL WIN32API ODIN_QueryPostscriptPassthrough()
     50{
     51    return fPostscriptPassthrough;
     52}
     53//******************************************************************************
     54//******************************************************************************
     55void WIN32API ODIN_SetPostscriptPassthrough(BOOL fEnabled)
     56{
     57    fPostscriptPassthrough = fEnabled;
     58}
    3759//******************************************************************************
    3860//******************************************************************************
     
    6486        dprintf(("Postscript %s data of size %d", lpszEscape, *(WORD *)lpvInData));
    6587
     88        if(fPostscriptPassthrough == FALSE)
     89        {
     90            return 0;
     91        }
     92        if(lpszPassThrough) {
     93            O32_Escape(hdc, nEscape, cbPassThrough, lpszPassThrough, NULL);
     94            free(lpszPassThrough);
     95            lpszPassThrough = NULL;
     96        }
     97        pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
     98        if(pHps && (pHps->Reserved & DC_FLAG_SEND_POSTSCRIPT_SETUP_STRING))
     99        {
     100            DWORD dmOrientation = 0, hdrsize, dmCollate, dmCopies;
     101            char *pvSetupData = NULL;
     102
     103            O32_Escape(hdc, PRIVATE_QUERYORIENTATION, 0, NULL, &dmOrientation);
     104            if(dmOrientation == DMORIENT_LANDSCAPE) {
     105                hdrsize = sizeof(szSetupStringLandscape)-1;
     106                pvSetupData = (char *)alloca(hdrsize+sizeof(WORD));
     107            }
     108            else {//portrait
     109                hdrsize = sizeof(szSetupStringPortrait)-1;
     110                pvSetupData = (char *)alloca(hdrsize+sizeof(WORD));
     111            }
     112            if(pvSetupData) {
     113                *(WORD *)pvSetupData = hdrsize;
     114                memcpy(pvSetupData+sizeof(WORD), (hdrsize == sizeof(szSetupStringPortrait)-1) ? szSetupStringPortrait : szSetupStringLandscape, hdrsize);
     115
     116                O32_Escape(hdc, nEscape, *(WORD *)pvSetupData, pvSetupData, NULL);
     117
     118                dprintf(("Send Postscript setup string %d (%x):\n%s", dmOrientation, pHps->Reserved, pvSetupData+sizeof(WORD)));
     119            }
     120            pHps->Reserved &= ~DC_FLAG_SEND_POSTSCRIPT_SETUP_STRING;
     121        }
     122
    66123        rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
    67124        if(rc == 1) rc = *(WORD *)lpvInData;
     
    70127    }
    71128
     129    case PRIVATE_QUERYORIENTATION:
     130        DebugInt3();
     131        return 0;
     132   
    72133    case SPCLPASSTHROUGH2:
    73134    {
     
    76137        dprintf(("SPCLPASSTHROUGH2: pretend success"));
    77138        dprintf(("SPCLPASSTHROUGH2: virt mem %x size %x", *(DWORD *)lpvInData, rawsize));
     139        if(lpszPassThrough == NULL) {
     140            lpszPassThrough = (char *)malloc(rawsize+sizeof(WORD));
     141            if(lpszPassThrough == NULL) {
     142                DebugInt3();
     143                return 0;
     144            }
     145            memcpy(lpszPassThrough+sizeof(WORD), (char *)lpvInData+6, rawsize);
     146            cbPassThrough = rawsize;
     147            *(WORD *)lpszPassThrough = (WORD)cbPassThrough;
     148        }
     149        else {
     150            char *tmp = lpszPassThrough;
     151
     152            lpszPassThrough = (char *)malloc(cbPassThrough+rawsize+sizeof(WORD));
     153            if(lpszPassThrough == NULL) {
     154                DebugInt3();
     155                return 0;
     156            }
     157            memcpy(lpszPassThrough+sizeof(WORD), tmp+sizeof(WORD), cbPassThrough);
     158            free(tmp);
     159            memcpy(lpszPassThrough+sizeof(WORD)+cbPassThrough, (char *)lpvInData+6, rawsize);
     160            cbPassThrough += rawsize;
     161            *(WORD *)lpszPassThrough = (WORD)cbPassThrough;
     162        }
    78163        return 1;
    79164    }
     
    126211            return Escape(hdc, QUERYESCSUPPORT, sizeof(nEscapeSup), (LPCSTR)&nEscapeSup, NULL);
    127212        }
     213        case POSTSCRIPT_PASSTHROUGH:
     214        case POSTSCRIPT_DATA:
     215        case PASSTHROUGH:
     216            if(fPostscriptPassthrough == FALSE)
     217            {
     218                return 0;
     219            }
     220            break;
     221
    128222        default:
    129223            break;
Note: See TracChangeset for help on using the changeset viewer.