TODO | 2 docs/harfbuzz-sections.txt | 1 src/hb-face.cc | 95 ++++++++++++++++++++++++--------------- src/hb-face.h | 4 + src/hb-ot-shape-complex-khmer.cc | 6 +- 5 files changed, 67 insertions(+), 41 deletions(-)
New commits: commit ba3b6d6c6512b58a3d0e5277fbbe4e69b085467d Author: Behdad Esfahbod <beh...@behdad.org> Date: Mon Jun 4 16:47:45 2018 -0700 [khmer] Fix Coeng vs Halant confusion Test suite results are unchanged (34). diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 7c2cd791..18e3c941 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -317,7 +317,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, if ((FLAG_UNSAFE (info[i].khmer_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | FLAG (OT_Coeng)))) { info[i].khmer_position() = last_pos; - if (unlikely (info[i].khmer_category() == OT_H && + if (unlikely (info[i].khmer_category() == OT_Coeng && info[i].khmer_position() == POS_PRE_M)) { /* @@ -538,7 +538,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * and possibly multiple substitutions happened prior to this * phase, and that might have messed up our properties. Recover * from a particular case of that where we're fairly sure that a - * class of OT_H is desired but has been lost. */ + * class of OT_Coeng is desired but has been lost. */ if (khmer_plan->virama_glyph) { unsigned int virama_glyph = khmer_plan->virama_glyph; @@ -548,7 +548,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, _hb_glyph_info_multiplied (&info[i])) { /* This will make sure that this glyph passes is_coeng() test. */ - info[i].khmer_category() = OT_H; + info[i].khmer_category() = OT_Coeng; _hb_glyph_info_clear_ligated_and_multiplied (&info[i]); } } commit 8220ef8a54bcc94f122d50804c0a5e829de81be1 Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Tue Jun 5 22:50:53 2018 +0430 Fix hb_face_count build issue I should've rebased #1002 before the merge, my bad diff --git a/src/hb-face.cc b/src/hb-face.cc index d7e8a27b..f79940e9 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -53,7 +53,7 @@ hb_face_count (hb_blob_t *blob) return 0; hb_blob_t *sanitized = OT::Sanitizer<OT::OpenTypeFontFile> ().sanitize (blob); - const OT::OpenTypeFontFile& ot = *OT::Sanitizer<OT::OpenTypeFontFile>::lock_instance (sanitized); + const OT::OpenTypeFontFile& ot = *sanitized->as<OT::OpenTypeFontFile> (); return ot.get_face_count (); } commit 32da0c6bc4770568346f6c05fd6b374be2bbd2b2 Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Tue Jun 5 18:56:26 2018 +0430 Add hb_face_count, a new API (#1002) Simply, it returns the number of faces on a font blob. To be used on hb-sanitizer tool but other clients also can benefit from it. diff --git a/TODO b/TODO index c6804d12..6dac0be5 100644 --- a/TODO +++ b/TODO @@ -27,8 +27,6 @@ API additions - Add query / enumeration API for aalt-like features? -- SFNT api? get_num_faces? - - Add segmentation API - Add hb-fribidi glue? diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 73840391..c837e6b0 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -169,6 +169,7 @@ hb_coretext_font_get_ct_font <SECTION> <FILE>hb-face</FILE> +hb_face_count hb_face_create hb_face_create_for_tables hb_face_destroy diff --git a/src/hb-face.cc b/src/hb-face.cc index 01271413..d7e8a27b 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -35,6 +35,29 @@ #include "hb-ot-maxp-table.hh" + +/** + * hb_face_count: Get number of faces on the blob + * @blob: + * + * + * + * Return value: Number of faces on the blob + * + * Since: REPLACEME + **/ +unsigned int +hb_face_count (hb_blob_t *blob) +{ + if (unlikely (!blob)) + return 0; + + hb_blob_t *sanitized = OT::Sanitizer<OT::OpenTypeFontFile> ().sanitize (blob); + const OT::OpenTypeFontFile& ot = *OT::Sanitizer<OT::OpenTypeFontFile>::lock_instance (sanitized); + + return ot.get_face_count (); +} + /* * hb_face_t */ @@ -65,10 +88,10 @@ const hb_face_t _hb_face_nil = { /** * hb_face_create_for_tables: * @reference_table_func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: + * @user_data: + * @destroy: + * * - * * * Return value: (transfer full) * @@ -147,10 +170,10 @@ _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void /** * hb_face_create: (Xconstructor) - * @blob: - * @index: + * @blob: + * @index: + * * - * * * Return value: (transfer full): * @@ -182,7 +205,7 @@ hb_face_create (hb_blob_t *blob, /** * hb_face_get_empty: * - * + * * * Return value: (transfer full) * @@ -199,9 +222,9 @@ hb_face_get_empty (void) * hb_face_reference: (skip) * @face: a face. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -215,7 +238,7 @@ hb_face_reference (hb_face_t *face) * hb_face_destroy: (skip) * @face: a face. * - * + * * * Since: 0.9.2 **/ @@ -245,14 +268,14 @@ hb_face_destroy (hb_face_t *face) /** * hb_face_set_user_data: (skip) * @face: a face. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -269,9 +292,9 @@ hb_face_set_user_data (hb_face_t *face, /** * hb_face_get_user_data: (skip) * @face: a face. - * @key: + * @key: + * * - * * * Return value: (transfer none): * @@ -288,7 +311,7 @@ hb_face_get_user_data (hb_face_t *face, * hb_face_make_immutable: * @face: a face. * - * + * * * Since: 0.9.2 **/ @@ -305,9 +328,9 @@ hb_face_make_immutable (hb_face_t *face) * hb_face_is_immutable: * @face: a face. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -321,9 +344,9 @@ hb_face_is_immutable (hb_face_t *face) /** * hb_face_reference_table: * @face: a face. - * @tag: + * @tag: + * * - * * * Return value: (transfer full): * @@ -340,7 +363,7 @@ hb_face_reference_table (hb_face_t *face, * hb_face_reference_blob: * @face: a face. * - * + * * * Return value: (transfer full): * @@ -355,9 +378,9 @@ hb_face_reference_blob (hb_face_t *face) /** * hb_face_set_index: * @face: a face. - * @index: + * @index: + * * - * * * Since: 0.9.2 **/ @@ -375,9 +398,9 @@ hb_face_set_index (hb_face_t *face, * hb_face_get_index: * @face: a face. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -390,9 +413,9 @@ hb_face_get_index (hb_face_t *face) /** * hb_face_set_upem: * @face: a face. - * @upem: + * @upem: + * * - * * * Since: 0.9.2 **/ @@ -410,9 +433,9 @@ hb_face_set_upem (hb_face_t *face, * hb_face_get_upem: * @face: a face. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -434,9 +457,9 @@ hb_face_t::load_upem (void) const /** * hb_face_set_glyph_count: * @face: a face. - * @glyph_count: + * @glyph_count: + * * - * * * Since: 0.9.7 **/ @@ -454,9 +477,9 @@ hb_face_set_glyph_count (hb_face_t *face, * hb_face_get_glyph_count: * @face: a face. * - * * - * Return value: + * + * Return value: * * Since: 0.9.7 **/ diff --git a/src/hb-face.h b/src/hb-face.h index 0ce8d046..983ee56b 100644 --- a/src/hb-face.h +++ b/src/hb-face.h @@ -37,6 +37,10 @@ HB_BEGIN_DECLS +HB_EXTERN unsigned int +hb_face_count (hb_blob_t *blob); + + /* * hb_face_t */ _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz