@@ -293,8 +293,8 @@ FT2Font::FT2Font(FT_Open_Args &open_args,
293
293
294
294
FT2Font::~FT2Font ()
295
295
{
296
- for (size_t i = 0 ; i < glyphs. size (); i++ ) {
297
- FT_Done_Glyph (glyphs[i] );
296
+ for (auto & glyph : glyphs) {
297
+ FT_Done_Glyph (glyph );
298
298
}
299
299
300
300
if (face) {
@@ -308,16 +308,16 @@ void FT2Font::clear()
308
308
bbox.xMin = bbox.yMin = bbox.xMax = bbox.yMax = 0 ;
309
309
advance = 0 ;
310
310
311
- for (size_t i = 0 ; i < glyphs. size (); i++ ) {
312
- FT_Done_Glyph (glyphs[i] );
311
+ for (auto & glyph : glyphs) {
312
+ FT_Done_Glyph (glyph );
313
313
}
314
314
315
315
glyphs.clear ();
316
316
glyph_to_font.clear ();
317
317
char_to_font.clear ();
318
318
319
- for (size_t i = 0 ; i < fallbacks. size (); i++ ) {
320
- fallbacks[i] ->clear ();
319
+ for (auto & font : fallbacks) {
320
+ font ->clear ();
321
321
}
322
322
}
323
323
@@ -331,8 +331,8 @@ void FT2Font::set_size(double ptsize, double dpi)
331
331
FT_Matrix transform = { 65536 / hinting_factor, 0 , 0 , 65536 };
332
332
FT_Set_Transform (face, &transform, 0 );
333
333
334
- for (size_t i = 0 ; i < fallbacks. size (); i++ ) {
335
- fallbacks[i] ->set_size (ptsize, dpi);
334
+ for (auto & font : fallbacks) {
335
+ font ->set_size (ptsize, dpi);
336
336
}
337
337
}
338
338
@@ -391,8 +391,8 @@ int FT2Font::get_kerning(FT_UInt left, FT_UInt right, FT_UInt mode, FT_Vector &d
391
391
void FT2Font::set_kerning_factor (int factor)
392
392
{
393
393
kerning_factor = factor;
394
- for (size_t i = 0 ; i < fallbacks. size (); i++ ) {
395
- fallbacks[i] ->set_kerning_factor (factor);
394
+ for (auto & font : fallbacks) {
395
+ font ->set_kerning_factor (factor);
396
396
}
397
397
}
398
398
@@ -451,7 +451,7 @@ void FT2Font::set_text(
451
451
}
452
452
453
453
// extract glyph image and store it in our table
454
- FT_Glyph &thisGlyph = glyphs[glyphs. size () - 1 ] ;
454
+ FT_Glyph &thisGlyph = glyphs. back () ;
455
455
456
456
last_advance = ft_object_with_glyph->get_face ()->glyph ->advance .x ;
457
457
FT_Glyph_Transform (thisGlyph, 0 , &pen);
@@ -592,8 +592,8 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
592
592
return true ;
593
593
}
594
594
else {
595
- for (size_t i = 0 ; i < fallbacks. size (); ++i ) {
596
- bool was_found = fallbacks[i] ->load_char_with_fallback (
595
+ for (auto & font : fallbacks) {
596
+ bool was_found = font ->load_char_with_fallback (
597
597
ft_object_with_glyph, final_glyph_index, parent_glyphs,
598
598
parent_char_to_font, parent_glyph_to_font, charcode, flags,
599
599
charcode_error, glyph_error, glyph_seen_fonts, override );
@@ -672,14 +672,14 @@ void FT2Font::draw_glyphs_to_bitmap(bool antialiased)
672
672
673
673
image.resize (width, height);
674
674
675
- for (size_t n = 0 ; n < glyphs. size (); n++ ) {
675
+ for (auto & glyph : glyphs) {
676
676
FT_Error error = FT_Glyph_To_Bitmap (
677
- &glyphs[n] , antialiased ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO, 0 , 1 );
677
+ &glyph , antialiased ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO, 0 , 1 );
678
678
if (error) {
679
679
throw_ft_error (" Could not convert glyph to bitmap" , error);
680
680
}
681
681
682
- FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyphs[n] ;
682
+ FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph ;
683
683
// now, draw to our target surface (convert position)
684
684
685
685
// bitmap left and top in pixel, string bbox in subpixel
0 commit comments