rpms/openoffice.org/F-9 openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch, NONE, 1.1 openoffice.org.spec, 1.1486, 1.1487

Caolan McNamara (caolanm) fedora-extras-commits at redhat.com
Mon May 26 16:02:13 UTC 2008


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3811

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch 
Log Message:
Resolves: rhbz#445588 add openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch

openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch:

--- NEW FILE openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch ---
diff -ru psprint/inc/psprint/fontmanager.hxx psprint/inc/psprint/fontmanager.hxx
--- openoffice.org.orig/psprint/inc/psprint/fontmanager.hxx	2008-05-26 15:48:28.000000000 +0100
+++ openoffice.org/psprint/inc/psprint/fontmanager.hxx	2008-05-26 15:50:13.000000000 +0100
@@ -789,8 +789,8 @@
     FontConfigHints getFontConfigHints(const FastPrintFontInfo& rInfo, int nSize);
 
     rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, 
-        const rtl::OString& rLangAttrib, italic::type eItalic, weight::type eWeight, 
-        width::type eWidth, pitch::type ePitch) const;
+        const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight, 
+        width::type& rWidth, pitch::type& rPitch) const;
     bool hasFontconfig() const { return m_bFontconfigSuccess; }
 
     int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar );
diff -ru psprint/source/fontmanager/fontconfig.cxx psprint/source/fontmanager/fontconfig.cxx
--- openoffice.org.orig/psprint/source/fontmanager/fontconfig.cxx	2008-05-26 15:48:28.000000000 +0100
+++ openoffice.org/psprint/source/fontmanager/fontconfig.cxx	2008-05-26 16:07:30.000000000 +0100
@@ -581,6 +581,72 @@
     return true;
 }
 
+namespace
+{
+    weight::type convertWeight(int weight)
+    {
+        // set weight
+        if( weight <= FC_WEIGHT_THIN )
+            return weight::Thin;
+        else if( weight <= FC_WEIGHT_ULTRALIGHT )
+            return weight::UltraLight;
+        else if( weight <= FC_WEIGHT_LIGHT )
+            return weight::Light;
+        else if( weight <= FC_WEIGHT_BOOK )
+            return weight::SemiLight;
+        else if( weight <= FC_WEIGHT_NORMAL )
+            return weight::Normal;
+        else if( weight <= FC_WEIGHT_MEDIUM )
+            return weight::Medium;
+        else if( weight <= FC_WEIGHT_SEMIBOLD )
+            return weight::SemiBold;
+        else if( weight <= FC_WEIGHT_BOLD )
+            return weight::Bold;
+        else if( weight <= FC_WEIGHT_ULTRABOLD )
+            return weight::UltraBold;
+        return weight::Black;
+    }
+
+    italic::type convertSlant(int slant)
+    {
+        // set italic
+        if( slant == FC_SLANT_ITALIC )
+            return italic::Italic;
+        else if( slant == FC_SLANT_OBLIQUE )
+            return italic::Oblique;
+        return italic::Upright;
+    }
+
+    pitch::type convertSpacing(int spacing)
+    {
+        // set pitch
+        if( spacing == FC_MONO || spacing == FC_CHARCELL )
+            return pitch::Fixed;
+        return pitch::Variable;
+    }
+
+    width::type convertWidth(int width)
+    {
+        if (width == FC_WIDTH_ULTRACONDENSED)
+            return width::UltraCondensed;
+        else if (width == FC_WIDTH_EXTRACONDENSED)
+            return width::ExtraCondensed;
+        else if (width == FC_WIDTH_CONDENSED)
+            return width::Condensed;
+        else if (width == FC_WIDTH_SEMICONDENSED)
+            return width::SemiCondensed;
+        else if (width == FC_WIDTH_SEMIEXPANDED)
+            return width::SemiExpanded;
+        else if (width == FC_WIDTH_EXPANDED)
+            return width::Expanded;
+        else if (width == FC_WIDTH_EXTRAEXPANDED)
+            return width::ExtraExpanded;
+        else if (width == FC_WIDTH_ULTRAEXPANDED)
+            return width::UltraExpanded;
+        return width::Normal;
+    }
+}
+
 int PrintFontManager::countFontconfigFonts()
 {
     int nFonts = 0;
@@ -709,47 +775,11 @@
                     pUpdate->m_nFamilyName = nFamilyName;
                 }
                 if( eWeightRes == FcResultMatch )
