Class: Harfbuzz::Blob

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#define_finalizer, finalize

Constructor Details

#initialize(data, mode = 0, user_data = nil) ⇒ Blob

Returns a new instance of Blob.



28
29
30
31
32
33
34
# File 'lib/harfbuzz/blob.rb', line 28

def initialize(data, mode=0, user_data=nil)
  data = data.read if data.kind_of?(IO)
  data_ptr = FFI::MemoryPointer.new(:char, data.size)
  data_ptr.put_bytes(0, data)
  @hb_blob = Harfbuzz.hb_blob_create(data_ptr, data.size, mode, user_data, nil)
  define_finalizer(:hb_blob_destroy, @hb_blob)
end

Instance Attribute Details

#hb_blobObject (readonly)

Returns the value of attribute hb_blob.



26
27
28
# File 'lib/harfbuzz/blob.rb', line 26

def hb_blob
  @hb_blob
end

Instance Method Details

#lengthObject



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

def length
  Harfbuzz.hb_blob_get_length(@hb_blob)
end