Ignore:
Timestamp:
Jan 15, 2004, 12:18:58 PM (22 years ago)
Author:
sandervl
Message:

KOM: Cleanup of text functions

File:
1 edited

Legend:

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

    r10391 r10400  
    4141void WIN32API SetFreeTypeIntegration(BOOL fEnabled)
    4242{
    43     fFT2LIBIntegration = fEnabled;   
     43    fFT2LIBIntegration = fEnabled;
    4444
    4545    FT2Module.init();
     
    4848// Constructor
    4949//******************************************************************************
    50 CFT2Module::CFT2Module(char* sModuleName): bEnabled(FALSE), hftModule(0), pfnGetGlyphIndices(NULL), 
     50CFT2Module::CFT2Module(char* sModuleName): bEnabled(FALSE), hftModule(0), pfnGetGlyphIndices(NULL),
    5151                pfnFt2GetTextExtentW(NULL), pfnFt2EnableFontEngine(NULL),
    52                 pfnFt2GetGlyphOutline(NULL), pfnFt2CharStringPosAtA(NULL), 
     52                pfnFt2GetGlyphOutline(NULL), pfnFt2CharStringPosAtA(NULL),
    5353                pfnFt2CharStringPosAtW(NULL), pfnFt2GetFontData(NULL),
    5454                pfnFt2RegisterUconv(NULL), pfnFt2QueryStringWidthW(NULL),
     
    7171
    7272    rc = DosLoadModule((PSZ)Loaderror, sizeof(Loaderror), pszModuleName, &hftModule);
    73     if (rc != 0) 
     73    if (rc != 0)
    7474        dprintf(("Freetype2 library load error: return code = %u\n", rc));
    7575    else
    76        bEnabled = TRUE;   
     76       bEnabled = TRUE;
    7777
    7878    if(bEnabled) {
     
    111111
    112112       // Do not register functions for Mozilla plugins
    113        if(IsDummyExeLoaded() == FALSE) 
     113       if(IsDummyExeLoaded() == FALSE)
    114114       {
    115115           pfnFt2RegisterUconv = (PFN_FT2REGISTERUCONV)QueryProcAddress("Ft2RegisterUconv");
    116            if(pfnFt2RegisterUconv) 
     116           if(pfnFt2RegisterUconv)
    117117                pfnFt2RegisterUconv(WideCharToMultiByte, MultiByteToWideChar);
    118118           else dprintf(("Ft2QueryFontType not found!!"));
     
    123123
    124124failure:
    125     if(pfnFt2RegisterUconv) 
     125    if(pfnFt2RegisterUconv)
    126126        pfnFt2RegisterUconv(NULL, NULL);
    127127    if(pfnFt2EnableFontEngine)
     
    131131    pfnFt2GetTextExtentW   = NULL;
    132132    pfnFt2EnableFontEngine = NULL;
    133     pfnFt2GetGlyphOutline  = NULL; 
    134     pfnFt2CharStringPosAtA = NULL; 
    135     pfnFt2CharStringPosAtW = NULL; 
     133    pfnFt2GetGlyphOutline  = NULL;
     134    pfnFt2CharStringPosAtA = NULL;
     135    pfnFt2CharStringPosAtW = NULL;
    136136    pfnFt2GetFontData      = NULL;
    137     pfnFt2RegisterUconv    = NULL; 
     137    pfnFt2RegisterUconv    = NULL;
    138138    pfnFt2QueryStringWidthW= NULL;
    139139    pfnFt2GetVersion       = NULL;
     
    162162    PFN ModuleAddr;
    163163
    164     rc = DosQueryProcAddr(hftModule, ordinal, NULL, &ModuleAddr); 
     164    rc = DosQueryProcAddr(hftModule, ordinal, NULL, &ModuleAddr);
    165165    if (rc != 0) {
    166166        dprintf(("FreeType2 QueryProcAddr error: return code = %u\n", rc));
     
    176176    PFN ModuleAddr;
    177177
    178     rc = DosQueryProcAddr(hftModule, 0, procname, &ModuleAddr); 
     178    rc = DosQueryProcAddr(hftModule, 0, procname, &ModuleAddr);
    179179    if (rc != 0) {
    180180        dprintf(("FreeType2 QueryProcAddr error: return code = %u\n", rc));
     
    203203// This is basically the same as Ft2QueryTextBoxW, but it behaves as the Win32
    204204// API GetTextExtent (which ignores character attributes and underhang/overhang)
    205 // 
     205//
    206206// The fallback case is not accurate!! (but the same as our old code)
    207207//
     
    242242
    243243    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 
    248244    if( ret )
    249245    {
     246        TEXTMETRICW tmW;
     247
     248        cx = labs( pplos2[ lenA ].x - pplos2[ 0 ].x );
     249        cy = labs( pplos2[ lenA ].y - pplos2[ 0 ].y );
     250
    250251        aptlPoints[ TXTBOX_BOTTOMLEFT ].x = 0;
    251252        aptlPoints[ TXTBOX_BOTTOMLEFT ].y = 0;
     
    258259        aptlPoints[ TXTBOX_CONCAT ].x = cx;
    259260        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        }
    269268#ifdef DEBUG
    270     else DebugInt3();
     269        else DebugInt3();
    271270#endif
     271    }
    272272
    273273    free( pplos2 );
     
    280280BOOL CFT2Module::Ft2CharStringPosAtA(HPS hps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCSTR pchString,CONST INT *alAdx, DWORD fuWin32Options)
    281281{
    282     DWORD  ret; 
     282    DWORD  ret;
    283283    USHORT sel;
    284284
    285     // All FreeType calls should be wrapped for saving FS 
     285    // All FreeType calls should be wrapped for saving FS
    286286    if(pfnFt2CharStringPosAtA) {
    287287        sel  = RestoreOS2FS();
     
    289289        SetFS(sel);
    290290        if(ret || (ret == FALSE && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED))
    291             return ret; 
     291            return ret;
    292292    }
    293293    //else fall back to GPI
     
    300300BOOL CFT2Module::Ft2CharStringPosAtW(HPS hps, PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCWSTR pchString,CONST INT *alAdx, DWORD fuWin32Options)
    301301{
    302     DWORD  ret; 
     302    DWORD  ret;
    303303    USHORT sel;
    304304
    305     // All FreeType calls should be wrapped for saving FS 
     305    // All FreeType calls should be wrapped for saving FS
    306306    if(pfnFt2CharStringPosAtW) {
    307307        sel  = RestoreOS2FS();
     
    309309        SetFS(sel);
    310310        if(ret || (ret == FALSE && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED))
    311             return ret; 
     311            return ret;
    312312    }
    313313    //else fall back to GPI
     
    336336}
    337337//******************************************************************************
    338 // Query the font type current selected into the presentation space, or, 
     338// Query the font type current selected into the presentation space, or,
    339339// when hps == NULL, query the type of the font with the specified name
    340340//******************************************************************************
    341341DWORD CFT2Module::Ft2QueryFontType(HPS hps, LPCSTR lpszFontName)
    342342{
    343     DWORD  ret; 
     343    DWORD  ret;
    344344    USHORT sel;
    345345
    346     // All FreeType calls should be wrapped for saving FS 
     346    // All FreeType calls should be wrapped for saving FS
    347347    if(pfnFt2QueryFontType) {
    348348        sel  = RestoreOS2FS();
     
    350350        SetFS(sel);
    351351        if(ret || (ret == GDI_ERROR && ERRORIDERROR(WinGetLastError(0)) != PMERR_FUNCTION_NOT_SUPPORTED))
    352             return ret; 
     352            return ret;
    353353    }
    354354    //no fallback
     
    359359BOOL CFT2Module::Ft2GetStringWidthW(HDC hdc, LPWSTR lpszString, UINT cbString, PINT pWidthArray)
    360360{
    361     DWORD  ret; 
     361    DWORD  ret;
    362362    USHORT sel;
    363363    pDCData pHps;
     
    370370    }
    371371
    372     // All FreeType calls should be wrapped for saving FS 
     372    // All FreeType calls should be wrapped for saving FS
    373373    if(pfnFt2QueryStringWidthW) {
    374374        sel  = RestoreOS2FS();
     
    382382
    383383               if(OSLibDevQueryCaps(pHps, OSLIB_CAPS_HORIZONTAL_RESOLUTION, 2, &alArray[0]) &&
    384                   alArray[0] != alArray[1]) 
     384                  alArray[0] != alArray[1])
    385385               {
    386386                   dprintf(("Different hor/vert resolutions (%d,%d)", alArray[0], alArray[1]));
     
    391391                }
    392392            }
    393             return ret; 
     393            return ret;
    394394        }
    395395    }
     
    438438                                            DWORD         dwFlags)
    439439{
    440     DWORD  ret; 
     440    DWORD  ret;
    441441    USHORT sel;
    442442    SIZE   size;
     
    454454
    455455    dprintf(("lStructSize=%ld, lpOutString=%p, lpOrder=%p, lpDx=%p, lpCaretPos=%p, lpClass=%p, lpGlyphs=%p, nGlyphs=%u, nMaxFit=%d\n",
    456             lpResults->lStructSize, lpResults->lpOutString, lpResults->lpOrder,
    457             lpResults->lpDx, lpResults->lpCaretPos, lpResults->lpClass,
    458             lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit));
     456        lpResults->lStructSize, lpResults->lpOutString, lpResults->lpOrder,
     457        lpResults->lpDx, lpResults->lpCaretPos, lpResults->lpClass,
     458        lpResults->lpGlyphs, lpResults->nGlyphs, lpResults->nMaxFit));
    459459
    460460    if(dwFlags&(~0))            dprintf(("unsupported flags 0x%08lx\n", dwFlags));
    461     if(lpResults->lpCaretPos)   dprintf(("caret positions not implemented\n"));
    462     if(lpResults->lpClass)      dprintf(("classes not implemented\n"));
     461    if(lpResults->lpCaretPos)   dprintf(("caret positions not implemented\n"));
     462    if(lpResults->lpClass)  dprintf(("classes not implemented\n"));
    463463
    464464    nSet = (UINT)uCount;
    465465    if(nSet > lpResults->nGlyphs)
    466         nSet = lpResults->nGlyphs;
     466    nSet = lpResults->nGlyphs;
    467467
    468468    /* return number of initialized fields */
     
    488488
    489489    if(lpResults->lpGlyphs)
    490         GetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0);
     490    GetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0);
    491491
    492492    if (GetTextExtentPoint32W(hdc, lpString, uCount, &size))
Note: See TracChangeset for help on using the changeset viewer.