From af8b4b2520fc43fba5d67513aeb3ef488bea3978 Mon Sep 17 00:00:00 2001 From: Lauris Kaplinski Date: Thu, 31 Aug 2000 00:32:57 +0000 Subject: Made it compilable both with gnome-print 0.20 and 0.21+ svn path=/trunk/; revision=5126 --- calendar/gui/print.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'calendar/gui/print.c') diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 1554be0b96..99d60f3c92 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -29,9 +29,9 @@ #include #include #include -#include #include #include +#include #include #include "calendar-commands.h" #include "gnome-cal.h" @@ -243,7 +243,7 @@ print_text(GnomePrintContext *pc, GnomeFont *font, const char *text, enum align_ x = l+((r-l)-w)/2; break; } - gnome_print_moveto(pc, x, t-font->size); + gnome_print_moveto(pc, x, t - gnome_font_get_size (font)); gnome_print_setfont(pc, font); gnome_print_setrgbcolor (pc, 0,0,0); gnome_print_show(pc, text); @@ -266,15 +266,15 @@ titled_box(GnomePrintContext *pc, const char *text, GnomeFont *font, enum align_ { if (align&ALIGN_BORDER) { gnome_print_gsave(pc); - print_border(pc, *l, *r, *t, *t-font->size-font->size*0.4, linewidth, 0.9); - print_border(pc, *l, *r, *t-font->size-font->size*0.4, *b, linewidth, -1.0); + print_border(pc, *l, *r, *t, *t-gnome_font_get_size(font)-gnome_font_get_size(font)*0.4, linewidth, 0.9); + print_border(pc, *l, *r, *t-gnome_font_get_size(font)-gnome_font_get_size(font)*0.4, *b, linewidth, -1.0); gnome_print_grestore(pc); *l+=2; *r-=2; *b+=2; } print_text(pc, font, text, align, *l, *r, *t, *b); - *t-=font->size*1.4; + *t-=gnome_font_get_size(font)*1.4; } enum datefmt { @@ -370,10 +370,10 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, font = gnome_font_new_closest ("Times", GNOME_FONT_BOLD, 1, size*1.2); /* title font */ if (bordertitle) print_border(pc, - left, left+7*xpad, top, top-font->size*1.3, + left, left+7*xpad, top, top-gnome_font_get_size(font)*1.3, 1.0, 0.9); print_text(pc, font, buf, ALIGN_CENTRE, - left, left+7*xpad, top, top - font->size); + left, left+7*xpad, top, top - gnome_font_get_size (font)); gtk_object_unref (GTK_OBJECT (font)); font_normal = gnome_font_new_closest ("Times", GNOME_FONT_BOOK, 0, size); @@ -382,7 +382,7 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, gnome_print_setrgbcolor (pc, 0,0,0); for (x=0;x<7;x++) { print_text(pc, font_bold, daynames[(week_starts_on_monday?x+1:x)%7], ALIGN_CENTRE, - left+x*xpad, left+(x+1)*xpad, bottom+7*ypad, bottom+7*ypad-font_bold->size); + left+x*xpad, left+(x+1)*xpad, bottom+7*ypad, bottom+7*ypad-gnome_font_get_size(font_bold)); } for (y=0;y<6;y++) { @@ -404,12 +404,12 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, print_border(pc, left+x*xpad+xpad*0.1, left+(x+1)*xpad+xpad*0.1, - bottom+(5-y)*ypad+font->size-ypad*0.15, + bottom+(5-y)*ypad+gnome_font_get_size(font)-ypad*0.15, bottom+(5-y)*ypad-ypad*0.15, -1.0, 0.75); } print_text(pc, font, buf, ALIGN_RIGHT, - left+x*xpad, left+(x+1)*xpad, bottom+(5-y)*ypad+font->size, bottom+(5-y)*ypad); + left+x*xpad, left+(x+1)*xpad, bottom+(5-y)*ypad+gnome_font_get_size(font), bottom+(5-y)*ypad); now = next; } } @@ -445,7 +445,7 @@ bound_text(GnomePrintContext *pc, GnomeFont *font, char *text, double left, doub outbuffer = g_malloc(outbufflen); outbuffendmarker = outbuffer+outbufflen-2; - top -= font->size; + top -= gnome_font_get_size (font); gnome_print_setfont (pc, font); width=0; @@ -470,7 +470,7 @@ bound_text(GnomePrintContext *pc, GnomeFont *font, char *text, double left, doub *o++=c; if (c==' ') wordstart = o; - width+=gnome_font_get_width(font, c); + width+=gnome_font_get_glyph_width(font, gnome_font_lookup_default (font, c)); if (width>maxwidth) dump=1; else @@ -488,7 +488,7 @@ bound_text(GnomePrintContext *pc, GnomeFont *font, char *text, double left, doub width = gnome_font_get_width_string_n(font, outbuffer, o-wordstart); o=outbuffer+(o-wordstart); wordstart = outbuffer; - top -= font->size; + top -= gnome_font_get_size (font); if (topsize; + top -= gnome_font_get_size (font); } g_free(outbuffer); return top; @@ -734,14 +734,14 @@ print_day_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence, x = left + incsmall; xend = right - inc; - if (y - font_summary->size < bottom) + if (y - gnome_font_get_size (font_summary) < bottom) break; tm = *localtime (&ei->start); strftime (buf, 100, TIME_FMT, &tm); gnome_print_moveto (pc, x + (margin - gnome_font_get_width_string (font_summary, buf)), - y - font_summary->size); + y - gnome_font_get_size (font_summary)); gnome_print_show (pc, buf); if (totime) { @@ -751,7 +751,7 @@ print_day_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence, (x + margin + inc + (margin - gnome_font_get_width_string (font_summary, buf))), - y - font_summary->size); + y - gnome_font_get_size (font_summary)); gnome_print_show (pc, buf); y = bound_text (pc, font_summary, ei->text, @@ -764,7 +764,7 @@ print_day_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence, y, yend, -margin + inc); } - y += font_summary->size - inc; + y += gnome_font_get_size (font_summary) - inc; g_free (ei); } @@ -879,9 +879,9 @@ print_month_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence, format_date(today, DATE_DAYNAME, buf, 100); print_text(pc, font_days, buf, ALIGN_CENTRE, (right-left)*x/7+left, (right-left)*(x+1)/7+left, - top, top-font_days->size); + top, top-gnome_font_get_size(font_days)); } - top -= font_days->size*1.5; + top -= gnome_font_get_size(font_days)*1.5; gtk_object_unref (GTK_OBJECT (font_days)); for (y=0;y<6;y++) { @@ -953,7 +953,7 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t start, ti break; y = bound_text (pc, font_summary, ei->text, x + 2, xend, y, yend, 0); - y += font_summary->size; + y += gnome_font_get_size (font_summary); gnome_print_moveto (pc, x, y - 3); gnome_print_lineto (pc, xend, y - 3); gnome_print_stroke (pc); -- cgit v1.2.3