Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Sat, 2012-05-05 at 08:53 +0100, Caolán McNamara wrote:
How about just moving the fix down to FontList::Get in
svtools/source/control/ctrltool.cxx in the !pFontInfo font-is-unknown
branch to look up the font name in the unotools fontcvt
list-of-known-symbol-fonts-we-can-emulate and toggle it there to be a
symbol font ?

Like so maybe. But testing fdo#34814 the top .docx is unchanged-broken
after import by this or the other patch, and new .docxs created from
scratch are unchanged-working either way. *shrug* whatever works.

C.
From 36e4ad180e6c533602afbfe737ea8aab1232a744 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 8 May 2012 16:08:16 +0100
Subject: [PATCH] Related: fdo#34814 check if a missing font is a known symbol
 font

Change-Id: I85f8e3fe7a30a59b2e458706b927d8f9c3a65abc

diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 01459ad..3fdd515 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;
 
-- 
1.7.7.6


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.