Class: Harfbuzz::Face

Inherits:
Base
  • Object
show all
Defined in:
lib/harfbuzz/face.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#define_finalizer, finalize

Constructor Details

#initialize(input, face_index = 0) ⇒ Face

Returns a new instance of Face.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/harfbuzz/face.rb', line 17

def initialize(input, face_index=0)
  blob = case input
  when IO
    Harfbuzz::Blob.new(input.read, :HB_MEMORY_MODE_READONLY)
  when Blob
    # use as-is
  when String
    Harfbuzz::Blob.new(input, :HB_MEMORY_MODE_READONLY)
  else
    raise "Unknown input type: #{input.class}"
  end
  @hb_face = Harfbuzz.hb_face_create(blob.hb_blob, face_index)
  define_finalizer(:hb_face_destroy, @hb_face)
end

Instance Attribute Details

#hb_faceObject (readonly)

Returns the value of attribute hb_face.



15
16
17
# File 'lib/harfbuzz/face.rb', line 15

def hb_face
  @hb_face
end

Instance Method Details

#glyph_countObject



40
41
42
# File 'lib/harfbuzz/face.rb', line 40

def glyph_count
  Harfbuzz.hb_face_get_glyph_count(@hb_face)
end

#indexObject



32
33
34
# File 'lib/harfbuzz/face.rb', line 32

def index
  Harfbuzz.hb_face_get_index(@hb_face)
end

#upemObject



36
37
38
# File 'lib/harfbuzz/face.rb', line 36

def upem
  Harfbuzz.hb_face_get_upem(@hb_face)
end