Пример #1
0
gs_font_dir *
gslt_new_font_cache(gs_memory_t *mem)
{
    gs_font_dir *fontdir;

    int smax = 50;         /* number of scaled fonts */
    int bmax = 500000;     /* space for cached chars */
    int mmax = 200;        /* number of cached font/matrix pairs */
    int cmax = 5000;       /* number of cached chars */
    int upper = 32000;     /* max size of a single cached char */

    fontdir = gs_font_dir_alloc2_limits(mem, mem, smax, bmax, mmax, cmax, upper);
    if (!fontdir)
    {
        gs_throw(-1, "cannot gs_font_dir_alloc2_limits()");
        return NULL;
    }

    gs_setaligntopixels(fontdir, 1); /* no subpixels */
    gs_setgridfittt(fontdir, 3); /* see gx_ttf_outline for values */

    return fontdir;
}
Пример #2
0
/* Set a device into an interperter instance */
static int   /* ret 0 ok, else -ve error code */
pxl_impl_set_device(
  pl_interp_instance_t   *instance,     /* interp instance to use */
  gx_device              *device        /* device to set (open or closed) */
)
{
	int code;
	pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
	px_state_t *pxs = pxli->pxs;

	enum {Sbegin, Ssetdevice, Sinitg, Sgsave, Serase, Sdone} stage;
	stage = Sbegin;
	gs_opendevice(device);

        pxs->interpolate = pxl_get_interpolation(instance);
	/* Set the device into the gstate */
	stage = Ssetdevice;
	if ((code = gs_setdevice_no_erase(pxli->pgs, device)) < 0)	/* can't erase yet */
	  goto pisdEnd;
        /* Initialize device ICC profile  */
        code = gsicc_init_device_profile(pxli->pgs, device);
        if (code < 0)
            return code;
	/* Init XL graphics */
	stage = Sinitg;
	if ((code = px_initgraphics(pxli->pxs)) < 0)
	  goto pisdEnd;

	/* Do inits of gstate that may be reset by setdevice */
	gs_setaccuratecurves(pxli->pgs, true);	/* All H-P languages want accurate curves. */
        /* disable hinting at high res */
        if (gs_currentdevice(pxli->pgs)->HWResolution[0] >= 300)
            gs_setgridfittt(pxs->font_dir, 0);


	/* gsave and grestore (among other places) assume that */
	/* there are at least 2 gstates on the graphics stack. */
	/* Ensure that now. */
	stage = Sgsave;
	if ( (code = gs_gsave(pxli->pgs)) < 0)
	  goto pisdEnd;

	stage = Serase;
	if ( (code = gs_erasepage(pxli->pgs)) < 0 )
		goto pisdEnd;

	stage = Sdone;	/* success */
	/* Unwind any errors */
pisdEnd:
	switch (stage) {
	case Sdone:	/* don't undo success */
	  break;

	case Serase:	/* gs_erasepage failed */
	  /* undo  gsave */
	  gs_grestore_only(pxli->pgs);	 /* destroys gs_save stack */
	  /* fall thru to next */
	case Sgsave:	/* gsave failed */
	case Sinitg:
	  /* undo setdevice */
	  gs_nulldevice(pxli->pgs);
	  /* fall thru to next */

	case Ssetdevice:	/* gs_setdevice failed */
	case Sbegin:	/* nothing left to undo */
	  break;
	}
	return code;
}
Пример #3
0
static int
set_GridFitTT(i_ctx_t *i_ctx_p, long val)
{
    gs_setgridfittt(ifont_dir, (uint)val);
    return 0;
}