summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/unotools/fontcfg.hxx135
-rw-r--r--unotools/source/config/fontcfg.cxx132
-rw-r--r--vcl/inc/PhysicalFontCollection.hxx2
-rw-r--r--vcl/inc/PhysicalFontFamily.hxx8
-rw-r--r--vcl/source/font/PhysicalFontCollection.cxx210
-rw-r--r--vcl/source/font/PhysicalFontFamily.cxx28
-rw-r--r--vcl/source/gdi/font.cxx24
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx2
8 files changed, 273 insertions, 268 deletions
diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx
index d8c7b9699941..0b8368885cf7 100644
--- a/include/unotools/fontcfg.hxx
+++ b/include/unotools/fontcfg.hxx
@@ -26,11 +26,74 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <o3tl/typed_flags_set.hxx>
#include <unordered_map>
#include <unordered_set>
#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
{
@@ -64,74 +127,16 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
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
{
OUString Name;
- ::std::vector< OUString > Substitutions;
- ::std::vector< OUString > MSSubstitutions;
- ::std::vector< OUString > PSSubstitutions;
- ::std::vector< OUString > HTMLSubstitutions;
+ ::std::vector< OUString > Substitutions;
+ ::std::vector< OUString > MSSubstitutions;
+ ::std::vector< OUString > PSSubstitutions;
+ ::std::vector< OUString > HTMLSubstitutions;
FontWeight Weight;
FontWidth Width;
- unsigned long Type; // bitfield of IMPL_FONT_ATTR_*
+ ImplFontAttrs Type;
};
class UNOTOOLS_DLLPUBLIC FontSubstConfiguration
@@ -164,7 +169,7 @@ private:
const OUString& rType ) const;
FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& rFont,
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;
void readLocaleSubst( const OUString& rBcp47 ) const;
public:
@@ -177,7 +182,7 @@ public:
const OUString& rFontName,
const LanguageTag& rLanguageTag = LanguageTag( OUString( "en"))
) 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
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 8f496a05116a..60ae20a67228 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -554,71 +554,71 @@ static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] =
struct ImplFontAttrTypeSearchData
{
const char* mpStr;
- sal_uLong mnType;
+ ImplFontAttrs mnType;
};
static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
{
-{ "monotype", 0 },
-{ "linotype", 0 },
-{ "titling", IMPL_FONT_ATTR_TITLING },
-{ "captitals", IMPL_FONT_ATTR_CAPITALS },
-{ "captital", IMPL_FONT_ATTR_CAPITALS },
-{ "caps", IMPL_FONT_ATTR_CAPITALS },
-{ "italic", IMPL_FONT_ATTR_ITALIC },
-{ "oblique", IMPL_FONT_ATTR_ITALIC },
-{ "rounded", IMPL_FONT_ATTR_ROUNDED },
-{ "outline", IMPL_FONT_ATTR_OUTLINE },
-{ "shadow", IMPL_FONT_ATTR_SHADOW },
-{ "handwriting", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT },
-{ "hand", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT },
-{ "signet", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT },
-{ "script", IMPL_FONT_ATTR_BRUSHSCRIPT | IMPL_FONT_ATTR_SCRIPT },
-{ "calligraphy", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT },
-{ "chancery", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT },
-{ "corsiva", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT },
-{ "gothic", IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_GOTHIC },
-{ "schoolbook", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK },
-{ "schlbk", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK },
-{ "typewriter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED },
-{ "lineprinter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED },
-{ "monospaced", IMPL_FONT_ATTR_FIXED },
-{ "monospace", IMPL_FONT_ATTR_FIXED },
-{ "mono", IMPL_FONT_ATTR_FIXED },
-{ "fixed", IMPL_FONT_ATTR_FIXED },
-{ "sansserif", IMPL_FONT_ATTR_SANSSERIF },
-{ "sans", IMPL_FONT_ATTR_SANSSERIF },
-{ "swiss", IMPL_FONT_ATTR_SANSSERIF },
-{ "serif", IMPL_FONT_ATTR_SERIF },
-{ "bright", IMPL_FONT_ATTR_SERIF },
-{ "symbols", IMPL_FONT_ATTR_SYMBOL },
-{ "symbol", IMPL_FONT_ATTR_SYMBOL },
-{ "dingbats", IMPL_FONT_ATTR_SYMBOL },
-{ "dings", IMPL_FONT_ATTR_SYMBOL },
-{ "ding", IMPL_FONT_ATTR_SYMBOL },
-{ "bats", IMPL_FONT_ATTR_SYMBOL },
-{ "math", IMPL_FONT_ATTR_SYMBOL },
-{ "oldstyle", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "oldface", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "old", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "new", 0 },
-{ "modern", 0 },
-{ "lucida", 0 },
-{ "regular", 0 },
-{ "extended", 0 },
-{ "extra", IMPL_FONT_ATTR_OTHERSTYLE },
-{ "ext", 0 },
-{ "scalable", 0 },
-{ "scale", 0 },
-{ "nimbus", 0 },
-{ "adobe", 0 },
-{ "itc", 0 },
-{ "amt", 0 },
-{ "mt", 0 },
-{ "ms", 0 },
-{ "cpi", 0 },
-{ "no", 0 },
-{ NULL, 0 },
+{ "monotype", ImplFontAttrs::None },
+{ "linotype", ImplFontAttrs::None },
+{ "titling", ImplFontAttrs::Titling },
+{ "captitals", ImplFontAttrs::Capitals },
+{ "captital", ImplFontAttrs::Capitals },
+{ "caps", ImplFontAttrs::Capitals },
+{ "italic", ImplFontAttrs::Italic },
+{ "oblique", ImplFontAttrs::Italic },
+{ "rounded", ImplFontAttrs::Rounded },
+{ "outline", ImplFontAttrs::Outline },
+{ "shadow", ImplFontAttrs::Shadow },
+{ "handwriting", ImplFontAttrs::Handwriting | ImplFontAttrs::Script },
+{ "hand", ImplFontAttrs::Handwriting | ImplFontAttrs::Script },
+{ "signet", ImplFontAttrs::Handwriting | ImplFontAttrs::Script },
+{ "script", ImplFontAttrs::BrushScript | ImplFontAttrs::Script },
+{ "calligraphy", ImplFontAttrs::Chancery | ImplFontAttrs::Script },
+{ "chancery", ImplFontAttrs::Chancery | ImplFontAttrs::Script },
+{ "corsiva", ImplFontAttrs::Chancery | ImplFontAttrs::Script },
+{ "gothic", ImplFontAttrs::SansSerif | ImplFontAttrs::Gothic },
+{ "schoolbook", ImplFontAttrs::Serif | ImplFontAttrs::Schoolbook },
+{ "schlbk", ImplFontAttrs::Serif | ImplFontAttrs::Schoolbook },
+{ "typewriter", ImplFontAttrs::Typewriter | ImplFontAttrs::Fixed },
+{ "lineprinter", ImplFontAttrs::Typewriter | ImplFontAttrs::Fixed },
+{ "monospaced", ImplFontAttrs::Fixed },
+{ "monospace", ImplFontAttrs::Fixed },
+{ "mono", ImplFontAttrs::Fixed },
+{ "fixed", ImplFontAttrs::Fixed },
+{ "sansserif", ImplFontAttrs::SansSerif },
+{ "sans", ImplFontAttrs::SansSerif },
+{ "swiss", ImplFontAttrs::SansSerif },
+{ "serif", ImplFontAttrs::Serif },
+{ "bright", ImplFontAttrs::Serif },
+{ "symbols", ImplFontAttrs::Symbol },
+{ "symbol", ImplFontAttrs::Symbol },
+{ "dingbats", ImplFontAttrs::Symbol },
+{ "dings", ImplFontAttrs::Symbol },
+{ "ding", ImplFontAttrs::Symbol },
+{ "bats", ImplFontAttrs::Symbol },
+{ "math", ImplFontAttrs::Symbol },
+{ "oldstyle", ImplFontAttrs::OtherStyle },
+{ "oldface", ImplFontAttrs::OtherStyle },
+{ "old", ImplFontAttrs::OtherStyle },
+{ "new", ImplFontAttrs::None },
+{ "modern", ImplFontAttrs::None },
+{ "lucida", ImplFontAttrs::None },
+{ "regular", ImplFontAttrs::None },
+{ "extended", ImplFontAttrs::None },
+{ "extra", ImplFontAttrs::OtherStyle },
+{ "ext", ImplFontAttrs::None },
+{ "scalable", ImplFontAttrs::None },
+{ "scale", ImplFontAttrs::None },
+{ "nimbus", ImplFontAttrs::None },
+{ "adobe", ImplFontAttrs::None },
+{ "itc", ImplFontAttrs::None },
+{ "amt", ImplFontAttrs::None },
+{ "mt", ImplFontAttrs::None },
+{ "ms", ImplFontAttrs::None },
+{ "cpi", ImplFontAttrs::None },
+{ "no", ImplFontAttrs::None },
+{ NULL, ImplFontAttrs::None },
};
static bool ImplKillLeading( OUString& rName, const char* const* ppStr )
@@ -723,7 +723,7 @@ static bool ImplFindAndErase( OUString& rName, const char* pStr )
void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rShortName,
OUString& rFamilyName, FontWeight& rWeight,
- FontWidth& rWidth, sal_uLong& rType )
+ FontWidth& rWidth, ImplFontAttrs& rType )
{
rShortName = rOrgName;
@@ -767,7 +767,7 @@ void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rSh
}
// Type
- rType = 0;
+ rType = ImplFontAttrs::None;
const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList;
while ( pTypeList->mpStr )
{
@@ -983,10 +983,10 @@ FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Refe
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
{
- unsigned long type = 0;
+ sal_uLong type = 0;
try
{
Any aAny = rFont->getByName( rType );
@@ -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
diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx
index 53bdfb44e542..36dba9f7980b 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/PhysicalFontCollection.hxx
@@ -80,7 +80,7 @@ protected:
PhysicalFontFamily* ImplFindByAliasName(const OUString& rSearchName,
const OUString& rShortName) 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;
PhysicalFontFamily* FindDefaultFont() const;
diff --git a/vcl/inc/PhysicalFontFamily.hxx b/vcl/inc/PhysicalFontFamily.hxx
index 61f7c42b34ff..a2fbf1baa0a1 100644
--- a/vcl/inc/PhysicalFontFamily.hxx
+++ b/vcl/inc/PhysicalFontFamily.hxx
@@ -29,7 +29,7 @@
class PhysicalFontFace;
class PhysicalFontCollection;
-// flags for mnMatchType member
+// flags for mnTypeFaces member
#define FONT_FAMILY_SCALABLE (1<<0)
#define FONT_FAMILY_SYMBOL (1<<1)
#define FONT_FAMILY_NONESYMBOL (1<<2)
@@ -49,7 +49,7 @@ public:
const OUString& GetSearchName() const { return maSearchName; }
const OUString& GetAliasNames() const { return maMapNames; }
const OUString& GetMatchFamilyName() const { return maMatchFamilyName; }
- sal_uLong GetMatchType() const { return mnMatchType ; }
+ ImplFontAttrs GetMatchType() const { return mnMatchType ; }
FontWeight GetMatchWeight() const { return meMatchWeight ; }
FontWidth GetMatchWidth() const { return meMatchWidth ; }
bool IsScalable() const { return mpFirst->IsScalable(); }
@@ -65,7 +65,7 @@ public:
void UpdateCloneFontList( PhysicalFontCollection&,
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 );
private:
@@ -74,7 +74,7 @@ private:
OUString maSearchName; // normalized font family name
OUString maMapNames; // fontname aliases
int mnTypeFaces; // Typeface Flags
- sal_uLong mnMatchType; // MATCH - Type
+ ImplFontAttrs mnMatchType; // MATCH - Type
OUString maMatchFamilyName; // MATCH - FamilyName
FontWeight meMatchWeight; // MATCH - Weight
FontWidth meMatchWidth; // MATCH - Width
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 4295566ff59d..eed3367e3c9d 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -38,7 +38,7 @@
#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
// mention that it is a CJK font
@@ -48,26 +48,26 @@ static unsigned lcl_IsCJKFont( const OUString& rFontName )
// japanese
if ( ((ch >= 0x3040) && (ch <= 0x30FF)) ||
((ch >= 0x3190) && (ch <= 0x319F)) )
- return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP;
+ return ImplFontAttrs::CJK|ImplFontAttrs::CJK_JP;
// korean
if ( ((ch >= 0xAC00) && (ch <= 0xD7AF)) ||
((ch >= 0x3130) && (ch <= 0x318F)) ||
((ch >= 0x1100) && (ch <= 0x11FF)) )
- return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR;
+ return ImplFontAttrs::CJK|ImplFontAttrs::CJK_KR;
// chinese
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
if ( ((ch >= 0x3000) && (ch <= 0xD7AF)) ||
((ch >= 0xFF00) && (ch <= 0xFFEE)) )
- return IMPL_FONT_ATTR_CJK;
+ return ImplFontAttrs::CJK;
}
- return 0;
+ return ImplFontAttrs::None;
}
PhysicalFontCollection::PhysicalFontCollection()
@@ -434,8 +434,8 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindBySubstFontAttr( const utl::
}
// use known attributes from the configuration to find a matching substitute
- const sal_uLong nSearchType = rFontAttr.Type;
- if( nSearchType != 0 )
+ const ImplFontAttrs nSearchType = rFontAttr.Type;
+ if( nSearchType != ImplFontAttrs::None )
{
const FontWeight eSearchWeight = rFontAttr.Weight;
const FontWidth eSearchWidth = rFontAttr.Width;
@@ -472,17 +472,17 @@ void PhysicalFontCollection::InitMatchData() const
}
}
-PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSearchType,
+PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( ImplFontAttrs nSearchType,
FontWeight eSearchWeight,
FontWidth eSearchWidth,
FontItalic eSearchItalic,
const OUString& rSearchFamilyName ) const
{
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
- if( !nSearchType
+ if( nSearchType == ImplFontAttrs::None
&& ((eSearchWeight == WEIGHT_DONTKNOW) || (eSearchWeight == WEIGHT_NORMAL))
&& ((eSearchWidth == WIDTH_DONTKNOW) || (eSearchWidth == WIDTH_NORMAL)) )
return NULL;
@@ -491,7 +491,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
PhysicalFontFamily* pFoundData = NULL;
long nBestMatch = 40000;
- sal_uLong nBestType = 0;
+ ImplFontAttrs nBestType = ImplFontAttrs::None;
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin();
for(; it != maPhysicalFontFamilies.end(); ++it )
@@ -499,9 +499,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
PhysicalFontFamily* pData = (*it).second;
// Get all information about the matching font
- sal_uLong nMatchType = pData->GetMatchType();
- FontWeight eMatchWeight= pData->GetMatchWeight();
- FontWidth eMatchWidth = pData->GetMatchWidth();
+ ImplFontAttrs nMatchType = pData->GetMatchType();
+ FontWeight eMatchWeight= pData->GetMatchWeight();
+ FontWidth eMatchWidth = pData->GetMatchWidth();
// Calculate Match Value
// 1000000000
@@ -519,45 +519,45 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
long nTestMatch = 0;
// test CJK script attributes
- if ( nSearchType & IMPL_FONT_ATTR_CJK )
+ if ( nSearchType & ImplFontAttrs::CJK )
{
// Matching language
- if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_CJK_ALLLANG) )
+ if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::CJK_AllLang) )
nTestMatch += 10000000*3;
- if( nMatchType & IMPL_FONT_ATTR_CJK )
+ if( nMatchType & ImplFontAttrs::CJK )
nTestMatch += 10000000*2;
- if( nMatchType & IMPL_FONT_ATTR_FULL )
+ if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000;
}
- else if ( nMatchType & IMPL_FONT_ATTR_CJK )
+ else if ( nMatchType & ImplFontAttrs::CJK )
{
nTestMatch -= 10000000;
}
// 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;
- if( nMatchType & IMPL_FONT_ATTR_FULL )
+ if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000;
}
- else if ( nMatchType & IMPL_FONT_ATTR_CTL )
+ else if ( nMatchType & ImplFontAttrs::CTL )
{
nTestMatch -= 10000000;
}
// 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;
- if( nMatchType & IMPL_FONT_ATTR_FULL )
+ if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000;
}
// test SYMBOL attributes
- if ( nSearchType & IMPL_FONT_ATTR_SYMBOL )
+ if ( nSearchType & ImplFontAttrs::Symbol )
{
const OUString& rSearchName = it->first;
// prefer some special known symbol fonts
@@ -583,9 +583,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
}
else
{
- if( nMatchType & IMPL_FONT_ATTR_SYMBOL )
+ if( nMatchType & ImplFontAttrs::Symbol )
nTestMatch += 10000000*2;
- if( nMatchType & IMPL_FONT_ATTR_FULL )
+ if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000000;
}
}
@@ -593,7 +593,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
{
nTestMatch -= 10000000;
}
- else if ( nMatchType & IMPL_FONT_ATTR_SYMBOL )
+ else if ( nMatchType & ImplFontAttrs::Symbol )
{
nTestMatch -= 10000;
}
@@ -605,123 +605,123 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
}
// 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;
}
- 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;
- if( 0 != ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_BRUSHSCRIPT) )
+ if( ImplFontAttrs::None != ((nSearchType ^ nMatchType) & ImplFontAttrs::BrushScript) )
nTestMatch -= 1000000;
}
}
- else if( nMatchType & IMPL_FONT_ATTR_ALLSCRIPT )
+ else if( nMatchType & ImplFontAttrs::AllScript )
{
nTestMatch -= 1000000;
}
// 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;
// a typewriter attribute is even better
- if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_TYPEWRITER) )
+ if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Typewriter) )
nTestMatch += 10000*2;
}
- else if( nMatchType & IMPL_FONT_ATTR_FIXED )
+ else if( nMatchType & ImplFontAttrs::Fixed )
{
nTestMatch -= 1000000;
}
// 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;
}
- 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;
}
- else if( nMatchType & IMPL_FONT_ATTR_SANSSERIF )
+ else if( nMatchType & ImplFontAttrs::SansSerif )
{
nTestMatch += 1000;
}
}
}
- else if( (nMatchType & IMPL_FONT_ATTR_SPECIAL) && !(nSearchType & IMPL_FONT_ATTR_SYMBOL) )
+ else if( (nMatchType & ImplFontAttrs::Special) && !(nSearchType & ImplFontAttrs::Symbol) )
{
nTestMatch -= 1000000;
}
// 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;
}
- 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;
- else if ( nMatchType & IMPL_FONT_ATTR_SANSSERIF )
+ else if ( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch += 1000;
}
}
- else if( nMatchType & IMPL_FONT_ATTR_DECORATIVE )
+ else if( nMatchType & ImplFontAttrs::Decorative )
{
nTestMatch -= 1000000;
}
// 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;
}
- if( 0 == ((nSearchType^nMatchType) & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS)))
+ if( ImplFontAttrs::None == ((nSearchType^nMatchType) & ImplFontAttrs(ImplFontAttrs::Titling | ImplFontAttrs::Capitals)))
{
nTestMatch += 1000000;
}
- else if( (nMatchType & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS)) &&
- (nMatchType & (IMPL_FONT_ATTR_STANDARD | IMPL_FONT_ATTR_DEFAULT)) )
+ else if( (nMatchType & (ImplFontAttrs::Titling | ImplFontAttrs::Capitals)) &&
+ (nMatchType & (ImplFontAttrs::Standard | ImplFontAttrs::Default)) )
{
nTestMatch += 1000000;
}
}
- else if( nMatchType & (IMPL_FONT_ATTR_TITLING | IMPL_FONT_ATTR_CAPITALS) )
+ else if( nMatchType & (ImplFontAttrs::Titling | ImplFontAttrs::Capitals) )
{
nTestMatch -= 1000000;
}
// 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;
}
- if( 0 == ((nSearchType ^ nMatchType) & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW)) )
+ if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs(ImplFontAttrs::Outline | ImplFontAttrs::Shadow)) )
{
nTestMatch += 1000000;
}
- else if( (nMatchType & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW)) &&
- (nMatchType & (IMPL_FONT_ATTR_STANDARD | IMPL_FONT_ATTR_DEFAULT)) )
+ else if( (nMatchType & (ImplFontAttrs::Outline | ImplFontAttrs::Shadow)) &&
+ (nMatchType & (ImplFontAttrs::Standard | ImplFontAttrs::Default)) )
{
nTestMatch += 1000000;
}
}
- else if ( nMatchType & (IMPL_FONT_ATTR_OUTLINE | IMPL_FONT_ATTR_SHADOW) )
+ else if ( nMatchType & (ImplFontAttrs::Outline | ImplFontAttrs::Shadow) )
{
nTestMatch -= 1000000;
}
@@ -736,33 +736,33 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
nTestMatch += 5000;
}
// 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;
- else if( nMatchType & IMPL_FONT_ATTR_SANSSERIF )
+ else if( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch -= 1000000;
}
// 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;
- else if ( nMatchType & IMPL_FONT_ATTR_SERIF )
+ else if ( nMatchType & ImplFontAttrs::Serif )
nTestMatch -= 1000000;
}
// test ITALIC attribute
- if( nSearchType & IMPL_FONT_ATTR_ITALIC )
+ if( nSearchType & ImplFontAttrs::Italic )
{
if( pData->GetTypeFaces() & FONT_FAMILY_ITALIC )
nTestMatch += 1000000*3;
- if( nMatchType & IMPL_FONT_ATTR_ITALIC )
+ if( nMatchType & ImplFontAttrs::Italic )
nTestMatch += 1000000;
}
- else if( !(nSearchType & IMPL_FONT_ATTR_ALLSCRIPT) &&
- ((nMatchType & IMPL_FONT_ATTR_ITALIC) ||
+ else if( !(nSearchType & ImplFontAttrs::AllScript) &&
+ ((nMatchType & ImplFontAttrs::Italic) ||
!(pData->GetTypeFaces() & FONT_FAMILY_NONEITALIC)) )
{
nTestMatch -= 1000000*2;
@@ -826,44 +826,44 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
nTestMatch -= 10000*4;
// test STANDARD+DEFAULT+FULL+NORMAL attributes
- if( nMatchType & IMPL_FONT_ATTR_STANDARD )
+ if( nMatchType & ImplFontAttrs::Standard )
nTestMatch += 10000*2;
- if( nMatchType & IMPL_FONT_ATTR_DEFAULT )
+ if( nMatchType & ImplFontAttrs::Default )
nTestMatch += 10000;
- if( nMatchType & IMPL_FONT_ATTR_FULL )
+ if( nMatchType & ImplFontAttrs::Full )
nTestMatch += 10000;
- if( nMatchType & IMPL_FONT_ATTR_NORMAL )
+ if( nMatchType & ImplFontAttrs::Normal )
nTestMatch += 10000;
// test OTHERSTYLE attribute
- if( ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_OTHERSTYLE) != 0 )
+ if( ((nSearchType ^ nMatchType) & ImplFontAttrs::OtherStyle) != ImplFontAttrs::None )
{
nTestMatch -= 10000;
}
// test ROUNDED attribute
- if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_ROUNDED) )
+ if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Rounded) )
nTestMatch += 1000;
// test TYPEWRITER attribute
- if( 0 == ((nSearchType ^ nMatchType) & IMPL_FONT_ATTR_TYPEWRITER) )
+ if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) & ImplFontAttrs::Typewriter) )
nTestMatch += 1000;
// 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;
- if( nMatchType & IMPL_FONT_ATTR_SANSSERIF )
+ if( nMatchType & ImplFontAttrs::SansSerif )
nTestMatch += 1000*2;
}
// 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;
- if( nMatchType & IMPL_FONT_ATTR_SERIF )
+ if( nMatchType & ImplFontAttrs::Serif )
nTestMatch += 1000*2;
}
@@ -877,13 +877,13 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByAttributes( sal_uLong nSea
else if( nTestMatch == nBestMatch )
{
// some fonts are more suitable defaults
- if( nMatchType & IMPL_FONT_ATTR_DEFAULT )
+ if( nMatchType & ImplFontAttrs::Default )
{
pFoundData = pData;
nBestType = nMatchType;
}
- else if( (nMatchType & IMPL_FONT_ATTR_STANDARD) &&
- !(nBestType & IMPL_FONT_ATTR_DEFAULT) )
+ else if( (nMatchType & ImplFontAttrs::Standard) &&
+ !(nBestType & ImplFontAttrs::Default) )
{
pFoundData = pData;
nBestType = nMatchType;
@@ -929,11 +929,11 @@ PhysicalFontFamily* PhysicalFontCollection::FindDefaultFont() const
for(; it != maPhysicalFontFamilies.end(); ++it )
{
PhysicalFontFamily* pData = (*it).second;
- if( pData->GetMatchType() & IMPL_FONT_ATTR_SYMBOL )
+ if( pData->GetMatchType() & ImplFontAttrs::Symbol )
continue;
pFoundData = pData;
- if( pData->GetMatchType() & (IMPL_FONT_ATTR_DEFAULT|IMPL_FONT_ATTR_STANDARD) )
+ if( pData->GetMatchType() & (ImplFontAttrs::Default|ImplFontAttrs::Standard) )
break;
}
if( pFoundData )
@@ -1144,9 +1144,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
OUString aSearchShortName;
OUString aSearchFamilyName;
- FontWeight eSearchWeight = rFSD.GetWeight();
- FontWidth eSearchWidth = rFSD.GetWidthType();
- sal_uLong nSearchType = 0;
+ FontWeight eSearchWeight = rFSD.GetWeight();
+ FontWidth eSearchWidth = rFSD.GetWidthType();
+ ImplFontAttrs nSearchType = ImplFontAttrs::None;
utl::FontSubstConfiguration::getMapName( aSearchName, aSearchShortName, aSearchFamilyName,
eSearchWeight, eSearchWidth, nSearchType );
@@ -1216,9 +1216,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
OUString aTempShortName;
OUString aTempFamilyName;
- sal_uLong nTempType = 0;
- FontWeight eTempWeight = rFSD.GetWeight();
- FontWidth eTempWidth = WIDTH_DONTKNOW;
+ ImplFontAttrs nTempType = ImplFontAttrs::None;
+ FontWeight eTempWeight = rFSD.GetWeight();
+ FontWidth eTempWidth = WIDTH_DONTKNOW;
utl::FontSubstConfiguration::getMapName( aSearchName, aTempShortName, aTempFamilyName,
eTempWeight, eTempWidth, nTempType );
@@ -1263,18 +1263,18 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
// if still needed use the font request's attributes to find a good match
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))
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_TC;
+ nSearchType |= ImplFontAttrs::CJK | ImplFontAttrs::CJK_TC;
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)
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_JP;
+ nSearchType |= ImplFontAttrs::CJK | ImplFontAttrs::CJK_JP;
else
{
nSearchType |= lcl_IsCJKFont( rFSD.GetFamilyName() );
if( rFSD.IsSymbolFont() )
- nSearchType |= IMPL_FONT_ATTR_SYMBOL;
+ nSearchType |= ImplFontAttrs::Symbol;
}
PhysicalFontFamily::CalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.GetFamilyType(), pFontAttr );
@@ -1298,7 +1298,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindByFont( FontSelectPattern& r
rFSD.SetWeight( eSearchWeight );
}
- if( (nSearchType & IMPL_FONT_ATTR_ITALIC) &&
+ if( (nSearchType & ImplFontAttrs::Italic) &&
((rFSD.GetSlant() == ITALIC_DONTKNOW) ||
(rFSD.GetSlant() == ITALIC_NONE)) &&
(pFoundData->GetTypeFaces() & FONT_FAMILY_ITALIC) )
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index 395bcf0bb45d..552c2dac20c7 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -27,21 +27,21 @@
#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 )
{
if ( eFamily != FAMILY_DONTKNOW )
{
if ( eFamily == FAMILY_SWISS )
- rType |= IMPL_FONT_ATTR_SANSSERIF;
+ rType |= ImplFontAttrs::SansSerif;
else if ( eFamily == FAMILY_ROMAN )
- rType |= IMPL_FONT_ATTR_SERIF;
+ rType |= ImplFontAttrs::Serif;
else if ( eFamily == FAMILY_SCRIPT )
- rType |= IMPL_FONT_ATTR_SCRIPT;
+ rType |= ImplFontAttrs::Script;
else if ( eFamily == FAMILY_MODERN )
- rType |= IMPL_FONT_ATTR_FIXED;
+ rType |= ImplFontAttrs::Fixed;
else if ( eFamily == FAMILY_DECORATIVE )
- rType |= IMPL_FONT_ATTR_DECORATIVE;
+ rType |= ImplFontAttrs::Decorative;
}
if ( pFontAttr )
@@ -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
// mention that it is a CJK font
@@ -67,33 +67,33 @@ static unsigned lcl_IsCJKFont( const OUString& rFontName )
// japanese
if ( ((ch >= 0x3040) && (ch <= 0x30FF)) ||
((ch >= 0x3190) && (ch <= 0x319F)) )
- return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_JP;
+ return ImplFontAttrs::CJK|ImplFontAttrs::CJK_JP;
// korean
if ( ((ch >= 0xAC00) && (ch <= 0xD7AF)) ||
((ch >= 0x3130) && (ch <= 0x318F)) ||
((ch >= 0x1100) && (ch <= 0x11FF)) )
- return IMPL_FONT_ATTR_CJK|IMPL_FONT_ATTR_CJK_KR;
+ return ImplFontAttrs::CJK|ImplFontAttrs::CJK_KR;
// chinese
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
if ( ((ch >= 0x3000) && (ch <= 0xD7AF)) ||
((ch >= 0xFF00) && (ch <= 0xFFEE)) )
- return IMPL_FONT_ATTR_CJK;
+ return ImplFontAttrs::CJK;
}
- return 0;
+ return ImplFontAttrs::None;
}
PhysicalFontFamily::PhysicalFontFamily( const OUString& rSearchName )
: mpFirst( NULL ),
maSearchName( rSearchName ),
mnTypeFaces( 0 ),
- mnMatchType( 0 ),
+ mnMatchType( ImplFontAttrs::None ),
meMatchWeight( WEIGHT_DONTKNOW ),
meMatchWidth( WIDTH_DONTKNOW ),
meFamily( FAMILY_DONTKNOW ),
@@ -161,7 +161,7 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewData )
if( (meMatchWeight == WEIGHT_DONTKNOW)
|| (meMatchWidth == WIDTH_DONTKNOW)
- || (mnMatchType == 0) )
+ || (mnMatchType == ImplFontAttrs::None) )
{
// TODO: is it cheaper to calc matching attributes now or on demand?
// calc matching attributes if other entries are already initialized
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 04fc54cad985..5dd22f3e0645 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -152,7 +152,7 @@ void Impl_Font::AskConfig()
OUString aShortName;
OUString aFamilyName;
- sal_uLong nType = 0;
+ ImplFontAttrs nType = ImplFontAttrs::None;
FontWeight eWeight = WEIGHT_DONTKNOW;
FontWidth eWidthType = WIDTH_DONTKNOW;
OUString aMapName = GetEnglishSearchFontName( maFamilyName );
@@ -172,21 +172,21 @@ void Impl_Font::AskConfig()
// the font was found in the configuration
if( meFamily == FAMILY_DONTKNOW )
{
- if ( pFontAttr->Type & IMPL_FONT_ATTR_SERIF )
+ if ( pFontAttr->Type & ImplFontAttrs::Serif )
meFamily = FAMILY_ROMAN;
- else if ( pFontAttr->Type & IMPL_FONT_ATTR_SANSSERIF )
+ else if ( pFontAttr->Type & ImplFontAttrs::SansSerif )
meFamily = FAMILY_SWISS;
- else if ( pFontAttr->Type & IMPL_FONT_ATTR_TYPEWRITER )
+ else if ( pFontAttr->Type & ImplFontAttrs::Typewriter )
meFamily = FAMILY_MODERN;
- else if ( pFontAttr->Type & IMPL_FONT_ATTR_ITALIC )
+ else if ( pFontAttr->Type & ImplFontAttrs::Italic )
meFamily = FAMILY_SCRIPT;
- else if ( pFontAttr->Type & IMPL_FONT_ATTR_DECORATIVE )
+ else if ( pFontAttr->Type & ImplFontAttrs::Decorative )
meFamily = FAMILY_DECORATIVE;
}
if( mePitch == PITCH_DONTKNOW )
{
- if ( pFontAttr->Type & IMPL_FONT_ATTR_FIXED )
+ if ( pFontAttr->Type & ImplFontAttrs::Fixed )
mePitch = PITCH_FIXED;
}
}
@@ -194,15 +194,15 @@ void Impl_Font::AskConfig()
// if some attributes are still unknown then use the FontSubst magic
if( meFamily == FAMILY_DONTKNOW )
{
- if( nType & IMPL_FONT_ATTR_SERIF )
+ if( nType & ImplFontAttrs::Serif )
meFamily = FAMILY_ROMAN;
- else if( nType & IMPL_FONT_ATTR_SANSSERIF )
+ else if( nType & ImplFontAttrs::SansSerif )
meFamily = FAMILY_SWISS;
- else if( nType & IMPL_FONT_ATTR_TYPEWRITER )
+ else if( nType & ImplFontAttrs::Typewriter )
meFamily = FAMILY_MODERN;
- else if( nType & IMPL_FONT_ATTR_ITALIC )
+ else if( nType & ImplFontAttrs::Italic )
meFamily = FAMILY_SCRIPT;
- else if( nType & IMPL_FONT_ATTR_DECORATIVE )
+ else if( nType & ImplFontAttrs::Decorative )
meFamily = FAMILY_DECORATIVE;
}
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 732642c186d8..89b8d96e2526 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -543,7 +543,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon
}
// are the missing characters symbols?
- pFontFamily = pFontCollection->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL,
+ pFontFamily = pFontCollection->ImplFindByAttributes( ImplFontAttrs::Symbol,
rFontSelData.GetWeight(),
rFontSelData.GetWidthType(),
rFontSelData.GetSlant(),