Class: Harfbuzz::Font
- Inherits:
-
Base
- Object
- Base
- Harfbuzz::Font
show all
- Defined in:
- lib/harfbuzz/font.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#define_finalizer, finalize
Constructor Details
#initialize(face) ⇒ Font
Returns a new instance of Font.
33
34
35
36
37
38
|
# File 'lib/harfbuzz/font.rb', line 33
def initialize(face)
@hb_font = Harfbuzz.hb_font_create(face.hb_face)
Harfbuzz.hb_font_set_scale(@hb_font, face.upem, face.upem)
Harfbuzz.hb_ft_font_set_funcs(@hb_font)
define_finalizer(:hb_font_destroy, @hb_font)
end
|
Instance Attribute Details
#hb_font ⇒ Object
Returns the value of attribute hb_font.
31
32
33
|
# File 'lib/harfbuzz/font.rb', line 31
def hb_font
@hb_font
end
|
Instance Method Details
#glyph_to_string(glyph) ⇒ Object
60
61
62
63
64
|
# File 'lib/harfbuzz/font.rb', line 60
def glyph_to_string(glyph)
string_ptr = FFI::MemoryPointer.new(:char, 20)
Harfbuzz.hb_font_glyph_to_string(@hb_font, glyph, string_ptr, 20)
string_ptr.get_string(0, 20)
end
|
#ppem ⇒ Object
50
51
52
53
54
55
56
57
58
|
# File 'lib/harfbuzz/font.rb', line 50
def ppem
ppem_x_ptr = FFI::MemoryPointer.new(:uint, 1)
ppem_y_ptr = FFI::MemoryPointer.new(:uint, 1)
Harfbuzz.hb_font_get_ppem(@hb_font, ppem_x_ptr, ppem_y_ptr)
[
ppem_x_ptr.read_uint,
ppem_y_ptr.read_uint,
]
end
|
#scale ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/harfbuzz/font.rb', line 40
def scale
x_scale_ptr = FFI::MemoryPointer.new(:int, 1)
y_scale_ptr = FFI::MemoryPointer.new(:int, 1)
Harfbuzz.hb_font_get_scale(@hb_font, x_scale_ptr, y_scale_ptr)
[
x_scale_ptr.read_int,
y_scale_ptr.read_int,
]
end
|