Class FT2::Glyph
In: ./ft2.c
Parent: Object
Methods
advance    cbox    class    dup    format    initialize    library    to_bmap    transform   
Public Class methods
initialize(VALUE self)

Constructor for FT2::Glyph class.

This method is currently empty. You should never call this method directly unless you're instantiating a derived class (ie, you know what you're doing).

Public Instance methods
library(VALUE self)

Get the library of a FT2::Glyph object.

Note:

  Glyph objects are not owned or tracked by the library.

Examples:

  lib = glyph.library
class(VALUE self)

Get the FreeType2 class of a FT2::Glyph object.

Note:

  This is _not_ the Ruby class of the object.

Aliases:

  FT2::Glyph#clazz

Examples:

  c = glyph.class
format(VALUE self)

Get the format of a FT2::Glyph object's image.

Glyph Formats:

  FT2::GlyphFormat::COMPOSITE
  FT2::GlyphFormat::BITMAP
  FT2::GlyphFormat::OUTLINE
  FT2::GlyphFormat::PLOTTER

Examples:

  format = glyph.format
advance(VALUE self)

Get the advance of a FT2::Glyph object.

Description:

  This vector gives the FT2::Glyph object's advance width.

Examples:

  advance = glyph.advance
dup(VALUE self)

Duplicate a FT2::Glyph object.

Aliases:

  FT2::Glyph#copy

Examples:

  new_glyph = glyph.dup
transform(VALUE self, VALUE matrix_ary, VALUE delta_ary)

Transform a FT2::Glyph object if it's format is scalable.

Description:

  matrix: A pointer to a 2x2 matrix to apply.
  delta:  A pointer to a 2d vector to apply. Coordinates are
          expressed in 1/64th of a pixel.

Note:

  The transformation matrix is also applied to the glyph's advance
  vector.  This method returns an error if the glyph format is not
  scalable (eg, if it's not equal to zero).

Examples:

  matrix = [[1, 0],
            [0, 1]]
  delta = [1, 1]
  transform = glyph.transform matrix, delta
cbox(VALUE self, VALUE bbox_mode)

Get the control box of a FT2::Glyph object.

Description:

  Returns a FT2::Glyph object's `control box'. The control box
  encloses all the outline's points, including Bezier control points.
  Though it coincides with the exact bounding box for most FT2::Glyph
  objects, it can be slightly larger in some situations (like when
  rotating an outline which contains Bezier outside arcs).

  Computing the control box is very fast, while getting the bounding
  box can take much more time as it needs to walk over all segments
  and arcs in the outline. To get the latter, you can use the
  `ftbbox' component which is dedicated to this single task.

Notes:

  Coordinates are relative to the FT2::Glyph object's origin, using
  the Y-upwards convention.

  If the FT2::Glyph object has been loaded with FT2::Load::NO_SCALE,
  `bbox_mode' must be set to FT2::GlyphBBox::UNSCALED to get unscaled
  font units.
  If `bbox_mode' is set to FT2::GlyphBBox::SUBPIXELS the
  bbox coordinates are returned in 26.6 pixels (i.e. 1/64th of
  pixels).

  Note that the maximum coordinates are exclusive, which means that
  one can compute the width and height of the FT2::Glyph object image
  (be it in integer or 26.6 pixels) as:
  width = bbox.xMax - bbox.xMin; height = bbox.yMax - bbox.yMin;

  Note also that for 26.6 coordinates, if `bbox_mode' is set to
  FT2::GlyphBBox::GRIDFIT, the coordinates will also be
  grid-fitted, which corresponds to:
  bbox.xMin = FLOOR(bbox.xMin); bbox.yMin = FLOOR(bbox.yMin);
  bbox.xMax = CEILING(bbox.xMax); bbox.yMax = CEILING(bbox.yMax);

  To get the bbox in pixel coordinates, set `bbox_mode' to
  FT2::GlyphBBox::TRUNCATE.
  To get the bbox in grid-fitted pixel coordinates, set `bbox_mode'
  to FT2::GlyphBBox::PIXELS.

  The default value for `bbox_mode' is FT2::GlyphBBox::PIXELS.

Aliases:

  FT2::Glyph#control_box

Examples:

  bbox_mode = FT2::GlyphBBox::PIXELS
  x_min, y_min, x_max, y_max = glyph.cbox bbox_mode
to_bmap(VALUE self, VALUE render_mode, VALUE origin, VALUE destroy)

Render a FT2::Glyph object as a FT2::BitmapGlyph object.

Description:

  Converts a FT2::Glyph object to a FT2::BitmapGlyph object.

  render_mode: A set of bit flags that describe how the data is.
  origin:      A vector used to translate the glyph image before
               rendering. Can be nil (if no translation).  The
               origin is expressed in 26.6 pixels.
  destroy:     A boolean that indicates that the original glyph
               image should be destroyed by this function. It is
               never destroyed in case of error.

Aliases:

  FT2::Glyph#to_bitmap

Examples:

  glyph_to_bmap = glyph.glyph_to_bmap