Class: FreeType::API::Outline

Inherits:
Object
  • Object
show all
Includes:
C
Defined in:
lib/freetype/api.rb

Constant Summary

Constants included from C

C::FT_ENC_TAG, C::FT_Encoding, C::FT_Glyph_Format, C::FT_IMAGE_TAG, C::FT_Kerning_Mode, C::FT_LOAD_COLOR, C::FT_LOAD_COMPUTE_METRICS, C::FT_LOAD_CROP_BITMAP, C::FT_LOAD_DEFAULT, C::FT_LOAD_FORCE_AUTOHINT, C::FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH, C::FT_LOAD_IGNORE_TRANSFORM, C::FT_LOAD_LINEAR_DESIGN, C::FT_LOAD_MONOCHROME, C::FT_LOAD_NO_AUTOHINT, C::FT_LOAD_NO_BITMAP, C::FT_LOAD_NO_HINTING, C::FT_LOAD_NO_RECURSE, C::FT_LOAD_NO_SCALE, C::FT_LOAD_PEDANTIC, C::FT_LOAD_RENDER, C::FT_LOAD_VERTICAL_LAYOUT

Instance Method Summary collapse

Methods included from C::LazyAttach

#attach_function

Constructor Details

#initialize(outline) ⇒ Outline

Returns a new instance of Outline.



181
182
183
# File 'lib/freetype/api.rb', line 181

def initialize(outline)
  @outline = outline
end

Instance Method Details

#[](key) ⇒ Object



185
186
187
# File 'lib/freetype/api.rb', line 185

def [](key)
  @outline[key]
end

#contoursObject



198
199
200
201
# File 'lib/freetype/api.rb', line 198

def contours
  return [] if @outline[:n_contours] == 0
  @outline[:contours].get_array_of_short(0, @outline[:n_contours])
end

#pointsObject



189
190
191
192
193
194
195
196
# File 'lib/freetype/api.rb', line 189

def points
  points = @outline[:n_points].times.map do |i|
    FT_Vector.new(@outline[:points] + i * FT_Vector.size)
  end
  points.zip(tags).map do |(point, tag)|
    Point.new(tag, point[:x], point[:y])
  end
end

#tagsObject



203
204
205
206
# File 'lib/freetype/api.rb', line 203

def tags
  return [] if @outline[:n_points] == 0
  @outline[:tags].get_array_of_char(0, @outline[:n_points])
end