added wxUSE_FONTENUM for wxFontEnumerator

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-07-21 02:20:00 +00:00
parent a8ff046ba9
commit ff42758536
16 changed files with 133 additions and 20 deletions

58
configure vendored
View File

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

View File

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

View File

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

View File

@ -492,6 +492,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -491,6 +491,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -491,6 +491,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -491,6 +491,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -491,6 +491,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -491,6 +491,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -487,6 +487,9 @@
// Joystick support class
#define wxUSE_JOYSTICK 1
// wxFontEnumerator class
#define wxUSE_FONTENUM 1
// wxFontMapper class
#define wxUSE_FONTMAP 1

View File

@ -270,6 +270,8 @@
#define wxUSE_JOYSTICK 0
#define wxUSE_FONTENUM 0
#define wxUSE_FONTMAP 0
#define wxUSE_MIMETYPE 0

View File

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

View File

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

View File

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

View File

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

View File

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