/* Note that this takes a px_state_t, not a px_gstate_t. */ int px_initgraphics(px_state_t *pxs) { gs_state *pgs = pxs->pgs; px_gstate_reset(pxs->pxgs); gs_initgraphics(pgs); gs_setfilladjust(pgs, 0.5, 0.5); { gs_point inch; float dpi; gs_dtransform(pgs, 72.0, 0.0, &inch); dpi = fabs(inch.x) + fabs(inch.y); /* Stroke adjustment leads to anomalies at high resolutions. */ if ( dpi >= 150 ) gs_setstrokeadjust(pgs, false); /* We need the H-P interpretation of zero-length lines */ /* and of using bevel joins for the segments of flattened curves. */ gs_setdotlength(pgs, 72.0 / 300, true); } /* we always clamp coordinates hp does not seem to report limit checks in paths */ gs_setlimitclamp(pgs, true); return 0; }
/* <num> <bool> .setdotlength - */ static int zsetdotlength(i_ctx_t *i_ctx_p) { os_ptr op = osp; double length; int code = real_param(op - 1, &length); if (code < 0) return code; check_type(*op, t_boolean); code = gs_setdotlength(igs, length, op->value.boolval); if (code < 0) return code; pop(2); return 0; }