Module: HarfBuzz::OT::Layout
- Defined in:
- lib/harfbuzz/ot/layout.rb
Overview
OpenType Layout table queries (GSUB/GPOS)
Class Method Summary collapse
-
.attach_points(face, glyph) ⇒ Array<Integer>
Returns attachment point list for a glyph.
-
.baseline(font, baseline_tag, dir, script_tag, language = nil) ⇒ Integer?
Returns a baseline coordinate value.
-
.baseline2(font, baseline_tag, dir, script, language = nil) ⇒ Integer?
Returns a baseline coordinate value (v2: takes hb_script_t + hb_language_t).
-
.baseline_with_fallback(font, baseline_tag, dir, script_tag, language = nil) ⇒ Integer
Returns a baseline coordinate with fallback.
-
.baseline_with_fallback2(font, baseline_tag, dir, script, language = nil) ⇒ Integer
Returns a baseline coordinate with fallback (v2: takes hb_script_t + hb_language_t).
-
.collect_features(face, table_tag, scripts: nil, languages: nil, features: nil) ⇒ HarfBuzz::Set
Collects all feature indices.
-
.collect_lookups(face, table_tag, scripts: nil, languages: nil, features: nil) ⇒ HarfBuzz::Set
Collects all lookups referenced by features.
-
.feature_characters(face, table_tag, feature_index) ⇒ Array<Integer>
Returns codepoints for a named feature's characters.
-
.feature_indexes(face, table_tag, script_index, language_index) ⇒ Array<Integer>
Returns feature indices for a language.
-
.feature_lookups(face, table_tag, feature_index) ⇒ Array<Integer>
Returns lookup indices for a feature.
-
.feature_name_ids(face, table_tag, feature_index) ⇒ Hash?
Returns OpenType feature UI name IDs.
-
.feature_tags(face, table_tag) ⇒ Array<Integer>
Returns the feature tags for a table.
-
.feature_tags_for_lang(face, table_tag, script_index, language_index) ⇒ Array<Integer>
Returns feature tags for a language.
-
.find_feature(face, table_tag, script_index, language_index, feature_tag) ⇒ Array
Finds a specific feature in a language, returns [found, feature_index].
-
.find_script(face, table_tag, script_tag) ⇒ Array
Finds a script in the table, returns [found, index].
-
.font_extents(font, dir, script_tag, language = nil) ⇒ Hash?
Returns font extents from OT tables.
-
.font_extents2(font, dir, script, language = nil) ⇒ Hash?
Returns font extents from OT tables (v2: takes hb_script_t + hb_language_t).
-
.glyph_class(face, glyph) ⇒ Symbol
Returns the glyph class from GDEF.
-
.glyphs_in_class(face, klass) ⇒ HarfBuzz::Set
Returns all glyphs in a given GDEF class.
-
.has_glyph_classes?(face) ⇒ Boolean
True if the face has GDEF glyph classes.
-
.has_positioning?(face) ⇒ Boolean
True if the face has a GPOS table.
-
.has_substitution?(face) ⇒ Boolean
True if the face has a GSUB table.
-
.horizontal_baseline_tag_for_script(script) ⇒ Integer
Returns the horizontal baseline tag for a script.
-
.language_tags(face, table_tag, script_index) ⇒ Array<Integer>
Returns language tags for a script.
-
.ligature_carets(font, dir, glyph) ⇒ Array<Integer>
Returns ligature caret positions for a glyph.
-
.required_feature(face, table_tag, script_index, language_index) ⇒ Array?
Returns [feature_index, feature_tag] for the required feature, or nil.
-
.required_feature_index(face, table_tag, script_index, language_index) ⇒ Integer?
Returns the required feature index for a language, or nil if none.
-
.script_tags(face, table_tag) ⇒ Array<Integer>
Returns the script tags for a table.
-
.select_language(face, table_tag, script_index, language_tags) ⇒ Array
Selects the best matching language, returns [found, language_index].
-
.select_script(face, table_tag, script_tags) ⇒ Array
Selects the best matching script from a list.
-
.size_params(face) ⇒ Hash?
Returns size design parameters for the face.
-
.tag_to_language(tag) ⇒ FFI::Pointer
Converts an OT tag to a language pointer.
-
.tag_to_script(tag) ⇒ Integer
Converts an OT tag to a script value.
-
.tags_from_script_and_language(script, language) ⇒ Array<Array<Integer>>
Converts script+language to OT tags.
-
.tags_to_script_and_language(script_tag, language_tag) ⇒ Array
Converts OT tags to script + language.
Class Method Details
.attach_points(face, glyph) ⇒ Array<Integer>
Returns attachment point list for a glyph
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/harfbuzz/ot/layout.rb', line 66 def attach_points(face, glyph) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.hb_ot_layout_get_attach_points(face.ptr, glyph, 0, count_ptr, nil) return [] if total.zero? points_ptr = FFI::MemoryPointer.new(:uint, total) count_ptr.write_uint(total) C.hb_ot_layout_get_attach_points(face.ptr, glyph, 0, count_ptr, points_ptr) points_ptr.read_array_of_uint(count_ptr.read_uint) end |
.baseline(font, baseline_tag, dir, script_tag, language = nil) ⇒ Integer?
Returns a baseline coordinate value
365 366 367 368 369 370 371 372 373 374 |
# File 'lib/harfbuzz/ot/layout.rb', line 365 def baseline(font, baseline_tag, dir, script_tag, language = nil) lang_ptr = language || FFI::Pointer::NULL coord_ptr = FFI::MemoryPointer.new(:int32) found = C.from_hb_bool( C.hb_ot_layout_get_baseline( font.ptr, baseline_tag, dir, script_tag, lang_ptr, coord_ptr ) ) found ? coord_ptr.read_int32 : nil end |
.baseline2(font, baseline_tag, dir, script, language = nil) ⇒ Integer?
Returns a baseline coordinate value (v2: takes hb_script_t + hb_language_t)
422 423 424 425 426 427 428 429 430 431 |
# File 'lib/harfbuzz/ot/layout.rb', line 422 def baseline2(font, baseline_tag, dir, script, language = nil) lang_ptr = language || FFI::Pointer::NULL coord_ptr = FFI::MemoryPointer.new(:int32) found = C.from_hb_bool( C.hb_ot_layout_get_baseline2( font.ptr, baseline_tag, dir, script, lang_ptr, coord_ptr ) ) found ? coord_ptr.read_int32 : nil end |
.baseline_with_fallback(font, baseline_tag, dir, script_tag, language = nil) ⇒ Integer
Returns a baseline coordinate with fallback
383 384 385 386 387 388 389 390 |
# File 'lib/harfbuzz/ot/layout.rb', line 383 def baseline_with_fallback(font, baseline_tag, dir, script_tag, language = nil) lang_ptr = language || FFI::Pointer::NULL coord_ptr = FFI::MemoryPointer.new(:int32) C.hb_ot_layout_get_baseline_with_fallback( font.ptr, baseline_tag, dir, script_tag, lang_ptr, coord_ptr ) coord_ptr.read_int32 end |
.baseline_with_fallback2(font, baseline_tag, dir, script, language = nil) ⇒ Integer
Returns a baseline coordinate with fallback (v2: takes hb_script_t + hb_language_t)
440 441 442 443 444 445 446 447 |
# File 'lib/harfbuzz/ot/layout.rb', line 440 def baseline_with_fallback2(font, baseline_tag, dir, script, language = nil) lang_ptr = language || FFI::Pointer::NULL coord_ptr = FFI::MemoryPointer.new(:int32) C.hb_ot_layout_get_baseline_with_fallback2( font.ptr, baseline_tag, dir, script, lang_ptr, coord_ptr ) coord_ptr.read_int32 end |
.collect_features(face, table_tag, scripts: nil, languages: nil, features: nil) ⇒ HarfBuzz::Set
Collects all feature indices
518 519 520 521 522 523 524 525 526 527 |
# File 'lib/harfbuzz/ot/layout.rb', line 518 def collect_features(face, table_tag, scripts: nil, languages: nil, features: nil) set = HarfBuzz::Set.new scripts_ptr = build_tag_array_ptr(scripts) languages_ptr = build_tag_array_ptr(languages) features_ptr = build_tag_array_ptr(features) C.hb_ot_layout_collect_features( face.ptr, table_tag, scripts_ptr, languages_ptr, features_ptr, set.ptr ) set end |
.collect_lookups(face, table_tag, scripts: nil, languages: nil, features: nil) ⇒ HarfBuzz::Set
Collects all lookups referenced by features
503 504 505 506 507 508 509 510 511 512 |
# File 'lib/harfbuzz/ot/layout.rb', line 503 def collect_lookups(face, table_tag, scripts: nil, languages: nil, features: nil) set = HarfBuzz::Set.new scripts_ptr = build_tag_array_ptr(scripts) languages_ptr = build_tag_array_ptr(languages) features_ptr = build_tag_array_ptr(features) C.hb_ot_layout_collect_lookups( face.ptr, table_tag, scripts_ptr, languages_ptr, features_ptr, set.ptr ) set end |
.feature_characters(face, table_tag, feature_index) ⇒ Array<Integer>
Returns codepoints for a named feature's characters
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/harfbuzz/ot/layout.rb', line 342 def feature_characters(face, table_tag, feature_index) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.hb_ot_layout_feature_get_characters( face.ptr, table_tag, feature_index, 0, count_ptr, nil ) return [] if total.zero? cps_ptr = FFI::MemoryPointer.new(:uint32, total) count_ptr.write_uint(total) C.hb_ot_layout_feature_get_characters( face.ptr, table_tag, feature_index, 0, count_ptr, cps_ptr ) cps_ptr.read_array_of_uint32(count_ptr.read_uint) end |
.feature_indexes(face, table_tag, script_index, language_index) ⇒ Array<Integer>
Returns feature indices for a language
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/harfbuzz/ot/layout.rb', line 205 def feature_indexes(face, table_tag, script_index, language_index) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.hb_ot_layout_language_get_feature_indexes( face.ptr, table_tag, script_index, language_index, 0, count_ptr, nil ) return [] if total.zero? idx_ptr = FFI::MemoryPointer.new(:uint, total) count_ptr.write_uint(total) C.hb_ot_layout_language_get_feature_indexes( face.ptr, table_tag, script_index, language_index, 0, count_ptr, idx_ptr ) idx_ptr.read_array_of_uint(count_ptr.read_uint) end |
.feature_lookups(face, table_tag, feature_index) ⇒ Array<Integer>
Returns lookup indices for a feature
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/harfbuzz/ot/layout.rb', line 265 def feature_lookups(face, table_tag, feature_index) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.hb_ot_layout_feature_get_lookups( face.ptr, table_tag, feature_index, 0, count_ptr, nil ) return [] if total.zero? idx_ptr = FFI::MemoryPointer.new(:uint, total) count_ptr.write_uint(total) C.hb_ot_layout_feature_get_lookups( face.ptr, table_tag, feature_index, 0, count_ptr, idx_ptr ) idx_ptr.read_array_of_uint(count_ptr.read_uint) end |
.feature_name_ids(face, table_tag, feature_index) ⇒ Hash?
Returns OpenType feature UI name IDs
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/harfbuzz/ot/layout.rb', line 313 def feature_name_ids(face, table_tag, feature_index) label_id_ptr = FFI::MemoryPointer.new(:uint) tooltip_id_ptr = FFI::MemoryPointer.new(:uint) sample_id_ptr = FFI::MemoryPointer.new(:uint) num_params_ptr = FFI::MemoryPointer.new(:uint) first_param_id_ptr = FFI::MemoryPointer.new(:uint) found = C.from_hb_bool( C.hb_ot_layout_feature_get_name_ids( face.ptr, table_tag, feature_index, label_id_ptr, tooltip_id_ptr, sample_id_ptr, num_params_ptr, first_param_id_ptr ) ) return nil unless found { label_id: label_id_ptr.read_uint, tooltip_id: tooltip_id_ptr.read_uint, sample_id: sample_id_ptr.read_uint, num_named_parameters: num_params_ptr.read_uint, first_param_id: first_param_id_ptr.read_uint } end |
.feature_tags(face, table_tag) ⇒ Array<Integer>
Returns the feature tags for a table
483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/harfbuzz/ot/layout.rb', line 483 def (face, table_tag) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) C.(face.ptr, table_tag, 0, count_ptr, nil) count = count_ptr.read_uint return [] if count.zero? = FFI::MemoryPointer.new(:uint32, count) count_ptr.write_uint(count) C.(face.ptr, table_tag, 0, count_ptr, ) .read_array_of_uint32(count_ptr.read_uint) end |
.feature_tags_for_lang(face, table_tag, script_index, language_index) ⇒ Array<Integer>
Returns feature tags for a language
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/harfbuzz/ot/layout.rb', line 227 def (face, table_tag, script_index, language_index) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.( face.ptr, table_tag, script_index, language_index, 0, count_ptr, nil ) return [] if total.zero? = FFI::MemoryPointer.new(:uint32, total) count_ptr.write_uint(total) C.( face.ptr, table_tag, script_index, language_index, 0, count_ptr, ) .read_array_of_uint32(count_ptr.read_uint) end |
.find_feature(face, table_tag, script_index, language_index, feature_tag) ⇒ Array
Finds a specific feature in a language, returns [found, feature_index]
250 251 252 253 254 255 256 257 258 |
# File 'lib/harfbuzz/ot/layout.rb', line 250 def find_feature(face, table_tag, script_index, language_index, feature_tag) idx_ptr = FFI::MemoryPointer.new(:uint) found = C.from_hb_bool( C.hb_ot_layout_language_find_feature( face.ptr, table_tag, script_index, language_index, feature_tag, idx_ptr ) ) [found, idx_ptr.read_uint] end |
.find_script(face, table_tag, script_tag) ⇒ Array
Finds a script in the table, returns [found, index]
100 101 102 103 104 105 106 |
# File 'lib/harfbuzz/ot/layout.rb', line 100 def find_script(face, table_tag, script_tag) idx_ptr = FFI::MemoryPointer.new(:uint) found = C.from_hb_bool( C.hb_ot_layout_table_find_script(face.ptr, table_tag, script_tag, idx_ptr) ) [found, idx_ptr.read_uint] end |
.font_extents(font, dir, script_tag, language = nil) ⇒ Hash?
Returns font extents from OT tables
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/harfbuzz/ot/layout.rb', line 398 def font_extents(font, dir, script_tag, language = nil) lang_ptr = language || FFI::Pointer::NULL extents = C::HbFontExtentsT.new found = C.from_hb_bool( C.hb_ot_layout_get_font_extents( font.ptr, dir, script_tag, lang_ptr, extents.to_ptr ) ) return nil unless found { ascender: extents[:ascender], descender: extents[:descender], line_gap: extents[:line_gap] } end |
.font_extents2(font, dir, script, language = nil) ⇒ Hash?
Returns font extents from OT tables (v2: takes hb_script_t + hb_language_t)
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/harfbuzz/ot/layout.rb', line 455 def font_extents2(font, dir, script, language = nil) lang_ptr = language || FFI::Pointer::NULL extents = C::HbFontExtentsT.new found = C.from_hb_bool( C.hb_ot_layout_get_font_extents2( font.ptr, dir, script, lang_ptr, extents.to_ptr ) ) return nil unless found { ascender: extents[:ascender], descender: extents[:descender], line_gap: extents[:line_gap] } end |
.glyph_class(face, glyph) ⇒ Symbol
Returns the glyph class from GDEF
31 32 33 |
# File 'lib/harfbuzz/ot/layout.rb', line 31 def glyph_class(face, glyph) C.hb_ot_layout_get_glyph_class(face.ptr, glyph) end |
.glyphs_in_class(face, klass) ⇒ HarfBuzz::Set
Returns all glyphs in a given GDEF class
39 40 41 42 43 |
# File 'lib/harfbuzz/ot/layout.rb', line 39 def glyphs_in_class(face, klass) set = HarfBuzz::Set.new C.hb_ot_layout_get_glyphs_in_class(face.ptr, klass, set.ptr) set end |
.has_glyph_classes?(face) ⇒ Boolean
Returns true if the face has GDEF glyph classes.
11 12 13 |
# File 'lib/harfbuzz/ot/layout.rb', line 11 def has_glyph_classes?(face) C.from_hb_bool(C.hb_ot_layout_has_glyph_classes(face.ptr)) end |
.has_positioning?(face) ⇒ Boolean
Returns true if the face has a GPOS table.
23 24 25 |
# File 'lib/harfbuzz/ot/layout.rb', line 23 def has_positioning?(face) C.from_hb_bool(C.hb_ot_layout_has_positioning(face.ptr)) end |
.has_substitution?(face) ⇒ Boolean
Returns true if the face has a GSUB table.
17 18 19 |
# File 'lib/harfbuzz/ot/layout.rb', line 17 def has_substitution?(face) C.from_hb_bool(C.hb_ot_layout_has_substitution(face.ptr)) end |
.horizontal_baseline_tag_for_script(script) ⇒ Integer
Returns the horizontal baseline tag for a script
475 476 477 |
# File 'lib/harfbuzz/ot/layout.rb', line 475 def horizontal_baseline_tag_for_script(script) C.hb_ot_layout_get_horizontal_baseline_tag_for_script(script) end |
.language_tags(face, table_tag, script_index) ⇒ Array<Integer>
Returns language tags for a script
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/harfbuzz/ot/layout.rb', line 131 def (face, table_tag, script_index) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.( face.ptr, table_tag, script_index, 0, count_ptr, nil ) return [] if total.zero? = FFI::MemoryPointer.new(:uint32, total) count_ptr.write_uint(total) C.( face.ptr, table_tag, script_index, 0, count_ptr, ) .read_array_of_uint32(count_ptr.read_uint) end |
.ligature_carets(font, dir, glyph) ⇒ Array<Integer>
Returns ligature caret positions for a glyph
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/harfbuzz/ot/layout.rb', line 83 def ligature_carets(font, dir, glyph) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) total = C.hb_ot_layout_get_ligature_carets(font.ptr, dir, glyph, 0, count_ptr, nil) return [] if total.zero? carets_ptr = FFI::MemoryPointer.new(:int32, total) count_ptr.write_uint(total) C.hb_ot_layout_get_ligature_carets(font.ptr, dir, glyph, 0, count_ptr, carets_ptr) carets_ptr.read_array_of_int32(count_ptr.read_uint) end |
.required_feature(face, table_tag, script_index, language_index) ⇒ Array?
Returns [feature_index, feature_tag] for the required feature, or nil
188 189 190 191 192 193 194 195 196 197 |
# File 'lib/harfbuzz/ot/layout.rb', line 188 def required_feature(face, table_tag, script_index, language_index) idx_ptr = FFI::MemoryPointer.new(:uint) tag_ptr = FFI::MemoryPointer.new(:uint32) found = C.from_hb_bool( C.hb_ot_layout_language_get_required_feature( face.ptr, table_tag, script_index, language_index, idx_ptr, tag_ptr ) ) found ? [idx_ptr.read_uint, tag_ptr.read_uint32] : nil end |
.required_feature_index(face, table_tag, script_index, language_index) ⇒ Integer?
Returns the required feature index for a language, or nil if none
172 173 174 175 176 177 178 179 180 |
# File 'lib/harfbuzz/ot/layout.rb', line 172 def required_feature_index(face, table_tag, script_index, language_index) idx_ptr = FFI::MemoryPointer.new(:uint) found = C.from_hb_bool( C.hb_ot_layout_language_get_required_feature_index( face.ptr, table_tag, script_index, language_index, idx_ptr ) ) found ? idx_ptr.read_uint : nil end |
.script_tags(face, table_tag) ⇒ Array<Integer>
Returns the script tags for a table
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/harfbuzz/ot/layout.rb', line 49 def (face, table_tag) count_ptr = FFI::MemoryPointer.new(:uint) count_ptr.write_uint(0) C.(face.ptr, table_tag, 0, count_ptr, nil) count = count_ptr.read_uint return [] if count.zero? = FFI::MemoryPointer.new(:uint32, count) count_ptr.write_uint(count) C.(face.ptr, table_tag, 0, count_ptr, ) .read_array_of_uint32(count_ptr.read_uint) end |
.select_language(face, table_tag, script_index, language_tags) ⇒ Array
Selects the best matching language, returns [found, language_index]
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/harfbuzz/ot/layout.rb', line 153 def select_language(face, table_tag, script_index, ) = FFI::MemoryPointer.new(:uint32, .size) .put_array_of_uint32(0, ) lang_idx_ptr = FFI::MemoryPointer.new(:uint) found = C.from_hb_bool( C.hb_ot_layout_script_select_language( face.ptr, table_tag, script_index, .size, , lang_idx_ptr ) ) [found, lang_idx_ptr.read_uint] end |
.select_script(face, table_tag, script_tags) ⇒ Array
Selects the best matching script from a list
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/harfbuzz/ot/layout.rb', line 113 def select_script(face, table_tag, ) = FFI::MemoryPointer.new(:uint32, .size) .put_array_of_uint32(0, ) idx_ptr = FFI::MemoryPointer.new(:uint) chosen_tag_ptr = FFI::MemoryPointer.new(:uint32) exact = C.from_hb_bool( C.hb_ot_layout_table_select_script( face.ptr, table_tag, .size, , idx_ptr, chosen_tag_ptr ) ) [exact, idx_ptr.read_uint, chosen_tag_ptr.read_uint32] end |
.size_params(face) ⇒ Hash?
Returns size design parameters for the face
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/harfbuzz/ot/layout.rb', line 284 def size_params(face) design_size_ptr = FFI::MemoryPointer.new(:uint) subfamily_id_ptr = FFI::MemoryPointer.new(:uint) name_id_ptr = FFI::MemoryPointer.new(:uint) range_start_ptr = FFI::MemoryPointer.new(:uint) range_end_ptr = FFI::MemoryPointer.new(:uint) found = C.from_hb_bool( C.hb_ot_layout_get_size_params( face.ptr, design_size_ptr, subfamily_id_ptr, name_id_ptr, range_start_ptr, range_end_ptr ) ) return nil unless found { design_size: design_size_ptr.read_uint, subfamily_id: subfamily_id_ptr.read_uint, subfamily_name_id: name_id_ptr.read_uint, range_start: range_start_ptr.read_uint, range_end: range_end_ptr.read_uint } end |
.tag_to_language(tag) ⇒ FFI::Pointer
Converts an OT tag to a language pointer
561 562 563 |
# File 'lib/harfbuzz/ot/layout.rb', line 561 def tag_to_language(tag) C.hb_ot_tag_to_language(tag) end |
.tag_to_script(tag) ⇒ Integer
Converts an OT tag to a script value
568 569 570 |
# File 'lib/harfbuzz/ot/layout.rb', line 568 def tag_to_script(tag) C.hb_ot_tag_to_script(tag) end |
.tags_from_script_and_language(script, language) ⇒ Array<Array<Integer>>
Converts script+language to OT tags
533 534 535 536 537 538 539 540 541 542 543 544 545 |
# File 'lib/harfbuzz/ot/layout.rb', line 533 def (script, language) s_count = FFI::MemoryPointer.new(:uint) l_count = FFI::MemoryPointer.new(:uint) s_count.write_uint(8) l_count.write_uint(8) = FFI::MemoryPointer.new(:uint32, 8) = FFI::MemoryPointer.new(:uint32, 8) C.(script, language, s_count, , l_count, ) [ .read_array_of_uint32(s_count.read_uint), .read_array_of_uint32(l_count.read_uint) ] end |
.tags_to_script_and_language(script_tag, language_tag) ⇒ Array
Converts OT tags to script + language
551 552 553 554 555 556 |
# File 'lib/harfbuzz/ot/layout.rb', line 551 def (script_tag, language_tag) script_ptr = FFI::MemoryPointer.new(:uint32) lang_ptr = FFI::MemoryPointer.new(:pointer) C.(script_tag, language_tag, script_ptr, lang_ptr) [script_ptr.read_uint32, lang_ptr.read_pointer] end |