Class: HarfBuzz::GlyphInfo

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

Overview

Wraps hb_glyph_info_t, providing access to glyph ID and cluster index

Instance Method Summary collapse

Constructor Details

#initialize(struct_ptr) ⇒ GlyphInfo

Returns a new instance of GlyphInfo.



6
7
8
# File 'lib/harfbuzz/glyph_info.rb', line 6

def initialize(struct_ptr)
  @struct = C::HbGlyphInfoT.new(struct_ptr)
end

Instance Method Details

#clusterInteger

Returns Cluster index in source text.

Returns:

  • (Integer)

    Cluster index in source text



18
19
20
# File 'lib/harfbuzz/glyph_info.rb', line 18

def cluster
  @struct[:cluster]
end

#codepointInteger Also known as: glyph_id

Returns Glyph ID (after shaping) or Unicode codepoint (before shaping).

Returns:

  • (Integer)

    Glyph ID (after shaping) or Unicode codepoint (before shaping)



11
12
13
# File 'lib/harfbuzz/glyph_info.rb', line 11

def codepoint
  @struct[:codepoint]
end

#inspectObject



31
32
33
# File 'lib/harfbuzz/glyph_info.rb', line 31

def inspect
  "#<HarfBuzz::GlyphInfo glyph_id=#{codepoint} cluster=#{cluster}>"
end

#maskInteger

Returns Glyph flags bitmask.

Returns:

  • (Integer)

    Glyph flags bitmask



23
24
25
# File 'lib/harfbuzz/glyph_info.rb', line 23

def mask
  @struct[:mask]
end

#to_hObject



27
28
29
# File 'lib/harfbuzz/glyph_info.rb', line 27

def to_h
  { codepoint: codepoint, cluster: cluster, mask: mask }
end