Module: HarfBuzz::OT::Meta

Defined in:
lib/harfbuzz/ot/meta.rb

Overview

OpenType Meta table API

Class Method Summary collapse

Class Method Details

.entry(face, tag) ⇒ Blob

Returns the blob for a meta entry

Parameters:

  • face (Face)

    Font face

  • tag (Symbol)

    Entry tag (:design_languages or :supported_languages)

Returns:

  • (Blob)

    Entry data blob



29
30
31
# File 'lib/harfbuzz/ot/meta.rb', line 29

def entry(face, tag)
  Blob.wrap_owned(C.hb_ot_meta_reference_entry(face.ptr, tag))
end

.entry_tags(face) ⇒ Array<Integer>

Returns the tags of all meta table entries

Parameters:

  • face (Face)

    Font face

Returns:

  • (Array<Integer>)

    Entry tags



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/harfbuzz/ot/meta.rb', line 12

def (face)
  count_ptr = FFI::MemoryPointer.new(:uint)
  count_ptr.write_uint(0)
  C.(face.ptr, 0, count_ptr, nil)
  count = count_ptr.read_uint
  return [] if count.zero?

  tags_ptr = FFI::MemoryPointer.new(:uint32, count)
  count_ptr.write_uint(count)
  C.(face.ptr, 0, count_ptr, tags_ptr)
  tags_ptr.read_array_of_uint32(count_ptr.read_uint)
end