mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-10 14:03:06 -04:00
Shuffle scaling around so we always work on 100×100 pixels.
Width variations are not catered for by scaling on output.
This commit is contained in:
parent
530a41fab6
commit
7a06191a8f
20
bedstead.c
20
bedstead.c
@ -175,14 +175,16 @@ static int const nwidths = sizeof(widths) / sizeof(widths[0]);
|
||||
|
||||
struct width const *width = &widths[0];
|
||||
|
||||
/* Size of pixels in font design units (usually 1000/em) */
|
||||
/* Size of output pixels in font design units (usually 1000/em) */
|
||||
#define XPIX (width->xpix)
|
||||
#define YPIX 100
|
||||
|
||||
/* We work internally in smaller units, though. */
|
||||
#define SCALE 2
|
||||
#define XPIX_S (XPIX * SCALE)
|
||||
#define YPIX_S (YPIX * SCALE)
|
||||
/* Internally, we work in pixels 100 design units square */
|
||||
#define XPIX_S 100
|
||||
#define YPIX_S 100
|
||||
|
||||
#define XSCALE ((double)XPIX_S / (double)XPIX)
|
||||
#define YSCALE ((double)YPIX_S / (double)YPIX)
|
||||
|
||||
/* Position of diagonal lines within pixels */
|
||||
#define XQTR_S (XPIX_S/4)
|
||||
@ -1831,8 +1833,8 @@ emit_path()
|
||||
started = 1;
|
||||
do {
|
||||
printf(" %g %g %s 1\n",
|
||||
(double)p->v.x / SCALE,
|
||||
(double)p->v.y / SCALE - 3*YPIX,
|
||||
(double)p->v.x / XSCALE,
|
||||
(double)p->v.y / YSCALE - 3*YPIX,
|
||||
p == &points[i] && p->next ? "m" : "l");
|
||||
p1 = p->next;
|
||||
p->prev = p->next = NULL;
|
||||
@ -1850,9 +1852,9 @@ emit_path()
|
||||
* waveform of the SAA5050. This is implemented by moving all left
|
||||
* edges left and right. The code below only handles cases where we
|
||||
* don't run out of slack in horizontal lines, which limits weight to
|
||||
* the range (-50 * SCALE) < weight < (25 * SCALE).
|
||||
* the range (-0.5 * XPIX) < weight < (0.25 * XPIX).
|
||||
*/
|
||||
static int weight = 0 * SCALE;
|
||||
static int weight = 0;
|
||||
|
||||
static void
|
||||
adjust_weight()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user