From 06003f71ba0d0327fb1a17098a9d7faa8fb336f0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 26 Sep 2016 12:07:29 +0100 Subject: [PATCH] [MATH] Clean up a bit more --- src/hb-ot-layout-math-table.hh | 12 +-------- src/hb-ot-layout.cc | 57 ++++++++++++++++-------------------------- 2 files changed, 22 insertions(+), 47 deletions(-) diff --git a/src/hb-ot-layout-math-table.hh b/src/hb-ot-layout-math-table.hh index cbdee48..53038e3 100644 --- a/src/hb-ot-layout-math-table.hh +++ b/src/hb-ot-layout-math-table.hh @@ -367,17 +367,11 @@ struct MathGlyphInfo mathKernInfo.sanitize(c, this)); } - inline bool has_math_italics_correction_info (void) const { - return mathItalicsCorrectionInfo != 0; - } inline const MathItalicsCorrectionInfo& get_math_italics_correction_info (void) const { return this+mathItalicsCorrectionInfo; } - inline bool has_math_top_accent_attachment (void) const { - return mathTopAccentAttachment != 0; - } inline const MathTopAccentAttachment& get_math_top_accent_attachment (void) const { return this+mathTopAccentAttachment; @@ -385,13 +379,10 @@ struct MathGlyphInfo inline bool is_extended_shape (hb_codepoint_t glyph) const { - if (likely (extendedShapeCoverage == 0)) return false; unsigned int index = (this+extendedShapeCoverage).get_coverage (glyph); - if (likely (index == NOT_COVERED)) return false; - return true; + return index != NOT_COVERED; } - inline bool has_math_kern_info (void) const { return mathKernInfo != 0; } inline const MathKernInfo &get_math_kern_info (void) const { return this+mathKernInfo; } @@ -442,7 +433,6 @@ struct MATH hb_font_t *font) const { return (this+mathConstants).get_value (constant, font); } - inline bool has_math_glyph_info (void) const { return mathGlyphInfo != 0; } inline const MathGlyphInfo &get_math_glyph_info (void) const { return this+mathGlyphInfo; } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 359d941..6fa61a4 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1277,23 +1277,19 @@ hb_ot_layout_get_math_constant (hb_font_t *font, * * Return value: the italic correction of the glyph or 0 * - * Since: ???? + * Since: 1.4 **/ HB_EXTERN hb_position_t hb_ot_layout_get_math_italic_correction (hb_font_t *font, hb_codepoint_t glyph) { const OT::MATH &math = _get_math (font->face); - if (math.has_math_glyph_info()) { - const OT::MathGlyphInfo &glyphInfo = math.get_math_glyph_info(); - if (glyphInfo.has_math_italics_correction_info()) { - hb_position_t value; - if (glyphInfo.get_math_italics_correction_info().get_value(font, glyph, - value)) - return value; - } - } - return 0; + const OT::MathGlyphInfo &glyphInfo = math.get_math_glyph_info(); + hb_position_t value; + if (glyphInfo.get_math_italics_correction_info().get_value(font, glyph, value)) + return value; + else + return 0; } /** @@ -1304,23 +1300,19 @@ hb_ot_layout_get_math_italic_correction (hb_font_t *font, * * Return value: the top accent attachment of the glyph or 0 * - * Since: ???? + * Since: 1.4 **/ HB_EXTERN hb_position_t hb_ot_layout_get_math_top_accent_attachment (hb_font_t *font, hb_codepoint_t glyph) { const OT::MATH &math = _get_math (font->face); - if (math.has_math_glyph_info()) { - const OT::MathGlyphInfo &glyphInfo = math.get_math_glyph_info(); - if (glyphInfo.has_math_top_accent_attachment()) { - hb_position_t value; - if (glyphInfo.get_math_top_accent_attachment().get_value(font, glyph, - value)) - return value; - } - } - return 0; + const OT::MathGlyphInfo &glyphInfo = math.get_math_glyph_info(); + hb_position_t value; + if (glyphInfo.get_math_top_accent_attachment().get_value(font, glyph, value)) + return value; + else + return 0; // XXX font->get_glyph_h_advance (glyph) / 2; } /** @@ -1331,15 +1323,14 @@ hb_ot_layout_get_math_top_accent_attachment (hb_font_t *font, * * Return value: #TRUE if the glyph is an extended shape and #FALSE otherwise * - * Since: ???? + * Since: 1.4 **/ HB_EXTERN hb_bool_t hb_ot_layout_is_math_extended_shape (hb_face_t *face, hb_codepoint_t glyph) { const OT::MATH &math = _get_math (face); - return math.has_math_glyph_info() && - math.get_math_glyph_info().is_extended_shape(glyph); + return math.get_math_glyph_info().is_extended_shape(glyph); } /** @@ -1358,7 +1349,7 @@ hb_ot_layout_is_math_extended_shape (hb_face_t *face, * * Return value: requested kerning or 0 * - * Since: ???? + * Since: 1.4 **/ HB_EXTERN hb_position_t hb_ot_layout_get_math_kerning (hb_font_t *font, @@ -1367,14 +1358,8 @@ hb_ot_layout_get_math_kerning (hb_font_t *font, hb_position_t correction_height) { const OT::MATH &math = _get_math (font->face); - if (math.has_math_glyph_info()) { - const OT::MathGlyphInfo &glyphInfo = math.get_math_glyph_info(); - if (glyphInfo.has_math_kern_info()) { - const OT::MathKernInfo &kernInfo = glyphInfo.get_math_kern_info(); - const OT::MathKernInfoRecord &kernInfoRecord = kernInfo.get_math_kern_info_record(glyph); - return kernInfoRecord.get_math_kern (kern, &kernInfo).get_value (font, correction_height); - } - } - - return 0; + const OT::MathGlyphInfo &glyphInfo = math.get_math_glyph_info(); + const OT::MathKernInfo &kernInfo = glyphInfo.get_math_kern_info(); + const OT::MathKernInfoRecord &kernInfoRecord = kernInfo.get_math_kern_info_record(glyph); + return kernInfoRecord.get_math_kern (kern, &kernInfo).get_value (font, correction_height); } -- 2.7.4