[PATCH] Replaced psp::width::type with FontWidth

Christina Rossmanith ChrRossmanith at web.de
Tue Apr 5 11:54:37 PDT 2011


---
 vcl/inc/vcl/fontmanager.hxx                |   16 ++--
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx   |   23 ++++---
 vcl/unx/headless/svppspgraphics.cxx        |   20 +-----
 vcl/unx/headless/svppspgraphics.hxx        |    1 -
 vcl/unx/inc/pspgraphics.h                  |    2 +-
 vcl/unx/kde/salnativewidgets-kde.cxx       |   21 +++---
 vcl/unx/source/fontmanager/fontcache.cxx   |    2 +-
 vcl/unx/source/fontmanager/fontconfig.cxx  |   48 +++++++-------
 vcl/unx/source/fontmanager/fontmanager.cxx |   42 ++++++------
 vcl/unx/source/gdi/pspgraphics.cxx         |   23 +------
 vcl/unx/source/gdi/salgdi3.cxx             |   99 ++++++++++------------------
 11 files changed, 115 insertions(+), 182 deletions(-)

diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx
index bb03bc3..632e304 100644
--- a/vcl/inc/vcl/fontmanager.hxx
+++ b/vcl/inc/vcl/fontmanager.hxx
@@ -36,7 +36,7 @@
 
 #include "vcl/dllapi.h"
 #include "vcl/helper.hxx"
-
+#include "vcl/vclenum.hxx"
 #include "com/sun/star/lang/Locale.hpp"
 
 #include <vector>
@@ -162,7 +162,7 @@ struct FastPrintFontInfo
     std::list< rtl::OUString >			m_aAliases;
     family::type            			m_eFamilyStyle;
     italic::type            			m_eItalic;
-    width::type             			m_eWidth;
+    FontWidth             			    m_eWidth;
     weight::type            			m_eWeight;
     pitch::type             			m_ePitch;
     rtl_TextEncoding        			m_aEncoding;
@@ -174,7 +174,7 @@ struct FastPrintFontInfo
             m_eType( fonttype::Unknown ),
             m_eFamilyStyle( family::Unknown ),
             m_eItalic( italic::Unknown ),
-            m_eWidth( width::Unknown ),
+            m_eWidth( WIDTH_DONTKNOW ),
             m_eWeight( weight::Unknown ),
             m_ePitch( pitch::Unknown ),
             m_aEncoding( RTL_TEXTENCODING_DONTKNOW )
@@ -276,7 +276,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
         int                                         m_nPSName;      // atom
         rtl::OUString                               m_aStyleName;
         italic::type                                m_eItalic;
-        width::type                                 m_eWidth;
+        FontWidth                                   m_eWidth;
         weight::type                                m_eWeight;
         pitch::type                                 m_ePitch;
         rtl_TextEncoding                            m_aEncoding;
@@ -360,7 +360,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
         rtl::OString		aAddStyle;
         italic::type		eItalic;
         weight::type		eWeight;
-        width::type			eWidth;
+        FontWidth			eWidth;
         pitch::type			ePitch;
         rtl_TextEncoding	aEncoding;
 
@@ -521,10 +521,10 @@ public:
     }
 
     // get a specific fonts width type
-    width::type getFontWidth( fontID nFontID ) const
+    FontWidth getFontWidth( fontID nFontID ) const
     {
         PrintFont* pFont = getFont( nFontID );
-        return pFont ? pFont->m_eWidth : width::Unknown;
+        return pFont ? pFont->m_eWidth : WIDTH_DONTKNOW;
     }
 
     // get a specific fonts weight type
@@ -737,7 +737,7 @@ public:
 
     rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes,
         const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight,
-        width::type& rWidth, pitch::type& rPitch) const;
+        FontWidth& rWidth, pitch::type& rPitch) const;
     bool hasFontconfig() const { return m_bFontconfigSuccess; }
 
     int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar );
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index e1d12ce..296cbc2 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -45,6 +45,7 @@
 #include "saldata.hxx"
 #include "saldisp.hxx"
 #include "vcl/svapp.hxx"
+#include "vcl/vclenum.hxx"
 
 typedef struct _cairo_font_options cairo_font_options_t;
 
@@ -3416,15 +3417,15 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     // set width
     switch( eStretch )
     {
-        case PANGO_STRETCH_ULTRA_CONDENSED:	aInfo.m_eWidth = psp::width::UltraCondensed;break;
-        case PANGO_STRETCH_EXTRA_CONDENSED:	aInfo.m_eWidth = psp::width::ExtraCondensed;break;
-        case PANGO_STRETCH_CONDENSED:		aInfo.m_eWidth = psp::width::Condensed;break;
-        case PANGO_STRETCH_SEMI_CONDENSED:	aInfo.m_eWidth = psp::width::SemiCondensed;break;
-        case PANGO_STRETCH_NORMAL:			aInfo.m_eWidth = psp::width::Normal;break;
-        case PANGO_STRETCH_SEMI_EXPANDED:	aInfo.m_eWidth = psp::width::SemiExpanded;break;
-        case PANGO_STRETCH_EXPANDED:		aInfo.m_eWidth = psp::width::Expanded;break;
-        case PANGO_STRETCH_EXTRA_EXPANDED:	aInfo.m_eWidth = psp::width::ExtraExpanded;break;
-        case PANGO_STRETCH_ULTRA_EXPANDED:	aInfo.m_eWidth = psp::width::UltraExpanded;break;
+        case PANGO_STRETCH_ULTRA_CONDENSED:	aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;break;
+        case PANGO_STRETCH_EXTRA_CONDENSED:	aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;break;
+        case PANGO_STRETCH_CONDENSED:		aInfo.m_eWidth = WIDTH_CONDENSED;break;
+        case PANGO_STRETCH_SEMI_CONDENSED:	aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;break;
+        case PANGO_STRETCH_NORMAL:			aInfo.m_eWidth = WIDTH_NORMAL;break;
+        case PANGO_STRETCH_SEMI_EXPANDED:	aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;break;
+        case PANGO_STRETCH_EXPANDED:		aInfo.m_eWidth = WIDTH_EXPANDED;break;
+        case PANGO_STRETCH_EXTRA_EXPANDED:	aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;break;
+        case PANGO_STRETCH_ULTRA_EXPANDED:	aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;break;
     }
 
 #if OSL_DEBUG_LEVEL > 1
@@ -3453,8 +3454,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
     if( aInfo.m_eWeight != psp::weight::Unknown )
         aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
-    if( aInfo.m_eWidth != psp::width::Unknown )
-        aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
+    if( aInfo.m_eWidth != WIDTH_DONTKNOW )
+        aFont.SetWidthType( aInfo.m_eWidth );
     if( aInfo.m_eItalic != psp::italic::Unknown )
         aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
     if( aInfo.m_ePitch != psp::pitch::Unknown )
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 2ddbff1..fa8b98f 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -1078,24 +1078,6 @@ void PspGraphics::DoGetGlyphWidths( psp::fontID aFont,
 
 // ----------------------------------------------------------------------------
 
-FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth)
-{
-    switch (eWidth)
-    {
-        case psp::width::UltraCondensed: return WIDTH_ULTRA_CONDENSED;
-        case psp::width::ExtraCondensed: return WIDTH_EXTRA_CONDENSED;
-        case psp::width::Condensed:		 return WIDTH_CONDENSED;
-        case psp::width::SemiCondensed:	 return WIDTH_SEMI_CONDENSED;
-        case psp::width::Normal:		 return WIDTH_NORMAL;
-        case psp::width::SemiExpanded:	 return WIDTH_SEMI_EXPANDED;
-        case psp::width::Expanded:		 return WIDTH_EXPANDED;
-        case psp::width::ExtraExpanded:	 return WIDTH_EXTRA_EXPANDED;
-        case psp::width::UltraExpanded:	 return WIDTH_ULTRA_EXPANDED;
-        default: break;
-    }
-    return WIDTH_DONTKNOW;
-}
-
 FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight)
 {
     switch (eWeight)
@@ -1161,7 +1143,7 @@ ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintF
     aDFA.meFamily       = ToFontFamily (rInfo.m_eFamilyStyle);
     aDFA.meWeight       = ToFontWeight (rInfo.m_eWeight);
     aDFA.meItalic       = ToFontItalic (rInfo.m_eItalic);
-    aDFA.meWidthType    = ToFontWidth (rInfo.m_eWidth);
+    aDFA.meWidthType    = rInfo.m_eWidth;
     aDFA.mePitch        = ToFontPitch (rInfo.m_ePitch);
     aDFA.mbSymbolFlag   = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL);
 
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index a1371fd..0428bbb 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -79,7 +79,6 @@ public:
                                   Ucs2UIntMap& rUnicodeEnc );
     static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& );
     static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& );
