summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-08 16:08:16 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-05-09 15:10:27 +0200
commit13e6af8860f42daf49474a7ae9779baa0f8f2630 (patch)
tree065942a78ef38bb14051f4a2424eeb733a8b7ef8
parent2221e0a0be16ffc0402b336ad308feff8a693a8a (diff)
Related: fdo#34814 check if a missing font is a known symbol font
Change-Id: I85f8e3fe7a30a59b2e458706b927d8f9c3a65abc
-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 01459ad1f20a..3fdd51529ece 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -583,7 +583,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("OpenSymbol")))
+ aInfo.SetCharSet(RTL_TEXTENCODING_SYMBOL);
+
+ return aInfo;
+ }
+}
FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) const
{
@@ -612,54 +635,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;
@@ -700,17 +719,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;