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
......
...@@ -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