-    static FontWidth	ToFontWidth (psp::width::type eWidth);
     static FontWeight	ToFontWeight (psp::weight::type eWeight);
     static FontPitch	ToFontPitch (psp::pitch::type ePitch);
     static FontItalic	ToFontItalic (psp::italic::type eItalic);
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index 717adbd..25213f6 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -34,6 +34,7 @@
 #include "vcl/salgdi.hxx"
 #include "vcl/sallayout.hxx"
 #include "vcl/dllapi.h"
+#include "vcl/vclenum.hxx"
 
 namespace psp { struct JobData; class PrinterGfx; }
 
@@ -76,7 +77,6 @@ public:
 
     static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& );
     static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& );
-    static FontWidth	ToFontWidth (psp::width::type eWidth);
     static FontWeight	ToFontWeight (psp::weight::type eWeight);
     static FontPitch	ToFontPitch (psp::pitch::type ePitch);
     static FontItalic	ToFontItalic (psp::italic::type eItalic);
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index f92687c..ba1db46 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -40,6 +40,7 @@
 
 #include <salframe.h>
 #include <vcl/settings.hxx>
+#include <vcl/vclenum.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <plugins/kde/kdedata.hxx>
 #include <iostream>
@@ -1778,23 +1779,23 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r
     // set width
     int nStretch = rQFont.stretch();
     if ( nStretch <= QFont::UltraCondensed )
-        aInfo.m_eWidth = psp::width::UltraCondensed;
+        aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;
     else if ( nStretch <= QFont::ExtraCondensed )
-        aInfo.m_eWidth = psp::width::ExtraCondensed;
+        aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;
     else if ( nStretch <= QFont::Condensed )
-        aInfo.m_eWidth = psp::width::Condensed;
+        aInfo.m_eWidth = WIDTH_CONDENSED;
     else if ( nStretch <= QFont::SemiCondensed )
-        aInfo.m_eWidth = psp::width::SemiCondensed;
+        aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;
     else if ( nStretch <= QFont::Unstretched )
-        aInfo.m_eWidth = psp::width::Normal;
+        aInfo.m_eWidth = WIDTH_NORMAL;
     else if ( nStretch <= QFont::SemiExpanded )
-        aInfo.m_eWidth = psp::width::SemiExpanded;
+        aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;
     else if ( nStretch <= QFont::Expanded )
-        aInfo.m_eWidth = psp::width::Expanded;
+        aInfo.m_eWidth = WIDTH_EXPANDED;
     else if ( nStretch <= QFont::ExtraExpanded )
-        aInfo.m_eWidth = psp::width::ExtraExpanded;
+        aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;
     else
-        aInfo.m_eWidth = psp::width::UltraExpanded;
+        aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;
     
 #if OSL_DEBUG_LEVEL > 1
     fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
@@ -1818,7 +1819,7 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r
     Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
     if( aInfo.m_eWeight != psp::weight::Unknown )
         aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
-    if( aInfo.m_eWidth != psp::width::Unknown )
+    if( aInfo.m_eWidth != WIDTH_DONTKNOW )
         aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
     if( aInfo.m_eItalic != psp::italic::Unknown )
         aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
diff --git a/vcl/unx/source/fontmanager/fontcache.cxx b/vcl/unx/source/fontmanager/fontcache.cxx
index b322761..c24d2d7 100644
--- a/vcl/unx/source/fontmanager/fontcache.cxx
+++ b/vcl/unx/source/fontmanager/fontcache.cxx
@@ -410,7 +410,7 @@ void FontCache::read()
                 pFont->m_nPSName    = pAtoms->getAtom( ATOM_PSNAME, OUString( pLine + nTokenPos[1], nTokenPos[2]-nTokenPos[1]-1, RTL_TEXTENCODING_UTF8 ), sal_True );
                 pFont->m_eItalic    = (italic::type)atoi( pLine+nTokenPos[2] );
                 pFont->m_eWeight    = (weight::type)atoi( pLine+nTokenPos[3] );
