Google

"DTD/xhtml1-strict.dtd">
Class Imlib2::Font
In: ./imlib2.c
Methods
Public Class methods
new(VALUE klass, VALUE font_name)

Returns a new Imlib2::Font

Note: the specified font must be in the font path. See Imlib2::Font::list_paths() for a list of font paths, and Imlib2::Font::list_fonts() for a list of fonts.

Examples:

  font = Imlib2::Font.new 'helvetica/24'
  font = Imlib2::Font.load 'helvetica/24'
load(VALUE klass, VALUE font_name)

Returns a new Imlib2::Font

Note: the specified font must be in the font path. See Imlib2::Font::list_paths() for a list of font paths, and Imlib2::Font::list_fonts() for a list of fonts.

Examples:

  font = Imlib2::Font.new 'helvetica/24'
  font = Imlib2::Font.load 'helvetica/24'
list(VALUE klass)

Return an array of all known fonts

Example:

  font_list = Imlib2::Font.list_fonts
fonts(VALUE klass)

Return an array of all known fonts

Example:

  font_list = Imlib2::Font.list_fonts
list_fonts(VALUE klass)

Return an array of all known fonts

Example:

  font_list = Imlib2::Font.list_fonts
add_path(VALUE klass, VALUE path)

Add a path to the list of font paths.

Example:

  Imlib2::Font.add_path '/usr/lib/X11/fonts/Truetype'
remove_path(VALUE klass, VALUE path)

Remove a path from the list of font paths.

Example:

  Imlib2::Font.remove_path '/usr/lib/X11/fonts/Truetype'
paths(VALUE klass)

Return an array of font paths.

Example:

  path_list = Imlib2::Font.list_paths
list_paths(VALUE klass)

Return an array of font paths.

Example:

  path_list = Imlib2::Font.list_paths
Public Instance methods
initialize(VALUE self)

Constructor for Imlib2::Font

Currently just a placeholder.

size(VALUE self, VALUE text)

Get the width and height of the given string using this font.

Example:

  font = Imlib2::Font.new 'helvetica/12'
  size = font.size 'how big am i?'
  ['width', 'height'].each_index { |i, v|
    puts 'text ' << v << ' = ' << size[i]
  }
text_size(VALUE self, VALUE text)

Get the width and height of the given string using this font.

Example:

  font = Imlib2::Font.new 'helvetica/12'
  size = font.size 'how big am i?'
  ['width', 'height'].each_index { |i, v|
    puts 'text ' << v << ' = ' << size[i]
  }
get_text_size(VALUE self, VALUE text)

Get the width and height of the given string using this font.

Example:

  font = Imlib2::Font.new 'helvetica/12'
  size = font.size 'how big am i?'
  ['width', 'height'].each_index { |i, v|
    puts 'text ' << v << ' = ' << size[i]
  }
advance(VALUE self, VALUE text)

Get the horizontal and vertical advance of the given string using this font.

Example:

  font = Imlib2::Font.new 'verdana/36'
  advances = font.advance "what's my advance?"
  ['horizontal', 'vertical'].each_index { |i, v|
    puts 'text ' << v << ' advance = ' << advances[i]
  }
text_advance(VALUE self, VALUE text)

Get the horizontal and vertical advance of the given string using this font.

Example:

  font = Imlib2::Font.new 'verdana/36'
  advances = font.advance "what's my advance?"
  ['horizontal', 'vertical'].each_index { |i, v|
    puts 'text ' << v << ' advance = ' << advances[i]
  }
get_text_advance(VALUE self, VALUE text)

Get the horizontal and vertical advance of the given string using this font.

Example:

  font = Imlib2::Font.new 'verdana/36'
  advances = font.advance "what's my advance?"
  ['horizontal', 'vertical'].each_index { |i, v|
    puts 'text ' << v << ' advance = ' << advances[i]
  }
inset(VALUE self, VALUE text)

Get the inset of the given string using this font

Example:

  font = Imlib2::Font.new 'palatino/9'
  inset = font.inset 'wonder what the inset for this string is...'
text_inset(VALUE self, VALUE text)

Get the inset of the given string using this font

Example:

  font = Imlib2::Font.new 'palatino/9'
  inset = font.inset 'wonder what the inset for this string is...'
get_text_inset(VALUE self, VALUE text)

Get the inset of the given string using this font

Example:

  font = Imlib2::Font.new 'palatino/9'
  inset = font.inset 'wonder what the inset for this string is...'
index(int argc, VALUE *argv, VALUE self)

Get the character index of the pixel at the given coordinates using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 5, 5
text_index(int argc, VALUE *argv, VALUE self)

Get the character index of the pixel at the given coordinates using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 5, 5
text_index_and_location(int argc, VALUE *argv, VALUE self)

Get the character index of the pixel at the given coordinates using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 5, 5
get_text_index_and_location(int argc, VALUE *argv, VALUE self)

Get the character index of the pixel at the given coordinates using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 5, 5
location(VALUE self, VALUE text, VALUE index)

Get the character coordinates of the at the given index using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 8
text_location(VALUE self, VALUE text, VALUE index)

Get the character coordinates of the at the given index using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 8
text_location_at_index(VALUE self, VALUE text, VALUE index)

Get the character coordinates of the at the given index using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 8
get_text_location_at_index(VALUE self, VALUE text, VALUE index)

Get the character coordinates of the at the given index using this font.

Example:

  x, y, char_w, char_h = font.index "index\nstring\n", 8
ascent(VALUE self)

Get font ascent.

Example:

  a = font.ascent
get_ascent(VALUE self)

Get font ascent.

Example:

  a = font.ascent
descent(VALUE self)

Get font descent.

Example:

  a = font.descent
get_descent(VALUE self)

Get font descent.

Example:

  a = font.descent
maximum_ascent(VALUE self)

Get font maximum ascent.

Example:

  a = font.maximum_ascent
get_maximum_ascent(VALUE self)

Get font maximum ascent.

Example:

  a = font.maximum_ascent
maximum_descent(VALUE self)

Get font maximum descent.

Example:

  a = font.maximum_descent
get_maximum_descent(VALUE self)

Get font maximum descent.

Example:

  a = font.maximum_descent