-                {
-                    // set weight
-                    if( weight <= FC_WEIGHT_THIN )
-                        pUpdate->m_eWeight = weight::Thin;
-                    else if( weight <= FC_WEIGHT_ULTRALIGHT )
-                        pUpdate->m_eWeight = weight::UltraLight;
-                    else if( weight <= FC_WEIGHT_LIGHT )
-                        pUpdate->m_eWeight = weight::Light;
-                    else if( weight <= FC_WEIGHT_BOOK )
-                        pUpdate->m_eWeight = weight::SemiLight;
-                    else if( weight <= FC_WEIGHT_NORMAL )
-                        pUpdate->m_eWeight = weight::Normal;
-                    else if( weight <= FC_WEIGHT_MEDIUM )
-                        pUpdate->m_eWeight = weight::Medium;
-                    else if( weight <= FC_WEIGHT_SEMIBOLD )
-                        pUpdate->m_eWeight = weight::SemiBold;
-                    else if( weight <= FC_WEIGHT_BOLD )
-                        pUpdate->m_eWeight = weight::Bold;
-                    else if( weight <= FC_WEIGHT_ULTRABOLD )
-                        pUpdate->m_eWeight = weight::UltraBold;
-                    else
-                        pUpdate->m_eWeight = weight::Black;
-                }
+					pUpdate->m_eWeight = convertWeight(weight);
                 if( eSpacRes == FcResultMatch )
-                {
-                    // set pitch
-                    if( spacing == FC_PROPORTIONAL )
-                        pUpdate->m_ePitch = pitch::Variable;
-                    else if( spacing == FC_MONO || spacing == FC_CHARCELL )
-                        pUpdate->m_ePitch = pitch::Fixed;
-                }
+                    pUpdate->m_ePitch = convertSpacing(spacing);
                 if( eSlantRes == FcResultMatch )
-                {
-                    // set italic
-                    if( slant == FC_SLANT_ROMAN )
-                        pUpdate->m_eItalic = italic::Upright;
-                    else if( slant == FC_SLANT_ITALIC )
-                        pUpdate->m_eItalic = italic::Italic;
-                    else if( slant == FC_SLANT_OBLIQUE )
-                        pUpdate->m_eItalic = italic::Oblique;
-                }
+					pUpdate->m_eItalic = convertSlant(slant);
                 if( eStyleRes == FcResultMatch )
                 {
                     pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 );
@@ -888,8 +918,8 @@
 
 rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
     rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
-    italic::type eItalic, weight::type eWeight,
-    width::type eWidth, pitch::type ePitch) const
+    italic::type &rItalic, weight::type &rWeight,
+    width::type &rWidth, pitch::type &rPitch) const
 {
     rtl::OUString aName;
     FontCfgWrapper& rWrapper = FontCfgWrapper::get();
@@ -932,7 +962,7 @@
        rWrapper.FcCharSetDestroy( unicodes );
     }
 
-    addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch);
+    addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch);
 
     // query fontconfig for a substitute
     rWrapper.FcConfigSubstitute( rWrapper.getDefConfig(), pPattern, FcMatchPattern );
@@ -969,6 +999,18 @@
                 if (aI != rWrapper.m_aFontNameToLocalized.end())
                     sFamily = aI->second;
                 aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
+
+
+                fprintf(stderr, "incoming weight was %d\n", rWeight);
+                int val = 0;
+                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val))
+                    rWeight = convertWeight(val);
+                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val))
+                    rItalic = convertSlant(val);
+                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val))
+                    rPitch = convertSpacing(val);
+                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val))
+                    rWidth = convertWidth(val);
             }
 
 			// update rMissingCodes by removing resolved unicodes
