X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..49bffb1482cd2a6a30b38280f6c9bffc72dbfe42:/wxPython/src/_font.i diff --git a/wxPython/src/_font.i b/wxPython/src/_font.i index 9cd36d352c..bd059a236e 100644 --- a/wxPython/src/_font.i +++ b/wxPython/src/_font.i @@ -118,7 +118,8 @@ enum wxFontEncoding wxFONTENCODING_ISO8859_MAX, // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) - wxFONTENCODING_KOI8, // we don't support any of KOI8 variants + wxFONTENCODING_KOI8, // KOI8 Russian + wxFONTENCODING_KOI8_U, // KOI8 Ukrainian wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria @@ -153,6 +154,50 @@ enum wxFontEncoding wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding + wxFONTENCODING_MACROMAN, // the standard mac encodings + wxFONTENCODING_MACJAPANESE, + wxFONTENCODING_MACCHINESETRAD, + wxFONTENCODING_MACKOREAN, + wxFONTENCODING_MACARABIC, + wxFONTENCODING_MACHEBREW, + wxFONTENCODING_MACGREEK, + wxFONTENCODING_MACCYRILLIC, + wxFONTENCODING_MACDEVANAGARI, + wxFONTENCODING_MACGURMUKHI, + wxFONTENCODING_MACGUJARATI, + wxFONTENCODING_MACORIYA, + wxFONTENCODING_MACBENGALI, + wxFONTENCODING_MACTAMIL, + wxFONTENCODING_MACTELUGU, + wxFONTENCODING_MACKANNADA, + wxFONTENCODING_MACMALAJALAM, + wxFONTENCODING_MACSINHALESE, + wxFONTENCODING_MACBURMESE, + wxFONTENCODING_MACKHMER, + wxFONTENCODING_MACTHAI, + wxFONTENCODING_MACLAOTIAN, + wxFONTENCODING_MACGEORGIAN, + wxFONTENCODING_MACARMENIAN, + wxFONTENCODING_MACCHINESESIMP, + wxFONTENCODING_MACTIBETAN, + wxFONTENCODING_MACMONGOLIAN, + wxFONTENCODING_MACETHIOPIC, + wxFONTENCODING_MACCENTRALEUR, + wxFONTENCODING_MACVIATNAMESE, + wxFONTENCODING_MACARABICEXT, + wxFONTENCODING_MACSYMBOL, + wxFONTENCODING_MACDINGBATS, + wxFONTENCODING_MACTURKISH, + wxFONTENCODING_MACCROATIAN, + wxFONTENCODING_MACICELANDIC, + wxFONTENCODING_MACROMANIAN, + wxFONTENCODING_MACCELTIC, + wxFONTENCODING_MACGAELIC, + wxFONTENCODING_MACKEYBOARD, + + wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , + wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , + wxFONTENCODING_MAX, // highest enumerated encoding value @@ -261,17 +306,17 @@ struct wxNativeEncodingInfo %} // test for the existence of the font described by this facename/encoding, -// return TRUE if such font(s) exist, FALSE otherwise +// return True if such font(s) exist, False otherwise bool wxTestFontEncoding(const wxNativeEncodingInfo& info); #else %inline %{ wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding) - { PyErr_SetNone(PyExc_NotImplementedError); return NULL; } + { wxPyRaiseNotImplemented(); return NULL; } bool wxTestFontEncoding(const wxNativeEncodingInfo& info) - { PyErr_SetNone(PyExc_NotImplementedError); return false; } + { wxPyRaiseNotImplemented(); return False; } %} #endif @@ -284,11 +329,11 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info); // The default implementations of all functions will ask the user if they are // not capable of finding the answer themselves and store the answer in a // config file (configurable via SetConfigXXX functions). This behaviour may -// be disabled by giving the value of FALSE to "interactive" parameter. +// be disabled by giving the value of False to "interactive" parameter. // However, the functions will always consult the config file to allow the // user-defined values override the default logic and there is no way to // disable this - which shouldn't be ever needed because if "interactive" was -// never TRUE, the config file is never created anyhow. +// never True, the config file is never created anyhow. // // This is a singleton class, font mapper objects can only be accessed using // wxFontMapper::Get(). @@ -309,9 +354,9 @@ public: // wxFONTENCODING_SYSTEM if couldn't decode it // // interactive parameter is ignored in the base class, we behave as if it - // were always false + // were always False virtual wxFontEncoding CharsetToEncoding(const wxString& charset, - bool interactive = true); + bool interactive = True); // get the number of font encodings we know about @@ -329,6 +374,12 @@ public: // NB: hard-coded now, but might change later (read it from config?) static wxString GetEncodingDescription(wxFontEncoding encoding); + // find the encoding corresponding to the given name, inverse of + // GetEncodingName() and less general than CharsetToEncoding() + // + // returns wxFONTENCODING_MAX if the name is not a supported encoding + static wxFontEncoding GetEncodingFromName(const wxString& name); + // set the config object to use (may be NULL to use default) void SetConfig(wxConfigBase *config); @@ -347,7 +398,7 @@ public: %extend { PyObject* GetAltForEncoding(wxFontEncoding encoding, const wxString& facename = wxPyEmptyString, - bool interactive = TRUE) { + bool interactive = True) { wxFontEncoding alt_enc; if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive)) return PyInt_FromLong(alt_enc); @@ -360,7 +411,8 @@ public: // checks whether given encoding is available in given face or not. - // If no facename is given, + // If no facename is given (default), return true if it's available in any + // facename at all. bool IsEncodingAvailable(wxFontEncoding encoding, const wxString& facename = wxPyEmptyString); @@ -381,7 +433,7 @@ public: class wxFont : public wxGDIObject { public: wxFont( int pointSize, int family, int style, int weight, - bool underline=FALSE, const wxString& face = wxPyEmptyString, + bool underline=False, const wxString& face = wxPyEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT); ~wxFont(); @@ -408,8 +460,10 @@ public: %pythoncode { def __nonzero__(self): return self.Ok() } // comparison - bool operator == (const wxFont& font) const; - bool operator != (const wxFont& font) const; + %extend { + bool __eq__(const wxFont* other) { return other ? (*self == *other) : False; } + bool __ne__(const wxFont* other) { return other ? (*self != *other) : True; } + } // accessors: get the font characteristics virtual int GetPointSize() const; @@ -445,7 +499,7 @@ public: wxString GetWeightString() const; // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool no = TRUE ); + virtual void SetNoAntiAliasing( bool no = True ); virtual bool GetNoAntiAliasing(); // the default encoding is used for creating all fonts with default @@ -479,7 +533,7 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc %name(FontEnumerator) class wxPyFontEnumerator { public: - %addtofunc wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)" + %pythonAppend wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)" wxPyFontEnumerator(); ~wxPyFontEnumerator(); @@ -487,7 +541,7 @@ public: bool EnumerateFacenames( wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = FALSE); + bool fixedWidthOnly = False); bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);