{
unsigned int index = (this+coverage).get_coverage (glyph);
return italicsCorrection[index].get_x_value (font, this);
- return true;
}
protected:
topAccentAttachment.sanitize (c, this));
}
- inline bool get_value (hb_font_t *font, hb_codepoint_t glyph,
- hb_position_t &value) const
+ inline hb_position_t get_value (hb_codepoint_t glyph,
+ hb_font_t *font) const
{
unsigned int index = (this+topAccentCoverage).get_coverage (glyph);
- if (likely (index == NOT_COVERED)) return false;
- if (unlikely (index >= topAccentAttachment.len)) return false;
- value = topAccentAttachment[index].get_x_value(font, this);
- return true;
+ if (index == NOT_COVERED)
+ return font->get_glyph_h_advance (glyph) / 2;
+ return topAccentAttachment[index].get_x_value(font, this);
}
protected:
}
inline hb_position_t
- get_italics_correction (hb_codepoint_t glyph,
- hb_font_t *font) const
- {
- return (this+mathItalicsCorrectionInfo).get_value (glyph, font);
- }
+ get_italics_correction (hb_codepoint_t glyph, hb_font_t *font) const
+ { return (this+mathItalicsCorrectionInfo).get_value (glyph, font); }
- inline const MathTopAccentAttachment&
- get_math_top_accent_attachment (void) const {
- return this+mathTopAccentAttachment;
- }
+ inline hb_position_t
+ get_top_accent_attachment (hb_codepoint_t glyph, hb_font_t *font) const
+ { return (this+mathTopAccentAttachment).get_value (glyph, font); }
inline bool is_extended_shape (hb_codepoint_t glyph) const
- {
- unsigned int index = (this+extendedShapeCoverage).get_coverage (glyph);
- return index != NOT_COVERED;
- }
+ { return (this+extendedShapeCoverage).get_coverage (glyph) != NOT_COVERED; }
inline const MathKernInfo &get_math_kern_info (void) const {
return this+mathKernInfo;
hb_codepoint_t glyph)
{
const OT::MATH &math = _get_math (font->face);
- 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;
+ return math.get_math_glyph_info().get_top_accent_attachment (glyph, font);
}
/**
openFont("fonts/MathTestFontEmpty.otf");
g_assert(hb_font_get_glyph_from_name (hb_font, "space", -1, &glyph));
- g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 0); // MathGlyphInfo not available
+ g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 500); // MathGlyphInfo not available
closeFont();
openFont("fonts/MathTestFontPartial1.otf");
g_assert(hb_font_get_glyph_from_name (hb_font, "space", -1, &glyph));
- g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 0); // MathGlyphInfo empty
+ g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 500); // MathGlyphInfo empty
closeFont();
openFont("fonts/MathTestFontPartial2.otf");
g_assert(hb_font_get_glyph_from_name (hb_font, "space", -1, &glyph));
- g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 0); // MathTopAccentAttachment empty
+ g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 500); // MathTopAccentAttachment empty
closeFont();
openFont("fonts/MathTestFontFull.otf");
g_assert(hb_font_get_glyph_from_name (hb_font, "space", -1, &glyph));
- g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 0); // Glyph without top accent attachment.
+ g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 500); // Glyph without top accent attachment.
g_assert(hb_font_get_glyph_from_name (hb_font, "D", -1, &glyph));
g_assert_cmpint(hb_ot_layout_get_math_top_accent_attachment (hb_font, glyph), ==, 374);
g_assert(hb_font_get_glyph_from_name (hb_font, "E", -1, &glyph));