mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Right-align moon indicators when day numbers are left-aligned.
This commit is contained in:
109
src/rem2ps.c
109
src/rem2ps.c
@@ -143,6 +143,18 @@ void WriteOneEntry (CalEntry *c);
|
|||||||
void GetSmallLocations (void);
|
void GetSmallLocations (void);
|
||||||
char const *EatToken(char const *in, char *out, int maxlen);
|
char const *EatToken(char const *in, char *out, int maxlen);
|
||||||
|
|
||||||
|
static void
|
||||||
|
put_escaped_string(char const *s)
|
||||||
|
{
|
||||||
|
while(*s) {
|
||||||
|
if (*s == '\\' || *s == '(' || *s == ')') {
|
||||||
|
PutChar('\\');
|
||||||
|
}
|
||||||
|
PutChar(*s);
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* StrCmpi */
|
/* StrCmpi */
|
||||||
@@ -1066,10 +1078,10 @@ int DoQueuedPs(void)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fnoff;
|
int fnoff;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
char const *size, *extra;
|
char fbuffer[512];
|
||||||
|
char const *size, *fsize, *extra;
|
||||||
char const *s;
|
char const *s;
|
||||||
int num, r, g, b, phase, fontsize, moonsize;
|
int num, r, g, b, phase, fontsize, moonsize;
|
||||||
unsigned char c;
|
|
||||||
|
|
||||||
if (!MondayFirst) begin = CurDay - WkDayNum;
|
if (!MondayFirst) begin = CurDay - WkDayNum;
|
||||||
else begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
|
else begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
|
||||||
@@ -1141,19 +1153,28 @@ int DoQueuedPs(void)
|
|||||||
while(*s && isspace(*s)) {
|
while(*s && isspace(*s)) {
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
while(*s) {
|
put_escaped_string(s);
|
||||||
if (*s == '\\' || *s == '(' || *s == ')') {
|
|
||||||
PutChar('\\');
|
|
||||||
}
|
|
||||||
PutChar(*s);
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
printf(") show grestore\n");
|
printf(") show grestore\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPECIAL_MOON: /* Moon phase */
|
case SPECIAL_MOON: /* Moon phase */
|
||||||
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
||||||
&fontsize);
|
&fontsize);
|
||||||
|
/* See if we have extra stuff */
|
||||||
|
extra = e->entry+fnoff;
|
||||||
|
|
||||||
|
/* Skip phase */
|
||||||
|
while(*extra && !isspace(*extra)) extra++;
|
||||||
|
while(*extra && isspace(*extra)) extra++;
|
||||||
|
|
||||||
|
/* Skip moon size */
|
||||||
|
while(*extra && !isspace(*extra)) extra++;
|
||||||
|
while(*extra && isspace(*extra)) extra++;
|
||||||
|
|
||||||
|
/* Skip font size */
|
||||||
|
while(*extra && !isspace(*extra)) extra++;
|
||||||
|
while(*extra && isspace(*extra)) extra++;
|
||||||
|
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
moonsize = -1;
|
moonsize = -1;
|
||||||
fontsize = -1;
|
fontsize = -1;
|
||||||
@@ -1175,12 +1196,27 @@ int DoQueuedPs(void)
|
|||||||
size = buffer;
|
size = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("gsave 0 setgray newpath ");
|
/* Store the starting X coordinate in "moonstartx" */
|
||||||
if (DaynumRight) {
|
if (DaynumRight) {
|
||||||
printf("Border %s add BoxHeight Border sub %s sub\n", size, size);
|
printf("Border %s add /moonstartx exch def", size);
|
||||||
} else {
|
} else {
|
||||||
printf("Border %s add " MOONMOVE " BoxHeight Border sub %s sub\n", size, e->daynum, size);
|
printf("xincr Border sub %s sub", size);
|
||||||
|
if (*extra) {
|
||||||
|
if (fontsize < 0) {
|
||||||
|
fsize = "EntrySize";
|
||||||
|
} else {
|
||||||
|
sprintf(fbuffer, "%d", fontsize);
|
||||||
|
fsize = fbuffer;
|
||||||
|
}
|
||||||
|
printf("/EntryFont findfont %s scalefont setfont (",
|
||||||
|
fsize);
|
||||||
|
put_escaped_string(extra);
|
||||||
|
printf(") stringwidth pop sub Border sub ");
|
||||||
|
}
|
||||||
|
printf("/moonstartx exch def\n");
|
||||||
}
|
}
|
||||||
|
printf(" gsave 0 setgray newpath ");
|
||||||
|
printf("moonstartx BoxHeight Border sub %s sub\n", size);
|
||||||
printf(" %s 0 360 arc closepath\n", size);
|
printf(" %s 0 360 arc closepath\n", size);
|
||||||
switch(phase) {
|
switch(phase) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -1192,60 +1228,27 @@ int DoQueuedPs(void)
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
printf("stroke\nnewpath ");
|
printf("stroke\nnewpath ");
|
||||||
if (DaynumRight) {
|
printf("moonstartx BoxHeight Border sub %s sub\n", size);
|
||||||
printf("Border %s add BoxHeight Border sub %s sub\n",
|
|
||||||
size, size);
|
|
||||||
} else {
|
|
||||||
printf("Border %s add " MOONMOVE " BoxHeight Border sub %s sub\n",
|
|
||||||
size, e->daynum, size);
|
|
||||||
}
|
|
||||||
printf("%s 90 270 arc closepath fill\n", size);
|
printf("%s 90 270 arc closepath fill\n", size);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("stroke\nnewpath ");
|
printf("stroke\nnewpath ");
|
||||||
if (DaynumRight) {
|
printf("moonstartx BoxHeight Border sub %s sub\n", size);
|
||||||
printf("Border %s add BoxHeight Border sub %s sub\n", size, size);
|
|
||||||
} else {
|
|
||||||
printf("Border %s add " MOONMOVE " BoxHeight Border sub %s sub\n", size, e->daynum, size);
|
|
||||||
}
|
|
||||||
printf("%s 270 90 arc closepath fill\n", size);
|
printf("%s 270 90 arc closepath fill\n", size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* See if we have extra stuff */
|
|
||||||
extra = e->entry+fnoff;
|
|
||||||
|
|
||||||
/* Skip phase */
|
|
||||||
while(*extra && !isspace(*extra)) extra++;
|
|
||||||
while(*extra && isspace(*extra)) extra++;
|
|
||||||
|
|
||||||
/* Skip moon size */
|
|
||||||
while(*extra && !isspace(*extra)) extra++;
|
|
||||||
while(*extra && isspace(*extra)) extra++;
|
|
||||||
|
|
||||||
/* Skip font size */
|
|
||||||
while(*extra && !isspace(*extra)) extra++;
|
|
||||||
while(*extra && isspace(*extra)) extra++;
|
|
||||||
|
|
||||||
/* Anything left? */
|
/* Anything left? */
|
||||||
if (*extra) {
|
if (*extra) {
|
||||||
if (DaynumRight) {
|
printf("moonstartx %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size);
|
||||||
printf("Border %s add %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size, size);
|
|
||||||
} else {
|
|
||||||
printf("Border %s add %s add Border add " MOONMOVE " BoxHeight border sub %s sub %s sub moveto\n", size, size, e->daynum, size, size);
|
|
||||||
}
|
|
||||||
if (fontsize < 0) {
|
if (fontsize < 0) {
|
||||||
size = "EntrySize";
|
fsize = "EntrySize";
|
||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "%d", fontsize);
|
sprintf(fbuffer, "%d", fontsize);
|
||||||
size = buffer;
|
fsize = fbuffer;
|
||||||
}
|
}
|
||||||
printf("/EntryFont findfont %s scalefont setfont (",
|
printf("/EntryFont findfont %s scalefont setfont (",
|
||||||
size);
|
fsize);
|
||||||
while(*extra) {
|
put_escaped_string(extra);
|
||||||
c = (unsigned char) *extra++;
|
|
||||||
if (c == '\\' || c == '(' || c == ')') PutChar('\\');
|
|
||||||
PutChar(c);
|
|
||||||
}
|
|
||||||
printf(") show\n");
|
printf(") show\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4778,10 +4778,10 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
1 0.8 1 setrgbcolor fill 0.0 setgray
|
1 0.8 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
stroke
|
stroke
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (20:56) show
|
/EntryFont findfont EntrySize scalefont setfont (20:56) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -4953,12 +4953,12 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
0.8 1 1 setrgbcolor fill 0.0 setgray
|
0.8 1 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
stroke
|
stroke
|
||||||
newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 270 90 arc closepath fill
|
DaySize 2 div 270 90 arc closepath fill
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (14:56) show
|
/EntryFont findfont EntrySize scalefont setfont (14:56) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -5119,10 +5119,10 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
0.8 1 1 setrgbcolor fill 0.0 setgray
|
0.8 1 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
fill
|
fill
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (06:02) show
|
/EntryFont findfont EntrySize scalefont setfont (06:02) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -5283,12 +5283,12 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
0.8 1 1 setrgbcolor fill 0.0 setgray
|
0.8 1 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
stroke
|
stroke
|
||||||
newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 90 270 arc closepath fill
|
DaySize 2 div 90 270 arc closepath fill
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (07:42) show
|
/EntryFont findfont EntrySize scalefont setfont (07:42) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -5882,10 +5882,10 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
1 0.8 1 setrgbcolor fill 0.0 setgray
|
1 0.8 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
stroke
|
stroke
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (20:56) show
|
/EntryFont findfont EntrySize scalefont setfont (20:56) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -6057,12 +6057,12 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
0.8 1 1 setrgbcolor fill 0.0 setgray
|
0.8 1 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
stroke
|
stroke
|
||||||
newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 270 90 arc closepath fill
|
DaySize 2 div 270 90 arc closepath fill
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (14:56) show
|
/EntryFont findfont EntrySize scalefont setfont (14:56) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -6223,10 +6223,10 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
0.8 1 1 setrgbcolor fill 0.0 setgray
|
0.8 1 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
fill
|
fill
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (06:02) show
|
/EntryFont findfont EntrySize scalefont setfont (06:02) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
@@ -6387,12 +6387,12 @@ _A BoxHeight _A sub lineto closepath
|
|||||||
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto
|
||||||
_A BoxHeight _A sub lineto closepath
|
_A BoxHeight _A sub lineto closepath
|
||||||
0.8 1 1 setrgbcolor fill 0.0 setgray
|
0.8 1 1 setrgbcolor fill 0.0 setgray
|
||||||
gsave 0 setgray newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
Border DaySize 2 div add /moonstartx exch def gsave 0 setgray newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 0 360 arc closepath
|
DaySize 2 div 0 360 arc closepath
|
||||||
stroke
|
stroke
|
||||||
newpath Border DaySize 2 div add BoxHeight Border sub DaySize 2 div sub
|
newpath moonstartx BoxHeight Border sub DaySize 2 div sub
|
||||||
DaySize 2 div 90 270 arc closepath fill
|
DaySize 2 div 90 270 arc closepath fill
|
||||||
Border DaySize 2 div add DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
moonstartx DaySize 2 div add Border add BoxHeight border sub DaySize 2 div sub DaySize 2 div sub moveto
|
||||||
/EntryFont findfont EntrySize scalefont setfont (07:42) show
|
/EntryFont findfont EntrySize scalefont setfont (07:42) show
|
||||||
grestore
|
grestore
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user