Ejemplo n.º 1
0
void TopFindQuestionablePoints(struct qg_data *data) {
    char *pt, *end;
    int low, high;

    if ( data->fv!=NULL )
	data->freetype_context = _FreeTypeFontContext(data->fv->sf,NULL,data->fv,data->layer,
	    ff_ttf,0,NULL);
    else
	data->freetype_context = _FreeTypeFontContext(data->sc->parent,data->sc,NULL,data->layer,
	    ff_ttf,0,NULL);
    if ( data->freetype_context==NULL ) {
	data->error = qg_nofont;
return;
    }
    data->qg = NULL;
    data->cur = data->max = 0;
    data->error = qg_ok;

    for ( pt=data->pixelsizes; *pt; pt=end ) {
	low = strtol(pt,&end,10);
	if ( pt==end ) {
	    data->error = qg_notnumber;
return;
	}
	while ( *end==' ' ) ++end;
	if ( *end=='-' ) {
	    pt = end+1;
	    high = strtol(pt,&end,10);
	    if ( pt==end ) {
		data->error = qg_notnumber;
return;
	    }
	    if ( high<low ) {
		data->error = qg_badrange;
return;
	    }
	} else
	    high = low;
	if ( low<2 || low>4096 || high<2 || high>4096 ) {
	    data->error = qg_badnumber;
return;
	}
	while ( *end==' ' ) ++end;
	if ( *end==',' ) ++end;
	for ( data->cur_size = low; data->cur_size <= high; ++ data->cur_size ) {
	    if ( data->fv!=NULL ) {
		int enc, gid;
		for ( enc=0; enc<data->fv->map->enccount; ++enc ) {
		    if ( data->fv->selected[enc] && (gid = data->fv->map->map[enc])!=-1 &&
			    (data->sc = data->fv->sf->glyphs[gid])!=NULL )
			SCFindQuestionablePoints(data);
		}
	    } else {
		SCFindQuestionablePoints(data);
	    }
	}
    }
    FreeTypeFreeContext(data->freetype_context);
    data->freetype_context = NULL;
}
Ejemplo n.º 2
0
void CVGridFitChar(CharView *cv) {
    void *single_glyph_context;
    SplineFont *sf = cv->b.sc->parent;
    int layer = CVLayer((CharViewBase *) cv);

    SplinePointListsFree(cv->b.gridfit); cv->b.gridfit = NULL;
    FreeType_FreeRaster(cv->raster); cv->raster = NULL;

    single_glyph_context = _FreeTypeFontContext(sf,cv->b.sc,NULL,layer,
	    sf->layers[layer].order2?ff_ttf:ff_otf,0,NULL);
    if ( single_glyph_context==NULL ) {
	LogError(_("Freetype rasterization failed.\n") );
return;
    }

    if ( cv->b.sc->layers[layer].refs!=NULL )
	SCNumberPoints(cv->b.sc,layer);

    cv->raster = FreeType_GetRaster(single_glyph_context,cv->b.sc->orig_pos,
	    cv->ft_pointsizey, cv->ft_pointsizex, cv->ft_dpi, cv->ft_depth );
    cv->b.gridfit = FreeType_GridFitChar(single_glyph_context,cv->b.sc->orig_pos,
	    cv->ft_pointsizey, cv->ft_pointsizex, cv->ft_dpi, &cv->b.ft_gridfitwidth,
	    cv->b.sc, cv->ft_depth, true );

    FreeTypeFreeContext(single_glyph_context);
    GDrawRequestExpose(cv->v,NULL,false);
    if ( cv->b.sc->instructions_out_of_date && cv->b.sc->ttf_instrs_len!=0 )
	ff_post_notice(_("Instructions out of date"),
	    _("The points have been changed. This may mean that the truetype instructions now refer to the wrong points and they may cause unexpected results."));
}