@@ -396,13 +396,6 @@ void FT2Font::clear()
396
396
}
397
397
}
398
398
399
- void FT2Font::check () {
400
- printf (" Fallback num: -1; Numface: %lu\n " , get_face ()->num_glyphs );
401
- for (uint i = 0 ; i < fallbacks.size (); i++) {
402
- printf (" Fallback num: %u; Numface: %lu\n " , i, fallbacks[i]->get_face ()->num_glyphs );
403
- }
404
- }
405
-
406
399
void FT2Font::set_size (double ptsize, double dpi)
407
400
{
408
401
FT_Error error = FT_Set_Char_Size (
@@ -481,7 +474,6 @@ void FT2Font::set_text(
481
474
size_t N, uint32_t *codepoints, double angle, FT_Int32 flags, std::vector<double > &xys)
482
475
{
483
476
FT_Matrix matrix; /* transformation matrix */
484
- check ();
485
477
486
478
angle = angle / 360.0 * 2 * M_PI;
487
479
@@ -507,10 +499,8 @@ void FT2Font::set_text(
507
499
FT_UInt final_glyph_index;
508
500
FT_Error charcode_error, glyph_error;
509
501
FT2Font *ft_object_with_glyph = this ;
510
- printf (" \n Before loading char! \n " );
511
502
load_char_with_fallback (ft_object_with_glyph, final_glyph_index, glyphs, codepoints[n],
512
503
flags, charcode_error, glyph_error);
513
- printf (" Final ft2font: %lu\n " , ft_object_with_glyph->get_face ()->num_glyphs );
514
504
if (charcode_error || glyph_error) {
515
505
ft_glyph_warn ((FT_ULong)codepoints[n]);
516
506
return ;
@@ -525,25 +515,9 @@ void FT2Font::set_text(
525
515
pen.x += delta.x / (hinting_factor << kerning_factor);
526
516
}
527
517
528
- // DONE with load_char_with_fallback
529
- // if (FT_Error error = FT_Load_Glyph(face, glyph_index, flags)) {
530
- // throw_ft_error("Could not load glyph", error);
531
- // }
532
-
533
- // ignore errors, jump to next glyph
534
-
535
518
// extract glyph image and store it in our table
536
-
537
- // DONE with load_char_with_fallback
538
- // FT_Glyph thisGlyph;
539
- // if (FT_Error error = FT_Get_Glyph(face->glyph, &thisGlyph)) {
540
- // throw_ft_error("Could not get glyph", error);
541
- // }
542
- // ignore errors, jump to next glyph
543
-
544
519
FT_Glyph &thisGlyph = glyphs[glyphs.size () - 1 ];
545
520
546
- // Compare with thisGlyph?
547
521
last_advance = ft_object_with_glyph->get_face ()->glyph ->advance .x ;
548
522
FT_Glyph_Transform (thisGlyph, 0 , &pen);
549
523
FT_Glyph_Transform (thisGlyph, &matrix, 0 );
@@ -560,10 +534,6 @@ void FT2Font::set_text(
560
534
pen.x += last_advance;
561
535
562
536
previous = glyph_index;
563
-
564
- printf (" Set_Text complete! \n " );
565
- // DONE with load_char_with_fallback
566
- // glyphs.push_back(thisGlyph);
567
537
}
568
538
569
539
FT_Vector_Transform (&pen, &matrix);
@@ -595,34 +565,25 @@ void FT2Font::load_char_with_fallback(FT2Font* &ft_object_with_glyph,
595
565
FT_Error &charcode_error,
596
566
FT_Error &glyph_error)
597
567
{
598
- printf (" loading char!\n " );
599
568
FT_UInt glyph_index = FT_Get_Char_Index (face, charcode);
600
569
601
570
if (glyph_index) {
602
- printf (" glyph found!\n " );
603
571
charcode_error = FT_Load_Glyph (face, glyph_index, flags);
604
- // throw_ft_error("Could not load charcode", error);
605
572
FT_Glyph thisGlyph;
606
573
glyph_error = FT_Get_Glyph (face->glyph , &thisGlyph);
607
- // throw_ft_error("Could not get glyph", error);
608
574
final_glyph_index = glyph_index;
609
575
parent_glyphs.push_back (thisGlyph);
610
576
}
611
577
612
578
else {
613
- printf (" glyph not found! Fallback size: %lu\n " , fallbacks.size ());
614
579
for (uint i = 0 ; i < fallbacks.size (); ++i) {
615
580
uint current_size = parent_glyphs.size ();
616
- printf (" Fallback %u: %u\n " , i, current_size);
617
581
fallbacks[i]->load_char_with_fallback (ft_object_with_glyph, final_glyph_index,
618
582
parent_glyphs, charcode, flags, charcode_error,
619
583
glyph_error);
620
- printf (" Got back from fallback load char!\n " );
621
584
// jump out if glyph size increased
622
585
if (parent_glyphs.size () == current_size + 1 ) {
623
- printf (" size increased!\n " );
624
586
ft_object_with_glyph = fallbacks[i];
625
- printf (" Ft object assigned!\n " );
626
587
return ;
627
588
}
628
589
}
0 commit comments