diff -ru vcl/unx/source/gdi/salgdi3.cxx vcl/unx/source/gdi/salgdi3.cxx
--- openoffice.org.orig/vcl/unx/source/gdi/salgdi3.cxx	2008-05-26 16:46:52.000000000 +0100
+++ openoffice.org/vcl/unx/source/gdi/salgdi3.cxx	2008-05-26 16:46:28.000000000 +0100
@@ -2069,8 +2069,10 @@
 
 // -----------------------------------------------------------------------
 
-static rtl::OUString GetFcSubstitute(const ImplFontSelectData &rFontSelData, OUString& rMissingCodes )
+static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData, OUString& rMissingCodes )
 {
+    ImplFontSelectData aRet(rFontSelData);
+
     const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
 
     psp::italic::type eItalic = psp::italic::Unknown;
@@ -2138,7 +2140,72 @@
     }
 
     const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
-    return rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
+    aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
+
+    switch (eItalic)
+    {
+        case psp::italic::Upright: aRet.meItalic = ITALIC_NONE; break;
+        case psp::italic::Italic: aRet.meItalic = ITALIC_NORMAL; break;
+        case psp::italic::Oblique: aRet.meItalic = ITALIC_OBLIQUE; break;
+        default:
+            break;
+    }
+
+    switch (eWeight)
+    {
+        case psp::weight::Thin: aRet.meWeight = WEIGHT_THIN; break;
+        case psp::weight::UltraLight: aRet.meWeight = WEIGHT_ULTRALIGHT; break;
+        case psp::weight::Light: aRet.meWeight = WEIGHT_LIGHT; break;
+        case psp::weight::SemiLight: aRet.meWeight = WEIGHT_SEMILIGHT; break;
+        case psp::weight::Normal: aRet.meWeight = WEIGHT_NORMAL; break;
+        case psp::weight::Medium: aRet.meWeight = WEIGHT_MEDIUM; break;
+        case psp::weight::SemiBold: aRet.meWeight = WEIGHT_SEMIBOLD; break;
+        case psp::weight::Bold: aRet.meWeight = WEIGHT_BOLD; break;
+        case psp::weight::UltraBold: aRet.meWeight = WEIGHT_ULTRABOLD; break;
+        case psp::weight::Black: aRet.meWeight = WEIGHT_BLACK; break;
+        default:
+                break;
+    }
+
+    switch (eWidth)
+    {
+        case psp::width::UltraCondensed: aRet.meWidthType = WIDTH_ULTRA_CONDENSED; break;
+        case psp::width::ExtraCondensed: aRet.meWidthType = WIDTH_EXTRA_CONDENSED; break;
+        case psp::width::Condensed: aRet.meWidthType = WIDTH_CONDENSED; break;
+        case psp::width::SemiCondensed: aRet.meWidthType = WIDTH_SEMI_CONDENSED; break;
+        case psp::width::Normal: aRet.meWidthType = WIDTH_NORMAL; break;
+        case psp::width::SemiExpanded: aRet.meWidthType = WIDTH_SEMI_EXPANDED; break;
+        case psp::width::Expanded: aRet.meWidthType = WIDTH_EXPANDED; break;
+        case psp::width::ExtraExpanded: aRet.meWidthType = WIDTH_EXTRA_EXPANDED; break;
+        case psp::width::UltraExpanded: aRet.meWidthType = WIDTH_ULTRA_EXPANDED; break;
+        default:
+            break;
+    }
+
+    switch (ePitch)
+    {
+        case psp::pitch::Fixed: aRet.mePitch = PITCH_FIXED; break;
+        case psp::pitch::Variable: aRet.mePitch = PITCH_VARIABLE; break;
+        default:
+            break;
+    }
+
+    return aRet;
+}
+
+namespace
+{
+    bool uselessmatch(const ImplFontSelectData &rOrig, const ImplFontSelectData &rNew)
+    {
+        return
+          (
+            rOrig.maTargetName == rNew.maSearchName &&
+            rOrig.meWeight == rNew.meWeight &&
+            rOrig.meItalic == rNew.meItalic &&
+            rOrig.mePitch == rNew.mePitch &&
+            rOrig.meWidthType == rNew.meWidthType
+          );
+    }
 }
 
 //--------------------------------------------------------------------------
