home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume21 / xfig / patch02j / xfig.02
Encoding:
Text File  |  1993-10-21  |  28.5 KB  |  1,001 lines

  1.   static int    base_x, base_y;
  2. ! static PIX_ROT_FONT canvas_zoomed_font;
  3.   
  4.   static int    work_psflag, work_font, work_fontsize, work_textjust;
  5. ! static PIX_ROT_FONT work_fontstruct;
  6. ! static float    work_angle;
  7.   static        finish_n_start();
  8.   static        init_text_input(), cancel_text_input();
  9.   static        wrap_up();
  10. --- 42,54 ----
  11.   int        leng_prefix, leng_suffix;
  12.   static int    char_ht;
  13.   static int    base_x, base_y;
  14. ! static PIX_FONT canvas_zoomed_font;
  15.   
  16. + static int    is_newline;
  17.   static int    work_psflag, work_font, work_fontsize, work_textjust;
  18. ! static PIX_FONT work_fontstruct;
  19. ! static float    work_angle;        /* in RADIANS */
  20. ! static double    sin_t, cos_t;        /* sin(work_angle) and cos(work_angle) */
  21.   static        finish_n_start();
  22.   static        init_text_input(), cancel_text_input();
  23.   static        wrap_up();
  24. ***************
  25. *** 71,76 ****
  26. --- 74,80 ----
  27.       canvas_rightbut_proc = null_proc;
  28.       set_mousefun("posn cursor", "", "");
  29.       set_cursor(pencil_cursor);
  30. +     is_newline = 0;
  31.   }
  32.   
  33.   static
  34. ***************
  35. *** 105,123 ****
  36.   new_text_line()
  37.   {
  38.       wrap_up();
  39. !     if (work_angle < 90.0 - 0.001) {
  40. !     cur_y += (int) ((float) char_ht * cur_textstep);
  41. !     cur_x = base_x;
  42. !     } else if (work_angle < 180.0 - 0.001) {
  43. !     cur_x += (int) ((float) char_ht * cur_textstep);
  44. !     cur_y = base_y;
  45. !     } else if (work_angle < 270.0 - 0.001) {
  46. !     cur_y -= (int) ((float) char_ht * cur_textstep);
  47. !     cur_x = base_x;
  48. !     } else {
  49. !     cur_x -= (int) ((float) char_ht * cur_textstep);
  50. !     cur_y = base_y;
  51.       }
  52.       init_text_input(cur_x, cur_y);
  53.   }
  54.   
  55. --- 109,122 ----
  56.   new_text_line()
  57.   {
  58.       wrap_up();
  59. !     if (cur_t) {    /* use current text's position as ref */
  60. !     cur_x = round(cur_t->base_x + char_ht*cur_textstep*sin_t);
  61. !     cur_y = round(cur_t->base_y + char_ht*cur_textstep*cos_t);
  62. !     } else {        /* use position from previous text */
  63. !     cur_x = round(base_x + char_ht*cur_textstep*sin_t);
  64. !     cur_y = round(base_y + char_ht*cur_textstep*cos_t);
  65.       }
  66. +     is_newline = 1;
  67.       init_text_input(cur_x, cur_y);
  68.   }
  69.   
  70. ***************
  71. *** 170,177 ****
  72.   init_text_input(x, y)
  73.       int            x, y;
  74.   {
  75. !     int            length, d;
  76.       PR_SIZE        tsize;
  77.   
  78.       cur_x = x;
  79.       cur_y = y;
  80. --- 169,177 ----
  81.   init_text_input(x, y)
  82.       int            x, y;
  83.   {
  84. !     int            length, posn;
  85.       PR_SIZE        tsize;
  86. +     float        lensin, lencos;
  87.   
  88.       cur_x = x;
  89.       cur_y = y;
  90. ***************
  91. *** 191,198 ****
  92.        * through
  93.        */
  94.   
  95. !     put_msg("Ready for text input (from keyboard)");
  96. !     if ((cur_t = text_search(cur_x, cur_y)) == NULL) {    /* new text input */
  97.       leng_prefix = leng_suffix = 0;
  98.       *suffix = 0;
  99.       prefix[leng_prefix] = '\0';
  100. --- 191,197 ----
  101.        * through
  102.        */
  103.   
  104. !     if ((cur_t = text_search(cur_x, cur_y, &posn)) == NULL) {    /* new text input */
  105.       leng_prefix = leng_suffix = 0;
  106.       *suffix = 0;
  107.       prefix[leng_prefix] = '\0';
  108. ***************
  109. *** 199,221 ****
  110.       base_x = cur_x;
  111.       base_y = cur_y;
  112.   
  113. !     work_fontsize = cur_fontsize;
  114. !     work_font     = using_ps ? cur_ps_font : cur_latex_font;
  115. !     work_psflag   = using_ps;
  116. !     work_textjust = cur_textjust;
  117. !     work_angle    = cur_elltextangle;
  118. !     if (work_angle < 0.0)
  119. !         work_angle += 360.0;
  120.   
  121. !     /* load the X font and get its id for this font, size and angle UNZOOMED */
  122. !     /* this is to get widths etc for the unzoomed chars */
  123. !     canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  124. !                work_fontsize, work_angle*M_PI/180.0);
  125. !     /* get the ZOOMED font for actually drawing on the canvas */
  126. !     canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font), 
  127. !                round(work_fontsize*zoomscale), work_angle*M_PI/180.0);
  128. !     /* save the working font structure */
  129. !     work_fontstruct = canvas_zoomed_font;
  130.       } else {            /* clicked on existing text */
  131.       if (hidden_text(cur_t)) {
  132.           put_msg("Can't edit hidden text");
  133. --- 198,226 ----
  134.       base_x = cur_x;
  135.       base_y = cur_y;
  136.   
  137. !     if (is_newline) {    /* working settings already set */
  138. !         is_newline = 0;
  139. !     } else {        /* set working settings from ind panel */
  140. !         work_fontsize = cur_fontsize;
  141. !         work_font     = using_ps ? cur_ps_font : cur_latex_font;
  142. !         work_psflag   = using_ps;
  143. !         work_textjust = cur_textjust;
  144. !         work_angle    = cur_elltextangle*M_PI/180.0;
  145. !         while (work_angle < 0.0)
  146. !         work_angle += M_2PI;
  147. !         sin_t = sin((double)work_angle);
  148. !         cos_t = cos((double)work_angle);
  149.   
  150. !         /* load the X font and get its id for this font and size UNZOOMED */
  151. !         /* this is to get widths etc for the unzoomed chars */
  152. !         canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  153. !                work_fontsize);
  154. !         /* get the ZOOMED font for actually drawing on the canvas */
  155. !         canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font), 
  156. !                round(work_fontsize*zoomscale));
  157. !         /* save the working font structure */
  158. !         work_fontstruct = canvas_zoomed_font;
  159. !     }
  160.       } else {            /* clicked on existing text */
  161.       if (hidden_text(cur_t)) {
  162.           put_msg("Can't edit hidden text");
  163. ***************
  164. *** 229,241 ****
  165.       work_fontsize = cur_t->size;
  166.       work_psflag   = cur_t->flags;
  167.       work_textjust = cur_t->type;
  168. !     work_angle    = cur_t->angle*180.0/M_PI;
  169. !     if (work_angle < 0.0)
  170. !         work_angle += 360.0;
  171.       /* load the X font and get its id for this font, size and angle UNZOOMED */
  172.       /* this is to get widths etc for the unzoomed chars */
  173.       canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  174. !                work_fontsize, work_angle*M_PI/180.0);
  175.   
  176.       toggle_textmarker(cur_t);
  177.       draw_text(cur_t, ERASE);
  178. --- 234,249 ----
  179.       work_fontsize = cur_t->size;
  180.       work_psflag   = cur_t->flags;
  181.       work_textjust = cur_t->type;
  182. !     work_angle    = cur_t->angle;
  183. !     while (work_angle < 0.0)
  184. !         work_angle += M_2PI;
  185. !     sin_t = sin((double)work_angle);
  186. !     cos_t = cos((double)work_angle);
  187.       /* load the X font and get its id for this font, size and angle UNZOOMED */
  188.       /* this is to get widths etc for the unzoomed chars */
  189.       canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  190. !                work_fontsize);
  191.   
  192.       toggle_textmarker(cur_t);
  193.       draw_text(cur_t, ERASE);
  194. ***************
  195. *** 242,298 ****
  196.       base_x = cur_t->base_x;
  197.       base_y = cur_t->base_y;
  198.       length = cur_t->length;
  199.       switch (cur_t->type) {
  200.       case T_CENTER_JUSTIFIED:
  201. !         if (work_angle < 90.0 - 0.001) 
  202. !         base_x -= length / 2;
  203. !         else if (work_angle < 180.0 - 0.001)
  204. !         base_y += length / 2;
  205. !         else if (work_angle < 270.0 - 0.001)
  206. !         base_x += length / 2;
  207. !         else
  208. !         base_y -= length / 2;
  209.           break;
  210.   
  211.       case T_RIGHT_JUSTIFIED:
  212. !         if (work_angle < 90.0 - 0.001) 
  213. !         base_x -= length;
  214. !         else if (work_angle < 180.0 - 0.001)
  215. !         base_y += length;
  216. !         else if (work_angle < 270.0 - 0.001)
  217. !         base_x += length;
  218. !         else
  219. !         base_y -= length;
  220.           break;
  221.       } /* switch */
  222. !     if (work_angle < 90.0 - 0.001 || (work_angle >= 180.0 - 0.001 
  223. !         && work_angle < 270.0 - 0.001))
  224. !         d = abs(cur_x - base_x);
  225. !     else
  226. !         d = abs(cur_y - base_y);
  227.       leng_suffix = strlen(cur_t->cstring);
  228.       /* leng_prefix is # of char in the text before the cursor */
  229. !     leng_prefix = prefix_length(cur_t->cstring, d);
  230.       leng_suffix -= leng_prefix;
  231.       cpy_n_char(prefix, cur_t->cstring, leng_prefix);
  232.       strcpy(suffix, &cur_t->cstring[leng_prefix]);
  233.       tsize = pf_textwidth(canvas_font, leng_prefix, prefix);
  234.   
  235. !     if (work_angle < 90.0 - 0.001) {
  236. !         cur_x = base_x + tsize.x;
  237. !         cur_y = base_y;
  238. !     } else if (work_angle < 180.0 - 0.001) {
  239. !         cur_x = base_x;
  240. !         cur_y = base_y - tsize.x;
  241. !     } else if (work_angle < 270.0 - 0.001) {
  242. !         cur_x = base_x - tsize.x;
  243. !         cur_y = base_y;
  244. !     } else {
  245. !         cur_x = base_x;
  246. !         cur_y = base_y + tsize.x;
  247. !     }
  248.       }
  249. !     char_ht = rot_char_height(canvas_font);
  250.       initialize_char_handler(canvas_win, finish_text_input,
  251.                   base_x, base_y);
  252.       draw_char_string();
  253. --- 250,283 ----
  254.       base_x = cur_t->base_x;
  255.       base_y = cur_t->base_y;
  256.       length = cur_t->length;
  257. +     lencos = length*cos_t;
  258. +     lensin = length*sin_t;
  259.       switch (cur_t->type) {
  260.       case T_CENTER_JUSTIFIED:
  261. !         base_x = round(base_x - lencos/2.0);
  262. !         base_y = round(base_y + lensin/2.0);
  263.           break;
  264.   
  265.       case T_RIGHT_JUSTIFIED:
  266. !         base_x = round(base_x - lencos);
  267. !         base_y = round(base_y + lensin);
  268.           break;
  269.       } /* switch */
  270.       leng_suffix = strlen(cur_t->cstring);
  271.       /* leng_prefix is # of char in the text before the cursor */
  272. !     leng_prefix = prefix_length(cur_t->cstring, posn);
  273.       leng_suffix -= leng_prefix;
  274.       cpy_n_char(prefix, cur_t->cstring, leng_prefix);
  275.       strcpy(suffix, &cur_t->cstring[leng_prefix]);
  276.       tsize = pf_textwidth(canvas_font, leng_prefix, prefix);
  277.   
  278. !     cur_x = round(base_x + tsize.x * cos_t);
  279. !     cur_y = round(base_y - tsize.x * sin_t);
  280.       }
  281. !     put_msg("Ready for text input (from keyboard)");
  282. !     char_ht = char_height(canvas_font);
  283.       initialize_char_handler(canvas_win, finish_text_input,
  284.                   base_x, base_y);
  285.       draw_char_string();
  286. ***************
  287. *** 316,322 ****
  288.       text->font = work_font;    /* put in current font number */
  289.       text->fontstruct = work_fontstruct;
  290.       text->size = work_fontsize;
  291. !     text->angle = work_angle/180.0*M_PI;    /* convert to radians */
  292.       text->flags = cur_textflags;
  293.       text->color = cur_color;
  294.       text->depth = cur_depth;
  295. --- 301,307 ----
  296.       text->font = work_font;    /* put in current font number */
  297.       text->fontstruct = work_fontstruct;
  298.       text->size = work_fontsize;
  299. !     text->angle = work_angle;
  300.       text->flags = cur_textflags;
  301.       text->color = cur_color;
  302.       text->depth = cur_depth;
  303. ***************
  304. *** 359,365 ****
  305.       if (where_p >= len_p)
  306.       return (len_c);        /* entire string is the prefix */
  307.   
  308. !     char_wid = rot_char_width(canvas_font);
  309.       where_c = where_p / char_wid;    /* estimated char position */
  310.       size = pf_textwidth(canvas_font, where_c, string);
  311.       l = size.x;            /* actual length (pixels) of string of
  312. --- 344,350 ----
  313.       if (where_p >= len_p)
  314.       return (len_c);        /* entire string is the prefix */
  315.   
  316. !     char_wid = char_width(canvas_font);
  317.       where_c = where_p / char_wid;    /* estimated char position */
  318.       size = pf_textwidth(canvas_font, where_c, string);
  319.       l = size.x;            /* actual length (pixels) of string of
  320. ***************
  321. *** 366,372 ****
  322.                    * where_c chars */
  323.       if (l < where_p) {
  324.       do {            /* add the width of next char to l */
  325. !         l += (char_wid = rot_char_advance(canvas_font, 
  326.                   (unsigned char) string[where_c++]));
  327.       } while (l < where_p);
  328.       if (l - (char_wid >> 1) >= where_p)
  329. --- 351,357 ----
  330.                    * where_c chars */
  331.       if (l < where_p) {
  332.       do {            /* add the width of next char to l */
  333. !         l += (char_wid = char_advance(canvas_font, 
  334.                   (unsigned char) string[where_c++]));
  335.       } while (l < where_p);
  336.       if (l - (char_wid >> 1) >= where_p)
  337. ***************
  338. *** 373,382 ****
  339.           where_c--;
  340.       } else if (l > where_p) {
  341.       do {            /* subtract the width of last char from l */
  342. !         l -= (char_wid = rot_char_advance(canvas_font, 
  343.                   (unsigned char) string[--where_c]));
  344.       } while (l > where_p);
  345. !     if (l + (char_wid >> 1) >= where_p)
  346.           where_c++;
  347.       }
  348.       if (where_c < 0) {
  349. --- 358,367 ----
  350.           where_c--;
  351.       } else if (l > where_p) {
  352.       do {            /* subtract the width of last char from l */
  353. !         l -= (char_wid = char_advance(canvas_font, 
  354.                   (unsigned char) string[--where_c]));
  355.       } while (l > where_p);
  356. !     if (l + (char_wid >> 1) <= where_p)
  357.           where_c++;
  358.       }
  359.       if (where_c < 0) {
  360. ***************
  361. *** 383,388 ****
  362. --- 368,375 ----
  363.       fprintf(stderr, "xfig file %s line %d: Error in prefix_length - adjusted\n", __FILE__, __LINE__);
  364.       where_c = 0;
  365.       }
  366. +     if ( where_c > len_c ) 
  367. +     return (len_c);
  368.       return (where_c);
  369.   }
  370.   
  371. ***************
  372. *** 405,422 ****
  373.   draw_cursor(x, y)
  374.       int            x, y;
  375.   {
  376. !     if (work_angle < 90.0 - 0.001)        /* 0-89 degrees */
  377. !         pw_vector(pw, x, y, x, y-ch_height, INV_PAINT, 1, RUBBER_LINE, 0.0,
  378. !         DEFAULT_COLOR);
  379. !     else if (work_angle < 180.0 - 0.001)    /* 90-179 degrees */
  380. !         pw_vector(pw, x-ch_height, y, x, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
  381. !         DEFAULT_COLOR);
  382. !     else if (work_angle < 270.0 - 0.001)    /* 180-269 degrees */
  383. !         pw_vector(pw, x, y+ch_height, x, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
  384. !         DEFAULT_COLOR);
  385. !     else                /* 270-359 degrees */
  386. !         pw_vector(pw, x, y, x+ch_height, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
  387. !         DEFAULT_COLOR);
  388.   }
  389.   
  390.   static int
  391. --- 392,401 ----
  392.   draw_cursor(x, y)
  393.       int            x, y;
  394.   {
  395. !     pw_vector(pw, x, y, 
  396. !         round(x-ch_height*sin_t),
  397. !         round(y-ch_height*cos_t),
  398. !         INV_PAINT, 1, RUBBER_LINE, 0.0, DEFAULT_COLOR);
  399.   }
  400.   
  401.   static int
  402. ***************
  403. *** 432,438 ****
  404.       rcur_x = cur_x;
  405.       rcur_y = cur_y;
  406.   
  407. !     ch_height = rot_char_height(canvas_font);
  408.       turn_on_blinking_cursor(draw_cursor, draw_cursor,
  409.                   cur_x, cur_y, (long) BLINK_INTERVAL);
  410.   }
  411. --- 411,417 ----
  412.       rcur_x = cur_x;
  413.       rcur_y = cur_y;
  414.   
  415. !     ch_height = canvas_font->max_bounds.ascent;
  416.       turn_on_blinking_cursor(draw_cursor, draw_cursor,
  417.                   cur_x, cur_y, (long) BLINK_INTERVAL);
  418.   }
  419. ***************
  420. *** 454,463 ****
  421.   erase_char_string()
  422.   {
  423.       pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  424. !         prefix, DEFAULT_COLOR);
  425.       if (leng_suffix)
  426.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  427. !         suffix, DEFAULT_COLOR);
  428.   }
  429.   
  430.   static int
  431. --- 433,442 ----
  432.   erase_char_string()
  433.   {
  434.       pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  435. !         work_angle, prefix, DEFAULT_COLOR);
  436.       if (leng_suffix)
  437.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  438. !         work_angle, suffix, DEFAULT_COLOR);
  439.   }
  440.   
  441.   static int
  442. ***************
  443. *** 464,473 ****
  444.   draw_char_string()
  445.   {
  446.       pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  447. !         prefix, DEFAULT_COLOR);
  448.       if (leng_suffix)
  449.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  450. !         suffix, DEFAULT_COLOR);
  451.       move_blinking_cursor(cur_x, cur_y);
  452.   }
  453.   
  454. --- 443,452 ----
  455.   draw_char_string()
  456.   {
  457.       pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  458. !         work_angle, prefix, DEFAULT_COLOR);
  459.       if (leng_suffix)
  460.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  461. !         work_angle, suffix, DEFAULT_COLOR);
  462.       move_blinking_cursor(cur_x, cur_y);
  463.   }
  464.   
  465. ***************
  466. *** 476,482 ****
  467.   {
  468.       if (leng_suffix)
  469.       pw_text(pw, cur_x, cur_y, PAINT, canvas_zoomed_font, 
  470. !         suffix, DEFAULT_COLOR);
  471.   }
  472.   
  473.   static int
  474. --- 455,461 ----
  475.   {
  476.       if (leng_suffix)
  477.       pw_text(pw, cur_x, cur_y, PAINT, canvas_zoomed_font, 
  478. !         work_angle, suffix, DEFAULT_COLOR);
  479.   }
  480.   
  481.   static int
  482. ***************
  483. *** 484,490 ****
  484.   {
  485.       if (leng_suffix)
  486.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  487. !         suffix, DEFAULT_COLOR);
  488.   }
  489.   
  490.   static int
  491. --- 463,469 ----
  492.   {
  493.       if (leng_suffix)
  494.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  495. !         work_angle, suffix, DEFAULT_COLOR);
  496.   }
  497.   
  498.   static int
  499. ***************
  500. *** 495,501 ****
  501.       s[0]=c;
  502.       s[1]='\0';
  503.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  504. !         s, DEFAULT_COLOR);
  505.   }
  506.   
  507.   char_handler(c)
  508. --- 474,480 ----
  509.       s[0]=c;
  510.       s[1]='\0';
  511.       pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  512. !         work_angle, s, DEFAULT_COLOR);
  513.   }
  514.   
  515.   char_handler(c)
  516. ***************
  517. *** 502,507 ****
  518. --- 481,488 ----
  519.       unsigned char   c;
  520.   {
  521.       float        cwidth, cw2;
  522. +     float        cwsin, cwcos;
  523. +     float        cw2sin, cw2cos;
  524.   
  525.       if (cr_proc == NULL)
  526.       return;
  527. ***************
  528. *** 511,562 ****
  529.       } else if (c == DEL || c == CTRL_H) {
  530.       if (leng_prefix > 0) {
  531.           erase_char_string();
  532. !         cwidth = (float) rot_char_advance(canvas_font, 
  533.               (unsigned char) prefix[leng_prefix - 1]);
  534.           cw2 = cwidth/2.0;
  535.           /* correct text/cursor posn for justification and zoom factor */
  536.           switch (work_textjust) {
  537.           case T_LEFT_JUSTIFIED:
  538. !         if (work_angle < 90.0 - 0.001)
  539. !             rcur_x -= cwidth;           /* 0-89 deg, move the suffix left */
  540. !         else if (work_angle < 180.0 - 0.001) 
  541. !             rcur_y += cwidth;           /* 90-179 deg, move suffix down */
  542. !         else if (work_angle < 270.0 - 0.001) 
  543. !             rcur_x += cwidth;           /* 180-269 deg, move suffix right */
  544. !         else 
  545. !             rcur_y -= cwidth;           /* 270-359 deg, move suffix up */
  546.           break;
  547.           case T_CENTER_JUSTIFIED:
  548. !         if (work_angle < 90.0 - 0.001) { 
  549. !             rbase_x += cw2;    /* 0-89 deg, move base right cw/2 */
  550. !             rcur_x -= cw2;    /* move suffix left by cw/2 */
  551. !         } else if (work_angle < 180.0 - 0.001) { 
  552. !             rbase_y -= cw2;    /* 90-179 deg, move base up cw/2 */
  553. !             rcur_y += cw2;    /* move suffix down cw/2 */
  554. !         } else if (work_angle < 270.0 - 0.001) {
  555. !             rbase_x -= cw2;    /* 180-269 deg, move base left cw/2 */
  556. !             rcur_x += cw2;    /* move suffix right cw/2 */
  557. !         } else {                      
  558. !             rbase_y += cw2;    /* 270-359 deg, move base down cw/2 */
  559. !             rcur_y -= cw2;    /* move suffix up cw/2 */
  560. !         }
  561.           break;
  562.           case T_RIGHT_JUSTIFIED:
  563. !         if (work_angle < 90.0 - 0.001) 
  564. !             rbase_x += cwidth;           /* 0-89 deg, move the prefix right */
  565. !         else if (work_angle < 180.0 - 0.001)
  566. !             rbase_y -= cwidth;           /* 90-179 deg, move prefix up */
  567. !         else if (work_angle < 270.0 - 0.001)
  568. !             rbase_x -= cwidth;           /* 180-269 deg, move prefix left */
  569. !         else
  570. !             rbase_y += cwidth;           /* 270-359 deg, move prefix down */
  571.           break;
  572.           }
  573.           prefix[--leng_prefix] = '\0';
  574. !         cbase_x = rbase_x;    /* fix */
  575. !         cbase_y = rbase_y;
  576. !         cur_x = rcur_x;
  577. !         cur_y = rcur_y;
  578.           draw_char_string();
  579.       }
  580.       } else if (c == CTRL_X) {
  581. --- 492,527 ----
  582.       } else if (c == DEL || c == CTRL_H) {
  583.       if (leng_prefix > 0) {
  584.           erase_char_string();
  585. !         cwidth = (float) char_advance(canvas_font, 
  586.               (unsigned char) prefix[leng_prefix - 1]);
  587.           cw2 = cwidth/2.0;
  588. +         cwsin = cwidth*sin_t;
  589. +         cwcos = cwidth*cos_t;
  590. +         cw2sin = cw2*sin_t;
  591. +         cw2cos = cw2*cos_t;
  592.           /* correct text/cursor posn for justification and zoom factor */
  593.           switch (work_textjust) {
  594.           case T_LEFT_JUSTIFIED:
  595. !         rcur_x -= cwcos;
  596. !         rcur_y += cwsin;
  597.           break;
  598.           case T_CENTER_JUSTIFIED:
  599. !         rbase_x += cw2cos;
  600. !         rbase_y -= cw2sin;
  601. !         rcur_x -= cw2cos;
  602. !         rcur_y += cw2sin;
  603.           break;
  604.           case T_RIGHT_JUSTIFIED:
  605. !         rbase_x += cwcos;
  606. !         rbase_y -= cwsin;
  607.           break;
  608.           }
  609.           prefix[--leng_prefix] = '\0';
  610. !         cbase_x = round(rbase_x);
  611. !         cbase_y = round(rbase_y);
  612. !         cur_x = round(rcur_x);
  613. !         cur_y = round(rcur_y);
  614.           draw_char_string();
  615.       }
  616.       } else if (c == CTRL_X) {
  617. ***************
  618. *** 564,592 ****
  619.           erase_char_string();
  620.           switch (work_textjust) {
  621.           case T_CENTER_JUSTIFIED:
  622. !         while (leng_prefix--)    /* subtract char width/2 per char */
  623. !             if (work_angle < 90.0 - 0.001)    /* 0-89 degrees */
  624. !             rcur_x -= rot_char_advance(canvas_font, 
  625. !                 (unsigned char) prefix[leng_prefix]) / 2.0;
  626. !         else if (work_angle < 180.0 - 0.001)     /* 90-179 degrees */
  627. !             rcur_y += rot_char_advance(canvas_font, 
  628. !                 (unsigned char) prefix[leng_prefix]) / 2.0;
  629. !         else if (work_angle < 270.0 - 0.001)     /* 180-269 degrees */
  630. !             rcur_x += rot_char_advance(canvas_font, 
  631. !                 (unsigned char) prefix[leng_prefix]) / 2.0;
  632. !         else                     /* 270-359 degrees */
  633. !             rcur_y -= rot_char_advance(canvas_font, 
  634. !                 (unsigned char) prefix[leng_prefix]) / 2.0;
  635. !         cur_x = cbase_x = rbase_x = rcur_x;
  636. !         cur_y = cbase_y = rbase_y = rcur_y;
  637.           break;
  638.           case T_RIGHT_JUSTIFIED:
  639. !         cbase_x = rbase_x = cur_x = rcur_x;
  640. !         cbase_y = rbase_y = cur_y = rcur_y;
  641.           break;
  642.           case T_LEFT_JUSTIFIED:
  643. !         cur_x = rcur_x = cbase_x = rbase_x;
  644. !         cur_y = rcur_y = cbase_y = rbase_y;
  645.           break;
  646.           }
  647.           leng_prefix = 0;
  648. --- 529,556 ----
  649.           erase_char_string();
  650.           switch (work_textjust) {
  651.           case T_CENTER_JUSTIFIED:
  652. !         while (leng_prefix--) {    /* subtract char width/2 per char */
  653. !             rcur_x -= cos_t*char_advance(canvas_font,
  654. !                     (unsigned char) prefix[leng_prefix]) / 2.0;
  655. !             rcur_y += sin_t*char_advance(canvas_font,
  656. !                     (unsigned char) prefix[leng_prefix]) / 2.0;
  657. !         }
  658. !         rbase_x = rcur_x;
  659. !         cur_x = cbase_x = round(rbase_x);
  660. !         rbase_y = rcur_y;
  661. !         cur_y = cbase_y = round(rbase_y);
  662.           break;
  663.           case T_RIGHT_JUSTIFIED:
  664. !         rbase_x = rcur_x;
  665. !         cbase_x = cur_x = round(rbase_x);
  666. !         rbase_y = rcur_y;
  667. !         cbase_y = cur_y = round(rbase_y);
  668.           break;
  669.           case T_LEFT_JUSTIFIED:
  670. !         rcur_x = rbase_x;
  671. !         cur_x = cbase_x = round(rcur_x);
  672. !         rcur_y = rbase_y;
  673. !         cur_y = cbase_y = round(rcur_y);
  674.           break;
  675.           }
  676.           leng_prefix = 0;
  677. ***************
  678. *** 600,653 ****
  679.   
  680.       /* normal text character */
  681.       } else {    
  682. !     draw_char_string();
  683. !     cwidth = rot_char_advance(canvas_font, (unsigned char) c);
  684.       cw2 = cwidth/2.0;
  685. !     /* correct text/cursor posn for justification and zoom factor */
  686.       switch (work_textjust) {
  687.         case T_LEFT_JUSTIFIED:
  688. !         if (work_angle < 90.0 - 0.001)
  689. !         rcur_x += cwidth;           /* 0-89 deg, move the suffix right */
  690. !         else if (work_angle < 180.0 - 0.001) 
  691. !         rcur_y -= cwidth;           /* 90-179 deg, move suffix up */
  692. !         else if (work_angle < 270.0 - 0.001) 
  693. !         rcur_x -= cwidth;           /* 180-269 deg, move suffix left */
  694. !         else 
  695. !         rcur_y += cwidth;           /* 270-359 deg, move suffix down */
  696.           break;
  697.         case T_CENTER_JUSTIFIED:
  698. !         if (work_angle < 90.0 - 0.001) { 
  699. !         rbase_x -= cw2;    /* 0-89 deg, move base left cw/2 */
  700. !         rcur_x += cw2;    /* move suffix right by cw/2 */
  701. !         } else if (work_angle < 180.0 - 0.001) { 
  702. !         rbase_y += cw2;    /* 90-179 deg, move base down cw/2 */
  703. !         rcur_y -= cw2;    /* move suffix up cw/2 */
  704. !         } else if (work_angle < 270.0 - 0.001) {
  705. !         rbase_x += cw2;    /* 180-269 deg, move base right cw/2 */
  706. !         rcur_x -= cw2;    /* move suffix left cw/2 */
  707. !         } else {                      
  708. !         rbase_y -= cw2;    /* 270-359 deg, move base up cw/2 */
  709. !         rcur_y += cw2;    /* move suffix down cw/2 */
  710. !         }
  711.           break;
  712.         case T_RIGHT_JUSTIFIED:
  713. !         if (work_angle < 90.0 - 0.001) 
  714. !         rbase_x -= cwidth;           /* 0-89 deg, move the prefix left */
  715. !         else if (work_angle < 180.0 - 0.001)
  716. !         rbase_y += cwidth;           /* 90-179 deg, move prefix down */
  717. !         else if (work_angle < 270.0 - 0.001)
  718. !         rbase_x += cwidth;           /* 180-269 deg, move prefix right */
  719. !         else
  720. !         rbase_y -= cwidth;           /* 270-359 deg, move prefix up */
  721.           break;
  722.       }
  723.       prefix[leng_prefix++] = c;
  724.       prefix[leng_prefix] = '\0';
  725. !     cbase_x = rbase_x;
  726. !     cbase_y = rbase_y;
  727. !     cur_x = rcur_x;
  728. !     cur_y = rcur_y;
  729. !     draw_char_string();
  730.       }
  731.   }
  732.   
  733. --- 564,601 ----
  734.   
  735.       /* normal text character */
  736.       } else {    
  737. !     draw_char_string();    /* erase current string */
  738. !     cwidth = char_advance(canvas_font, (unsigned char) c);
  739. !     cwsin = cwidth*sin_t;
  740. !     cwcos = cwidth*cos_t;
  741.       cw2 = cwidth/2.0;
  742. !     cw2sin = cw2*sin_t;
  743. !     cw2cos = cw2*cos_t;
  744. !     /* correct text/cursor posn for justification and rotation */
  745.       switch (work_textjust) {
  746.         case T_LEFT_JUSTIFIED:
  747. !         rcur_x += cwcos;
  748. !         rcur_y -= cwsin;
  749.           break;
  750.         case T_CENTER_JUSTIFIED:
  751. !         rbase_x -= cw2cos;
  752. !         rbase_y += cw2sin;
  753. !         rcur_x += cw2cos;
  754. !         rcur_y -= cw2sin;
  755.           break;
  756.         case T_RIGHT_JUSTIFIED:
  757. !         rbase_x -= cwcos;
  758. !         rbase_y += cwsin;
  759.           break;
  760.       }
  761.       prefix[leng_prefix++] = c;
  762.       prefix[leng_prefix] = '\0';
  763. !     cbase_x = round(rbase_x);
  764. !     cbase_y = round(rbase_y);
  765. !     cur_x = round(rcur_x);
  766. !     cur_y = round(rcur_y);
  767. !     draw_char_string();    /* draw new string */
  768.       }
  769.   }
  770.   
  771. ***************
  772. *** 737,742 ****
  773. --- 685,695 ----
  774.       cursor_is_moving = 0;
  775.   }
  776.   
  777. + /*
  778. +  * Reload the font structure for all texts, the saved texts and the 
  779. +    current work_fontstruct.
  780. +  */
  781.   reload_text_fstructs()
  782.   {
  783.       F_text       *t;
  784. ***************
  785. *** 743,751 ****
  786. --- 696,708 ----
  787.   
  788.       /* reload the compound objects' texts */
  789.       reload_compoundfont(objects.compounds);
  790. +     reload_compoundfont(saved_objects.compounds);
  791.       /* and the separate texts */
  792.       for (t=objects.texts; t != NULL; t = t->next)
  793.       reload_text_fstruct(t);
  794. +     /* also for the saved texts */
  795. +     for (t=saved_objects.texts; t != NULL; t = t->next)
  796. +     reload_text_fstruct(t);
  797.   }
  798.   
  799.   /*
  800. ***************
  801. *** 769,773 ****
  802.       F_text       *t;
  803.   {
  804.       t->fontstruct = lookfont(x_fontnum(t->flags, t->font), 
  805. !             round(t->size*zoomscale), t->angle);
  806.   }
  807. --- 726,730 ----
  808.       F_text       *t;
  809.   {
  810.       t->fontstruct = lookfont(x_fontnum(t->flags, t->font), 
  811. !             round(t->size*zoomscale));
  812.   }
  813. diff -rc xfig.2.1.7a/e_align.c xfig.2.1.8/e_align.c
  814. *** xfig.2.1.7a/e_align.c    Tue Jan  5 11:41:05 1993
  815. --- xfig.2.1.8/e_align.c    Fri Jul  2 11:08:20 1993
  816. ***************
  817. *** 184,190 ****
  818.   
  819.       for (t = cur_c->texts; t != NULL; t = t->next) {
  820.       int   dum;
  821. !     text_bound_actual(t, t->angle, &llx, &lly, &urx, &ury,
  822.              &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
  823.       get_dx_dy();
  824.       translate_text(t, dx, dy);
  825. --- 184,190 ----
  826.   
  827.       for (t = cur_c->texts; t != NULL; t = t->next) {
  828.       int   dum;
  829. !     text_bound(t, &llx, &lly, &urx, &ury,
  830.              &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
  831.       get_dx_dy();
  832.       translate_text(t, dx, dy);
  833. ***************
  834. *** 195,224 ****
  835.   get_dx_dy()
  836.   {
  837.       switch (cur_valign) {
  838. !     case NONE:
  839.       dy = 0;
  840.       break;
  841. !     case TOP:
  842.       dy = ycmin - lly;
  843.       break;
  844. !     case BOTTOM:
  845.       dy = ycmax - ury;
  846.       break;
  847. !     case CENTER:
  848.       dy = (ycmin - lly) + (abs(ycmin - lly) + abs(ycmax - ury)) / 2;
  849.       break;
  850.       }
  851.       switch (cur_halign) {
  852. !     case NONE:
  853.       dx = 0;
  854.       break;
  855. !     case LEFT:
  856.       dx = xcmin - llx;
  857.       break;
  858. !     case RIGHT:
  859.       dx = xcmax - urx;
  860.       break;
  861. !     case CENTER:
  862.       dx = (xcmin - llx) + (abs(xcmin - llx) + abs(xcmax - urx)) / 2;
  863.       break;
  864.       }
  865. --- 195,224 ----
  866.   get_dx_dy()
  867.   {
  868.       switch (cur_valign) {
  869. !     case ALIGN_NONE:
  870.       dy = 0;
  871.       break;
  872. !     case ALIGN_TOP:
  873.       dy = ycmin - lly;
  874.       break;
  875. !     case ALIGN_BOTTOM:
  876.       dy = ycmax - ury;
  877.       break;
  878. !     case ALIGN_CENTER:
  879.       dy = (ycmin - lly) + (abs(ycmin - lly) + abs(ycmax - ury)) / 2;
  880.       break;
  881.       }
  882.       switch (cur_halign) {
  883. !     case ALIGN_NONE:
  884.       dx = 0;
  885.       break;
  886. !     case ALIGN_LEFT:
  887.       dx = xcmin - llx;
  888.       break;
  889. !     case ALIGN_RIGHT:
  890.       dx = xcmax - urx;
  891.       break;
  892. !     case ALIGN_CENTER:
  893.       dx = (xcmin - llx) + (abs(xcmin - llx) + abs(xcmax - urx)) / 2;
  894.       break;
  895.       }
  896. diff -rc xfig.2.1.7a/e_copy.c xfig.2.1.8/e_copy.c
  897. *** xfig.2.1.7a/e_copy.c    Wed Dec  9 15:42:43 1992
  898. --- xfig.2.1.8/e_copy.c    Wed Jul  7 14:58:53 1993
  899. ***************
  900. *** 181,186 ****
  901.       fclose(fp);
  902.       return;
  903.       }
  904. !     put_msg("Object copied to scrap");
  905.       fclose(fp);
  906.   }
  907. --- 181,186 ----
  908.       fclose(fp);
  909.       return;
  910.       }
  911. !     put_msg("Object copied to scrapfile %s",cut_buf_name);
  912.       fclose(fp);
  913.   }
  914. diff -rc xfig.2.1.7a/e_delete.c xfig.2.1.8/e_delete.c
  915. *** xfig.2.1.7a/e_delete.c    Wed Dec  9 15:42:50 1992
  916. --- xfig.2.1.8/e_delete.c    Wed Jul  7 14:59:28 1993
  917. ***************
  918. *** 222,228 ****
  919.       fclose(fp);
  920.       return;
  921.       }
  922. !     put_msg("Object deleted to scrap");
  923.       fclose(fp);
  924.   }
  925.   
  926. --- 222,228 ----
  927.       fclose(fp);
  928.       return;
  929.       }
  930. !     put_msg("Object deleted to scrapfile %s",cut_buf_name);
  931.       fclose(fp);
  932.   }
  933.   
  934. diff -rc xfig.2.1.7a/e_edit.c xfig.2.1.8/e_edit.c
  935. *** xfig.2.1.7a/e_edit.c    Wed Feb  3 13:31:40 1993
  936. --- xfig.2.1.8/e_edit.c    Tue Aug 31 14:18:09 1993
  937. ***************
  938. *** 29,35 ****
  939.   #include "w_mousefun.h"
  940.   
  941.   extern char    *panel_get_value();
  942. ! extern PIX_ROT_FONT lookfont();
  943.   Widget        make_popup_menu();
  944.   static Widget    make_color_popup_menu();
  945.   
  946. --- 29,35 ----
  947.   #include "w_mousefun.h"
  948.   
  949.   extern char    *panel_get_value();
  950. ! extern PIX_FONT lookfont();
  951.   Widget        make_popup_menu();
  952.   static Widget    make_color_popup_menu();
  953.   
  954. ***************
  955. *** 343,350 ****
  956.       XButtonEvent   *ev;
  957.   {
  958.       struct f_point  p1, p2;
  959. !     int            dx, dy, rotation;
  960. !     float        ratio;
  961.       register float  orig_ratio = new_l->eps->hw_ratio;
  962.   
  963.       p1.x = atoi(panel_get_value(x1_panel));
  964. --- 343,349 ----
  965.       XButtonEvent   *ev;
  966.   {
  967.       struct f_point  p1, p2;
  968. !     int            dx, dy;
  969.       register float  orig_ratio = new_l->eps->hw_ratio;
  970.   
  971.       p1.x = atoi(panel_get_value(x1_panel));
  972. ***************
  973. *** 380,388 ****
  974.       new_c = copy_compound(c);
  975.       new_c->next = c;
  976.       generic_window("COMPOUND", "", &glue_ic, done_compound, 0, 0);
  977. !     f_pos_panel(&c->nwcorner, "Top Left Corner:", &x1_panel, &y1_panel);
  978. !     f_pos_panel(&c->secorner, "Bottom Right Corner:", &x2_panel, &y2_panel);
  979. !     int_label(object_count(c), "Num Objects: ", &num_objects);
  980.   }
  981.   
  982.   static
  983. --- 379,387 ----
  984.       new_c = copy_compound(c);
  985.       new_c->next = c;
  986.       generic_window("COMPOUND", "", &glue_ic, done_compound, 0, 0);
  987. !     f_pos_panel(&c->nwcorner, "Top Left Corner", &x1_panel, &y1_panel);
  988. !     f_pos_panel(&c->secorner, "Bottom Right Corner", &x2_panel, &y2_panel);
  989. !     int_label(object_count(c), "Num Objects ", &num_objects);
  990.   }
  991.   
  992.   static
  993. ***************
  994. *** 476,490 ****
  995.