@@ -260,30 +260,33 @@ void GlyphToType3::PSConvert(TTStreamWriter& stream)
260260 points.push_back (points.front ());
261261 }
262262
263- // For output, a vector is more convenient than a list.
264- std::vector<FlaggedPoint> points_v (points.begin (), points.end ());
265263 // The first point
266264 stack (stream, 3 );
267- PSMoveto (stream, points_v .front ().x , points_v .front ().y );
265+ PSMoveto (stream, points .front ().x , points .front ().y );
268266
269267 // Step through the remaining points
270- for (size_t p = 1 ; p < points_v.size (); )
268+ std::list<FlaggedPoint>::const_iterator it = points.begin ();
269+ for (it++; it != points.end (); /* incremented inside */ )
271270 {
272- const FlaggedPoint& point = points_v. at (p) ;
271+ const FlaggedPoint& point = *it ;
273272 if (point.flag == ON_PATH)
274273 {
275274 stack (stream, 3 );
276275 PSLineto (stream, point.x , point.y );
277- p ++;
276+ it ++;
278277 } else {
279- assert (points_v.at (p-1 ).flag == ON_PATH);
280- assert (points_v.at (p+1 ).flag == ON_PATH);
278+ std::list<FlaggedPoint>::const_iterator prev = it, next = it;
279+ prev--;
280+ next++;
281+ assert (prev->flag == ON_PATH);
282+ assert (next->flag == ON_PATH);
281283 stack (stream, 7 );
282284 PSCurveto (stream,
283- points_v. at (p- 1 ). x , points_v. at (p- 1 ). y ,
285+ prev-> x , prev-> y ,
284286 point.x , point.y ,
285- points_v.at (p+1 ).x , points_v.at (p+1 ).y );
286- p += 2 ;
287+ next->x , next->y );
288+ it++;
289+ it++;
287290 }
288291 }
289292 }
0 commit comments