Kaydet (Commit) 60e659ae authored tarafından Noel Grandin's avatar Noel Grandin

convert IMPL_FONT_ATTR constants to scoped enum

Change-Id: I2b5986ea69dc09e6ba18b23a80029f6551b48152
üst 96471119
...@@ -26,11 +26,74 @@ ...@@ -26,11 +26,74 @@
#include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
#include <o3tl/typed_flags_set.hxx>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
// DEFAULT - Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ...
// STANDARD - Standard-Font like Arial, Times, Courier, ...
// NORMAL - normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ...
// SYMBOL - Font with symbols
// DECORATIVE - Readable and normally used for drawings
// SPECIAL - very special design
// TITLING - only uppercase characters
// FONT_ATTR_FULL - Font with normally all characters
// CAPITALS - only uppercase characters, but lowercase characters smaller as the uppercase characters
// TYPEWRITER - like a typewriter: Courier, ...
// SCRIPT - Handwriting or Script
// HANDWRITING - More Handwriting with normal letters
// CHANCERY - Like Zapf Chancery
// COMIC - Like Comic Sans MS
// BRUSHSCRIPT - More Script
// OTHERSTYLE - OldStyle, ... so negativ points
enum class ImplFontAttrs : sal_uLong
{
None = 0x00000000,
Default = 0x00000001,
Standard = 0x00000002,
Normal = 0x00000004,
Symbol = 0x00000008,
Fixed = 0x00000010,
SansSerif = 0x00000020,
Serif = 0x00000040,
Decorative = 0x00000080,
Special = 0x00000100,
Italic = 0x00000200,
Titling = 0x00000400,
Capitals = 0x00000800,
CJK = 0x00001000,
CJK_JP = 0x00002000,
CJK_SC = 0x00004000,
CJK_TC = 0x00008000,
CJK_KR = 0x00010000,
CTL = 0x00020000,
NoneLatin = 0x00040000,
Full = 0x00080000,
Outline = 0x00100000,
Shadow = 0x00200000,
Rounded = 0x00400000,
Typewriter = 0x00800000,
Script = 0x01000000,
Handwriting = 0x02000000,
Chancery = 0x04000000,
Comic = 0x08000000,
BrushScript = 0x10000000,
Gothic = 0x20000000,
Schoolbook = 0x40000000,
OtherStyle = 0x80000000,
CJK_AllLang = CJK_JP | CJK_SC | CJK_TC | CJK_KR,
AllScript = Script | Handwriting | Chancery | Comic | BrushScript,
AllSubscript = Handwriting | Chancery | Comic | BrushScript,
AllSerifStyle = AllScript | SansSerif | Serif | Fixed | Italic | Gothic | Schoolbook | Shadow | Outline,
};
namespace o3tl
{
template<> struct typed_flags<ImplFontAttrs> : is_typed_flags<ImplFontAttrs, 0xffffffff> {};
}
namespace utl namespace utl
{ {
...@@ -64,74 +127,16 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration ...@@ -64,74 +127,16 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
OUString getUserInterfaceFont( const LanguageTag& rLanguageTag ) const; OUString getUserInterfaceFont( const LanguageTag& rLanguageTag ) const;
}; };
// IMPL_FONT_ATTR_DEFAULT - Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ...
// IMPL_FONT_ATTR_STANDARD - Standard-Font like Arial, Times, Courier, ...
// IMPL_FONT_ATTR_NORMAL - normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ...
// IMPL_FONT_ATTR_SYMBOL - Font with symbols
// IMPL_FONT_ATTR_DECORATIVE - Readable and normally used for drawings
// IMPL_FONT_ATTR_SPECIAL - very special design
// IMPL_FONT_ATTR_TITLING - only uppercase characters
// IMPL_FONT_ATTR_FULL - Font with normally all characters
// IMPL_FONT_ATTR_CAPITALS - only uppercase characters, but lowercase characters smaller as the uppercase characters
// IMPL_FONT_ATTR_TYPEWRITER - like a typewriter: Courier, ...
// IMPL_FONT_ATTR_SCRIPT - Handwriting or Script
// IMPL_FONT_ATTR_HANDWRITING - More Handwriting with normal letters
// IMPL_FONT_ATTR_CHANCERY - Like Zapf Chancery
// IMPL_FONT_ATTR_COMIC - Like Comic Sans MS
// IMPL_FONT_ATTR_BRUSHSCRIPT - More Script
// IMPL_FONT_ATTR_OTHERSTYLE - OldStyle, ... so negativ points
#define IMPL_FONT_ATTR_DEFAULT ((sal_uLong)0x00000001)
#define IMPL_FONT_ATTR_STANDARD ((sal_uLong)0x00000002)
#define IMPL_FONT_ATTR_NORMAL ((sal_uLong)0x00000004)
#define IMPL_FONT_ATTR_SYMBOL ((sal_uLong)0x00000008)
#define IMPL_FONT_ATTR_FIXED ((sal_uLong)0x00000010)
#define IMPL_FONT_ATTR_SANSSERIF ((sal_uLong)0x00000020)
#define IMPL_FONT_ATTR_SERIF ((sal_uLong)0x00000040)
#define IMPL_FONT_ATTR_DECORATIVE ((sal_uLong)0x00000080)
#define IMPL_FONT_ATTR_SPECIAL ((sal_uLong)0x00000100)
#define IMPL_FONT_ATTR_ITALIC ((sal_uLong)0x00000200)
#define IMPL_FONT_ATTR_TITLING ((sal_uLong)0x00000400)
#define IMPL_FONT_ATTR_CAPITALS ((sal_uLong)0x00000800)
#define IMPL_FONT_ATTR_CJK ((sal_uLong)0x00001000)
#define IMPL_FONT_ATTR_CJK_JP ((sal_uLong)0x00002000)
#define IMPL_FONT_ATTR_CJK_SC ((sal_uLong)0x00004000)
#define IMPL_FONT_ATTR_CJK_TC ((sal_uLong)0x00008000)
#define IMPL_FONT_ATTR_CJK_KR ((sal_uLong)0x00010000)
#define IMPL_FONT_ATTR_CTL ((sal_uLong)0x00020000)
#define IMPL_FONT_ATTR_NONELATIN ((sal_uLong)0x00040000)
#define IMPL_FONT_ATTR_FULL ((sal_uLong)0x00080000)
#define IMPL_FONT_ATTR_OUTLINE ((sal_uLong)0x00100000)
#define IMPL_FONT_ATTR_SHADOW ((sal_uLong)0x00200000)
#define IMPL_FONT_ATTR_ROUNDED ((sal_uLong)0x00400000)
#define IMPL_FONT_ATTR_TYPEWRITER ((sal_uLong)0x00800000)
#define IMPL_FONT_ATTR_SCRIPT ((sal_uLong)0x01000000)
#define IMPL_FONT_ATTR_HANDWRITING ((sal_uLong)0x02000000)
#define IMPL_FONT_ATTR_CHANCERY ((sal_uLong)0x04000000)
#define IMPL_FONT_ATTR_COMIC ((sal_uLong)0x08000000)
#define IMPL_FONT_ATTR_BRUSHSCRIPT ((sal_uLong)0x10000000)
#define IMPL_FONT_ATTR_GOTHIC ((sal_uLong)0x20000000)
#define IMPL_FONT_ATTR_SCHOOLBOOK ((sal_uLong)0x40000000)
#define IMPL_FONT_ATTR_OTHERSTYLE ((sal_uLong)0x80000000)
#define IMPL_FONT_ATTR_CJK_ALLLANG (IMPL_FONT_ATTR_CJK_JP | IMPL_FONT_ATTR_CJK_SC | IMPL_FONT_ATTR_CJK_TC | IMPL_FONT_ATTR_CJK_KR)
#define IMPL_FONT_ATTR_ALLSCRIPT (IMPL_FONT_ATTR_SCRIPT | IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT)
#define IMPL_FONT_ATTR_ALLSUBSCRIPT (IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT)
#define IMPL_FONT_ATTR_ALLSERIFSTYLE (IMPL_FONT_ATTR_ALLSCRIPT |\
IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_SERIF |\
IMPL_FONT_ATTR_FIXED | IMPL_FONT_ATTR_ITALIC |\
IMPL_FONT_ATTR_GOTHIC | IMPL_FONT_ATTR_SCHOOLBOOK |\
IMPL_FONT_ATTR_SHADOW | IMPL_FONT_ATTR_OUTLINE)
struct UNOTOOLS_DLLPUBLIC FontNameAttr struct UNOTOOLS_DLLPUBLIC FontNameAttr
{ {
OUString Name; OUString Name;
::std::vector< OUString > Substitutions; ::std::vector< OUString > Substitutions;
::std::vector< OUString > MSSubstitutions; ::std::vector< OUString > MSSubstitutions;
::std::vector< OUString > PSSubstitutions; ::std::vector< OUString > PSSubstitutions;
::std::vector< OUString > HTMLSubstitutions; ::std::vector< OUString > HTMLSubstitutions;
FontWeight Weight; FontWeight Weight;
FontWidth Width; FontWidth Width;
unsigned long Type; // bitfield of IMPL_FONT_ATTR_* ImplFontAttrs Type;
}; };
class UNOTOOLS_DLLPUBLIC FontSubstConfiguration class UNOTOOLS_DLLPUBLIC FontSubstConfiguration
...@@ -164,7 +169,7 @@ private: ...@@ -164,7 +169,7 @@ private:
const OUString& rType ) const; const OUString& rType ) const;
FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& rFont, FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& rFont,
const OUString& rType ) const; const OUString& rType ) const;
unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& rFont, ImplFontAttrs getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& rFont,
const OUString& rType ) const; const OUString& rType ) const;
void readLocaleSubst( const OUString& rBcp47 ) const; void readLocaleSubst( const OUString& rBcp47 ) const;
public: public:
...@@ -177,7 +182,7 @@ public: ...@@ -177,7 +182,7 @@ public:
const OUString& rFontName, const OUString& rFontName,
const LanguageTag& rLanguageTag = LanguageTag( OUString( "en")) const LanguageTag& rLanguageTag = LanguageTag( OUString( "en"))
) const; ) const;
static void getMapName( const OUString& rOrgName, OUString& rShortName, OUString& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType ); static void getMapName( const OUString& rOrgName, OUString& rShortName, OUString& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ImplFontAttrs& rType );
}; };
} // namespace utl } // namespace utl
......
...@@ -554,71 +554,71 @@ static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = ...@@ -554,71 +554,71 @@ static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] =
struct ImplFontAttrTypeSearchData struct ImplFontAttrTypeSearchData
{ {
const char* mpStr; const char* mpStr;
sal_uLong mnType; ImplFontAttrs mnType;
}; };
static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] = static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
{ {
{ "monotype", 0 }, { "monotype", ImplFontAttrs::None },
{ "linotype", 0 }, { "linotype", ImplFontAttrs::None },
{ "titling", IMPL_FONT_ATTR_TITLING }, { "titling", ImplFontAttrs::Titling },
{ "captitals", IMPL_FONT_ATTR_CAPITALS }, { "captitals", ImplFontAttrs::Capitals },
{ "captital", IMPL_FONT_ATTR_CAPITALS }, { "captital", ImplFontAttrs::Capitals },
{ "caps", IMPL_FONT_ATTR_CAPITALS }, { "caps", ImplFontAttrs::Capitals },
{ "italic", IMPL_FONT_ATTR_ITALIC }, { "italic", ImplFontAttrs::Italic },
{ "oblique", IMPL_FONT_ATTR_ITALIC }, { "oblique", ImplFontAttrs::Italic },
{ "rounded", IMPL_FONT_ATTR_ROUNDED }, { "rounded", ImplFontAttrs::Rounded },
{ "outline", IMPL_FONT_ATTR_OUTLINE }, { "outline", ImplFontAttrs::Outline },
{ "shadow", IMPL_FONT_ATTR_SHADOW }, { "shadow", ImplFontAttrs::Shadow },
{ "handwriting", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, { "handwriting", ImplFontAttrs::Handwriting | ImplFontAttrs::Script },
{ "hand", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, { "hand", ImplFontAttrs::Handwriting | ImplFontAttrs::Script },
{ "signet", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, { "signet", ImplFontAttrs::Handwriting | ImplFontAttrs::Script },
{ "script", IMPL_FONT_ATTR_BRUSHSCRIPT | IMPL_FONT_ATTR_SCRIPT }, { "script", ImplFontAttrs::BrushScript | ImplFontAttrs::Script },
{ "calligraphy", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, { "calligraphy", ImplFontAttrs::Chancery | ImplFontAttrs::Script },
{ "chancery", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, { "chancery", ImplFontAttrs::Chancery | ImplFontAttrs::Script },
{ "corsiva", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, { "corsiva", ImplFontAttrs::Chancery | ImplFontAttrs::Script },
{ "gothic", IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_GOTHIC }, { "gothic", ImplFontAttrs::SansSerif | ImplFontAttrs::Gothic },
{ "schoolbook", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, { "schoolbook", ImplFontAttrs::Serif | ImplFontAttrs::Schoolbook },
{ "schlbk", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, { "schlbk", ImplFontAttrs::Serif | ImplFontAttrs::Schoolbook },
{ "typewriter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, { "typewriter", ImplFontAttrs::Typewriter | ImplFontAttrs::Fixed },
{ "lineprinter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, { "lineprinter", ImplFontAttrs::Typewriter | ImplFontAttrs::Fixed },
{ "monospaced", IMPL_FONT_ATTR_FIXED }, { "monospaced", ImplFontAttrs::Fixed },
{ "monospace", IMPL_FONT_ATTR_FIXED }, { "monospace", ImplFontAttrs::Fixed },
{ "mono", IMPL_FONT_ATTR_FIXED }, { "mono", ImplFontAttrs::Fixed },
{ "fixed", IMPL_FONT_ATTR_FIXED }, { "fixed", ImplFontAttrs::Fixed },
{ "sansserif", IMPL_FONT_ATTR_SANSSERIF }, { "sansserif", ImplFontAttrs::SansSerif },
{ "sans", IMPL_FONT_ATTR_SANSSERIF }, { "sans", ImplFontAttrs::SansSerif },
{ "swiss", IMPL_FONT_ATTR_SANSSERIF }, { "swiss", ImplFontAttrs::SansSerif },
{ "serif", IMPL_FONT_ATTR_SERIF }, { "serif", ImplFontAttrs::Serif },
{ "bright", IMPL_FONT_ATTR_SERIF }, { "bright", ImplFontAttrs::Serif },
{ "symbols", IMPL_FONT_ATTR_SYMBOL }, { "symbols", ImplFontAttrs::Symbol },
{ "symbol", IMPL_FONT_ATTR_SYMBOL }, { "symbol", ImplFontAttrs::Symbol },
{ "dingbats", IMPL_FONT_ATTR_SYMBOL }, { "dingbats", ImplFontAttrs::Symbol },
{ "dings", IMPL_FONT_ATTR_SYMBOL }, { "dings", ImplFontAttrs::Symbol },
{ "ding", IMPL_FONT_ATTR_SYMBOL }, { "ding", ImplFontAttrs::Symbol },
{ "bats", IMPL_FONT_ATTR_SYMBOL }, { "bats", ImplFontAttrs::Symbol },
{ "math", IMPL_FONT_ATTR_SYMBOL }, { "math", ImplFontAttrs::Symbol },
{ "oldstyle", IMPL_FONT_ATTR_OTHERSTYLE }, { "oldstyle", ImplFontAttrs::OtherStyle },
{ "oldface", IMPL_FONT_ATTR_OTHERSTYLE }, { "oldface", ImplFontAttrs::OtherStyle },
{ "old", IMPL_FONT_ATTR_OTHERSTYLE }, { "old", ImplFontAttrs::OtherStyle },
{ "new", 0 }, { "new", ImplFontAttrs::None },
{ "modern", 0 }, { "modern", ImplFontAttrs::None },
{ "lucida", 0 }, { "lucida", ImplFontAttrs::None },
{ "regular", 0 }, { "regular", ImplFontAttrs::None },
{ "extended", 0 }, { "extended", ImplFontAttrs::None },
{ "extra", IMPL_FONT_ATTR_OTHERSTYLE }, { "extra", ImplFontAttrs::OtherStyle },
{ "ext", 0 }, { "ext", ImplFontAttrs::None },
{ "scalable", 0 }, { "scalable", ImplFontAttrs::None },
{ "scale", 0 }, { "scale", ImplFontAttrs::None },
{ "nimbus", 0 }, { "nimbus", ImplFontAttrs::None },
{ "adobe", 0 }, { "adobe", ImplFontAttrs::None },
{ "itc", 0 }, { "itc", ImplFontAttrs::None },
{ "amt", 0 }, { "amt", ImplFontAttrs::None },
{ "mt", 0 }, { "mt", ImplFontAttrs::None },
{ "ms", 0 }, { "ms", ImplFontAttrs::None },
{ "cpi", 0 }, { "cpi", ImplFontAttrs::None },
{ "no", 0 }, { "no", ImplFontAttrs::None },
{ NULL, 0 }, { NULL, ImplFontAttrs::None },
}; };
static bool ImplKillLeading( OUString& rName, const char* const* ppStr ) static bool ImplKillLeading( OUString& rName, const char* const* ppStr )
...@@ -723,7 +723,7 @@ static bool ImplFindAndErase( OUString& rName, const char* pStr ) ...@@ -723,7 +723,7 @@ static bool ImplFindAndErase( OUString& rName, const char* pStr )
void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rShortName, void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rShortName,
OUString& rFamilyName, FontWeight& rWeight, OUString& rFamilyName, FontWeight& rWeight,
FontWidth& rWidth, sal_uLong& rType ) FontWidth& rWidth, ImplFontAttrs& rType )
{ {
rShortName = rOrgName; rShortName = rOrgName;
...@@ -767,7 +767,7 @@ void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rSh ...@@ -767,7 +767,7 @@ void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rSh
} }
// Type // Type
rType = 0; rType = ImplFontAttrs::None;
const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList; const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList;
while ( pTypeList->mpStr ) while ( pTypeList->mpStr )
{ {
...@@ -983,10 +983,10 @@ FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Refe ...@@ -983,10 +983,10 @@ FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Refe
return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW ); return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW );
} }
unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::Reference< XNameAccess >& rFont, ImplFontAttrs FontSubstConfiguration::getSubstType( const com::sun::star::uno::Reference< XNameAccess >& rFont,
const OUString& rType ) const const OUString& rType ) const
{ {
unsigned long type = 0; sal_uLong type = 0;
try try
{ {
Any aAny = rFont->getByName( rType ); Any aAny = rFont->getByName( rType );
...@@ -1016,7 +1016,7 @@ unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::R ...@@ -1016,7 +1016,7 @@ unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::R
{ {
} }
return type; return static_cast<ImplFontAttrs>(type);
} }
void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const
......
...@@ -80,7 +80,7 @@ protected: ...@@ -80,7 +80,7 @@ protected:
PhysicalFontFamily* ImplFindByAliasName(const OUString& rSearchName, PhysicalFontFamily* ImplFindByAliasName(const OUString& rSearchName,
const OUString& rShortName) const; const OUString& rShortName) const;
PhysicalFontFamily* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; PhysicalFontFamily* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const;
PhysicalFontFamily* ImplFindByAttributes(sal_uLong nSearchType, FontWeight, FontWidth, PhysicalFontFamily* ImplFindByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth,
FontItalic, const OUString& rSearchFamily) const; FontItalic, const OUString& rSearchFamily) const;
PhysicalFontFamily* FindDefaultFont() const; PhysicalFontFamily* FindDefaultFont() const;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
class PhysicalFontFace; class PhysicalFontFace;
class PhysicalFontCollection; class PhysicalFontCollection;
// flags for mnMatchType member // flags for mnTypeFaces member
#define FONT_FAMILY_SCALABLE (1<<0) #define FONT_FAMILY_SCALABLE (1<<0)
#define FONT_FAMILY_SYMBOL (1<<1) #define FONT_FAMILY_SYMBOL (1<<1)
#define FONT_FAMILY_NONESYMBOL (1<<2) #define FONT_FAMILY_NONESYMBOL (1<<2)
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
const OUString& GetSearchName() const { return maSearchName; } const OUString& GetSearchName() const { return maSearchName; }
const OUString& GetAliasNames() const { return maMapNames; } const OUString& GetAliasNames() const { return maMapNames; }
const OUString& GetMatchFamilyName() const { return maMatchFamilyName; } const OUString& GetMatchFamilyName() const { return maMatchFamilyName; }
sal_uLong GetMatchType() const { return mnMatchType ; } ImplFontAttrs GetMatchType() const { return mnMatchType ; }
FontWeight GetMatchWeight() const { return meMatchWeight ; } FontWeight GetMatchWeight() const { return meMatchWeight ; }
FontWidth GetMatchWidth() const { return meMatchWidth ; } FontWidth GetMatchWidth() const { return meMatchWidth ; }
bool IsScalable() const { return mpFirst->IsScalable(); } bool IsScalable() const { return mpFirst->IsScalable(); }
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
void UpdateCloneFontList( PhysicalFontCollection&, void UpdateCloneFontList( PhysicalFontCollection&,
bool bScalable, bool bEmbeddable ) const; bool bScalable, bool bEmbeddable ) const;
static void CalcType( sal_uLong& rType, FontWeight& rWeight, FontWidth& rWidth, static void CalcType( ImplFontAttrs& rType, FontWeight& rWeight, FontWidth& rWidth,
FontFamily eFamily, const utl::FontNameAttr* pFontAttr ); FontFamily eFamily, const utl::FontNameAttr* pFontAttr );
private: private:
...@@ -74,7 +74,7 @@ private: ...@@ -74,7 +74,7 @@ private:
OUString maSearchName; // normalized font family name OUString maSearchName; // normalized font family name
OUString maMapNames; // fontname aliases OUString maMapNames; // fontname aliases
int mnTypeFaces; // Typeface Flags int mnTypeFaces; // Typeface Flags
sal_uLong mnMatchType; // MATCH - Type ImplFontAttrs mnMatchType; // MATCH - Type
OUString maMatchFamilyName; // MATCH - FamilyName OUString maMatchFamilyName; // MATCH - FamilyName
FontWeight meMatchWeight; // MATCH - Weight FontWeight meMatchWeight; // MATCH - Weight
FontWidth meMatchWidth; // MATCH - Width FontWidth meMatchWidth; // MATCH - Width
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "PhysicalFontCollection.hxx" #include "PhysicalFontCollection.hxx"
static unsigned lcl_IsCJKFont( const OUString& rFontName ) static ImplFontAttrs lcl_IsCJKFont( const OUString& rFontName )
{ {
// Test, if Fontname includes CJK characters --> In this case we // Test, if Fontname includes CJK characters --> In this case we
// mention that it is a CJK font // mention that it is a CJK font
...@@ -48,26 +48,26 @@ static unsigned lcl_IsCJKFont( const OUString& rFontName ) ...@@ -48,26 +48,26 @@ static unsigned lcl_IsCJKFont( const OUString& rFontName )
// japanese // japanese
if ( ((ch >= 0x3040) && (ch <= 0x30FF)) || if ( ((ch >= 0x3040) && (ch <= 0x30FF)) ||
((ch >= 0x3190) && (ch <= 0x319F)) ) ((ch >= 0x3190) && (ch <= 0x319F)) )
return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP; return ImplFontAttrs::CJK|ImplFontAttrs::CJK_JP;
// korean // korean
if ( ((ch >= 0xAC00) && (ch <= 0xD7AF)) || if ( ((ch >= 0xAC00) && (ch <= 0xD7AF)) ||
((ch >= 0x3130) && (ch <= 0x318F)) || ((ch >= 0x3130) && (ch <= 0x318F)) ||
((ch >= 0x1100) && (ch <= 0x11FF)) ) ((ch >= 0x1100) && (ch <= 0x11FF)) )
return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR; return ImplFontAttrs::CJK|ImplFontAttrs::CJK_KR;
// chinese // chinese
if ( ((ch >= 0x3400) && (ch <= 0x9FFF)) ) if ( ((ch >= 0x3400) && (ch <= 0x9FFF)) )
return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_TC|IMPL_FONT_ATTR_CJK_SC; return ImplFontAttrs::CJK|ImplFontAttrs::CJK_TC|ImplFontAttrs::CJK_SC;
// cjk // cjk
if ( ((ch >= 0x3000) && (ch <= 0xD7AF)) || if ( ((ch >= 0x3000) && (ch <= 0xD7AF)) ||
((ch >= 0xFF00) && (ch <= 0xFFEE)) ) ((ch >= 0xFF00) && (ch <= 0xFFEE)) )
return IMPL_FONT_ATTR_CJK; return ImplFontAttrs::CJK;
} }
return 0; return ImplFontAttrs::None;
} }
PhysicalFontCollection::PhysicalFontCollection() PhysicalFontCollection::PhysicalFontCollection()
...@@ -434,8 +434,8 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindBySubstFontAttr( const utl:: ...@@ -434,8 +434,8 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindBySubstFontAttr( const utl::
} }
// use known attributes from the configuration to find a matching substitute // use known attributes from the configuration to find a matching substitute
const sal_uLong nSearchType = rFontAttr.Type; const ImplFontAttrs nSearchType = rFontAttr.Type;
if( nSearchType != 0 ) if( nSearchType != ImplFontAttrs::None )
{ {
const FontWeight eSearchWeight = rFontAttr.Weight; const FontWeight eSearchWeight = rFontAttr.Weight;
const FontWidth eSearchWidth = rFontAttr.Width; const FontWidth eSearchWidth = rFontAttr.Width;
...@@ -472,17 +472,17 @@ void PhysicalFontCollection::InitMatchData() const ...@@ -472,17 +472,17 @@ void PhysicalFontCollection::InitMatchData() const
} }
} }
PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSearchType, PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( ImplFontAttrs nSearchType,
FontWeight eSearchWeight, FontWeight eSearchWeight,
FontWidth eSearchWidth, FontWidth eSearchWidth,
FontItalic eSearchItalic, FontItalic eSearchItalic,
const OUString& rSearchFamilyName ) const const OUString& rSearchFamilyName ) const
{ {
if( (eSearchItalic != ITALIC_NONE) && (eSearchItalic != ITALIC_DONTKNOW) ) if( (eSearchItalic != ITALIC_NONE) && (eSearchItalic != ITALIC_DONTKNOW) )
nSearchType |= IMPL_FONT_ATTR_ITALIC; nSearchType |= ImplFontAttrs::Italic;
// don't bother to match attributes if the attributes aren't worth matching // don't bother to match attributes if the attributes aren't worth matching
if( !nSearchType if( nSearchType == ImplFontAttrs::None
&& ((eSearchWeight == WEIGHT_DONTKNOW) || (eSearchWeight == WEIGHT_NORMAL)) && ((eSearchWeight == WEIGHT_DONTKNOW) || (eSearchWeight == WEIGHT_NORMAL))
&& ((eSearchWidth == WIDTH_DONTKNOW) || (eSearchWidth == WIDTH_NORMAL)) ) && ((eSearchWidth == WIDTH_DONTKNOW) || (eSearchWidth == WIDTH_NORMAL)) )
return NULL; return NULL;
...@@ -491,7 +491,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -491,7 +491,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
PhysicalFontFamily* pFoundData = NULL; PhysicalFontFamily* pFoundData = NULL;
long nBestMatch = 40000; long nBestMatch = 40000;
sal_uLong nBestType = 0; ImplFontAttrs nBestType = ImplFontAttrs::None;
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin();
for(; it != maPhysicalFontFamilies.end(); ++it ) for(; it != maPhysicalFontFamilies.end(); ++it )
...@@ -499,9 +499,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -499,9 +499,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
PhysicalFontFamily* pData = (*it).second; PhysicalFontFamily* pData = (*it).second;
// Get all information about the matching font // Get all information about the matching font
sal_uLong nMatchType = pData->GetMatchType(); ImplFontAttrs nMatchType = pData->GetMatchType();
FontWeight eMatchWeight= pData->GetMatchWeight(); FontWeight eMatchWeight= pData->GetMatchWeight();
FontWidth eMatchWidth = pData->GetMatchWidth(); FontWidth eMatchWidth = pData->GetMatchWidth();
// Calculate Match Value // Calculate Match Value
// 1000000000 // 1000000000
...@@ -519,45 +519,45 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -519,45 +519,45 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
long nTestMatch = 0; long nTestMatch = 0;
// test CJK script attributes // test CJK script attributes
if ( nSearchType & IMPL_FONT_ATTR_CJK ) if ( nSearchType & ImplFontAttrs::CJK )
{ {
// Matching language // Matching language
if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_CJK_ALLLANG) ) if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::CJK_AllLang) )
nTestMatch += 10000000*3; nTestMatch += 10000000*3;
if( nMatchType & IMPL_FONT_ATTR_CJK ) if( nMatchType & ImplFontAttrs::CJK )
nTestMatch += 10000000*2; nTestMatch += 10000000*2;
if( nMatchType & IMPL_FONT_ATTR_FULL ) if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000; nTestMatch += 10000000;
} }
else if ( nMatchType & IMPL_FONT_ATTR_CJK ) else if ( nMatchType & ImplFontAttrs::CJK )
{ {
nTestMatch -= 10000000; nTestMatch -= 10000000;
} }
// test CTL script attributes // test CTL script attributes
if( nSearchType & IMPL_FONT_ATTR_CTL ) if( nSearchType & ImplFontAttrs::CTL )
{ {
if( nMatchType & IMPL_FONT_ATTR_CTL ) if( nMatchType & ImplFontAttrs::CTL )
nTestMatch += 10000000*2; nTestMatch += 10000000*2;
if( nMatchType & IMPL_FONT_ATTR_FULL ) if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000; nTestMatch += 10000000;
} }
else if ( nMatchType & IMPL_FONT_ATTR_CTL ) else if ( nMatchType & ImplFontAttrs::CTL )
{ {
nTestMatch -= 10000000; nTestMatch -= 10000000;
} }
// test LATIN script attributes // test LATIN script attributes
if( nSearchType & IMPL_FONT_ATTR_NONELATIN ) if( nSearchType & ImplFontAttrs::NoneLatin )
{ {
if( nMatchType & IMPL_FONT_ATTR_NONELATIN ) if( nMatchType & ImplFontAttrs::NoneLatin )
nTestMatch += 10000000*2; nTestMatch += 10000000*2;
if( nMatchType & IMPL_FONT_ATTR_FULL ) if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000; nTestMatch += 10000000;
} }
// test SYMBOL attributes // test SYMBOL attributes
if ( nSearchType & IMPL_FONT_ATTR_SYMBOL ) if ( nSearchType & ImplFontAttrs::Symbol )
{ {
const OUString& rSearchName = it->first; const OUString& rSearchName = it->first;
// prefer some special known symbol fonts // prefer some special known symbol fonts
...@@ -583,9 +583,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -583,9 +583,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
} }
else else
{ {
if( nMatchType & IMPL_FONT_ATTR_SYMBOL ) if( nMatchType & ImplFontAttrs::Symbol )
nTestMatch += 10000000*2; nTestMatch += 10000000*2;
if( nMatchType & IMPL_FONT_ATTR_FULL ) if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000; nTestMatch += 10000000;
} }
} }
...@@ -593,7 +593,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -593,7 +593,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
{ {
nTestMatch -= 10000000; nTestMatch -= 10000000;
} }
else if ( nMatchType & IMPL_FONT_ATTR_SYMBOL ) else if ( nMatchType & ImplFontAttrs::Symbol )
{ {
nTestMatch -= 10000; nTestMatch -= 10000;
} }
...@@ -605,123 +605,123 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -605,123 +605,123 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
} }
// match ALLSCRIPT? attribute // match ALLSCRIPT? attribute
if( nSearchType & IMPL_FONT_ATTR_ALLSCRIPT ) if( nSearchType & ImplFontAttrs::AllScript )
{ {
if( nMatchType & IMPL_FONT_ATTR_ALLSCRIPT ) if( nMatchType & ImplFontAttrs::AllScript )
{ {
nTestMatch += 1000000*2; nTestMatch += 1000000*2;
} }
if( nSearchType & IMPL_FONT_ATTR_ALLSUBSCRIPT ) if( nSearchType & ImplFontAttrs::AllSubscript )
{ {
if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_ALLSUBSCRIPT) ) if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::AllSubscript) )
nTestMatch += 1000000*2; nTestMatch += 1000000*2;
if( 0 != ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_BRUSHSCRIPT) ) if( ImplFontAttrs::None != ((nSearchType ^ nMatchType) & ImplFontAttrs::BrushScript) )
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
} }
else if( nMatchType & IMPL_FONT_ATTR_ALLSCRIPT ) else if( nMatchType & ImplFontAttrs::AllScript )
{ {
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test MONOSPACE+TYPEWRITER attributes // test MONOSPACE+TYPEWRITER attributes
if( nSearchType & IMPL_FONT_ATTR_FIXED ) if( nSearchType & ImplFontAttrs::Fixed )
{ {
if( nMatchType & IMPL_FONT_ATTR_FIXED ) if( nMatchType & ImplFontAttrs::Fixed )
nTestMatch += 1000000*2; nTestMatch += 1000000*2;
// a typewriter attribute is even better // a typewriter attribute is even better
if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_TYPEWRITER) ) if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Typewriter) )
nTestMatch += 10000*2; nTestMatch += 10000*2;
} }
else if( nMatchType & IMPL_FONT_ATTR_FIXED ) else if( nMatchType & ImplFontAttrs::Fixed )
{ {
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test SPECIAL attribute // test SPECIAL attribute
if( nSearchType & IMPL_FONT_ATTR_SPECIAL ) if( nSearchType & ImplFontAttrs::Special )
{ {
if( nMatchType & IMPL_FONT_ATTR_SPECIAL ) if( nMatchType & ImplFontAttrs::Special )
{ {
nTestMatch += 10000; nTestMatch += 10000;
} }
else if( !(nSearchType & IMPL_FONT_ATTR_ALLSERIFSTYLE) ) else if( !(nSearchType & ImplFontAttrs::AllSerifStyle) )
{ {
if( nMatchType & IMPL_FONT_ATTR_SERIF ) if( nMatchType & ImplFontAttrs::Serif )
{ {
nTestMatch += 1000*2; nTestMatch += 1000*2;
} }
else if( nMatchType & IMPL_FONT_ATTR_SANSSERIF ) else if( nMatchType & ImplFontAttrs::SansSerif )
{ {
nTestMatch += 1000; nTestMatch += 1000;
} }
} }
} }
else if( (nMatchType & IMPL_FONT_ATTR_SPECIAL) && !(nSearchType & IMPL_FONT_ATTR_SYMBOL) ) else if( (nMatchType & ImplFontAttrs::Special) && !(nSearchType & ImplFontAttrs::Symbol) )
{ {
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test DECORATIVE attribute // test DECORATIVE attribute
if( nSearchType & IMPL_FONT_ATTR_DECORATIVE ) if( nSearchType & ImplFontAttrs::Decorative )
{ {
if( nMatchType & IMPL_FONT_ATTR_DECORATIVE ) if( nMatchType & ImplFontAttrs::Decorative )
{ {
nTestMatch += 10000; nTestMatch += 10000;
} }
else if( !(nSearchType & IMPL_FONT_ATTR_ALLSERIFSTYLE) ) else if( !(nSearchType & ImplFontAttrs::AllSerifStyle) )
{ {
if( nMatchType & IMPL_FONT_ATTR_SERIF ) if( nMatchType & ImplFontAttrs::Serif )
nTestMatch += 1000*2; nTestMatch += 1000*2;
else if ( nMatchType & IMPL_FONT_ATTR_SANSSERIF ) else if ( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch += 1000; nTestMatch += 1000;
} }
} }
else if( nMatchType & IMPL_FONT_ATTR_DECORATIVE ) else if( nMatchType & ImplFontAttrs::Decorative )
{ {
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test TITLE+CAPITALS attributes // test TITLE+CAPITALS attributes
if( nSearchType & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS) ) if( nSearchType & (ImplFontAttrs::Titling | ImplFontAttrs::Capitals) )
{ {
if( nMatchType & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS) ) if( nMatchType & (ImplFontAttrs::Titling | ImplFontAttrs::Capitals) )
{ {
nTestMatch += 1000000*2; nTestMatch += 1000000*2;
} }
if( 0 == ((nSearchType^nMatchType) & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS))) if( ImplFontAttrs::None == ((nSearchType^nMatchType) & ImplFontAttrs(ImplFontAttrs::Titling | ImplFontAttrs::Capitals)))
{ {
nTestMatch += 1000000; nTestMatch += 1000000;
} }
else if( (nMatchType & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS)) && else if( (nMatchType & (ImplFontAttrs::Titling | ImplFontAttrs::Capitals)) &&
(nMatchType & (IMPL_FONT_ATTR_STANDARD | IMPL_FONT_ATTR_DEFAULT)) ) (nMatchType & (ImplFontAttrs::Standard | ImplFontAttrs::Default)) )
{ {
nTestMatch += 1000000; nTestMatch += 1000000;
} }
} }
else if( nMatchType & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS) ) else if( nMatchType & (ImplFontAttrs::Titling | ImplFontAttrs::Capitals) )
{ {
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test OUTLINE+SHADOW attributes // test OUTLINE+SHADOW attributes
if( nSearchType & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW) ) if( nSearchType & (ImplFontAttrs::Outline | ImplFontAttrs::Shadow) )
{ {
if( nMatchType & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW) ) if( nMatchType & (ImplFontAttrs::Outline | ImplFontAttrs::Shadow) )
{ {
nTestMatch += 1000000*2; nTestMatch += 1000000*2;
} }
if( 0 == ((nSearchType ^ nMatchType) & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW)) ) if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs(ImplFontAttrs::Outline | ImplFontAttrs::Shadow)) )
{ {
nTestMatch += 1000000; nTestMatch += 1000000;
} }
else if( (nMatchType & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW)) && else if( (nMatchType & (ImplFontAttrs::Outline | ImplFontAttrs::Shadow)) &&
(nMatchType & (IMPL_FONT_ATTR_STANDARD | IMPL_FONT_ATTR_DEFAULT)) ) (nMatchType & (ImplFontAttrs::Standard | ImplFontAttrs::Default)) )
{ {
nTestMatch += 1000000; nTestMatch += 1000000;
} }
} }
else if ( nMatchType & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW) ) else if ( nMatchType & (ImplFontAttrs::Outline | ImplFontAttrs::Shadow) )
{ {
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
...@@ -736,33 +736,33 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -736,33 +736,33 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
nTestMatch += 5000; nTestMatch += 5000;
} }
// test SERIF attribute // test SERIF attribute
if( nSearchType & IMPL_FONT_ATTR_SERIF ) if( nSearchType & ImplFontAttrs::Serif )
{ {
if( nMatchType & IMPL_FONT_ATTR_SERIF ) if( nMatchType & ImplFontAttrs::Serif )
nTestMatch += 1000000*2; nTestMatch += 1000000*2;
else if( nMatchType & IMPL_FONT_ATTR_SANSSERIF ) else if( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test SANSERIF attribute // test SANSERIF attribute
if( nSearchType & IMPL_FONT_ATTR_SANSSERIF ) if( nSearchType & ImplFontAttrs::SansSerif )
{ {
if( nMatchType & IMPL_FONT_ATTR_SANSSERIF ) if( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch += 1000000; nTestMatch += 1000000;
else if ( nMatchType & IMPL_FONT_ATTR_SERIF ) else if ( nMatchType & ImplFontAttrs::Serif )
nTestMatch -= 1000000; nTestMatch -= 1000000;
} }
// test ITALIC attribute // test ITALIC attribute
if( nSearchType & IMPL_FONT_ATTR_ITALIC ) if( nSearchType & ImplFontAttrs::Italic )
{ {
if( pData->GetTypeFaces() & FONT_FAMILY_ITALIC ) if( pData->GetTypeFaces() & FONT_FAMILY_ITALIC )
nTestMatch += 1000000*3; nTestMatch += 1000000*3;
if( nMatchType & IMPL_FONT_ATTR_ITALIC ) if( nMatchType & ImplFontAttrs::Italic )
nTestMatch += 1000000; nTestMatch += 1000000;
} }
else if( !(nSearchType & IMPL_FONT_ATTR_ALLSCRIPT) && else if( !(nSearchType & ImplFontAttrs::AllScript) &&
((nMatchType & IMPL_FONT_ATTR_ITALIC) || ((nMatchType & ImplFontAttrs::Italic) ||
!(pData->GetTypeFaces() & FONT_FAMILY_NONEITALIC)) ) !(pData->GetTypeFaces() & FONT_FAMILY_NONEITALIC)) )
{ {
nTestMatch -= 1000000*2; nTestMatch -= 1000000*2;
...@@ -826,44 +826,44 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -826,44 +826,44 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
nTestMatch -= 10000*4; nTestMatch -= 10000*4;
// test STANDARD+DEFAULT+FULL+NORMAL attributes // test STANDARD+DEFAULT+FULL+NORMAL attributes
if( nMatchType & IMPL_FONT_ATTR_STANDARD ) if( nMatchType & ImplFontAttrs::Standard )
nTestMatch += 10000*2; nTestMatch += 10000*2;
if( nMatchType & IMPL_FONT_ATTR_DEFAULT ) if( nMatchType & ImplFontAttrs::Default )
nTestMatch += 10000; nTestMatch += 10000;
if( nMatchType & IMPL_FONT_ATTR_FULL ) if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000; nTestMatch += 10000;
if( nMatchType & IMPL_FONT_ATTR_NORMAL ) if( nMatchType & ImplFontAttrs::Normal )
nTestMatch += 10000; nTestMatch += 10000;
// test OTHERSTYLE attribute // test OTHERSTYLE attribute
if( ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_OTHERSTYLE) != 0 ) if( ((nSearchType ^ nMatchType) & ImplFontAttrs::OtherStyle) != ImplFontAttrs::None )
{ {
nTestMatch -= 10000; nTestMatch -= 10000;
} }
// test ROUNDED attribute // test ROUNDED attribute
if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_ROUNDED) ) if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Rounded) )
nTestMatch += 1000; nTestMatch += 1000;
// test TYPEWRITER attribute // test TYPEWRITER attribute
if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_TYPEWRITER) ) if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Typewriter) )
nTestMatch += 1000; nTestMatch += 1000;
// test GOTHIC attribute // test GOTHIC attribute
if( nSearchType & IMPL_FONT_ATTR_GOTHIC ) if( nSearchType & ImplFontAttrs::Gothic )
{ {
if( nMatchType & IMPL_FONT_ATTR_GOTHIC ) if( nMatchType & ImplFontAttrs::Gothic )
nTestMatch += 1000*3; nTestMatch += 1000*3;
if( nMatchType & IMPL_FONT_ATTR_SANSSERIF ) if( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch += 1000*2; nTestMatch += 1000*2;
} }
// test SCHOOLBOOK attribute // test SCHOOLBOOK attribute
if( nSearchType & IMPL_FONT_ATTR_SCHOOLBOOK ) if( nSearchType & ImplFontAttrs::Schoolbook )
{ {
if( nMatchType & IMPL_FONT_ATTR_SCHOOLBOOK ) if( nMatchType & ImplFontAttrs::Schoolbook )
nTestMatch += 1000*3; nTestMatch += 1000*3;
if( nMatchType & IMPL_FONT_ATTR_SERIF ) if( nMatchType & ImplFontAttrs::Serif )
nTestMatch += 1000*2; nTestMatch += 1000*2;
} }
...@@ -877,13 +877,13 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea ...@@ -877,13 +877,13 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
else if( nTestMatch == nBestMatch ) else if( nTestMatch == nBestMatch )
{ {
// some fonts are more suitable defaults // some fonts are more suitable defaults
if( nMatchType & IMPL_FONT_ATTR_DEFAULT ) if( nMatchType & ImplFontAttrs::Default )
{ {
pFoundData = pData; pFoundData = pData;
nBestType = nMatchType; nBestType = nMatchType;
} }
else if( (nMatchType & IMPL_FONT_ATTR_STANDARD) && else if( (nMatchType & ImplFontAttrs::Standard) &&
!(nBestType & IMPL_FONT_ATTR_DEFAULT) ) !(nBestType & ImplFontAttrs::Default) )
{ {
pFoundData = pData; pFoundData = pData;
nBestType = nMatchType; nBestType = nMatchType;
...@@ -929,11 +929,11 @@ PhysicalFontFamily* PhysicalFontCollection::FindDefaultFont() const ...@@ -929,11 +929,11 @@ PhysicalFontFamily* PhysicalFontCollection::FindDefaultFont() const
for(; it != maPhysicalFontFamilies.end(); ++it ) for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
PhysicalFontFamily* pData = (*it).second; PhysicalFontFamily* pData = (*it).second;
if( pData->GetMatchType() & IMPL_FONT_ATTR_SYMBOL ) if( pData->GetMatchType() & ImplFontAttrs::Symbol )
continue; continue;
pFoundData = pData; pFoundData = pData;
if( pData->GetMatchType() & (IMPL_FONT_ATTR_DEFAULT|IMPL_FONT_ATTR_STANDARD) ) if( pData->GetMatchType() & (ImplFontAttrs::Default|ImplFontAttrs::Standard) )
break; break;
} }
if( pFoundData ) if( pFoundData )
...@@ -1144,9 +1144,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r ...@@ -1144,9 +1144,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
OUString aSearchShortName; OUString aSearchShortName;
OUString aSearchFamilyName; OUString aSearchFamilyName;
FontWeight eSearchWeight = rFSD.GetWeight(); FontWeight eSearchWeight = rFSD.GetWeight();
FontWidth eSearchWidth = rFSD.GetWidthType(); FontWidth eSearchWidth = rFSD.GetWidthType();
sal_uLong nSearchType = 0; ImplFontAttrs nSearchType = ImplFontAttrs::None;
utl::FontSubstConfiguration::getMapName( aSearchName, aSearchShortName, aSearchFamilyName, utl::FontSubstConfiguration::getMapName( aSearchName, aSearchShortName, aSearchFamilyName,
eSearchWeight, eSearchWidth, nSearchType ); eSearchWeight, eSearchWidth, nSearchType );
...@@ -1216,9 +1216,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r ...@@ -1216,9 +1216,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
OUString aTempShortName; OUString aTempShortName;
OUString aTempFamilyName; OUString aTempFamilyName;
sal_uLong nTempType = 0; ImplFontAttrs nTempType = ImplFontAttrs::None;
FontWeight eTempWeight = rFSD.GetWeight(); FontWeight eTempWeight = rFSD.GetWeight();
FontWidth eTempWidth = WIDTH_DONTKNOW; FontWidth eTempWidth = WIDTH_DONTKNOW;
utl::FontSubstConfiguration::getMapName( aSearchName, aTempShortName, aTempFamilyName, utl::FontSubstConfiguration::getMapName( aSearchName, aTempShortName, aTempFamilyName,
eTempWeight, eTempWidth, nTempType ); eTempWeight, eTempWidth, nTempType );
...@@ -1263,18 +1263,18 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r ...@@ -1263,18 +1263,18 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
// if still needed use the font request's attributes to find a good match // if still needed use the font request's attributes to find a good match
if (MsLangId::isSimplifiedChinese(rFSD.meLanguage)) if (MsLangId::isSimplifiedChinese(rFSD.meLanguage))
nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_SC; nSearchType |= ImplFontAttrs::CJK | ImplFontAttrs::CJK_SC;
else if (MsLangId::isTraditionalChinese(rFSD.meLanguage)) else if (MsLangId::isTraditionalChinese(rFSD.meLanguage))
nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_TC; nSearchType |= ImplFontAttrs::CJK | ImplFontAttrs::CJK_TC;
else if (MsLangId::isKorean(rFSD.meLanguage)) else if (MsLangId::isKorean(rFSD.meLanguage))
nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_KR; nSearchType |= ImplFontAttrs::CJK | ImplFontAttrs::CJK_KR;
else if (rFSD.meLanguage == LANGUAGE_JAPANESE) else if (rFSD.meLanguage == LANGUAGE_JAPANESE)
nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_JP; nSearchType |= ImplFontAttrs::CJK | ImplFontAttrs::CJK_JP;
else else
{ {
nSearchType |= lcl_IsCJKFont( rFSD.GetFamilyName() ); nSearchType |= lcl_IsCJKFont( rFSD.GetFamilyName() );
if( rFSD.IsSymbolFont() ) if( rFSD.IsSymbolFont() )
nSearchType |= IMPL_FONT_ATTR_SYMBOL; nSearchType |= ImplFontAttrs::Symbol;
} }
PhysicalFontFamily::CalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.GetFamilyType(), pFontAttr ); PhysicalFontFamily::CalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.GetFamilyType(), pFontAttr );
...@@ -1298,7 +1298,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r ...@@ -1298,7 +1298,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
rFSD.SetWeight( eSearchWeight ); rFSD.SetWeight( eSearchWeight );
} }
if( (nSearchType & IMPL_FONT_ATTR_ITALIC) && if( (nSearchType & ImplFontAttrs::Italic) &&
((rFSD.GetSlant() == ITALIC_DONTKNOW) || ((rFSD.GetSlant() == ITALIC_DONTKNOW) ||
(rFSD.GetSlant() == ITALIC_NONE)) && (rFSD.GetSlant() == ITALIC_NONE)) &&
(pFoundData->GetTypeFaces() & FONT_FAMILY_ITALIC) ) (pFoundData->GetTypeFaces() & FONT_FAMILY_ITALIC) )
......
...@@ -27,21 +27,21 @@ ...@@ -27,21 +27,21 @@
#include "PhysicalFontFamily.hxx" #include "PhysicalFontFamily.hxx"
void PhysicalFontFamily::CalcType( sal_uLong& rType, FontWeight& rWeight, FontWidth& rWidth, void PhysicalFontFamily::CalcType( ImplFontAttrs& rType, FontWeight& rWeight, FontWidth& rWidth,
FontFamily eFamily, const utl::FontNameAttr* pFontAttr ) FontFamily eFamily, const utl::FontNameAttr* pFontAttr )
{ {
if ( eFamily != FAMILY_DONTKNOW ) if ( eFamily != FAMILY_DONTKNOW )
{ {
if ( eFamily == FAMILY_SWISS ) if ( eFamily == FAMILY_SWISS )
rType |= IMPL_FONT_ATTR_SANSSERIF; rType |= ImplFontAttrs::SansSerif;
else if ( eFamily == FAMILY_ROMAN ) else if ( eFamily == FAMILY_ROMAN )
rType |= IMPL_FONT_ATTR_SERIF; rType |= ImplFontAttrs::Serif;
else if ( eFamily == FAMILY_SCRIPT ) else if ( eFamily == FAMILY_SCRIPT )
rType |= IMPL_FONT_ATTR_SCRIPT; rType |= ImplFontAttrs::Script;
else if ( eFamily == FAMILY_MODERN ) else if ( eFamily == FAMILY_MODERN )
rType |= IMPL_FONT_ATTR_FIXED; rType |= ImplFontAttrs::Fixed;
else if ( eFamily == FAMILY_DECORATIVE ) else if ( eFamily == FAMILY_DECORATIVE )
rType |= IMPL_FONT_ATTR_DECORATIVE; rType |= ImplFontAttrs::Decorative;
} }
if ( pFontAttr ) if ( pFontAttr )
...@@ -57,7 +57,7 @@ void PhysicalFontFamily::CalcType( sal_uLong& rType, FontWeight& rWeight, FontWi ...@@ -57,7 +57,7 @@ void PhysicalFontFamily::CalcType( sal_uLong& rType, FontWeight& rWeight, FontWi
} }
} }
static unsigned lcl_IsCJKFont( const OUString& rFontName ) static ImplFontAttrs lcl_IsCJKFont( const OUString& rFontName )
{ {
// Test, if Fontname includes CJK characters --> In this case we // Test, if Fontname includes CJK characters --> In this case we
// mention that it is a CJK font // mention that it is a CJK font
...@@ -67,33 +67,33 @@ static unsigned lcl_IsCJKFont( const OUString& rFontName ) ...@@ -67,33 +67,33 @@ static unsigned lcl_IsCJKFont( const OUString& rFontName )
// japanese // japanese
if ( ((ch >= 0x3040) && (ch <= 0x30FF)) || if ( ((ch >= 0x3040) && (ch <= 0x30FF)) ||
((ch >= 0x3190) && (ch <= 0x319F)) ) ((ch >= 0x3190) && (ch <= 0x319F)) )
return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP; return ImplFontAttrs::CJK|ImplFontAttrs::CJK_JP;
// korean // korean
if ( ((ch >= 0xAC00) && (ch <= 0xD7AF)) || if ( ((ch >= 0xAC00) && (ch <= 0xD7AF)) ||
((ch >= 0x3130) && (ch <= 0x318F)) || ((ch >= 0x3130) && (ch <= 0x318F)) ||
((ch >= 0x1100) && (ch <= 0x11FF)) ) ((ch >= 0x1100) && (ch <= 0x11FF)) )
return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR; return ImplFontAttrs::CJK|ImplFontAttrs::CJK_KR;
// chinese // chinese
if ( ((ch >= 0x3400) && (ch <= 0x9FFF)) ) if ( ((ch >= 0x3400) && (ch <= 0x9FFF)) )
return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_TC|IMPL_FONT_ATTR_CJK_SC; return ImplFontAttrs::CJK|ImplFontAttrs::CJK_TC|ImplFontAttrs::CJK_SC;
// cjk // cjk
if ( ((ch >= 0x3000) && (ch <= 0xD7AF)) || if ( ((ch >= 0x3000) && (ch <= 0xD7AF)) ||
((ch >= 0xFF00) && (ch <= 0xFFEE)) ) ((ch >= 0xFF00) && (ch <= 0xFFEE)) )
return IMPL_FONT_ATTR_CJK; return ImplFontAttrs::CJK;
} }
return 0; return ImplFontAttrs::None;
} }
PhysicalFontFamily::PhysicalFontFamily( const OUString& rSearchName ) PhysicalFontFamily::PhysicalFontFamily( const OUString& rSearchName )
: mpFirst( NULL ), : mpFirst( NULL ),
maSearchName( rSearchName ), maSearchName( rSearchName ),
mnTypeFaces( 0 ), mnTypeFaces( 0 ),
mnMatchType( 0 ), mnMatchType( ImplFontAttrs::None ),
meMatchWeight( WEIGHT_DONTKNOW ), meMatchWeight( WEIGHT_DONTKNOW ),
meMatchWidth( WIDTH_DONTKNOW ), meMatchWidth( WIDTH_DONTKNOW ),
meFamily( FAMILY_DONTKNOW ), meFamily( FAMILY_DONTKNOW ),
...@@ -161,7 +161,7 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewData ) ...@@ -161,7 +161,7 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewData )
if( (meMatchWeight == WEIGHT_DONTKNOW) if( (meMatchWeight == WEIGHT_DONTKNOW)
|| (meMatchWidth == WIDTH_DONTKNOW) || (meMatchWidth == WIDTH_DONTKNOW)
|| (mnMatchType == 0) ) || (mnMatchType == ImplFontAttrs::None) )
{ {
// TODO: is it cheaper to calc matching attributes now or on demand? // TODO: is it cheaper to calc matching attributes now or on demand?
// calc matching attributes if other entries are already initialized // calc matching attributes if other entries are already initialized
......
...@@ -152,7 +152,7 @@ void Impl_Font::AskConfig() ...@@ -152,7 +152,7 @@ void Impl_Font::AskConfig()
OUString aShortName; OUString aShortName;
OUString aFamilyName; OUString aFamilyName;
sal_uLong nType = 0; ImplFontAttrs nType = ImplFontAttrs::None;
FontWeight eWeight = WEIGHT_DONTKNOW; FontWeight eWeight = WEIGHT_DONTKNOW;
FontWidth eWidthType = WIDTH_DONTKNOW; FontWidth eWidthType = WIDTH_DONTKNOW;
OUString aMapName = GetEnglishSearchFontName( maFamilyName ); OUString aMapName = GetEnglishSearchFontName( maFamilyName );
...@@ -172,21 +172,21 @@ void Impl_Font::AskConfig() ...@@ -172,21 +172,21 @@ void Impl_Font::AskConfig()
// the font was found in the configuration // the font was found in the configuration
if( meFamily == FAMILY_DONTKNOW ) if( meFamily == FAMILY_DONTKNOW )
{ {
if ( pFontAttr->Type & IMPL_FONT_ATTR_SERIF ) if ( pFontAttr->Type & ImplFontAttrs::Serif )
meFamily = FAMILY_ROMAN; meFamily = FAMILY_ROMAN;
else if ( pFontAttr->Type & IMPL_FONT_ATTR_SANSSERIF ) else if ( pFontAttr->Type & ImplFontAttrs::SansSerif )
meFamily = FAMILY_SWISS; meFamily = FAMILY_SWISS;
else if ( pFontAttr->Type & IMPL_FONT_ATTR_TYPEWRITER ) else if ( pFontAttr->Type & ImplFontAttrs::Typewriter )
meFamily = FAMILY_MODERN; meFamily = FAMILY_MODERN;
else if ( pFontAttr->Type & IMPL_FONT_ATTR_ITALIC ) else if ( pFontAttr->Type & ImplFontAttrs::Italic )
meFamily = FAMILY_SCRIPT; meFamily = FAMILY_SCRIPT;
else if ( pFontAttr->Type & IMPL_FONT_ATTR_DECORATIVE ) else if ( pFontAttr->Type & ImplFontAttrs::Decorative )
meFamily = FAMILY_DECORATIVE; meFamily = FAMILY_DECORATIVE;
} }
if( mePitch == PITCH_DONTKNOW ) if( mePitch == PITCH_DONTKNOW )
{ {
if ( pFontAttr->Type & IMPL_FONT_ATTR_FIXED ) if ( pFontAttr->Type & ImplFontAttrs::Fixed )
mePitch = PITCH_FIXED; mePitch = PITCH_FIXED;
} }
} }
...@@ -194,15 +194,15 @@ void Impl_Font::AskConfig() ...@@ -194,15 +194,15 @@ void Impl_Font::AskConfig()
// if some attributes are still unknown then use the FontSubst magic // if some attributes are still unknown then use the FontSubst magic
if( meFamily == FAMILY_DONTKNOW ) if( meFamily == FAMILY_DONTKNOW )
{ {
if( nType & IMPL_FONT_ATTR_SERIF ) if( nType & ImplFontAttrs::Serif )
meFamily = FAMILY_ROMAN; meFamily = FAMILY_ROMAN;
else if( nType & IMPL_FONT_ATTR_SANSSERIF ) else if( nType & ImplFontAttrs::SansSerif )
meFamily = FAMILY_SWISS; meFamily = FAMILY_SWISS;
else if( nType & IMPL_FONT_ATTR_TYPEWRITER ) else if( nType & ImplFontAttrs::Typewriter )
meFamily = FAMILY_MODERN; meFamily = FAMILY_MODERN;
else if( nType & IMPL_FONT_ATTR_ITALIC ) else if( nType & ImplFontAttrs::Italic )
meFamily = FAMILY_SCRIPT; meFamily = FAMILY_SCRIPT;
else if( nType & IMPL_FONT_ATTR_DECORATIVE ) else if( nType & ImplFontAttrs::Decorative )
meFamily = FAMILY_DECORATIVE; meFamily = FAMILY_DECORATIVE;
} }
......
...@@ -543,7 +543,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon ...@@ -543,7 +543,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon
} }
// are the missing characters symbols? // are the missing characters symbols?
pFontFamily = pFontCollection->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL, pFontFamily = pFontCollection->ImplFindByAttributes( ImplFontAttrs::Symbol,
rFontSelData.GetWeight(), rFontSelData.GetWeight(),
rFontSelData.GetWidthType(), rFontSelData.GetWidthType(),
rFontSelData.GetSlant(), rFontSelData.GetSlant(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment