@@ -513,6 +513,7 @@ FT2Font::get_path()
513
513
for (n = 0 ; n < outline .n_contours ; n++)
514
514
{
515
515
int last; // index of last point in contour
516
+ bool starts_with_last;
516
517
517
518
last = outline .contours [n];
518
519
limit = outline .points + last;
@@ -531,13 +532,22 @@ FT2Font::get_path()
531
532
{
532
533
throw Py::RuntimeError (" A contour cannot start with a cubic control point" );
533
534
}
535
+ else if (tag == FT_CURVE_TAG_CONIC)
536
+ {
537
+ starts_with_last = true ;
538
+ } else {
539
+ starts_with_last = false ;
540
+ }
534
541
535
542
count++;
536
543
537
544
while (point < limit)
538
545
{
539
- point++;
540
- tags++;
546
+ if (!starts_with_last) {
547
+ point++;
548
+ tags++;
549
+ }
550
+ starts_with_last = false ;
541
551
542
552
tag = FT_CURVE_TAG (tags[0 ]);
543
553
switch (tag)
@@ -633,7 +643,8 @@ FT2Font::get_path()
633
643
first = 0 ;
634
644
for (n = 0 ; n < outline .n_contours ; n++)
635
645
{
636
- int last; // index of last point in contour
646
+ int last; // index of last point in contour
647
+ bool starts_with_last;
637
648
638
649
last = outline .contours [n];
639
650
limit = outline .points + last;
@@ -647,16 +658,29 @@ FT2Font::get_path()
647
658
tags = outline .tags + first;
648
659
tag = FT_CURVE_TAG (tags[0 ]);
649
660
650
- double x = conv (v_start.x );
651
- double y = flip_y ? -conv (v_start.y ) : conv (v_start.y );
661
+ double x, y;
662
+ if (tag != FT_CURVE_TAG_ON)
663
+ {
664
+ x = conv (v_last.x );
665
+ y = flip_y ? -conv (v_last.y ) : conv (v_last.y );
666
+ starts_with_last = true ;
667
+ } else {
668
+ x = conv (v_start.x );
669
+ y = flip_y ? -conv (v_start.y ) : conv (v_start.y );
670
+ starts_with_last = false ;
671
+ }
672
+
652
673
*(outpoints++) = x;
653
674
*(outpoints++) = y;
654
675
*(outcodes++) = MOVETO;
655
676
656
677
while (point < limit)
657
678
{
658
- point++;
659
- tags++;
679
+ if (!starts_with_last) {
680
+ point++;
681
+ tags++;
682
+ }
683
+ starts_with_last = false ;
660
684
661
685
tag = FT_CURVE_TAG (tags[0 ]);
662
686
switch (tag)
0 commit comments