diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-09 11:44:01 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-09 11:44:19 +1100 |
commit | 85ac3cd63f6720ff2d3c4b7491f4ad296219fa53 (patch) | |
tree | aa8c3fba6a62d8a8ff8b8aea9708c86fc35eeae5 /vcl/source/font/fontselect.cxx | |
parent | 6ee8ba1e451f7a2bd890b265d0c0c0030519da31 (diff) |
vcl: move FontSelectPatternAttributes constructor to fontselect.cxx
Change-Id: I49041e086c1da6d9cc23781e10b00997f227da8e
Diffstat (limited to 'vcl/source/font/fontselect.cxx')
-rw-r--r-- | vcl/source/font/fontselect.cxx | 68 |
1 files changed, 68 insertions, 0 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) |