Class: Harfbuzz::Buffer
- Inherits:
-
Base
- Object
- Base
- Harfbuzz::Buffer
show all
- Defined in:
- lib/harfbuzz/buffer.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#define_finalizer, finalize
Constructor Details
#initialize ⇒ Buffer
Returns a new instance of Buffer.
61
62
63
64
|
# File 'lib/harfbuzz/buffer.rb', line 61
def initialize
@hb_buffer = Harfbuzz.hb_buffer_create
define_finalizer(:hb_buffer_destroy, @hb_buffer)
end
|
Instance Attribute Details
#hb_buffer ⇒ Object
Returns the value of attribute hb_buffer.
59
60
61
|
# File 'lib/harfbuzz/buffer.rb', line 59
def hb_buffer
@hb_buffer
end
|
Instance Method Details
#add_utf8(text, offset = 0, length = -1)) ⇒ Object
66
67
68
69
70
|
# File 'lib/harfbuzz/buffer.rb', line 66
def add_utf8(text, offset=0, length=-1)
text_ptr = FFI::MemoryPointer.new(:char, text.bytesize)
text_ptr.put_bytes(0, text)
Harfbuzz.hb_buffer_add_utf8(@hb_buffer, text_ptr, text.bytesize, offset, length)
end
|
#get_glyph_infos ⇒ Object
84
85
86
87
88
89
90
91
|
# File 'lib/harfbuzz/buffer.rb', line 84
def get_glyph_infos
length_ptr = FFI::MemoryPointer.new(:uint, 1)
info_ptr = Harfbuzz.hb_buffer_get_glyph_infos(@hb_buffer, length_ptr)
length = length_ptr.read_uint
length.times.map do |i|
GlyphInfo.new(info_ptr + (i * GlyphInfo.size))
end
end
|
#get_glyph_positions ⇒ Object
93
94
95
96
97
98
99
100
|
# File 'lib/harfbuzz/buffer.rb', line 93
def get_glyph_positions
length_ptr = FFI::MemoryPointer.new(:uint, 1)
positions_ptr = Harfbuzz.hb_buffer_get_glyph_positions(@hb_buffer, length_ptr)
length = length_ptr.read_uint
length.times.map do |i|
GlyphPosition.new(positions_ptr + (i * GlyphPosition.size))
end
end
|
#guess_segment_properties ⇒ Object
72
73
74
|
# File 'lib/harfbuzz/buffer.rb', line 72
def guess_segment_properties
Harfbuzz.hb_buffer_guess_segment_properties(@hb_buffer)
end
|
#length ⇒ Object
80
81
82
|
# File 'lib/harfbuzz/buffer.rb', line 80
def length
Harfbuzz.hb_buffer_get_length(@hb_buffer)
end
|
#normalize_glyphs ⇒ Object
76
77
78
|
# File 'lib/harfbuzz/buffer.rb', line 76
def normalize_glyphs
Harfbuzz.hb_buffer_normalize_glyphs(@hb_buffer)
end
|