提交 350f98ea 编写于 作者: B Behdad Esfahbod

[config] Don't compile name table API if HB_NO_NAME

Part of https://github.com/harfbuzz/harfbuzz/issues/1652
上级 da51a2cb
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "hb.hh" #include "hb.hh"
#ifndef HB_NO_NAME
#include "hb-ot-name-table.hh" #include "hb-ot-name-table.hh"
#include "hb-ot-face.hh" #include "hb-ot-face.hh"
...@@ -58,11 +60,6 @@ const hb_ot_name_entry_t * ...@@ -58,11 +60,6 @@ const hb_ot_name_entry_t *
hb_ot_name_list_names (hb_face_t *face, hb_ot_name_list_names (hb_face_t *face,
unsigned int *num_entries /* OUT */) unsigned int *num_entries /* OUT */)
{ {
#ifdef HB_NO_NAME
if (num_entries)
*num_entries = 0;
return 0;
#endif
const OT::name_accelerator_t &name = *face->table.name; const OT::name_accelerator_t &name = *face->table.name;
if (num_entries) *num_entries = name.names.length; if (num_entries) *num_entries = name.names.length;
return (const hb_ot_name_entry_t *) name.names; return (const hb_ot_name_entry_t *) name.names;
...@@ -172,11 +169,6 @@ hb_ot_name_get_utf8 (hb_face_t *face, ...@@ -172,11 +169,6 @@ hb_ot_name_get_utf8 (hb_face_t *face,
unsigned int *text_size /* IN/OUT */, unsigned int *text_size /* IN/OUT */,
char *text /* OUT */) char *text /* OUT */)
{ {
#ifdef HB_NO_NAME
if (text_size)
*text_size = 0;
return 0;
#endif
return hb_ot_name_get_utf<hb_utf8_t> (face, name_id, language, text_size, return hb_ot_name_get_utf<hb_utf8_t> (face, name_id, language, text_size,
(hb_utf8_t::codepoint_t *) text); (hb_utf8_t::codepoint_t *) text);
} }
...@@ -204,11 +196,6 @@ hb_ot_name_get_utf16 (hb_face_t *face, ...@@ -204,11 +196,6 @@ hb_ot_name_get_utf16 (hb_face_t *face,
unsigned int *text_size /* IN/OUT */, unsigned int *text_size /* IN/OUT */,
uint16_t *text /* OUT */) uint16_t *text /* OUT */)
{ {
#ifdef HB_NO_NAME
if (text_size)
*text_size = 0;
return 0;
#endif
return hb_ot_name_get_utf<hb_utf16_t> (face, name_id, language, text_size, text); return hb_ot_name_get_utf<hb_utf16_t> (face, name_id, language, text_size, text);
} }
...@@ -235,10 +222,8 @@ hb_ot_name_get_utf32 (hb_face_t *face, ...@@ -235,10 +222,8 @@ hb_ot_name_get_utf32 (hb_face_t *face,
unsigned int *text_size /* IN/OUT */, unsigned int *text_size /* IN/OUT */,
uint32_t *text /* OUT */) uint32_t *text /* OUT */)
{ {
#ifdef HB_NO_NAME
if (text_size)
*text_size = 0;
return 0;
#endif
return hb_ot_name_get_utf<hb_utf32_t> (face, name_id, language, text_size, text); return hb_ot_name_get_utf<hb_utf32_t> (face, name_id, language, text_size, text);
} }
#endif
...@@ -43,7 +43,9 @@ main (int argc, char **argv) ...@@ -43,7 +43,9 @@ main (int argc, char **argv)
hb_blob_destroy (blob); hb_blob_destroy (blob);
blob = nullptr; blob = nullptr;
unsigned int count; unsigned int count = 0;
#ifndef HB_NO_NAME
const hb_ot_name_entry_t *entries = hb_ot_name_list_names (face, &count); const hb_ot_name_entry_t *entries = hb_ot_name_list_names (face, &count);
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
...@@ -62,6 +64,7 @@ main (int argc, char **argv) ...@@ -62,6 +64,7 @@ main (int argc, char **argv)
printf ("%s\n", buf); printf ("%s\n", buf);
} }
#endif
hb_face_destroy (face); hb_face_destroy (face);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册