diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 72c138f6d..a3d1f8c34 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -60,11 +60,12 @@ struct loca } protected: - UnsizedArrayOf dataZ; /* Location data. */ + UnsizedArrayOf + dataZ; /* Location data. */ public: - DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always - * check the size externally, allow Null() object of it by - * defining it _MIN instead. */ + DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always + * check the size externally, allow Null() object of it by + * defining it _MIN instead. */ }; @@ -290,14 +291,15 @@ struct glyf bool has_data () const { return numberOfContours; } - HBINT16 numberOfContours; /* If the number of contours is - * greater than or equal to zero, - * this is a simple glyph; if negative, - * this is a composite glyph. */ - FWORD xMin; /* Minimum x for coordinate data. */ - FWORD yMin; /* Minimum y for coordinate data. */ - FWORD xMax; /* Maximum x for coordinate data. */ - FWORD yMax; /* Maximum y for coordinate data. */ + HBINT16 numberOfContours; + /* If the number of contours is + * greater than or equal to zero, + * this is a simple glyph; if negative, + * this is a composite glyph. */ + FWORD xMin; /* Minimum x for coordinate data. */ + FWORD yMin; /* Minimum y for coordinate data. */ + FWORD xMax; /* Maximum x for coordinate data. */ + FWORD yMax; /* Maximum y for coordinate data. */ DEFINE_SIZE_STATIC (10); }; @@ -347,8 +349,8 @@ struct glyf const HBUINT8 *p = &StructAfter (glyphIndex); if (flags & ARG_1_AND_2_ARE_WORDS) { - point1 = ((const HBUINT16 *)p)[0]; - point2 = ((const HBUINT16 *)p)[1]; + point1 = ((const HBUINT16 *) p)[0]; + point2 = ((const HBUINT16 *) p)[1]; } else { @@ -378,7 +380,7 @@ struct glyf protected: bool scaled_offsets () const - { return (flags & (SCALED_COMPONENT_OFFSET|UNSCALED_COMPONENT_OFFSET)) == SCALED_COMPONENT_OFFSET; } + { return (flags & (SCALED_COMPONENT_OFFSET | UNSCALED_COMPONENT_OFFSET)) == SCALED_COMPONENT_OFFSET; } bool get_transformation (float (&matrix)[4], contour_point_t &trans) const { @@ -389,9 +391,9 @@ struct glyf const HBINT8 *p = &StructAfter (glyphIndex); if (flags & ARG_1_AND_2_ARE_WORDS) { - tx = *(const HBINT16 *)p; + tx = *(const HBINT16 *) p; p += HBINT16::static_size; - ty = *(const HBINT16 *)p; + ty = *(const HBINT16 *) p; p += HBINT16::static_size; } else @@ -401,26 +403,29 @@ struct glyf } if (is_anchored ()) tx = ty = 0; - trans.init ((float)tx, (float)ty); + trans.init ((float) tx, (float) ty); - if (flags & WE_HAVE_A_SCALE) { - matrix[0] = matrix[3] = ((const F2DOT14*)p)->to_float (); - return true; - } - else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) - { - matrix[0] = ((const F2DOT14*)p)[0].to_float (); - matrix[3] = ((const F2DOT14*)p)[1].to_float (); - return true; - } - else if (flags & WE_HAVE_A_TWO_BY_TWO) - { - matrix[0] = ((const F2DOT14*)p)[0].to_float (); - matrix[1] = ((const F2DOT14*)p)[1].to_float (); - matrix[2] = ((const F2DOT14*)p)[2].to_float (); - matrix[3] = ((const F2DOT14*)p)[3].to_float (); - return true; + const F2DOT14 *points = (const F2DOT14 *) p; + if (flags & WE_HAVE_A_SCALE) + { + matrix[0] = matrix[3] = points[0].to_float (); + return true; + } + else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) + { + matrix[0] = points[0].to_float (); + matrix[3] = points[1].to_float (); + return true; + } + else if (flags & WE_HAVE_A_TWO_BY_TWO) + { + matrix[0] = points[0].to_float (); + matrix[1] = points[1].to_float (); + matrix[2] = points[2].to_float (); + matrix[3] = points[3].to_float (); + return true; + } } return tx || ty; } @@ -449,8 +454,8 @@ struct glyf bool in_range (const CompositeGlyphHeader *composite) const { return (const char *) composite >= glyph_start - && ((const char *) composite + CompositeGlyphHeader::min_size) <= glyph_end - && ((const char *) composite + composite->get_size ()) <= glyph_end; + && ((const char *) composite + CompositeGlyphHeader::min_size) <= glyph_end + && ((const char *) composite + composite->get_size ()) <= glyph_end; } }; @@ -543,7 +548,8 @@ struct glyf FLAG_RESERVED2 = 0x80 }; - enum phantom_point_index_t { + enum phantom_point_index_t + { PHANTOM_LEFT = 0, PHANTOM_RIGHT = 1, PHANTOM_TOP = 2, @@ -556,7 +562,7 @@ struct glyf { unsigned int start_offset, end_offset; if (!get_offsets (glyph, &start_offset, &end_offset) || end_offset - start_offset < GlyphHeader::static_size) - return Null(GlyphHeader); + return Null (GlyphHeader); return StructAtOffset (glyf_table, start_offset); } @@ -564,15 +570,15 @@ struct glyf struct x_setter_t { void set (contour_point_t &point, float v) const { point.x = v; } - bool is_short (uint8_t flag) const { return (flag & FLAG_X_SHORT) != 0; } - bool is_same (uint8_t flag) const { return (flag & FLAG_X_SAME) != 0; } + bool is_short (uint8_t flag) const { return flag & FLAG_X_SHORT; } + bool is_same (uint8_t flag) const { return flag & FLAG_X_SAME; } }; struct y_setter_t { void set (contour_point_t &point, float v) const { point.y = v; } - bool is_short (uint8_t flag) const { return (flag & FLAG_Y_SHORT) != 0; } - bool is_same (uint8_t flag) const { return (flag & FLAG_Y_SAME) != 0; } + bool is_short (uint8_t flag) const { return flag & FLAG_Y_SHORT; } + bool is_same (uint8_t flag) const { return flag & FLAG_Y_SAME; } }; template @@ -598,7 +604,7 @@ struct glyf if (!coord_setter.is_same (flag)) { if (unlikely (!checker.in_range ((const HBUINT16 *)p))) return false; - v += *(const HBINT16 *)p; + v += *(const HBINT16 *) p; p += HBINT16::static_size; } } @@ -610,15 +616,15 @@ struct glyf void init_phantom_points (hb_codepoint_t glyph, hb_array_t &phantoms /* IN/OUT */) const { const GlyphHeader &header = get_header (glyph); - int h_delta = (int)header.xMin - hmtx_accel.get_side_bearing (glyph); - int v_orig = (int)header.yMax + vmtx_accel.get_side_bearing (glyph); + int h_delta = (int) header.xMin - hmtx_accel.get_side_bearing (glyph); + int v_orig = (int) header.yMax + vmtx_accel.get_side_bearing (glyph); unsigned int h_adv = hmtx_accel.get_advance (glyph); unsigned int v_adv = vmtx_accel.get_advance (glyph); phantoms[PHANTOM_LEFT].x = h_delta; phantoms[PHANTOM_RIGHT].x = h_adv + h_delta; phantoms[PHANTOM_TOP].y = v_orig; - phantoms[PHANTOM_BOTTOM].y = -(int)v_adv + v_orig; + phantoms[PHANTOM_BOTTOM].y = v_orig - (int) v_adv; } /* for a simple glyph, return contour end points, flags, along with coordinate points @@ -635,16 +641,16 @@ struct glyf if (unlikely (!get_offsets (glyph, &start_offset, &end_offset))) return false; if (unlikely (end_offset - start_offset < GlyphHeader::static_size)) { - /* empty glyph */ + /* empty glyph */ points_.resize (PHANTOM_COUNT); for (unsigned int i = 0; i < points_.length; i++) points_[i].init (); - return true; + return true; } CompositeGlyphHeader::Iterator composite; if (get_composite (glyph, &composite)) { - /* For a composite glyph, add one pseudo point for each component */ + /* For a composite glyph, add one pseudo point for each component */ do { num_points++; } while (composite.move_to_next()); points_.resize (num_points + PHANTOM_COUNT); for (unsigned int i = 0; i < points_.length; i++) points_[i].init (); @@ -652,17 +658,17 @@ struct glyf } const GlyphHeader &glyph_header = StructAtOffset (glyf_table, start_offset); - int16_t num_contours = (int16_t) glyph_header.numberOfContours; + int num_contours = glyph_header.numberOfContours; const HBUINT16 *end_pts = &StructAfter (glyph_header); range_checker_t checker (glyf_table, start_offset, end_offset); num_points = 0; - if (num_contours > 0) + if (glyph_header.is_simple_glyph ()) { if (unlikely (!checker.in_range (&end_pts[num_contours + 1]))) return false; - num_points = end_pts[num_contours - 1] + 1; + num_points = end_pts[glyph_header.numberOfContours - 1] + 1; } - else if (num_contours < 0) + else if (glyph_header.is_composite_glyph ()) { CompositeGlyphHeader::Iterator composite; if (unlikely (!get_composite (glyph, &composite))) return false; @@ -674,22 +680,23 @@ struct glyf points_.resize (num_points + PHANTOM_COUNT); for (unsigned int i = 0; i < points_.length; i++) points_[i].init (); - if ((num_contours <= 0) || phantom_only) return true; + if (!glyph_header.is_simple_glyph () || phantom_only) return true; /* Read simple glyph points if !phantom_only */ end_points_.resize (num_contours); - for (int16_t i = 0; i < num_contours; i++) - end_points_[i] = end_pts[i]; + for (int i = 0; i < num_contours; i++) + end_points_[i] = end_pts[i]; /* Skip instructions */ - const HBUINT8 *p = &StructAtOffset (&end_pts[num_contours+1], end_pts[num_contours]); + const HBUINT8 *p = &StructAtOffset (&end_pts[num_contours+1], + end_pts[num_contours]); /* Read flags */ for (unsigned int i = 0; i < num_points; i++) { - if (unlikely (!checker.in_range (p))) return false; - uint8_t flag = *p++; + if (unlikely (!checker.in_range (p))) return false; + uint8_t flag = *p++; points_[i].flag = flag; if ((flag & FLAG_REPEAT) != 0) { @@ -732,8 +739,8 @@ struct glyf unsigned int depth=0) const { if (unlikely (depth++ > HB_MAX_NESTING_LEVEL)) return false; - contour_point_vector_t points; - hb_vector_t end_points; + contour_point_vector_t points; + hb_vector_t end_points; if (unlikely (!get_contour_points (glyph, points, end_points))) return false; hb_array_t phantoms = points.sub_array (points.length-PHANTOM_COUNT, PHANTOM_COUNT); init_phantom_points (glyph, phantoms); @@ -743,7 +750,7 @@ struct glyf CompositeGlyphHeader::Iterator composite; if (!get_composite (glyph, &composite)) { - /* simple glyph */ + /* simple glyph */ all_points.extend (points.as_array ()); } else @@ -753,8 +760,8 @@ struct glyf { contour_point_vector_t comp_points; if (unlikely (!get_points_var (composite.current->glyphIndex, coords, coord_count, - comp_points, depth)) - || comp_points.length < PHANTOM_COUNT) return false; + comp_points, depth)) + || comp_points.length < PHANTOM_COUNT) return false; /* Copy phantom points from component if USE_MY_METRICS flag set */ if (composite.current->flags & CompositeGlyphHeader::USE_MY_METRICS) @@ -775,7 +782,7 @@ struct glyf { contour_point_t delta; delta.init (all_points[p1].x - comp_points[p2].x, - all_points[p1].y - comp_points[p2].y); + all_points[p1].y - comp_points[p2].y); comp_points.translate (delta); } @@ -799,7 +806,7 @@ struct glyf { contour_point_vector_t all_points; if (unlikely (!get_points_var (glyph, coords, coord_count, all_points) || - all_points.length < PHANTOM_COUNT)) return false; + all_points.length < PHANTOM_COUNT)) return false; /* Undocumented rasterizer behavior: * Shift points horizontally by the updated left side bearing @@ -810,7 +817,7 @@ struct glyf if (extents != nullptr) { - contour_bounds_t bounds; + contour_bounds_t bounds; for (unsigned int i = 0; i + PHANTOM_COUNT < all_points.length; i++) bounds.add (all_points[i]); @@ -821,8 +828,8 @@ struct glyf } else { - extents->x_bearing = (int32_t)floorf (bounds.min.x); - extents->width = (int32_t)ceilf (bounds.max.x) - extents->x_bearing; + extents->x_bearing = (int) floor (bounds.min.x); + extents->width = (int) ceil (bounds.max.x) - extents->x_bearing; } if (bounds.min.y > bounds.max.y) { @@ -831,13 +838,13 @@ struct glyf } else { - extents->y_bearing = (int32_t)ceilf (bounds.max.y); - extents->height = (int32_t)floorf (bounds.min.y) - extents->y_bearing; + extents->y_bearing = (int) ceil (bounds.max.y); + extents->height = (int) floor (bounds.min.y) - extents->y_bearing; } } if (phantoms != nullptr) { - for (unsigned int i = 0; i < PHANTOM_COUNT; i++) + for (unsigned int i = 0; i < PHANTOM_COUNT; i++) (*phantoms)[i] = all_points[all_points.length - PHANTOM_COUNT + i]; } return true; @@ -962,7 +969,7 @@ struct glyf if (!glyph_header.has_data ()) { *length = 0; - // only 0 byte glyphs are healthy when missing GlyphHeader + /* only 0 byte glyphs are healthy when missing GlyphHeader */ return glyph.length == 0; } if (glyph_header.is_composite_glyph ()) @@ -1017,14 +1024,14 @@ struct glyf bool vertical) const { bool success = false; - contour_point_vector_t phantoms; + contour_point_vector_t phantoms; phantoms.resize (PHANTOM_COUNT); if (likely (coord_count == gvar_accel.get_axis_count ())) success = get_var_metrics (glyph, coords, coord_count, phantoms); if (unlikely (!success)) - return vertical? vmtx_accel.get_advance (glyph): hmtx_accel.get_advance (glyph); + return vertical ? vmtx_accel.get_advance (glyph) : hmtx_accel.get_advance (glyph); if (vertical) return roundf (phantoms[PHANTOM_TOP].y - phantoms[PHANTOM_BOTTOM].y); @@ -1039,9 +1046,9 @@ struct glyf phantoms.resize (PHANTOM_COUNT); if (unlikely (!get_var_extents_and_phantoms (glyph, coords, coord_count, &extents, &phantoms))) - return vertical? vmtx_accel.get_side_bearing (glyph): hmtx_accel.get_side_bearing (glyph); + return vertical ? vmtx_accel.get_side_bearing (glyph) : hmtx_accel.get_side_bearing (glyph); - return vertical? (int)ceilf (phantoms[PHANTOM_TOP].y) - extents.y_bearing: (int)floorf (phantoms[PHANTOM_LEFT].x); + return vertical ? (int) ceil (phantoms[PHANTOM_TOP].y) - extents.y_bearing : (int)floorf (phantoms[PHANTOM_LEFT].x); } bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const @@ -1070,23 +1077,23 @@ struct glyf return true; } - hb_bytes_t bytes_for_glyph (const char * glyf, hb_codepoint_t gid) - { - unsigned int start_offset, end_offset; - if (unlikely (!(get_offsets (gid, &start_offset, &end_offset) && - remove_padding (start_offset, &end_offset)))) + hb_bytes_t bytes_for_glyph (const char * glyf, hb_codepoint_t gid) { - DEBUG_MSG(SUBSET, nullptr, "Unable to get offset or remove padding for %d", gid); - return hb_bytes_t (); + unsigned int start_offset, end_offset; + if (unlikely (!(get_offsets (gid, &start_offset, &end_offset) && + remove_padding (start_offset, &end_offset)))) + { + DEBUG_MSG(SUBSET, nullptr, "Unable to get offset or remove padding for %d", gid); + return hb_bytes_t (); + } + hb_bytes_t glyph_bytes = hb_bytes_t (glyf + start_offset, end_offset - start_offset); + if (!glyph_bytes.as ()->has_data ()) + { + DEBUG_MSG(SUBSET, nullptr, "Glyph size smaller than minimum header %d", gid); + return hb_bytes_t (); + } + return glyph_bytes; } - hb_bytes_t glyph_bytes = hb_bytes_t (glyf + start_offset, end_offset - start_offset); - if (!glyph_bytes.as ()->has_data ()) - { - DEBUG_MSG(SUBSET, nullptr, "Glyph size smaller than minimum header %d", gid); - return hb_bytes_t (); - } - return glyph_bytes; - } private: bool short_offset; @@ -1095,9 +1102,9 @@ struct glyf hb_blob_ptr_t glyf_table; /* variable font support */ - gvar::accelerator_t gvar_accel; - hmtx::accelerator_t hmtx_accel; - vmtx::accelerator_t vmtx_accel; + gvar::accelerator_t gvar_accel; + hmtx::accelerator_t hmtx_accel; + vmtx::accelerator_t vmtx_accel; }; @@ -1110,36 +1117,36 @@ struct glyf hb_bytes_t dest_end; /* region of source_glyph to copy second */ - bool serialize (hb_serialize_context_t *c, - const hb_subset_plan_t *plan) const - { - TRACE_SERIALIZE (this); - - hb_bytes_t dest_glyph = dest_start.copy (c); - dest_glyph = hb_bytes_t (&dest_glyph, dest_glyph.length + dest_end.copy(c).length); - unsigned int pad_length = padding (); - DEBUG_MSG(SUBSET, nullptr, "serialize %d byte glyph, width %d pad %d", dest_glyph.length, dest_glyph.length + pad_length, pad_length); - - HBUINT8 pad; - pad = 0; - while (pad_length > 0) + bool serialize (hb_serialize_context_t *c, + const hb_subset_plan_t *plan) const { - c->embed(pad); - pad_length--; - } + TRACE_SERIALIZE (this); - if (dest_glyph.length) - { - _fix_component_gids (plan, dest_glyph); - if (plan->drop_hints) + hb_bytes_t dest_glyph = dest_start.copy (c); + dest_glyph = hb_bytes_t (&dest_glyph, dest_glyph.length + dest_end.copy(c).length); + unsigned int pad_length = padding (); + DEBUG_MSG(SUBSET, nullptr, "serialize %d byte glyph, width %d pad %d", dest_glyph.length, dest_glyph.length + pad_length, pad_length); + + HBUINT8 pad; + pad = 0; + while (pad_length > 0) { - _zero_instruction_length (dest_glyph); - c->check_success (_remove_composite_instruction_flag (dest_glyph)); + c->embed(pad); + pad_length--; } - } - return_trace (true); - } + if (dest_glyph.length) + { + _fix_component_gids (plan, dest_glyph); + if (plan->drop_hints) + { + _zero_instruction_length (dest_glyph); + c->check_success (_remove_composite_instruction_flag (dest_glyph)); + } + } + + return_trace (true); + } void drop_hints (const OT::glyf::accelerator_t& glyf) { diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index 630249b71..ad942e390 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -154,37 +154,37 @@ struct TupleVarHeader if (has_intermediate ()) { - int start = start_tuple[i]; - int end = end_tuple[i]; + int start = start_tuple[i]; + int end = end_tuple[i]; if (unlikely (start > peak || peak > end || (start < 0 && end > 0 && peak))) continue; if (v < start || v > end) return 0.f; if (v < peak) - { if (peak != start) scalar *= (float)(v - start) / (peak - start); } + { if (peak != start) scalar *= (float) (v - start) / (peak - start); } else - { if (peak != end) scalar *= (float)(end - v) / (end - peak); } + { if (peak != end) scalar *= (float) (end - v) / (end - peak); } } else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.f; else - scalar *= (float)v / peak; + scalar *= (float) v / peak; } return scalar; } unsigned int get_data_size () const { return varDataSize; } - bool has_peak () const { return (tupleIndex & TuppleIndex::EmbeddedPeakTuple); } - bool has_intermediate () const { return (tupleIndex & TuppleIndex::IntermediateRegion); } + bool has_peak () const { return (tupleIndex & TuppleIndex::EmbeddedPeakTuple); } + bool has_intermediate () const { return (tupleIndex & TuppleIndex::IntermediateRegion); } bool has_private_points () const { return (tupleIndex & TuppleIndex::PrivatePointNumbers); } - unsigned int get_index () const { return (tupleIndex & TuppleIndex::TupleIndexMask); } + unsigned int get_index () const { return (tupleIndex & TuppleIndex::TupleIndexMask); } protected: const Tuple &get_peak_tuple () const { return StructAfter (tupleIndex); } const Tuple &get_start_tuple (unsigned int axis_count) const - { return *(const Tuple *)&get_peak_tuple ()[has_peak ()? axis_count: 0]; } + { return *(const Tuple *) &get_peak_tuple ()[has_peak () ? axis_count : 0]; } const Tuple &get_end_tuple (unsigned int axis_count) const - { return *(const Tuple *)&get_peak_tuple ()[has_peak ()? (axis_count * 2): axis_count]; } + { return *(const Tuple *) &get_peak_tuple ()[has_peak () ? (axis_count * 2) : axis_count]; } HBUINT16 varDataSize; TuppleIndex tupleIndex; @@ -202,7 +202,8 @@ struct TupleVarCount : HBUINT16 unsigned int get_count () const { return (*this) & CountMask; } protected: - enum Flags { + enum Flags + { SharedPointNumbers = 0x8000u, CountMask = 0x0FFFu }; @@ -257,7 +258,7 @@ struct GlyphVarData } bool in_range (const void *p, unsigned int l) const - { return (const char*)p >= (const char*)var_data && (const char*)p+l <= (const char*)var_data + length; } + { return (const char*) p >= (const char*) var_data && (const char*) p+l <= (const char*) var_data + length; } template bool in_range (const T *p) const { return in_range (p, sizeof (*p)); } @@ -295,11 +296,12 @@ struct GlyphVarData { enum packed_point_flag_t { - POINTS_ARE_WORDS = 0x80, + POINTS_ARE_WORDS = 0x80, POINT_RUN_COUNT_MASK = 0x7F }; - if (!check.in_range (p)) return false; + if (unlikely (!check.in_range (p))) return false; + uint16_t count = *p++; if (count & POINTS_ARE_WORDS) { @@ -370,7 +372,7 @@ struct GlyphVarData { if (!check.in_range ((const HBUINT16 *)p)) return false; - deltas[i] = *(const HBINT16 *)p; + deltas[i] = *(const HBINT16 *) p; p += HBUINT16::static_size; } } @@ -393,7 +395,6 @@ struct GlyphVarData TupleVarCount tupleVarCount; OffsetTo data; /* TupleVarHeader tupleVarHeaders[] */ - public: DEFINE_SIZE_MIN (4); }; @@ -471,18 +472,18 @@ struct gvar unsigned int length = c->plan->old_gid_for_new_gid (gid, &old_gid)? get_glyph_var_data_length (old_gid): 0; if (long_offset) - ((HBUINT32 *)subset_offsets)[gid] = glyph_offset; + ((HBUINT32 *) subset_offsets)[gid] = glyph_offset; else - ((HBUINT16 *)subset_offsets)[gid] = glyph_offset / 2; + ((HBUINT16 *) subset_offsets)[gid] = glyph_offset / 2; if (length > 0) memcpy (subset_data, get_glyph_var_data (old_gid), length); subset_data += length; glyph_offset += length; } if (long_offset) - ((HBUINT32 *)subset_offsets)[num_glyphs] = glyph_offset; + ((HBUINT32 *) subset_offsets)[num_glyphs] = glyph_offset; else - ((HBUINT16 *)subset_offsets)[num_glyphs] = glyph_offset / 2; + ((HBUINT16 *) subset_offsets)[num_glyphs] = glyph_offset / 2; return_trace (true); } @@ -497,10 +498,10 @@ struct gvar unlikely ((start_offset > get_offset (glyphCount)) || (start_offset + GlyphVarData::min_size > end_offset))) return &Null(GlyphVarData); - return &(((unsigned char *)this+start_offset)+dataZ); + return &(((unsigned char *) this + start_offset) + dataZ); } - bool is_long_offset () const { return (flags & 1)!=0; } + bool is_long_offset () const { return (flags & 1) != 0; } unsigned int get_offset (unsigned int i) const { @@ -519,7 +520,7 @@ struct gvar return end_offset - start_offset; } - const HBUINT32 *get_long_offset_array () const { return (const HBUINT32 *)&offsetZ; } + const HBUINT32 * get_long_offset_array () const { return (const HBUINT32 *)&offsetZ; } const HBUINT16 *get_short_offset_array () const { return (const HBUINT16 *)&offsetZ; } public: @@ -541,7 +542,7 @@ struct gvar unsigned int num_shared_coord = gvar_table->sharedTupleCount * gvar_table->axisCount; shared_tuples.resize (num_shared_coord); for (unsigned int i = 0; i < num_shared_coord; i++) - shared_tuples[i] = (&(gvar_table+gvar_table->sharedTuples))[i]; + shared_tuples[i] = (&(gvar_table + gvar_table->sharedTuples))[i]; } void fini () @@ -605,10 +606,11 @@ struct gvar for (unsigned int i = 0; i < orig_points.length; i++) orig_points[i] = points[i]; - contour_point_vector_t deltas; /* flag is used to indicate referenced point */ + contour_point_vector_t deltas; /* flag is used to indicate referenced point */ deltas.resize (points.length); - do { + do + { float scalar = iterator.current_tuple->calculate_scalar (coords, coord_count, shared_tuples.as_array ()); if (scalar == 0.f) continue; const HBUINT8 *p = iterator.get_serialized_data ();