[Libreoffice-commits] .: 3 commits - libxml2/makefile.mk libxslt/makefile.mk solenv/gbuild vcl/Library_vcl.mk vcl/win

Tor Lillqvist tml at kemper.freedesktop.org
Tue May 8 07:19:08 PDT 2012


 libxml2/makefile.mk                     |    3 
 libxslt/makefile.mk                     |    3 
 solenv/gbuild/platform/WNT_INTEL_MSC.mk |    1 
 vcl/Library_vcl.mk                      |    1 
 vcl/win/source/gdi/winlayout.cxx        |  119 +++++---------------------------
 5 files changed, 22 insertions(+), 105 deletions(-)

New commits:
commit 02cf8bf47252cdaeaed7179ebd002692065583d0
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue May 8 17:11:09 2012 +0300

    Fix lookup of path to usp10.dll
    
    Just using the identifier ScriptIsComplex apparently results in the
    address of its import stub, which has been linked into the calling DLL
    (vcllo.dll). We need to look up that symbols from the handle of
    usp10.dll to get the actual function's address, to be passed to
    osl_getModuleURLFromAddress().
    
    (Nothing magic with ScriptIsComplex here, it is just an arbitrary
    function from usp10.dll.)
    
    Change-Id: I If000d0c2eae3e3e32ce0ad1c26e545304d6f6d9e

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 666212e..fa804d1 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1110,10 +1110,11 @@ static bool bManualCellAlign = true;
 static bool InitUSP()
 {
     // get the usp10.dll version info
+    HMODULE usp10 = ::GetModuleHandle("usp10.dll");
+    void *pScriptIsComplex = ::GetProcAddress(usp10, "ScriptIsComplex");
     int nUspVersion = 0;
-    // TODO: there must be a simpler way to get the friggin version info from OSL?
     rtl_uString* pModuleURL = NULL;
-    osl_getModuleURLFromAddress( (void*)ScriptIsComplex, &pModuleURL );
+    osl_getModuleURLFromAddress( pScriptIsComplex, &pModuleURL );
     rtl_uString* pModuleFileName = NULL;
     if( pModuleURL )
         osl_getSystemPathFromFileURL( pModuleURL, &pModuleFileName );
commit 1437b877391a5c3f79bbbcab415b83e1189e5617
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue May 8 16:07:01 2012 +0300

    Don't build against the debugging MSVC runtime in a dbgutil build either
    
    We don't use the debugging runtime in LO's own code in dbgutil builds,
    so we shouldn't use it in bundled libs either.
    
    (At one point I did try to use the debugging runtime in a dbgutil
    build, but had to give up eventually; too many compilation errors
    thanks to using -D_DEBUG which brings in much more strict checks in
    the C++ headers. I apparently forgot to fix these makefiles then when
    I aborted the attempt.)
    
    Change-Id: I I Iedf765b55ba71b811d7fe3074e4c3129783108fd

diff --git a/libxml2/makefile.mk b/libxml2/makefile.mk
index 558835e..6c7c069 100644
--- a/libxml2/makefile.mk
+++ b/libxml2/makefile.mk
@@ -99,9 +99,6 @@ BUILD_DIR=$(CONFIGURE_DIR)
 CONFIGURE_DIR=win32
 CONFIGURE_ACTION=cscript configure.js
 CONFIGURE_FLAGS=iconv=no sax1=yes
-.IF "$(dbgutil)"!=""
-CONFIGURE_FLAGS+=debug=yes
-.ENDIF
 BUILD_ACTION=nmake
 BUILD_DIR=$(CONFIGURE_DIR)
 .ENDIF
diff --git a/libxslt/makefile.mk b/libxslt/makefile.mk
index 80eeea5..7c86a4c 100644
--- a/libxslt/makefile.mk
+++ b/libxslt/makefile.mk
@@ -97,9 +97,6 @@ BUILD_DIR=$(CONFIGURE_DIR)
 CONFIGURE_DIR=win32
 CONFIGURE_ACTION=cscript configure.js
 #CONFIGURE_FLAGS=iconv=no sax1=yes
-.IF "$(dbgutil)"!=""
-CONFIGURE_FLAGS+=debug=yes
-.ENDIF
 BUILD_ACTION=nmake
 BUILD_DIR=$(CONFIGURE_DIR)
 .ENDIF
commit e38c3afab5bb5dbb38f2a6a065d97df19ec0c95a
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue May 8 12:32:11 2012 +0300

    No need to load the Uniscribe DLL dynamically; just use directly
    
    Change-Id: I706593f0017d440b486f698d1158f070df4e8b2e

diff --git a/solenv/gbuild/platform/WNT_INTEL_MSC.mk b/solenv/gbuild/platform/WNT_INTEL_MSC.mk
index 31af240..ed3425f 100644
--- a/solenv/gbuild/platform/WNT_INTEL_MSC.mk
+++ b/solenv/gbuild/platform/WNT_INTEL_MSC.mk
@@ -410,6 +410,7 @@ gb_Library_PLAINLIBS_NONE += \
 	shlwapi \
 	urlmon \
 	user32 \
+	usp10 \
 	uuid \
 	version \
 	wininet \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 92e35a2..9a259c3 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -583,6 +583,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
     ole32 \
     shell32 \
     uuid \
+	usp10 \
     uwinapi \
     winspool \
     version \
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 02fa03c..666212e 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1101,30 +1101,7 @@ private:
     bool           mbDisableGlyphInjection;
 };
 