-                pFont->m_eWidth     = (width::type)atoi( pLine+nTokenPos[4] );
+                pFont->m_eWidth     = (FontWidth)atoi( pLine+nTokenPos[4] );
                 pFont->m_ePitch     = (pitch::type)atoi( pLine+nTokenPos[5] );
                 pFont->m_aEncoding  = (rtl_TextEncoding)atoi( pLine+nTokenPos[6] );
                 pFont->m_nAscend    = atoi( pLine + nTokenPos[7] );
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 8c67c99..c2e0c67 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -32,6 +32,7 @@
 #include "vcl/fontmanager.hxx"
 #include "vcl/fontcache.hxx"
 #include "vcl/impfont.hxx"
+#include "vcl/vclenum.hxx"
 
 using namespace psp;
 
@@ -734,25 +735,26 @@ namespace
         return pitch::Variable;
     }
 
-    width::type convertWidth(int width)
+    // translation: fontconfig enum -> vcl enum
+    FontWidth convertWidth(int width)
     {
         if (width == FC_WIDTH_ULTRACONDENSED)
-            return width::UltraCondensed;
+            return WIDTH_ULTRA_CONDENSED;
         else if (width == FC_WIDTH_EXTRACONDENSED)
-            return width::ExtraCondensed;
+            return WIDTH_EXTRA_CONDENSED;
         else if (width == FC_WIDTH_CONDENSED)
-            return width::Condensed;
+            return WIDTH_CONDENSED;
         else if (width == FC_WIDTH_SEMICONDENSED)
-            return width::SemiCondensed;
+            return WIDTH_SEMI_CONDENSED;
         else if (width == FC_WIDTH_SEMIEXPANDED)
-            return width::SemiExpanded;
+            return WIDTH_SEMI_EXPANDED;
         else if (width == FC_WIDTH_EXPANDED)
-            return width::Expanded;
+            return WIDTH_EXPANDED;
         else if (width == FC_WIDTH_EXTRAEXPANDED)
-            return width::ExtraExpanded;
+            return WIDTH_EXTRA_EXPANDED;
         else if (width == FC_WIDTH_ULTRAEXPANDED)
-            return width::UltraExpanded;
-        return width::Normal;
+            return WIDTH_ULTRA_EXPANDED;
+        return WIDTH_NORMAL;
     }
 }
 
@@ -973,7 +975,7 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName )
 }
 
 static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, 
-    italic::type eItalic, weight::type eWeight, width::type eWidth, pitch::type ePitch)
+    italic::type eItalic, weight::type eWeight, FontWidth eWidth, pitch::type ePitch)
 {
     if( eItalic != italic::Unknown )
     {
@@ -1007,20 +1009,20 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
         }
         rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight );
     }
