提交 62932c14 编写于 作者: E Ebrahim Byagowi 提交者: Behdad Esfahbod

[meta] Rename ot-metadata to ot-meta per review

上级 821d9e90
......@@ -608,9 +608,10 @@ hb_ot_math_get_glyph_assembly
</SECTION>
<SECTION>
<FILE>hb-ot-metadata</FILE>
hb_ot_metadata_reference_entry
hb_ot_metadata_t
<FILE>hb-ot-meta</FILE>
hb_ot_meta_t
hb_ot_meta_get_entries
hb_ot_meta_reference_entry
</SECTION>
<SECTION>
......
......@@ -332,7 +332,7 @@ noinst_PROGRAMS = \
main \
test \
test-buffer-serialize \
test-ot-metadata \
test-ot-meta \
test-ot-name \
test-gpos-size-params \
test-gsub-would-substitute \
......@@ -351,9 +351,9 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
test_buffer_serialize_CPPFLAGS = $(HBCFLAGS)
test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS)
test_ot_metadata_SOURCES = test-ot-metadata.cc
test_ot_metadata_CPPFLAGS = $(HBCFLAGS)
test_ot_metadata_LDADD = libharfbuzz.la $(HBLIBS)
test_ot_meta_SOURCES = test-ot-meta.cc
test_ot_meta_CPPFLAGS = $(HBCFLAGS)
test_ot_meta_LDADD = libharfbuzz.la $(HBLIBS)
test_ot_name_SOURCES = test-ot-name.cc
test_ot_name_CPPFLAGS = $(HBCFLAGS)
......
......@@ -89,7 +89,7 @@ HB_BASE_sources = \
hb-ot-math.cc \
hb-ot-maxp-table.hh \
hb-ot-meta-table.hh \
hb-ot-metadata.cc \
hb-ot-meta.cc \
hb-ot-metrics.cc \
hb-ot-metrics.hh \
hb-ot-name-language-static.hh \
......@@ -195,7 +195,7 @@ HB_BASE_headers = \
hb-ot-font.h \
hb-ot-layout.h \
hb-ot-math.h \
hb-ot-metadata.h \
hb-ot-meta.h \
hb-ot-metrics.h \
hb-ot-name.h \
hb-ot-shape.h \
......
......@@ -16,7 +16,7 @@
#include "hb-ot-layout.cc"
#include "hb-ot-map.cc"
#include "hb-ot-math.cc"
#include "hb-ot-metadata.cc"
#include "hb-ot-meta.cc"
#include "hb-ot-metrics.cc"
#include "hb-ot-name.cc"
#include "hb-ot-shape-complex-arabic.cc"
......
......@@ -78,15 +78,15 @@ struct meta
hb_blob_t *reference_entry (hb_tag_t tag) const
{ return table->dataMaps.lsearch (tag, Null (DataMap)).reference_entry (table.get_blob ()); }
unsigned int get_entries (unsigned int start_offset,
unsigned int *count,
hb_ot_metadata_t *entries) const
unsigned int get_entries (unsigned int start_offset,
unsigned int *count,
hb_ot_meta_t *entries) const
{
if (count && *count)
{
hb_array_t<const DataMap> array = table->dataMaps.sub_array (start_offset, count);
for (unsigned int i = 0; i < *count; i++)
entries[i] = (hb_ot_metadata_t) array[i].get_tag ();
entries[i] = (hb_ot_meta_t) array[i].get_tag ();
}
return table->dataMaps.len;
}
......
......@@ -29,8 +29,8 @@
#include "hb-ot-meta-table.hh"
/**
* SECTION:hb-ot-metadata
* @title: hb-ot-metadata
* SECTION:hb-ot-meta
* @title: hb-ot-meta
* @short_description: OpenType Metadata
* @include: hb-ot.h
*
......@@ -38,7 +38,7 @@
**/
/**
* hb_ot_metadata_reference_entry:
* hb_ot_meta_reference_entry:
* @face: a face object
* @start_offset: iteration's start offset
* @entries_count:(inout) (allow-none): buffer size as input, filled size as output
......@@ -49,18 +49,18 @@
* Since: REPLACEME
**/
unsigned int
hb_ot_metadata_get_entries (hb_face_t *face,
unsigned int start_offset,
unsigned int *entries_count, /* IN/OUT. May be NULL. */
hb_ot_metadata_t *entries /* OUT. May be NULL. */)
hb_ot_meta_get_entries (hb_face_t *face,
unsigned int start_offset,
unsigned int *entries_count, /* IN/OUT. May be NULL. */
hb_ot_meta_t *entries /* OUT. May be NULL. */)
{
return face->table.meta->get_entries (start_offset, entries_count, entries);
}
/**
* hb_ot_metadata_reference_entry:
* hb_ot_meta_reference_entry:
* @face: a #hb_face_t object.
* @metadata_tag: tag of metadata you like to have.
* @meta_tag: tag of metadata you like to have.
*
* It fetches metadata entry of a given tag from a font.
*
......@@ -69,9 +69,9 @@ hb_ot_metadata_get_entries (hb_face_t *face,
* Since: REPLACEME
**/
hb_blob_t *
hb_ot_metadata_reference_entry (hb_face_t *face, hb_ot_metadata_t metadata_tag)
hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_t meta_tag)
{
return face->table.meta->reference_entry (metadata_tag);
return face->table.meta->reference_entry (meta_tag);
}
#endif
......@@ -26,15 +26,15 @@
#error "Include <hb-ot.h> instead."
#endif
#ifndef HB_OT_METADATA_H
#define HB_OT_METADATA_H
#ifndef HB_OT_META_H
#define HB_OT_META_H
#include "hb.h"
HB_BEGIN_DECLS
/**
* hb_ot_metadata_t:
* hb_ot_meta_t:
*
* From https://docs.microsoft.com/en-us/typography/opentype/spec/meta
*
......@@ -42,24 +42,24 @@ HB_BEGIN_DECLS
**/
typedef enum {
/*
HB_OT_METADATA_APPL = HB_TAG ('a','p','p','l'),
HB_OT_METADATA_BILD = HB_TAG ('b','i','l','d'),
HB_OT_META_APPL = HB_TAG ('a','p','p','l'),
HB_OT_META_BILD = HB_TAG ('b','i','l','d'),
*/
HB_OT_METADATA_DESIGN_LANGUAGES = HB_TAG ('d','l','n','g'),
HB_OT_METADATA_SUPPORTED_LANGUAGES = HB_TAG ('s','l','n','g'),
HB_OT_META_DESIGN_LANGUAGES = HB_TAG ('d','l','n','g'),
HB_OT_META_SUPPORTED_LANGUAGES= HB_TAG ('s','l','n','g'),
_HB_OT_METADATA_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_ot_metadata_t;
_HB_OT_META_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_ot_meta_t;
HB_EXTERN unsigned int
hb_ot_metadata_get_entries (hb_face_t *face,
unsigned int start_offset,
unsigned int *entries_count, /* IN/OUT. May be NULL. */
hb_ot_metadata_t *entries /* OUT. May be NULL. */);
hb_ot_meta_get_entries (hb_face_t *face,
unsigned int start_offset,
unsigned int *entries_count, /* IN/OUT. May be NULL. */
hb_ot_meta_t *entries /* OUT. May be NULL. */);
HB_EXTERN hb_blob_t *
hb_ot_metadata_reference_entry (hb_face_t *face, hb_ot_metadata_t metadata_tag);
hb_ot_meta_reference_entry (hb_face_t *face, hb_ot_meta_t meta_tag);
HB_END_DECLS
#endif /* HB_OT_METADATA_H */
#endif /* HB_OT_META_H */
......@@ -35,7 +35,7 @@
#include "hb-ot-font.h"
#include "hb-ot-layout.h"
#include "hb-ot-math.h"
#include "hb-ot-metadata.h"
#include "hb-ot-meta.h"
#include "hb-ot-metrics.h"
#include "hb-ot-name.h"
#include "hb-ot-shape.h"
......
......@@ -48,14 +48,14 @@ main (int argc, char **argv)
unsigned int count = 0;
#ifndef HB_NO_META
count = hb_ot_metadata_get_entries (face, 0, nullptr, nullptr);
count = hb_ot_meta_get_entries (face, 0, nullptr, nullptr);
hb_ot_metadata_t *tags = (hb_ot_metadata_t *)
malloc (sizeof (hb_ot_metadata_t) * count);
hb_ot_metadata_get_entries (face, 0, &count, tags);
hb_ot_meta_t *tags = (hb_ot_meta_t *)
malloc (sizeof (hb_ot_meta_t) * count);
hb_ot_meta_get_entries (face, 0, &count, tags);
for (unsigned i = 0; i < count; ++i)
{
hb_blob_t *entry = hb_ot_metadata_reference_entry (face, tags[i]);
hb_blob_t *entry = hb_ot_meta_reference_entry (face, tags[i]);
printf ("%c%c%c%c, size: %d: %.*s\n",
HB_UNTAG (tags[i]), hb_blob_get_length (entry),
hb_blob_get_length (entry), hb_blob_get_data (entry, nullptr));
......
......@@ -84,7 +84,7 @@ TEST_PROGS += \
test-ot-color \
test-ot-ligature-carets \
test-ot-name \
test-ot-metadata \
test-ot-meta \
test-ot-metrics \
test-ot-tag \
test-ot-extents-cff \
......
......@@ -26,27 +26,27 @@
#include <hb-ot.h>
/* Unit tests for hb-ot-metadata.h */
/* Unit tests for hb-ot-meta.h */
static void
test_ot_metadata_get_entries (void)
test_ot_meta_get_entries (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/meta.ttf");
hb_ot_metadata_t entries[2];
hb_ot_meta_t entries[2];
unsigned int entries_count = 2;
g_assert_cmpint (hb_ot_metadata_get_entries (face, 0, &entries_count, entries), ==, 5);
g_assert_cmpint (hb_ot_meta_get_entries (face, 0, &entries_count, entries), ==, 5);
g_assert_cmpint (entries_count, ==, 2);
g_assert_cmpint (entries[0], ==, HB_TAG ('a','p','p','l'));
g_assert_cmpint (entries[1], ==, HB_TAG ('b','i','l','d'));
entries_count = 1;
g_assert_cmpint (hb_ot_metadata_get_entries (face, 2, &entries_count, entries), ==, 5);
g_assert_cmpint (hb_ot_meta_get_entries (face, 2, &entries_count, entries), ==, 5);
g_assert_cmpint (entries_count, ==, 1);
g_assert_cmpint (entries[0], ==, HB_TAG ('d','l','n','g'));
entries_count = 2;
g_assert_cmpint (hb_ot_metadata_get_entries (face, 4, &entries_count, entries), ==, 5);
g_assert_cmpint (hb_ot_meta_get_entries (face, 4, &entries_count, entries), ==, 5);
g_assert_cmpint (entries_count, ==, 1);
g_assert_cmpint (entries[0], ==, HB_TAG ('s','l','n','g'));
......@@ -54,20 +54,20 @@ test_ot_metadata_get_entries (void)
}
static void
test_ot_metadata_reference_entry (void)
test_ot_meta_reference_entry (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/meta.ttf");
hb_blob_t *dlng = hb_ot_metadata_reference_entry (face, HB_OT_METADATA_DESIGN_LANGUAGES);
hb_blob_t *dlng = hb_ot_meta_reference_entry (face, HB_OT_META_DESIGN_LANGUAGES);
g_assert_cmpint (hb_blob_get_length (dlng), ==, 8);
g_assert_cmpmem (hb_blob_get_data (dlng, NULL), 8, "ar,de,fa", 8);
hb_blob_destroy (dlng);
hb_blob_t *fslf = hb_ot_metadata_reference_entry (face, (hb_ot_metadata_t) HB_TAG ('f','s','l','f'));
hb_blob_t *fslf = hb_ot_meta_reference_entry (face, (hb_ot_meta_t) HB_TAG ('f','s','l','f'));
g_assert_cmpint (hb_blob_get_length (fslf), ==, 12);
hb_blob_destroy (fslf);
hb_blob_t *nacl = hb_ot_metadata_reference_entry (face, (hb_ot_metadata_t) HB_TAG ('n','a','c','l'));
hb_blob_t *nacl = hb_ot_meta_reference_entry (face, (hb_ot_meta_t) HB_TAG ('n','a','c','l'));
g_assert_cmpint (hb_blob_get_length (nacl), ==, 0);
hb_blob_destroy (nacl);
hb_blob_t *slng = hb_ot_metadata_reference_entry (face, HB_OT_METADATA_SUPPORTED_LANGUAGES);
hb_blob_t *slng = hb_ot_meta_reference_entry (face, HB_OT_META_SUPPORTED_LANGUAGES);
g_assert_cmpint (hb_blob_get_length (slng), ==, 11);
g_assert_cmpmem (hb_blob_get_data (slng, NULL), 11, "ar,de,en,fa", 11);
hb_blob_destroy (slng);
......@@ -78,7 +78,7 @@ int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
hb_test_add (test_ot_metadata_get_entries);
hb_test_add (test_ot_metadata_reference_entry);
hb_test_add (test_ot_meta_get_entries);
hb_test_add (test_ot_meta_reference_entry);
return hb_test_run ();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册