summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-08 15:08:16 (GMT)
committerLuboš Luňák <l.lunak@suse.cz>2012-05-09 13:47:55 (GMT)
commit1dc9f21667237bf61ec8d2a9e50b7fb8a61d475b (patch)
treed33117d2bd6a773fa5a3257ad8fd5ff104673b40
parenta91f9b10edc31f3c4ad7209f97924990cc5b6796 (diff)
Related: fdo#34814 check if a missing font is a known symbol font
Change-Id: I85f8e3fe7a30a59b2e458706b927d8f9c3a65abc Signed-off-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r--svtools/source/control/ctrltool.cxx79
1 files changed, 44 insertions, 35 deletions
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 146f47e..b38d782 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -595,7 +595,30 @@ XubString FontList::GetFontMapText( const FontInfo& rInfo ) const
}
}
-// -----------------------------------------------------------------------
+namespace
+{
+ FontInfo makeMissing(ImplFontListFontInfo* pFontNameInfo, const rtl::OUString &rName,
+ FontWeight eWeight, FontItalic eItalic)
+ {
+ FontInfo aInfo;
+ // Falls der Fontname stimmt, uebernehmen wir soviel wie moeglich
+ if (pFontNameInfo)
+ {
+ aInfo = *pFontNameInfo;
+ aInfo.SetStyleName(rtl::OUString());
+ }
+
+ aInfo.SetWeight(eWeight);
+ aInfo.SetItalic(eItalic);
+
+ //If this is a known but uninstalled symbol font which we can remap to
+ //OpenSymbol then toggle its charset to be a symbol font
+ if (ConvertChar::GetRecodeData(rName, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenSymbol"))))
+ aInfo.SetCharSet(RTL_TEXTENCODING_SYMBOL);
+
+ return aInfo;
+ }
+}
FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) const
{
@@ -624,54 +647,50 @@ FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) co
FontInfo aInfo;
if ( !pFontInfo )
{
- if ( pFontNameInfo )
- aInfo = *pFontNameInfo;
+ FontWeight eWeight = WEIGHT_DONTKNOW;
+ FontItalic eItalic = ITALIC_NONE;
if ( rStyleName == maNormal )
{
- aInfo.SetItalic( ITALIC_NONE );
- aInfo.SetWeight( WEIGHT_NORMAL );
+ eItalic = ITALIC_NONE;
+ eWeight = WEIGHT_NORMAL;
}
else if ( rStyleName == maNormalItalic )
{
- aInfo.SetItalic( ITALIC_NORMAL );
- aInfo.SetWeight( WEIGHT_NORMAL );
+ eItalic = ITALIC_NORMAL;
+ eWeight = WEIGHT_NORMAL;
}
else if ( rStyleName == maBold )
{
- aInfo.SetItalic( ITALIC_NONE );
- aInfo.SetWeight( WEIGHT_BOLD );
+ eItalic = ITALIC_NONE;
+ eWeight = WEIGHT_BOLD;
}
else if ( rStyleName == maBoldItalic )
{
- aInfo.SetItalic( ITALIC_NORMAL );
- aInfo.SetWeight( WEIGHT_BOLD );
+ eItalic = ITALIC_NORMAL;
+ eWeight = WEIGHT_BOLD;
}
else if ( rStyleName == maLight )
{
- aInfo.SetItalic( ITALIC_NONE );
- aInfo.SetWeight( WEIGHT_LIGHT );
+ eItalic = ITALIC_NONE;
+ eWeight = WEIGHT_LIGHT;
}
else if ( rStyleName == maLightItalic )
{
- aInfo.SetItalic( ITALIC_NORMAL );
- aInfo.SetWeight( WEIGHT_LIGHT );
+ eItalic = ITALIC_NORMAL;
+ eWeight = WEIGHT_LIGHT;
}
else if ( rStyleName == maBlack )
{
- aInfo.SetItalic( ITALIC_NONE );
- aInfo.SetWeight( WEIGHT_BLACK );
+ eItalic = ITALIC_NONE;
+ eWeight = WEIGHT_BLACK;
}
else if ( rStyleName == maBlackItalic )
{
- aInfo.SetItalic( ITALIC_NORMAL );
- aInfo.SetWeight( WEIGHT_BLACK );
- }
- else
- {
- aInfo.SetItalic( ITALIC_NONE );
- aInfo.SetWeight( WEIGHT_DONTKNOW );
+ eItalic = ITALIC_NORMAL;
+ eWeight = WEIGHT_BLACK;
}
+ aInfo = makeMissing(pFontNameInfo, rName, eWeight, eItalic);
}
else
aInfo = *pFontInfo;
@@ -712,17 +731,7 @@ FontInfo FontList::Get( const XubString& rName,
// Attribute nachgebildet werden
FontInfo aInfo;
if ( !pFontInfo )
- {
- // Falls der Fontname stimmt, uebernehmen wir soviel wie moeglich
- if ( pFontNameInfo )
- {
- aInfo = *pFontNameInfo;
- aInfo.SetStyleName( XubString() );
- }
-
- aInfo.SetWeight( eWeight );
- aInfo.SetItalic( eItalic );
- }
+ aInfo = makeMissing(pFontNameInfo, rName, eWeight, eItalic);
else
aInfo = *pFontInfo;