void text_keypad_thumbscript_push(int n) { int fc, lc, ch; if (text_keypad_thumbscript_last == 0) { text_keypad_thumbscript_last = n; } else { fc = text_keypad_thumbscript_last; lc = n; text_keypad_thumbscript_last = 0; switch (text_keypad_thumbscript_mode) { case 0: /* normal */ ch = text_keypad_thumbscript_normal[fc*9 + lc]; break; case 1: /* shift */ ch = text_keypad_thumbscript_shift[fc*9 + lc]; break; case 3: /* mod */ case 2: /* cmd */ case 4: /* alt */ case 5: /* meta/ctrl */ case 6: /* fn */ ch = text_keypad_thumbscript_mod[fc*9 + lc]; break; } if (ch < 7) { text_keypad_thumbscript_mode = ch; } else { text_keypad_thumbscript_mode = 0; if ((ch >= 128) && (ch <= 136)) { fc = text_get_buffer()[text_get_iposition()-1]; if ((fc >= 'A') && (fc <= 'Z')) { text_output_char(8); text_output_char(text_keypad_thumbscript_accents[(ch-128)*52 + 0 + (fc-'A')]); } else if ((fc >= 'a') && (fc <= 'z')) { text_output_char(8); text_output_char(text_keypad_thumbscript_accents[(ch-128)*52 + 26 + (fc-'a')]); } } else { text_output_char(ch); } } } }
int text_keypad_thumbscript_event(GR_EVENT *event) { int i; switch (event->type) { case GR_EVENT_TYPE_TIMER: if (is_clickwheel_timer(event)) { i = clickwheel_octrant(); if (clickwheel_change(i) && (i>=0)) { text_keypad_thumbscript_4gpush(i); text_draw(); } } break; case GR_EVENT_TYPE_KEY_DOWN: switch (event->keystroke.ch) { case '\n': case '\r': text_keypad_thumbscript_push(4); text_draw(); break; case 'l': case 'r': break; case 'w': text_output_char(28); break; case 'f': text_output_char(29); break; case 'd': text_output_char(10); break; case 'm': text_exit(); break; } break; } return 1; }
void main (unsigned argc, string argv[]) { bzr_preamble_type preamble; bzr_postamble_type postamble; tfm_char_type *tfm_chars; tfm_global_info_type tfm_info; string tfm_name; unsigned this_char; unsigned char_count = 0; string font_name = read_command_line (argc, argv); string font_basename = basename (font_name); string bzr_name = concat (font_name, ".bzr"); if (!bzr_open_input_file (bzr_name)) FATAL1 ("%s: Could not find BZR file", font_name); tfm_name = find_tfm_filename (font_name); if (tfm_name == NULL || !tfm_open_input_file (tfm_name)) FATAL1 ("%s: Could not find TFM file", font_name); preamble = bzr_get_preamble (); postamble = bzr_get_postamble (); tfm_info = tfm_get_global_info (); tfm_chars = tfm_get_chars (); if (output_name == NULL) output_name = strtok (xstrdup (font_basename), "0123456789"); else if (find_suffix (output_name) != NULL && ((output[metafont] && output[pstype1]) || (output[metafont] && output[pstype3]) || (output[pstype1] && output[pstype3]))) FATAL ("You can't specify all the output files' suffices to be the same"); if (output[metafont]) metafont_start_output (output_name, preamble, tfm_info); if (output[pstype1]) pstype1_start_output (font_basename, output_name, preamble, postamble, tfm_info); if (output[pstype3]) pstype3_start_output (font_basename, output_name, preamble, postamble, tfm_info); if (output[text]) text_start_output (font_basename, preamble); for (this_char = 0; this_char <= MAX_CHARCODE; this_char++) { bzr_char_type *c = bzr_get_char (this_char); if (c != NULL) { REPORT1 ("[%u", this_char); BZR_SHAPE (*c) = oblique_splines (BZR_SHAPE (*c)); if (output[metafont]) metafont_output_char (*c); if (output[pstype1]) pstype1_output_char (*c); if (output[pstype3]) pstype3_output_char (*c); if (output[text]) text_output_char (*c); REPORT1 ("]%c", ++char_count % 8 ? ' ' : '\n'); } } if (output[metafont]) metafont_finish_output (tfm_chars); if (output[pstype1]) pstype1_finish_output (); if (output[pstype3]) pstype3_finish_output (); if (output[text]) text_finish_output (postamble); if (char_count % 8 != 0) REPORT ("\n"); bzr_close_input_file (); tfm_close_input_file (); exit (0); }