Пример #1
0
void AnchorControlClass(SplineFont *_sf,AnchorClass *ac,int layer) {
    /* Pick a random glyph with an anchor point in the class. If no glyph, */
    /*  give user the chance to create one */
    SplineChar *sc, *scmark = NULL;
    AnchorPoint *ap, *apmark = NULL;
    SplineFont *sf;
    int k, gid;

    if ( _sf->cidmaster!=NULL ) _sf = _sf->cidmaster;
    k=0;
    ap = NULL;
    do {
	sf = _sf->subfontcnt==0 ? _sf : _sf->subfonts[k];
	for ( gid=0; gid<sf->glyphcnt; ++gid ) if ( (sc = sf->glyphs[gid])!=NULL ) {
	    for ( ap=sc->anchor; ap!=NULL; ap=ap->next ) {
		if ( ap->anchor==ac ) {
		    if ( ap->type!=at_mark && ap->type!=at_centry )
	    break;
		    else if ( scmark==NULL ) {
			scmark = sc;
			apmark = ap;
		    }
		}
	    }
	    if ( ap!=NULL )
	break;
	}
	if ( ap!=NULL )
    break;
	++k;
    } while ( k<_sf->subfontcnt );

    if ( ap==NULL ) {
	sc = scmark;
	ap = apmark;
    }
    if ( ap==NULL ) {
	sc = AddAnchor(NULL,_sf,ac,-1);
	if ( sc==NULL )
return;
	for ( ap=sc->anchor; ap!=NULL; ap=ap->next ) {
	    if ( ap->anchor==ac )
	break;
	}
	if ( ap==NULL )		/* Can't happen */
return;
    }
	
    AnchorControl(sc,ap,layer);
}
Пример #2
0
static void KPAC(KPData *kpd, int base) {
    if ( kpd->selected!=-1 ) {
	struct kerns *k = &kpd->kerns[kpd->selected];
	SplineChar *sc = base ? k->first : k->second;
	AnchorPoint *ap;
	for ( ap=sc->anchor; ap!=NULL && ap->anchor!=k->ac; ap=ap->next );
	if ( ap!=NULL ) {
	    /* There is currently no way to modify anchors in this dlg */
	    /* so the anchor will be right. On the other hand we might */
	    /* need to reinit all other combinations which use this point */
	    AnchorControl(sc,ap,kpd->layer);
	    AnchorRefigure(kpd);
	    GDrawRequestExpose(kpd->v,NULL,false);
	}
    }
}