Class: Wx::Font

Inherits:
GDIObject show all
Defined in:
lib/wx/doc/gen/font.rb,
lib/wx/doc/font.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A font is an object which determines the appearance of text.

Fonts are used for drawing text to a device context, and setting the appearance of a window’s text, see DC#set_font and Window#set_font. The easiest way to create a custom font is to use FontInfo 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 Window#get_font and modify the font, e.g. by increasing its size using #make_larger or changing its weight using #make_bold. This class uses reference counting and copy-on-write 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. You can retrieve the current system font settings with SystemSettings.

Category: Graphics Device Interface (GDI) Predefined objects/pointers: NULL_FONT, NORMAL_FONT, SMALL_FONT, ITALIC_FONT, SWISS_FONT

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GDIObject

#clone, #dup

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::Font #initialize(font) ⇒ Wx::Font #initialize(fontInfo) ⇒ Wx::Font #initialize(pointSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font #initialize(pixelSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font #initialize(nativeInfoString) ⇒ Wx::Font

Returns a new instance of Font.

Overloads:

  • #initializeWx::Font

    Default ctor.

  • #initialize(font) ⇒ Wx::Font

    Copy constructor, uses reference counting.

    Parameters:

  • #initialize(fontInfo) ⇒ Wx::Font

    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:

    font = Wx::Font.new(Wx::FontInfo.new(10).bold().underlined())
    

    Parameters:

  • #initialize(pointSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    Creates a font object with the specified attributes and size in points.

    Notice that the use of this constructor is often more verbose and less readable than using wxFont(const wxFontInfo& font), e.g. the example in that constructor documentation would need to be written as:

    font = Wx::Font.new(10, Wx::FontFamily::FONTFAMILY_DEFAULT, 
                          Wx::FontStyle::FONTSTYLE_NORMAL, 
                          Wx::FontWeight::FONTWEIGHT_BOLD, true)
    
    Remark:

    If the desired font does not exist, the closest match will be chosen. Under Windows, only scalable TrueType fonts are used.

    Parameters:

    • pointSize (Integer)

      Size in points. See #set_point_size for more info. Notice that, for historical reasons, the value 70 here is interpreted at DEFAULT and results in creation of the font with the default size and not of a font with the size of 70pt. If you really need the latter, please use SetPointSize(70). Note that this constructor and the matching Create() method overload are the only places in Wx::Font API handling DEFAULT specially: neither #set_point_size nor the constructor taking Wx::FontInfo handle this value in this way.

    • family (Wx::FontFamily)

      The font family: a generic portable way of referring to fonts without specifying a facename. This parameter must be one of the Wx::FontFamily enumeration values. If the faceName argument is provided, then it overrides the font family.

    • style (Wx::FontStyle)
    • weight (Wx::FontWeight)

      Font weight, sometimes also referred to as font boldness. One of the Wx::FontWeight enumeration values.

    • underline (Boolean) (defaults to: false)

      The value can be true or false. At present this has an effect on Windows and Motif 2.x only.

    • faceName (String) (defaults to: (''))

      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.

    • encoding (Wx::FontEncoding) (defaults to: Wx::FontEncoding::FONTENCODING_DEFAULT)

      An encoding which may be one of the enumeration values of Wx::FontEncoding. If the specified encoding isn’t available, no font is created (see also Font Encodings).

  • #initialize(pixelSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    Creates a font object with the specified attributes and size in pixels.

    Notice that the use of this constructor is often more verbose and less readable than the use of constructor from Wx::FontInfo, consider using that constructor instead.

    Remark:

    If the desired font does not exist, the closest match will be chosen. Under Windows, only scalable TrueType fonts are used.

    Parameters:

    • pixelSize (Array(Integer, Integer), Wx::Size)

      Size in pixels. See #set_pixel_size for more info.

    • family (Wx::FontFamily)

      The font family: a generic portable way of referring to fonts without specifying a facename. This parameter must be one of the Wx::FontFamily enumeration values. If the faceName argument is provided, then it overrides the font family.

    • style (Wx::FontStyle)
    • weight (Wx::FontWeight)

      Font weight, sometimes also referred to as font boldness. One of the Wx::FontWeight enumeration values.

    • underline (Boolean) (defaults to: false)

      The value can be true or false. At present this has an effect on Windows and Motif 2.x only.

    • faceName (String) (defaults to: (''))

      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.

    • encoding (Wx::FontEncoding) (defaults to: Wx::FontEncoding::FONTENCODING_DEFAULT)

      An encoding which may be one of the enumeration values of Wx::FontEncoding. If the specified encoding isn’t available, no font is created (see also Font Encodings).

  • #initialize(nativeInfoString) ⇒ Wx::Font

    Constructor from font description string.

    This constructor uses #set_native_font_info to initialize the font. If fontdesc is invalid the font remains uninitialized, i.e. its #is_ok method will return false.

    Parameters:

    • nativeInfoString (String)


