Class: Wx::FontInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/font.rb

Overview

Note:

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

This class is a helper used for Font creation using named parameter idiom: it allows specifying various Font attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to Font constructors.

For example, to create an italic font with the given face name and size you could use:

font = Wx::Font.new(Wx::FontInfo.new(12).face_name('Helvetica').italic())

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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWx::FontInfo #initialize(pointSize) ⇒ Wx::FontInfo #initialize(pixelSize) ⇒ Wx::FontInfo

Returns a new instance of FontInfo.

Overloads:

  • #initializeWx::FontInfo

    Default constructor uses the default font size for the current platform.

  • #initialize(pointSize) ⇒ Wx::FontInfo

    Constructor setting the font size in points to use.

    Note that until wxWidgets 3.1.2 fractional point sizes were not supported, and the type of pointSize was int.

    Parameters:

    • pointSize (Float)

    See Also:

  • #initialize(pixelSize) ⇒ Wx::FontInfo

    Constructor setting the font size in pixels to use.

    Parameters:

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

    See Also:



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

def initialize(*args) end

Class Method Details

.get_weight_closest_to_numeric_value(numWeight) ⇒ Wx::FontWeight

Get the symbolic weight closest to the given raw weight value.

A valid element of Wx::FontWeight enum.

Parameters:

  • numWeight (Integer)

    A valid raw weight value, i.e. a value in the range 1 to 1000, inclusive.

Returns:



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

def self.get_weight_closest_to_numeric_value(numWeight) end

Instance Method Details

#all_flags(flags) ⇒ Wx::FontInfo

Set all the font attributes at once.

See Wx::FontFlag for the various flags that can be used. Note that calling this method affects the font weight stored in this object: it is set to Wx::FontWeight::FONTWEIGHT_LIGHT or Wx::FontWeight::FONTWEIGHT_BOLD if the corresponding flag is present in flags, or Wx::FontWeight::FONTWEIGHT_NORMAL otherwise.

Parameters:

  • flags (Integer)

Returns:



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

def all_flags(flags) end

#anti_aliased(antiAliased = true) ⇒ Wx::FontInfo

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.

Parameters:

  • antiAliased (Boolean) (defaults to: true)

Returns:



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

def anti_aliased(antiAliased=true) end

#bold(bold = true) ⇒ Wx::FontInfo

Use a bold version of the font.

This is a wrapper for #weight calling it with Wx::FontWeight::FONTWEIGHT_BOLD argument.

Parameters:

  • bold (Boolean) (defaults to: true)

Returns:

See Also:



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

def bold(bold=true) end

#encoding(encoding) ⇒ Wx::FontInfo

Set the font encoding to use.

This is mostly unneeded in Unicode builds of wxWidgets.

Parameters:

Returns:

See Also:



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

def encoding(encoding) end

#face_name(faceName) ⇒ Wx::FontInfo

Set the font face name to use.

Face names are not portable, so prefer to use #family in portable code.

Parameters:

  • faceName (String)

Returns:

See Also:



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

def face_name(faceName) end

#family(family) ⇒ Wx::FontInfo

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 Wx::FontFamily enumeration values. If the #face_name is used, then it overrides the font family.

Parameters:

Returns:

See Also:



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

def family(family) end

#italic(italic = true) ⇒ Wx::FontInfo

Use an italic version of the font.

This is a wrapper for #style calling it with Wx::FontStyle::FONTSTYLE_ITALIC argument.

Parameters:

  • italic (Boolean) (defaults to: true)

Returns:

See Also:



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

def italic(italic=true) end

#light(light = true) ⇒ Wx::FontInfo

Use a lighter version of the font.

This is a wrapper for #weight calling it with Wx::FontWeight::FONTWEIGHT_LIGHT argument.

Parameters:

  • light (Boolean) (defaults to: true)

Returns:

See Also:



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

def light(light=true) end

#slant(slant = true) ⇒ Wx::FontInfo

Use a slanted version of the font.

This is a wrapper for #style calling it with Wx::FontStyle::FONTSTYLE_SLANT argument.

Parameters:

  • slant (Boolean) (defaults to: true)

Returns:

See Also:



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

def slant(slant=true) end

#strikethrough(strikethrough = true) ⇒ Wx::FontInfo

Use a strike-through version of the font.

Currently this is only implemented in WXMSW, WXGTK, and WXOSX.

Parameters:

  • strikethrough (Boolean) (defaults to: true)

Returns:



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

def strikethrough(strikethrough=true) end

#style(style) ⇒ Wx::FontInfo

Specify the style of the font using one of Wx::FontStyle constants.

Parameters:

Returns:



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

def style(style) end

#underlined(underlined = true) ⇒ Wx::FontInfo

Use an underlined version of the font.

Parameters:

  • underlined (Boolean) (defaults to: true)

Returns:



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

def underlined(underlined=true) end

#weight(weight) ⇒ Wx::FontInfo

Specify the weight of the font.

Parameters:

  • weight (Integer)

    A font weight in the range from 1 to 1000, inclusive, with 1 being the thinnest and 1000 the heaviest possible font variant. Wx::FONTWEIGHT_XXX values from Wx::FontWeight enum can be used here.

Returns:



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

def weight(weight) end