@@ -536,6 +536,7 @@ FT2Font::get_path()
536
536
for (n = 0 ; n < outline .n_contours ; n++)
537
537
{
538
538
int last; // index of last point in contour
539
+ bool starts_with_last;
539
540
540
541
last = outline .contours [n];
541
542
limit = outline .points + last;
@@ -554,13 +555,22 @@ FT2Font::get_path()
554
555
{
555
556
throw Py::RuntimeError (" A contour cannot start with a cubic control point" );
556
557
}
558
+ else if (tag == FT_CURVE_TAG_CONIC)
559
+ {
560
+ starts_with_last = true ;
561
+ } else {
562
+ starts_with_last = false ;
563
+ }
557
564
558
565
count++;
559
566
560
567
while (point < limit)
561
568
{
562
- point++;
563
- tags++;
569
+ if (!starts_with_last) {
570
+ point++;
571
+ tags++;
572
+ }
573
+ starts_with_last = false ;
564
574
565
575
tag = FT_CURVE_TAG (tags[0 ]);
566
576
switch (tag)
@@ -656,7 +666,8 @@ FT2Font::get_path()
656
666
first = 0 ;
657
667
for (n = 0 ; n < outline .n_contours ; n++)
658
668
{
659
- int last; // index of last point in contour
669
+ int last; // index of last point in contour
670
+ bool starts_with_last;
660
671
661
672
last = outline .contours [n];
662
673
limit = outline .points + last;
@@ -670,16 +681,29 @@ FT2Font::get_path()
670
681
tags = outline .tags + first;
671
682
tag = FT_CURVE_TAG (tags[0 ]);
672
683
673
- double x = conv (v_start.x );
674
- double y = flip_y ? -conv (v_start.y ) : conv (v_start.y );
684
+ double x, y;
685
+ if (tag != FT_CURVE_TAG_ON)
686
+ {
687
+ x = conv (v_last.x );
688
+ y = flip_y ? -conv (v_last.y ) : conv (v_last.y );
689
+ starts_with_last = true ;
690
+ } else {
691
+ x = conv (v_start.x );
692
+ y = flip_y ? -conv (v_start.y ) : conv (v_start.y );
693
+ starts_with_last = false ;
694
+ }
695
+
675
696
*(outpoints++) = x;
676
697
*(outpoints++) = y;
677
698
*(outcodes++) = MOVETO;
678
699
679
700
while (point < limit)
680
701
{
681
- point++;
682
- tags++;
702
+ if (!starts_with_last) {
703
+ point++;
704
+ tags++;
705
+ }
706
+ starts_with_last = false ;
683
707
684
708
tag = FT_CURVE_TAG (tags[0 ]);
685
709
switch (tag)
0 commit comments