- msg("<trace> %d dashes", dashnum);
- msg("<trace> | phase: %f", dashphase);
- for(t=0;t<dashnum;t++) {
- dash[t] = (float)ldash[t];
- msg("<trace> | d%-3d: %f", t, ldash[t]);
+
+ /* try to find out how much the transformation matrix would
+ stretch the dashes, and factor that into the dash lengths.
+ This is not the entirely correct approach- it would be
+ better to first convert the path to an unscaled version,
+ then apply dashing, and then transform the path using
+ the current transformation matrix. However there are few
+ PDFs which actually stretch a dashed path in a non-orthonormal
+ way */
+ double tx1, ty1, tx2, ty2;
+ this->transformXY(state, 0, 0, &tx1, &ty1);
+ this->transformXY(state, 1, 1, &tx2, &ty2);
+ double f = sqrt(sqr(tx2-tx1)+sqr(ty2-ty1)) / SQRT2;
+
+ msg("<trace> %d dashes", this->dashLength);
+ msg("<trace> | phase: %f", this->dashStart);
+ for(t=0;t<this->dashLength;t++) {
+ dash[t] = (float)this->dashPattern[t] * f;
+ msg("<trace> | d%-3d: %f", t, this->dashPattern[t]);