#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <libps/pslib-mp.h>
void errorhandler(PSDoc *p, int error, const char *str, void *data) {
fprintf(stderr, "PSLib: %s\n", str);
}
void frame(PSDoc *psdoc) {
PS_setlinewidth(psdoc, 60);
PS_moveto(psdoc, 150, 50);
PS_lineto(psdoc, 750, 50);
PS_arc(psdoc, 750, 150, 100, 270, 360);
PS_lineto(psdoc, 850, 750);
PS_arc(psdoc, 750, 750, 100, 0, 90);
PS_lineto(psdoc, 150, 850);
PS_arc(psdoc, 150, 750, 100, 90, 180);
PS_lineto(psdoc, 50, 150);
PS_arc(psdoc, 150, 150, 100, 180, 270);
PS_stroke(psdoc);
}
int main() {
PSDoc *psdoc;
int myfont;
float boxwidth, boxheight, baseline, colsep, leftmargin;
float fontsize;
int boxed;
boxwidth = 100;
boxheight = 630;
baseline = 100;
colsep = 20;
leftmargin = 100;
boxed = 0;
fontsize = 10.0;
PS_boot();
#ifdef MEMORY_DEBUGGING
PS_mp_init();
#endif
#ifdef MEMORY_DEBUGGING
psdoc = PS_new2(errorhandler, PS_mp_malloc, PS_mp_realloc, PS_mp_free, NULL);
#else
psdoc = PS_new();
#endif
PS_open_file(psdoc, "fontcreate.ps");
PS_set_info(psdoc, "Creator", __FILE__);
PS_set_info(psdoc, "Author", "Uwe Steinmann");
PS_set_info(psdoc, "Title", "Boxed Text");
PS_set_info(psdoc, "Keywords", "Boxes, Text Rendering");
PS_set_info(psdoc, "BoundingBox", "0 0 596 842");
myfont = PS_begin_font(psdoc, "test", 0, 0.001, 0.0, 0.0, 0.001, 0.0, 0.0, NULL);
PS_begin_glyph(psdoc, "a", 800.0, 0.0, 0.0, 800.0, 800.0);
PS_rect(psdoc, 10, 10, 300, 300);
PS_stroke(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "b", 800.0, 0.0, 0.0, 800.0, 800.0);
PS_rect(psdoc, 10, 10, 300, 300);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "zero", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "one", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 450, 450, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "two", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "three", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "four", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "five", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "six", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "seven", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "eight", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_begin_glyph(psdoc, "nine", 900.0, 0.0, 0.0, 900.0, 900.0);
frame(psdoc);
PS_circle(psdoc, 250, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 250, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 450, 650, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 250, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 450, 80);
PS_fill(psdoc);
PS_circle(psdoc, 650, 650, 80);
PS_fill(psdoc);
PS_end_glyph(psdoc);
PS_end_font(psdoc);
PS_begin_page(psdoc, 596, 842);
PS_setfont(psdoc, myfont, 80.0);
PS_show_xy(psdoc, "123456", 80, 700);
PS_setfont(psdoc, myfont, 60.0);
PS_show_xy(psdoc, "12345678", 80, 600);
PS_setfont(psdoc, myfont, 40.0);
PS_show_xy(psdoc, "1234567890", 80, 500);
PS_setfont(psdoc, myfont, 20.0);
PS_show_xy(psdoc, "1234567890", 80, 400);
PS_setfont(psdoc, myfont, 10.0);
PS_show_xy(psdoc, "1234567890", 80, 300);
PS_end_page(psdoc);
PS_close(psdoc);
PS_delete(psdoc);
#ifdef MEMORY_DEBUGGING
PS_mp_list_unfreed();
#endif
PS_shutdown();
exit(0);
}