From 85ac3cd63f6720ff2d3c4b7491f4ad296219fa53 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Sat, 9 Jan 2016 11:44:01 +1100 Subject: vcl: move FontSelectPatternAttributes constructor to fontselect.cxx Change-Id: I49041e086c1da6d9cc23781e10b00997f227da8e --- vcl/source/font/fontselect.cxx | 68 ++++++++++++++++++++++++++++++++++++++++++ vcl/source/outdev/font.cxx | 32 -------------------- 2 files changed, 68 insertions(+), 32 deletions(-) diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx index e1b875734a42..82c33f56c9ec 100644 --- a/vcl/source/font/fontselect.cxx +++ b/vcl/source/font/fontselect.cxx @@ -71,6 +71,40 @@ FontSelectPattern::FontSelectPattern( const vcl::Font& rFont, { } + +FontSelectPatternAttributes::FontSelectPatternAttributes( const vcl::Font& rFont, + const OUString& rSearchName, const Size& rSize, float fExactHeight ) + : maSearchName( rSearchName ) + , mnWidth( rSize.Width() ) + , mnHeight( rSize.Height() ) + , mfExactHeight( fExactHeight) + , mnOrientation( rFont.GetOrientation() ) + , meLanguage( rFont.GetLanguage() ) + , mbVertical( rFont.IsVertical() ) + , mbNonAntialiased( false ) + , mbEmbolden( false ) +{ + maTargetName = GetFamilyName(); + + rFont.GetFontAttributes( *this ); + + // normalize orientation between 0 and 3600 + if( 3600 <= (unsigned)mnOrientation ) + { + if( mnOrientation >= 0 ) + mnOrientation %= 3600; + else + mnOrientation = 3600 - (-mnOrientation % 3600); + } + + // normalize width and height + if( mnHeight < 0 ) + mnHeight = -mnHeight; + if( mnWidth < 0 ) + mnWidth = -mnWidth; +} + + // NOTE: this ctor is still used on Windows. Do not remove. #ifdef WNT FontSelectPatternAttributes::FontSelectPatternAttributes( const PhysicalFontFace& rFontData, @@ -89,6 +123,40 @@ FontSelectPatternAttributes::FontSelectPatternAttributes( const PhysicalFontFace // NOTE: no normalization for width/height/orientation } + +FontSelectPatternAttributes::FontSelectPatternAttributes( const vcl::Font& rFont, + const OUString& rSearchName, const Size& rSize, float fExactHeight ) + : maSearchName( rSearchName ) + , mnWidth( rSize.Width() ) + , mnHeight( rSize.Height() ) + , mfExactHeight( fExactHeight) + , mnOrientation( rFont.GetOrientation() ) + , meLanguage( rFont.GetLanguage() ) + , mbVertical( rFont.IsVertical() ) + , mbNonAntialiased( false ) + , mbEmbolden( false ) +{ + maTargetName = GetFamilyName(); + + rFont.GetFontAttributes( *this ); + + // normalize orientation between 0 and 3600 + if( 3600 <= (unsigned)mnOrientation ) + { + if( mnOrientation >= 0 ) + mnOrientation %= 3600; + else + mnOrientation = 3600 - (-mnOrientation % 3600); + } + + // normalize width and height + if( mnHeight < 0 ) + mnHeight = -mnHeight; + if( mnWidth < 0 ) + mnWidth = -mnWidth; +} + + FontSelectPattern::FontSelectPattern( const PhysicalFontFace& rFontData, const Size& rSize, float fExactHeight, int nOrientation, bool bVertical ) : FontSelectPatternAttributes(rFontData, rSize, fExactHeight, nOrientation, bVertical) diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 5032cbbc293b..80c85fc7af48 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -979,38 +979,6 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan return aFont; } -FontSelectPatternAttributes::FontSelectPatternAttributes( const vcl::Font& rFont, - const OUString& rSearchName, const Size& rSize, float fExactHeight ) - : maSearchName( rSearchName ) - , mnWidth( rSize.Width() ) - , mnHeight( rSize.Height() ) - , mfExactHeight( fExactHeight) - , mnOrientation( rFont.GetOrientation() ) - , meLanguage( rFont.GetLanguage() ) - , mbVertical( rFont.IsVertical() ) - , mbNonAntialiased( false ) - , mbEmbolden( false ) -{ - maTargetName = GetFamilyName(); - - rFont.GetFontAttributes( *this ); - - // normalize orientation between 0 and 3600 - if( 3600 <= (unsigned)mnOrientation ) - { - if( mnOrientation >= 0 ) - mnOrientation %= 3600; - else - mnOrientation = 3600 - (-mnOrientation % 3600); - } - - // normalize width and height - if( mnHeight < 0 ) - mnHeight = -mnHeight; - if( mnWidth < 0 ) - mnWidth = -mnWidth; -} - void OutputDevice::ImplInitFontList() const { if( !mpFontCollection->Count() ) -- cgit