-    if( eWidth != width::Unknown )
+    if( eWidth != WIDTH_DONTKNOW )
     {
         int nWidth = FC_WIDTH_NORMAL;
         switch( eWidth )
         {
-            case width::UltraCondensed:	nWidth = FC_WIDTH_ULTRACONDENSED;break;
-            case width::ExtraCondensed: nWidth = FC_WIDTH_EXTRACONDENSED;break;
-            case width::Condensed:		nWidth = FC_WIDTH_CONDENSED;break;
-            case width::SemiCondensed:	nWidth = FC_WIDTH_SEMICONDENSED;break;
-            case width::Normal:			nWidth = FC_WIDTH_NORMAL;break;
-            case width::SemiExpanded:	nWidth = FC_WIDTH_SEMIEXPANDED;break;
-            case width::Expanded:		nWidth = FC_WIDTH_EXPANDED;break;
-            case width::ExtraExpanded:	nWidth = FC_WIDTH_EXTRAEXPANDED;break;
-            case width::UltraExpanded:	nWidth = FC_WIDTH_ULTRACONDENSED;break;
+            case WIDTH_ULTRA_CONDENSED:	nWidth = FC_WIDTH_ULTRACONDENSED;break;
+            case WIDTH_EXTRA_CONDENSED: nWidth = FC_WIDTH_EXTRACONDENSED;break;
+            case WIDTH_CONDENSED:		nWidth = FC_WIDTH_CONDENSED;break;
+            case WIDTH_SEMI_CONDENSED:	nWidth = FC_WIDTH_SEMICONDENSED;break;
+            case WIDTH_NORMAL:			nWidth = FC_WIDTH_NORMAL;break;
+            case WIDTH_SEMI_EXPANDED:	nWidth = FC_WIDTH_SEMIEXPANDED;break;
+            case WIDTH_EXPANDED:		nWidth = FC_WIDTH_EXPANDED;break;
+            case WIDTH_EXTRA_EXPANDED:	nWidth = FC_WIDTH_EXTRAEXPANDED;break;
+            case WIDTH_ULTRA_EXPANDED:	nWidth = FC_WIDTH_ULTRACONDENSED;break;
             default:
                 break;
         }
@@ -1045,7 +1047,7 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern,
 rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
     rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
     italic::type &rItalic, weight::type &rWeight,
-    width::type &rWidth, pitch::type &rPitch) const
+    FontWidth &rWidth, pitch::type &rPitch) const
 {
     rtl::OUString aName;
     FontCfgWrapper& rWrapper = FontCfgWrapper::get();
@@ -1361,7 +1363,7 @@ int PrintFontManager::FreeTypeCharIndex( void*, sal_uInt32 )
 }
 
 rtl::OUString PrintFontManager::Substitute( const rtl::OUString&,
-    rtl::OUString&, const rtl::OString&, italic::type, weight::type, width::type, pitch::type) const
+    rtl::OUString&, const rtl::OString&, italic::type, weight::type, FontWidth, pitch::type) const
 {
     rtl::OUString aName;
     return aName;
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index c418bec..864e911 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -188,30 +188,30 @@ static weight::type parseWeight( const ByteString& rWeight )
 
 // -------------------------------------------------------------------------
 
-static width::type parseWidth( const ByteString& rWidth )
+static FontWidth parseWidth( const ByteString& rWidth )
 {
-    width::type eWidth = width::Unknown;
+    FontWidth eWidth = WIDTH_DONTKNOW;
     if( rWidth.Equals( "bold" ) ||
         rWidth.Equals( "semiexpanded" ) )
-        eWidth = width::SemiExpanded;
+        eWidth = WIDTH_SEMI_EXPANDED;
     else if( rWidth.Equals( "condensed" ) ||
              rWidth.Equals( "narrow" ) )
-        eWidth = width::Condensed;
+        eWidth = WIDTH_CONDENSED;
     else if( rWidth.Equals( "double wide" ) ||
              rWidth.Equals( "extraexpanded" ) ||
              rWidth.Equals( "ultraexpanded" ) )
-        eWidth = width::UltraExpanded;
+        eWidth = WIDTH_ULTRA_EXPANDED;
     else if( rWidth.Equals( "expanded" ) ||
              rWidth.Equals( "wide" ) )
-        eWidth = width::Expanded;
+        eWidth = WIDTH_EXPANDED;
     else if( rWidth.Equals( "extracondensed" ) )
-        eWidth = width::ExtraCondensed;
+        eWidth = WIDTH_EXTRA_CONDENSED;
     else if( rWidth.Equals( "semicondensed" ) )
-        eWidth = width::SemiCondensed;
+        eWidth = WIDTH_SEMI_CONDENSED;
     else if( rWidth.Equals( "ultracondensed" ) )
-        eWidth = width::UltraCondensed;
+        eWidth = WIDTH_ULTRA_CONDENSED;
     else
-        eWidth = width::Normal;
+        eWidth = WIDTH_NORMAL;
 
     return eWidth;
 }
@@ -357,7 +357,7 @@ PrintFontManager::PrintFont::PrintFont( fonttype::type eType ) :
         m_nFamilyName( 0 ),
         m_nPSName( 0 ),
         m_eItalic( italic::Unknown ),
-        m_eWidth( width::Unknown ),
+        m_eWidth( WIDTH_DONTKNOW ),
         m_eWeight( weight::Unknown ),
         m_ePitch( pitch::Unknown ),
         m_aEncoding( RTL_TEXTENCODING_DONTKNOW ),
@@ -1962,17 +1962,17 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const
 
         switch( aInfo.width )
         {
-            case FWIDTH_ULTRA_CONDENSED:    pFont->m_eWidth = width::UltraCondensed; break;
-            case FWIDTH_EXTRA_CONDENSED:    pFont->m_eWidth = width::ExtraCondensed; break;
-            case FWIDTH_CONDENSED:          pFont->m_eWidth = width::Condensed; break;
-            case FWIDTH_SEMI_CONDENSED: pFont->m_eWidth = width::SemiCondensed; break;
-            case FWIDTH_SEMI_EXPANDED:      pFont->m_eWidth = width::SemiExpanded; break;
-            case FWIDTH_EXPANDED:           pFont->m_eWidth = width::Expanded; break;
-            case FWIDTH_EXTRA_EXPANDED: pFont->m_eWidth = width::ExtraExpanded; break;
-            case FWIDTH_ULTRA_EXPANDED: pFont->m_eWidth = width::UltraExpanded; break;
+            case FWIDTH_ULTRA_CONDENSED:    pFont->m_eWidth = WIDTH_ULTRA_CONDENSED; break;
+            case FWIDTH_EXTRA_CONDENSED:    pFont->m_eWidth = WIDTH_EXTRA_CONDENSED; break;
+            case FWIDTH_CONDENSED:          pFont->m_eWidth = WIDTH_CONDENSED; break;
+            case FWIDTH_SEMI_CONDENSED: pFont->m_eWidth = WIDTH_SEMI_CONDENSED; break;
+            case FWIDTH_SEMI_EXPANDED:      pFont->m_eWidth = WIDTH_SEMI_EXPANDED; break;
+            case FWIDTH_EXPANDED:           pFont->m_eWidth = WIDTH_EXPANDED; break;
+            case FWIDTH_EXTRA_EXPANDED: pFont->m_eWidth = WIDTH_EXTRA_EXPANDED; break;
+            case FWIDTH_ULTRA_EXPANDED: pFont->m_eWidth = WIDTH_ULTRA_EXPANDED; break;
 
             case FWIDTH_NORMAL:
-            default:                        pFont->m_eWidth = width::Normal; break;
+            default:                        pFont->m_eWidth = WIDTH_NORMAL; break;
         }
 
         pFont->m_ePitch = aInfo.pitch ? pitch::Fixed : pitch::Variable;
@@ -4016,7 +4016,7 @@ bool PrintFontManager::readOverrideMetrics()
             else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Italic" ) ) )
                 pFont->m_eItalic = static_cast<italic::type>(getInt(pProps[n].Value));
             else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) )
