Skip to content

Unsatisfying Point Type Change From Corner To Curve #4763

@linusromer

Description

@linusromer

The function SPChangePointType() in splinechar.c has a unsatisfying behaviour that I will try to describe in two GIFs:

  1. If you change a single-linked corner point to a curve point, it will head to the next on-curve-node in the distance of the nice proportion = .39:
    smooth-to-corner0
  2. If you change a double-linked corner point, the behaviour is basically the same but the direction is defined by the vector from the next and the previous on-curve-node:
    smooth-to-corner1

This problem occurs both with the 2020-11-07 release as well as the current main branch of FontForge.

I have tried to fix the problem by changing line 699 of splinechar.c to something like

if( pointtype==pt_curve ) { 
	if ( sp->pointtype==pt_corner ) { 
		if ( sp->prev!=NULL && sp->next!=NULL && prevlen!=0 && nextlen!=0 ) {
			unitnext.x = .5*(unitnext.x-unitprev.x); /* average direction */
			unitnext.y = .5*(unitnext.y-unitprev.y); 
			sp->nextcp.x = sp->me.x + unitnext.x*nextlen;
			sp->nextcp.y = sp->me.y + unitnext.y*nextlen;
			sp->prevcp.x = sp->me.x - unitnext.x*prevlen; /* prev is antidirectional to next */
			sp->prevcp.y = sp->me.y - unitnext.y*prevlen;
		}
		if ( ( sp->prev==NULL && sp->next!=NULL && nextlen!=0 ) || (sp->next==NULL && sp->prev!=NULL && prevlen!=0) ) 
			makedflt = false; /* just do nothing */
	} 
    else makedflt = true; /* original behaviour */
}	

to change this behaviour but it did not work as desired. Maybe we should consider changing the function SplineRefigureFixup() as well? If someone has a good hint, I will try to figure out a patch and make a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions