Module: HarfBuzz::AAT::Layout
- Defined in:
- lib/harfbuzz/aat/layout.rb
Overview
Apple Advanced Typography Layout queries
Class Method Summary collapse
-
.feature_type_name_id(face, type) ⇒ Integer?
Returns the name ID for a feature type.
-
.feature_types(face) ⇒ Array<Integer>
Returns feature types available in the AAT 'feat' table.
-
.has_positioning?(face) ⇒ Boolean
True if the face has AAT kerning/kerx positioning.
-
.has_substitution?(face) ⇒ Boolean
True if the face has AAT morx substitution.
-
.has_tracking?(face) ⇒ Boolean
True if the face has AAT trak tracking.
-
.selector_infos(face, type) ⇒ Array<C::HbAatLayoutFeatureSelectorInfoT>
Returns the selector infos for a feature type.
Class Method Details
.feature_type_name_id(face, type) ⇒ Integer?
Returns the name ID for a feature type
47 48 49 50 51 |
# File 'lib/harfbuzz/aat/layout.rb', line 47 def feature_type_name_id(face, type) name_id_ptr = FFI::MemoryPointer.new(:uint) ok = C.hb_aat_layout_feature_type_get_name_id(face.ptr, type, name_id_ptr) ok.zero? ? nil : name_id_ptr.read_uint end |
.feature_types(face) ⇒ Array<Integer>
Returns feature types available in the AAT 'feat' table
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/harfbuzz/aat/layout.rb', line 30 def feature_types(face) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) C.hb_aat_layout_get_feature_types(face.ptr, 0, count_ptr, nil) count = count_ptr.read_uint return [] if count.zero? types_ptr = FFI::MemoryPointer.new(:uint, count) count_ptr.write_uint(count) C.hb_aat_layout_get_feature_types(face.ptr, 0, count_ptr, types_ptr) types_ptr.read_array_of_uint(count_ptr.read_uint) end |
.has_positioning?(face) ⇒ Boolean
Returns true if the face has AAT kerning/kerx positioning.
17 18 19 |
# File 'lib/harfbuzz/aat/layout.rb', line 17 def has_positioning?(face) C.from_hb_bool(C.hb_aat_layout_has_positioning(face.ptr)) end |
.has_substitution?(face) ⇒ Boolean
Returns true if the face has AAT morx substitution.
11 12 13 |
# File 'lib/harfbuzz/aat/layout.rb', line 11 def has_substitution?(face) C.from_hb_bool(C.hb_aat_layout_has_substitution(face.ptr)) end |
.has_tracking?(face) ⇒ Boolean
Returns true if the face has AAT trak tracking.
23 24 25 |
# File 'lib/harfbuzz/aat/layout.rb', line 23 def has_tracking?(face) C.from_hb_bool(C.hb_aat_layout_has_tracking(face.ptr)) end |
.selector_infos(face, type) ⇒ Array<C::HbAatLayoutFeatureSelectorInfoT>
Returns the selector infos for a feature type
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/harfbuzz/aat/layout.rb', line 57 def selector_infos(face, type) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) C.hb_aat_layout_feature_type_get_selector_infos(face.ptr, type, 0, count_ptr, nil, nil) count = count_ptr.read_uint return [] if count.zero? infos_ptr = FFI::MemoryPointer.new(C::HbAatLayoutFeatureSelectorInfoT, count) count_ptr.write_uint(count) C.hb_aat_layout_feature_type_get_selector_infos( face.ptr, type, 0, count_ptr, infos_ptr, nil ) actual = count_ptr.read_uint actual.times.map do |i| C::HbAatLayoutFeatureSelectorInfoT.new( infos_ptr + i * C::HbAatLayoutFeatureSelectorInfoT.size ) end end |