From a157b3e4ebd57ad29f217c4cef6519e7398cfa5c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 1 Nov 2018 19:56:16 +0330 Subject: [PATCH] [feat] Apply @behdad comments --- src/Makefile.sources | 2 +- src/hb-aat-layout-feat-table.hh | 1 + src/hb-aat-layout.cc | 16 ++++++++-------- src/hb-aat-layout.hh | 2 +- src/hb-aat-map.hh | 2 +- src/{hb-aat-layout.h => hb-aat.h} | 22 +++++++++++++--------- src/hb-ot.h | 1 + test/api/test-aat-layout.c | 14 +++++++------- test/api/test-c.c | 1 - 9 files changed, 33 insertions(+), 28 deletions(-) rename src/{hb-aat-layout.h => hb-aat.h} (78%) diff --git a/src/Makefile.sources b/src/Makefile.sources index 2635cbc..e0dee94 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -189,7 +189,7 @@ HB_OT_headers = \ hb-ot-name.h \ hb-ot-shape.h \ hb-ot-var.h \ - hb-aat-layout.h \ + hb-aat.h \ $(NULL) # Optional Sources and Headers with external deps diff --git a/src/hb-aat-layout-feat-table.hh b/src/hb-aat-layout-feat-table.hh index 37c35af..14ce990 100644 --- a/src/hb-aat-layout-feat-table.hh +++ b/src/hb-aat-layout-feat-table.hh @@ -45,6 +45,7 @@ struct SettingName return_trace (likely (c->check_struct (this))); } + public: HBUINT16 setting; /* The setting. */ NameID nameIndex; /* The name table index for the setting's name. */ public: diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 5b72e2d..04f4d6e 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -28,7 +28,7 @@ #include "hb-open-type.hh" #include "hb-ot-face.hh" -#include "hb-aat-layout.h" +#include "hb-aat.h" #include "hb-aat-layout.hh" #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. @@ -307,7 +307,7 @@ _hb_aat_language_get (hb_face_t *face, } /** - * hb_aat_get_feature_settings: + * hb_aat_layout_get_feature_settings: * @face: a font face. * @identifier: AAT feature id you are querying, for example 1 for * "Ligatures" feature, 37 for the "Lower Case" feature, @@ -323,12 +323,12 @@ _hb_aat_language_get (hb_face_t *face, * Since: REPLACEME */ unsigned int -hb_aat_get_feature_settings (hb_face_t *face, - hb_aat_feature_type_t identifier, - hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */ - unsigned int start_offset, - unsigned int *records_count, /* IN/OUT. May be NULL. */ - hb_aat_feature_type_selector_t *records_buffer /* OUT. May be NULL. */) +hb_aat_layout_get_feature_settings (hb_face_t *face, + hb_aat_feature_type_t identifier, + hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */ + unsigned int start_offset, + unsigned int *records_count, /* IN/OUT. May be NULL. */ + hb_aat_feature_type_selector_t *records_buffer /* OUT. May be NULL. */) { return _get_feat (face).get_settings (identifier, default_setting, start_offset, records_count, records_buffer); diff --git a/src/hb-aat-layout.hh b/src/hb-aat-layout.hh index d7296aa..a87ef20 100644 --- a/src/hb-aat-layout.hh +++ b/src/hb-aat-layout.hh @@ -29,7 +29,7 @@ #include "hb.hh" -#include "hb-aat-layout.h" +#include "hb-aat.h" #include "hb-ot-shape.hh" diff --git a/src/hb-aat-map.hh b/src/hb-aat-map.hh index 07720e8..77f9114 100644 --- a/src/hb-aat-map.hh +++ b/src/hb-aat-map.hh @@ -28,7 +28,7 @@ #define HB_AAT_MAP_HH #include "hb.hh" -#include "hb-aat-layout.h" +#include "hb-aat.h" struct hb_aat_map_t diff --git a/src/hb-aat-layout.h b/src/hb-aat.h similarity index 78% rename from src/hb-aat-layout.h rename to src/hb-aat.h index 83517e5..b71f67c 100644 --- a/src/hb-aat-layout.h +++ b/src/hb-aat.h @@ -22,8 +22,12 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -#ifndef HB_AAT_LAYOUT_H -#define HB_AAT_LAYOUT_H +#ifndef HB_OT_H_IN +#error "Include instead." +#endif + +#ifndef HB_AAT_H +#define HB_AAT_H #include "hb.h" #include "hb-ot.h" @@ -67,13 +71,13 @@ typedef struct hb_aat_feature_type_selector_t #define HB_AAT_FEATURE_NO_DEFAULT_SETTING ((hb_aat_feature_setting_t) -1) HB_EXTERN unsigned int -hb_aat_get_feature_settings (hb_face_t *face, - hb_aat_feature_type_t type, - hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */ - unsigned int start_offset, - unsigned int *records_count, /* IN/OUT. May be NULL. */ - hb_aat_feature_type_selector_t *records_buffer /* OUT. May be NULL. */); +hb_aat_layout_get_feature_settings (hb_face_t *face, + hb_aat_feature_type_t type, + hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */ + unsigned int start_offset, + unsigned int *records_count, /* IN/OUT. May be NULL. */ + hb_aat_feature_type_selector_t *records_buffer /* OUT. May be NULL. */); HB_END_DECLS -#endif /* HB_AAT_LAYOUT_H */ +#endif /* HB_AAT_H */ diff --git a/src/hb-ot.h b/src/hb-ot.h index c168175..d4f1d3a 100644 --- a/src/hb-ot.h +++ b/src/hb-ot.h @@ -37,6 +37,7 @@ #include "hb-ot-name.h" #include "hb-ot-shape.h" #include "hb-ot-var.h" +#include "hb-aat.h" HB_BEGIN_DECLS diff --git a/test/api/test-aat-layout.c b/test/api/test-aat-layout.c index 1d6b775..854b58a 100644 --- a/test/api/test-aat-layout.c +++ b/test/api/test-aat-layout.c @@ -24,9 +24,9 @@ #include "hb-test.h" -#include +#include -/* Unit tests for hb-aat-layout.h */ +/* Unit tests for hb-aat.h */ static void test_aat_get_feature_settings (void) @@ -37,7 +37,7 @@ test_aat_get_feature_settings (void) hb_face_t *face = hb_test_open_font_file ("fonts/aat-feat.ttf"); - g_assert_cmpuint (4, ==, hb_aat_get_feature_settings (face, 18, &default_setting, + g_assert_cmpuint (4, ==, hb_aat_layout_get_feature_settings (face, 18, &default_setting, 0, &count, records)); g_assert_cmpuint (3, ==, count); g_assert_cmpuint (0, ==, default_setting); @@ -52,7 +52,7 @@ test_aat_get_feature_settings (void) g_assert_cmpuint (296, ==, records[2].name_id); count = 3; - g_assert_cmpuint (4, ==, hb_aat_get_feature_settings (face, 18, &default_setting, + g_assert_cmpuint (4, ==, hb_aat_layout_get_feature_settings (face, 18, &default_setting, 3, &count, records)); g_assert_cmpuint (1, ==, count); g_assert_cmpuint (0, ==, default_setting); @@ -62,7 +62,7 @@ test_aat_get_feature_settings (void) count = 1; - g_assert_cmpuint (1, ==, hb_aat_get_feature_settings (face, 14, &default_setting, + g_assert_cmpuint (1, ==, hb_aat_layout_get_feature_settings (face, 14, &default_setting, 0, &count, records)); g_assert_cmpuint (1, ==, count); g_assert_cmpuint (HB_AAT_FEATURE_NO_DEFAULT_SETTING, ==, default_setting); @@ -72,14 +72,14 @@ test_aat_get_feature_settings (void) count = 100; - g_assert_cmpuint (0, ==, hb_aat_get_feature_settings (face, 32, NULL, + g_assert_cmpuint (0, ==, hb_aat_layout_get_feature_settings (face, 32, NULL, 0, &count, records)); g_assert_cmpuint (0, ==, count); hb_face_destroy (face); hb_face_t *sbix = hb_test_open_font_file ("fonts/chromacheck-sbix.ttf"); - g_assert_cmpuint (0, ==, hb_aat_get_feature_settings (sbix, 100, NULL, + g_assert_cmpuint (0, ==, hb_aat_layout_get_feature_settings (sbix, 100, NULL, 0, &count, records)); hb_face_destroy (sbix); } diff --git a/test/api/test-c.c b/test/api/test-c.c index 3d1d6e8..061f35c 100644 --- a/test/api/test-c.c +++ b/test/api/test-c.c @@ -33,7 +33,6 @@ #include #include -#include #ifdef HAVE_GLIB #include -- 2.7.4