harfbuzz-ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +12 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +258 -0
  5. data/Rakefile +8 -0
  6. data/benchmark/shaping_bench.rb +77 -0
  7. data/examples/basic_shaping.rb +67 -0
  8. data/examples/glyph_outlines.rb +79 -0
  9. data/examples/opentype_features.rb +91 -0
  10. data/examples/render_svg.rb +112 -0
  11. data/examples/render_waterfall.rb +177 -0
  12. data/examples/variable_fonts.rb +73 -0
  13. data/lib/harfbuzz/aat/layout.rb +78 -0
  14. data/lib/harfbuzz/blob.rb +136 -0
  15. data/lib/harfbuzz/buffer.rb +497 -0
  16. data/lib/harfbuzz/c/aat/layout.rb +15 -0
  17. data/lib/harfbuzz/c/base.rb +114 -0
  18. data/lib/harfbuzz/c/blob.rb +23 -0
  19. data/lib/harfbuzz/c/buffer.rb +127 -0
  20. data/lib/harfbuzz/c/common.rb +39 -0
  21. data/lib/harfbuzz/c/draw.rb +22 -0
  22. data/lib/harfbuzz/c/enums.rb +146 -0
  23. data/lib/harfbuzz/c/face.rb +37 -0
  24. data/lib/harfbuzz/c/font.rb +88 -0
  25. data/lib/harfbuzz/c/font_funcs.rb +58 -0
  26. data/lib/harfbuzz/c/map.rb +28 -0
  27. data/lib/harfbuzz/c/ot/color.rb +32 -0
  28. data/lib/harfbuzz/c/ot/font.rb +7 -0
  29. data/lib/harfbuzz/c/ot/layout.rb +83 -0
  30. data/lib/harfbuzz/c/ot/math.rb +23 -0
  31. data/lib/harfbuzz/c/ot/meta.rb +10 -0
  32. data/lib/harfbuzz/c/ot/metrics.rb +16 -0
  33. data/lib/harfbuzz/c/ot/name.rb +13 -0
  34. data/lib/harfbuzz/c/ot/shape.rb +10 -0
  35. data/lib/harfbuzz/c/ot/var.rb +22 -0
  36. data/lib/harfbuzz/c/paint.rb +38 -0
  37. data/lib/harfbuzz/c/set.rb +42 -0
  38. data/lib/harfbuzz/c/shape.rb +11 -0
  39. data/lib/harfbuzz/c/shape_plan.rb +24 -0
  40. data/lib/harfbuzz/c/structs.rb +120 -0
  41. data/lib/harfbuzz/c/subset.rb +49 -0
  42. data/lib/harfbuzz/c/unicode.rb +40 -0
  43. data/lib/harfbuzz/c/version.rb +25 -0
  44. data/lib/harfbuzz/draw_funcs.rb +112 -0
  45. data/lib/harfbuzz/error.rb +27 -0
  46. data/lib/harfbuzz/face.rb +186 -0
  47. data/lib/harfbuzz/feature.rb +76 -0
  48. data/lib/harfbuzz/flags.rb +85 -0
  49. data/lib/harfbuzz/font.rb +404 -0
  50. data/lib/harfbuzz/font_funcs.rb +286 -0
  51. data/lib/harfbuzz/glyph_info.rb +35 -0
  52. data/lib/harfbuzz/glyph_position.rb +41 -0
  53. data/lib/harfbuzz/library.rb +98 -0
  54. data/lib/harfbuzz/map.rb +157 -0
  55. data/lib/harfbuzz/ot/color.rb +125 -0
  56. data/lib/harfbuzz/ot/font.rb +16 -0
  57. data/lib/harfbuzz/ot/layout.rb +583 -0
  58. data/lib/harfbuzz/ot/math.rb +111 -0
  59. data/lib/harfbuzz/ot/meta.rb +34 -0
  60. data/lib/harfbuzz/ot/metrics.rb +54 -0
  61. data/lib/harfbuzz/ot/name.rb +81 -0
  62. data/lib/harfbuzz/ot/shape.rb +34 -0
  63. data/lib/harfbuzz/ot/var.rb +116 -0
  64. data/lib/harfbuzz/paint_funcs.rb +134 -0
  65. data/lib/harfbuzz/set.rb +272 -0
  66. data/lib/harfbuzz/shape_plan.rb +115 -0
  67. data/lib/harfbuzz/shaping_result.rb +94 -0
  68. data/lib/harfbuzz/subset.rb +130 -0
  69. data/lib/harfbuzz/unicode_funcs.rb +201 -0
  70. data/lib/harfbuzz/variation.rb +49 -0
  71. data/lib/harfbuzz/version.rb +5 -0
  72. data/lib/harfbuzz-ffi.rb +4 -0
  73. data/lib/harfbuzz.rb +313 -0
  74. data/sig/harfbuzz.rbs +594 -0
  75. metadata +132 -0