@@ -2154,20 +2221,19 @@
         return false;
 
     rtl::OUString aDummy;
-    const rtl::OUString aOUName = GetFcSubstitute( rFontSelData, aDummy );
-    if( !aOUName.getLength() )
+    const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy );
+    if (!aOut.maSearchName.Len())
         return false;
-    const String aName( aOUName );
-    if( aName == rFontSelData.maTargetName )
+    if( uselessmatch(rFontSelData, aOut ) )
         return false;
 
 #ifdef DEBUG
     ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
-    ByteString aSubstName( aName, RTL_TEXTENCODING_UTF8 );
+    ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
     printf( "FcPreMatchSubstititution \"%s\" -> \"%s\"\n",
         aOrigName.GetBuffer(), aSubstName.GetBuffer() );
 #endif
-    rFontSelData.maSearchName = aName;
+    rFontSelData = aOut;
     return true;
 }
 
@@ -2184,21 +2250,20 @@
     ||  0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
         return false;
 
-    const rtl::OUString aOUName = GetFcSubstitute( rFontSelData, rMissingCodes );
+    const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
     // TODO: cache the unicode+font specific result
-    if( !aOUName.getLength() )
+    if (!aOut.maSearchName.Len())
         return false;
-    const String aName( aOUName );
-    if( aName == rFontSelData.maTargetName )
+    if (uselessmatch(rFontSelData, aOut))
         return false;
 
 #ifdef DEBUG
     ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
-    ByteString aSubstName( aName, RTL_TEXTENCODING_UTF8 );
+    ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
     printf( "FcGlyphFallbackSubstititution \"%s\" -> \"%s\"\n",
         aOrigName.GetBuffer(), aSubstName.GetBuffer() );
 #endif
-    rFontSelData.maSearchName = aName;
+    rFontSelData = aOut;
     return true;
 }
 


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/F-9/openoffice.org.spec,v
retrieving revision 1.1486
retrieving revision 1.1487
diff -u -r1.1486 -r1.1487
--- openoffice.org.spec	22 May 2008 13:32:02 -0000	1.1486
+++ openoffice.org.spec	26 May 2008 16:00:03 -0000	1.1487
@@ -1,6 +1,6 @@
 %define oootag OOH680
 %define ooomilestone 12
-%define rh_rpm_release 10
+%define rh_rpm_release 11
 
 # undef to get english only and no-langpacks for a faster smoketest build
 %define langpacks 1
@@ -157,6 +157,7 @@
 Patch84: workspace.os114.patch
 Patch85: workspace.impress138.patch
 Patch86: openoffice.org-2.4.0.gcc36187.noaliasingbusted.patch
+Patch87: openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch
 
 %define instdir %{_libdir}/openoffice.org
 
@@ -1128,6 +1129,7 @@
 %patch84 -p1 -b .workspace.os114.patch
 %patch85 -p1 -b .workspace.impress138.patch
 %patch86 -p1 -b .gcc36187.noaliasingbusted.patch
+%patch87 -p1 -b .ooo87970.vcl.samenamesubs.patch
 
 %build
 echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -2914,6 +2916,9 @@
 
 
 %changelog
+* Mon May 26 2008 Caolan McNamara <caolanm at redhat.com> - 1:2.4.0-12.11-UNRELEASED
+- Resolves: rhbz#445588 add openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch
+
 * Thu May 22 2008 Caolan McNamara <caolanm at redhat.com> - 1:2.4.0-12.10
 - rebuild
 - Resolves: rhbz#447199 add workspace.impress138.patch




More information about the scm-commits mailing list