123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include "sys-defines.h"
- #include "extern.h"
- bool
- _pl_f_retrieve_font (S___(Plotter *_plotter))
- {
- double theta;
- double dx, dy, device_dx, device_dy, device_vector_len;
- double pointsize, fig_pointsize, size, quantized_size;
- int int_fig_pointsize;
- double quantization_factor;
-
- if (_plotter->drawstate->font_type != PL_F_POSTSCRIPT)
- return false;
-
- if (!_plotter->drawstate->transform.uniform
- || !_plotter->drawstate->transform.nonreflection)
-
- return false;
-
- theta = _plotter->drawstate->text_rotation * M_PI / 180.0;
-
- dx = cos (theta);
- dy = sin (theta);
-
- device_dx = XDV(dx, dy);
- device_dy = YDV(dx, dy);
- device_vector_len = sqrt(device_dx * device_dx + device_dy * device_dy);
-
- size = _plotter->drawstate->font_size;
- pointsize = FIG_UNITS_TO_POINTS(size * device_vector_len);
-
- fig_pointsize = FIG_FONT_SCALING * pointsize;
-
- int_fig_pointsize = IROUND(fig_pointsize);
-
- _plotter->drawstate->fig_font_point_size = int_fig_pointsize;
-
-
- if (device_vector_len == 0.0)
- quantized_size = 0.0;
- else
- quantized_size =
- (POINTS_TO_FIG_UNITS((double)int_fig_pointsize / FIG_FONT_SCALING))
- / (device_vector_len);
- _plotter->drawstate->true_font_size = quantized_size;
-
- if (size == 0.0)
- quantization_factor = 0.0;
- else
- quantization_factor = quantized_size / size;
- _plotter->drawstate->font_ascent *= quantization_factor;
- _plotter->drawstate->font_descent *= quantization_factor;
- _plotter->drawstate->font_cap_height *= quantization_factor;
- return true;
- }
|