@@ -0,0 +1,127 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_buffer_create, [], :hb_buffer_t
6
+ attach_function :hb_buffer_create_similar, [:hb_buffer_t], :hb_buffer_t
7
+ attach_function :hb_buffer_destroy, [:hb_buffer_t], :void
8
+ attach_function :hb_buffer_reference, [:hb_buffer_t], :hb_buffer_t
9
+ attach_function :hb_buffer_get_empty, [], :hb_buffer_t
10
+ attach_function :hb_buffer_reset, [:hb_buffer_t], :void
11
+ attach_function :hb_buffer_clear_contents, [:hb_buffer_t], :void
12
+ attach_function :hb_buffer_pre_allocate, [:hb_buffer_t, :uint], :hb_bool_t
13
+ attach_function :hb_buffer_allocation_successful, [:hb_buffer_t], :hb_bool_t
14
+
15
+ attach_function :hb_buffer_add, [:hb_buffer_t, :hb_codepoint_t, :uint], :void
16
+ attach_function :hb_buffer_add_utf8,
17
+ [:hb_buffer_t, :pointer, :int, :uint, :int], :void
18
+ attach_function :hb_buffer_add_utf16,
19
+ [:hb_buffer_t, :pointer, :int, :uint, :int], :void
20
+ attach_function :hb_buffer_add_utf32,
21
+ [:hb_buffer_t, :pointer, :int, :uint, :int], :void
22
+ attach_function :hb_buffer_add_latin1,
23
+ [:hb_buffer_t, :pointer, :int, :uint, :int], :void
24
+ attach_function :hb_buffer_add_codepoints,
25
+ [:hb_buffer_t, :pointer, :int, :uint, :int], :void
26
+ attach_function :hb_buffer_append,
27
+ [:hb_buffer_t, :hb_buffer_t, :uint, :uint], :void
28
+
29
+ attach_function :hb_buffer_set_content_type,
30
+ [:hb_buffer_t, :hb_buffer_content_type_t], :void
31
+ attach_function :hb_buffer_get_content_type,
32
+ [:hb_buffer_t], :hb_buffer_content_type_t
33
+
34
+ attach_function :hb_buffer_set_unicode_funcs,
35
+ [:hb_buffer_t, :hb_unicode_funcs_t], :void
36
+ attach_function :hb_buffer_get_unicode_funcs,
37
+ [:hb_buffer_t], :hb_unicode_funcs_t
38
+
39
+ attach_function :hb_buffer_set_direction,
40
+ [:hb_buffer_t, :hb_direction_t], :void
41
+ attach_function :hb_buffer_get_direction,
42
+ [:hb_buffer_t], :hb_direction_t
43
+
44
+ attach_function :hb_buffer_set_script, [:hb_buffer_t, :uint32], :void
45
+ attach_function :hb_buffer_get_script, [:hb_buffer_t], :uint32
46
+
47
+ attach_function :hb_buffer_set_language, [:hb_buffer_t, :pointer], :void
48
+ attach_function :hb_buffer_get_language, [:hb_buffer_t], :pointer
49
+
50
+ attach_function :hb_buffer_set_segment_properties,
51
+ [:hb_buffer_t, :pointer], :void
52
+ attach_function :hb_buffer_get_segment_properties,
53
+ [:hb_buffer_t, :pointer], :void
54
+ attach_function :hb_buffer_guess_segment_properties, [:hb_buffer_t], :void
55
+
56
+ attach_function :hb_buffer_set_flags, [:hb_buffer_t, :uint], :void
57
+ attach_function :hb_buffer_get_flags, [:hb_buffer_t], :uint
58
+
59
+ attach_function :hb_buffer_set_cluster_level,
60
+ [:hb_buffer_t, :hb_buffer_cluster_level_t], :void
61
+ attach_function :hb_buffer_get_cluster_level,
62
+ [:hb_buffer_t], :hb_buffer_cluster_level_t
63
+
64
+ attach_function :hb_buffer_set_replacement_codepoint,
65
+ [:hb_buffer_t, :hb_codepoint_t], :void
66
+ attach_function :hb_buffer_get_replacement_codepoint,
67
+ [:hb_buffer_t], :hb_codepoint_t
68
+
69
+ attach_function :hb_buffer_set_invisible_glyph,
70
+ [:hb_buffer_t, :hb_codepoint_t], :void
71
+ attach_function :hb_buffer_get_invisible_glyph,
72
+ [:hb_buffer_t], :hb_codepoint_t
73
+
74
+ attach_function :hb_buffer_set_not_found_glyph,
75
+ [:hb_buffer_t, :hb_codepoint_t], :void
76
+ attach_function :hb_buffer_get_not_found_glyph,
77
+ [:hb_buffer_t], :hb_codepoint_t
78
+
79
+ # hb_buffer_{set,get}_random_state requires HarfBuzz >= 7.2.0
80
+ begin
81
+ attach_function :hb_buffer_set_random_state, [:hb_buffer_t, :uint], :void
82
+ attach_function :hb_buffer_get_random_state, [:hb_buffer_t], :uint
83
+ rescue FFI::NotFoundError
84
+ # Not available in this version of HarfBuzz
85
+ end
86
+
87
+ attach_function :hb_buffer_set_length, [:hb_buffer_t, :uint], :hb_bool_t
88
+ attach_function :hb_buffer_get_length, [:hb_buffer_t], :uint
89
+
90
+ attach_function :hb_buffer_get_glyph_infos, [:hb_buffer_t, :pointer], :pointer
91
+ attach_function :hb_buffer_get_glyph_positions, [:hb_buffer_t, :pointer], :pointer
92
+ attach_function :hb_buffer_has_positions, [:hb_buffer_t], :hb_bool_t
93
+
94
+ attach_function :hb_buffer_normalize_glyphs, [:hb_buffer_t], :void
95
+ attach_function :hb_buffer_reverse, [:hb_buffer_t], :void
96
+ attach_function :hb_buffer_reverse_range, [:hb_buffer_t, :uint, :uint], :void
97
+ attach_function :hb_buffer_reverse_clusters, [:hb_buffer_t], :void
98
+
99
+ attach_function :hb_buffer_serialize,
100
+ [:hb_buffer_t, :uint, :uint, :pointer, :uint, :pointer,
101
+ :hb_font_t, :hb_buffer_serialize_format_t, :uint], :uint
102
+ attach_function :hb_buffer_serialize_glyphs,
103
+ [:hb_buffer_t, :uint, :uint, :pointer, :uint, :pointer,
104
+ :hb_font_t, :hb_buffer_serialize_format_t, :uint], :uint
105
+ attach_function :hb_buffer_serialize_unicode,
106
+ [:hb_buffer_t, :uint, :uint, :pointer, :uint, :pointer,
107
+ :hb_buffer_serialize_format_t, :uint], :uint
108
+ attach_function :hb_buffer_serialize_format_from_string, [:string, :int],
109
+ :hb_buffer_serialize_format_t
110
+ attach_function :hb_buffer_serialize_format_to_string,
111
+ [:hb_buffer_serialize_format_t], :string
112
+ attach_function :hb_buffer_serialize_list_formats, [], :pointer
113
+
114
+ attach_function :hb_buffer_deserialize_glyphs,
115
+ [:hb_buffer_t, :string, :int, :pointer, :hb_font_t,
116
+ :hb_buffer_serialize_format_t], :hb_bool_t
117
+ attach_function :hb_buffer_deserialize_unicode,
118
+ [:hb_buffer_t, :string, :int, :pointer,
119
+ :hb_buffer_serialize_format_t], :hb_bool_t
120
+
121
+ attach_function :hb_buffer_diff,
122
+ [:hb_buffer_t, :hb_buffer_t, :hb_codepoint_t, :uint], :uint
123
+
124
+ attach_function :hb_buffer_set_message_func,
125
+ [:hb_buffer_t, :pointer, :pointer, :pointer], :void
126
+ end
127
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ # hb_tag_t utilities
6
+ attach_function :hb_tag_from_string, [:string, :int], :hb_tag_t
7
+ attach_function :hb_tag_to_string, [:hb_tag_t, :pointer], :void
8
+
9
+ # hb_direction_t utilities
10
+ attach_function :hb_direction_from_string, [:string, :int], :hb_direction_t
11
+ attach_function :hb_direction_to_string, [:hb_direction_t], :string
12
+
13
+ # hb_language_t utilities
14
+ attach_function :hb_language_from_string, [:string, :int], :pointer
15
+ attach_function :hb_language_to_string, [:pointer], :string
16
+ attach_function :hb_language_get_default, [], :pointer
17
+ attach_function :hb_language_matches, [:pointer, :pointer], :hb_bool_t
18
+
19
+ # hb_script_t utilities
20
+ attach_function :hb_script_from_iso15924_tag, [:hb_tag_t], :uint32
21
+ attach_function :hb_script_from_string, [:string, :int], :uint32
22
+ attach_function :hb_script_to_iso15924_tag, [:uint32], :hb_tag_t
23
+ attach_function :hb_script_get_horizontal_direction, [:uint32], :hb_direction_t
24
+
25
+ # hb_feature_t utilities
26
+ attach_function :hb_feature_from_string, [:string, :int, :pointer], :hb_bool_t
27
+ attach_function :hb_feature_to_string, [:pointer, :pointer, :uint], :void
28
+
29
+ # hb_variation_t utilities
30
+ attach_function :hb_variation_from_string, [:string, :int, :pointer], :hb_bool_t
31
+ attach_function :hb_variation_to_string, [:pointer, :pointer, :uint], :void
32
+
33
+ # hb_color_t utilities
34
+ attach_function :hb_color_get_alpha, [:hb_color_t], :uint8
35
+ attach_function :hb_color_get_red, [:hb_color_t], :uint8
36
+ attach_function :hb_color_get_green, [:hb_color_t], :uint8
37
+ attach_function :hb_color_get_blue, [:hb_color_t], :uint8
38
+ end
39
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_draw_funcs_create, [], :hb_draw_funcs_t
6
+ attach_function :hb_draw_funcs_destroy, [:hb_draw_funcs_t], :void
7
+ attach_function :hb_draw_funcs_reference, [:hb_draw_funcs_t], :hb_draw_funcs_t
8
+ attach_function :hb_draw_funcs_is_immutable, [:hb_draw_funcs_t], :hb_bool_t
9
+ attach_function :hb_draw_funcs_make_immutable, [:hb_draw_funcs_t], :void
10
+
11
+ attach_function :hb_draw_funcs_set_move_to_func,
12
+ [:hb_draw_funcs_t, :pointer, :pointer, :pointer], :void
13
+ attach_function :hb_draw_funcs_set_line_to_func,
14
+ [:hb_draw_funcs_t, :pointer, :pointer, :pointer], :void
15
+ attach_function :hb_draw_funcs_set_quadratic_to_func,
16
+ [:hb_draw_funcs_t, :pointer, :pointer, :pointer], :void
17
+ attach_function :hb_draw_funcs_set_cubic_to_func,
18
+ [:hb_draw_funcs_t, :pointer, :pointer, :pointer], :void
19
+ attach_function :hb_draw_funcs_set_close_path_func,
20
+ [:hb_draw_funcs_t, :pointer, :pointer, :pointer], :void
21
+ end
22
+ end
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ # hb_memory_mode_t
6
+ MemoryMode = enum :hb_memory_mode_t, [
7
+ :duplicate, 0,
8
+ :readonly,
9
+ :writable,
10
+ :readonly_may_make_writable
11
+ ]
12
+
13
+ # hb_direction_t
14
+ Direction = enum :hb_direction_t, [
15
+ :invalid, 0,
16
+ :ltr, 4,
17
+ :rtl, 5,
18
+ :ttb, 6,
19
+ :btt, 7
20
+ ]
21
+
22
+ # hb_buffer_content_type_t
23
+ BufferContentType = enum :hb_buffer_content_type_t, [
24
+ :invalid, 0,
25
+ :unicode,
26
+ :glyphs
27
+ ]
28
+
29
+ # hb_buffer_cluster_level_t
30
+ BufferClusterLevel = enum :hb_buffer_cluster_level_t, [
31
+ :monotone_graphemes, 0,
32
+ :monotone_characters, 1,
33
+ :characters, 2
34
+ ]
35
+
36
+ # hb_buffer_serialize_format_t
37
+ BufferSerializeFormat = enum :hb_buffer_serialize_format_t, [
38
+ :text, 0x54455854,
39
+ :json, 0x4A534F4E,
40
+ :invalid, 0x00000000
41
+ ]
42
+
43
+ # hb_unicode_general_category_t
44
+ UnicodeGeneralCategory = enum :hb_unicode_general_category_t, [
45
+ :control, 0, :format, 1,
46
+ :unassigned, 2, :private_use, 3,
47
+ :surrogate, 4, :lowercase_letter, 5,
48
+ :modifier_letter, 6, :other_letter, 7,
49
+ :titlecase_letter, 8, :uppercase_letter, 9,
50
+ :spacing_mark, 10, :enclosing_mark, 11,
51
+ :non_spacing_mark, 12, :decimal_number, 13,
52
+ :letter_number, 14, :other_number, 15,
53
+ :connect_punctuation, 16, :dash_punctuation, 17,
54
+ :close_punctuation, 18, :final_punctuation, 19,
55
+ :initial_punctuation, 20, :other_punctuation, 21,
56
+ :open_punctuation, 22, :currency_symbol, 23,
57
+ :modifier_symbol, 24, :math_symbol, 25,
58
+ :other_symbol, 26, :line_separator, 27,
59
+ :paragraph_separator, 28, :space_separator, 29
60
+ ]
61
+
62
+ # hb_ot_layout_glyph_class_t
63
+ OtLayoutGlyphClass = enum :hb_ot_layout_glyph_class_t, [
64
+ :unclassified, 0, :base_glyph, 1,
65
+ :ligature, 2, :mark, 3, :component, 4
66
+ ]
67
+
68
+ # hb_ot_meta_tag_t
69
+ OtMetaTag = enum :hb_ot_meta_tag_t, [
70
+ :design_languages, 0x646C6E67,
71
+ :supported_languages, 0x736C6E67
72
+ ]
73
+
74
+ # hb_paint_composite_mode_t
75
+ PaintCompositeMode = enum :hb_paint_composite_mode_t, [
76
+ :clear, 0, :src, :dest, :src_over, :dest_over,
77
+ :src_in, :dest_in, :src_out, :dest_out,
78
+ :src_atop, :dest_atop, :xor, :plus,
79
+ :screen, :overlay, :darken, :lighten,
80
+ :color_dodge, :color_burn, :hard_light, :soft_light,
81
+ :difference, :exclusion, :multiply,
82
+ :hsl_hue, :hsl_saturation, :hsl_color, :hsl_luminosity
83
+ ]
84
+
85
+ # === Bit Flag Constants ===
86
+
87
+ # hb_buffer_flags_t
88
+ BUFFER_FLAG_DEFAULT = 0x00000000
89
+ BUFFER_FLAG_BOT = 0x00000001
90
+ BUFFER_FLAG_EOT = 0x00000002
91
+ BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004
92
+ BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES = 0x00000008
93
+ BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE = 0x00000010
94
+ BUFFER_FLAG_VERIFY = 0x00000020
95
+ BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT = 0x00000040
96
+ BUFFER_FLAG_PRODUCE_SAFE_TO_INSERT_TATWEEL = 0x00000080
97
+ BUFFER_FLAG_DEFINED = 0x000000FF
98
+
99
+ # hb_buffer_serialize_flags_t
100
+ BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000
101
+ BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001
102
+ BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002
103
+ BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004
104
+ BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008
105
+ BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010
106
+ BUFFER_SERIALIZE_FLAG_NO_ADVANCES = 0x00000020
107
+
108
+ # hb_buffer_diff_flags_t
109
+ BUFFER_DIFF_FLAG_EQUAL = 0x0000
110
+ BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH = 0x0001
111
+ BUFFER_DIFF_FLAG_LENGTH_MISMATCH = 0x0002
112
+ BUFFER_DIFF_FLAG_NOTDEF_PRESENT = 0x0004
113
+ BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT = 0x0008
114
+ BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH = 0x0010
115
+ BUFFER_DIFF_FLAG_CLUSTER_MISMATCH = 0x0020
116
+ BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH = 0x0040
117
+ BUFFER_DIFF_FLAG_POSITION_MISMATCH = 0x0080
118
+
119
+ # hb_glyph_flags_t
120
+ GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001
121
+ GLYPH_FLAG_UNSAFE_TO_CONCAT = 0x00000002
122
+ GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL = 0x00000004
123
+ GLYPH_FLAG_DEFINED = 0x00000007
124
+
125
+ # hb_ot_var_axis_flags_t
126
+ OT_VAR_AXIS_FLAG_HIDDEN = 0x0001
127
+
128
+ # hb_ot_color_palette_flags_t
129
+ OT_COLOR_PALETTE_FLAG_DEFAULT = 0x0000
130
+ OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BG = 0x0001
131
+ OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BG = 0x0002
132
+
133
+ # hb_subset_flags_t
134
+ SUBSET_FLAGS_DEFAULT = 0x0000
135
+ SUBSET_FLAGS_NO_HINTING = 0x0001
136
+ SUBSET_FLAGS_RETAIN_GIDS = 0x0002
137
+ SUBSET_FLAGS_DESUBROUTINIZE = 0x0004
138
+ SUBSET_FLAGS_NAME_LEGACY = 0x0008
139
+ SUBSET_FLAGS_SET_OVERLAPS_FLAG = 0x0010
140
+ SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED = 0x0020
141
+ SUBSET_FLAGS_NOTDEF_OUTLINE = 0x0040
142
+ SUBSET_FLAGS_GLYPH_NAMES = 0x0080
143
+ SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES = 0x0100
144
+ SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS = 0x0200
145
+ end
146
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_face_create, [:hb_blob_t, :uint], :hb_face_t
6
+ attach_function :hb_face_create_for_tables, [:pointer, :pointer, :pointer], :hb_face_t
7
+ attach_function :hb_face_destroy, [:hb_face_t], :void
8
+ attach_function :hb_face_reference, [:hb_face_t], :hb_face_t
9
+ attach_function :hb_face_get_empty, [], :hb_face_t
10
+ attach_function :hb_face_count, [:hb_blob_t], :uint
11
+
12
+ attach_function :hb_face_get_index, [:hb_face_t], :uint
13
+ attach_function :hb_face_set_index, [:hb_face_t, :uint], :void
14
+ attach_function :hb_face_get_upem, [:hb_face_t], :uint
15
+ attach_function :hb_face_set_upem, [:hb_face_t, :uint], :void
16
+ attach_function :hb_face_get_glyph_count, [:hb_face_t], :uint
17
+ attach_function :hb_face_set_glyph_count, [:hb_face_t, :uint], :void
18
+
19
+ attach_function :hb_face_get_table_tags, [:hb_face_t, :uint, :pointer, :pointer], :uint
20
+ attach_function :hb_face_reference_table, [:hb_face_t, :hb_tag_t], :hb_blob_t
21
+ attach_function :hb_face_reference_blob, [:hb_face_t], :hb_blob_t
22
+
23
+ attach_function :hb_face_is_immutable, [:hb_face_t], :hb_bool_t
24
+ attach_function :hb_face_make_immutable, [:hb_face_t], :void
25
+
26
+ attach_function :hb_face_collect_unicodes, [:hb_face_t, :hb_set_t], :void
27
+ attach_function :hb_face_collect_nominal_glyph_mapping,
28
+ [:hb_face_t, :hb_map_t, :hb_set_t], :void
29
+ attach_function :hb_face_collect_variation_selectors, [:hb_face_t, :hb_set_t], :void
30
+ attach_function :hb_face_collect_variation_unicodes,
31
+ [:hb_face_t, :hb_codepoint_t, :hb_set_t], :void
32
+
33
+ attach_function :hb_face_set_user_data,
34
+ [:hb_face_t, :pointer, :pointer, :pointer, :hb_bool_t], :hb_bool_t
35
+ attach_function :hb_face_get_user_data, [:hb_face_t, :pointer], :pointer
36
+ end
37
+ end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_font_create, [:hb_face_t], :hb_font_t
6
+ attach_function :hb_font_create_sub_font, [:hb_font_t], :hb_font_t
7
+ attach_function :hb_font_destroy, [:hb_font_t], :void
8
+ attach_function :hb_font_reference, [:hb_font_t], :hb_font_t
9
+ attach_function :hb_font_get_empty, [], :hb_font_t
10
+
11
+ attach_function :hb_font_get_face, [:hb_font_t], :hb_face_t
12
+ attach_function :hb_font_set_face, [:hb_font_t, :hb_face_t], :void
13
+
14
+ attach_function :hb_font_set_funcs,
15
+ [:hb_font_t, :hb_font_funcs_t, :pointer, :pointer], :void
16
+
17
+ attach_function :hb_font_get_scale, [:hb_font_t, :pointer, :pointer], :void
18
+ attach_function :hb_font_set_scale, [:hb_font_t, :int, :int], :void
19
+ attach_function :hb_font_get_ppem, [:hb_font_t, :pointer, :pointer], :void
20
+ attach_function :hb_font_set_ppem, [:hb_font_t, :uint, :uint], :void
21
+ attach_function :hb_font_get_ptem, [:hb_font_t], :float
22
+ attach_function :hb_font_set_ptem, [:hb_font_t, :float], :void
23
+
24
+ attach_function :hb_font_set_synthetic_bold, [:hb_font_t, :float, :float, :hb_bool_t], :void
25
+ attach_function :hb_font_get_synthetic_bold, [:hb_font_t, :pointer, :pointer, :pointer], :void
26
+ attach_function :hb_font_set_synthetic_slant, [:hb_font_t, :float], :void
27
+ attach_function :hb_font_get_synthetic_slant, [:hb_font_t], :float
28
+
29
+ attach_function :hb_font_set_variations, [:hb_font_t, :pointer, :uint], :void
30
+ attach_function :hb_font_set_variation, [:hb_font_t, :hb_tag_t, :float], :void
31
+
32
+ attach_function :hb_font_set_var_coords_design, [:hb_font_t, :pointer, :uint], :void
33
+ attach_function :hb_font_get_var_coords_design, [:hb_font_t, :pointer], :pointer
34
+ attach_function :hb_font_set_var_coords_normalized, [:hb_font_t, :pointer, :uint], :void
35
+ attach_function :hb_font_get_var_coords_normalized, [:hb_font_t, :pointer], :pointer
36
+
37
+ attach_function :hb_font_is_immutable, [:hb_font_t], :hb_bool_t
38
+ attach_function :hb_font_make_immutable, [:hb_font_t], :void
39
+
40
+ attach_function :hb_font_get_glyph,
41
+ [:hb_font_t, :hb_codepoint_t, :hb_codepoint_t, :pointer], :hb_bool_t
42
+ attach_function :hb_font_get_nominal_glyph,
43
+ [:hb_font_t, :hb_codepoint_t, :pointer], :hb_bool_t
44
+ attach_function :hb_font_get_nominal_glyphs,
45
+ [:hb_font_t, :uint, :pointer, :uint, :pointer, :uint], :uint
46
+ attach_function :hb_font_get_variation_glyph,
47
+ [:hb_font_t, :hb_codepoint_t, :hb_codepoint_t, :pointer], :hb_bool_t
48
+
49
+ attach_function :hb_font_get_glyph_h_advance, [:hb_font_t, :hb_codepoint_t], :hb_position_t
50
+ attach_function :hb_font_get_glyph_v_advance, [:hb_font_t, :hb_codepoint_t], :hb_position_t
51
+ attach_function :hb_font_get_glyph_advance_for_direction,
52
+ [:hb_font_t, :hb_codepoint_t, :hb_direction_t, :pointer, :pointer], :void
53
+ attach_function :hb_font_get_glyph_h_advances,
54
+ [:hb_font_t, :uint, :pointer, :uint, :pointer, :uint], :void
55
+ attach_function :hb_font_get_glyph_v_advances,
56
+ [:hb_font_t, :uint, :pointer, :uint, :pointer, :uint], :void
57
+
58
+ attach_function :hb_font_get_glyph_h_origin,
59
+ [:hb_font_t, :hb_codepoint_t, :pointer, :pointer], :hb_bool_t
60
+ attach_function :hb_font_get_glyph_v_origin,
61
+ [:hb_font_t, :hb_codepoint_t, :pointer, :pointer], :hb_bool_t
62
+
63
+ attach_function :hb_font_get_glyph_h_kerning,
64
+ [:hb_font_t, :hb_codepoint_t, :hb_codepoint_t], :hb_position_t
65
+
66
+ attach_function :hb_font_get_glyph_extents,
67
+ [:hb_font_t, :hb_codepoint_t, :pointer], :hb_bool_t
68
+ attach_function :hb_font_get_glyph_contour_point,
69
+ [:hb_font_t, :hb_codepoint_t, :uint, :pointer, :pointer], :hb_bool_t
70
+
71
+ attach_function :hb_font_get_glyph_name,
72
+ [:hb_font_t, :hb_codepoint_t, :pointer, :uint], :hb_bool_t
73
+ attach_function :hb_font_get_glyph_from_name,
74
+ [:hb_font_t, :string, :int, :pointer], :hb_bool_t
75
+
76
+ attach_function :hb_font_get_extents_for_direction,
77
+ [:hb_font_t, :hb_direction_t, :pointer], :void
78
+
79
+ attach_function :hb_font_draw_glyph,
80
+ [:hb_font_t, :hb_codepoint_t, :hb_draw_funcs_t, :pointer], :void
81
+ attach_function :hb_font_paint_glyph,
82
+ [:hb_font_t, :hb_codepoint_t, :hb_paint_funcs_t, :pointer, :uint, :hb_color_t], :void
83
+
84
+ attach_function :hb_font_set_user_data,
85
+ [:hb_font_t, :pointer, :pointer, :pointer, :hb_bool_t], :hb_bool_t
86
+ attach_function :hb_font_get_user_data, [:hb_font_t, :pointer], :pointer
87
+ end
88
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_font_funcs_create, [], :hb_font_funcs_t
6
+ attach_function :hb_font_funcs_destroy, [:hb_font_funcs_t], :void
7
+ attach_function :hb_font_funcs_reference, [:hb_font_funcs_t], :hb_font_funcs_t
8
+ attach_function :hb_font_funcs_get_empty, [], :hb_font_funcs_t
9
+ attach_function :hb_font_funcs_is_immutable, [:hb_font_funcs_t], :hb_bool_t
10
+ attach_function :hb_font_funcs_make_immutable, [:hb_font_funcs_t], :void
11
+
12
+ # Callback setter signatures:
13
+ # Each takes (funcs, callback, user_data, destroy_notify)
14
+ # We use :pointer for the callback and nil/NULL for user_data/destroy.
15
+
16
+ attach_function :hb_font_funcs_set_font_h_extents_func,
17
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
18
+
19
+ attach_function :hb_font_funcs_set_font_v_extents_func,
20
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
21
+
22
+ attach_function :hb_font_funcs_set_nominal_glyph_func,
23
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
24
+
25
+ attach_function :hb_font_funcs_set_variation_glyph_func,
26
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
27
+
28
+ attach_function :hb_font_funcs_set_glyph_h_advance_func,
29
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
30
+
31
+ attach_function :hb_font_funcs_set_glyph_v_advance_func,
32
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
33
+
34
+ attach_function :hb_font_funcs_set_glyph_h_origin_func,
35
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
36
+
37
+ attach_function :hb_font_funcs_set_glyph_v_origin_func,
38
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
39
+
40
+ attach_function :hb_font_funcs_set_glyph_h_kerning_func,
41
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
42
+
43
+ attach_function :hb_font_funcs_set_glyph_extents_func,
44
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
45
+
46
+ attach_function :hb_font_funcs_set_glyph_contour_point_func,
47
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
48
+
49
+ attach_function :hb_font_funcs_set_glyph_name_func,
50
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
51
+
52
+ attach_function :hb_font_funcs_set_glyph_from_name_func,
53
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
54
+
55
+ attach_function :hb_font_funcs_set_draw_glyph_func,
56
+ [:hb_font_funcs_t, :pointer, :pointer, :pointer], :void
57
+ end
58
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_map_create, [], :hb_map_t
6
+ attach_function :hb_map_destroy, [:hb_map_t], :void
7
+ attach_function :hb_map_reference, [:hb_map_t], :hb_map_t
8
+ attach_function :hb_map_get_empty, [], :hb_map_t
9
+ attach_function :hb_map_clear, [:hb_map_t], :void
10
+ attach_function :hb_map_is_empty, [:hb_map_t], :hb_bool_t
11
+ attach_function :hb_map_get_population, [:hb_map_t], :uint
12
+ attach_function :hb_map_has, [:hb_map_t, :hb_codepoint_t], :hb_bool_t
13
+ attach_function :hb_map_get, [:hb_map_t, :hb_codepoint_t], :hb_codepoint_t
14
+ attach_function :hb_map_set, [:hb_map_t, :hb_codepoint_t, :hb_codepoint_t], :void
15
+ attach_function :hb_map_del, [:hb_map_t, :hb_codepoint_t], :void
16
+ attach_function :hb_map_is_equal, [:hb_map_t, :hb_map_t], :hb_bool_t
17
+ attach_function :hb_map_hash, [:hb_map_t], :uint
18
+ attach_function :hb_map_allocation_successful, [:hb_map_t], :hb_bool_t
19
+ attach_function :hb_map_keys, [:hb_map_t, :hb_set_t], :void
20
+ attach_function :hb_map_values, [:hb_map_t, :hb_set_t], :void
21
+ attach_function :hb_map_next, [:hb_map_t, :pointer, :pointer, :pointer], :hb_bool_t
22
+ attach_function :hb_map_update, [:hb_map_t, :hb_map_t], :void
23
+
24
+ attach_function :hb_map_set_user_data,
25
+ [:hb_map_t, :pointer, :pointer, :pointer, :hb_bool_t], :hb_bool_t
26
+ attach_function :hb_map_get_user_data, [:hb_map_t, :pointer], :pointer
27
+ end
28
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_ot_color_has_palettes, [:hb_face_t], :hb_bool_t
6
+ attach_function :hb_ot_color_palette_get_count, [:hb_face_t], :uint
7
+ attach_function :hb_ot_color_palette_get_name_id,
8
+ [:hb_face_t, :uint], :hb_ot_name_id_t
9
+ attach_function :hb_ot_color_palette_color_get_name_id,
10
+ [:hb_face_t, :uint], :hb_ot_name_id_t
11
+ attach_function :hb_ot_color_palette_get_flags,
12
+ [:hb_face_t, :uint], :uint
13
+ attach_function :hb_ot_color_palette_get_colors,
14
+ [:hb_face_t, :uint, :uint, :pointer, :pointer], :uint
15
+
16
+ attach_function :hb_ot_color_has_layers, [:hb_face_t], :hb_bool_t
17
+ attach_function :hb_ot_color_glyph_get_layers,
18
+ [:hb_face_t, :hb_codepoint_t, :uint, :pointer, :pointer], :uint
19
+
20
+ attach_function :hb_ot_color_has_svg, [:hb_face_t], :hb_bool_t
21
+ attach_function :hb_ot_color_glyph_reference_svg,
22
+ [:hb_face_t, :hb_codepoint_t], :hb_blob_t
23
+
24
+ attach_function :hb_ot_color_has_png, [:hb_face_t], :hb_bool_t
25
+ attach_function :hb_ot_color_glyph_reference_png,
26
+ [:hb_font_t, :hb_codepoint_t], :hb_blob_t
27
+
28
+ attach_function :hb_ot_color_has_paint, [:hb_face_t], :hb_bool_t
29
+ attach_function :hb_ot_color_glyph_has_paint,
30
+ [:hb_face_t, :hb_codepoint_t], :hb_bool_t
31
+ end
32
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_ot_font_set_funcs, [:hb_font_t], :void
6
+ end
7
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HarfBuzz
4
+ module C
5
+ attach_function :hb_ot_layout_has_glyph_classes, [:hb_face_t], :hb_bool_t
6
+ attach_function :hb_ot_layout_has_substitution, [:hb_face_t], :hb_bool_t
7
+ attach_function :hb_ot_layout_has_positioning, [:hb_face_t], :hb_bool_t
8
+
9
+ attach_function :hb_ot_layout_get_glyph_class,
10
+ [:hb_face_t, :hb_codepoint_t], :hb_ot_layout_glyph_class_t
11
+ attach_function :hb_ot_layout_get_glyphs_in_class,
12
+ [:hb_face_t, :hb_ot_layout_glyph_class_t, :hb_set_t], :void
13
+
14
+ attach_function :hb_ot_layout_get_attach_points,
15
+ [:hb_face_t, :hb_codepoint_t, :uint, :pointer, :pointer], :uint
16
+ attach_function :hb_ot_layout_get_ligature_carets,
17
+ [:hb_font_t, :hb_direction_t, :hb_codepoint_t, :uint, :pointer, :pointer], :uint
18
+
19
+ attach_function :hb_ot_layout_table_get_script_tags,
20
+ [:hb_face_t, :hb_tag_t, :uint, :pointer, :pointer], :uint
21
+ attach_function :hb_ot_layout_table_find_script,
22
+ [:hb_face_t, :hb_tag_t, :hb_tag_t, :pointer], :hb_bool_t
23
+ attach_function :hb_ot_layout_table_select_script,
24
+ [:hb_face_t, :hb_tag_t, :uint, :pointer, :pointer, :pointer], :hb_bool_t
25
+ attach_function :hb_ot_layout_table_get_feature_tags,
26
+ [:hb_face_t, :hb_tag_t, :uint, :pointer, :pointer], :uint
27
+
28
+ attach_function :hb_ot_layout_script_get_language_tags,
29
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :pointer, :pointer], :uint
30
+ attach_function :hb_ot_layout_script_select_language,
31
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :pointer, :pointer], :hb_bool_t
32
+
33
+ attach_function :hb_ot_layout_language_get_required_feature_index,
34
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :pointer], :hb_bool_t
35
+ attach_function :hb_ot_layout_language_get_required_feature,
36
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :pointer, :pointer], :hb_bool_t
37
+ attach_function :hb_ot_layout_language_get_feature_indexes,
38
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :uint, :pointer, :pointer], :uint
39
+ attach_function :hb_ot_layout_language_get_feature_tags,
40
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :uint, :pointer, :pointer], :uint
41
+ attach_function :hb_ot_layout_language_find_feature,
42
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :hb_tag_t, :pointer], :hb_bool_t
43
+
44
+ attach_function :hb_ot_layout_feature_get_lookups,
45
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :pointer, :pointer], :uint
46
+ attach_function :hb_ot_layout_collect_lookups,
47
+ [:hb_face_t, :hb_tag_t, :pointer, :pointer, :pointer, :hb_set_t], :void
48
+ attach_function :hb_ot_layout_collect_features,
49
+ [:hb_face_t, :hb_tag_t, :pointer, :pointer, :pointer, :hb_set_t], :void
50
+
51
+ attach_function :hb_ot_layout_get_size_params,
52
+ [:hb_face_t, :pointer, :pointer, :pointer, :pointer, :pointer], :hb_bool_t
53
+ attach_function :hb_ot_layout_feature_get_name_ids,
54
+ [:hb_face_t, :hb_tag_t, :uint, :pointer, :pointer, :pointer, :pointer, :pointer], :hb_bool_t
55
+ attach_function :hb_ot_layout_feature_get_characters,
56
+ [:hb_face_t, :hb_tag_t, :uint, :uint, :pointer, :pointer], :uint
57
+
58
+ attach_function :hb_ot_layout_get_baseline,
59
+ [:hb_font_t, :uint, :hb_direction_t, :uint32, :pointer, :pointer], :hb_bool_t
60
+ attach_function :hb_ot_layout_get_baseline_with_fallback,
61
+ [:hb_font_t, :uint, :hb_direction_t, :uint32, :pointer, :pointer], :void
62
+ attach_function :hb_ot_layout_get_font_extents,
63
+ [:hb_font_t, :hb_direction_t, :uint32, :pointer, :pointer], :hb_bool_t
64
+
65
+ # "2" variants: use hb_script_t + hb_language_t (enum + opaque pointer)
66
+ attach_function :hb_ot_layout_get_baseline2,
67
+ [:hb_font_t, :uint, :hb_direction_t, :uint32, :pointer, :pointer], :hb_bool_t
68
+ attach_function :hb_ot_layout_get_baseline_with_fallback2,
69
+ [:hb_font_t, :uint, :hb_direction_t, :uint32, :pointer, :pointer], :void
70
+ attach_function :hb_ot_layout_get_font_extents2,
71
+ [:hb_font_t, :hb_direction_t, :uint32, :pointer, :pointer], :hb_bool_t
72
+
73
+ attach_function :hb_ot_layout_get_horizontal_baseline_tag_for_script,
74
+ [:uint32], :uint
75
+
76
+ attach_function :hb_ot_tags_from_script_and_language,
77
+ [:uint32, :pointer, :pointer, :pointer, :pointer, :pointer], :void
78
+ attach_function :hb_ot_tags_to_script_and_language,
79
+ [:hb_tag_t, :hb_tag_t, :pointer, :pointer], :void
80
+ attach_function :hb_ot_tag_to_language, [:hb_tag_t], :pointer
81
+ attach_function :hb_ot_tag_to_script, [:hb_tag_t], :uint32
82
+ end
83
+ end