Kaydet (Commit) a3895516 authored tarafından Herbert Dürr's avatar Herbert Dürr

#i123895# split impfont.cxx source from metric.cxx

and move the helper function UpdateAttributesFromPSName() there to
make it available for all platforms, not only ATSUI-based ones.
üst 4e347ce0
......@@ -347,6 +347,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/imagerepository \
vcl/source/gdi/impanmvw \
vcl/source/gdi/impbmp \
vcl/source/gdi/impfont \
vcl/source/gdi/impgraph \
vcl/source/gdi/impimage \
vcl/source/gdi/impimagetree \
......
......@@ -34,159 +34,6 @@
#include "aqua/saldata.hxx"
#include "aqua/salatsuifontutils.hxx"
// we have to get the font attributes from the name table
// since neither head's macStyle nor OS/2's panose are easily available
// during font enumeration. macStyle bits would be not sufficient anyway
// and SFNT fonts on Mac usually do not contain an OS/2 table.
static void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttributes& rDFA )
{
ByteString aPSName( rPSName, RTL_TEXTENCODING_UTF8 );
aPSName.ToLowerAscii();
// TODO: use a multi-string ignore-case matcher once it becomes available
if( (aPSName.Search("regular") != STRING_NOTFOUND)
|| (aPSName.Search("normal") != STRING_NOTFOUND)
|| (aPSName.Search("roman") != STRING_NOTFOUND)
|| (aPSName.Search("medium") != STRING_NOTFOUND)
|| (aPSName.Search("plain") != STRING_NOTFOUND)
|| (aPSName.Search("standard") != STRING_NOTFOUND)
|| (aPSName.Search("std") != STRING_NOTFOUND) )
{
rDFA.meWidthType = WIDTH_NORMAL;
rDFA.meWeight = WEIGHT_NORMAL;
rDFA.meItalic = ITALIC_NONE;
}
// heuristics for font weight
if (aPSName.Search("extrablack") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_BLACK;
else if (aPSName.Search("black") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_BLACK;
//else if (aPSName.Search("book") != STRING_NOTFOUND)
// rDFA.meWeight = WEIGHT_SEMIBOLD;
else if( (aPSName.Search("semibold") != STRING_NOTFOUND)
|| (aPSName.Search("smbd") != STRING_NOTFOUND))
rDFA.meWeight = WEIGHT_SEMIBOLD;
else if (aPSName.Search("ultrabold") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_ULTRABOLD;
else if (aPSName.Search("extrabold") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_BLACK;
else if( (aPSName.Search("bold") != STRING_NOTFOUND)
|| (aPSName.Search("-bd") != STRING_NOTFOUND))
rDFA.meWeight = WEIGHT_BOLD;
else if (aPSName.Search("extralight") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_ULTRALIGHT;
else if (aPSName.Search("ultralight") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_ULTRALIGHT;
else if (aPSName.Search("light") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_LIGHT;
else if (aPSName.Search("thin") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_THIN;
else if (aPSName.Search("-w3") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_LIGHT;
else if (aPSName.Search("-w4") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_SEMILIGHT;
else if (aPSName.Search("-w5") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_NORMAL;
else if (aPSName.Search("-w6") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_SEMIBOLD;
else if (aPSName.Search("-w7") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_BOLD;
else if (aPSName.Search("-w8") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_ULTRABOLD;
else if (aPSName.Search("-w9") != STRING_NOTFOUND)
rDFA.meWeight = WEIGHT_BLACK;
// heuristics for font slant
if( (aPSName.Search("italic") != STRING_NOTFOUND)
|| (aPSName.Search(" ital") != STRING_NOTFOUND)
|| (aPSName.Search("cursive") != STRING_NOTFOUND)
|| (aPSName.Search("-it") != STRING_NOTFOUND)
|| (aPSName.Search("lightit") != STRING_NOTFOUND)
|| (aPSName.Search("mediumit") != STRING_NOTFOUND)
|| (aPSName.Search("boldit") != STRING_NOTFOUND)
|| (aPSName.Search("cnit") != STRING_NOTFOUND)
|| (aPSName.Search("bdcn") != STRING_NOTFOUND)
|| (aPSName.Search("bdit") != STRING_NOTFOUND)
|| (aPSName.Search("condit") != STRING_NOTFOUND)
|| (aPSName.Search("bookit") != STRING_NOTFOUND)
|| (aPSName.Search("blackit") != STRING_NOTFOUND) )
rDFA.meItalic = ITALIC_NORMAL;
if( (aPSName.Search("oblique") != STRING_NOTFOUND)
|| (aPSName.Search("inclined") != STRING_NOTFOUND)
|| (aPSName.Search("slanted") != STRING_NOTFOUND) )
rDFA.meItalic = ITALIC_OBLIQUE;
// heuristics for font width
if( (aPSName.Search("condensed") != STRING_NOTFOUND)
|| (aPSName.Search("-cond") != STRING_NOTFOUND)
|| (aPSName.Search("boldcond") != STRING_NOTFOUND)
|| (aPSName.Search("boldcn") != STRING_NOTFOUND)
|| (aPSName.Search("cnit") != STRING_NOTFOUND) )
rDFA.meWidthType = WIDTH_CONDENSED;
else if (aPSName.Search("narrow") != STRING_NOTFOUND)
rDFA.meWidthType = WIDTH_SEMI_CONDENSED;
else if (aPSName.Search("expanded") != STRING_NOTFOUND)
rDFA.meWidthType = WIDTH_EXPANDED;
else if (aPSName.Search("wide") != STRING_NOTFOUND)
rDFA.meWidthType = WIDTH_EXPANDED;
// heuristics for font pitch
if( (aPSName.Search("mono") != STRING_NOTFOUND)
|| (aPSName.Search("courier") != STRING_NOTFOUND)
|| (aPSName.Search("monaco") != STRING_NOTFOUND)
|| (aPSName.Search("typewriter") != STRING_NOTFOUND) )
rDFA.mePitch = PITCH_FIXED;
// heuristics for font family type
if( (aPSName.Search("script") != STRING_NOTFOUND)
|| (aPSName.Search("chancery") != STRING_NOTFOUND)
|| (aPSName.Search("zapfino") != STRING_NOTFOUND))
rDFA.meFamily = FAMILY_SCRIPT;
else if( (aPSName.Search("comic") != STRING_NOTFOUND)
|| (aPSName.Search("outline") != STRING_NOTFOUND)
|| (aPSName.Search("pinpoint") != STRING_NOTFOUND) )
rDFA.meFamily = FAMILY_DECORATIVE;
else if( (aPSName.Search("sans") != STRING_NOTFOUND)
|| (aPSName.Search("arial") != STRING_NOTFOUND) )
rDFA.meFamily = FAMILY_SWISS;
else if( (aPSName.Search("roman") != STRING_NOTFOUND)
|| (aPSName.Search("times") != STRING_NOTFOUND) )
rDFA.meFamily = FAMILY_ROMAN;
// heuristics for codepoint semantic
if( (aPSName.Search("symbol") != STRING_NOTFOUND)
|| (aPSName.Search("dings") != STRING_NOTFOUND)
|| (aPSName.Search("dingbats") != STRING_NOTFOUND)
|| (aPSName.Search("ornaments") != STRING_NOTFOUND)
|| (aPSName.Search("embellishments") != STRING_NOTFOUND) )
rDFA.mbSymbolFlag = true;
// #i100020# special heuristic for names with single-char styles
// NOTE: we are checking name that hasn't been lower-cased
if( rPSName.Len() > 3 )
{
int i = rPSName.Len();
sal_Unicode c = rPSName.GetChar( --i );
if( c == 'C' ) { // "capitals"
rDFA.meFamily = FAMILY_DECORATIVE;
c = rPSName.GetChar( --i );
}
if( c == 'O' ) { // CFF-based OpenType
c = rPSName.GetChar( --i );
}
if( c == 'I' ) { // "italic"
rDFA.meItalic = ITALIC_NORMAL;
c = rPSName.GetChar( --i );
}
if( c == 'B' ) // "bold"
rDFA.meWeight = WEIGHT_BOLD;
if( c == 'C' ) // "capitals"
rDFA.meFamily = FAMILY_DECORATIVE;
// TODO: check that all single-char styles have been resolved?
}
}
// -----------------------------------------------------------------------
static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDFA )
......
......@@ -31,6 +31,7 @@
#include <vcl/dllapi.h>
#include <vcl/vclenum.hxx>
#include <vcl/fntstyle.hxx>
#include <outfont.hxx>
// ------------
// - Impl_Font -
......@@ -231,5 +232,7 @@ public:
bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& );
void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttributes& );
#endif // _SV_IMPFONT_HXX
......@@ -97,19 +97,19 @@ public:
FontCharMap();
~FontCharMap();
sal_Bool IsDefaultMap() const;
sal_Bool HasChar( sal_uInt32 ) const;
int CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const;
int GetCharCount() const;
bool IsDefaultMap( void ) const;
bool HasChar( sal_UCS4 ) const;
int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const;
int GetCharCount( void ) const;
sal_uInt32 GetFirstChar() const;
sal_uInt32 GetLastChar() const;
sal_UCS4 GetFirstChar( void ) const;
sal_UCS4 GetLastChar( void ) const;
sal_uInt32 GetNextChar( sal_uInt32 ) const;
sal_uInt32 GetPrevChar( sal_uInt32 ) const;
sal_UCS4 GetNextChar( sal_UCS4 ) const;
sal_UCS4 GetPrevChar( sal_UCS4 ) const;
int GetIndexFromChar( sal_uInt32 ) const;
sal_uInt32 GetCharFromIndex( int ) const;
int GetIndexFromChar( sal_UCS4 ) const;
sal_UCS4 GetCharFromIndex( int ) const;
private:
......
This diff is collapsed.
This diff is collapsed.
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