-                pFont->m_eWidth = static_cast<width::type>(getInt(pProps[n].Value));
+                pFont->m_eWidth = static_cast<FontWidth>(getInt(pProps[n].Value));
             else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Weight" ) ) )
                 pFont->m_eWeight = static_cast<weight::type>(getInt(pProps[n].Value));
             else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Pitch" ) ) )
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index 8718979..68c1492 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -1180,27 +1180,6 @@ void PspGraphics::DoGetGlyphWidths( psp::fontID aFont,
 }
 // ----------------------------------------------------------------------------
 
-FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth)
-{
-    switch (eWidth)
-    {
-        case psp::width::UltraCondensed: return WIDTH_ULTRA_CONDENSED;
-        case psp::width::ExtraCondensed: return WIDTH_EXTRA_CONDENSED;
-        case psp::width::Condensed:		 return WIDTH_CONDENSED;
-        case psp::width::SemiCondensed:	 return WIDTH_SEMI_CONDENSED;
-        case psp::width::Normal:		 return WIDTH_NORMAL;
-        case psp::width::SemiExpanded:	 return WIDTH_SEMI_EXPANDED;
-        case psp::width::Expanded:		 return WIDTH_EXPANDED;
-        case psp::width::ExtraExpanded:	 return WIDTH_EXTRA_EXPANDED;
-        case psp::width::UltraExpanded:	 return WIDTH_ULTRA_EXPANDED;
-        case psp::width::Unknown:        return WIDTH_DONTKNOW;
-        default:
-            OSL_FAIL( "unknown width mapping" );
-            break;
-    }
-    return WIDTH_DONTKNOW;
-}
-
 FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight)
 {
     switch (eWeight)
@@ -1278,7 +1257,7 @@ ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintF
     aDFA.meFamily       = ToFontFamily (rInfo.m_eFamilyStyle);
     aDFA.meWeight       = ToFontWeight (rInfo.m_eWeight);
     aDFA.meItalic       = ToFontItalic (rInfo.m_eItalic);
-    aDFA.meWidthType    = ToFontWidth (rInfo.m_eWidth);
+    aDFA.meWidthType    = rInfo.m_eWidth;
     aDFA.mePitch        = ToFontPitch (rInfo.m_ePitch);
     aDFA.mbSymbolFlag   = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL);
     aDFA.mbSubsettable  = rInfo.m_bSubsettable;
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 4365356..805b1d9 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -1160,39 +1160,7 @@ ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, in
             break;
     }
     // set width
