diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-06-24 13:12:22 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-06-24 13:12:22 +0000 |
commit | cfff10ee7499ca70f649dfa88e936ea68ab10d07 (patch) | |
tree | 7cd5e2cd74155e11b3a1456cc2f28d41ef1eb77b /Build/source/texk/xdvipdfmx | |
parent | b21064d86aaafcdb6cca39b296ddb3dedffbded9 (diff) |
xdvipdfmx 0.7.3 - updated pstricts support, from SMiyata
git-svn-id: svn://tug.org/texlive/trunk@8977 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvipdfmx')
-rwxr-xr-x | Build/source/texk/xdvipdfmx/configure | 2 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/configure.in | 2 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/spc_dvips.c | 58 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/spc_xtx.c | 52 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/spc_xtx.h | 4 |
5 files changed, 72 insertions, 46 deletions
diff --git a/Build/source/texk/xdvipdfmx/configure b/Build/source/texk/xdvipdfmx/configure index fb83d510c20..263f29239be 100755 --- a/Build/source/texk/xdvipdfmx/configure +++ b/Build/source/texk/xdvipdfmx/configure @@ -2429,7 +2429,7 @@ fi # Define the identity of the package. PACKAGE=xdvipdfmx - VERSION=0.7.2 + VERSION=0.7.3 cat >>confdefs.h <<_ACEOF diff --git a/Build/source/texk/xdvipdfmx/configure.in b/Build/source/texk/xdvipdfmx/configure.in index bcb6d9bb5d6..0f9f4a615bb 100644 --- a/Build/source/texk/xdvipdfmx/configure.in +++ b/Build/source/texk/xdvipdfmx/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/dvipdfmx.c) -AM_INIT_AUTOMAKE(xdvipdfmx, 0.7.2) +AM_INIT_AUTOMAKE(xdvipdfmx, 0.7.3) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/Build/source/texk/xdvipdfmx/src/spc_dvips.c b/Build/source/texk/xdvipdfmx/src/spc_dvips.c index 940644103ed..10641f6e9a1 100644 --- a/Build/source/texk/xdvipdfmx/src/spc_dvips.c +++ b/Build/source/texk/xdvipdfmx/src/spc_dvips.c @@ -339,7 +339,7 @@ spc_handler_ps_tricks_tdef (struct spc_env *spe, struct spc_arg *args) return 0; } -static int calculate_PS (char *string, int length, double *res1, double *res2); +static int calculate_PS (char *string, int length, double *res1, double *res2, double *res3, double *res4, double *res5, double *res6); static int spc_handler_ps_tricks_bput (struct spc_env *spe, struct spc_arg *args, int must_def, int pre_def) @@ -373,7 +373,7 @@ spc_handler_ps_tricks_bput (struct spc_env *spe, struct spc_arg *args, int must_ PutBegin = strstr(formula, "PutBegin"); strcpy(PutBegin, "exch = ="); *(PutBegin + 8) = 0; - if (calculate_PS(formula, strlen(formula), &tr.x, &tr.y) == 0) { + if (calculate_PS(formula, strlen(formula), &tr.x, &tr.y, 0, 0, 0, 0) == 0) { if (!(++put_stack_depth & 0x0f)) put_stack = realloc(put_stack, (put_stack_depth + 16) * sizeof(pdf_coord)); put_stack[put_stack_depth] = tr; @@ -433,11 +433,14 @@ spc_handler_ps_tricks_brotate (struct spc_env *spe, struct spc_arg *args) strncat(cmd, args->curptr, l); RotBegin = strstr(cmd, "RotBegin"); strcpy(RotBegin, post); - if (calculate_PS(cmd, strlen(cmd), &value, 0) != 0) + if (calculate_PS(cmd, strlen(cmd), &value, 0, 0, 0, 0, 0) != 0) return -1; RAngles[RAngleCount] = value; - return spc_handler_xtx_do_rotate (spe->x_user, spe->y_user, value); + return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, + cos(value * M_PI / 180), sin(value * M_PI / 180), + -sin(value * M_PI / 180), cos(value * M_PI / 180), + 0, 0); } static int @@ -445,7 +448,37 @@ spc_handler_ps_tricks_erotate (struct spc_env *spe, struct spc_arg *args) { double value = RAngles[RAngleCount--]; - return spc_handler_xtx_do_rotate (spe->x_user, spe->y_user, (-1.0) * value); + return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, + cos(value * M_PI / 180), -sin(value * M_PI / 180), + sin(value * M_PI / 180), cos(value * M_PI / 180), + 0, 0); +} + +static int +spc_handler_ps_tricks_transform (struct spc_env *spe, struct spc_arg *args) +{ + double d1, d2, d3, d4, d5, d6; + char *cmd, *concat; + int l = args->endptr - args->curptr; + + static char *post = "concat matrix currentmatrix =="; + + cmd = calloc(l + 41, 1); + strncpy(cmd, "matrix setmatrix ", 17); + strncpy(cmd + 17, args->curptr, l); + concat = strstr(cmd, "concat"); + if (concat != 0) { + strcpy(concat, post); + concat[strlen(post)] = 0; + concat = strstr(cmd, "{"); + *concat = ' '; + if (calculate_PS(cmd, strlen(cmd), &d1, &d2, &d3, &d4, &d5, &d6) != 0) + return -1; + if (spc_handler_xtx_gsave (0, 0) != 0) + return -1; + return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, d1, d2, d3, d4, d5, d6); + } + return spc_handler_xtx_grestore (0, 0); } static int @@ -672,7 +705,8 @@ typedef enum { begin_rotate = 1 << 7, end_rotate = 1 << 8, parse = 1 << 9, - req_ref = 1 << 10 + req_ref = 1 << 10, + transform = 1 << 11 } Operation; /* ToDo: all the substring search must be centralized so that * @@ -692,6 +726,7 @@ struct pstricks_key_ { {"InitNC", render | new_temp}, {"/Glbx", add_temp}, {"NewtonSolving", add_temp}, + {"tx@LightThreeDDict", page_def}, {"PutEnd", end_put}, {"RotEnd", end_rotate}, {"mtrxc", parse}, @@ -701,7 +736,8 @@ struct pstricks_key_ { {" Glbx", req_ref}, {"TextPathShow", parse}, {"/rotAngle", page_def}, - {"NAngle", req_ref} + {"NAngle", req_ref}, + {"TMatrix", transform} }; static int @@ -740,6 +776,8 @@ spc_handler_ps_trickscmd (struct spc_env *spe, struct spc_arg *args) error |= spc_handler_ps_tricks_brotate(spe, args); if (f_exec & end_rotate) error |= spc_handler_ps_tricks_erotate(spe, args); + if (f_exec & transform) + error |= spc_handler_ps_tricks_transform(spe, args); if (f_exec & page_def) error |= spc_handler_ps_tricks_pdef (spe, args); if (f_exec == 0) @@ -939,7 +977,7 @@ spc_dvips_setup_handler (struct spc_handler *handle, #endif static -int calculate_PS (char *string, int length, double *res1, double *res2) { +int calculate_PS (char *string, int length, double *res1, double *res2, double *res3, double *res4, double *res5, double *res6) { char *formula, *cmd; FILE *fp, *coord; int k; @@ -978,8 +1016,10 @@ int calculate_PS (char *string, int length, double *res1, double *res2) { fscanf(coord, " %lf ", res2); else if (res2 == 0) fscanf(coord, " %lf ", res1); - else + else if (res3 == 0) fscanf(coord, " %lf %lf ", res1, res2); + else + fscanf(coord, " [%lf %lf %lf %lf %lf %lf] ", res1, res2, res3, res4, res5, res6); } else return -1; diff --git a/Build/source/texk/xdvipdfmx/src/spc_xtx.c b/Build/source/texk/xdvipdfmx/src/spc_xtx.c index 53ea769a4ab..99c359372e7 100644 --- a/Build/source/texk/xdvipdfmx/src/spc_xtx.c +++ b/Build/source/texk/xdvipdfmx/src/spc_xtx.c @@ -84,18 +84,19 @@ spc_xtx_at_end_page (void) return 0; } -static int -spc_handler_xtx_do_scale (double x_user, double y_user, double valueX, double valueY) +int +spc_handler_xtx_do_transform (double x_user, double y_user, double a, double b, double c, double d, double e, double f) { pdf_tmatrix M = { 0, 0, 0, 0, 0, 0 }; pdf_coord pt; - /* Create transformation matrix */ - M.a = valueX; - M.d = valueY; - M.e = ((1.0 - M.a) * x_user - M.c * y_user); - M.f = ((1.0 - M.d) * y_user - M.b * x_user); + M.a = a; + M.b = b; + M.c = c; + M.d = d; + M.e = ((1.0 - M.a) * x_user - M.c * y_user) + e; + M.f = ((1.0 - M.d) * y_user - M.b * x_user) + f; pdf_dev_concat(&M); pdf_dev_get_fixed_point(&pt); @@ -103,6 +104,7 @@ spc_handler_xtx_do_scale (double x_user, double y_user, double valueX, double va return 0; } + static int spc_handler_xtx_scale (struct spc_env *spe, struct spc_arg *args) { @@ -113,7 +115,7 @@ spc_handler_xtx_scale (struct spc_env *spe, struct spc_arg *args) } args->curptr = args->endptr; - return spc_handler_xtx_do_scale(spe->x_user, spe->y_user, values[0], values[1]); + return spc_handler_xtx_do_transform(spe->x_user, spe->y_user, values[0], 0, 0, values[1], 0, 0); } /* Scaling without gsave/grestore. */ @@ -137,7 +139,7 @@ spc_handler_xtx_bscale (struct spc_env *spe, struct spc_arg *args) scaleFactors[scaleFactorCount].y = 1 / values[1]; args->curptr = args->endptr; - return spc_handler_xtx_do_scale (spe->x_user, spe->y_user, values[0], values[1]); + return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, values[0], 0, 0, values[1], 0, 0); } static int @@ -147,28 +149,7 @@ spc_handler_xtx_escale (struct spc_env *spe, struct spc_arg *args) args->curptr = args->endptr; - return spc_handler_xtx_do_scale (spe->x_user, spe->y_user, factor.x, factor.y); -} - -int -spc_handler_xtx_do_rotate (double x_user, double y_user, double value) -{ - pdf_tmatrix M = { 0, 0, 0, 0, 0, 0 }; - pdf_coord pt; - - /* Create transformation matrix */ - M.a = cos(value * M_PI / 180); - M.b = sin(value * M_PI / 180); - M.c = -M.b; - M.d = M.a; - M.e = ((1.0 - M.a) * x_user - M.c * y_user); - M.f = ((1.0 - M.d) * y_user - M.b * x_user); - - pdf_dev_concat(&M); - pdf_dev_get_fixed_point(&pt); - pdf_dev_set_fixed_point(x_user - pt.x, y_user - pt.y); - - return 0; + return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, factor.x, 0, 0, factor.y, 0, 0); } static int @@ -181,10 +162,13 @@ spc_handler_xtx_rotate (struct spc_env *spe, struct spc_arg *args) } args->curptr = args->endptr; - return spc_handler_xtx_do_rotate (spe->x_user, spe->y_user, value); + return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, + cos(value * M_PI / 180), sin(value * M_PI / 180), + -sin(value * M_PI / 180), cos(value * M_PI / 180), + 0, 0); } -static int +int spc_handler_xtx_gsave (struct spc_env *spe, struct spc_arg *args) { pdf_dev_gsave(); @@ -192,7 +176,7 @@ spc_handler_xtx_gsave (struct spc_env *spe, struct spc_arg *args) return 0; } -static int +int spc_handler_xtx_grestore (struct spc_env *spe, struct spc_arg *args) { pdf_dev_grestore(); diff --git a/Build/source/texk/xdvipdfmx/src/spc_xtx.h b/Build/source/texk/xdvipdfmx/src/spc_xtx.h index 5c4f77bca3a..09daa5e61c1 100644 --- a/Build/source/texk/xdvipdfmx/src/spc_xtx.h +++ b/Build/source/texk/xdvipdfmx/src/spc_xtx.h @@ -38,6 +38,8 @@ extern int spc_xtx_at_end_document (void); extern int spc_xtx_check_special (const char *buffer, long size); extern int spc_xtx_setup_handler (struct spc_handler *handle, struct spc_env *spe, struct spc_arg *args); -extern int spc_handler_xtx_do_rotate (double x_user, double y_user, double value); +extern int spc_handler_xtx_do_transform (double x_user, double y_user, double a, double b, double c, double d, double e, double f); +extern int spc_handler_xtx_gsave (struct spc_env *spe, struct spc_arg *args); +extern int spc_handler_xtx_grestore (struct spc_env *spe, struct spc_arg *args); #endif /* _SPC_XTX_H_ */ |