diff --git a/configure b/configure index e1bd12b4c4..8757436fae 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 47597 2007-07-20 18:27:35Z PC . +# From configure.in Id: configure.in 47607 2007-07-21 01:42:58Z VZ . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0. # @@ -1700,6 +1700,7 @@ Optional Features: --enable-ffile use wxFFile class --enable-file use wxFile class --enable-filesystem use virtual file systems classes + --enable-fontenum use wxFontEnumerator class --enable-fontmap use font encodings conversion classes --enable-fs_archive use virtual archive filesystems --enable-fs_inet use virtual HTTP/FTP filesystems @@ -7534,6 +7535,61 @@ fi echo "${ECHO_T}$result" >&6; } + enablestring= + defaultval=$wxUSE_ALL_FEATURES + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-fontenum" >&5 +echo $ECHO_N "checking for --${enablestring:-enable}-fontenum... $ECHO_C" >&6; } + no_cache=0 + # Check whether --enable-fontenum was given. +if test "${enable_fontenum+set}" = set; then + enableval=$enable_fontenum; + if test "$enableval" = yes; then + wx_cv_use_fontenum='wxUSE_FONTENUM=yes' + else + wx_cv_use_fontenum='wxUSE_FONTENUM=no' + fi + +else + + LINE=`grep "^wxUSE_FONTENUM=" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "DEFAULT_$LINE" + else + no_cache=1 + fi + + wx_cv_use_fontenum='wxUSE_FONTENUM=${'DEFAULT_wxUSE_FONTENUM":-$defaultval}" + +fi + + + eval "$wx_cv_use_fontenum" + if test "$no_cache" != 1; then + echo $wx_cv_use_fontenum >> ${wx_arg_cache_file}.tmp + fi + + if test x"$enablestring" = xdisable; then + if test $wxUSE_FONTENUM = yes; then + result=no + else + result=yes + fi + else + result=$wxUSE_FONTENUM + fi + + { echo "$as_me:$LINENO: result: $result" >&5 +echo "${ECHO_T}$result" >&6; } + + enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then diff --git a/configure.in b/configure.in index c7e3c028cb..27f84655c9 100644 --- a/configure.in +++ b/configure.in @@ -596,6 +596,7 @@ WX_ARG_FEATURE(exceptions, [ --enable-exceptions build exception-safe li WX_ARG_FEATURE(ffile, [ --enable-ffile use wxFFile class], wxUSE_FFILE) WX_ARG_FEATURE(file, [ --enable-file use wxFile class], wxUSE_FILE) WX_ARG_FEATURE(filesystem, [ --enable-filesystem use virtual file systems classes], wxUSE_FILESYSTEM) +WX_ARG_FEATURE(fontenum, [ --enable-fontenum use wxFontEnumerator class], wxUSE_FONTENUM) WX_ARG_FEATURE(fontmap, [ --enable-fontmap use font encodings conversion classes], wxUSE_FONTMAP) WX_ARG_FEATURE(fs_archive, [ --enable-fs_archive use virtual archive filesystems], wxUSE_FS_ARCHIVE) WX_ARG_FEATURE(fs_inet, [ --enable-fs_inet use virtual HTTP/FTP filesystems], wxUSE_FS_INET) diff --git a/include/wx/fontenum.h b/include/wx/fontenum.h index 0e4b525cd5..29127061a8 100644 --- a/include/wx/fontenum.h +++ b/include/wx/fontenum.h @@ -13,6 +13,10 @@ #ifndef _WX_FONTENUM_H_ #define _WX_FONTENUM_H_ +#include "wx/defs.h" + +#if wxUSE_FONTENUM + #include "wx/fontenc.h" #include "wx/arrstr.h" @@ -80,4 +84,6 @@ private: DECLARE_NO_COPY_CLASS(wxFontEnumerator) }; +#endif // wxUSE_FONTENUM + #endif // _WX_FONTENUM_H_ diff --git a/include/wx/mac/setup0.h b/include/wx/mac/setup0.h index 5583f84ad0..a512c0062c 100644 --- a/include/wx/mac/setup0.h +++ b/include/wx/mac/setup0.h @@ -492,6 +492,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index a87494d58b..4987201b9e 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -491,6 +491,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 50ee712377..05010371f9 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -491,6 +491,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index 1b647c578c..b1b2599069 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -491,6 +491,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index b1d8003bca..0bfc015f05 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -491,6 +491,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h index e45042039d..87bf32ac74 100644 --- a/include/wx/palmos/setup0.h +++ b/include/wx/palmos/setup0.h @@ -491,6 +491,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index ae0eeac492..79e636098e 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -487,6 +487,9 @@ // Joystick support class #define wxUSE_JOYSTICK 1 +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + // wxFontMapper class #define wxUSE_FONTMAP 1 diff --git a/setup.h.in b/setup.h.in index 78c9c825d6..9c7f54691f 100644 --- a/setup.h.in +++ b/setup.h.in @@ -270,6 +270,8 @@ #define wxUSE_JOYSTICK 0 +#define wxUSE_FONTENUM 0 + #define wxUSE_FONTMAP 0 #define wxUSE_MIMETYPE 0 diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 4fcd211e53..20b8c303d0 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -388,13 +388,17 @@ wxString wxFontBase::GetWeightString() const } } -bool wxFontBase::SetFaceName(const wxString &facename) +bool wxFontBase::SetFaceName(const wxString& facename) { +#if wxUSE_FONTENUM if (!wxFontEnumerator::IsValidFacename(facename)) { UnRef(); // make Ok() return false return false; } +#else // !wxUSE_FONTENUM + wxUnusedVar(facename); +#endif // wxUSE_FONTENUM/!wxUSE_FONTENUM return true; } @@ -405,8 +409,9 @@ bool wxFontBase::SetFaceName(const wxString &facename) // ---------------------------------------------------------------------------- // Up to now, there are no native implementations of this function: -void wxNativeFontInfo::SetFaceName(const wxArrayString &facenames) +void wxNativeFontInfo::SetFaceName(const wxArrayString& facenames) { +#if wxUSE_FONTENUM for (size_t i=0; i < facenames.GetCount(); i++) { if (wxFontEnumerator::IsValidFacename(facenames[i])) @@ -420,6 +425,9 @@ void wxNativeFontInfo::SetFaceName(const wxArrayString &facenames) wxString validfacename = wxFontEnumerator::GetFacenames().Item(0); wxLogTrace(wxT("font"), wxT("Falling back to '%s'"), validfacename.c_str()); SetFaceName(validfacename); +#else // !wxUSE_FONTENUM + SetFaceName(facenames[0]); +#endif // wxUSE_FONTENUM/!wxUSE_FONTENUM } @@ -744,9 +752,15 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) // NB: the check on the facename is implemented in wxFontBase::SetFaceName // and not in wxNativeFontInfo::SetFaceName thus we need to explicitely // call here wxFontEnumerator::IsValidFacename - if (!wxFontEnumerator::IsValidFacename(face) || - !SetFaceName(face)) + if ( +#if wxUSE_FONTENUM + !wxFontEnumerator::IsValidFacename(face) || +#endif // wxUSE_FONTENUM + !SetFaceName(face) ) + { SetFaceName(wxNORMAL_FONT->GetFaceName()); + } + face.clear(); } } @@ -757,9 +771,14 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) // NB: the check on the facename is implemented in wxFontBase::SetFaceName // and not in wxNativeFontInfo::SetFaceName thus we need to explicitely // call here wxFontEnumerator::IsValidFacename - if (!wxFontEnumerator::IsValidFacename(face) || - !SetFaceName(face)) - SetFaceName(wxNORMAL_FONT->GetFaceName()); + if ( +#if wxUSE_FONTENUM + !wxFontEnumerator::IsValidFacename(face) || +#endif // wxUSE_FONTENUM + !SetFaceName(face) ) + { + SetFaceName(wxNORMAL_FONT->GetFaceName()); + } } // set point size to default value if size was not given diff --git a/src/common/fontenumcmn.cpp b/src/common/fontenumcmn.cpp index c2ef4c8820..aaae1543c4 100644 --- a/src/common/fontenumcmn.cpp +++ b/src/common/fontenumcmn.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_FONTENUM + #include "wx/fontenum.h" // ============================================================================ @@ -129,3 +131,5 @@ bool wxFontEnumerator::EnumerateEncodingsUTF8(const wxString& facename) return true; } #endif // wxHAS_UTF8_FONTS + +#endif // wxUSE_FONTENUM diff --git a/src/mac/carbon/fontenum.cpp b/src/mac/carbon/fontenum.cpp index 3cbe7bad1b..6db95ec845 100644 --- a/src/mac/carbon/fontenum.cpp +++ b/src/mac/carbon/fontenum.cpp @@ -12,7 +12,7 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#if wxUSE_FONTMAP +#if wxUSE_FONTENUM #include "wx/fontenum.h" @@ -37,20 +37,20 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, // // From Apple's QA 1471 http://developer.apple.com/qa/qa2006/qa1471.html // - + ATSFontFamilyIterator theFontFamilyIterator = NULL; ATSFontFamilyRef theATSFontFamilyRef = 0; OSStatus status = noErr; - + wxArrayString fontFamilies ; - + // Create the iterator status = ATSFontFamilyIteratorCreate(kATSFontContextLocal, nil,nil, kATSOptionFlagsUnRestrictedScope, &theFontFamilyIterator ); - + wxUint32 macEncoding = wxMacGetSystemEncFromFontEnc(encoding) ; - + while (status == noErr) { // Get the next font in the iteration. @@ -76,7 +76,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, if ( fontFamiliyEncoding != macEncoding ) continue ; } - + // TODO: determine fixed widths ... CFStringRef theName = NULL; @@ -94,13 +94,13 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, } } ATSFontFamilyIteratorRelease(&theFontFamilyIterator); - + for ( size_t i = 0 ; i < fontFamilies.Count() ; ++i ) { if ( OnFacename( fontFamilies[i] ) == false ) break ; } - + return true; } @@ -111,4 +111,4 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) return true; } -#endif // wxUSE_FONTMAP +#endif // wxUSE_FONTENUM diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index 50fea7dc51..cf3623766b 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -24,7 +24,7 @@ #pragma hdrstop #endif -#if wxUSE_FONTMAP +#if wxUSE_FONTENUM #ifndef WX_PRECOMP #include "wx/gdicmn.h" @@ -289,4 +289,4 @@ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, } #endif -#endif // wxUSE_FONTMAP +#endif // wxUSE_FONTENUM diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index e09f06170e..dc50c9b740 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -20,6 +20,8 @@ // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#if wxUSE_FONTENUM + #include "wx/fontenum.h" #ifndef WX_PRECOMP @@ -360,3 +362,5 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) } #endif // !wxUSE_PANGO + +#endif // wxUSE_FONTENUM