int main (int argc, char **argv) { int c; int row, col; double x, y; char *outname; outname = "cards.pdf"; while ((c = getopt (argc, argv, "n")) != EOF) { switch (c) { case 'n': draw_outline = 0; break; default: usage (); } } if (optind != argc) usage (); init_pdf (outname); setup_fonts (); code_surface = cairo_image_surface_create_from_png ("code-med-high.png"); code_pattern = cairo_pattern_create_for_surface (code_surface); for (row = 0; row < 5; row++) { for (col = 0; col < 2; col++) { cairo_save (cr); x = LEFT_MARGIN + col * CARD_WIDTH; y = TOP_MARGIN + row * CARD_HEIGHT; cairo_translate (cr, x, y); draw_card (); cairo_restore (cr); } } cairo_destroy(cr); cairo_surface_flush(surface); cairo_surface_destroy(surface); printf ("evince %s\n", outname); return (0); }
static void pango_load_all_fonts(void) { setup_fonts(); GLOBALS->signalfont=do_font_load(GLOBALS->fontname_signals); if(!GLOBALS->signalfont) { if(GLOBALS->use_big_fonts) { GLOBALS->signalfont=do_font_load(GLOBALS->use_nonprop_fonts ? WAVE_MONOSPACE_12 : WAVE_SANS_12); } else { GLOBALS->signalfont=do_font_load(GLOBALS->use_nonprop_fonts ? WAVE_MONOSPACE_10 : WAVE_SANS_10); } } GLOBALS->fontheight= my_font_height(GLOBALS->signalfont)+4; GLOBALS->wavefont=GLOBALS->wavefont_smaller=do_font_load(GLOBALS->fontname_waves); if(!GLOBALS->wavefont) { if(GLOBALS->use_big_fonts) { GLOBALS->wavefont=do_font_load(WAVE_MONOSPACE_12); GLOBALS->wavefont_smaller=do_font_load(WAVE_MONOSPACE_10); } else { GLOBALS->wavefont=do_font_load(WAVE_MONOSPACE_8); GLOBALS->wavefont_smaller=do_font_load(WAVE_MONOSPACE_6); } } if( my_font_height(GLOBALS->signalfont) < my_font_height(GLOBALS->wavefont)) { fprintf(stderr, "Signalfont is smaller than wavefont (%d vs %d). Exiting!\n", my_font_height(GLOBALS->signalfont), my_font_height(GLOBALS->wavefont)); exit(1); } if(my_font_height(GLOBALS->signalfont)>100) { fprintf(stderr, "Fonts are too big! Try fonts with a smaller size. Exiting!\n"); exit(1); } GLOBALS->wavecrosspiece=GLOBALS->wavefont->ascent+1; }