-// -----------------------------------------------------------------------
-// dynamic loading of usp library
-
-static oslModule aUspModule = NULL;
-static bool bUspEnabled = true;
-
-static HRESULT ((WINAPI *pScriptIsComplex)( const WCHAR*, int, DWORD ));
-static HRESULT ((WINAPI *pScriptItemize)( const WCHAR*, int, int,
-    const SCRIPT_CONTROL*, const SCRIPT_STATE*, SCRIPT_ITEM*, int* ));
-static HRESULT ((WINAPI *pScriptShape)( HDC, SCRIPT_CACHE*, const WCHAR*,
-    int, int, SCRIPT_ANALYSIS*, WORD*, WORD*, SCRIPT_VISATTR*, int* ));
-static HRESULT ((WINAPI *pScriptPlace)( HDC, SCRIPT_CACHE*, const WORD*, int,
-    const SCRIPT_VISATTR*, SCRIPT_ANALYSIS*, int*, GOFFSET*, ABC* ));
-static HRESULT ((WINAPI *pScriptGetLogicalWidths)( const SCRIPT_ANALYSIS*,
-    int, int, const int*, const WORD*, const SCRIPT_VISATTR*, int* ));
-static HRESULT ((WINAPI *pScriptApplyLogicalWidth)( const int*, int, int, const WORD*,
-    const SCRIPT_VISATTR*, const int*, const SCRIPT_ANALYSIS*, ABC*, int* ));
-static HRESULT ((WINAPI *pScriptJustify)( const SCRIPT_VISATTR*,
-    const int*, int, int, int, int* ));
-static HRESULT ((WINAPI *pScriptTextOut)( const HDC, SCRIPT_CACHE*,
-    int, int, UINT, const RECT*, const SCRIPT_ANALYSIS*, const WCHAR*,
-    int, const WORD*, int, const int*, const int*, const GOFFSET* ));
-static HRESULT ((WINAPI *pScriptGetFontProperties)( HDC, SCRIPT_CACHE*, SCRIPT_FONTPROPERTIES* ));
-static HRESULT ((WINAPI *pScriptFreeCache)( SCRIPT_CACHE* ));
+static bool bUspInited = false;
 
 static bool bManualCellAlign = true;
 