-    switch( rFontAttributes.GetWidthType() )
-    {
-        case WIDTH_ULTRA_CONDENSED:
-            aInfo.m_eWidth = psp::width::UltraCondensed;
-            break;
-        case WIDTH_EXTRA_CONDENSED:
-            aInfo.m_eWidth = psp::width::ExtraCondensed;
-            break;
-        case WIDTH_CONDENSED:
-            aInfo.m_eWidth = psp::width::Condensed;
-            break;
-        case WIDTH_SEMI_CONDENSED:
-            aInfo.m_eWidth = psp::width::SemiCondensed;
-            break;
-        case WIDTH_NORMAL:
-            aInfo.m_eWidth = psp::width::Normal;
-            break;
-        case WIDTH_SEMI_EXPANDED:
-            aInfo.m_eWidth = psp::width::SemiExpanded;
-            break;
-        case WIDTH_EXPANDED:
-            aInfo.m_eWidth = psp::width::Expanded;
-            break;
-        case WIDTH_EXTRA_EXPANDED:
-            aInfo.m_eWidth = psp::width::ExtraExpanded;
-            break;
-        case WIDTH_ULTRA_EXPANDED:
-            aInfo.m_eWidth = psp::width::UltraExpanded;
-            break;
-        default:
-            aInfo.m_eWidth = psp::width::Unknown;
-            break;
-    }
+    aInfo.m_eWidth = rFontAttributes.GetWidthType();
 
     const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
     return rPFM.getFontOptions(aInfo, nSize, cairosubcallback);
@@ -1495,24 +1463,24 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData
         }
     }
 
-    psp::width::type eWidth = psp::width::Unknown;
-    if( rFontSelData.GetWidthType() != WIDTH_DONTKNOW )
-    {
-        switch( rFontSelData.GetWidthType() )
-        {
-            case WIDTH_ULTRA_CONDENSED:	eWidth = psp::width::UltraCondensed; break;
-            case WIDTH_EXTRA_CONDENSED: eWidth = psp::width::ExtraCondensed; break;
-            case WIDTH_CONDENSED:	eWidth = psp::width::Condensed; break;
-            case WIDTH_SEMI_CONDENSED:	eWidth = psp::width::SemiCondensed; break;
-            case WIDTH_NORMAL:		eWidth = psp::width::Normal; break;
-            case WIDTH_SEMI_EXPANDED:	eWidth = psp::width::SemiExpanded; break;
-            case WIDTH_EXPANDED:	eWidth = psp::width::Expanded; break;
-            case WIDTH_EXTRA_EXPANDED:	eWidth = psp::width::ExtraExpanded; break;
-            case WIDTH_ULTRA_EXPANDED:	eWidth = psp::width::UltraExpanded; break;
-            default:
-                break;
-        }
-    }
+    FontWidth eWidth = rFontSelData.GetWidthType();
+//     if( rFontSelData.GetWidthType() != WIDTH_DONTKNOW )
+//     {
+//         switch( rFontSelData.GetWidthType() )
+//         {
+//             case WIDTH_ULTRA_CONDENSED:	eWidth = psp::width::UltraCondensed; break;
+//             case WIDTH_EXTRA_CONDENSED: eWidth = psp::width::ExtraCondensed; break;
+//             case WIDTH_CONDENSED:	eWidth = psp::width::Condensed; break;
+//             case WIDTH_SEMI_CONDENSED:	eWidth = psp::width::SemiCondensed; break;
+//             case WIDTH_NORMAL:		eWidth = psp::width::Normal; break;
+//             case WIDTH_SEMI_EXPANDED:	eWidth = psp::width::SemiExpanded; break;
+//             case WIDTH_EXPANDED:	eWidth = psp::width::Expanded; break;
+//             case WIDTH_EXTRA_EXPANDED:	eWidth = psp::width::ExtraExpanded; break;
+//             case WIDTH_ULTRA_EXPANDED:	eWidth = psp::width::UltraExpanded; break;
+//             default:
+//                 break;
+//         }
+//     }
 
     psp::pitch::type ePitch = psp::pitch::Unknown;
     if( rFontSelData.GetPitch() != PITCH_DONTKNOW )
@@ -1554,20 +1522,21 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData
                 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;
-    }
+    aRet.meWidthType = eWidth;
+//     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)
     {
-- 
1.7.0.4


--------------070600050103000806020501--


More information about the LibreOffice mailing list