1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface file for wxFont and related classes
9 // Copyright: (c) 2002 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
19 #include <wx/fontutil.h>
20 #include <wx/fontmap.h>
21 #include <wx/fontenum.h>
24 //---------------------------------------------------------------------------
30 wxFONTFAMILY_DEFAULT = wxDEFAULT,
31 wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
32 wxFONTFAMILY_ROMAN = wxROMAN,
33 wxFONTFAMILY_SCRIPT = wxSCRIPT,
34 wxFONTFAMILY_SWISS = wxSWISS,
35 wxFONTFAMILY_MODERN = wxMODERN,
36 wxFONTFAMILY_TELETYPE = wxTELETYPE,
38 wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX
44 wxFONTSTYLE_NORMAL = wxNORMAL,
45 wxFONTSTYLE_ITALIC = wxITALIC,
46 wxFONTSTYLE_SLANT = wxSLANT,
53 wxFONTWEIGHT_NORMAL = wxNORMAL,
54 wxFONTWEIGHT_LIGHT = wxLIGHT,
55 wxFONTWEIGHT_BOLD = wxBOLD,
60 // the font flag bits for the new font ctor accepting one combined flags word
63 // no special flags: font with default weight/slant/anti-aliasing
66 // slant flags (default: no slant)
70 // weight flags (default: medium)
74 // anti-aliasing flag: force on or off (default: the current system default)
75 wxFONTFLAG_ANTIALIASED,
76 wxFONTFLAG_NOT_ANTIALIASED,
78 // underlined/strikethrough flags (default: no lines)
79 wxFONTFLAG_UNDERLINED,
80 wxFONTFLAG_STRIKETHROUGH,
82 // the mask of all currently used flags
90 wxFONTENCODING_SYSTEM = -1, // system default
91 wxFONTENCODING_DEFAULT, // current default encoding
93 // ISO8859 standard defines a number of single-byte charsets
94 wxFONTENCODING_ISO8859_1, // West European (Latin1)
95 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
96 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
97 wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
98 wxFONTENCODING_ISO8859_5, // Cyrillic
99 wxFONTENCODING_ISO8859_6, // Arabic
100 wxFONTENCODING_ISO8859_7, // Greek
101 wxFONTENCODING_ISO8859_8, // Hebrew
102 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
103 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
104 wxFONTENCODING_ISO8859_11, // Thai
105 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
106 // here anyhow to make all ISO8859
107 // consecutive numbers
108 wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
109 wxFONTENCODING_ISO8859_14, // Latin8
110 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
111 wxFONTENCODING_ISO8859_MAX,
113 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
114 wxFONTENCODING_KOI8, // KOI8 Russian
115 wxFONTENCODING_KOI8_U, // KOI8 Ukrainian
116 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
117 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
119 // what would we do without Microsoft? They have their own encodings
121 wxFONTENCODING_CP437, // original MS-DOS codepage
122 wxFONTENCODING_CP850, // CP437 merged with Latin1
123 wxFONTENCODING_CP852, // CP437 merged with Latin2
124 wxFONTENCODING_CP855, // another cyrillic encoding
125 wxFONTENCODING_CP866, // and another one
127 wxFONTENCODING_CP874, // WinThai
128 wxFONTENCODING_CP932, // Japanese (shift-JIS)
129 wxFONTENCODING_CP936, // Chinese simplified (GB)
130 wxFONTENCODING_CP949, // Korean (Hangul charset)
131 wxFONTENCODING_CP950, // Chinese (traditional - Big5)
132 wxFONTENCODING_CP1250, // WinLatin2
133 wxFONTENCODING_CP1251, // WinCyrillic
134 wxFONTENCODING_CP1252, // WinLatin1
135 wxFONTENCODING_CP1253, // WinGreek (8859-7)
136 wxFONTENCODING_CP1254, // WinTurkish
137 wxFONTENCODING_CP1255, // WinHebrew
138 wxFONTENCODING_CP1256, // WinArabic
139 wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
140 wxFONTENCODING_CP12_MAX,
142 wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
143 wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
144 wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese
145 wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding
146 wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding
147 wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding
148 wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
150 wxFONTENCODING_MACROMAN, // the standard mac encodings
151 wxFONTENCODING_MACJAPANESE,
152 wxFONTENCODING_MACCHINESETRAD,
153 wxFONTENCODING_MACKOREAN,
154 wxFONTENCODING_MACARABIC,
155 wxFONTENCODING_MACHEBREW,
156 wxFONTENCODING_MACGREEK,
157 wxFONTENCODING_MACCYRILLIC,
158 wxFONTENCODING_MACDEVANAGARI,
159 wxFONTENCODING_MACGURMUKHI,
160 wxFONTENCODING_MACGUJARATI,
161 wxFONTENCODING_MACORIYA,
162 wxFONTENCODING_MACBENGALI,
163 wxFONTENCODING_MACTAMIL,
164 wxFONTENCODING_MACTELUGU,
165 wxFONTENCODING_MACKANNADA,
166 wxFONTENCODING_MACMALAJALAM,
167 wxFONTENCODING_MACSINHALESE,
168 wxFONTENCODING_MACBURMESE,
169 wxFONTENCODING_MACKHMER,
170 wxFONTENCODING_MACTHAI,
171 wxFONTENCODING_MACLAOTIAN,
172 wxFONTENCODING_MACGEORGIAN,
173 wxFONTENCODING_MACARMENIAN,
174 wxFONTENCODING_MACCHINESESIMP,
175 wxFONTENCODING_MACTIBETAN,
176 wxFONTENCODING_MACMONGOLIAN,
177 wxFONTENCODING_MACETHIOPIC,
178 wxFONTENCODING_MACCENTRALEUR,
179 wxFONTENCODING_MACVIATNAMESE,
180 wxFONTENCODING_MACARABICEXT,
181 wxFONTENCODING_MACSYMBOL,
182 wxFONTENCODING_MACDINGBATS,
183 wxFONTENCODING_MACTURKISH,
184 wxFONTENCODING_MACCROATIAN,
185 wxFONTENCODING_MACICELANDIC,
186 wxFONTENCODING_MACROMANIAN,
187 wxFONTENCODING_MACCELTIC,
188 wxFONTENCODING_MACGAELIC,
189 wxFONTENCODING_MACKEYBOARD,
191 wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
192 wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
194 wxFONTENCODING_MAX, // highest enumerated encoding value
197 // aliases for endian-dependent UTF encodings
198 wxFONTENCODING_UTF16, // native UTF-16
199 wxFONTENCODING_UTF32, // native UTF-32
201 // alias for the native Unicode encoding on this platform
202 // (this is used by wxEncodingConverter and wxUTFFile only for now)
203 wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16,
205 // alternative names for Far Eastern encodings
207 wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese
208 wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese
210 // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html)
211 wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932 // Shift JIS
214 //---------------------------------------------------------------------------
217 // wxNativeFontInfo is platform-specific font representation: this struct
218 // should be considered as opaque font description only used by the native
219 // functions, the user code can only get the objects of this type from
220 // somewhere and pass it somewhere else (possibly save them somewhere using
221 // ToString() and restore them using FromString())
222 struct wxNativeFontInfo
228 // reset to the default state
231 // init with the parameters of the given font
232 void InitFromFont(const wxFont& font);
234 // accessors and modifiers for the font elements
235 int GetPointSize() const;
237 wxSize GetPixelSize() const;
239 wxFontStyle GetStyle() const;
240 wxFontWeight GetWeight() const;
241 bool GetUnderlined() const;
242 wxString GetFaceName() const;
243 wxFontFamily GetFamily() const;
244 wxFontEncoding GetEncoding() const;
246 void SetPointSize(int pointsize);
248 void SetPixelSize(const wxSize& pixelSize);
250 void SetStyle(wxFontStyle style);
251 void SetWeight(wxFontWeight weight);
252 void SetUnderlined(bool underlined);
253 bool SetFaceName(wxString facename);
254 void SetFamily(wxFontFamily family);
255 void SetEncoding(wxFontEncoding encoding);
258 // // sets the first facename in the given array which is found
259 // // to be valid. If no valid facename is given, sets the
260 // // first valid facename returned by wxFontEnumerator::GetFacenames().
261 // // Does not return a bool since it cannot fail.
262 // void SetFaceName(const wxArrayString &facenames);
265 // it is important to be able to serialize wxNativeFontInfo objects to be
266 // able to store them (in config file, for example)
267 bool FromString(const wxString& s);
268 wxString ToString() const;
272 return self->ToString();
276 // we also want to present the native font descriptions to the user in some
277 // human-readable form (it is not platform independent neither, but can
278 // hopefully be understood by the user)
279 bool FromUserString(const wxString& s);
280 wxString ToUserString() const;
286 struct wxNativeEncodingInfo
288 wxString facename; // may be empty meaning "any"
289 wxFontEncoding encoding; // so that we know what this struct represents
291 wxNativeEncodingInfo();
292 ~wxNativeEncodingInfo();
294 // this struct is saved in config by wxFontMapper, so it should know to
295 // serialise itself (implemented in platform-specific code)
296 bool FromString(const wxString& s);
297 wxString ToString() const;
302 // translate a wxFontEncoding into native encoding parameter (defined above),
303 // returning a wxNativeEncodingInfo if an (exact) match could be found, NULL
306 wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding) {
307 static wxNativeEncodingInfo info;
308 if ( wxGetNativeFontEncoding(encoding, &info) )
315 // test for the existence of the font described by this facename/encoding,
316 // return True if such font(s) exist, False otherwise
317 bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
322 wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding)
323 { wxPyRaiseNotImplemented(); return NULL; }
325 bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
326 { wxPyRaiseNotImplemented(); return false; }
330 //---------------------------------------------------------------------------
333 // wxFontMapper manages user-definable correspondence between logical font
334 // names and the fonts present on the machine.
336 // The default implementations of all functions will ask the user if they are
337 // not capable of finding the answer themselves and store the answer in a
338 // config file (configurable via SetConfigXXX functions). This behaviour may
339 // be disabled by giving the value of False to "interactive" parameter.
340 // However, the functions will always consult the config file to allow the
341 // user-defined values override the default logic and there is no way to
342 // disable this - which shouldn't be ever needed because if "interactive" was
343 // never True, the config file is never created anyhow.
345 // This is a singleton class, font mapper objects can only be accessed using
346 // wxFontMapper::Get().
354 // return instance of the wxFontMapper singleton
355 static wxFontMapper *Get();
356 // set the singleton to 'mapper' instance and return previous one
357 static wxFontMapper *Set(wxFontMapper *mapper);
360 // returns the encoding for the given charset (in the form of RFC 2046) or
361 // wxFONTENCODING_SYSTEM if couldn't decode it
363 // interactive parameter is ignored in the base class, we behave as if it
365 virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
366 bool interactive = true);
369 // get the number of font encodings we know about
370 static size_t GetSupportedEncodingsCount();
372 // get the n-th supported encoding
373 static wxFontEncoding GetEncoding(size_t n);
375 // return canonical name of this encoding (this is a short string,
376 // GetEncodingDescription() returns a longer one)
377 static wxString GetEncodingName(wxFontEncoding encoding);
379 // // return a list of all names of this encoding (see GetEncodingName)
380 // static const wxChar** GetAllEncodingNames(wxFontEncoding encoding);
382 // return user-readable string describing the given encoding
384 // NB: hard-coded now, but might change later (read it from config?)
385 static wxString GetEncodingDescription(wxFontEncoding encoding);
387 // find the encoding corresponding to the given name, inverse of
388 // GetEncodingName() and less general than CharsetToEncoding()
390 // returns wxFONTENCODING_MAX if the name is not a supported encoding
391 static wxFontEncoding GetEncodingFromName(const wxString& name);
394 // set the root config path to use (should be an absolute path)
395 void SetConfigPath(const wxString& prefix);
397 // return default config path
398 static const wxString GetDefaultConfigPath();
402 // Find an alternative for the given encoding (which is supposed to not be
403 // available on this system). If successful, returns the encoding otherwise
406 PyObject* GetAltForEncoding(wxFontEncoding encoding,
407 const wxString& facename = wxPyEmptyString,
408 bool interactive = true) {
409 wxFontEncoding alt_enc;
410 if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
411 return PyInt_FromLong(alt_enc);
420 // checks whether given encoding is available in given face or not.
421 // If no facename is given (default), return true if it's available in any
423 bool IsEncodingAvailable(wxFontEncoding encoding,
424 const wxString& facename = wxPyEmptyString);
426 // the parent window for modal dialogs
427 void SetDialogParent(wxWindow *parent);
429 // the title for the dialogs (note that default is quite reasonable)
430 void SetDialogTitle(const wxString& title);
436 //---------------------------------------------------------------------------
441 MustHaveApp(wxFont::GetDefaultEncoding);
442 MustHaveApp(wxFont::SetDefaultEncoding);
445 "A font is an object which determines the appearance of text. Fonts are
446 used for drawing text to a device context, and setting the appearance
449 You can retrieve the current system font settings with `wx.SystemSettings`.", "
451 The possible values for the family parameter of wx.Font constructor are:
453 ======================== =============================
454 wx.FONTFAMILY_DEFAULT Chooses a default font.
455 wx.FONTFAMILY_DECORATIVE A decorative font.
456 wx.FONTFAMILY_ROMAN A formal, serif font.
457 wx.FONTFAMILY_SCRIPT A handwriting font.
458 wx.FONTFAMILY_SWISS A sans-serif font.
459 wx.FONTFAMILY_MODERN Usually a fixed pitch font.
460 wx.FONTFAMILY_TELETYPE A teletype font.
461 ======================== =============================
463 The possible values for the weight parameter are:
465 ==================== ==
469 ==================== ==
471 The known font encodings are:
473 =========================== ====================================
474 wx.FONTENCODING_SYSTEM system default
475 wx.FONTENCODING_DEFAULT current default encoding
476 wx.FONTENCODING_ISO8859_1 West European (Latin1)
477 wx.FONTENCODING_ISO8859_2 Central and East European (Latin2)
478 wx.FONTENCODING_ISO8859_3 Esperanto (Latin3)
479 wx.FONTENCODING_ISO8859_4 Baltic (old) (Latin4)
480 wx.FONTENCODING_ISO8859_5 Cyrillic
481 wx.FONTENCODING_ISO8859_6 Arabic
482 wx.FONTENCODING_ISO8859_7 Greek
483 wx.FONTENCODING_ISO8859_8 Hebrew
484 wx.FONTENCODING_ISO8859_9 Turkish (Latin5)
485 wx.FONTENCODING_ISO8859_10 Variation of Latin4 (Latin6)
486 wx.FONTENCODING_ISO8859_11 Thai
487 wx.FONTENCODING_ISO8859_12 doesn't exist currently, but put it
488 here anyhow to make all ISO8859
490 wx.FONTENCODING_ISO8859_13 Baltic (Latin7)
491 wx.FONTENCODING_ISO8859_14 Latin8
492 wx.FONTENCODING_ISO8859_15 Latin9 (a.k.a. Latin0, includes euro)
493 wx.FONTENCODING_KOI8 Cyrillic charset
494 wx.FONTENCODING_ALTERNATIVE same as MS-DOS CP866
495 wx.FONTENCODING_BULGARIAN used under Linux in Bulgaria
496 wx.FONTENCODING_CP437 original MS-DOS codepage
497 wx.FONTENCODING_CP850 CP437 merged with Latin1
498 wx.FONTENCODING_CP852 CP437 merged with Latin2
499 wx.FONTENCODING_CP855 another cyrillic encoding
500 wx.FONTENCODING_CP866 and another one
501 wx.FONTENCODING_CP874 WinThai
502 wx.FONTENCODING_CP1250 WinLatin2
503 wx.FONTENCODING_CP1251 WinCyrillic
504 wx.FONTENCODING_CP1252 WinLatin1
505 wx.FONTENCODING_CP1253 WinGreek (8859-7)
506 wx.FONTENCODING_CP1254 WinTurkish
507 wx.FONTENCODING_CP1255 WinHebrew
508 wx.FONTENCODING_CP1256 WinArabic
509 wx.FONTENCODING_CP1257 WinBaltic (same as Latin 7)
510 wx.FONTENCODING_UTF7 UTF-7 Unicode encoding
511 wx.FONTENCODING_UTF8 UTF-8 Unicode encoding
512 =========================== ====================================
516 class wxFont : public wxGDIObject {
518 %pythonPrepend wxFont "if kwargs.has_key('faceName'): kwargs['face'] = kwargs['faceName'];del kwargs['faceName']"
521 wxFont( int pointSize, int family, int style, int weight,
522 bool underline=false, const wxString& face = wxPyEmptyString,
523 wxFontEncoding encoding = wxFONTENCODING_DEFAULT),
524 "Creates a font object with the specified attributes.
526 :param pointSize: The size of the font in points.
528 :param family: Font family. A generic way of referring to fonts
529 without specifying actual facename. It can be One of
530 the ``wx.FONTFAMILY_xxx`` constants.
532 :param style: One of the ``wx.FONTSTYLE_xxx`` constants.
534 :param weight: Font weight, sometimes also referred to as font
535 boldness. One of the ``wx.FONTWEIGHT_xxx`` constants.
537 :param underline: The value can be ``True`` or ``False`` and
538 indicates whether the font will include an underline. This
539 may not be supported on all platforms.
541 :param face: An optional string specifying the actual typeface to
542 be used. If it is an empty string, a default typeface will be
543 chosen based on the family.
545 :param encoding: An encoding which may be one of the
546 ``wx.FONTENCODING_xxx`` constants. If the specified encoding isn't
547 available, no font is created.
549 :see: `wx.FFont`, `wx.FontFromPixelSize`, `wx.FFontFromPixelSize`,
550 `wx.FontFromNativeInfoString`, `wx.FontFromNativeInfo`
557 "Construct a `wx.Font` from a `wx.NativeFontInfo` object.", "",
558 wxFont(const wxNativeFontInfo& info));
562 FontFromNativeInfoString,
563 "Construct a `wx.Font` from the string representation of a
564 `wx.NativeFontInfo` object.", "",
565 wxFont(const wxString& info))
567 wxNativeFontInfo nfi;
568 nfi.FromString(info);
569 return new wxFont(nfi);
577 "A bit of a simpler way to create a `wx.Font` using flags instead of
578 individual attribute settings. The value of flags can be a
579 combination of the following:
581 ============================ ==
587 wx.FONTFLAG_ANTIALIASED
588 wx.FONTFLAG_NOT_ANTIALIASED
589 wx.FONTFLAG_UNDERLINED
590 wx.FONTFLAG_STRIKETHROUGH
591 ============================ ==
593 :see: `wx.Font.__init__`", "",
595 wxFont(int pointSize,
597 int flags = wxFONTFLAG_DEFAULT,
598 const wxString& face = wxPyEmptyString,
599 wxFontEncoding encoding = wxFONTENCODING_DEFAULT))
601 return wxFont::New(pointSize, family, flags, face, encoding);
605 // There is a real ctor for this on wxMSW, but not the others, so just
606 // use the factory function in all cases.
610 "Creates a font using a size in pixels rather than points. If there is
611 platform API support for this then it is used, otherwise a font with
612 the closest size is found using a binary search.
614 :see: `wx.Font.__init__`", "",
615 wxFont(const wxSize& pixelSize,
619 bool underlined = false,
620 const wxString& face = wxEmptyString,
621 wxFontEncoding encoding = wxFONTENCODING_DEFAULT))
623 return wxFontBase::New(pixelSize, family,
624 style, weight, underlined,
630 "Creates a font using a size in pixels rather than points. If there is
631 platform API support for this then it is used, otherwise a font with
632 the closest size is found using a binary search.
634 :see: `wx.Font.__init__`, `wx.FFont`", "",
635 wxFont(const wxSize& pixelSize,
637 int flags = wxFONTFLAG_DEFAULT,
638 const wxString& face = wxEmptyString,
639 wxFontEncoding encoding = wxFONTENCODING_DEFAULT))
641 return wxFontBase::New(pixelSize, family, flags, face, encoding);
647 // was the font successfully created?
650 "Returns ``True`` if this font was successfully created.", "");
651 %pythoncode { def __nonzero__(self): return self.Ok() }
656 bool __eq__(const wxFont* other) { return other ? (*self == *other) : false; }
657 bool __ne__(const wxFont* other) { return other ? (*self != *other) : true; }
662 virtual int , GetPointSize() const,
663 "Gets the point size.", "");
666 virtual wxSize , GetPixelSize() const,
667 "Returns the size in pixels if the font was constructed with a pixel
671 virtual bool , IsUsingSizeInPixels() const,
672 "Returns ``True`` if the font is using a pixelSize.", "");
676 virtual int , GetFamily() const,
677 "Gets the font family. ", "");
680 virtual int , GetStyle() const,
681 "Gets the font style.", "");
684 virtual int , GetWeight() const,
685 "Gets the font weight. ", "");
688 virtual bool , GetUnderlined() const,
689 "Returns ``True`` if the font is underlined, ``False`` otherwise.", "");
692 virtual wxString , GetFaceName() const,
693 "Returns the typeface name associated with the font, or the empty
694 string if there is no typeface information.", "");
697 virtual wxFontEncoding , GetEncoding() const,
698 "Get the font's encoding.", "");
701 virtual const wxNativeFontInfo *, GetNativeFontInfo() const,
702 "Constructs a `wx.NativeFontInfo` object from this font.", "");
706 virtual bool , IsFixedWidth() const,
707 "Returns true if the font is a fixed width (or monospaced) font, false
708 if it is a proportional one or font is invalid.", "");
712 wxString , GetNativeFontInfoDesc() const,
713 "Returns the platform-dependent string completely describing this font
714 or an empty string if the font isn't valid.", "");
717 wxString , GetNativeFontInfoUserDesc() const,
718 "Returns a human readable version of `GetNativeFontInfoDesc`.", "");
721 // change the font characteristics
723 virtual void , SetPointSize( int pointSize ),
724 "Sets the point size.", "");
727 virtual void , SetPixelSize( const wxSize& pixelSize ),
728 "Sets the size in pixels rather than points. If there is platform API
729 support for this then it is used, otherwise a font with the closest
730 size is found using a binary search.", "");
733 virtual void , SetFamily( int family ),
734 "Sets the font family.", "");
737 virtual void , SetStyle( int style ),
738 "Sets the font style.", "");
741 virtual void , SetWeight( int weight ),
742 "Sets the font weight.", "");
745 virtual bool , SetFaceName( const wxString& faceName ),
746 "Sets the facename for the font. The facename, which should be a valid
747 font installed on the end-user's system.
749 To avoid portability problems, don't rely on a specific face, but
750 specify the font family instead or as well. A suitable font will be
751 found on the end-user's system. If both the family and the facename
752 are specified, wxWidgets will first search for the specific face, and
753 then for a font belonging to the same family.", "");
756 virtual void , SetUnderlined( bool underlined ),
757 "Sets underlining.", "");
760 virtual void , SetEncoding(wxFontEncoding encoding),
761 "Set the font encoding.", "");
764 void , SetNativeFontInfo(const wxNativeFontInfo& info),
765 "Set the font's attributes from a `wx.NativeFontInfo` object.", "");
769 bool , SetNativeFontInfo(const wxString& info),
770 "Set the font's attributes from string representation of a
771 `wx.NativeFontInfo` object.", "",
772 SetNativeFontInfoFromString);
775 bool , SetNativeFontInfoUserDesc(const wxString& info),
776 "Set the font's attributes from a string formerly returned from
777 `GetNativeFontInfoDesc`.", "");
781 wxString , GetFamilyString() const,
782 "Returns a string representation of the font family.", "");
785 wxString , GetStyleString() const,
786 "Returns a string representation of the font style.", "");
789 wxString , GetWeightString() const,
790 "Return a string representation of the font weight.", "");
793 virtual void SetNoAntiAliasing( bool no = true );
794 virtual bool GetNoAntiAliasing() const;
796 // the default encoding is used for creating all fonts with default
797 // encoding parameter
799 static wxFontEncoding , GetDefaultEncoding(),
800 "Returns the encoding used for all fonts created with an encoding of
801 ``wx.FONTENCODING_DEFAULT``.", "");
804 static void , SetDefaultEncoding(wxFontEncoding encoding),
805 "Sets the default font encoding.", "");
809 %pythoncode { Font2 = wx._deprecated(FFont, "Use `wx.FFont` instead.") }
811 //---------------------------------------------------------------------------
816 class wxPyFontEnumerator : public wxFontEnumerator {
818 wxPyFontEnumerator() {}
819 ~wxPyFontEnumerator() {}
821 DEC_PYCALLBACK_BOOL_STRING(OnFacename);
822 DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
827 IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
828 IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
832 MustHaveApp(wxPyFontEnumerator);
834 %rename(FontEnumerator) wxPyFontEnumerator;
835 class wxPyFontEnumerator {
837 %pythonAppend wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)"
839 wxPyFontEnumerator();
840 ~wxPyFontEnumerator();
841 void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref);
843 bool EnumerateFacenames(
844 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
845 bool fixedWidthOnly = false);
847 bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);
850 static PyObject* GetEncodings() {
852 wxArrayString arr = wxFontEnumerator::GetEncodings();
853 wxPyBlock_t blocked = wxPyBeginBlockThreads();
854 ret = wxArrayString2PyList_helper(arr);
855 wxPyEndBlockThreads(blocked);
859 static PyObject* GetFacenames() {
861 wxArrayString arr = wxFontEnumerator::GetFacenames();
862 wxPyBlock_t blocked = wxPyBeginBlockThreads();
863 ret = wxArrayString2PyList_helper(arr);
864 wxPyEndBlockThreads(blocked);
870 static bool , IsValidFacename(const wxString &str),
871 "Convenience function that returns true if the given face name exist in
872 the user's system", "");
879 wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");
882 //---------------------------------------------------------------------------