- tv=analogtv_allocate(dpy, window);
- analogtv_set_defaults(tv, "");
- tv->event_handler = screenhack_handle_event;
-
- analogtv_make_font(dpy, window, &score_font,
- 4, 6, NULL );
-
- /* If you think we haven't learned anything since the early 70s,
- look at this font for a while */
- analogtv_font_set_char(&score_font, '0',
- "****"
- "* *"
- "* *"
- "* *"
- "* *"
- "****");
- analogtv_font_set_char(&score_font, '1',
- " *"
- " *"
- " *"
- " *"
- " *"
- " *");
- analogtv_font_set_char(&score_font, '2',
- "****"
- " *"
- "****"
- "* "
- "* "
- "****");
- analogtv_font_set_char(&score_font, '3',
- "****"
- " *"
- "****"
- " *"
- " *"
- "****");
- analogtv_font_set_char(&score_font, '4',
- "* *"
- "* *"
- "****"
- " *"
- " *"
- " *");
- analogtv_font_set_char(&score_font, '5',
- "****"
- "* "
- "****"
- " *"
- " *"
- "****");
- analogtv_font_set_char(&score_font, '6',
- "****"
- "* "
- "****"
- "* *"
- "* *"
- "****");
- analogtv_font_set_char(&score_font, '7',
- "****"
- " *"
- " *"
- " *"
- " *"
- " *");
- analogtv_font_set_char(&score_font, '8',
- "****"
- "* *"
- "****"
- "* *"
- "* *"
- "****");
- analogtv_font_set_char(&score_font, '9',
- "****"
- "* *"
- "****"
- " *"
- " *"
- " *");
-
- score_font.y_mult *= 2;
- score_font.x_mult *= 2;
+ struct state *st = (struct state *) calloc (1, sizeof(*st));
+
+ int i;
+ struct {
+ int w, h;
+ char *s[10];
+ } fonts[2] = {
+ { /* regular pong font */
+ /* If you think we haven't learned anything since the early 70s,
+ look at this font for a while */
+ 4, 6,
+ {
+ "****"
+ "* *"
+ "* *"
+ "* *"
+ "* *"
+ "****",
+
+ " *"
+ " *"
+ " *"
+ " *"
+ " *"
+ " *",
+
+ "****"
+ " *"
+ "****"
+ "* "
+ "* "
+ "****",
+
+ "****"
+ " *"
+ "****"
+ " *"
+ " *"
+ "****",
+
+ "* *"
+ "* *"
+ "****"
+ " *"
+ " *"
+ " *",
+
+ "****"
+ "* "
+ "****"
+ " *"
+ " *"
+ "****",
+
+ "****"
+ "* "
+ "****"
+ "* *"
+ "* *"
+ "****",
+
+ "****"
+ " *"
+ " *"
+ " *"
+ " *"
+ " *",
+
+ "****"
+ "* *"
+ "****"
+ "* *"
+ "* *"
+ "****",
+
+ "****"
+ "* *"
+ "****"
+ " *"
+ " *"
+ " *"
+ }
+ },
+ { /* pong clock font - hand-crafted double size looks better */
+ 8, 12,
+ {
+ "####### "
+ "####### "
+ "## ## "
+ "## ## "
+ "## ## "
+ "## ## "
+ "## ## "
+ "## ## "
+ "## ## "
+ "####### "
+ "####### ",
+
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## ",
+
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ "####### "
+ "####### "
+ "## "
+ "## "
+ "## "
+ "####### "
+ "####### ",
+
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ " ## "
+ "####### "
+ "####### ",
+
+ "## ## "
+ "## ## "
+ "## ## "
+ "## ## "
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## ",
+
+ "####### "
+ "####### "
+ "## "
+ "## "
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ " ## "
+ "####### "
+ "####### ",
+
+ "####### "
+ "####### "
+ "## "
+ "## "
+ "####### "
+ "####### "
+ "## ## "
+ "## ## "
+ "## ## "
+ "####### "
+ "####### ",
+
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## "
+ " ## ",
+
+ "####### "
+ "####### "
+ "## ## "
+ "## ## "
+ "####### "
+ "####### "
+ "## ## "
+ "## ## "
+ "## ## "
+ "####### "
+ "####### ",
+
+ "####### "
+ "####### "
+ "## ## "
+ "## ## "
+ "####### "
+ "####### "
+ " ## "
+ " ## "
+ " ## "
+ "####### "
+ "####### "
+
+ }
+ }
+ };
+
+ st->dpy = dpy;
+ st->window = window;
+ st->tv=analogtv_allocate(st->dpy, st->window);
+ analogtv_set_defaults(st->tv, "");
+
+
+ st->clock = get_boolean_resource(st->dpy, "clock", "Boolean");
+
+ analogtv_make_font(st->dpy, st->window, &st->score_font,
+ fonts[st->clock].w, fonts[st->clock].h, NULL);
+
+ for (i=0; i<10; ++i)
+ {
+ analogtv_font_set_char(&st->score_font, '0'+i, fonts[st->clock].s[i]);
+ }