[MATH] Wire up get_glyph_assembly()
This commit is contained in:
parent
353f455af7
commit
559eb56447
@ -437,6 +437,8 @@ struct PartFlags : USHORT
|
|||||||
{
|
{
|
||||||
enum Flags {
|
enum Flags {
|
||||||
Extender = 0x0001u, /* If set, the part can be skipped or repeated. */
|
Extender = 0x0001u, /* If set, the part can be skipped or repeated. */
|
||||||
|
|
||||||
|
Defined = 0x0001u, /* All defined flags. */
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -445,14 +447,30 @@ struct PartFlags : USHORT
|
|||||||
|
|
||||||
struct MathGlyphPartRecord
|
struct MathGlyphPartRecord
|
||||||
{
|
{
|
||||||
friend struct MathGlyphAssembly;
|
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this));
|
return_trace (c->check_struct (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void extract (hb_math_glyph_part_t &out,
|
||||||
|
int scale,
|
||||||
|
hb_font_t *font) const
|
||||||
|
{
|
||||||
|
out.glyph = glyph;
|
||||||
|
|
||||||
|
out.start_connector_length = font->em_scale (startConnectorLength, scale);
|
||||||
|
out.end_connector_length = font->em_scale (endConnectorLength, scale);
|
||||||
|
out.full_advance = font->em_scale (fullAdvance, scale);
|
||||||
|
|
||||||
|
ASSERT_STATIC ((unsigned int) HB_MATH_GLYPH_PART_FLAG_EXTENDER ==
|
||||||
|
(unsigned int) PartFlags::Extender);
|
||||||
|
|
||||||
|
out.flags = (hb_math_glyph_part_flags_t)
|
||||||
|
(unsigned int)
|
||||||
|
(partFlags & PartFlags::Defined);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GlyphID glyph; /* Glyph ID for the part. */
|
GlyphID glyph; /* Glyph ID for the part. */
|
||||||
USHORT startConnectorLength; /* Advance width/ height of the straight bar
|
USHORT startConnectorLength; /* Advance width/ height of the straight bar
|
||||||
@ -482,8 +500,28 @@ struct MathGlyphAssembly
|
|||||||
partRecords.sanitize(c));
|
partRecords.sanitize(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hb_position_t get_italic_correction (hb_font_t *font) const
|
inline unsigned int get_parts (hb_direction_t direction,
|
||||||
{ return italicsCorrection.get_x_value(font, this); }
|
hb_font_t *font,
|
||||||
|
unsigned int start_offset,
|
||||||
|
unsigned int *parts_count, /* IN/OUT */
|
||||||
|
hb_math_glyph_part_t *parts /* OUT */,
|
||||||
|
hb_position_t *italics_correction /* OUT */) const
|
||||||
|
{
|
||||||
|
if (parts_count)
|
||||||
|
{
|
||||||
|
int scale = font->dir_scale (direction);
|
||||||
|
const MathGlyphPartRecord *arr =
|
||||||
|
partRecords.sub_array (start_offset, parts_count);
|
||||||
|
unsigned int count = *parts_count;
|
||||||
|
for (unsigned int i = 0; i < count; i++)
|
||||||
|
arr[i].extract (parts[i], scale, font);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (italics_correction)
|
||||||
|
*italics_correction = italicsCorrection.get_x_value (font, this);
|
||||||
|
|
||||||
|
return partRecords.len;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MathValueRecord italicsCorrection; /* Italics correction of this
|
MathValueRecord italicsCorrection; /* Italics correction of this
|
||||||
@ -507,6 +545,9 @@ struct MathGlyphConstruction
|
|||||||
mathGlyphVariantRecord.sanitize(c));
|
mathGlyphVariantRecord.sanitize(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const MathGlyphAssembly &get_assembly (void) const
|
||||||
|
{ return this+glyphAssembly; }
|
||||||
|
|
||||||
inline unsigned int get_variants (hb_direction_t direction,
|
inline unsigned int get_variants (hb_direction_t direction,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
@ -576,6 +617,19 @@ struct MathVariants
|
|||||||
{ return get_glyph_construction (glyph, direction, font)
|
{ return get_glyph_construction (glyph, direction, font)
|
||||||
.get_variants (direction, font, start_offset, variants_count, variants); }
|
.get_variants (direction, font, start_offset, variants_count, variants); }
|
||||||
|
|
||||||
|
inline unsigned int get_glyph_parts (hb_codepoint_t glyph,
|
||||||
|
hb_direction_t direction,
|
||||||
|
hb_font_t *font,
|
||||||
|
unsigned int start_offset,
|
||||||
|
unsigned int *parts_count, /* IN/OUT */
|
||||||
|
hb_math_glyph_part_t *parts /* OUT */,
|
||||||
|
hb_position_t *italics_correction /* OUT */) const
|
||||||
|
{ return get_glyph_construction (glyph, direction, font)
|
||||||
|
.get_assembly ()
|
||||||
|
.get_parts (direction, font,
|
||||||
|
start_offset, parts_count, parts,
|
||||||
|
italics_correction); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline const MathGlyphConstruction &
|
inline const MathGlyphConstruction &
|
||||||
get_glyph_construction (hb_codepoint_t glyph,
|
get_glyph_construction (hb_codepoint_t glyph,
|
||||||
|
@ -1341,7 +1341,7 @@ hb_ot_layout_is_math_extended_shape (hb_face_t *face,
|
|||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
**/
|
**/
|
||||||
HB_EXTERN hb_position_t
|
hb_position_t
|
||||||
hb_ot_layout_get_math_kerning (hb_font_t *font,
|
hb_ot_layout_get_math_kerning (hb_font_t *font,
|
||||||
hb_codepoint_t glyph,
|
hb_codepoint_t glyph,
|
||||||
hb_ot_math_kern_t kern,
|
hb_ot_math_kern_t kern,
|
||||||
@ -1351,7 +1351,7 @@ hb_ot_layout_get_math_kerning (hb_font_t *font,
|
|||||||
return math.get_math_glyph_info().get_kerning (glyph, kern, correction_height, font);
|
return math.get_math_glyph_info().get_kerning (glyph, kern, correction_height, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
HB_EXTERN unsigned int
|
unsigned int
|
||||||
hb_ot_layout_get_math_glyph_variants (hb_font_t *font,
|
hb_ot_layout_get_math_glyph_variants (hb_font_t *font,
|
||||||
hb_codepoint_t glyph,
|
hb_codepoint_t glyph,
|
||||||
hb_direction_t direction,
|
hb_direction_t direction,
|
||||||
@ -1374,15 +1374,19 @@ hb_ot_layout_get_math_min_connector_overlap (hb_font_t *font,
|
|||||||
return math.get_math_variants().get_min_connector_overlap (direction, font);
|
return math.get_math_variants().get_min_connector_overlap (direction, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
HB_EXTERN unsigned int
|
unsigned int
|
||||||
hb_ot_layout_get_math_glyph_assembly_parts (hb_font_t *font,
|
hb_ot_layout_get_math_glyph_assembly (hb_font_t *font,
|
||||||
hb_codepoint_t glyph,
|
hb_codepoint_t glyph,
|
||||||
hb_direction_t direction,
|
hb_direction_t direction,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
unsigned int *parts_count, /* IN/OUT */
|
unsigned int *parts_count, /* IN/OUT */
|
||||||
hb_math_glyph_part_t *parts, /* OUT */
|
hb_math_glyph_part_t *parts, /* OUT */
|
||||||
hb_position_t *italic_correction /* OUT */)
|
hb_position_t *italics_correction /* OUT */)
|
||||||
{
|
{
|
||||||
const OT::MATH &math = _get_math (font->face);
|
const OT::MATH &math = _get_math (font->face);
|
||||||
return 0;
|
return math.get_math_variants().get_glyph_parts (glyph, direction, font,
|
||||||
|
start_offset,
|
||||||
|
parts_count,
|
||||||
|
parts,
|
||||||
|
italics_correction);
|
||||||
}
|
}
|
||||||
|
@ -341,13 +341,13 @@ hb_ot_layout_get_math_min_connector_overlap (hb_font_t *font,
|
|||||||
hb_direction_t direction);
|
hb_direction_t direction);
|
||||||
|
|
||||||
HB_EXTERN unsigned int
|
HB_EXTERN unsigned int
|
||||||
hb_ot_layout_get_math_glyph_assembly_parts (hb_font_t *font,
|
hb_ot_layout_get_math_glyph_assembly (hb_font_t *font,
|
||||||
hb_codepoint_t glyph,
|
hb_codepoint_t glyph,
|
||||||
hb_direction_t direction,
|
hb_direction_t direction,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
unsigned int *parts_count, /* IN/OUT */
|
unsigned int *parts_count, /* IN/OUT */
|
||||||
hb_math_glyph_part_t *parts, /* OUT */
|
hb_math_glyph_part_t *parts, /* OUT */
|
||||||
hb_position_t *italic_correction /* OUT */);
|
hb_position_t *italics_correction /* OUT */);
|
||||||
|
|
||||||
HB_END_DECLS
|
HB_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user