2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: font.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxFont
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
|
|
|
|
/**
|
2009-04-12 18:53:26 -04:00
|
|
|
Standard font families: these are used mainly during wxFont creation to specify
|
|
|
|
the generic properties of the font without hardcoding in the sources a specific
|
|
|
|
face name.
|
|
|
|
|
|
|
|
wxFontFamily thus allows to group the font face names of fonts with similar
|
|
|
|
properties. Most wxWidgets ports use lists of fonts for each font family
|
|
|
|
inspired by the data taken from http://www.codestyle.org/css/font-family.
|
2008-09-25 15:15:28 -04:00
|
|
|
*/
|
|
|
|
enum wxFontFamily
|
|
|
|
{
|
|
|
|
wxFONTFAMILY_DEFAULT = wxDEFAULT, //!< Chooses a default font.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTFAMILY_DECORATIVE = wxDECORATIVE, //!< A decorative font.
|
|
|
|
wxFONTFAMILY_ROMAN = wxROMAN, //!< A formal, serif font.
|
|
|
|
wxFONTFAMILY_SCRIPT = wxSCRIPT, //!< A handwriting font.
|
|
|
|
wxFONTFAMILY_SWISS = wxSWISS, //!< A sans-serif font.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-12 18:53:26 -04:00
|
|
|
/// A fixed pitch font. Note that wxFont currently does not make distinctions
|
|
|
|
/// between @c wxFONTFAMILY_MODERN and @c wxFONTFAMILY_TELETYPE.
|
|
|
|
wxFONTFAMILY_MODERN = wxMODERN,
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-12 18:53:26 -04:00
|
|
|
/// A teletype (i.e. monospaced) font.
|
2009-06-12 16:11:21 -04:00
|
|
|
/// Monospace fonts have a fixed width like typewriters and often have strong angular
|
|
|
|
/// or block serifs. Monospace font faces are often used code samples and have a simple,
|
2009-04-12 18:53:26 -04:00
|
|
|
/// functional font style.
|
|
|
|
/// See also wxFont::IsFixedWidth() for an easy way to test for monospace property.
|
|
|
|
wxFONTFAMILY_TELETYPE = wxTELETYPE,
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2011-09-16 13:03:01 -04:00
|
|
|
wxFONTFAMILY_MAX,
|
2010-09-29 09:46:09 -04:00
|
|
|
/// Invalid font family value, returned by wxFont::GetFamily() when the
|
|
|
|
/// font is invalid for example.
|
2011-09-16 13:03:01 -04:00
|
|
|
wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX
|
2008-09-25 15:15:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Font styles.
|
|
|
|
*/
|
|
|
|
enum wxFontStyle
|
|
|
|
{
|
2009-03-25 08:30:27 -04:00
|
|
|
/// The font is drawn without slant.
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTSTYLE_NORMAL = wxNORMAL,
|
2009-03-25 08:30:27 -04:00
|
|
|
|
|
|
|
/// The font is slanted in an italic style.
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTSTYLE_ITALIC = wxITALIC,
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
/// The font is slanted, but in a roman style.
|
2009-03-25 08:30:27 -04:00
|
|
|
/// Note that under wxMSW this style is the same as @c wxFONTSTYLE_ITALIC.
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTSTYLE_SLANT = wxSLANT,
|
2009-03-25 08:30:27 -04:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTSTYLE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Font weights.
|
|
|
|
*/
|
|
|
|
enum wxFontWeight
|
|
|
|
{
|
|
|
|
wxFONTWEIGHT_NORMAL = wxNORMAL, //!< Normal font.
|
|
|
|
wxFONTWEIGHT_LIGHT = wxLIGHT, //!< Light font.
|
|
|
|
wxFONTWEIGHT_BOLD = wxBOLD, //!< Bold font.
|
|
|
|
wxFONTWEIGHT_MAX
|
|
|
|
};
|
|
|
|
|
2011-02-27 07:47:05 -05:00
|
|
|
/**
|
|
|
|
Symbolic font sizes.
|
|
|
|
|
|
|
|
The elements of this enum correspond to CSS absolute size specifications,
|
|
|
|
see http://www.w3.org/TR/CSS21/fonts.html#font-size-props
|
|
|
|
|
|
|
|
@see wxFont::SetSymbolicSize()
|
|
|
|
|
|
|
|
@since 2.9.2
|
|
|
|
*/
|
|
|
|
enum wxFontSymbolicSize
|
|
|
|
{
|
|
|
|
wxFONTSIZE_XX_SMALL = -3, //!< Extra small.
|
|
|
|
wxFONTSIZE_X_SMALL, //!< Very small.
|
|
|
|
wxFONTSIZE_SMALL, //!< Small.
|
|
|
|
wxFONTSIZE_MEDIUM, //!< Normal.
|
|
|
|
wxFONTSIZE_LARGE, //!< Large.
|
|
|
|
wxFONTSIZE_X_LARGE, //!< Very large.
|
|
|
|
wxFONTSIZE_XX_LARGE //!< Extra large.
|
|
|
|
};
|
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
/**
|
|
|
|
The font flag bits for the new font ctor accepting one combined flags word.
|
|
|
|
*/
|
|
|
|
enum wxFontFlag
|
|
|
|
{
|
|
|
|
/// no special flags: font with default weight/slant/anti-aliasing
|
|
|
|
wxFONTFLAG_DEFAULT = 0,
|
|
|
|
|
|
|
|
/// slant flags (default: no slant)
|
|
|
|
wxFONTFLAG_ITALIC = 1 << 0,
|
|
|
|
wxFONTFLAG_SLANT = 1 << 1,
|
|
|
|
|
|
|
|
/// weight flags (default: medium)
|
|
|
|
wxFONTFLAG_LIGHT = 1 << 2,
|
|
|
|
wxFONTFLAG_BOLD = 1 << 3,
|
|
|
|
|
|
|
|
/// anti-aliasing flag: force on or off (default: the current system default)
|
|
|
|
wxFONTFLAG_ANTIALIASED = 1 << 4,
|
|
|
|
wxFONTFLAG_NOT_ANTIALIASED = 1 << 5,
|
|
|
|
|
2012-01-23 06:28:28 -05:00
|
|
|
/// Underlined style (not underlined by default).
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTFLAG_UNDERLINED = 1 << 6,
|
2012-01-23 06:28:28 -05:00
|
|
|
|
|
|
|
/// Strike-through style (only supported in wxMSW and wxGTK currently).
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTFLAG_STRIKETHROUGH = 1 << 7,
|
|
|
|
|
|
|
|
/// the mask of all currently used flags
|
|
|
|
wxFONTFLAG_MASK = wxFONTFLAG_ITALIC |
|
|
|
|
wxFONTFLAG_SLANT |
|
|
|
|
wxFONTFLAG_LIGHT |
|
|
|
|
wxFONTFLAG_BOLD |
|
|
|
|
wxFONTFLAG_ANTIALIASED |
|
|
|
|
wxFONTFLAG_NOT_ANTIALIASED |
|
|
|
|
wxFONTFLAG_UNDERLINED |
|
|
|
|
wxFONTFLAG_STRIKETHROUGH
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Font encodings.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
See wxFont::SetEncoding().
|
2008-09-25 15:15:28 -04:00
|
|
|
*/
|
|
|
|
enum wxFontEncoding
|
|
|
|
{
|
|
|
|
/// Default system encoding.
|
|
|
|
wxFONTENCODING_SYSTEM = -1, // system default
|
|
|
|
|
|
|
|
/// Default application encoding.
|
|
|
|
wxFONTENCODING_DEFAULT, // current default encoding
|
|
|
|
|
|
|
|
// ISO8859 standard defines a number of single-byte charsets
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_ISO8859_1, //!< West European (Latin1)
|
|
|
|
wxFONTENCODING_ISO8859_2, //!< Central and East European (Latin2)
|
|
|
|
wxFONTENCODING_ISO8859_3, //!< Esperanto (Latin3)
|
|
|
|
wxFONTENCODING_ISO8859_4, //!< Baltic (old) (Latin4)
|
|
|
|
wxFONTENCODING_ISO8859_5, //!< Cyrillic
|
|
|
|
wxFONTENCODING_ISO8859_6, //!< Arabic
|
|
|
|
wxFONTENCODING_ISO8859_7, //!< Greek
|
|
|
|
wxFONTENCODING_ISO8859_8, //!< Hebrew
|
|
|
|
wxFONTENCODING_ISO8859_9, //!< Turkish (Latin5)
|
|
|
|
wxFONTENCODING_ISO8859_10, //!< Variation of Latin4 (Latin6)
|
|
|
|
wxFONTENCODING_ISO8859_11, //!< Thai
|
|
|
|
wxFONTENCODING_ISO8859_12, //!< doesn't exist currently, but put it
|
|
|
|
//!< here anyhow to make all ISO8859
|
|
|
|
//!< consecutive numbers
|
|
|
|
wxFONTENCODING_ISO8859_13, //!< Baltic (Latin7)
|
|
|
|
wxFONTENCODING_ISO8859_14, //!< Latin8
|
|
|
|
wxFONTENCODING_ISO8859_15, //!< Latin9 (a.k.a. Latin0, includes euro)
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTENCODING_ISO8859_MAX,
|
|
|
|
|
|
|
|
// Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_KOI8, //!< KOI8 Russian
|
|
|
|
wxFONTENCODING_KOI8_U, //!< KOI8 Ukrainian
|
|
|
|
wxFONTENCODING_ALTERNATIVE, //!< same as MS-DOS CP866
|
|
|
|
wxFONTENCODING_BULGARIAN, //!< used under Linux in Bulgaria
|
2008-09-25 15:15:28 -04:00
|
|
|
|
|
|
|
// what would we do without Microsoft? They have their own encodings
|
|
|
|
// for DOS
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_CP437, //!< original MS-DOS codepage
|
|
|
|
wxFONTENCODING_CP850, //!< CP437 merged with Latin1
|
|
|
|
wxFONTENCODING_CP852, //!< CP437 merged with Latin2
|
|
|
|
wxFONTENCODING_CP855, //!< another cyrillic encoding
|
|
|
|
wxFONTENCODING_CP866, //!< and another one
|
2008-09-25 15:15:28 -04:00
|
|
|
// and for Windows
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_CP874, //!< WinThai
|
|
|
|
wxFONTENCODING_CP932, //!< Japanese (shift-JIS)
|
|
|
|
wxFONTENCODING_CP936, //!< Chinese simplified (GB)
|
|
|
|
wxFONTENCODING_CP949, //!< Korean (Hangul charset)
|
|
|
|
wxFONTENCODING_CP950, //!< Chinese (traditional - Big5)
|
|
|
|
wxFONTENCODING_CP1250, //!< WinLatin2
|
|
|
|
wxFONTENCODING_CP1251, //!< WinCyrillic
|
|
|
|
wxFONTENCODING_CP1252, //!< WinLatin1
|
|
|
|
wxFONTENCODING_CP1253, //!< WinGreek (8859-7)
|
|
|
|
wxFONTENCODING_CP1254, //!< WinTurkish
|
|
|
|
wxFONTENCODING_CP1255, //!< WinHebrew
|
|
|
|
wxFONTENCODING_CP1256, //!< WinArabic
|
|
|
|
wxFONTENCODING_CP1257, //!< WinBaltic (same as Latin 7)
|
2012-06-01 07:01:46 -04:00
|
|
|
wxFONTENCODING_CP1258, //!< WinVietnamese (since 2.9.4)
|
|
|
|
wxFONTENCODING_CP1361, //!< Johab Korean character set (since 2.9.4)
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTENCODING_CP12_MAX,
|
|
|
|
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_UTF7, //!< UTF-7 Unicode encoding
|
|
|
|
wxFONTENCODING_UTF8, //!< UTF-8 Unicode encoding
|
|
|
|
wxFONTENCODING_EUC_JP, //!< Extended Unix Codepage for Japanese
|
|
|
|
wxFONTENCODING_UTF16BE, //!< UTF-16 Big Endian Unicode encoding
|
|
|
|
wxFONTENCODING_UTF16LE, //!< UTF-16 Little Endian Unicode encoding
|
|
|
|
wxFONTENCODING_UTF32BE, //!< UTF-32 Big Endian Unicode encoding
|
2008-09-25 15:15:28 -04:00
|
|
|
wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
|
|
|
|
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_MACROMAN, //!< the standard mac encodings
|
2008-09-25 15:15:28 -04:00
|
|
|
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,
|
|
|
|
|
|
|
|
// more CJK encodings (for historical reasons some are already declared
|
|
|
|
// above)
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_ISO2022_JP, //!< ISO-2022-JP JIS encoding
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_MAX, //!< highest enumerated encoding value
|
2008-09-25 15:15:28 -04:00
|
|
|
|
|
|
|
wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
|
|
|
|
wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
|
|
|
|
|
|
|
|
// aliases for endian-dependent UTF encodings
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_UTF16, //!< native UTF-16
|
|
|
|
wxFONTENCODING_UTF32, //!< native UTF-32
|
|
|
|
|
|
|
|
/// Alias for the native Unicode encoding on this platform
|
|
|
|
/// (this is used by wxEncodingConverter and wxUTFFile only for now)
|
|
|
|
wxFONTENCODING_UNICODE,
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2009-02-07 10:09:48 -05:00
|
|
|
wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, //!< Simplified Chinese
|
|
|
|
wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, //!< Traditional Chinese
|
2010-07-23 19:32:40 -04:00
|
|
|
wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, //!< Shift JIS
|
2012-06-01 07:01:46 -04:00
|
|
|
wxFONTENCODING_EUC_KR = wxFONTENCODING_CP949, //!< Korean
|
|
|
|
wxFONTENCODING_JOHAB = wxFONTENCODING_CP1361, //!< Korean Johab (since 2.9.4)
|
|
|
|
wxFONTENCODING_VIETNAMESE = wxFONTENCODING_CP1258 //!< Vietnamese (since 2.9.4)
|
2008-09-25 15:15:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
/**
|
2013-04-30 16:07:58 -04:00
|
|
|
@class wxFontInfo
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
|
|
|
|
This class is a helper used for wxFont creation using named parameter
|
|
|
|
idiom: it allows to specify various wxFont attributes using the chained
|
|
|
|
calls to its clearly named methods instead of passing them in the fixed
|
|
|
|
order to wxFont constructors.
|
|
|
|
|
|
|
|
For example, to create an italic font with the given face name and size you
|
|
|
|
could use:
|
|
|
|
@code
|
2013-04-30 16:07:58 -04:00
|
|
|
wxFont font(wxFontInfo(12).FaceName("Helvetica").Italic());
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
@endcode
|
|
|
|
|
|
|
|
Notice that all of the methods of this object return a reference to the
|
|
|
|
object itself, allowing the calls to them to be chained as in the example
|
|
|
|
above.
|
|
|
|
|
|
|
|
All methods taking boolean parameters can be used to turn the specified
|
|
|
|
font attribute on or off and turn it on by default.
|
|
|
|
|
|
|
|
@since 2.9.5
|
|
|
|
*/
|
|
|
|
class wxFontInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Default constructor uses the default font size for the current
|
|
|
|
platform.
|
|
|
|
*/
|
|
|
|
wxFontInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor setting the font size in points to use.
|
|
|
|
|
|
|
|
@see wxFont::SetPointSize()
|
|
|
|
*/
|
|
|
|
explicit wxFontInfo(int pointSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor setting the font size in pixels to use.
|
|
|
|
|
|
|
|
@see wxFont::SetPixelSize()
|
|
|
|
*/
|
|
|
|
explicit wxFontInfo(const wxSize& pixelSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the font family.
|
|
|
|
|
|
|
|
The family is a generic portable way of referring to fonts without
|
|
|
|
specifying a precise face name. This parameter must be one of the
|
|
|
|
::wxFontFamily enumeration values.
|
|
|
|
|
|
|
|
If the FaceName() is used, then it overrides the font family.
|
|
|
|
|
|
|
|
@see wxFont::SetFamily()
|
|
|
|
*/
|
|
|
|
wxFontInfo& Family(wxFontFamily family);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the font face name to use.
|
|
|
|
|
|
|
|
Face names are not portable, so prefer to use Family() in portable
|
|
|
|
code.
|
|
|
|
|
|
|
|
@see wxFont::SetFaceName()
|
|
|
|
*/
|
|
|
|
wxFontInfo& FaceName(const wxString& faceName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Use a bold version of the font.
|
|
|
|
|
|
|
|
@see ::wxFontWeight, wxFont::SetWeight()
|
|
|
|
*/
|
|
|
|
wxFontInfo& Bold(bool bold = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Use a lighter version of the font.
|
|
|
|
|
|
|
|
@see ::wxFontWeight, wxFont::SetWeight()
|
|
|
|
*/
|
|
|
|
wxFontInfo& Light(bool light = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Use an italic version of the font.
|
|
|
|
|
|
|
|
@see ::wxFontStyle, wxFont::SetStyle()
|
|
|
|
*/
|
|
|
|
wxFontInfo& Italic(bool italic = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Use a slanted version of the font.
|
|
|
|
|
|
|
|
@see ::wxFontStyle, wxFont::SetStyle()
|
|
|
|
*/
|
|
|
|
wxFontInfo& Slant(bool slant = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set anti-aliasing flag.
|
|
|
|
|
|
|
|
Force the use of anti-aliasing on or off.
|
|
|
|
|
|
|
|
Currently this is not implemented, i.e. using this method doesn't do
|
|
|
|
anything.
|
|
|
|
*/
|
|
|
|
wxFontInfo& AntiAliased(bool antiAliased = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Use an underlined version of the font.
|
|
|
|
*/
|
|
|
|
wxFontInfo& Underlined(bool underlined = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Use a strike-through version of the font.
|
|
|
|
|
|
|
|
Currently this is only implemented in wxMSW and wxGTK.
|
|
|
|
*/
|
|
|
|
wxFontInfo& Strikethrough(bool strikethrough = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the font encoding to use.
|
|
|
|
|
|
|
|
This is mostly unneeded in Unicode builds of wxWidgets.
|
|
|
|
|
|
|
|
@see ::wxFontEncoding, wxFont::SetEncoding()
|
|
|
|
*/
|
|
|
|
wxFontInfo& Encoding(wxFontEncoding encoding);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set all the font attributes at once.
|
|
|
|
|
|
|
|
See ::wxFontFlag for the various flags that can be used.
|
|
|
|
*/
|
|
|
|
wxFontInfo& AllFlags(int flags);
|
|
|
|
};
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxFont
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
A font is an object which determines the appearance of text.
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
Fonts are used for drawing text to a device context, and setting the appearance
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
of a window's text, see wxDC::SetFont() and wxWindow::SetFont().
|
|
|
|
|
|
|
|
The easiest way to create a custom font is to use wxFontInfo object to
|
|
|
|
specify the font attributes and then use wxFont::wxFont(const wxFontInfo&)
|
|
|
|
constructor. Alternatively, you could start with one of the pre-defined
|
|
|
|
fonts or use wxWindow::GetFont() and modify the font, e.g. by increasing
|
|
|
|
its size using MakeLarger() or changing its weight using MakeBold().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
This class uses @ref overview_refcount "reference counting and copy-on-write"
|
2008-03-08 08:52:38 -05:00
|
|
|
internally so that assignments between two instances of this class are very
|
|
|
|
cheap. You can therefore use actual objects instead of pointers without
|
|
|
|
efficiency problems. If an instance of this class is changed it will create
|
|
|
|
its own data internally so that other instances, which previously shared the
|
|
|
|
data using the reference counting, are not affected.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
You can retrieve the current system font settings with wxSystemSettings.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@stdobjects
|
2008-04-06 11:28:55 -04:00
|
|
|
::wxNullFont, ::wxNORMAL_FONT, ::wxSMALL_FONT, ::wxITALIC_FONT, ::wxSWISS_FONT
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
@see @ref overview_font, wxDC::SetFont, wxDC::DrawText,
|
|
|
|
wxDC::GetTextExtent, wxFontDialog, wxSystemSettings
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFont : public wxGDIObject
|
|
|
|
{
|
|
|
|
public:
|
2008-08-30 19:58:45 -04:00
|
|
|
/**
|
2008-09-25 15:15:28 -04:00
|
|
|
Default ctor.
|
2008-08-30 19:58:45 -04:00
|
|
|
*/
|
|
|
|
wxFont();
|
|
|
|
|
|
|
|
/**
|
2008-09-25 15:15:28 -04:00
|
|
|
Copy constructor, uses @ref overview_refcount "reference counting".
|
2008-08-30 19:58:45 -04:00
|
|
|
*/
|
|
|
|
wxFont(const wxFont& font);
|
|
|
|
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
/**
|
|
|
|
Creates a font object using the specified font description.
|
|
|
|
|
|
|
|
This is the preferred way to create font objects as using this ctor
|
|
|
|
results in more readable code and it is also extensible, e.g. it could
|
|
|
|
continue to be used if support for more font attributes is added in the
|
|
|
|
future. For example, this constructor provides the only way of creating
|
|
|
|
fonts with strike-through style.
|
|
|
|
|
|
|
|
Example of creating a font using this ctor:
|
|
|
|
@code
|
|
|
|
wxFont font(wxFontInfo(10).Bold().Underlined());
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
@since 2.9.5
|
|
|
|
*/
|
|
|
|
wxFont(const wxFontInfo& font);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2012-01-23 06:28:21 -05:00
|
|
|
Creates a font object with the specified attributes and size in points.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
Notice that the use of this constructor is often more verbose and less
|
|
|
|
readable than the use of constructor from wxFontInfo, e.g. the example
|
|
|
|
in that constructor documentation would need to be written as
|
|
|
|
@code
|
|
|
|
wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
|
|
|
|
wxFONTWEIGHT_BOLD, true);
|
|
|
|
@endcode
|
|
|
|
which is longer and less clear.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pointSize
|
2009-03-15 12:28:33 -04:00
|
|
|
Size in points. See SetPointSize() for more info.
|
2008-08-30 19:58:45 -04:00
|
|
|
@param family
|
2009-04-12 18:53:26 -04:00
|
|
|
The font family: a generic portable way of referring to fonts without specifying a
|
|
|
|
facename. This parameter must be one of the ::wxFontFamily enumeration values.
|
|
|
|
If the @a faceName argument is provided, then it overrides the font family.
|
2008-08-30 19:58:45 -04:00
|
|
|
@param style
|
2009-03-15 12:28:33 -04:00
|
|
|
One of @c wxFONTSTYLE_NORMAL, @c wxFONTSTYLE_SLANT and @c wxFONTSTYLE_ITALIC.
|
2008-08-30 19:58:45 -04:00
|
|
|
@param weight
|
2009-06-12 16:11:21 -04:00
|
|
|
Font weight, sometimes also referred to as font boldness.
|
2009-03-15 12:28:33 -04:00
|
|
|
One of the ::wxFontWeight enumeration values.
|
2008-08-30 19:58:45 -04:00
|
|
|
@param underline
|
2008-09-25 15:15:28 -04:00
|
|
|
The value can be @true or @false.
|
|
|
|
At present this has an effect on Windows and Motif 2.x only.
|
2008-08-30 19:58:45 -04:00
|
|
|
@param faceName
|
2009-04-12 18:53:26 -04:00
|
|
|
An optional string specifying the face name to be used.
|
|
|
|
If it is an empty string, a default face name will be chosen based on the family.
|
2008-08-30 19:58:45 -04:00
|
|
|
@param encoding
|
2008-09-25 15:15:28 -04:00
|
|
|
An encoding which may be one of the enumeration values of ::wxFontEncoding.
|
|
|
|
Briefly these can be summed up as:
|
|
|
|
<TABLE>
|
2009-03-15 12:28:33 -04:00
|
|
|
<TR><TD>@c wxFONTENCODING_SYSTEM</TD><TD>Default system encoding.</TD></TR>
|
|
|
|
<TR><TD>@c wxFONTENCODING_DEFAULT</TD><TD>
|
2009-03-18 11:30:06 -04:00
|
|
|
Default application encoding: this is the encoding set by calls to
|
2009-06-12 16:11:21 -04:00
|
|
|
SetDefaultEncoding() and which may be set to, say, KOI8 to create all
|
|
|
|
fonts by default with KOI8 encoding. Initially, the default application
|
2009-03-18 11:30:06 -04:00
|
|
|
encoding is the same as default system encoding.</TD></TR>
|
2009-03-15 12:28:33 -04:00
|
|
|
<TR><TD>@c wxFONTENCODING_ISO8859_1...15</TD><TD>ISO8859 encodings.</TD></TR>
|
|
|
|
<TR><TD>@c wxFONTENCODING_KOI8</TD><TD>The standard Russian encoding for Internet.</TD></TR>
|
|
|
|
<TR><TD>@c wxFONTENCODING_CP1250...1252</TD><TD>Windows encodings similar to ISO8859 (but not identical).</TD></TR>
|
2008-09-25 15:15:28 -04:00
|
|
|
</TABLE>
|
2008-08-30 19:58:45 -04:00
|
|
|
If the specified encoding isn't available, no font is created
|
2009-03-18 11:30:06 -04:00
|
|
|
(see also @ref overview_fontencoding).
|
2008-08-30 19:58:45 -04:00
|
|
|
|
|
|
|
@remarks If the desired font does not exist, the closest match will be
|
2008-09-25 15:15:28 -04:00
|
|
|
chosen. Under Windows, only scalable TrueType fonts are used.
|
2008-08-30 19:58:45 -04:00
|
|
|
*/
|
2009-01-10 18:44:44 -05:00
|
|
|
wxFont(int pointSize, wxFontFamily family, wxFontStyle style,
|
2008-08-30 19:58:45 -04:00
|
|
|
wxFontWeight weight,
|
2008-11-13 16:32:53 -05:00
|
|
|
bool underline = false,
|
2009-01-10 13:31:45 -05:00
|
|
|
const wxString& faceName = wxEmptyString,
|
2008-08-30 19:58:45 -04:00
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2008-08-30 19:58:45 -04:00
|
|
|
/**
|
2012-01-23 06:28:21 -05:00
|
|
|
Creates a font object with the specified attributes and size in pixels.
|
2008-08-30 19:58:45 -04:00
|
|
|
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
Notice that the use of this constructor is often more verbose and less
|
|
|
|
readable than the use of constructor from wxFontInfo, consider using
|
|
|
|
that constructor instead.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pixelSize
|
2009-03-15 12:28:33 -04:00
|
|
|
Size in pixels. See SetPixelSize() for more info.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param family
|
2009-04-12 18:53:26 -04:00
|
|
|
The font family: a generic portable way of referring to fonts without specifying a
|
|
|
|
facename. This parameter must be one of the ::wxFontFamily enumeration values.
|
|
|
|
If the @a faceName argument is provided, then it overrides the font family.
|
2008-03-09 08:33:59 -04:00
|
|
|
@param style
|
2009-03-15 12:28:33 -04:00
|
|
|
One of @c wxFONTSTYLE_NORMAL, @c wxFONTSTYLE_SLANT and @c wxFONTSTYLE_ITALIC.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param weight
|
2008-09-25 15:15:28 -04:00
|
|
|
Font weight, sometimes also referred to as font boldness.
|
|
|
|
One of the ::wxFontWeight enumeration values.
|
2008-03-09 08:33:59 -04:00
|
|
|
@param underline
|
2008-09-25 15:15:28 -04:00
|
|
|
The value can be @true or @false.
|
|
|
|
At present this has an effect on Windows and Motif 2.x only.
|
2008-03-09 08:33:59 -04:00
|
|
|
@param faceName
|
2009-04-12 18:53:26 -04:00
|
|
|
An optional string specifying the face name to be used.
|
|
|
|
If it is an empty string, a default face name will be chosen based on the family.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param encoding
|
2008-09-25 15:15:28 -04:00
|
|
|
An encoding which may be one of the enumeration values of ::wxFontEncoding.
|
|
|
|
Briefly these can be summed up as:
|
|
|
|
<TABLE>
|
2009-03-15 12:28:33 -04:00
|
|
|
<TR><TD>@c wxFONTENCODING_SYSTEM</TD><TD>Default system encoding.</TD></TR>
|
|
|
|
<TR><TD>@c wxFONTENCODING_DEFAULT</TD><TD>
|
2009-03-18 11:30:06 -04:00
|
|
|
Default application encoding: this is the encoding set by calls to
|
2009-06-12 16:11:21 -04:00
|
|
|
SetDefaultEncoding() and which may be set to, say, KOI8 to create all
|
|
|
|
fonts by default with KOI8 encoding. Initially, the default application
|
2009-03-18 11:30:06 -04:00
|
|
|
encoding is the same as default system encoding.</TD></TR>
|
2009-03-15 12:28:33 -04:00
|
|
|
<TR><TD>@c wxFONTENCODING_ISO8859_1...15</TD><TD>ISO8859 encodings.</TD></TR>
|
|
|
|
<TR><TD>@c wxFONTENCODING_KOI8</TD><TD>The standard Russian encoding for Internet.</TD></TR>
|
|
|
|
<TR><TD>@c wxFONTENCODING_CP1250...1252</TD><TD>Windows encodings similar to ISO8859 (but not identical).</TD></TR>
|
2008-09-25 15:15:28 -04:00
|
|
|
</TABLE>
|
2008-03-09 08:33:59 -04:00
|
|
|
If the specified encoding isn't available, no font is created
|
2009-03-18 11:30:06 -04:00
|
|
|
(see also @ref overview_fontencoding).
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks If the desired font does not exist, the closest match will be
|
2008-09-25 15:15:28 -04:00
|
|
|
chosen. Under Windows, only scalable TrueType fonts are used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxFont(const wxSize& pixelSize, wxFontFamily family,
|
2009-01-10 18:44:44 -05:00
|
|
|
wxFontStyle style, wxFontWeight weight,
|
2008-11-13 16:32:53 -05:00
|
|
|
bool underline = false,
|
2009-01-10 13:31:45 -05:00
|
|
|
const wxString& faceName = wxEmptyString,
|
2008-03-08 09:43:31 -05:00
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-04-07 06:41:30 -04:00
|
|
|
/**
|
|
|
|
Constructor from font description string.
|
|
|
|
|
2009-04-12 18:53:26 -04:00
|
|
|
This constructor uses SetNativeFontInfo() to initialize the font.
|
|
|
|
If @a fontdesc is invalid the font remains uninitialized, i.e. its IsOk() method
|
2009-04-07 06:41:30 -04:00
|
|
|
will return @false.
|
|
|
|
*/
|
2011-10-08 21:28:20 -04:00
|
|
|
wxFont(const wxString& nativeInfoString);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Construct font from a native font info structure.
|
|
|
|
*/
|
|
|
|
wxFont(const wxNativeFontInfo& nativeInfo);
|
2009-04-07 06:41:30 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Destructor.
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2008-09-25 16:00:31 -04:00
|
|
|
See @ref overview_refcount_destruct "reference-counted object destruction"
|
2008-09-25 15:15:28 -04:00
|
|
|
for more info.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks Although all remaining fonts are deleted when the application
|
2008-03-09 08:33:59 -04:00
|
|
|
exits, the application should try to clean up all fonts
|
|
|
|
itself. This is because wxWidgets cannot know if a
|
|
|
|
pointer to the font object is stored in an application
|
|
|
|
data structure, and there is a risk of double deletion.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxFont();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-04-26 10:55:07 -04:00
|
|
|
@name Getters
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-04-26 10:55:07 -04:00
|
|
|
//@{
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2014-03-11 16:48:20 -04:00
|
|
|
/**
|
|
|
|
Returns a font with the same face/size as the given one but with normal
|
|
|
|
weight and style and not underlined nor stricken through.
|
|
|
|
|
|
|
|
@since 3.1.0
|
|
|
|
*/
|
|
|
|
wxFont GetBaseFont() const;
|
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
/**
|
|
|
|
Returns the encoding of this font.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
Note that under wxGTK the returned value is always @c wxFONTENCODING_UTF8.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
@see SetEncoding()
|
|
|
|
*/
|
|
|
|
virtual wxFontEncoding GetEncoding() const;
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-04-12 18:53:26 -04:00
|
|
|
Returns the face name associated with the font, or the empty string if
|
|
|
|
there is no face information.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetFaceName()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetFaceName() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-09-29 09:46:09 -04:00
|
|
|
Gets the font family if possible.
|
|
|
|
|
2009-04-12 18:53:26 -04:00
|
|
|
As described in ::wxFontFamily docs the returned value acts as a rough,
|
|
|
|
basic classification of the main font properties (look, spacing).
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-12 18:53:26 -04:00
|
|
|
If the current font face name is not recognized by wxFont or by the
|
2010-09-29 09:46:09 -04:00
|
|
|
underlying system, @c wxFONTFAMILY_DEFAULT is returned.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2010-09-29 09:46:09 -04:00
|
|
|
Note that currently this function is not very precise and so not
|
|
|
|
particularly useful. Font families mostly make sense only for font
|
|
|
|
creation, see SetFamily().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetFamily()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-08 10:25:07 -05:00
|
|
|
virtual wxFontFamily GetFamily() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the platform-dependent string completely describing this font.
|
2009-11-25 21:34:01 -05:00
|
|
|
|
|
|
|
Returned string is always non-empty unless the font is invalid (in
|
|
|
|
which case an assert is triggered).
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Note that the returned string is not meant to be shown or edited by the user: a
|
2008-09-25 15:15:28 -04:00
|
|
|
typical use of this function is for serializing in string-form a wxFont object.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-03-25 08:44:15 -04:00
|
|
|
@see SetNativeFontInfo(), GetNativeFontInfoUserDesc()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetNativeFontInfoDesc() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-09-25 15:15:28 -04:00
|
|
|
Returns a user-friendly string for this font object.
|
2009-11-25 21:34:01 -05:00
|
|
|
|
|
|
|
Returned string is always non-empty unless the font is invalid (in
|
|
|
|
which case an assert is triggered).
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-03-25 08:44:15 -04:00
|
|
|
The string does not encode all wxFont infos under all platforms;
|
|
|
|
e.g. under wxMSW the font family is not present in the returned string.
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Some examples of the formats of returned strings (which are platform-dependent)
|
|
|
|
are in SetNativeFontInfoUserDesc().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-03-25 08:44:15 -04:00
|
|
|
@see SetNativeFontInfoUserDesc(), GetNativeFontInfoDesc()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
wxString GetNativeFontInfoUserDesc() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2011-10-08 21:28:20 -04:00
|
|
|
const wxNativeFontInfo *GetNativeFontInfo() const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Gets the point size.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetPointSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetPointSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2009-03-15 12:28:33 -04:00
|
|
|
Gets the pixel size.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-03-15 12:28:33 -04:00
|
|
|
Note that under wxMSW if you passed to SetPixelSize() (or to the ctor)
|
|
|
|
a wxSize object with a null width value, you'll get a null width in
|
|
|
|
the returned object.
|
|
|
|
|
|
|
|
@see SetPixelSize()
|
|
|
|
*/
|
|
|
|
virtual wxSize GetPixelSize() const;
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-03-15 12:28:33 -04:00
|
|
|
/**
|
|
|
|
Gets the font style. See ::wxFontStyle for a list of valid styles.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetStyle()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-08 10:25:07 -05:00
|
|
|
virtual wxFontStyle GetStyle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the font is underlined, @false otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetUnderlined()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool GetUnderlined() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2012-01-23 06:28:28 -05:00
|
|
|
/**
|
|
|
|
Returns @true if the font is stricken-through, @false otherwise.
|
|
|
|
|
|
|
|
@see SetStrikethrough()
|
|
|
|
|
|
|
|
@since 2.9.4
|
|
|
|
*/
|
|
|
|
virtual bool GetStrikethrough() const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-03-15 12:28:33 -04:00
|
|
|
Gets the font weight. See ::wxFontWeight for a list of valid weight identifiers.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetWeight()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-08 10:25:07 -05:00
|
|
|
virtual wxFontWeight GetWeight() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the font is a fixed width (or monospaced) font,
|
|
|
|
@false if it is a proportional one or font is invalid.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-12 18:53:26 -04:00
|
|
|
Note that this function under some platforms is different than just testing
|
|
|
|
for the font family being equal to @c wxFONTFAMILY_TELETYPE because native
|
|
|
|
platform-specific functions are used for the check (resulting in a more
|
|
|
|
accurate return value).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsFixedWidth() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if this object is a valid font, @false otherwise.
|
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
virtual bool IsOk() const;
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@name Similar fonts creation
|
|
|
|
|
2009-06-17 17:27:37 -04:00
|
|
|
The functions in this section either modify the font in place or create
|
|
|
|
a new font similar to the given one but with its weight, style or size
|
|
|
|
changed.
|
2009-06-12 16:11:21 -04:00
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
|
|
|
/**
|
2010-05-21 09:17:36 -04:00
|
|
|
Returns a bold version of this font.
|
2009-06-17 17:27:37 -04:00
|
|
|
|
|
|
|
@see MakeBold()
|
|
|
|
|
|
|
|
@since 2.9.1
|
2009-06-12 16:11:21 -04:00
|
|
|
*/
|
2009-06-17 17:27:37 -04:00
|
|
|
wxFont Bold() const;
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
/**
|
2010-05-21 09:17:36 -04:00
|
|
|
Returns an italic version of this font.
|
2009-06-17 17:27:37 -04:00
|
|
|
|
|
|
|
@see MakeItalic()
|
|
|
|
|
|
|
|
@since 2.9.1
|
2009-06-12 16:11:21 -04:00
|
|
|
*/
|
2009-06-17 17:27:37 -04:00
|
|
|
wxFont Italic() const;
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
/**
|
2010-05-21 09:17:36 -04:00
|
|
|
Returns a larger version of this font.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2010-05-21 09:17:36 -04:00
|
|
|
The font size is multiplied by @c 1.2, the factor of @c 1.2 being
|
|
|
|
inspired by the W3C CSS specification.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2010-05-21 09:17:36 -04:00
|
|
|
@see MakeLarger(), Smaller(), Scaled()
|
2009-06-17 17:27:37 -04:00
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxFont Larger() const;
|
|
|
|
|
2010-05-21 09:17:36 -04:00
|
|
|
/**
|
|
|
|
Returns a smaller version of this font.
|
|
|
|
|
|
|
|
The font size is divided by @c 1.2, the factor of @c 1.2 being
|
|
|
|
inspired by the W3C CSS specification.
|
|
|
|
|
|
|
|
@see MakeSmaller(), Larger(), Scaled()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxFont Smaller() const;
|
|
|
|
|
2011-02-27 07:46:59 -05:00
|
|
|
/**
|
|
|
|
Returns underlined version of this font.
|
|
|
|
|
|
|
|
@see MakeUnderlined()
|
|
|
|
|
|
|
|
@since 2.9.2
|
|
|
|
*/
|
|
|
|
wxFont Underlined() const;
|
|
|
|
|
2012-01-23 06:28:28 -05:00
|
|
|
/**
|
|
|
|
Returns stricken-through version of this font.
|
|
|
|
|
|
|
|
Currently stricken-through fonts are only supported in wxMSW and wxGTK.
|
|
|
|
|
|
|
|
@see MakeStrikethrough()
|
|
|
|
|
|
|
|
@since 2.9.4
|
|
|
|
*/
|
|
|
|
wxFont Strikethrough() const;
|
|
|
|
|
2009-06-17 17:27:37 -04:00
|
|
|
/**
|
|
|
|
Changes this font to be bold.
|
|
|
|
|
|
|
|
@see Bold()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxFont& MakeBold();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Changes this font to be italic.
|
|
|
|
|
|
|
|
@see Italic()
|
|
|
|
|
|
|
|
@since 2.9.1
|
2009-06-12 16:11:21 -04:00
|
|
|
*/
|
2009-06-17 17:27:37 -04:00
|
|
|
wxFont& MakeItalic();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Changes this font to be larger.
|
|
|
|
|
2010-05-21 09:17:36 -04:00
|
|
|
The font size is multiplied by @c 1.2, the factor of @c 1.2 being
|
|
|
|
inspired by the W3C CSS specification.
|
2009-06-17 17:27:37 -04:00
|
|
|
|
|
|
|
@see Larger(), MakeSmaller(), Scale()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxFont& MakeLarger();
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
/**
|
2010-05-21 09:17:36 -04:00
|
|
|
Changes this font to be smaller.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2010-05-21 09:17:36 -04:00
|
|
|
The font size is divided by @c 1.2, the factor of @c 1.2 being
|
|
|
|
inspired by the W3C CSS specification.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2010-05-21 09:17:36 -04:00
|
|
|
@see Smaller(), MakeLarger(), Scale()
|
2009-06-17 17:27:37 -04:00
|
|
|
|
|
|
|
@since 2.9.1
|
2009-06-12 16:11:21 -04:00
|
|
|
*/
|
2009-06-17 17:27:37 -04:00
|
|
|
wxFont& MakeSmaller();
|
|
|
|
|
2011-02-27 07:46:59 -05:00
|
|
|
/**
|
|
|
|
Changes this font to be underlined.
|
|
|
|
|
|
|
|
@see Underlined()
|
|
|
|
|
|
|
|
@since 2.9.2
|
|
|
|
*/
|
|
|
|
wxFont& MakeUnderlined();
|
|
|
|
|
2012-01-23 06:28:28 -05:00
|
|
|
/**
|
|
|
|
Changes this font to be stricken-through.
|
|
|
|
|
|
|
|
Currently stricken-through fonts are only supported in wxMSW and wxGTK.
|
|
|
|
|
|
|
|
@see Strikethrough()
|
|
|
|
|
|
|
|
@since 2.9.4
|
|
|
|
*/
|
|
|
|
wxFont& MakeStrikethrough();
|
|
|
|
|
2009-06-17 17:27:37 -04:00
|
|
|
/**
|
|
|
|
Changes the size of this font.
|
|
|
|
|
|
|
|
The font size is multiplied by the given factor (which may be less than
|
|
|
|
1 to create a smaller version of the font).
|
|
|
|
|
|
|
|
@see Scaled(), MakeLarger(), MakeSmaller()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxFont& Scale(float x);
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
/**
|
2010-05-21 09:17:36 -04:00
|
|
|
Returns a scaled version of this font.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
The font size is multiplied by the given factor (which may be less than
|
|
|
|
1 to create a smaller version of the font).
|
2009-06-17 17:27:37 -04:00
|
|
|
|
|
|
|
@see Scale(), Larger(), Smaller()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxFont Scaled(float x) const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-04-26 10:55:07 -04:00
|
|
|
@name Setters
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-26 10:55:07 -04:00
|
|
|
These functions internally recreate the native font object with the new
|
|
|
|
specified property.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-04-26 10:55:07 -04:00
|
|
|
//@{
|
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
/**
|
|
|
|
Sets the encoding for this font.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
Note that under wxGTK this function has no effect (because the underlying
|
|
|
|
Pango library always uses @c wxFONTENCODING_UTF8).
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-14 19:18:50 -04:00
|
|
|
@see GetEncoding()
|
|
|
|
*/
|
|
|
|
virtual void SetEncoding(wxFontEncoding encoding);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the facename for the font.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param faceName
|
2008-03-09 08:33:59 -04:00
|
|
|
A valid facename, which should be on the end-user's system.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks To avoid portability problems, don't rely on a specific face,
|
2009-04-26 11:01:28 -04:00
|
|
|
but specify the font family instead (see ::wxFontFamily and SetFamily()).
|
|
|
|
|
|
|
|
@return @true if the given face name exists; if the face name doesn't exist
|
2009-06-12 16:11:21 -04:00
|
|
|
in the user's system then the font is invalidated (so that IsOk() will
|
2009-04-26 11:01:28 -04:00
|
|
|
return @false) and @false is returned.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetFaceName(), SetFamily()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool SetFaceName(const wxString& faceName);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font family.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-26 10:55:07 -04:00
|
|
|
As described in ::wxFontFamily docs the given @a family value acts as a rough,
|
|
|
|
basic indication of the main font properties (look, spacing).
|
|
|
|
|
|
|
|
Note that changing the font family results in changing the font face name.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param family
|
2008-09-25 15:15:28 -04:00
|
|
|
One of the ::wxFontFamily values.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetFamily(), SetFaceName()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-09 11:46:52 -05:00
|
|
|
virtual void SetFamily(wxFontFamily family);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-09-25 15:15:28 -04:00
|
|
|
Creates the font corresponding to the given native font description string
|
|
|
|
which must have been previously returned by GetNativeFontInfoDesc().
|
|
|
|
|
|
|
|
If the string is invalid, font is unchanged.
|
|
|
|
This function is typically used for de-serializing a wxFont object
|
|
|
|
previously saved in a string-form.
|
|
|
|
|
|
|
|
@return @true if the creation was successful.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetNativeFontInfoUserDesc()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool SetNativeFontInfo(const wxString& info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the font corresponding to the given native font description string and
|
2008-09-25 15:15:28 -04:00
|
|
|
returns @true if the creation was successful.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
Unlike SetNativeFontInfo(), this function accepts strings which are user-friendly.
|
|
|
|
Examples of accepted string formats are:
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
@beginTable
|
|
|
|
@hdr3col{platform, generic syntax, example}
|
2012-09-15 19:17:12 -04:00
|
|
|
@row3col{wxGTK2, <tt>[underlined] [strikethrough] [FACE-NAME] [bold] [oblique|italic] [POINTSIZE]</tt>, Monospace bold 10}
|
2009-03-15 12:28:33 -04:00
|
|
|
@row3col{wxMSW, <tt>[light|bold] [italic] [FACE-NAME] [POINTSIZE] [ENCODING]</tt>, Tahoma 10 WINDOWS-1252}
|
2008-09-25 15:15:28 -04:00
|
|
|
@endTable
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
@todo add an example for wxMac
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
For more detailed information about the allowed syntaxes you can look at the
|
2008-09-25 15:15:28 -04:00
|
|
|
documentation of the native API used for font-rendering
|
2012-09-15 19:17:12 -04:00
|
|
|
(e.g. @c pango_font_description_from_string under GTK, although notice
|
|
|
|
that it doesn't support the "underlined" and "strikethrough" attributes
|
|
|
|
and so those are handled by wxWidgets itself).
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-03-25 08:44:15 -04:00
|
|
|
Note that unlike SetNativeFontInfo(), this function doesn't always restore all
|
|
|
|
attributes of the wxFont object under all platforms; e.g. on wxMSW the font family
|
|
|
|
is not restored (because GetNativeFontInfoUserDesc doesn't return it on wxMSW).
|
|
|
|
If you want to serialize/deserialize a font in string form, you should use
|
|
|
|
GetNativeFontInfoDesc() and SetNativeFontInfo() instead.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetNativeFontInfo()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool SetNativeFontInfoUserDesc(const wxString& info);
|
|
|
|
|
2011-10-08 21:28:20 -04:00
|
|
|
void SetNativeFontInfo(const wxNativeFontInfo& info);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Sets the point size.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
The <em>point size</em> is defined as 1/72 of the Anglo-Saxon inch
|
2009-06-12 16:11:21 -04:00
|
|
|
(25.4 mm): it is approximately 0.0139 inch or 352.8 um.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pointSize
|
2008-03-09 08:33:59 -04:00
|
|
|
Size in points.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetPointSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetPointSize(int pointSize);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-03-15 12:28:33 -04:00
|
|
|
/**
|
|
|
|
Sets the pixel size.
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-03-15 12:28:33 -04:00
|
|
|
The height parameter of @a pixelSize must be positive while the width
|
|
|
|
parameter may also be zero (to indicate that you're not interested in the
|
|
|
|
width of the characters: a suitable width will be chosen for best rendering).
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
This feature (specifying the font pixel size) is directly supported only
|
|
|
|
under wxMSW and wxGTK currently; under other platforms a font with the
|
2009-03-15 12:28:33 -04:00
|
|
|
closest size to the given one is found using binary search (this maybe slower).
|
|
|
|
|
|
|
|
@see GetPixelSize()
|
|
|
|
*/
|
|
|
|
virtual void SetPixelSize(const wxSize& pixelSize);
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Sets the font style.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-09-25 15:15:28 -04:00
|
|
|
One of the ::wxFontStyle enumeration values.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetStyle()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-09 11:46:52 -05:00
|
|
|
virtual void SetStyle(wxFontStyle style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2011-02-27 07:47:05 -05:00
|
|
|
/**
|
|
|
|
Sets the font size using a predefined symbolic size name.
|
|
|
|
|
|
|
|
This function allows to change font size to be (very) large or small
|
|
|
|
compared to the standard font size.
|
|
|
|
|
|
|
|
@see SetSymbolicSizeRelativeTo().
|
|
|
|
|
|
|
|
@since 2.9.2
|
|
|
|
*/
|
|
|
|
void SetSymbolicSize(wxFontSymbolicSize size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font size compared to the base font size.
|
|
|
|
|
|
|
|
This is the same as SetSymbolicSize() except that it uses the given
|
|
|
|
font size as the normal font size instead of the standard font size.
|
|
|
|
|
|
|
|
@since 2.9.2
|
|
|
|
*/
|
|
|
|
void SetSymbolicSizeRelativeTo(wxFontSymbolicSize size, int base);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Sets underlining.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-08-30 19:58:45 -04:00
|
|
|
@param underlined
|
2008-03-09 08:33:59 -04:00
|
|
|
@true to underline, @false otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetUnderlined()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-08 10:25:07 -05:00
|
|
|
virtual void SetUnderlined(bool underlined);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2012-01-23 06:28:28 -05:00
|
|
|
/**
|
|
|
|
Sets strike-through attribute of the font.
|
|
|
|
|
|
|
|
Currently stricken-through fonts are only supported in wxMSW and wxGTK.
|
|
|
|
|
|
|
|
@param strikethrough
|
|
|
|
@true to add strike-through style, @false to remove it.
|
|
|
|
|
|
|
|
@see GetStrikethrough()
|
|
|
|
|
|
|
|
@since 2.9.4
|
|
|
|
*/
|
|
|
|
virtual void SetStrikethrough(bool strikethrough);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Sets the font weight.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param weight
|
2008-09-25 15:15:28 -04:00
|
|
|
One of the ::wxFontWeight values.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetWeight()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-09 11:46:52 -05:00
|
|
|
virtual void SetWeight(wxFontWeight weight);
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-26 10:55:07 -04:00
|
|
|
//@}
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Inequality operator.
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2008-09-25 16:00:31 -04:00
|
|
|
See @ref overview_refcount_equality "reference-counted object comparison" for
|
2008-03-08 08:52:38 -05:00
|
|
|
more info.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
bool operator!=(const wxFont& font) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Equality operator.
|
2008-09-25 15:15:28 -04:00
|
|
|
|
2008-09-25 16:00:31 -04:00
|
|
|
See @ref overview_refcount_equality "reference-counted object comparison" for
|
2008-03-08 08:52:38 -05:00
|
|
|
more info.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
bool operator==(const wxFont& font) const;
|
2008-09-25 15:15:28 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Assignment operator, using @ref overview_refcount "reference counting".
|
|
|
|
*/
|
|
|
|
wxFont& operator =(const wxFont& font);
|
2009-06-12 16:11:21 -04:00
|
|
|
|
|
|
|
|
2009-04-26 10:55:07 -04:00
|
|
|
// statics
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current application's default encoding.
|
|
|
|
|
|
|
|
@see @ref overview_fontencoding, SetDefaultEncoding()
|
|
|
|
*/
|
|
|
|
static wxFontEncoding GetDefaultEncoding();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the default font encoding.
|
|
|
|
|
|
|
|
@see @ref overview_fontencoding, GetDefaultEncoding()
|
|
|
|
*/
|
|
|
|
static void SetDefaultEncoding(wxFontEncoding encoding);
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-04-26 10:55:07 -04:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
This function takes the same parameters as the relative
|
|
|
|
@ref wxFont::wxFont "wxFont constructor" and returns a new font
|
|
|
|
object allocated on the heap.
|
Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable
code, e.g.
wxFont font(12, wxFONTFLAG_DEFAULT,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true,
"DejaVu Sans");
can now be written simply as
wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined());
Remove the ctor from font flags added in r70445 as it's not needed any longer
now that we have this one and adding it resulted in compilation errors in the
existing code which compiled with 2.8 because of ambiguities between that ctor
and wxFont(int size, int family, int style, int weight. bool underlined, ...)
one, e.g.
wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL)
didn't compile any more but it does compile again now.
See #9907.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 06:27:38 -04:00
|
|
|
|
|
|
|
Their use is discouraged, use wxFont constructor from wxFontInfo
|
|
|
|
instead.
|
2009-04-26 10:55:07 -04:00
|
|
|
*/
|
|
|
|
static wxFont* New(int pointSize, wxFontFamily family, wxFontStyle style,
|
|
|
|
wxFontWeight weight,
|
|
|
|
bool underline = false,
|
|
|
|
const wxString& faceName = wxEmptyString,
|
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
|
|
|
static wxFont* New(int pointSize, wxFontFamily family,
|
|
|
|
int flags = wxFONTFLAG_DEFAULT,
|
|
|
|
const wxString& faceName = wxEmptyString,
|
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
|
|
|
static wxFont* New(const wxSize& pixelSize,
|
|
|
|
wxFontFamily family,
|
|
|
|
wxFontStyle style,
|
|
|
|
wxFontWeight weight,
|
|
|
|
bool underline = false,
|
|
|
|
const wxString& faceName = wxEmptyString,
|
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
|
|
|
static wxFont* New(const wxSize& pixelSize,
|
|
|
|
wxFontFamily family,
|
|
|
|
int flags = wxFONTFLAG_DEFAULT,
|
|
|
|
const wxString& faceName = wxEmptyString,
|
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
2011-10-08 21:28:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
static wxFont *New(const wxNativeFontInfo& nativeInfo);
|
|
|
|
static wxFont *New(const wxString& nativeInfoString);
|
|
|
|
|
2009-04-26 10:55:07 -04:00
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-04-06 11:28:55 -04:00
|
|
|
An empty wxFont.
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-03-23 14:24:32 -04:00
|
|
|
wxFont wxNullFont;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-09-25 15:15:28 -04:00
|
|
|
Equivalent to wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).
|
2009-06-12 16:11:21 -04:00
|
|
|
|
2009-03-15 12:28:33 -04:00
|
|
|
@see wxSystemSettings
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2012-02-02 19:24:09 -05:00
|
|
|
wxFont* wxNORMAL_FONT;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2009-03-15 12:28:33 -04:00
|
|
|
A font using the @c wxFONTFAMILY_SWISS family and 2 points smaller than
|
2008-09-25 15:15:28 -04:00
|
|
|
::wxNORMAL_FONT.
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2012-02-02 19:24:09 -05:00
|
|
|
wxFont* wxSMALL_FONT;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2009-03-15 12:28:33 -04:00
|
|
|
A font using the @c wxFONTFAMILY_ROMAN family and @c wxFONTSTYLE_ITALIC style and
|
2008-09-25 15:15:28 -04:00
|
|
|
of the same size of ::wxNORMAL_FONT.
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2012-02-02 19:24:09 -05:00
|
|
|
wxFont* wxITALIC_FONT;
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-09-25 15:15:28 -04:00
|
|
|
A font identic to ::wxNORMAL_FONT except for the family used which is
|
2009-03-15 12:28:33 -04:00
|
|
|
@c wxFONTFAMILY_SWISS.
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2012-02-02 19:24:09 -05:00
|
|
|
wxFont* wxSWISS_FONT;
|
2008-03-23 14:24:32 -04:00
|
|
|
|
|
|
|
|
2008-04-06 11:28:55 -04:00
|
|
|
/**
|
|
|
|
@class wxFontList
|
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
A font list is a list containing all fonts which have been created.
|
|
|
|
There is only one instance of this class: ::wxTheFontList.
|
|
|
|
|
|
|
|
Use this object to search for a previously created font of the desired type
|
|
|
|
and create it if not already found.
|
|
|
|
|
2008-04-06 11:28:55 -04:00
|
|
|
In some windowing systems, the font may be a scarce resource, so it is best to
|
|
|
|
reuse old resources if possible. When an application finishes, all fonts will
|
2008-09-25 15:15:28 -04:00
|
|
|
be deleted and their resources freed, eliminating the possibility of 'memory
|
2008-04-06 11:28:55 -04:00
|
|
|
leaks'.
|
|
|
|
|
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
|
|
|
|
|
|
|
@see wxFont
|
|
|
|
*/
|
2012-11-09 00:02:52 -05:00
|
|
|
class wxFontList
|
2008-04-06 11:28:55 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor. The application should not construct its own font list:
|
2008-09-25 15:15:28 -04:00
|
|
|
use the object pointer ::wxTheFontList.
|
2008-04-06 11:28:55 -04:00
|
|
|
*/
|
|
|
|
wxFontList();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Finds a font of the given specification, or creates one and adds it to the
|
2008-09-25 15:15:28 -04:00
|
|
|
list. See the @ref wxFont "wxFont constructor" for details of the arguments.
|
2008-04-06 11:28:55 -04:00
|
|
|
*/
|
2008-11-09 11:46:52 -05:00
|
|
|
wxFont* FindOrCreateFont(int point_size, wxFontFamily family, wxFontStyle style,
|
|
|
|
wxFontWeight weight, bool underline = false,
|
|
|
|
const wxString& facename = wxEmptyString,
|
2008-04-06 11:28:55 -04:00
|
|
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-25 15:15:28 -04:00
|
|
|
/**
|
|
|
|
The global wxFontList instance.
|
|
|
|
*/
|
|
|
|
wxFontList* wxTheFontList;
|
|
|
|
|
2008-03-23 14:24:32 -04:00
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2009-01-05 15:48:06 -05:00
|
|
|
/** @addtogroup group_funcmacro_misc */
|
2008-03-23 14:24:32 -04:00
|
|
|
//@{
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-23 14:24:32 -04:00
|
|
|
Converts string to a wxFont best represented by the given string. Returns
|
|
|
|
@true on success.
|
|
|
|
|
|
|
|
@see wxToString(const wxFont&)
|
|
|
|
|
|
|
|
@header{wx/font.h}
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-03-23 14:24:32 -04:00
|
|
|
bool wxFromString(const wxString& string, wxFont* font);
|
2008-03-10 11:24:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-03-23 14:24:32 -04:00
|
|
|
Converts the given wxFont into a string.
|
|
|
|
|
|
|
|
@see wxFromString(const wxString&, wxFont*)
|
|
|
|
|
|
|
|
@header{wx/font.h}
|
2008-03-10 11:24:38 -04:00
|
|
|
*/
|
2008-03-23 14:24:32 -04:00
|
|
|
wxString wxToString(const wxFont& font);
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-23 14:24:32 -04:00
|
|
|
//@}
|
2008-03-10 11:24:38 -04:00
|
|
|
|