[src] Add test-use-table

Fixes https://github.com/harfbuzz/harfbuzz/issues/3758
pull/3774/head
Behdad Esfahbod 2 years ago
parent e387b3acd3
commit 826639fab2
  1. 5
      src/Makefile.am
  2. 21
      src/gen-use-table.py
  3. 21
      src/hb-ot-shaper-use-table.hh
  4. 1
      src/meson.build
  5. 18
      src/test-use-table.cc

@ -321,6 +321,7 @@ noinst_PROGRAMS = \
test-ot-glyphname \
test-gpos-size-params \
test-gsub-would-substitute \
test-use-table \
$(NULL)
bin_PROGRAMS =
@ -348,6 +349,10 @@ test_ot_glyphname_SOURCES = test-ot-glyphname.cc
test_ot_glyphname_CPPFLAGS = $(HBCFLAGS)
test_ot_glyphname_LDADD = libharfbuzz.la $(HBLIBS)
test_use_table_SOURCES = test-use-table.cc
test_use_table_CPPFLAGS = $(HBCFLAGS)
test_use_table_LDADD = libharfbuzz.la $(HBLIBS)
test_gpos_size_params_SOURCES = test-gpos-size-params.cc
test_gpos_size_params_CPPFLAGS = $(HBCFLAGS)
test_gpos_size_params_LDADD = libharfbuzz.la $(HBLIBS)

@ -497,27 +497,6 @@ for k,v in sorted(use_positions.items()):
tag = k + suf
print ("#undef %s" % tag)
print ()
print (r"""
#ifdef HB_USE_TABLE_MAIN
int main (int argc, char **argv)
{
if (argc != 2)
{
for (unsigned u = 0; u < 0x10FFFFu; u++)
printf ("U+%04X %d\n", u, hb_use_get_category (u));
return 0;
}
hb_codepoint_t u;
sscanf (argv[1], "%x", &u);
printf ("%d\n", hb_use_get_category (u));
return 0;
}
#endif
""")
print ()
print ("#endif /* HB_OT_SHAPER_USE_TABLE_HH */")
print ("/* == End of generated table == */")

@ -393,26 +393,5 @@ hb_use_get_category (unsigned u)
#undef VMPre
#ifdef HB_USE_TABLE_MAIN
int main (int argc, char **argv)
{
if (argc != 2)
{
for (unsigned u = 0; u < 0x10FFFFu; u++)
printf ("U+%04X %d\n", u, hb_use_get_category (u));
return 0;
}
hb_codepoint_t u;
sscanf (argv[1], "%x", &u);
printf ("%d\n", hb_use_get_category (u));
return 0;
}
#endif
#endif /* HB_OT_SHAPER_USE_TABLE_HH */
/* == End of generated table == */

@ -558,6 +558,7 @@ if get_option('tests').enabled()
'test-ot-glyphname': 'test-ot-glyphname.cc',
'test-ot-gpos-size-params': 'test-gpos-size-params.cc',
'test-ot-gsub-would-substitute': 'test-gsub-would-substitute.cc',
'test-use-table': 'test-use-table.cc',
}
foreach name, source : noinst_programs
executable(name, source,

@ -0,0 +1,18 @@
#include "hb-ot-shaper-use-table.hh"
int main (int argc, char **argv)
{
if (argc != 2)
{
for (unsigned u = 0; u < 0x10FFFFu; u++)
printf ("U+%04X %d\n", u, hb_use_get_category (u));
return 0;
}
hb_codepoint_t u;
sscanf (argv[1], "%x", &u);
printf ("%d\n", hb_use_get_category (u));
return 0;
}
Loading…
Cancel
Save