From 0174562fa9e49bf989a571c6ccd51e558109b561 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Fri, 15 Jan 2016 20:16:20 +1100 Subject: [PATCH] vcl: ImplFontMetric and FontAttributes is *very* familiar So much so that I think we only need one or the other. As such, I'm implementing the functionality that is in one of the classes so that (and vice versa) might eventually be able to use the same class! Change-Id: I1b32a5a5213ea406a96386ac4a4553cd81d3728d --- vcl/inc/impfont.hxx | 52 ++++++++++++++++++++++++++++++---- vcl/source/outdev/textline.cxx | 8 +++--- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index cc4d19429cea..a4d9e25ec2af 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -27,17 +27,59 @@ #include +/* The following class is extraordinarily similar to FontAttributes. */ + class ImplFont { public: explicit ImplFont(); explicit ImplFont( const ImplFont& ); - FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; } - FontFamily GetFamily() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } - FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; } - FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } - FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW)AskConfig(); return meWidthType; } + // device independent font functions + const OUString& GetFamilyName() const { return maFamilyName; } + FontFamily GetFamily() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } + FontFamily GetFamilyType() { return GetFamily(); } + const OUString& GetStyleName() const { return maStyleName; } + + FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } + FontItalic GetSlantType() { return GetItalic(); } + FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; } + FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; } + FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW)AskConfig(); return meWidthType; } + + bool IsSymbolFont() const { return mbSymbol; } + + void SetFamilyName( const OUString& sFamilyName ) { maFamilyName = sFamilyName; } + void SetStyleName( const OUString& sStyleName ) { maStyleName = sStyleName; } + void SetFamilyType( const FontFamily eFontFamily ) { meFamily = eFontFamily; } + + void SetPitch( const FontPitch ePitch ) { mePitch = ePitch; } + void SetItalic( const FontItalic eItalic ) { meItalic = eItalic; } + void SetWeight( const FontWeight eWeight ) { meWeight = eWeight; } + void SetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; } + + void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbol = bSymbolFlag; } + + // device dependent functions + /* Missing function: int GetQuality() const; */ + /* Missing function: OUString GetMapNames() const; */ + + /* Missing function: bool IsBuiltInFont() const; */ + /* Missing function: bool CanEmbed() const; */ + /* Missing function: bool CanSubSet() const; */ + /* Missing function: bool CanRotate() const; */ + /* Missing function: bool HasMapNames() const; */ + + /* Missing function: void SetQuality( int nQuality ); */ + /* Missing function: void IncreaseQualityBy( int nQualityAmount ); */ + /* Missing function: void DecreaseQualityBy( int nQualityAmount ); */ + /* Missing function: void SetNames( OUString const& ); */ + /* Missing function: Vod AddMapName( OUString const& ); */ + + /* Missing function: SetBuiltInFontFlag( bool ); */ + /* Missing function: SetEmbeddableFlag( bool ); */ + /* Missing function: SetSettableFlag( bool ); */ + /* missing function: SetOrientationFlag( bool ); */ bool operator==( const ImplFont& ) const; diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 556004447776..c5cb80e0f889 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -32,10 +32,10 @@ #include "impfont.hxx" #include "outdata.hxx" -#include -#if ENABLE_GRAPHITE -#include "graphite_features.hxx" -#endif +//#include +//#if ENABLE_GRAPHITE +//#include "graphite_features.hxx" +//#endif #define UNDERLINE_LAST UNDERLINE_BOLDWAVE #define STRIKEOUT_LAST STRIKEOUT_X