提交 2c2a2b97 编写于 作者: E Ebrahim Byagowi

[meta] Rename hb_ot_meta_t to hb_ot_meta_tag_t

上级 7bcc5dfa
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* https://docs.microsoft.com/en-us/typography/opentype/spec/meta * https://docs.microsoft.com/en-us/typography/opentype/spec/meta
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html
*/ */
#define HB_OT_TAG_meta HB_TAG('m','e','t','a') #define HB_OT_TAG_meta HB_TAG ('m','e','t','a')
namespace OT { namespace OT {
...@@ -78,15 +78,15 @@ struct meta ...@@ -78,15 +78,15 @@ struct meta
hb_blob_t *reference_entry (hb_tag_t tag) const hb_blob_t *reference_entry (hb_tag_t tag) const
{ return table->dataMaps.lsearch (tag).reference_entry (table.get_blob ()); } { return table->dataMaps.lsearch (tag).reference_entry (table.get_blob ()); }
unsigned int get_entries (unsigned int start_offset, unsigned int get_entries (unsigned int start_offset,
unsigned int *count, unsigned int *count,
hb_ot_meta_t *entries) const hb_ot_meta_tag_t *entries) const
{ {
if (count) if (count)
{ {
hb_array_t<const DataMap> arr = table->dataMaps.sub_array (start_offset, count); hb_array_t<const DataMap> arr = table->dataMaps.sub_array (start_offset, count);
for (unsigned int i = 0; i < arr.length; i++) for (unsigned int i = 0; i < arr.length; i++)
entries[i] = (hb_ot_meta_t) arr[i].get_tag (); entries[i] = (hb_ot_meta_tag_t) arr[i].get_tag ();
} }
return table->dataMaps.len; return table->dataMaps.len;
} }
......
...@@ -49,10 +49,10 @@ ...@@ -49,10 +49,10 @@
* Since: REPLACEME * Since: REPLACEME
**/ **/
unsigned int unsigned int
hb_ot_meta_get_entries (hb_face_t *face, hb_ot_meta_get_entries (hb_face_t *face,
unsigned int start_offset, unsigned int start_offset,
unsigned int *entries_count, /* IN/OUT. May be NULL. */ unsigned int *entries_count, /* IN/OUT. May be NULL. */
hb_ot_meta_t *entries /* OUT. May be NULL. */) hb_ot_meta_tag_t *entries /* OUT. May be NULL. */)
{ {
return face->table.meta->get_entries (start_offset, entries_count, entries); return face->table.meta->get_entries (start_offset, entries_count, entries);
} }
...@@ -69,7 +69,7 @@ hb_ot_meta_get_entries (hb_face_t *face, ...@@ -69,7 +69,7 @@ hb_ot_meta_get_entries (hb_face_t *face,
* Since: REPLACEME * Since: REPLACEME
**/ **/
hb_blob_t * hb_blob_t *
hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_t meta_tag) hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_tag_t meta_tag)
{ {
return face->table.meta->reference_entry (meta_tag); return face->table.meta->reference_entry (meta_tag);
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
HB_BEGIN_DECLS HB_BEGIN_DECLS
/** /**
* hb_ot_meta_t: * hb_ot_meta_tag_t:
* *
* From https://docs.microsoft.com/en-us/typography/opentype/spec/meta * From https://docs.microsoft.com/en-us/typography/opentype/spec/meta
* *
...@@ -49,16 +49,16 @@ typedef enum { ...@@ -49,16 +49,16 @@ typedef enum {
HB_OT_META_SUPPORTED_LANGUAGES= HB_TAG ('s','l','n','g'), HB_OT_META_SUPPORTED_LANGUAGES= HB_TAG ('s','l','n','g'),
_HB_OT_META_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/ _HB_OT_META_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_ot_meta_t; } hb_ot_meta_tag_t;
HB_EXTERN unsigned int HB_EXTERN unsigned int
hb_ot_meta_get_entries (hb_face_t *face, hb_ot_meta_get_entries (hb_face_t *face,
unsigned int start_offset, unsigned int start_offset,
unsigned int *entries_count, /* IN/OUT. May be NULL. */ unsigned int *entries_count, /* IN/OUT. May be NULL. */
hb_ot_meta_t *entries /* OUT. May be NULL. */); hb_ot_meta_tag_t *entries /* OUT. May be NULL. */);
HB_EXTERN hb_blob_t * HB_EXTERN hb_blob_t *
hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_t meta_tag); hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_tag_t meta_tag);
HB_END_DECLS HB_END_DECLS
......
...@@ -50,8 +50,8 @@ main (int argc, char **argv) ...@@ -50,8 +50,8 @@ main (int argc, char **argv)
#ifndef HB_NO_META #ifndef HB_NO_META
count = hb_ot_meta_get_entries (face, 0, nullptr, nullptr); count = hb_ot_meta_get_entries (face, 0, nullptr, nullptr);
hb_ot_meta_t *tags = (hb_ot_meta_t *) hb_ot_meta_tag_t *tags = (hb_ot_meta_tag_t *)
malloc (sizeof (hb_ot_meta_t) * count); malloc (sizeof (hb_ot_meta_tag_t) * count);
hb_ot_meta_get_entries (face, 0, &count, tags); hb_ot_meta_get_entries (face, 0, &count, tags);
for (unsigned i = 0; i < count; ++i) for (unsigned i = 0; i < count; ++i)
{ {
......
...@@ -32,7 +32,7 @@ static void ...@@ -32,7 +32,7 @@ static void
test_ot_meta_get_entries (void) test_ot_meta_get_entries (void)
{ {
hb_face_t *face = hb_test_open_font_file ("fonts/meta.ttf"); hb_face_t *face = hb_test_open_font_file ("fonts/meta.ttf");
hb_ot_meta_t entries[2]; hb_ot_meta_tag_t entries[2];
unsigned int entries_count = 2; unsigned int entries_count = 2;
g_assert_cmpint (hb_ot_meta_get_entries (face, 0, &entries_count, entries), ==, 5); g_assert_cmpint (hb_ot_meta_get_entries (face, 0, &entries_count, entries), ==, 5);
...@@ -61,10 +61,10 @@ test_ot_meta_reference_entry (void) ...@@ -61,10 +61,10 @@ test_ot_meta_reference_entry (void)
g_assert_cmpint (hb_blob_get_length (dlng), ==, 8); g_assert_cmpint (hb_blob_get_length (dlng), ==, 8);
g_assert_cmpmem (hb_blob_get_data (dlng, NULL), 8, "ar,de,fa", 8); g_assert_cmpmem (hb_blob_get_data (dlng, NULL), 8, "ar,de,fa", 8);
hb_blob_destroy (dlng); hb_blob_destroy (dlng);
hb_blob_t *fslf = hb_ot_meta_reference_entry (face, (hb_ot_meta_t) HB_TAG ('f','s','l','f')); hb_blob_t *fslf = hb_ot_meta_reference_entry (face, (hb_ot_meta_tag_t) HB_TAG ('f','s','l','f'));
g_assert_cmpint (hb_blob_get_length (fslf), ==, 12); g_assert_cmpint (hb_blob_get_length (fslf), ==, 12);
hb_blob_destroy (fslf); hb_blob_destroy (fslf);
hb_blob_t *nacl = hb_ot_meta_reference_entry (face, (hb_ot_meta_t) HB_TAG ('n','a','c','l')); hb_blob_t *nacl = hb_ot_meta_reference_entry (face, (hb_ot_meta_tag_t) HB_TAG ('n','a','c','l'));
g_assert_cmpint (hb_blob_get_length (nacl), ==, 0); g_assert_cmpint (hb_blob_get_length (nacl), ==, 0);
hb_blob_destroy (nacl); hb_blob_destroy (nacl);
hb_blob_t *slng = hb_ot_meta_reference_entry (face, HB_OT_META_SUPPORTED_LANGUAGES); hb_blob_t *slng = hb_ot_meta_reference_entry (face, HB_OT_META_SUPPORTED_LANGUAGES);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册