Skip to content

Commit 5078044

Browse files
committed
[use] Add dump-use-data
1 parent 15ba4fb commit 5078044

File tree

6 files changed

+47
-5
lines changed

6 files changed

+47
-5
lines changed

src/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ check_PROGRAMS += \
355355
dump-indic-data \
356356
dump-khmer-data \
357357
dump-myanmar-data \
358+
dump-use-data \
358359
$(NULL)
359360
dump_indic_data_SOURCES = dump-indic-data.cc hb-ot-shape-complex-indic-table.cc
360361
dump_indic_data_CPPFLAGS = $(HBCFLAGS)
@@ -365,6 +366,9 @@ dump_khmer_data_LDADD = libharfbuzz.la $(HBLIBS)
365366
dump_myanmar_data_SOURCES = dump-myanmar-data.cc hb-ot-shape-complex-indic-table.cc
366367
dump_myanmar_data_CPPFLAGS = $(HBCFLAGS)
367368
dump_myanmar_data_LDADD = libharfbuzz.la $(HBLIBS)
369+
dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc
370+
dump_use_data_CPPFLAGS = $(HBCFLAGS)
371+
dump_use_data_LDADD = libharfbuzz.la $(HBLIBS)
368372

369373
check_PROGRAMS += test-ot-tag
370374
TESTS += test-ot-tag

src/dump-use-data.cc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright © 2018 Google, Inc.
3+
*
4+
* This is part of HarfBuzz, a text shaping library.
5+
*
6+
* Permission is hereby granted, without written agreement and without
7+
* license or royalty fees, to use, copy, modify, and distribute this
8+
* software and its documentation for any purpose, provided that the
9+
* above copyright notice and the following two paragraphs appear in
10+
* all copies of this software.
11+
*
12+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13+
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14+
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15+
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16+
* DAMAGE.
17+
*
18+
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19+
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20+
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21+
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22+
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23+
*
24+
* Google Author(s): Behdad Esfahbod
25+
*/
26+
27+
#include "hb-ot-shape-complex-use-private.hh"
28+
29+
int
30+
main (void)
31+
{
32+
for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
33+
{
34+
unsigned int category = hb_use_get_category (u);
35+
if (category != USE_O)
36+
printf("U+%04X %u\n", u, category);
37+
}
38+
}

src/gen-use-table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def print_block (block, start, end, data):
449449
print "}; /* Table items: %d; occupancy: %d%% */" % (offset, occupancy)
450450
print
451451
print "USE_TABLE_ELEMENT_TYPE"
452-
print "hb_use_get_categories (hb_codepoint_t u)"
452+
print "hb_use_get_category (hb_codepoint_t u)"
453453
print "{"
454454
print " switch (u >> %d)" % page_bits
455455
print " {"

src/hb-ot-shape-complex-use-private.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ enum use_category_t {
9292
};
9393

9494
HB_INTERNAL USE_TABLE_ELEMENT_TYPE
95-
hb_use_get_categories (hb_codepoint_t u);
95+
hb_use_get_category (hb_codepoint_t u);
9696

9797
#endif /* HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH */

src/hb-ot-shape-complex-use-table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
690690
}; /* Table items: 5424; occupancy: 73% */
691691

692692
USE_TABLE_ELEMENT_TYPE
693-
hb_use_get_categories (hb_codepoint_t u)
693+
hb_use_get_category (hb_codepoint_t u)
694694
{
695695
switch (u >> 12)
696696
{

src/hb-ot-shape-complex-use.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ setup_masks_use (const hb_ot_shape_plan_t *plan,
262262
unsigned int count = buffer->len;
263263
hb_glyph_info_t *info = buffer->info;
264264
for (unsigned int i = 0; i < count; i++)
265-
info[i].use_category() = hb_use_get_categories (info[i].codepoint);
265+
info[i].use_category() = hb_use_get_category (info[i].codepoint);
266266
}
267267

268268
static void
@@ -505,7 +505,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
505505
hb_glyph_info_t dottedcircle = {0};
506506
if (!font->get_nominal_glyph (0x25CCu, &dottedcircle.codepoint))
507507
return;
508-
dottedcircle.use_category() = hb_use_get_categories (0x25CC);
508+
dottedcircle.use_category() = hb_use_get_category (0x25CC);
509509

510510
buffer->clear_output ();
511511

0 commit comments

Comments
 (0)