[Libreoffice-commits] .: 3 commits - i18npool/source vcl/inc vcl/source vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Mar 10 12:05:21 PST 2011
i18npool/source/breakiterator/breakiteratorImpl.cxx | 24 ---------------
vcl/inc/vcl/fontmanager.hxx | 2 -
vcl/inc/vcl/glyphcache.hxx | 5 +--
vcl/inc/vcl/impfont.hxx | 25 +++++++--------
vcl/source/glyphs/gcach_ftyp.cxx | 18 +++++++----
vcl/source/glyphs/gcach_ftyp.hxx | 4 +-
vcl/source/glyphs/glyphcache.cxx | 3 +
vcl/unx/source/fontmanager/fontconfig.cxx | 32 ++++++++++----------
vcl/unx/source/gdi/salgdi3.cxx | 23 ++++++++------
9 files changed, 61 insertions(+), 75 deletions(-)
New commits:
commit 982d289f0fa9d24517ce844c86725fb96c0b345d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 20:04:52 2011 +0000
unused global table
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 1f2acc7..a9830a3 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -449,30 +449,6 @@ typedef struct {
sal_Int16 script;
} UBlock2Script;
-static UBlock2Script scriptList[] = {
- {UBLOCK_NO_BLOCK, UBLOCK_NO_BLOCK, ScriptType::WEAK},
- {UBLOCK_BASIC_LATIN, UBLOCK_ARMENIAN, ScriptType::LATIN},
- {UBLOCK_HEBREW, UBLOCK_MYANMAR, ScriptType::COMPLEX},
- {UBLOCK_GEORGIAN, UBLOCK_GEORGIAN, ScriptType::LATIN},
- {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO, ScriptType::ASIAN},
- {UBLOCK_ETHIOPIC, UBLOCK_ETHIOPIC, ScriptType::COMPLEX},
- {UBLOCK_CHEROKEE, UBLOCK_RUNIC, ScriptType::LATIN},
- {UBLOCK_KHMER, UBLOCK_MONGOLIAN, ScriptType::COMPLEX},
- {UBLOCK_LATIN_EXTENDED_ADDITIONAL, UBLOCK_GREEK_EXTENDED, ScriptType::LATIN},
- {UBLOCK_GENERAL_PUNCTUATION, UBLOCK_GENERAL_PUNCTUATION, ScriptType::LATIN},
- {UBLOCK_CJK_RADICALS_SUPPLEMENT, UBLOCK_HANGUL_SYLLABLES, ScriptType::ASIAN},
- {UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS, ScriptType::ASIAN},
- {UBLOCK_ARABIC_PRESENTATION_FORMS_A, UBLOCK_ARABIC_PRESENTATION_FORMS_A, ScriptType::COMPLEX},
- {UBLOCK_CJK_COMPATIBILITY_FORMS, UBLOCK_CJK_COMPATIBILITY_FORMS, ScriptType::ASIAN},
- {UBLOCK_ARABIC_PRESENTATION_FORMS_B, UBLOCK_ARABIC_PRESENTATION_FORMS_B, ScriptType::COMPLEX},
- {UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS, ScriptType::ASIAN},
- {UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B, UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT, ScriptType::ASIAN},
- {UBLOCK_CJK_STROKES, UBLOCK_CJK_STROKES, ScriptType::ASIAN},
- {UBLOCK_LATIN_EXTENDED_C, UBLOCK_LATIN_EXTENDED_D, ScriptType::LATIN}
-};
-
-#define scriptListCount sizeof (scriptList) / sizeof (UBlock2Script)
-
static sal_Int16 scriptTypes[] = {
ScriptType::WEAK, ScriptType::WEAK, ScriptType::COMPLEX, ScriptType::LATIN, ScriptType::COMPLEX,
ScriptType::ASIAN, ScriptType::LATIN, ScriptType::LATIN, ScriptType::LATIN, ScriptType::COMPLEX,
commit d83bc4d9921afd31f1afddc52f39951bb686e60a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 15:59:44 2011 +0000
Related: rhbz#680460 reorganize this to make it inheritable
diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx
index 6c76eea..103cd92 100644
--- a/vcl/inc/vcl/fontmanager.hxx
+++ b/vcl/inc/vcl/fontmanager.hxx
@@ -733,7 +733,7 @@ public:
false else
*/
bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
- bool getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*), ImplFontOptions& rResult ) const;
+ ImplFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*)) const;
rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes,
const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight,
diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
index 8714697..1c03759 100644
--- a/vcl/inc/vcl/glyphcache.hxx
+++ b/vcl/inc/vcl/glyphcache.hxx
@@ -187,7 +187,7 @@ public:
virtual bool TestFont() const { return true; }
virtual void* GetFtFace() const { return 0; }
virtual int GetLoadFlags() const { return 0; }
- virtual void SetFontOptions( const ImplFontOptions&) {}
+ virtual void SetFontOptions( const ImplFontOptions*) {}
virtual bool NeedsArtificialBold() const { return false; }
virtual bool NeedsArtificialItalic() const { return false; }
@@ -266,9 +266,8 @@ class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry
{
private:
ServerFont* mpServerFont;
- ImplFontOptions maFontOptions;
+ ImplFontOptions* mpFontOptions;
bool mbGotFontOptions;
- bool mbValidFontOptions;
public:
ImplServerFontEntry( ImplFontSelectData& );
diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
index b7a0368..fa8a837 100644
--- a/vcl/inc/vcl/impfont.hxx
+++ b/vcl/inc/vcl/impfont.hxx
@@ -135,7 +135,7 @@ public:
};
// ------------------
-// - ImplFontHints -
+// - ImplFontOptions -
// ------------------
class ImplFontOptions
@@ -154,19 +154,18 @@ public:
meHinting(HINTING_DONTKNOW),
meHintStyle(HINT_SLIGHT)
{}
- ImplFontOptions( FontEmbeddedBitmap eEmbeddedBitmap, FontAntiAlias eAntiAlias,
- FontAutoHint eAutoHint, FontHinting eHinting, FontHintStyle eHintStyle) :
- meEmbeddedBitmap(eEmbeddedBitmap),
- meAntiAlias(eAntiAlias),
- meAutoHint(eAutoHint),
- meHinting(eHinting),
- meHintStyle(eHintStyle)
+ virtual ~ImplFontOptions()
{}
- FontAutoHint GetUseAutoHint() const { return meAutoHint; }
- FontHintStyle GetHintStyle() const { return meHintStyle; }
- bool DontUseEmbeddedBitmaps() const { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; }
- bool DontUseAntiAlias() const { return meAntiAlias == ANTIALIAS_FALSE; }
- bool DontUseHinting() const { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); }
+ FontAutoHint GetUseAutoHint() const
+ { return meAutoHint; }
+ FontHintStyle GetHintStyle() const
+ { return meHintStyle; }
+ bool DontUseEmbeddedBitmaps() const
+ { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; }
+ bool DontUseAntiAlias() const
+ { return meAntiAlias == ANTIALIAS_FALSE; }
+ bool DontUseHinting() const
+ { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); }
};
// -------------------
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index 2db53a5..2236bad 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -768,6 +768,7 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn
mpFontInfo( pFI ),
maFaceFT( NULL ),
maSizeFT( NULL ),
+ mpFontOptions( NULL ),
mbFaceOk( false ),
maRecodeConverter( NULL ),
mpLayoutEngine( NULL )
@@ -913,9 +914,14 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn
mnLoadFlags |= FT_LOAD_NO_BITMAP;
}
-void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
+void FreetypeServerFont::SetFontOptions( const ImplFontOptions* pFontOptions)
{
- FontAutoHint eHint = rFontOptions.GetUseAutoHint();
+ mpFontOptions = pFontOptions;
+
+ if (!mpFontOptions)
+ return;
+
+ FontAutoHint eHint = mpFontOptions->GetUseAutoHint();
if( eHint == AUTOHINT_DONTKNOW )
eHint = mbUseGamma ? AUTOHINT_TRUE : AUTOHINT_FALSE;
@@ -926,11 +932,11 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
mnLoadFlags |= FT_LOAD_NO_HINTING;
mnLoadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //#88334#
- if( rFontOptions.DontUseAntiAlias() )
+ if( mpFontOptions->DontUseAntiAlias() )
mnPrioAntiAlias = 0;
- if( rFontOptions.DontUseEmbeddedBitmaps() )
+ if( mpFontOptions->DontUseEmbeddedBitmaps() )
mnPrioEmbedded = 0;
- if( rFontOptions.DontUseHinting() )
+ if( mpFontOptions->DontUseHinting() )
mnPrioAutoHint = 0;
#if (FTVERSION >= 2005) || defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
@@ -942,7 +948,7 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
if( !(mnLoadFlags & FT_LOAD_NO_HINTING) && (nFTVERSION >= 2103))
{
mnLoadFlags |= FT_LOAD_TARGET_NORMAL;
- switch( rFontOptions.GetHintStyle() )
+ switch( mpFontOptions->GetHintStyle() )
{
case HINT_NONE:
mnLoadFlags |= FT_LOAD_NO_HINTING;
diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx
index cf2284c..6069388 100644
--- a/vcl/source/glyphs/gcach_ftyp.hxx
+++ b/vcl/source/glyphs/gcach_ftyp.hxx
@@ -186,7 +186,7 @@ public:
virtual int GetFontFaceNum() const { return mpFontInfo->GetFaceNum(); }
virtual bool TestFont() const;
virtual void* GetFtFace() const;
- virtual void SetFontOptions( const ImplFontOptions&);
+ virtual void SetFontOptions( const ImplFontOptions*);
virtual int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
virtual bool NeedsArtificialBold() const { return mbArtBold; }
virtual bool NeedsArtificialItalic() const { return mbArtItalic; }
@@ -233,6 +233,8 @@ private:
FT_FaceRec_* maFaceFT;
FT_SizeRec_* maSizeFT;
+ const ImplFontOptions* mpFontOptions;
+
bool mbFaceOk;
bool mbArtItalic;
bool mbArtBold;
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index 8ad5a87..9668a50 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -522,8 +522,8 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex )
ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
: ImplFontEntry( rFSD )
, mpServerFont( NULL )
+, mpFontOptions( NULL )
, mbGotFontOptions( false )
-, mbValidFontOptions( false )
{}
// -----------------------------------------------------------------------
@@ -531,6 +531,7 @@ ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
ImplServerFontEntry::~ImplServerFontEntry()
{
// TODO: remove the ServerFont here instead of in the GlyphCache
+ delete mpFontOptions;
}
// =======================================================================
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 0dd5260..3c2f636 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -1093,17 +1093,17 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
return aName;
}
-bool PrintFontManager::getFontOptions(
- const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*),
- ImplFontOptions& rOptions) const
+ImplFontOptions* PrintFontManager::getFontOptions(
+ const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const
{
#ifndef ENABLE_FONTCONFIG
- return false;
+ return NULL;
#else // ENABLE_FONTCONFIG
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
if( ! rWrapper.isValid() )
- return false;
+ return NULL;
+ ImplFontOptions *pOptions = NULL;
FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
FcPattern* pPattern = rWrapper.FcPatternCreate();
@@ -1144,22 +1144,24 @@ bool PrintFontManager::getFontOptions(
FC_HINTING, 0, &hinting);
/*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger( pSet->fonts[0],
FC_HINT_STYLE, 0, &hintstyle);
+
+ pOptions = new ImplFontOptions;
if( eEmbeddedBitmap == FcResultMatch )
- rOptions.meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE;
+ pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE;
if( eAntialias == FcResultMatch )
- rOptions.meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE;
+ pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE;
if( eAutoHint == FcResultMatch )
- rOptions.meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE;
+ pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE;
if( eHinting == FcResultMatch )
- rOptions.meHinting = hinting ? HINTING_TRUE : HINTING_FALSE;
+ pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE;
switch (hintstyle)
{
- case FC_HINT_NONE: rOptions.meHintStyle = HINT_NONE; break;
- case FC_HINT_SLIGHT: rOptions.meHintStyle = HINT_SLIGHT; break;
- case FC_HINT_MEDIUM: rOptions.meHintStyle = HINT_MEDIUM; break;
+ case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break;
+ case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break;
+ case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break;
default: // fall through
- case FC_HINT_FULL: rOptions.meHintStyle = HINT_FULL; break;
+ case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break;
}
}
// info: destroying the pSet destroys pResult implicitly
@@ -1170,9 +1172,7 @@ bool PrintFontManager::getFontOptions(
// cleanup
rWrapper.FcPatternDestroy( pPattern );
- // TODO: return true only if non-default font options are set
- const bool bOK = (pResult != NULL);
- return bOK;
+ return pOptions;
#endif
}
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 9834028..6de93fe 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -632,22 +632,21 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
return false;
}
+ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize);
+
void ImplServerFontEntry::HandleFontOptions( void )
{
- bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& );
-
if( !mpServerFont )
return;
if( !mbGotFontOptions )
{
// get and cache the font options
mbGotFontOptions = true;
- mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
- maFontSelData.mnHeight, maFontOptions );
+ mpFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
+ maFontSelData.mnHeight );
}
// apply the font options
- if( mbValidFontOptions )
- mpServerFont->SetFontOptions( maFontOptions );
+ mpServerFont->SetFontOptions( mpFontOptions );
}
//--------------------------------------------------------------------------
@@ -1636,8 +1635,7 @@ void cairosubcallback( void* pPattern )
rCairo.ft_font_options_substitute( pFontOptions, pPattern );
}
-bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
- ImplFontOptions& rFontOptions)
+ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize)
{
// TODO: get rid of these insane enum-conversions
// e.g. by using the classic vclenum values inside VCL
@@ -1734,8 +1732,7 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
}
const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
- bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions);
- return bOK;
+ return rPFM.getFontOptions(aInfo, nSize, cairosubcallback);
}
// ----------------------------------------------------------------------------
commit 28e6caab0a9c04b306f723fb3390332f5ef94a61
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 10 13:54:58 2011 +0000
add cairo_ft_font_face_create_for_pattern wrapper
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 3056f92..9834028 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -89,6 +89,7 @@ struct cairo_surface_t;
struct cairo_t;
struct cairo_font_face_t;
typedef void* FT_Face;
+typedef void* FcPattern;
struct cairo_matrix_t {
double xx; double yx;
double xy; double yy;
@@ -742,6 +743,7 @@ private:
void (*mp_clip)(cairo_t*);
void (*mp_rectangle)(cairo_t*, double, double, double, double);
cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int);
+ cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(FcPattern*);
void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *);
void (*mp_font_face_destroy)(cairo_font_face_t *);
void (*mp_matrix_init_identity)(cairo_matrix_t *);
@@ -771,6 +773,8 @@ public:
{ (*mp_rectangle)(cr, x, y, width, height); }
cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags)
{ return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); }
+ cairo_font_face_t* ft_font_face_create_for_pattern(FcPattern *pattern)
+ { return (*mp_ft_font_face_create_for_pattern)(pattern); }
void set_font_face(cairo_t *cr, cairo_font_face_t *font_face)
{ (*mp_set_font_face)(cr, font_face); }
void font_face_destroy(cairo_font_face_t *font_face)
@@ -844,6 +848,8 @@ CairoWrapper::CairoWrapper()
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" );
mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" );
+ mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(FcPattern*))
+ osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" );
mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" );
mp_font_face_destroy = (void (*)(cairo_font_face_t *))
More information about the Libreoffice-commits
mailing list