@@ -1132,70 +1109,11 @@ static bool bManualCellAlign = true;
 
 static bool InitUSP()
 {
-    OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "usp10" ) );
-    aUspModule = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT );
-    if( !aUspModule )
-        return (bUspEnabled = false);
-
-    pScriptIsComplex = (HRESULT (WINAPI*)(const WCHAR*,int,DWORD))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptIsComplex" );
-    bUspEnabled &= (NULL != pScriptIsComplex);
-
-    pScriptItemize = (HRESULT (WINAPI*)(const WCHAR*,int,int,
-        const SCRIPT_CONTROL*,const SCRIPT_STATE*,SCRIPT_ITEM*,int*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptItemize" );
-    bUspEnabled &= (NULL != pScriptItemize);
-
-    pScriptShape = (HRESULT (WINAPI*)(HDC,SCRIPT_CACHE*,const WCHAR*,
-        int,int,SCRIPT_ANALYSIS*,WORD*,WORD*,SCRIPT_VISATTR*,int*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptShape" );
-    bUspEnabled &= (NULL != pScriptShape);
-
-    pScriptPlace = (HRESULT (WINAPI*)(HDC, SCRIPT_CACHE*, const WORD*, int,
-        const SCRIPT_VISATTR*,SCRIPT_ANALYSIS*,int*,GOFFSET*,ABC*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptPlace" );
-    bUspEnabled &= (NULL != pScriptPlace);
-
-    pScriptGetLogicalWidths = (HRESULT (WINAPI*)(const SCRIPT_ANALYSIS*,
-        int,int,const int*,const WORD*,const SCRIPT_VISATTR*,int*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptGetLogicalWidths" );
-    bUspEnabled &= (NULL != pScriptGetLogicalWidths);
-
-    pScriptApplyLogicalWidth = (HRESULT (WINAPI*)(const int*,int,int,const WORD*,
-        const SCRIPT_VISATTR*,const int*,const SCRIPT_ANALYSIS*,ABC*,int*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptApplyLogicalWidth" );
-    bUspEnabled &= (NULL != pScriptApplyLogicalWidth);
-
-    pScriptJustify = (HRESULT (WINAPI*)(const SCRIPT_VISATTR*,const int*,
-        int,int,int,int*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptJustify" );
-    bUspEnabled &= (NULL != pScriptJustify);
-
-    pScriptGetFontProperties = (HRESULT (WINAPI*)( HDC,SCRIPT_CACHE*,SCRIPT_FONTPROPERTIES*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptGetFontProperties" );
-    bUspEnabled &= (NULL != pScriptGetFontProperties);
-
-    pScriptTextOut = (HRESULT (WINAPI*)(const HDC,SCRIPT_CACHE*,
-        int,int,UINT,const RECT*,const SCRIPT_ANALYSIS*,const WCHAR*,
-        int,const WORD*,int,const int*,const int*,const GOFFSET*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptTextOut" );
-    bUspEnabled &= (NULL != pScriptTextOut);
-
-    pScriptFreeCache = (HRESULT (WINAPI*)(SCRIPT_CACHE*))
-        osl_getAsciiFunctionSymbol( aUspModule, "ScriptFreeCache" );
-    bUspEnabled &= (NULL != pScriptFreeCache);
-
-    if( !bUspEnabled )
-    {
-        osl_unloadModule( aUspModule );
-        aUspModule = NULL;
-    }
-
-    // get the DLL version info
+    // get the usp10.dll version info
     int nUspVersion = 0;
     // TODO: there must be a simpler way to get the friggin version info from OSL?
     rtl_uString* pModuleURL = NULL;
-    osl_getModuleURLFromAddress( (void*)pScriptIsComplex, &pModuleURL );
+    osl_getModuleURLFromAddress( (void*)ScriptIsComplex, &pModuleURL );
     rtl_uString* pModuleFileName = NULL;
     if( pModuleURL )
         osl_getSystemPathFromFileURL( pModuleURL, &pModuleFileName );
@@ -1221,7 +1139,9 @@ static bool InitUSP()
     if( nUspVersion >= 10600 )
         bManualCellAlign = false;
 
-    return bUspEnabled;
+    bUspInited = true;
+
+    return true;
 }
 
 // -----------------------------------------------------------------------
@@ -1328,7 +1248,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
     for( int nItemCapacity = 16;; nItemCapacity *= 8 )
     {
         mpScriptItems = new SCRIPT_ITEM[ nItemCapacity ];
-        HRESULT nRC = (*pScriptItemize)(
+        HRESULT nRC = ScriptItemize(
             reinterpret_cast<LPCWSTR>(rArgs.mpStr + mnSubStringMin), nSubStringEnd - mnSubStringMin,
             nItemCapacity - 1, &aScriptControl, &aScriptState,
             mpScriptItems, &mnItemCount );
@@ -1465,7 +1385,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
         // convert the unicodes to glyphs
         int nGlyphCount = 0;
         int nCharCount = rVisualItem.mnEndCharPos - rVisualItem.mnMinCharPos;
-        HRESULT nRC = (*pScriptShape)( mhDC, &rScriptCache,
+        HRESULT nRC = ScriptShape( mhDC, &rScriptCache,
             reinterpret_cast<LPCWSTR>(rArgs.mpStr + rVisualItem.mnMinCharPos),
             nCharCount,
             mnGlyphCapacity - rVisualItem.mnMinGlyphPos, // problem when >0xFFFF
@@ -1490,7 +1410,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
 
             // the primitive layout engine is good enough for the default layout
             rVisualItem.mpScriptItem->a.eScript = SCRIPT_UNDEFINED;
-            nRC = (*pScriptShape)( mhDC, &rScriptCache,
+            nRC = ScriptShape( mhDC, &rScriptCache,
                 reinterpret_cast<LPCWSTR>(rArgs.mpStr + rVisualItem.mnMinCharPos),
                 nCharCount,
                 mnGlyphCapacity - rVisualItem.mnMinGlyphPos,
@@ -1567,7 +1487,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
         }
 
         // now place the glyphs
-        nRC = (*pScriptPlace)( mhDC, &rScriptCache,
+        nRC = ScriptPlace( mhDC, &rScriptCache,
             mpOutGlyphs + rVisualItem.mnMinGlyphPos,
             nGlyphCount,
             mpVisualAttrs + rVisualItem.mnMinGlyphPos,
@@ -1580,7 +1500,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
             continue;
 
         // calculate the logical char widths from the glyph layout
-        nRC = (*pScriptGetLogicalWidths)(
+        nRC = ScriptGetLogicalWidths(
             &rVisualItem.mpScriptItem->a,
             nCharCount, nGlyphCount,
             mpGlyphAdvances + rVisualItem.mnMinGlyphPos,
@@ -2230,7 +2150,7 @@ void UniscribeLayout::DrawText( SalGraphics& ) const
         Point aRelPos( rVisualItem.mnXOffset + nBaseClusterOffset, 0 );
         Point aPos = GetDrawPosition( aRelPos );
         SCRIPT_CACHE& rScriptCache = GetScriptCache();
-        (*pScriptTextOut)( mhDC, &rScriptCache,
+        ScriptTextOut( mhDC, &rScriptCache,
             aPos.X(), aPos.Y(), 0, NULL,
             &rVisualItem.mpScriptItem->a, NULL, 0,
             mpOutGlyphs + nMinGlyphPos,
@@ -2488,7 +2408,7 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs )
         }
 
         // convert virtual charwidths to glyph justification values
-        HRESULT nRC = (*pScriptApplyLogicalWidth)(
+        HRESULT nRC = ScriptApplyLogicalWidth(
             mpCharWidths + rVisualItem.mnMinCharPos,
             rVisualItem.mnEndCharPos - rVisualItem.mnMinCharPos,
             rVisualItem.mnEndGlyphPos - rVisualItem.mnMinGlyphPos,
@@ -2723,7 +2643,7 @@ void UniscribeLayout::Justify( long nNewWidth )
                 nItemWidth += mpCharWidths[ i ];
             nItemWidth = (int)((fStretch - 1.0) * nItemWidth + 0.5);
 
-            (*pScriptJustify) (
+            ScriptJustify(
                 mpVisualAttrs + rVisualItem.mnMinGlyphPos,
                 mpGlyphAdvances + rVisualItem.mnMinGlyphPos,
                 rVisualItem.mnEndGlyphPos - rVisualItem.mnMinGlyphPos,
@@ -3002,7 +2922,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
 
 #if defined( USE_UNISCRIBE )
     if( !(rArgs.mnFlags & SAL_LAYOUT_COMPLEX_DISABLED)
-    &&   (aUspModule || (bUspEnabled && InitUSP())) )   // CTL layout engine
+    &&   (bUspInited || InitUSP()) )   // CTL layout engine
     {
 #ifdef ENABLE_GRAPHITE
         if (rFontFace.SupportsGraphite())
@@ -3079,7 +2999,7 @@ ImplWinFontEntry::~ImplWinFontEntry()
 {
 #ifdef USE_UNISCRIBE
     if( maScriptCache != NULL )
-        (*pScriptFreeCache)( &maScriptCache );
+        ScriptFreeCache( &maScriptCache );
 #endif // USE_UNISCRIBE
 #ifdef GCP_KERN_HACK
     delete[] mpKerningPairs;
@@ -3134,12 +3054,12 @@ bool ImplWinFontEntry::InitKashidaHandling( HDC hDC )
     mnMinKashidaWidth = 0;
     mnMinKashidaGlyph = 0;
 #ifdef USE_UNISCRIBE
-    if (aUspModule || (bUspEnabled && InitUSP()))
+    if (bUspInited || InitUSP())
     {
         SCRIPT_FONTPROPERTIES aFontProperties;
         aFontProperties.cBytes = sizeof (aFontProperties);
         SCRIPT_CACHE& rScriptCache = GetScriptCache();
-        HRESULT nRC = (*pScriptGetFontProperties)( hDC, &rScriptCache, &aFontProperties );
+        HRESULT nRC = ScriptGetFontProperties( hDC, &rScriptCache, &aFontProperties );
         if( nRC != 0 )
             return false;
         mnMinKashidaWidth = aFontProperties.iKashidaWidth;


More information about the Libreoffice-commits mailing list