}
/* based on FontTools _g_l_y_f.py::trim */
- inline bool trim(unsigned int start_offset,
- unsigned int *end_offset) const
+ inline bool remove_padding(unsigned int start_offset,
+ unsigned int *end_offset) const
{
static const int FLAG_X_SHORT = 0x02;
static const int FLAG_Y_SHORT = 0x04;
int16_t num_contours = (int16_t) glyph_header.numberOfContours;
if (num_contours < 0)
- return true; /* no trimming for composites just yet */
+ /* Trimming for composites not implemented.
+ * If removing hints it falls out of that. */
+ return true;
else if (num_contours > 0)
{
unsigned int glyph_len = *end_offset - start_offset;
for (unsigned int i = 0; i < glyph_ids.len; i++)
{
hb_codepoint_t next_glyph = glyph_ids[i];
- *(instruction_ranges->push()) = 0;
- *(instruction_ranges->push()) = 0;
+ unsigned int *instruction_start = instruction_ranges->push();
+ unsigned int *instruction_end = instruction_ranges->push();
+ *instruction_start = 0;
+ *instruction_end = 0;
unsigned int start_offset, end_offset;
if (unlikely (!(glyf.get_offsets(next_glyph, &start_offset, &end_offset)
- && glyf.trim(start_offset, &end_offset))))
+ && glyf.remove_padding(start_offset, &end_offset))))
{
DEBUG_MSG(SUBSET, nullptr, "Invalid gid %d", next_glyph);
continue;
if (end_offset - start_offset < OT::glyf::GlyphHeader::static_size)
continue; /* 0-length glyph */
- unsigned int instruction_start = 0, instruction_end = 0;
if (drop_hints)
{
if (unlikely (!glyf.get_instruction_offsets(start_offset, end_offset,
- &instruction_start, &instruction_end)))
+ instruction_start, instruction_end)))
{
DEBUG_MSG(SUBSET, nullptr, "Unable to get instruction offsets for %d", next_glyph);
return false;
}
- instruction_ranges->array[i * 2] = instruction_start;
- instruction_ranges->array[i * 2 + 1] = instruction_end;
}
- total += end_offset - start_offset - (instruction_end - instruction_start);
+ total += end_offset - start_offset - (*instruction_end - *instruction_start);
/* round2 so short loca will work */
total += total % 2;
}
{
unsigned int start_offset, end_offset;
if (unlikely (!(glyf.get_offsets (glyph_ids[i], &start_offset, &end_offset)
- && glyf.trim(start_offset, &end_offset))))
+ && glyf.remove_padding(start_offset, &end_offset))))
end_offset = start_offset = 0;
unsigned int instruction_start = instruction_ranges[i * 2];
unsigned int instruction_end = instruction_ranges[i * 2 + 1];