示例#1
0
int hasFreeTypeDebugger(void) {
    if ( !hasFreeTypeByteCode())
return( false );
#if FREETYPE_HAS_DEBUGGER
    if ( _FT_Set_Debug_Hook!=NULL && _TT_RunIns!=NULL )
return( true );
#endif

return( false );
}
示例#2
0
void DeltaSuggestionDlg(FontView *fv,CharView *cv) {
    GRect pos;
    GWindow gw;
    GWindowAttrs wattrs;
    GGadgetCreateData gcd[13], boxes[4];
    GTextInfo label[13];
    GGadgetCreateData *varray[7][5], *barray[9];
    char dpi_buffer[40], within_buffer[40];
    QGData *data;
    int failed = false;
    int k, r;
    FontView *savefv;

    if ( !hasFreeType() ) {
	ff_post_error(_("No FreeType"),_("You must install the freetype library before using this command."));
return;
    }
    if ( !hasFreeTypeByteCode() ) {
	ff_post_error(_("No FreeType"),_("Your version of the freetype library does not contain the bytecode interpreter."));
return;
    }
    
    if ( delta_sizes==NULL )
	delta_sizes = copy("7-40,72,80,88,96");

    data = calloc(1,sizeof(QGData));
    data->fv = (FontViewBase *) fv;
    data->cv = cv;
    if ( cv!=NULL ) {
	data->sc = cv->b.sc;
	savefv = (FontView *) cv->b.fv;
	data->layer = CVLayer((CharViewBase *) cv);
	if ( !data->sc->parent->layers[data->layer].order2 )
	    failed = true;
	if ( !failed && data->sc->ttf_instrs_len==0 )
	    ff_post_notice(_("No Instructions"),_("This glyph has no instructions. Adding instructions (a DELTA) may change its rasterization significantly."));
	cv->qg = data;
	cv->note_x = cv->note_y = 32766;
    } else {
	savefv = fv;
	data->layer = fv->b.active_layer;
	if ( !fv->b.sf->layers[data->layer].order2 )
	    failed = true;
    }
    if ( failed ) {
	ff_post_error(_("Not quadratic"),_("This must be a truetype layer."));
	free(data);
	if ( cv!=NULL )
	    cv->qg = NULL;
return;
    }
    savefv->qg = data;

    memset(&wattrs,0,sizeof(wattrs));
    wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict;
    wattrs.event_masks = ~(1<<et_charup);
    wattrs.restrict_input_to_me = 1;
    wattrs.undercursor = 1;
    wattrs.cursor = ct_pointer;
    wattrs.utf8_window_title = _("DELTA suggestions");
    wattrs.is_dlg = true;
    pos.x = pos.y = 0;
    pos.width = GGadgetScale(GDrawPointsToPixels(NULL,190));
    pos.height = GDrawPointsToPixels(NULL,106);
    data->gw = gw = GDrawCreateTopWindow(NULL,&pos,delta_e_h,data,&wattrs);

    memset(&label,0,sizeof(label));
    memset(&gcd,0,sizeof(gcd));
    memset(&boxes,0,sizeof(boxes));

    k=r=0;

    label[k].text = (unichar_t *) _(
	    "When a curve passes very close to the center of a\n"
	    "pixel you might want to check that the curve is on\n"
	    "the intended side of that pixel.\n"
	    "If it's on the wrong side, consider using a DELTA\n"
	    "instruction to adjust the closest point at the\n"
	    "current pixelsize."
	);
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k++].creator = GLabelCreate;
    varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL;

    label[k].text = (unichar_t *) _("Rasterize at sizes:");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k++].creator = GLabelCreate;

    label[k].text = (unichar_t *) delta_sizes;
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k].gd.cid = CID_Sizes;
    gcd[k++].creator = GTextFieldCreate;
    varray[r][0] = &gcd[k-2]; varray[r][1] = &gcd[k-1]; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL;

    label[k].text = (unichar_t *) _("DPI:");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k++].creator = GLabelCreate;

    sprintf( dpi_buffer, "%d", delta_dpi );
    label[k].text = (unichar_t *) dpi_buffer;
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.pos.width = 40;
    gcd[k].gd.cid = CID_DPI;
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k++].creator = GTextFieldCreate;

    label[k].text = (unichar_t *) _("_Mono");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = delta_depth==1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible);
    gcd[k].gd.cid = CID_BW;
    gcd[k++].creator = GRadioCreate;
    varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_HPad10;

    label[k].text = (unichar_t *) _("_Anti-Aliased");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = delta_depth!=1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible);
    gcd[k++].creator = GRadioCreate;
    varray[r][0] = &gcd[k-4]; varray[r][1] = &gcd[k-3]; varray[r][2] = &gcd[k-2]; varray[r][3] = &gcd[k-1]; varray[r++][4] = NULL;

    label[k].text = (unichar_t *) _("Proximity:");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k++].creator = GLabelCreate;

    sprintf( within_buffer, "%g", delta_within );
    label[k].text = (unichar_t *) within_buffer;
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k].gd.pos.width = 40;
    gcd[k].gd.cid = CID_Within;
    gcd[k++].creator = GTextFieldCreate;

    label[k].text = (unichar_t *) _("pixels");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled|gg_visible;
    gcd[k++].creator = GLabelCreate;
    varray[r][0] = &gcd[k-3]; varray[r][1] = &gcd[k-2]; varray[r][2] = &gcd[k-1]; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL;

    label[k].text = (unichar_t *) _( "This may take a while. Please be patient..." );
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.flags = gg_enabled;
    gcd[k].gd.cid = CID_Msg;
    gcd[k++].creator = GLabelCreate;
    varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL;

    gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default;
    label[k].text = (unichar_t *) _("_OK");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.handle_controlevent = Delta_OK;
    gcd[k].gd.cid = CID_Ok;
    gcd[k++].creator = GButtonCreate;
    barray[0] = GCD_Glue; barray[1] = &gcd[k-1]; barray[2] = GCD_Glue;

    gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
    label[k].text = (unichar_t *) _("_Cancel");
    label[k].text_is_1byte = true;
    label[k].text_in_resource = true;
    gcd[k].gd.label = &label[k];
    gcd[k].gd.handle_controlevent = Delta_Cancel;
    gcd[k].gd.cid = CID_Cancel;
    gcd[k++].creator = GButtonCreate;
    barray[3] = GCD_Glue; barray[4] = &gcd[k-1]; barray[5] = GCD_Glue; barray[6] = NULL;

    boxes[2].gd.flags = gg_enabled|gg_visible;
    boxes[2].gd.u.boxelements = barray;
    boxes[2].creator = GHBoxCreate;
    varray[r][0] = &boxes[2]; varray[r][1] = GCD_ColSpan; varray[r][2] = GCD_ColSpan; varray[r][3] = GCD_ColSpan; varray[r++][4] = NULL;
    varray[r][0] = NULL;

    boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2;
    boxes[0].gd.flags = gg_enabled|gg_visible;
    boxes[0].gd.u.boxelements = varray[0];
    boxes[0].gd.cid = CID_Top;
    boxes[0].creator = GHVGroupCreate;


    GGadgetsCreate(gw,boxes);
    GHVBoxFitWindow(boxes[0].ret);

    GDrawSetVisible(gw,true);
    while ( !data->done )
	GDrawProcessOneEvent(NULL);
    GDrawDestroyWindow(gw);
    if ( data->cv!=NULL )
	data->cv->qg = NULL;
    if ( savefv->qg == data )
	savefv->qg = NULL;
}