1198
# File 'lib/wx/doc/gen/font.rb', line 1198

def initialize(*args) end

Class Method Details

.add_private_font(filename) ⇒ Boolean

Specify the name of a file containing a TrueType font to be made available to the current application.

This method can be used to allow this application to use the font from the given file even if it is not globally installed on the system. Under macOS this method actually doesn’t do anything other than check for the existence of the file in the “Fonts” subdirectory of the application bundle “Resources” directory. You are responsible for actually making the font file available in this directory and setting ATSApplicationFontsPath to Fonts value in your Info.plist file. See also StandardPaths#get_resources_dir. Under MSW this method must be called before any GraphicsContext objects have been created, otherwise the private font won’t be usable from them. Under Unix this method requires Pango 1.38 or later and will return false and log an error message explaining the problem if this requirement is not satisfied either at compile- or run-time. Currently this method is implemented for all major platforms (subject to having Pango 1.38 or later when running configure under Unix) and Setup::USE_PRIVATE_FONTS is always set to 0 under the other platforms, making this function unavailable at compile-time. true if the font was added and can now be used.

Parameters:

  • filename (String)

Returns:

  • (Boolean)


805
# File 'lib/wx/doc/gen/font.rb', line 805

def self.add_private_font(filename) end

.self.create(pointSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font .self.create(pointSize, family, flags = Wx::FontFlag::FONTFLAG_DEFAULT, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font .self.create(pixelSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font .self.create(pixelSize, family, flags = Wx::FontFlag::FONTFLAG_DEFAULT, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font .self.create(nativeInfoString) ⇒ Wx::Font

Overloads:

  • .self.create(pointSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    This function takes the same parameters as the relative wxFont constructor and returns a new font object allocated on the heap.

    Their use is discouraged, use Wx::Font constructor from Wx::FontInfo instead.

    Parameters:

    Returns:

  • .self.create(pointSize, family, flags = Wx::FontFlag::FONTFLAG_DEFAULT, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    This function takes the same parameters as the relative wxFont constructor and returns a new font object allocated on the heap.

    Their use is discouraged, use Wx::Font constructor from Wx::FontInfo instead.

    Parameters:

    • pointSize (Integer)
    • family (Wx::FontFamily)
    • flags (Integer) (defaults to: Wx::FontFlag::FONTFLAG_DEFAULT)
    • faceName (String) (defaults to: (''))
    • encoding (Wx::FontEncoding) (defaults to: Wx::FontEncoding::FONTENCODING_DEFAULT)

    Returns:

  • .self.create(pixelSize, family, style, weight, underline = false, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    This function takes the same parameters as the relative wxFont constructor and returns a new font object allocated on the heap.

    Their use is discouraged, use Wx::Font constructor from Wx::FontInfo instead.

    Parameters:

    Returns:

  • .self.create(pixelSize, family, flags = Wx::FontFlag::FONTFLAG_DEFAULT, faceName = (''), encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    This function takes the same parameters as the relative wxFont constructor and returns a new font object allocated on the heap.

    Their use is discouraged, use Wx::Font constructor from Wx::FontInfo instead.

    Parameters:

    • pixelSize (Array(Integer, Integer), Wx::Size)
    • family (Wx::FontFamily)
    • flags (Integer) (defaults to: Wx::FontFlag::FONTFLAG_DEFAULT)
    • faceName (String) (defaults to: (''))
    • encoding (Wx::FontEncoding) (defaults to: Wx::FontEncoding::FONTENCODING_DEFAULT)

    Returns:

  • .self.create(nativeInfoString) ⇒ Wx::Font

    This function takes the same parameters as the relative wxFont constructor and returns a new font object allocated on the heap.

    Their use is discouraged, use Wx::Font constructor from Wx::FontInfo instead.

    Parameters:

    • nativeInfoString (String)

    Returns:



1131
# File 'lib/wx/doc/gen/font.rb', line 1131

def self.create(*args) end

.find_or_create_font(point_size, family, style, weight, underline = false, facename = '', encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font .find_or_create_font(font_info) ⇒ Wx::Font

Overloads:

  • .find_or_create_font(point_size, family, style, weight, underline = false, facename = '', encoding = Wx::FontEncoding::FONTENCODING_DEFAULT) ⇒ Wx::Font

    Finds a font of the given specification in the global font list, or creates one and adds it to the list.

    Parameters:

    • point_size (Integer)

      Size in points. See #set_point_size for more info.

    • family (Wx::FontFamily)

      The font family: a generic portable way of referring to fonts without specifying a facename.

    • style (Wx::FontStyle)
    • weight (Wx::FontWeight)

      Font weight, sometimes also referred to as font boldness. One of the Wx::FontWeight enumeration values.

    • underline (Boolean) (defaults to: false)

      The value can be true or false.

    • facename (String) (defaults to: '')

      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.

    • encoding (Wx::FontEncoding) (defaults to: Wx::FontEncoding::FONTENCODING_DEFAULT)

      An encoding which may be one of the enumeration values of Wx::FontEncoding. If the specified encoding isn’t available, no font is created (see also Font Encodings).

    Returns:

    See Also:

  • .find_or_create_font(font_info) ⇒ Wx::Font

    Finds a font of the given specification in the global font list, or creates one and adds it to the list.

    Parameters:

    Returns:



27
# File 'lib/wx/doc/font.rb', line 27

def self.find_or_create_font(*args) end

.get_default_encodingWx::FontEncoding

Returns the current application’s default encoding.



1213
# File 'lib/wx/doc/gen/font.rb', line 1213

def self.get_default_encoding; end

.get_numeric_weight_of(weight) ⇒ Integer

Get the raw weight value corresponding to the given symbolic constant.

For compatibility, this function handles the values NORMAL, LIGHT and BOLD, that have values 90, 91 and 92, specially and converts them to the corresponding Wx::FONTWEIGHT_XXX weight value.

Numeric weight, between 1 and 1000.

Parameters:

Returns:

  • (Integer)


1231
# File 'lib/wx/doc/gen/font.rb', line 1231

def self.get_numeric_weight_of(weight) end

.set_default_encoding(encoding) ⇒ void

This method returns an undefined value.

Sets the default font encoding.

Parameters:

See Also:



1222
# File 'lib/wx/doc/gen/font.rb', line 1222

def self.set_default_encoding(encoding) end

Instance Method Details

#==(font) ⇒ Boolean

Equality operator.

See reference-counted object comparison for more info.

Parameters:

Returns:

  • (Boolean)


1205
# File 'lib/wx/doc/gen/font.rb', line 1205

def ==(font) end

#boldWx::Font

Returns a bold version of this font.

Returns:

See Also:



812
# File 'lib/wx/doc/gen/font.rb', line 812

def bold; end

#get_base_fontWx::Font Also known as: base_font

Returns a font with the same face/size as the given one but with normal weight and style and not underlined nor stricken through.

Returns:



666
# File 'lib/wx/doc/gen/font.rb', line 666

def get_base_font; end

#get_encodingWx::FontEncoding Also known as: encoding

Returns the encoding of this font.

Note that under WXGTK the returned value is always Wx::FontEncoding::FONTENCODING_UTF8.

Returns:

See Also:



674
# File 'lib/wx/doc/gen/font.rb', line 674

def get_encoding; end

#get_face_nameString Also known as: face_name

Returns the face name associated with the font, or the empty string if there is no face information.

Returns:

  • (String)

See Also:



682
# File 'lib/wx/doc/gen/font.rb', line 682

def get_face_name; end

#get_familyWx::FontFamily Also known as: family

Gets the font family if possible.

As described in Wx::FontFamily docs the returned value acts as a rough, basic classification of the main font properties (look, spacing). If the current font face name is not recognized by Wx::Font or by the underlying system, Wx::FontFamily::FONTFAMILY_DEFAULT is returned. Note that currently this function is not very precise and so not particularly useful. Font families mostly make sense only for font creation, see #set_family.

Returns:

See Also:



692
# File 'lib/wx/doc/gen/font.rb', line 692

def get_family; end

#get_fractional_point_sizeFloat Also known as: fractional_point_size

Gets the point size as a floating number.

Returns:

  • (Float)

See Also:

  • SetPointSize(float)


732
# File 'lib/wx/doc/gen/font.rb', line 732

def get_fractional_point_size; end

#get_native_font_info_descString Also known as: native_font_info_desc

Returns the platform-dependent string completely describing this font.

Returned string is always non-empty unless the font is invalid (in which case an assert is triggered). Note that the returned string is not meant to be shown or edited by the user: a typical use of this function is for serializing in string-form a Wx::Font object.



702
# File 'lib/wx/doc/gen/font.rb', line 702

def get_native_font_info_desc; end

#get_native_font_info_user_descString Also known as: native_font_info_user_desc

Returns a user-friendly string for this font object.

Returned string is always non-empty unless the font is invalid (in which case an assert is triggered). The string does not encode all Wx::Font infos under all platforms; e.g. under WXMSW the font family is not present in the returned string. Some examples of the formats of returned strings (which are platform-dependent) are in #set_native_font_info_user_desc.



713
# File 'lib/wx/doc/gen/font.rb', line 713

def get_native_font_info_user_desc; end

#get_numeric_weightInteger Also known as: numeric_weight

Gets the font weight as an integer value.

See Wx::FontWeight for a list of valid weight identifiers and their corresponding integer value.

Returns:

  • (Integer)

See Also:



780
# File 'lib/wx/doc/gen/font.rb', line 780

def get_numeric_weight; end

#get_pixel_sizeWx::Size Also known as: pixel_size

Gets the pixel size.

Note that under WXMSW if you passed to #set_pixel_size (or to the ctor) a Size object with a null width value, you’ll get a null width in the returned object.

Returns:

See Also:



740
# File 'lib/wx/doc/gen/font.rb', line 740

def get_pixel_size; end

#get_point_sizeInteger Also known as: point_size

Gets the point size as an integer number.

This function is kept for compatibility reasons. New code should use #get_fractional_point_size and support fractional point sizes.

Returns:

  • (Integer)

See Also:



724
# File 'lib/wx/doc/gen/font.rb', line 724

def get_point_size; end

#get_strikethroughBoolean

Returns true if the font is stricken-through, false otherwise.

Returns:

  • (Boolean)

See Also:



763
# File 'lib/wx/doc/gen/font.rb', line 763

def get_strikethrough; end

#get_styleWx::FontStyle Also known as: style

Gets the font style.

See Wx::FontStyle for a list of valid styles.

Returns:

See Also:



748
# File 'lib/wx/doc/gen/font.rb', line 748

def get_style; end

#get_underlinedBoolean

Returns true if the font is underlined, false otherwise.

Returns:

  • (Boolean)

See Also:



756
# File 'lib/wx/doc/gen/font.rb', line 756

def get_underlined; end

#get_weightWx::FontWeight Also known as: weight

Gets the font weight.

See Wx::FontWeight for a list of valid weight identifiers.

Returns:

See Also:



770
# File 'lib/wx/doc/gen/font.rb', line 770

def get_weight; end

#is_fixed_widthBoolean Also known as: fixed_width?

Returns true if the font is a fixed width (or monospaced) font, false if it is a proportional one or font is invalid.

Note that this function under some platforms is different from just testing for the font family being equal to Wx::FontFamily::FONTFAMILY_TELETYPE because native platform-specific functions are used for the check (resulting in a more accurate return value).

Returns:

  • (Boolean)


787
# File 'lib/wx/doc/gen/font.rb', line 787

def is_fixed_width; end

#is_okBoolean Also known as: ok?

Returns true if this object is a valid font, false otherwise.

Returns:

  • (Boolean)


792
# File 'lib/wx/doc/gen/font.rb', line 792

def is_ok; end

#italicWx::Font

Returns an italic version of this font.

Returns:

See Also:



819
# File 'lib/wx/doc/gen/font.rb', line 819

def italic; end

#largerWx::Font

Returns a larger version of this font.

The font size is multiplied by 1.2, the factor of 1.2 being inspired by the W3C CSS specification.

Returns:

See Also:



828
# File 'lib/wx/doc/gen/font.rb', line 828

def larger; end

#make_boldWx::Font

Changes this font to be bold.

Returns:

See Also:



858
# File 'lib/wx/doc/gen/font.rb', line 858

def make_bold; end

#make_italicWx::Font

Changes this font to be italic.

Returns:

See Also:



865
# File 'lib/wx/doc/gen/font.rb', line 865

def make_italic; end

#make_largerWx::Font

Changes this font to be larger.

The font size is multiplied by 1.2, the factor of 1.2 being inspired by the W3C CSS specification.

Returns:

See Also:



874
# File 'lib/wx/doc/gen/font.rb', line 874

def make_larger; end

#make_smallerWx::Font

Changes this font to be smaller.

The font size is divided by 1.2, the factor of 1.2 being inspired by the W3C CSS specification.

Returns:

See Also:



883
# File 'lib/wx/doc/gen/font.rb', line 883

def make_smaller; end

#make_strikethroughWx::Font

Changes this font to be stricken-through.

Currently stricken-through fonts are only supported in WXMSW, WXGTK, and WXOSX.

Returns:

See Also:



897
# File 'lib/wx/doc/gen/font.rb', line 897

def make_strikethrough; end

#make_underlinedWx::Font

Changes this font to be underlined.

Returns:

See Also:



890
# File 'lib/wx/doc/gen/font.rb', line 890

def make_underlined; end

#scale(x) ⇒ Wx::Font

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

Parameters:

  • x (Float)

Returns:

See Also:



907
# File 'lib/wx/doc/gen/font.rb', line 907

def scale(x) end

#scaled(x) ⇒ Wx::Font

Returns a scaled version 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).

Parameters:

  • x (Float)

Returns:

See Also:



917
# File 'lib/wx/doc/gen/font.rb', line 917

def scaled(x) end

#set_encoding(encoding) ⇒ void Also known as: encoding=

This method returns an undefined value.

Sets the encoding for this font.

Note that under WXGTK this function has no effect (because the underlying Pango library always uses Wx::FontEncoding::FONTENCODING_UTF8).

Parameters:

See Also:



925
# File 'lib/wx/doc/gen/font.rb', line 925

def set_encoding(encoding) end

#set_face_name(faceName) ⇒ Boolean Also known as: face_name=

Sets the facename for the font.

Remark:

To avoid portability problems, don't rely on a specific face, but specify the font family instead (see Wx::FontFamily and #set_family).

true if the given face name exists; if the face name doesn’t exist in the user’s system then the font is invalidated (so that #is_ok will return false) and false is returned.

Parameters:

  • faceName (String)

    A valid facename, which should be on the end-user’s system.

Returns:

  • (Boolean)

See Also:



941
# File 'lib/wx/doc/gen/font.rb', line 941

def set_face_name(faceName) end

#set_family(family) ⇒ void Also known as: family=

This method returns an undefined value.

Sets the font family.

As described in Wx::FontFamily docs the given 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.

Parameters:

See Also:



952
# File 'lib/wx/doc/gen/font.rb', line 952

def set_family(family) end

#set_fractional_point_size(pointSize) ⇒ void Also known as: fractional_point_size=

This method returns an undefined value.

Sets the font size in points.

The point size is defined as 1/72 of the Anglo-Saxon inch (25.4 mm): it is approximately 0.0139 inch or 352.8 um.

Parameters:

  • pointSize (Float)

    Size in points. This can also be a fractional point size like 11.5.

See Also:



1006
# File 'lib/wx/doc/gen/font.rb', line 1006

def set_fractional_point_size(pointSize) end

#set_native_font_info(info) ⇒ Boolean Also known as: native_font_info=

Creates the font corresponding to the given native font description string which must have been previously returned by #get_native_font_info_desc.

If the string is invalid, font is unchanged. This function is typically used for de-serializing a Wx::Font object previously saved in a string-form. true if the creation was successful.

Parameters:

  • info (String)

Returns:

  • (Boolean)

See Also:



962
# File 'lib/wx/doc/gen/font.rb', line 962

def set_native_font_info(info) end

#set_native_font_info_user_desc(info) ⇒ Boolean Also known as: native_font_info_user_desc=

Creates the font corresponding to the given native font description string and returns true if the creation was successful.

Unlike #set_native_font_info, this function accepts strings which are user-friendly. Examples of accepted string formats are:

platform generic syntax example

WXGTK2 [underlined] [strikethrough] [FACE-NAME] [bold] [oblique|italic] [POINTSIZE] Monospace bold 10

WXMSW [light|bold] [italic] [FACE-NAME] [POINTSIZE] [ENCODING] Tahoma 10 WINDOWS-1252

Todoadd an example for WXOSX

For more detailed information about the allowed syntaxes you can look at the documentation of the native API used for font-rendering (e.g. 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). Note that unlike #set_native_font_info, this function doesn’t always restore all attributes of the Wx::Font 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 #get_native_font_info_desc and #set_native_font_info instead.

Parameters:

  • info (String)

Returns:

  • (Boolean)

See Also:



988
# File 'lib/wx/doc/gen/font.rb', line 988

def set_native_font_info_user_desc(info) end

#set_numeric_weight(weight) ⇒ void Also known as: numeric_weight=

This method returns an undefined value.

Sets the font weight using an integer value.

See Wx::FontWeight for a list of valid weight identifiers and their corresponding integer value.

Parameters:

  • weight (Integer)

    An integer value int the range 1-1000.

See Also:



1078
# File 'lib/wx/doc/gen/font.rb', line 1078

def set_numeric_weight(weight) end

#set_pixel_size(pixelSize) ⇒ void Also known as: pixel_size=

This method returns an undefined value.

Sets the pixel size.

The height parameter of 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). This feature (specifying the font pixel size) is directly supported only under WXMSW and WXGTK currently; under other platforms a font with the closest size to the given one is found using binary search (this maybe slower).

Parameters:

  • pixelSize (Array(Integer, Integer), Wx::Size)

See Also:



1016
# File 'lib/wx/doc/gen/font.rb', line 1016

def set_pixel_size(pixelSize) end

#set_point_size(pointSize) ⇒ void Also known as: point_size=

This method returns an undefined value.

Sets the font size in points to an integer value.

This is a legacy version of the function only supporting integer point sizes. It can still be used, but to avoid unnecessarily restricting the font size in points to integer values, consider using the new (added in wxWidgets 3.1.2) #set_fractional_point_size function instead.

Parameters:

  • pointSize (Integer)


996
# File 'lib/wx/doc/gen/font.rb', line 996

def set_point_size(pointSize) end

#set_strikethrough(strikethrough) ⇒ void Also known as: strikethrough=

This method returns an undefined value.

Sets strike-through attribute of the font.

Currently stricken-through fonts are only supported in WXMSW, WXGTK, and WXOSX.

Parameters:

  • strikethrough (Boolean)

    true to add strike-through style, false to remove it.

See Also:



1060
# File 'lib/wx/doc/gen/font.rb', line 1060

def set_strikethrough(strikethrough) end

#set_style(style) ⇒ void Also known as: style=

This method returns an undefined value.

Sets the font style.

Parameters:

See Also:



1025
# File 'lib/wx/doc/gen/font.rb', line 1025

def set_style(style) end

#set_symbolic_size(size) ⇒ void Also known as: symbolic_size=

This method returns an undefined value.

Sets the font size using a predefined symbolic size name.

This function allows changing font size to be (very) large or small compared to the standard font size.



1034
# File 'lib/wx/doc/gen/font.rb', line 1034

def set_symbolic_size(size) end

#set_symbolic_size_relative_to(size, base) ⇒ void

This method returns an undefined value.

Sets the font size compared to the base font size.

This is the same as #set_symbolic_size except that it uses the given font size as the normal font size instead of the standard font size.

Parameters:



1043
# File 'lib/wx/doc/gen/font.rb', line 1043

def set_symbolic_size_relative_to(size, base) end

#set_underlined(underlined) ⇒ void Also known as: underlined=

This method returns an undefined value.

Sets underlining.

Parameters:

  • underlined (Boolean)

    true to underline, false otherwise.

See Also:



1051
# File 'lib/wx/doc/gen/font.rb', line 1051

def set_underlined(underlined) end

#set_weight(weight) ⇒ void Also known as: weight=

This method returns an undefined value.

Sets the font weight.

Parameters:

See Also:



1069
# File 'lib/wx/doc/gen/font.rb', line 1069

def set_weight(weight) end

#smallerWx::Font

Returns a smaller version of this font.

The font size is divided by 1.2, the factor of 1.2 being inspired by the W3C CSS specification.

Returns:

See Also:



837
# File 'lib/wx/doc/gen/font.rb', line 837

def smaller; end

#strikethroughWx::Font

Returns stricken-through version of this font.

Currently stricken-through fonts are only supported in WXMSW, WXGTK, and WXOSX.

Returns:

See Also:



851
# File 'lib/wx/doc/gen/font.rb', line 851

def strikethrough; end

#underlinedWx::Font

Returns underlined version of this font.

Returns:

See Also:



844
# File 'lib/wx/doc/gen/font.rb', line 844

def underlined; end