sfml3.rb

Class: SFML::Glyph

Inherits:
Object
  • Object
show all
Defined in:
ext/graphics/glyph.c,
ext/graphics/glyph.c

Overview

A single character's rendering metrics and texture location, as returned by Font#glyph. Read-only.

Instance Method Summary collapse

Instance Method Details

#advance ⇒ Float

Returns the glyph's horizontal advance.

Returns:

  • (Float)

Returns:

  • (Float) —

    the horizontal offset to advance to the next character



43
44
45
# File 'ext/graphics/glyph.c', line 43

static VALUE Glyph_get_advance(VALUE self) {
    return DBL2NUM(Get_Glyph(self)->glyph.advance);
}

#bounds ⇒ Rect

Returns the glyph's bounding box.

Returns:

Returns:

  • (Rect) —

    the glyph's bounding box, relative to the baseline and the cursor position



54
55
56
# File 'ext/graphics/glyph.c', line 54

static VALUE Glyph_get_bounds(VALUE self) {
    return rect_to_rb(Get_Glyph(self)->glyph.bounds);
}

#texture_rect ⇒ Rect

Returns the sub-rectangle of the texture displayed on the object.

Returns:

Returns:

  • (Rect) —

    the sub-rectangle of the font's texture holding this glyph's pixels



65
66
67
# File 'ext/graphics/glyph.c', line 65

static VALUE Glyph_get_texture_rect(VALUE self) {
    return int_rect_to_rb(Get_Glyph(self)->glyph.textureRect);
}