rpms/openoffice.org/devel openoffice.org-1.9.129.ooo54603.fontconfig.part4.patch, NONE, 1.1 openoffice.org.spec, 1.913, 1.914
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Nov 6 09:31:06 UTC 2006
Author: caolanm
Update of /cvs/dist/rpms/openoffice.org/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv32006
Modified Files:
openoffice.org.spec
Added Files:
openoffice.org-1.9.129.ooo54603.fontconfig.part4.patch
Log Message:
add localized fontnames
openoffice.org-1.9.129.ooo54603.fontconfig.part4.patch:
inc/psprint/fontmanager.hxx | 2
source/fontmanager/fontconfig.cxx | 98 +++++++++++++++++++++++++++++++++++++-
2 files changed, 98 insertions(+), 2 deletions(-)
--- NEW FILE openoffice.org-1.9.129.ooo54603.fontconfig.part4.patch ---
diff -u -r psprint/inc/psprint/fontmanager.hxx psprint/inc/psprint/fontmanager.hxx
--- openoffice.org.orig/psprint/inc/psprint/fontmanager.hxx 2006-11-03 13:23:14.000000000 +0000
+++ openoffice.org/psprint/inc/psprint/fontmanager.hxx 2006-11-06 08:41:56.000000000 +0000
@@ -451,6 +451,8 @@
std::hash_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode;
std::hash_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode;
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontconfigNameToLocalized;
+
mutable FontCache* m_pFontCache;
bool m_bFontconfigSuccess;
diff -u -r psprint/source/fontmanager/fontconfig.cxx psprint/source/fontmanager/fontconfig.cxx
--- openoffice.org.orig/psprint/source/fontmanager/fontconfig.cxx 2006-11-03 13:23:14.000000000 +0000
+++ openoffice.org/psprint/source/fontmanager/fontconfig.cxx 2006-11-06 08:46:55.000000000 +0000
@@ -75,6 +75,15 @@
#ifndef _RTL_USTRBUF_HXX
#include <rtl/ustrbuf.hxx>
#endif
+#ifndef _OSL_PROCESS_H_
+#include <osl/process.h>
+#endif
+#ifndef _RTL_LOCALE_HXX_
+#include <rtl/locale.hxx>
+#endif
+#include <utility>
+#include <algorithm>
+
using namespace psp;
using namespace osl;
@@ -412,6 +421,84 @@
#define FC_EMBEDDED_BITMAP "embeddedbitmap"
#endif
+namespace
+{
+ typedef std::pair<FcChar8*, FcChar8*> lang_and_family;
+
+ class localizedsorter
+ {
+ rtl::OLocale maLoc;
+ public:
+ localizedsorter(rtl_Locale* pLoc) : maLoc(pLoc) {}
+ FcChar8* bestname(const std::vector<lang_and_family> &families);
+ };
+
+ FcChar8* localizedsorter::bestname(const std::vector<lang_and_family> &families)
+ {
+ FcChar8* candidate = families.begin()->second;
+ rtl::OString sLangMatch(rtl::OUStringToOString(maLoc.getLanguage().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8));
+ rtl::OString sFullMatch = sLangMatch;
+ sFullMatch += OString('-');
+ sFullMatch += rtl::OUStringToOString(maLoc.getCountry().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8);
+
+ std::vector<lang_and_family>::const_iterator aEnd = families.end();
+ for (std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter)
+ {
+ const char *pLang = (const char*)aIter->first;
+ //perfect
+ if (strcmp(pLang, sFullMatch.getStr()) == 0)
+ {
+ candidate = aIter->second;
+ break;
+ }
+ else if (strcmp(pLang, sLangMatch.getStr()) == 0)
+ candidate = aIter->second;
+ }
+
+ return candidate;
+ }
+
+
+ FcResult lcl_FamilyFromPattern(FontCfgWrapper& rWrapper, FcPattern* pPattern, FcChar8 **family,
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > &aFontconfigNameToLocalized)
+ {
+ FcChar8 *origfamily;
+ FcResult eFamilyRes = rWrapper.FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily );
+ *family = origfamily;
+
+ if( eFamilyRes == FcResultMatch)
+ {
+ FcChar8* familylang = NULL;
+ if (rWrapper.FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch)
+ {
+ std::vector< lang_and_family > lang_and_families;
+ lang_and_families.push_back(lang_and_family(familylang, *family));
+ int k = 1;
+ while (1)
+ {
+ if (rWrapper.FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch)
+ break;
+ if (rWrapper.FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch)
+ break;
+ lang_and_families.push_back(lang_and_family(familylang, *family));
+ ++k;
+ }
+
+ //possible to-do, sort by UILocale instead of process locale
+ rtl_Locale* pLoc;
+ osl_getProcessLocale(&pLoc);
+ localizedsorter aSorter(pLoc);
+ *family = aSorter.bestname(lang_and_families);
+ if (strcmp((const char*)origfamily, (const char*)(*family)) != 0)
+ aFontconfigNameToLocalized[OString((const char*)origfamily)] = OString((const char*)(*family));
+ }
+ }
+
+ return eFamilyRes;
+ }
+}
+
+
/*
* PrintFontManager::initFontconfig
*/
@@ -443,7 +530,7 @@
FcBool outline = false;
FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file );
- FcResult eFamilyRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FAMILY, 0, &family );
+ FcResult eFamilyRes = lcl_FamilyFromPattern(rWrapper, pFSet->fonts[i], &family, m_aFontconfigNameToLocalized );
FcResult eStyleRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_STYLE, 0, &style );
FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant );
FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight );
@@ -763,8 +850,15 @@
//extract the closest match
FcChar8* family = NULL;
FcResult eFileRes = rWrapper.FcPatternGetString( pSet->fonts[0], FC_FAMILY, 0, &family );
+
if( eFileRes == FcResultMatch )
- aName = String( (sal_Char*)family, RTL_TEXTENCODING_UTF8 );
+ {
+ OString sFamily((sal_Char*)family);
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = m_aFontconfigNameToLocalized.find(sFamily);
+ if (aI != m_aFontconfigNameToLocalized.end())
+ sFamily = aI->second;
+ aName = String( sFamily.getStr(), RTL_TEXTENCODING_UTF8 );
+ }
if (!rGlyphs.empty() )
{
Index: openoffice.org.spec
===================================================================
RCS file: /cvs/dist/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.913
retrieving revision 1.914
diff -u -r1.913 -r1.914
--- openoffice.org.spec 5 Nov 2006 17:41:09 -0000 1.913
+++ openoffice.org.spec 6 Nov 2006 09:31:04 -0000 1.914
@@ -125,6 +125,7 @@
Patch59: openoffice.org-2.0.4.ooo71077.sc.purevirtual.patch
Patch60: openoffice.org-2.1.0.ooo71111.sfx2.x86_64.patch
Patch61: workspace.gtkquickstart2.patch
+Patch62: openoffice.org-1.9.129.ooo54603.fontconfig.part4.patch
%define instdir %{_libdir}/openoffice.org2.1
@@ -986,6 +987,7 @@
%patch59 -p1 -b .ooo71077.sc.purevirtual.patch
%patch60 -p1 -b .ooo71111.sfx2.x86_64.patch
%patch61 -p1 -b .workspace.gtkquickstart2.patch
+%patch62 -p1 -b .ooo54603.fontconfig.part4.patch
tar xzf %{SOURCE1}
@@ -1550,6 +1552,7 @@
%{instdir}/program/libdict_ja.so
%{instdir}/program/libdict_zh.so
%{instdir}/program/libdtransX11680*.so
+%{instdir}/program/libeggtray680*.so
%{instdir}/program/libembobj.so
%{instdir}/program/libemboleobj.so
%{instdir}/program/libevoab*.so
@@ -1627,6 +1630,7 @@
%{instdir}/program/libpreload680*.so
%{instdir}/program/libprotocolhandler680*.so
%{instdir}/program/libpsp680*.so
+%{instdir}/program/libqstart_gtk680*.so
%{instdir}/program/librecentfile.so
%{instdir}/program/libreg.so
%{instdir}/program/libreg.so.3
@@ -1967,6 +1971,7 @@
%{instdir}/share/registry/schema/org/openoffice/Office/Scripting.xcs
%{instdir}/share/registry/schema/org/openoffice/Office/Security.xcs
%{instdir}/share/registry/schema/org/openoffice/Office/Substitution.xcs
+%{instdir}/share/registry/schema/org/openoffice/Office/TabBrowse.xcs
%{instdir}/share/registry/schema/org/openoffice/Office/TableWizard.xcs
%{instdir}/share/registry/schema/org/openoffice/Office/TypeDetection.xcs
%dir %{instdir}/share/registry/schema/org/openoffice/Office/UI
@@ -2531,6 +2536,8 @@
- add openoffice.org-2.1.0.ooo71111.sfx2.x86_64.patch
- add workspace.gtkquickstart2.patch
- add workspace.gtkquickstart2.patch
+- add openoffice.org-1.9.129.ooo54603.fontconfig.part4.patch for localized
+ fontnames
- Estonian dictionaries added
* Wed Nov 01 2006 Caolan McNamara <caolanm at redhat.com> - 1:2.0.4-5.7
More information about the fedora-cvs-commits
mailing list