View | Details | Raw Unified | Return to issue 77976
Collapse All | Expand All

(-)winlayout.cxx (-13 / +56 lines)
Lines 42-47 Link Here
42
42
43
#include <rtl/ustring.hxx>
43
#include <rtl/ustring.hxx>
44
#include <osl/module.h>
44
#include <osl/module.h>
45
#include <osl/file.h>
45
46
46
#ifndef _SV_SALGDI_H
47
#ifndef _SV_SALGDI_H
47
#include <salgdi.h>
48
#include <salgdi.h>
Lines 70-75 Link Here
70
71
71
#ifdef USE_UNISCRIBE
72
#ifdef USE_UNISCRIBE
72
#include <Usp10.h>
73
#include <Usp10.h>
74
#include <ShLwApi.h>
75
#include <winver.h>
73
#endif // USE_UNISCRIBE
76
#endif // USE_UNISCRIBE
74
77
75
#include <hash_map>
78
#include <hash_map>
Lines 1144-1149 static HRESULT ((WINAPI *pScriptTextOut) Link Here
1144
static HRESULT ((WINAPI *pScriptGetFontProperties)( HDC, SCRIPT_CACHE*, SCRIPT_FONTPROPERTIES* ));
1147
static HRESULT ((WINAPI *pScriptGetFontProperties)( HDC, SCRIPT_CACHE*, SCRIPT_FONTPROPERTIES* ));
1145
static HRESULT ((WINAPI *pScriptFreeCache)( SCRIPT_CACHE* ));
1148
static HRESULT ((WINAPI *pScriptFreeCache)( SCRIPT_CACHE* ));
1146
1149
1150
static bool bManualCellAlign = true;
1151
1147
// -----------------------------------------------------------------------
1152
// -----------------------------------------------------------------------
1148
1153
1149
static bool InitUSP()
1154
static bool InitUSP()
Lines 1217-1222 static bool InitUSP() Link Here
1217
        aUspModule = NULL;
1222
        aUspModule = NULL;
1218
    }
1223
    }
1219
1224
1225
	// get the DLL version info
1226
	int nUspVersion = 0;
1227
	// TODO: there must be a simpler way to get the friggin version info from OSL?
1228
	rtl_uString* pModuleURL = NULL;
1229
	osl_getModuleURLFromAddress( (void*)pScriptIsComplex, &pModuleURL );
1230
	rtl_uString* pModuleFileName = NULL;
1231
	if( pModuleURL )
1232
		osl_getSystemPathFromFileURL( pModuleURL, &pModuleFileName );
1233
	const sal_Unicode* pModuleFileCStr = NULL;
1234
	if( pModuleFileName )
1235
		pModuleFileCStr = rtl_uString_getStr( pModuleFileName );
1236
	if( pModuleFileCStr )
1237
	{
1238
		DWORD nHandle;
1239
		DWORD nBufSize = ::GetFileVersionInfoSizeW( pModuleFileCStr, &nHandle );
1240
		char* pBuffer = (char*)alloca( nBufSize );
1241
		WIN_BOOL bRC = ::GetFileVersionInfoW( pModuleFileCStr, nHandle, nBufSize, pBuffer );
1242
		VS_FIXEDFILEINFO* pFixedFileInfo = NULL;
1243
		UINT nFixedFileSize = 0;
1244
		if( bRC )	
1245
			::VerQueryValueW( pBuffer, L"\\", (void**)&pFixedFileInfo, &nFixedFileSize );
1246
		if( pFixedFileInfo && pFixedFileInfo->dwSignature == 0xFEEF04BD )
1247
			nUspVersion = HIWORD(pFixedFileInfo->dwProductVersionMS) * 10000
1248
						+ LOWORD(pFixedFileInfo->dwProductVersionMS);
1249
	}
1250
1251
	// #i77976# USP>=1.0600 changed the need to manually align glyphs in their cells
1252
	if( nUspVersion >= 10600 )
1253
		bManualCellAlign = false;
1254
1220
    return bUspEnabled;
1255
    return bUspEnabled;
1221
}
1256
}
1222
1257
Lines 2306-2312 void UniscribeLayout::ApplyDXArray( cons Link Here
2306
         || (rVisualItem.mnEndCharPos <= mnMinCharPos) )
2341
         || (rVisualItem.mnEndCharPos <= mnMinCharPos) )
2307
            continue;
2342
            continue;
2308
2343
2309
        if( rVisualItem.mpScriptItem->a.fRTL )
2344
		if( bManualCellAlign && rVisualItem.mpScriptItem->a.fRTL )
2310
        {
2345
        {
2311
            // HACK: make sure kashida justification is used when possible
2346
            // HACK: make sure kashida justification is used when possible
2312
            // TODO: make sure this works on all usp versions
2347
            // TODO: make sure this works on all usp versions
Lines 2334-2355 void UniscribeLayout::ApplyDXArray( cons Link Here
2334
            break;
2369
            break;
2335
        }
2370
        }
2336
2371
2337
        // update nXOffset to the position of the next visual item
2372
        // to prepare for the next visual item
2338
        int nEndGlyphPos;
2373
        // update nXOffset to the next items position
2339
        if( GetItemSubrange( rVisualItem, i, nEndGlyphPos ) )
2374
        // before the mpJustifications[] array gets modified
2340
            for(; i < nEndGlyphPos; ++i )
2375
        int nMinGlyphPos, nEndGlyphPos;
2376
        if( GetItemSubrange( rVisualItem, nMinGlyphPos, nEndGlyphPos ) )
2377
            for( i = nMinGlyphPos; i < nEndGlyphPos; ++i )
2341
                nXOffset += mpJustifications[ i ];
2378
                nXOffset += mpJustifications[ i ];
2342
2379
2343
        if( rVisualItem.mpScriptItem->a.fRTL )
2380
        // right align the justification-adjusted glyphs in their cells for RTL-items
2381
        if( bManualCellAlign && rVisualItem.mpScriptItem->a.fRTL ) 
2344
        {
2382
        {
2345
            // right align adjusted glyph positions for RTL item
2383
            for( i = nMinGlyphPos; i < nEndGlyphPos; ++i )
2346
            // exception: kashida aligned glyphs
2347
            // TODO: make sure this works on all usp versions
2348
            for( i = rVisualItem.mnMinGlyphPos+1; i < rVisualItem.mnEndGlyphPos; ++i )
2349
                if( mpVisualAttrs[i].uJustification != SCRIPT_JUSTIFY_ARABIC_KASHIDA )
2350
                {
2384
                {
2351
                    mpJustifications[i-1] += mpJustifications[ i ] - mpGlyphAdvances[ i ];
2385
                // kashida justified glyphs already seem to be right justified
2352
                    mpJustifications[ i ] = mpGlyphAdvances[ i ];
2386
                // TODO: make sure this assumption works on all usp versions
2387
                if( mpVisualAttrs[i].uJustification == SCRIPT_JUSTIFY_ARABIC_KASHIDA )
2388
                    continue;
2389
2390
                const int nXOffsetAdjust = mpJustifications[i] - mpGlyphAdvances[i];
2391
                if( i == nMinGlyphPos ) 
2392
                    rVisualItem.mnXOffset += nXOffsetAdjust;
2393
                else
2394
                    mpJustifications[i-1] += nXOffsetAdjust;
2395
                mpJustifications[i] -= nXOffsetAdjust;
2353
                }
2396
                }
2354
        }
2397
        }
2355
    }
2398
    }

Return to issue 77976