home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume18 / X11R5-fix13 / part02 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  50.4 KB

  1. Path: uunet!dtix!darwin.sura.net!mips!msi!dcmartin
  2. From: gildea@EXPO.LCS.MIT.EDU (Stephen Gildea)
  3. Newsgroups: comp.sources.x
  4. Subject: v18i043: X11R5 public fix #13, Part02/05
  5. Message-ID: <1992Jul22.150635.18675@msi.com>
  6. Date: 22 Jul 92 15:06:35 GMT
  7. References: <csx-18i042-X11R5-fix13@uunet.UU.NET>
  8. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  9. Organization: Molecular Simulations, Inc.
  10. Lines: 1861
  11. Approved: dcmartin@msi.com
  12. Originator: dcmartin@fascet
  13.  
  14. Submitted-by: gildea@EXPO.LCS.MIT.EDU (Stephen Gildea)
  15. Posting-number: Volume 18, Issue 43
  16. Archive-name: X11R5-fix13/part02
  17.  
  18. #!/bin/sh
  19. # this is part.02 (part 2 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file fix-13 continued
  22. #
  23. if test ! -r _shar_seq_.tmp; then
  24.     echo 'Please unpack part 1 first!'
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 2; then
  29.     echo Please unpack part "$Scheck" next!
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < _shar_seq_.tmp || exit 1
  35. if test ! -f _shar_wnt_.tmp; then
  36.     echo 'x - still skipping fix-13'
  37. else
  38. echo 'x - continuing file fix-13'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'fix-13' &&
  40. X  extern int  errno;
  41. X  
  42. X  
  43. ***************
  44. *** 61,67 ****
  45. X  static int  fs_font_type;
  46. X  extern unsigned long fs_fd_mask[];
  47. X  
  48. ! static int  fs_block_handler();
  49. X  static int  fs_wakeup();
  50. X  
  51. X  static FSFpePtr awaiting_reconnect;
  52. --- 66,72 ----
  53. X  static int  fs_font_type;
  54. X  extern unsigned long fs_fd_mask[];
  55. X  
  56. ! static void fs_block_handler();
  57. X  static int  fs_wakeup();
  58. X  
  59. X  static FSFpePtr awaiting_reconnect;
  60. ***************
  61. *** 117,123 ****
  62. X  fs_name_check(name)
  63. X      char       *name;
  64. X  {
  65. !     return (!strncmp(name, "tcp/", MIN(4, strlen(name))));
  66. X  }
  67. X  
  68. X  /*
  69. --- 122,128 ----
  70. X  fs_name_check(name)
  71. X      char       *name;
  72. X  {
  73. !     return (!strncmp(name, "tcp/", MIN(4, (int) strlen(name))));
  74. X  }
  75. X  
  76. X  /*
  77. ***************
  78. *** 254,259 ****
  79. --- 259,287 ----
  80. X      return err;
  81. X  }
  82. X  
  83. + /* 
  84. +  * close font server and remove any state associated with
  85. +  * this connection - this includes any client records.
  86. +  */
  87. + static void
  88. + fs_close_conn(conn)
  89. +     FSFpePtr    conn;
  90. + {
  91. +     FSClientPtr    client, nclient;
  92. +     (void) close(conn->fs_fd);
  93. +     _fs_bit_clear(fs_fd_mask, conn->fs_fd);
  94. +     for (client = conn->clients; client; client = nclient) 
  95. +     {
  96. +     nclient = client->next;
  97. +     xfree (client);
  98. +     }
  99. +     conn->clients = NULL;
  100. + }
  101. X  /*
  102. X   * the wakeup handlers have to be set when the FPE is open, and not
  103. X   * removed until it is freed, in order to handle unexpected data, like
  104. ***************
  105. *** 285,294 ****
  106. X      fpe->private = (pointer) conn;
  107. X      err = fs_send_init_packets(conn);
  108. X      if (err != Successful) {
  109. !         (void) close(conn->fs_fd);
  110. !         xfree(conn->servername);
  111. !         xfree(conn->alts);
  112. !         xfree(conn);
  113. X          return err;
  114. X      }
  115. X      if (init_fs_handlers(fpe, fs_block_handler) != Successful)
  116. --- 313,322 ----
  117. X      fpe->private = (pointer) conn;
  118. X      err = fs_send_init_packets(conn);
  119. X      if (err != Successful) {
  120. !         fs_close_conn(conn);
  121. !             xfree(conn->servername);
  122. !             xfree(conn->alts);
  123. !             xfree(conn);
  124. X          return err;
  125. X      }
  126. X      if (init_fs_handlers(fpe, fs_block_handler) != Successful)
  127. ***************
  128. *** 335,343 ****
  129. X      FSFpePtr    conn = (FSFpePtr) fpe->private;
  130. X      FSFpePtr    recon,
  131. X                 *prev;
  132. X      prev = &awaiting_reconnect;
  133. !     while (recon = *prev) {
  134. X      if (conn == recon) {
  135. X          *prev = recon->next_reconnect;
  136. X          break;
  137. --- 363,371 ----
  138. X      FSFpePtr    conn = (FSFpePtr) fpe->private;
  139. X      FSFpePtr    recon,
  140. X                 *prev;
  141. X      prev = &awaiting_reconnect;
  142. !     while (*prev) {
  143. !     recon = *prev;
  144. X      if (conn == recon) {
  145. X          *prev = recon->next_reconnect;
  146. X          break;
  147. ***************
  148. *** 345,355 ****
  149. X      prev = &recon->next_reconnect;
  150. X      }
  151. X  
  152. !     /* close font server */
  153. !     (void) close(conn->fs_fd);
  154. X  
  155. !     _fs_bit_clear(fs_fd_mask, conn->fs_fd);
  156. !     remove_fs_handlers(fpe, fs_block_handler, !_fs_any_bit_set(fs_fd_mask));
  157. X  
  158. X      xfree(conn->alts);
  159. X      xfree(conn->servername);
  160. --- 373,382 ----
  161. X      prev = &recon->next_reconnect;
  162. X      }
  163. X  
  164. !     fs_close_conn(conn);
  165. X  
  166. !     remove_fs_handlers(fpe, fs_block_handler,
  167. !                !_fs_any_bit_set(fs_fd_mask) && !awaiting_reconnect);
  168. X  
  169. X      xfree(conn->alts);
  170. X      xfree(conn->servername);
  171. ***************
  172. *** 578,584 ****
  173. X      return StillWorking;
  174. X      }
  175. X      /* move the data over */
  176. !     (void) fs_convert_header(&rep.header, &bfont->pfont->info);
  177. X      if (bfont->pfont->info.terminalFont)
  178. X      {
  179. X      bfont->format =
  180. --- 605,611 ----
  181. X      return StillWorking;
  182. X      }
  183. X      /* move the data over */
  184. !     (void) fs_convert_header(conn, &rep.header, &bfont->pfont->info);
  185. X      if (bfont->pfont->info.terminalFont)
  186. X      {
  187. X      bfont->format =
  188. ***************
  189. *** 609,615 ****
  190. X      fs_free_font(bfont);
  191. X      return StillWorking;
  192. X      }
  193. !     (void) fs_convert_props(&pi, po, pd, &bfont->pfont->info);
  194. X      xfree(po);
  195. X      xfree(pd);
  196. X  
  197. --- 636,648 ----
  198. X      fs_free_font(bfont);
  199. X      return StillWorking;
  200. X      }
  201. !     if (fs_convert_props(&pi, po, pd, &bfont->pfont->info) == -1)
  202. !     {
  203. !         xfree(po);
  204. !         xfree(pd);
  205. !     (void) fs_cleanup_font(bfont);
  206. !     return AllocError;
  207. !     }
  208. X      xfree(po);
  209. X      xfree(pd);
  210. X  
  211. ***************
  212. *** 628,633 ****
  213. --- 661,668 ----
  214. X      FSFpePtr    conn = (FSFpePtr) fpe->private;
  215. X      fsQueryXExtents8Reply rep;
  216. X      int         i;
  217. +     int        numInfos;
  218. +     Bool    haveInk = FALSE; /* need separate ink metrics? */
  219. X      CharInfoPtr ci,
  220. X                  pCI;
  221. X      FSFontPtr   fsfont = (FSFontPtr) bfont->pfont->fontPrivate;
  222. ***************
  223. *** 642,648 ****
  224. X      return StillWorking;
  225. X      }
  226. X      /* move the data over */
  227. !     ci = pCI = (CharInfoPtr) xalloc(sizeof(CharInfoRec) * rep.num_extents);
  228. X  /* XXX this could be done with an ALLOCATE_LOCAL */
  229. X      fsci = (fsCharInfo *) xalloc(sizeof(fsCharInfo) * rep.num_extents);
  230. X      if (!pCI || !fsci) {
  231. --- 677,690 ----
  232. X      return StillWorking;
  233. X      }
  234. X      /* move the data over */
  235. !     /* need separate inkMetrics for fixed font server protocol version */
  236. !     numInfos =  rep.num_extents;
  237. !     if (bfont->pfont->info.terminalFont && conn->fsMajorVersion > 1)
  238. !     {
  239. !     numInfos *= 2;
  240. !     haveInk = TRUE;
  241. !     }
  242. !     ci = pCI = (CharInfoPtr) xalloc(sizeof(CharInfoRec) * numInfos);
  243. X  /* XXX this could be done with an ALLOCATE_LOCAL */
  244. X      fsci = (fsCharInfo *) xalloc(sizeof(fsCharInfo) * rep.num_extents);
  245. X      if (!pCI || !fsci) {
  246. ***************
  247. *** 654,661 ****
  248. X      return AllocError;
  249. X      }
  250. X      fsfont->encoding = pCI;
  251. ! /* XXX - hack - use real default char */
  252. !     fsfont->pDefault = &pCI[0];
  253. X  
  254. X      if (_fs_read_pad(conn, (char *) fsci,
  255. X               sizeof(fsCharInfo) * rep.num_extents) == -1) {
  256. --- 696,705 ----
  257. X      return AllocError;
  258. X      }
  259. X      fsfont->encoding = pCI;
  260. !     if (haveInk)
  261. !     fsfont->inkMetrics = pCI + rep.num_extents;
  262. !     else
  263. !         fsfont->inkMetrics = pCI;
  264. X  
  265. X      if (_fs_read_pad(conn, (char *) fsci,
  266. X               sizeof(fsCharInfo) * rep.num_extents) == -1) {
  267. ***************
  268. *** 662,672 ****
  269. --- 706,767 ----
  270. X      fs_free_font(bfont);
  271. X      return StillWorking;
  272. X      }
  273. +     ci = fsfont->inkMetrics;
  274. X      for (i = 0, fscip = fsci; i < rep.num_extents; i++, ci++, fscip++) {
  275. X      fs_convert_char_info(fscip, ci);
  276. X      }
  277. X  
  278. X      xfree(fsci);
  279. +     /* build bitmap metrics, ImageRectMax style */
  280. +     if (haveInk)
  281. +     {
  282. +     FontInfoRec *fi = &bfont->pfont->info;
  283. +     CharInfoPtr ii;
  284. +     ci = fsfont->encoding;
  285. +     ii = fsfont->inkMetrics;
  286. +     for (i = 0; i < rep.num_extents; i++, ci++, ii++)
  287. +     {
  288. +         if (NONZEROMETRICS(&ii->metrics))
  289. +         {
  290. +         ci->metrics.leftSideBearing = FONT_MIN_LEFT(fi);
  291. +         ci->metrics.rightSideBearing = FONT_MAX_RIGHT(fi);
  292. +         ci->metrics.ascent = FONT_MAX_ASCENT(fi);
  293. +         ci->metrics.descent = FONT_MAX_DESCENT(fi);
  294. +         ci->metrics.characterWidth = FONT_MAX_WIDTH(fi);
  295. +         ci->metrics.attributes = ii->metrics.attributes;
  296. +         }
  297. +         else
  298. +         {
  299. +         ci->metrics = ii->metrics;
  300. +         }
  301. +     }
  302. +     }
  303. +     {
  304. +     unsigned int r, c, numCols, firstCol;
  305. +     firstCol = bfont->pfont->info.firstCol;
  306. +     numCols = bfont->pfont->info.lastCol - firstCol + 1;
  307. +     c = bfont->pfont->info.defaultCh;
  308. +     fsfont->pDefault = 0;
  309. +     if (bfont->pfont->info.lastRow)
  310. +     {
  311. +         r = c >> 8;
  312. +         r -= bfont->pfont->info.firstRow;
  313. +         c &= 0xff;
  314. +         c -= firstCol;
  315. +         if (r < bfont->pfont->info.lastRow-bfont->pfont->info.firstRow+1 &&
  316. +         c < numCols)
  317. +         fsfont->pDefault = &pCI[r * numCols + c];
  318. +     }
  319. +     else
  320. +     {
  321. +         c -= firstCol;
  322. +         if (c < numCols)
  323. +         fsfont->pDefault = &pCI[c];
  324. +     }
  325. +     }
  326. X      bfont->state = FS_GLYPHS_REPLY;
  327. X  
  328. X      if (bfont->flags & FontLoadBitmaps) {
  329. ***************
  330. *** 787,793 ****
  331. X  }
  332. X  
  333. X  /* ARGSUSED */
  334. ! static int
  335. X  fs_block_handler(data, wt, LastSelectMask)
  336. X      pointer     data;
  337. X      struct timeval **wt;
  338. --- 882,888 ----
  339. X  }
  340. X  
  341. X  /* ARGSUSED */
  342. ! static void
  343. X  fs_block_handler(data, wt, LastSelectMask)
  344. X      pointer     data;
  345. X      struct timeval **wt;
  346. ***************
  347. *** 817,823 ****
  348. X          **wt = recon_timeout;
  349. X      }
  350. X      }
  351. -     return Successful;
  352. X  }
  353. X  
  354. X  static void
  355. --- 912,917 ----
  356. ***************
  357. *** 932,939 ****
  358. X      if (!conn->attemptReconnect)
  359. X      return;
  360. X      conn->attemptReconnect = FALSE;
  361. !     _fs_bit_clear(fs_fd_mask, conn->fs_fd);
  362. !     close(conn->fs_fd);
  363. X      conn->time_to_try = time((long *) 0) + FS_RECONNECT_WAIT;
  364. X      conn->reconnect_delay = FS_RECONNECT_WAIT;
  365. X      conn->fs_fd = -1;
  366. --- 1026,1032 ----
  367. X      if (!conn->attemptReconnect)
  368. X      return;
  369. X      conn->attemptReconnect = FALSE;
  370. !     fs_close_conn(conn);
  371. X      conn->time_to_try = time((long *) 0) + FS_RECONNECT_WAIT;
  372. X      conn->reconnect_delay = FS_RECONNECT_WAIT;
  373. X      conn->fs_fd = -1;
  374. ***************
  375. *** 1318,1328 ****
  376. X      }
  377. X      /* adjust them */
  378. X      for (i = 0; i < rep.num_chars; i++) {
  379. !     if (ppbits[i].length)
  380. X          bits = (char *) pbitmaps + ppbits[i].position;
  381. X      else
  382. X          bits = 0;
  383. X      fsdata->encoding[i].bits = bits;
  384. X      }
  385. X  
  386. X      /* read glyphs according to the range */
  387. --- 1411,1423 ----
  388. X      }
  389. X      /* adjust them */
  390. X      for (i = 0; i < rep.num_chars; i++) {
  391. !     if (ppbits[i].length || NONZEROMETRICS(&fsdata->encoding[i].metrics))
  392. X          bits = (char *) pbitmaps + ppbits[i].position;
  393. X      else
  394. X          bits = 0;
  395. X      fsdata->encoding[i].bits = bits;
  396. +     /* copy the pointer into inkMetrics so _fs_get_metrics can use it */
  397. +     fsdata->inkMetrics[i].bits = bits;
  398. X      }
  399. X  
  400. X      /* read glyphs according to the range */
  401. ***************
  402. *** 1376,1381 ****
  403. --- 1471,1477 ----
  404. X      blockedglyph = (FSBlockedGlyphPtr) blockrec->data;
  405. X      blockedglyph->pfont = pfont;
  406. X      blockedglyph->expected_range = range;
  407. +     blockedglyph->done = FALSE;
  408. X  
  409. X      /* send the request */
  410. X      req.reqType = FS_QueryXBitmaps8;
  411. ***************
  412. *** 1474,1562 ****
  413. X      return Successful;
  414. X  }
  415. X  
  416. - static int
  417. - fs_send_load_extents(client, pfont, flags, nranges, range)
  418. -     pointer     client;
  419. -     FontPtr     pfont;
  420. -     int         nranges;
  421. -     fsRange    *range;
  422. - {
  423. -     FSBlockDataPtr blockrec;
  424. -     FSBlockedExtentPtr blockedextent;
  425. -     int         res;
  426. -     fsQueryXBitmaps8Req req;
  427. -     FSFontDataPtr fsd = (FSFontDataPtr) (pfont->fpePrivate);
  428. -     FontPathElementPtr fpe = fsd->fpe;
  429. -     FSFpePtr    conn = (FSFpePtr) fpe->private;
  430. X  
  431. -     /* make a new block record, and add it to the end of the list */
  432. -     blockrec = fs_new_block_rec(fpe, client, FS_LOAD_EXTENTS);
  433. -     if (!blockrec)
  434. -     return AllocError;
  435. -     blockedextent = (FSBlockedExtentPtr) blockrec->data;
  436. -     blockedextent->pfont = pfont;
  437. -     blockedextent->expected_ranges = range;
  438. -     blockedextent->nranges = nranges;
  439. -     /*
  440. -      * see if the desired extents already exist, and return Successful if they
  441. -      * do, otherwise build up character range/character string
  442. -      */
  443. -     res = fs_check_extents(pfont, flags, nranges, range, blockrec);
  444. -     if (res == AccessDone)
  445. -     return Successful;
  446. -     /* send the request */
  447. -     req.reqType = FS_QueryXExtents8;
  448. -     req.fid = ((FSFontDataPtr) pfont->fpePrivate)->fontid;
  449. -     req.range = TRUE;
  450. -     req.length = (sizeof(fsQueryXExtents8Req) + sizeof(fsRange) * nranges) >> 2;
  451. -     req.num_ranges = nranges;
  452. -     _fs_add_req_log(conn, FS_QueryXExtents8);
  453. -     _fs_write(conn, (char *) &req, sizeof(fsQueryXExtents8Req));
  454. -     if (nranges)
  455. -     _fs_write(conn, (char *) range, sizeof(fsRange) * nranges);
  456. -     return Suspended;
  457. - }
  458. - int
  459. - fs_load_extents(client, pfont, flags, nranges, range,
  460. -         nextents, extents)
  461. -     pointer     client;
  462. -     FontPtr     pfont;
  463. -     int         nranges;
  464. -     fsRange    *range;
  465. -     unsigned long *nextents;
  466. -     fsCharInfo **extents;
  467. - {
  468. -     FSBlockDataPtr blockrec;
  469. -     FSBlockedExtentPtr blockedextent;
  470. -     FSFpePtr    conn = (FSFpePtr) pfont->fpe->private;
  471. -     /* see if the result is already there */
  472. -     blockrec = (FSBlockDataPtr) conn->blocked_requests;
  473. -     while (blockrec) {
  474. -     if (blockrec->type == FS_LOAD_EXTENTS && blockrec->client == client) {
  475. -         blockedextent = (FSBlockedExtentPtr) blockrec->data;
  476. -         if (blockedextent->pfont == pfont && blockedextent->done) {
  477. -         /* copy the data */
  478. -         *nextents = blockedextent->nextents;
  479. -         *extents = blockedextent->extents;
  480. -         fs_remove_blockrec(conn, blockrec);
  481. -         return Successful;
  482. -         }
  483. -     }
  484. -     blockrec = blockrec->next;
  485. -     }
  486. -     /* didn't find waiting record, so send a new one */
  487. -     return fs_send_load_extents(client, pfont, flags, nranges, range);
  488. - }
  489. X  /*
  490. X   * almost identical to the above, but meant for FS chaining
  491. X   */
  492. --- 1570,1576 ----
  493. ***************
  494. *** 1619,1712 ****
  495. X  }
  496. X  
  497. X  static int
  498. - fs_send_load_bitmaps(client, pfont, format, flags, nranges, range)
  499. -     pointer     client;
  500. -     FontPtr     pfont;
  501. -     fsBitmapFormat format;
  502. -     int         nranges;
  503. -     fsRange    *range;
  504. - {
  505. -     FSBlockDataPtr blockrec;
  506. -     FSBlockedBitmapPtr blockedbitmap;
  507. -     int         res;
  508. -     fsQueryXBitmaps8Req req;
  509. -     FSFontDataPtr fsd = (FSFontDataPtr) (pfont->fpePrivate);
  510. -     FontPathElementPtr fpe = fsd->fpe;
  511. -     FSFpePtr    conn = (FSFpePtr) fpe->private;
  512. -     /* make a new block record, and add it to the end of the list */
  513. -     blockrec = fs_new_block_rec(fpe, client, FS_LOAD_BITMAPS);
  514. -     if (!blockrec)
  515. -     return AllocError;
  516. -     blockedbitmap = (FSBlockedBitmapPtr) blockrec->data;
  517. -     blockedbitmap->pfont = pfont;
  518. -     blockedbitmap->expected_ranges = range;
  519. -     blockedbitmap->nranges = nranges;
  520. -     /*
  521. -      * see if the desired glyphs already exist, and return Successful if they
  522. -      * do, otherwise build up character range/character string
  523. -      */
  524. -     res = fs_check_bitmaps(pfont, format, flags, nranges, range, blockrec);
  525. -     if (res == AccessDone)
  526. -     return Successful;
  527. -     /* send the request */
  528. -     req.reqType = FS_QueryXBitmaps8;
  529. -     req.fid = ((FSFontDataPtr) pfont->fpePrivate)->fontid;
  530. -     req.format = format;
  531. -     req.range = TRUE;
  532. -     req.length = (sizeof(fsQueryXBitmaps8Req) + sizeof(fsRange) * nranges) >> 2;
  533. -     req.num_ranges = nranges;
  534. -     _fs_add_req_log(conn, FS_QueryXBitmaps8);
  535. -     _fs_write(conn, (char *) &req, sizeof(fsQueryXBitmaps8Req));
  536. -     _fs_write(conn, (char *) range, sizeof(fsRange) * nranges);
  537. -     return Suspended;
  538. - }
  539. - int
  540. - fs_load_bitmaps(client, pfont, format, flags, nranges, range,
  541. -         size, nglyphs, offsets, gdata)
  542. -     pointer     client;
  543. -     FontPtr     pfont;
  544. -     fsBitmapFormat format;
  545. -     int         nranges;
  546. -     fsRange    *range;
  547. -     unsigned long *size;
  548. -     unsigned long *nglyphs;
  549. -     fsOffset  **offsets;
  550. -     pointer    *gdata;
  551. - {
  552. -     FSBlockDataPtr blockrec;
  553. -     FSBlockedBitmapPtr blockedbitmap;
  554. -     FSFpePtr    conn = (FSFpePtr) pfont->fpe->private;
  555. -     /* see if the result is already there */
  556. -     blockrec = (FSBlockDataPtr) conn->blocked_requests;
  557. -     while (blockrec) {
  558. -     if (blockrec->type == FS_LOAD_BITMAPS && blockrec->client == client) {
  559. -         blockedbitmap = (FSBlockedBitmapPtr) blockrec->data;
  560. -         if (blockedbitmap->pfont == pfont && blockedbitmap->done) {
  561. -         /* copy the data */
  562. -         *size = blockedbitmap->size;
  563. -         *nglyphs = blockedbitmap->nglyphs;
  564. -         *offsets = blockedbitmap->offsets;
  565. -         *gdata = blockedbitmap->gdata;
  566. -         fs_remove_blockrec(conn, blockrec);
  567. -         return Successful;
  568. -         }
  569. -     }
  570. -     blockrec = blockrec->next;
  571. -     }
  572. -     /* didn't find waiting record, so send a new one */
  573. -     return fs_send_load_bitmaps(client, pfont, format, flags, nranges, range);
  574. - }
  575. - static int
  576. X  fs_read_list(fpe, blockrec)
  577. X      FontPathElementPtr fpe;
  578. X      FSBlockDataPtr blockrec;
  579. --- 1633,1638 ----
  580. ***************
  581. *** 1840,1845 ****
  582. --- 1766,1773 ----
  583. X      return fs_send_list_fonts(client, fpe, pattern, patlen, maxnames, newnames);
  584. X  }
  585. X  
  586. + static int  padlength[4] = {0, 3, 2, 1};
  587. X  static int
  588. X  fs_read_list_info(fpe, blockrec)
  589. X      FontPathElementPtr fpe;
  590. ***************
  591. *** 1852,1863 ****
  592. X      fsPropOffset *po;
  593. X      char       *name;
  594. X      pointer     pd;
  595. X  
  596. X      /* clean up anything from the last trip */
  597. !     if (binfo->pfi) {
  598. X      xfree(binfo->name);
  599. X      xfree(binfo->pfi->isStringProp);
  600. X      xfree(binfo->pfi->props);
  601. X      }
  602. X      /* get reply header */
  603. X      bcopy((char *) &blockrec->header, (char *) &rep, sizeof(fsReplyHeader));
  604. --- 1780,1798 ----
  605. X      fsPropOffset *po;
  606. X      char       *name;
  607. X      pointer     pd;
  608. +     int        err;
  609. X  
  610. X      /* clean up anything from the last trip */
  611. !     if (binfo->name)
  612. !     {
  613. X      xfree(binfo->name);
  614. +     binfo->name = NULL;
  615. +     }
  616. +     if (binfo->pfi) {
  617. X      xfree(binfo->pfi->isStringProp);
  618. X      xfree(binfo->pfi->props);
  619. +     xfree(binfo->pfi);
  620. +     binfo->pfi = NULL;
  621. X      }
  622. X      /* get reply header */
  623. X      bcopy((char *) &blockrec->header, (char *) &rep, sizeof(fsReplyHeader));
  624. ***************
  625. *** 1867,1872 ****
  626. --- 1802,1811 ----
  627. X      binfo->errcode = AllocError;
  628. X      return AllocError;
  629. X      }
  630. +     if (conn->fsMajorVersion > 1)
  631. +     if (rep.nameLength == 0)
  632. +         goto done;
  633. +     /* old protocol sent a full-length reply even for the last one */
  634. X      if (_fs_read(conn, (char *) &rep + sizeof(fsReplyHeader),
  635. X        sizeof(fsListFontsWithXInfoReply) - sizeof(fsReplyHeader)) == -1) {
  636. X      goto done;
  637. ***************
  638. *** 1880,1885 ****
  639. --- 1819,1825 ----
  640. X      if (!name || !binfo->pfi) {
  641. X      xfree(name);
  642. X      xfree(binfo->pfi);
  643. +     binfo->pfi = NULL;
  644. X      _fs_drain_bytes(conn,
  645. X              rep.length - (sizeof(fsListFontsWithXInfoReply) -
  646. X                        sizeof(fsReplyHeader)));
  647. ***************
  648. *** 1886,1895 ****
  649. X      binfo->errcode = AllocError;
  650. X      return AllocError;
  651. X      }
  652. !     if (_fs_read_pad(conn, name, rep.nameLength) == -1 ||
  653. !         _fs_read_pad(conn, (char *) &pi, sizeof(fsPropInfo)) == -1) {
  654. !     goto done;
  655. !     }
  656. X      po = (fsPropOffset *) xalloc(sizeof(fsPropOffset) * pi.num_offsets);
  657. X      pd = (pointer) xalloc(pi.data_len);
  658. X      if (!po || !pd) {
  659. --- 1826,1837 ----
  660. X      binfo->errcode = AllocError;
  661. X      return AllocError;
  662. X      }
  663. !     if (conn->fsMajorVersion == 1)
  664. !     if (_fs_read_pad(conn, name, rep.nameLength) == -1)
  665. !         goto done;
  666. !     if (_fs_read_pad(conn, (char *) &pi, sizeof(fsPropInfo)) == -1)
  667. !         goto done;
  668. X      po = (fsPropOffset *) xalloc(sizeof(fsPropOffset) * pi.num_offsets);
  669. X      pd = (pointer) xalloc(pi.data_len);
  670. X      if (!po || !pd) {
  671. ***************
  672. *** 1896,1913 ****
  673. X      xfree(name);
  674. X      xfree(po);
  675. X      xfree(pd);
  676. X      binfo->errcode = AllocError;
  677. X      return AllocError;
  678. X      }
  679. !     if (_fs_read_pad(conn, (char *) po,
  680. !              (pi.num_offsets * sizeof(fsPropOffset))) == -1 ||
  681. !         _fs_read_pad(conn, (char *) pd, pi.data_len) == -1) {
  682. X      xfree(name);
  683. X      xfree(po);
  684. X      xfree(pd);
  685. X      goto done;
  686. X      }
  687. !     fs_convert_lfwi_reply(binfo->pfi, &rep, &pi, po, pd);
  688. X      xfree(po);
  689. X      xfree(pd);
  690. X      binfo->name = name;
  691. --- 1838,1882 ----
  692. X      xfree(name);
  693. X      xfree(po);
  694. X      xfree(pd);
  695. +     xfree (binfo->pfi);
  696. +     binfo->pfi = NULL;
  697. X      binfo->errcode = AllocError;
  698. X      return AllocError;
  699. X      }
  700. !     err = _fs_read_pad(conn, (char *) po,
  701. !                (pi.num_offsets * sizeof(fsPropOffset)));
  702. !     if (err != -1)
  703. !     {
  704. !     if (conn->fsMajorVersion > 1)
  705. !         err = _fs_read(conn, (char *) pd, pi.data_len);
  706. !     else
  707. !         err = _fs_read_pad(conn, (char *) pd, pi.data_len);
  708. !     }
  709. !     if (err != -1  &&  conn->fsMajorVersion != 1)
  710. !     {
  711. !     err = _fs_read(conn, name, rep.nameLength);
  712. !     if (err != -1)
  713. !         err = _fs_drain_bytes(conn, padlength[(pi.data_len+rep.nameLength)&3]);
  714. !     }
  715. !     if (err == -1) {
  716. X      xfree(name);
  717. X      xfree(po);
  718. X      xfree(pd);
  719. +     xfree (binfo->pfi);
  720. +     binfo->pfi = NULL;
  721. X      goto done;
  722. X      }
  723. !     if (fs_convert_lfwi_reply(conn, binfo->pfi, &rep, &pi, po, pd) != Successful)
  724. !     {
  725. !     xfree(name);
  726. !     xfree(po);
  727. !     xfree(pd);
  728. !     xfree (binfo->pfi);
  729. !     binfo->pfi = NULL;
  730. !     goto done;
  731. !     }
  732. X      xfree(po);
  733. X      xfree(pd);
  734. X      binfo->name = name;
  735. ***************
  736. *** 2067,2076 ****
  737. X      return;
  738. X      if (blockrec->type == FS_LIST_WITH_INFO)
  739. X      {
  740. !     FSBlockedListInfoPtr blockedinfo;
  741. !     blockedinfo = (FSBlockedListInfoPtr) blockrec->data;
  742. !     if (blockedinfo->status == FS_LFWI_REPLY)
  743. X          _fs_set_bit(fs_fd_mask, conn->fs_fd);
  744. X      }
  745. X      /* replace the client pointers in this block rec with the chained one */
  746. X      if (depending = blockrec->depending) {
  747. --- 2036,2057 ----
  748. X      return;
  749. X      if (blockrec->type == FS_LIST_WITH_INFO)
  750. X      {
  751. !     FSBlockedListInfoPtr binfo;
  752. !     binfo = (FSBlockedListInfoPtr) blockrec->data;
  753. !     if (binfo->status == FS_LFWI_REPLY)
  754. X          _fs_set_bit(fs_fd_mask, conn->fs_fd);
  755. +         if (binfo->name)
  756. +     {
  757. +         xfree(binfo->name);
  758. +         binfo->name = NULL;
  759. +     }
  760. +         if (binfo->pfi) 
  761. +     {
  762. +         xfree(binfo->pfi->isStringProp);
  763. +         xfree(binfo->pfi->props);
  764. +         xfree(binfo->pfi);
  765. +         binfo->pfi = NULL;
  766. +         }
  767. X      }
  768. X      /* replace the client pointers in this block rec with the chained one */
  769. X      if (depending = blockrec->depending) {
  770. *** /tmp/da26726    Tue Jul 14 18:05:08 1992
  771. --- mit/fonts/lib/font/fc/fsconvert.c    Tue Jul 14 18:05:08 1992
  772. ***************
  773. *** 1,4 ****
  774. ! /* $XConsortium: fsconvert.c,v 1.7 91/07/16 20:17:05 keith Exp $ */
  775. X  /*
  776. X   * Copyright 1990 Network Computing Devices
  777. X   *
  778. --- 1,4 ----
  779. ! /* $XConsortium: fsconvert.c,v 1.9 92/05/12 18:07:31 gildea Exp $ */
  780. X  /*
  781. X   * Copyright 1990 Network Computing Devices
  782. X   *
  783. ***************
  784. *** 22,32 ****
  785. X   * OR PERFORMANCE OF THIS SOFTWARE.
  786. X   *
  787. X   * Author:      Dave Lemke, Network Computing Devices, Inc
  788. -  *
  789. -  *    @(#)fsconvert.c    4.2    91/05/14
  790. -  *
  791. -  * $NCDId: @(#)fsconvert.c,v 1.3 1991/06/10 13:21:52 lemke Exp $
  792. -  *
  793. X   */
  794. X  /*
  795. X   * FS data conversion
  796. --- 22,27 ----
  797. ***************
  798. *** 59,65 ****
  799. X  }
  800. X  
  801. X  int
  802. ! fs_convert_header(hdr, pfi)
  803. X      fsFontHeader *hdr;
  804. X      FontInfoPtr pfi;
  805. X  {
  806. --- 54,61 ----
  807. X  }
  808. X  
  809. X  int
  810. ! fs_convert_header(conn, hdr, pfi)
  811. !     FSFpePtr    conn;
  812. X      fsFontHeader *hdr;
  813. X      FontInfoPtr pfi;
  814. X  {
  815. ***************
  816. *** 69,80 ****
  817. X      pfi->drawDirection = (hdr->draw_direction == LeftToRightDrawDirection) ?
  818. X      LeftToRight : RightToLeft;
  819. X      pfi->inkInside = (hdr->flags & FontInfoInkInside) != 0;
  820. -     pfi->firstCol = hdr->char_range.min_char.low;
  821. -     pfi->firstRow = hdr->char_range.min_char.high;
  822. -     pfi->lastCol = hdr->char_range.max_char.low;
  823. -     pfi->lastRow = hdr->char_range.max_char.high;
  824. X  
  825. !     pfi->defaultCh = hdr->default_char.low + (hdr->default_char.high << 8);
  826. X  
  827. X      pfi->fontDescent = hdr->font_descent;
  828. X      pfi->fontAscent = hdr->font_ascent;
  829. --- 65,84 ----
  830. X      pfi->drawDirection = (hdr->draw_direction == LeftToRightDrawDirection) ?
  831. X      LeftToRight : RightToLeft;
  832. X      pfi->inkInside = (hdr->flags & FontInfoInkInside) != 0;
  833. X  
  834. !     if (conn->fsMajorVersion > 1) {
  835. !     pfi->firstCol = hdr->char_range.min_char.low;
  836. !     pfi->firstRow = hdr->char_range.min_char.high;
  837. !     pfi->lastCol = hdr->char_range.max_char.low;
  838. !     pfi->lastRow = hdr->char_range.max_char.high;
  839. !     pfi->defaultCh = hdr->default_char.low + (hdr->default_char.high << 8);
  840. !     } else {
  841. !     pfi->firstCol = hdr->char_range.min_char.high;
  842. !     pfi->firstRow = hdr->char_range.min_char.low;
  843. !     pfi->lastCol = hdr->char_range.max_char.high;
  844. !     pfi->lastRow = hdr->char_range.max_char.low;
  845. !     pfi->defaultCh = hdr->default_char.high + (hdr->default_char.low << 8);
  846. !     }
  847. X  
  848. X      pfi->fontDescent = hdr->font_descent;
  849. X      pfi->fontAscent = hdr->font_ascent;
  850. ***************
  851. *** 112,117 ****
  852. --- 116,124 ----
  853. X                  nprops;
  854. X      char       *is_str;
  855. X  
  856. + /* stolen from server/include/resource.h */
  857. + #define BAD_RESOURCE 0xe0000000
  858. X      nprops = pfi->nprops = pi->num_offsets;
  859. X  
  860. X      dprop = (FontPropPtr) xalloc(sizeof(FontPropRec) * nprops);
  861. ***************
  862. *** 133,138 ****
  863. --- 140,153 ----
  864. X          *is_str = TRUE;
  865. X          dprop->value = (INT32) MakeAtom(&pd[po->value.position],
  866. X                          po->value.length, 1);
  867. +         if (dprop->value == BAD_RESOURCE)
  868. +         {
  869. +         xfree (pfi->props);
  870. +         xfree (pfi->isStringProp);
  871. +         pfi->props = 0;
  872. +         pfi->isStringProp = 0;
  873. +         return -1;
  874. +         }
  875. X      }
  876. X      }
  877. X  
  878. ***************
  879. *** 140,146 ****
  880. X  }
  881. X  
  882. X  int
  883. ! fs_convert_lfwi_reply(pfi, fsrep, pi, po, pd)
  884. X      FontInfoPtr pfi;
  885. X      fsListFontsWithXInfoReply *fsrep;
  886. X      fsPropInfo *pi;
  887. --- 155,162 ----
  888. X  }
  889. X  
  890. X  int
  891. ! fs_convert_lfwi_reply(conn, pfi, fsrep, pi, po, pd)
  892. !     FSFpePtr    conn;
  893. X      FontInfoPtr pfi;
  894. X      fsListFontsWithXInfoReply *fsrep;
  895. X      fsPropInfo *pi;
  896. ***************
  897. *** 149,156 ****
  898. X  {
  899. X      fsFontHeader *hdr = &fsrep->header;
  900. X  
  901. !     fs_convert_header(hdr, pfi);
  902. !     fs_convert_props(pi, po, pd, pfi);
  903. X  
  904. X      return Successful;
  905. X  }
  906. --- 165,173 ----
  907. X  {
  908. X      fsFontHeader *hdr = &fsrep->header;
  909. X  
  910. !     fs_convert_header(conn, hdr, pfi);
  911. !     if (fs_convert_props(pi, po, pd, pfi) == -1)
  912. !     return AllocError;
  913. X  
  914. X      return Successful;
  915. X  }
  916. ***************
  917. *** 325,331 ****
  918. X      return Successful;
  919. X  }
  920. X  
  921. ! CharInfoRec junkDefault;
  922. X  
  923. X  static int
  924. X  _fs_get_metrics(pFont, count, chars, charEncoding, glyphCount, glyphs)
  925. --- 342,348 ----
  926. X      return Successful;
  927. X  }
  928. X  
  929. ! static CharInfoRec junkDefault;
  930. X  
  931. X  static int
  932. X  _fs_get_metrics(pFont, count, chars, charEncoding, glyphCount, glyphs)
  933. ***************
  934. *** 339,350 ****
  935. X      int         ret;
  936. X      FSFontPtr   fsfont;
  937. X      int         i;
  938. X      fsfont = (FSFontPtr) pFont->fontPrivate;
  939. X      if (!fsfont->pDefault)
  940. X      fsfont->pDefault = &junkDefault;
  941. X      ret = _fs_get_glyphs(pFont, count, chars, charEncoding,
  942. X               glyphCount, (CharInfoPtr *) glyphs);
  943. X  
  944. X      if (ret == Successful) {
  945. X      if (fsfont->pDefault == &junkDefault) {
  946. --- 356,373 ----
  947. X      int         ret;
  948. X      FSFontPtr   fsfont;
  949. X      int         i;
  950. !     CharInfoPtr encoding;
  951. !     
  952. X      fsfont = (FSFontPtr) pFont->fontPrivate;
  953. X      if (!fsfont->pDefault)
  954. X      fsfont->pDefault = &junkDefault;
  955. +     /* sleeze - smash the encoding so we get ink metrics */
  956. +     encoding = fsfont->encoding;
  957. +     fsfont->encoding = fsfont->inkMetrics;
  958. X      ret = _fs_get_glyphs(pFont, count, chars, charEncoding,
  959. X               glyphCount, (CharInfoPtr *) glyphs);
  960. +     fsfont->encoding = encoding;
  961. X  
  962. X      if (ret == Successful) {
  963. X      if (fsfont->pDefault == &junkDefault) {
  964. ***************
  965. *** 377,388 ****
  966. X      FontPtr     pfont;
  967. X  {
  968. X      /* set font function pointers */
  969. -     extern int  fs_load_bitmaps();
  970. -     extern int  fs_load_extents();
  971. X      pfont->get_glyphs = _fs_get_glyphs;
  972. X      pfont->get_metrics = _fs_get_metrics;
  973. -     pfont->get_bitmaps = fs_load_bitmaps;
  974. -     pfont->get_extents = fs_load_extents;
  975. X      pfont->unload_font = fs_unload_font;
  976. X  }
  977. --- 400,406 ----
  978. *** /tmp/da26769    Tue Jul 14 18:05:13 1992
  979. --- mit/fonts/lib/font/fc/fsio.c    Tue Jul 14 18:05:12 1992
  980. ***************
  981. *** 1,6 ****
  982. ! /* $XConsortium: fsio.c,v 1.21 91/07/19 20:55:30 rws Exp $ */
  983. X  /*
  984. -  *
  985. X   * Copyright 1990 Network Computing Devices
  986. X   *
  987. X   * Permission to use, copy, modify, distribute, and sell this software and its
  988. --- 1,5 ----
  989. ! /* $XConsortium: fsio.c,v 1.23 92/05/14 16:52:27 gildea Exp $ */
  990. X  /*
  991. X   * Copyright 1990 Network Computing Devices
  992. X   *
  993. X   * Permission to use, copy, modify, distribute, and sell this software and its
  994. ***************
  995. *** 23,30 ****
  996. X   * OR PERFORMANCE OF THIS SOFTWARE.
  997. X   *
  998. X   * Author:      Dave Lemke, Network Computing Devices, Inc
  999. -  *
  1000. -  * $NCDId: @(#)fsio.c,v 1.7 1991/07/02 13:13:43 lemke Exp $
  1001. X   */
  1002. X  /*
  1003. X   * font server i/o routines
  1004. --- 22,27 ----
  1005. ***************
  1006. *** 213,220 ****
  1007. X      conn->fs_fd = _fs_connect(servername, 5);
  1008. X      if (conn->fs_fd < 0)
  1009. X      return FALSE;
  1010. -     conn->servername = (char *) xalloc(strlen(servername) + 1);
  1011. -     strcpy(conn->servername, servername);
  1012. X  
  1013. X      conn->generation = ++generationCount;
  1014. X  
  1015. --- 210,215 ----
  1016. ***************
  1017. *** 239,244 ****
  1018. --- 234,243 ----
  1019. X      if (_fs_read(conn, (char *) &rep, sizeof(fsConnSetup)) == -1)
  1020. X      return FALSE;
  1021. X  
  1022. +     conn->fsMajorVersion = rep.major_version;
  1023. +     if (rep.major_version > FS_PROTOCOL)
  1024. +     return FALSE;
  1025. X      alts = 0;
  1026. X      /* parse alternate list */
  1027. X      if (nalts = rep.num_alternates) {
  1028. ***************
  1029. *** 308,313 ****
  1030. --- 307,317 ----
  1031. X      xfree(auth_data);
  1032. X      xfree(vendor_string);
  1033. X  
  1034. +     conn->servername = (char *) xalloc(strlen(servername) + 1);
  1035. +     if (conn->servername == NULL)
  1036. +     return FALSE;
  1037. +     strcpy(conn->servername, servername);
  1038. X      return TRUE;
  1039. X  }
  1040. X  
  1041. ***************
  1042. *** 392,397 ****
  1043. --- 396,402 ----
  1044. X          errno = EPIPE;
  1045. X          return -1;
  1046. X          }
  1047. +         errno = 0;
  1048. X      } else if (errno == EINTR) {
  1049. X          continue;
  1050. X      } else {        /* something bad happened */
  1051. *** /tmp/da26791    Tue Jul 14 18:05:15 1992
  1052. --- mit/fonts/lib/font/fc/fservestr.h    Tue Jul 14 18:05:14 1992
  1053. ***************
  1054. *** 1,10 ****
  1055. ! /* $XConsortium: fservestr.h,v 1.6 91/06/21 18:15:45 keith Exp $ */
  1056. X  /*
  1057. X   * Copyright 1990 Network Computing Devices
  1058. X   *
  1059. !  * Permission to use, copy, modify, distribute, and sell this software and its
  1060. !  * documentation for any purpose is hereby granted without fee, provided that
  1061. !  * the above copyright notice appear in all copies and that both that
  1062. X   * copyright notice and this permission notice appear in supporting
  1063. X   * documentation, and that the name of Network Computing Devices not be
  1064. X   * used in advertising or publicity pertaining to distribution of the
  1065. --- 1,10 ----
  1066. ! /* $XConsortium: fservestr.h,v 1.8 92/07/09 16:11:10 gildea Exp $ */
  1067. X  /*
  1068. X   * Copyright 1990 Network Computing Devices
  1069. X   *
  1070. !  * Permission to use, copy, modify, distribute, and sell this software and
  1071. !  * its documentation for any purpose is hereby granted without fee, provided
  1072. !  * that the above copyright notice appear in all copies and that both that
  1073. X   * copyright notice and this permission notice appear in supporting
  1074. X   * documentation, and that the name of Network Computing Devices not be
  1075. X   * used in advertising or publicity pertaining to distribution of the
  1076. ***************
  1077. *** 22,29 ****
  1078. X   * OR PERFORMANCE OF THIS SOFTWARE.
  1079. X   *
  1080. X   * Author:      Dave Lemke, Network Computing Devices, Inc
  1081. -  *
  1082. -  * $NCDId: @(#)fservestr.h,v 1.2 1991/05/24 15:03:06 lemke Exp $
  1083. X   */
  1084. X  
  1085. X  #ifndef _FSERVESTR_H_
  1086. --- 22,27 ----
  1087. ***************
  1088. *** 48,53 ****
  1089. --- 46,52 ----
  1090. X  typedef struct _fs_font {
  1091. X      CharInfoPtr pDefault;
  1092. X      CharInfoPtr encoding;
  1093. +     CharInfoPtr inkMetrics;
  1094. X      pointer     bitmaps;
  1095. X  }           FSFontRec, *FSFontPtr;
  1096. X  
  1097. *** /tmp/da26813    Tue Jul 14 18:05:17 1992
  1098. --- mit/fonts/lib/font/fc/fsio.h    Tue Jul 14 18:05:16 1992
  1099. ***************
  1100. *** 1,4 ****
  1101. ! /* $XConsortium: fsio.h,v 1.9 91/07/18 22:40:50 keith Exp $ */
  1102. X  /*
  1103. X   * Copyright 1990 Network Computing Devices
  1104. X   *
  1105. --- 1,4 ----
  1106. ! /* $XConsortium: fsio.h,v 1.10 92/05/12 18:07:38 gildea Exp $ */
  1107. X  /*
  1108. X   * Copyright 1990 Network Computing Devices
  1109. X   *
  1110. ***************
  1111. *** 22,29 ****
  1112. X   * OR PERFORMANCE OF THIS SOFTWARE.
  1113. X   *
  1114. X   * Author:      Dave Lemke, Network Computing Devices, Inc
  1115. -  *
  1116. -  * $NCDId: @(#)fsio.h,v 1.4 1991/07/03 17:52:30 lemke Exp $
  1117. X   */
  1118. X  
  1119. X  #ifndef    _FSIO_H_
  1120. --- 22,27 ----
  1121. ***************
  1122. *** 56,61 ****
  1123. --- 54,60 ----
  1124. X  
  1125. X      int         generation;
  1126. X      int         numAlts;
  1127. +     int        fsMajorVersion; /* font server major version number */
  1128. X      FSFpeAltPtr alts;
  1129. X  
  1130. X      FSClientPtr    clients;
  1131. *** /tmp/da11492    Mon Jul 20 16:43:04 1992
  1132. --- mit/fonts/lib/font/Speedo/spfont.c    Mon Jul 20 16:43:03 1992
  1133. ***************
  1134. *** 1,4 ****
  1135. ! /* $XConsortium: spfont.c,v 1.13 91/09/16 11:42:28 keith Exp $ */
  1136. X  /*
  1137. X   * Copyright 1990, 1991 Network Computing Devices;
  1138. X   * Portions Copyright 1987 by Digital Equipment Corporation and the
  1139. --- 1,4 ----
  1140. ! /* $XConsortium: spfont.c,v 1.16 92/05/12 18:07:52 gildea Exp $ */
  1141. X  /*
  1142. X   * Copyright 1990, 1991 Network Computing Devices;
  1143. X   * Portions Copyright 1987 by Digital Equipment Corporation and the
  1144. ***************
  1145. *** 22,30 ****
  1146. X   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  1147. X   *
  1148. X   * Author: Dave Lemke, Network Computing Devices Inc
  1149. -  *
  1150. -  * $NCDId: @(#)spfont.c,v 4.9 1991/07/02 17:01:30 lemke Exp $
  1151. -  *
  1152. X   */
  1153. X  
  1154. X  /*
  1155. --- 22,27 ----
  1156. ***************
  1157. *** 47,55 ****
  1158. X  
  1159. X  extern void SpeedoCloseFont();
  1160. X  static int  get_sp_glyphs(),
  1161. !             get_sp_bitmaps(),
  1162. !             get_sp_metrics(),
  1163. !             get_sp_extents();
  1164. X  static int load_sp_font();
  1165. X  
  1166. X  static CharInfoRec junkDefault;
  1167. --- 44,50 ----
  1168. X  
  1169. X  extern void SpeedoCloseFont();
  1170. X  static int  get_sp_glyphs(),
  1171. !             get_sp_metrics();
  1172. X  static int load_sp_font();
  1173. X  
  1174. X  static CharInfoRec junkDefault;
  1175. ***************
  1176. *** 69,455 ****
  1177. X      dst->attributes = 0;
  1178. X  }
  1179. X  
  1180. - /* XXX -- may have to add in some work for setting default metrics values */
  1181. - /* ARGSUSED */
  1182. X  static int
  1183. - get_sp_extents(client, pfont, flags, num_ranges, range, num_extents, data)
  1184. -     pointer     client;
  1185. -     FontPtr     pfont;
  1186. -     Mask        flags;
  1187. -     unsigned long num_ranges;
  1188. -     fsRange    *range;
  1189. -     unsigned long *num_extents;
  1190. -     fsCharInfo **data;
  1191. - {
  1192. -     int         start,
  1193. -                 end,
  1194. -                 i,
  1195. -                 j;
  1196. -     unsigned long size;
  1197. -     fsCharInfo *ci,
  1198. -                *pci;
  1199. -     fsRange    *rp;
  1200. -     FontInfoPtr pinfo;
  1201. -     SpeedoFontPtr spf;
  1202. -     SpeedoMasterFontPtr master;
  1203. -     CharInfoRec src;
  1204. -     int        firstChar;
  1205. -     assert(pfont);
  1206. -     pinfo = &pfont->info;
  1207. -     spf = (SpeedoFontPtr) pfont->fontPrivate;
  1208. -     master = spf->master;
  1209. -     firstChar = master->first_char_id;
  1210. -     if (flags & LoadAll) {
  1211. -     start = master->first_char_id;
  1212. -     end = master->max_id;
  1213. -     *num_extents = end - start + 1;
  1214. -     size = sizeof(fsCharInfo) * (*num_extents);
  1215. -     pci = ci = (fsCharInfo *) xalloc(size);
  1216. -     if (!ci)
  1217. -         return AllocError;
  1218. -     /* copy all the extents */
  1219. -     for (i = start; i <= end; i++) {
  1220. -         src = spf->encoding[i - firstChar];
  1221. -         CopyCharInfo(&src, pci);
  1222. -         pci++;
  1223. -     }
  1224. -     /* make sure it didn't go off the end */
  1225. -     assert(pci == (fsCharInfo *) ((char *) ci + size));
  1226. -     assert(pci == (ci + (end - start + 1)));
  1227. -     *data = ci;
  1228. -     return Successful;
  1229. -     }
  1230. -     /* normal case */
  1231. -     /* figure out how big everything has to be */
  1232. -     *num_extents = 0;
  1233. -     for (i = 0, rp = range; i < num_ranges; i++, rp++) {
  1234. -     start = (rp->min_char.high << 8) + rp->min_char.low;
  1235. -     end = (rp->max_char.high << 8) + rp->max_char.low;
  1236. -     /* range check */
  1237. -     if (end < start ||
  1238. -         (end > (pinfo->lastRow << 8) + pinfo->lastCol)
  1239. -         || (end < (pinfo->firstRow << 8) + pinfo->firstCol)
  1240. -         || (start > (pinfo->lastRow << 8) + pinfo->lastCol)
  1241. -         || (start < (pinfo->firstRow << 8) + pinfo->firstCol))
  1242. -         return BadCharRange;
  1243. -     *num_extents += end - start + 1;
  1244. -     }
  1245. -     size = sizeof(fsCharInfo) * (*num_extents);
  1246. -     pci = ci = (fsCharInfo *) xalloc(size);
  1247. -     if (!ci)
  1248. -     return AllocError;
  1249. -     /* copy all the extents */
  1250. -     for (i = 0, rp = range; i < num_ranges; i++, rp++) {
  1251. -     start = (rp->min_char.high << 8) + rp->min_char.low;
  1252. -     end = (rp->max_char.high << 8) + rp->max_char.low;
  1253. -     /* copy all the extents */
  1254. -     for (j = start; j <= end; j++) {
  1255. -         src = spf->encoding[j - firstChar];
  1256. -         CopyCharInfo(&src, pci);
  1257. -         pci++;
  1258. -     }
  1259. -     /* make sure it didn't go off the end */
  1260. -     assert(pci == (fsCharInfo *) ((char *) ci + size));
  1261. -     assert(pci == (ci + (end - start + 1)));
  1262. -     }
  1263. -     *data = ci;
  1264. -     return Successful;
  1265. - }
  1266. - /*
  1267. -  * packs up the glyphs as requested by the format
  1268. -  */
  1269. - static int
  1270. - pack_sp_glyphs(pfont, format, flags, num_ranges, range, tsize, num_glyphs,
  1271. -            offsets, data, freeData)
  1272. -     FontPtr     pfont;
  1273. -     int         format;
  1274. -     Mask        flags;
  1275. -     unsigned long num_ranges;
  1276. -     fsRange    *range;
  1277. -     unsigned long *tsize;
  1278. -     unsigned long *num_glyphs;
  1279. -     fsOffset  **offsets;
  1280. -     pointer    *data;
  1281. -     int        *freeData;
  1282. - {
  1283. -     unsigned long start,
  1284. -                 end;
  1285. -     int         i;
  1286. -     fsOffset   *lengths = (fsOffset *) 0,
  1287. -                *l;
  1288. -     unsigned long size = 0;
  1289. -     pointer     gdata,
  1290. -                 gd;
  1291. -     unsigned long ch;
  1292. -     int         bitorder,
  1293. -                 byteorder,
  1294. -                 scanlinepad,
  1295. -                 scanlineunit,
  1296. -                 mappad;
  1297. -     int         bpr,
  1298. -                 skiprows = 0;
  1299. -     fsRange    *rp;
  1300. -     FontInfoPtr pinfo = &pfont->info;
  1301. -     SpeedoFontPtr spf = (SpeedoFontPtr) pfont->fontPrivate;
  1302. -     SpeedoMasterFontPtr master = spf->master;
  1303. -     int         err;
  1304. -     int         src_glyph_pad;
  1305. -     int         src_bit_order;
  1306. -     int         src_byte_order;
  1307. -     int        firstChar;
  1308. -     int         max_ascent, max_descent;
  1309. -     int         min_left, max_right;
  1310. -     
  1311. -     err = CheckFSFormat(format, (fsBitmapFormatMask) ~ 0,
  1312. -         &bitorder, &byteorder, &scanlineunit, &scanlinepad, &mappad);
  1313. -     if (err != Successful)
  1314. -     return err;
  1315. -     (void) CheckFSFormat(pfont->format, (fsBitmapFormatMask) ~ 0,
  1316. -         &src_bit_order, &src_byte_order, &err, &src_glyph_pad, &err);
  1317. -     if (!spf->pDefault)
  1318. -     spf->pDefault = &junkDefault;
  1319. -     *freeData = TRUE;
  1320. -     firstChar = master->first_char_id;
  1321. -     /* special case for all glyphs first */
  1322. -     if (flags & LoadAll) {
  1323. -     start = master->first_char_id;
  1324. -     end = master->max_id;
  1325. -     *num_glyphs = end - start + 1;
  1326. -     size = compute_sp_data_size(pfont, mappad, scanlinepad, start, end);;
  1327. -     num_ranges = 1;
  1328. -     } else {
  1329. -     *num_glyphs = 0;
  1330. -     for (i = 0, rp = range; i < num_ranges; i++, rp++) {
  1331. -         start = (rp->min_char.high << 8) + rp->min_char.low;
  1332. -         end = (rp->max_char.high << 8) + rp->max_char.low;
  1333. -         /* range check */
  1334. -         if (end < start ||
  1335. -             (end > (pinfo->lastRow << 8) + pinfo->lastCol)
  1336. -             || (end < (pinfo->firstRow << 8) + pinfo->firstCol)
  1337. -             || (start > (pinfo->lastRow << 8) + pinfo->lastCol)
  1338. -             || (start < (pinfo->firstRow << 8) + pinfo->firstCol))
  1339. -         return BadCharRange;
  1340. -         *num_glyphs += end - start + 1;
  1341. -         size += compute_sp_data_size(pfont, mappad, scanlinepad, start, end);
  1342. -     }
  1343. -     }
  1344. -     gd = gdata = (pointer) xalloc(size);
  1345. -     if (!gdata)
  1346. -     return AllocError;
  1347. -     if (mappad == BitmapFormatImageRectMax)
  1348. -     bzero((char *) gdata, size);
  1349. -     /* get space for glyph offsets */
  1350. -     l = lengths = (fsOffset *) xalloc(sizeof(fsOffset) *
  1351. -                       *num_glyphs);
  1352. -     if (!lengths) {
  1353. -     xfree((char *) gdata);
  1354. -     return AllocError;
  1355. -     }
  1356. -     /* compute bpr for padded out fonts */
  1357. -     switch (mappad)
  1358. -     {
  1359. -     case BitmapFormatImageRectMax:
  1360. -     max_ascent = FONT_MAX_ASCENT(pinfo);
  1361. -     max_descent = FONT_MAX_DESCENT(pinfo);
  1362. -     /* fall through */
  1363. -     case BitmapFormatImageRectMaxWidth:
  1364. -     min_left = FONT_MIN_LEFT(pinfo);
  1365. -     max_right = FONT_MAX_RIGHT(pinfo);
  1366. -     bpr = GLWIDTHBYTESPADDED(max_right - min_left, scanlinepad);
  1367. -     break;
  1368. -     case BitmapFormatImageRectMin:
  1369. -     break;
  1370. -     }
  1371. -     /* finally do the work */
  1372. -     for (i = 0, rp = range; i < num_ranges; i++, rp++) {
  1373. -     /*
  1374. -      * compute start & end.  if all_glyphs is set, we still have them
  1375. -      * laying around
  1376. -      */
  1377. -     if (!(flags & LoadAll)) {
  1378. -         start = (rp->min_char.high << 8) + rp->min_char.low;
  1379. -         end = (rp->max_char.high << 8) + rp->max_char.low;
  1380. -     }
  1381. -     for (ch = start; ch <= end; ch++) {
  1382. -         CharInfoPtr ci;
  1383. -         xCharInfo  *cim;
  1384. -         int         srcbpr;
  1385. -         unsigned char    *src, *dst;
  1386. -         unsigned int    bits1, bits2;
  1387. -         int         r,
  1388. -             lshift = 0,
  1389. -             rshift = 0,
  1390. -             width,
  1391. -             w,
  1392. -             src_extra,
  1393. -             dst_extra;
  1394. -         l->position = gd - gdata;
  1395. -         ci = &spf->encoding[ch - firstChar];
  1396. -         /* ignore missing chars */
  1397. -         if (!ci) 
  1398. -         {
  1399. -         l->length = 0;
  1400. -         l++;
  1401. -         continue;
  1402. -         }
  1403. -         cim = &ci->metrics;
  1404. -         /* sanity check */
  1405. -         assert((cim->rightSideBearing - cim->leftSideBearing) <= (pinfo->maxbounds.rightSideBearing - pinfo->minbounds.leftSideBearing));
  1406. -         srcbpr = GLWIDTHBYTESPADDED(cim->rightSideBearing -
  1407. -                     cim->leftSideBearing, src_glyph_pad);
  1408. -         /*
  1409. -          * caculate bytes-per-row for PadNone (others done in allocation
  1410. -          * phase), what (if anything) to ignore or add as padding
  1411. -          */
  1412. -         switch (mappad) {
  1413. -         case BitmapFormatImageRectMin:
  1414. -         bpr = GLYPH_SIZE(ci, scanlinepad);
  1415. -         break;
  1416. -         case BitmapFormatImageRectMax:
  1417. -         /* leave the first padded rows blank */
  1418. -         gd += bpr * (max_ascent - cim->ascent);
  1419. -         skiprows = bpr * (max_descent - cim->descent);
  1420. -         /* fall thru */
  1421. -         case BitmapFormatImageRectMaxWidth:
  1422. -         rshift = cim->leftSideBearing - min_left;
  1423. -         lshift = 8 - lshift;
  1424. -         break;
  1425. -         }
  1426. -         src = (unsigned char *) ci->bits;
  1427. -         dst = gd;
  1428. -         width = srcbpr;
  1429. -         if (srcbpr > bpr)
  1430. -         width = bpr;
  1431. -         src_extra = srcbpr - width;
  1432. -         dst_extra = bpr - width;
  1433. - #if (DEFAULTBITORDER == MSBFirst)
  1434. - #define BitLeft(b,c)    ((b) << (c))
  1435. - #define BitRight(b,c)    ((b) >> (c))
  1436. - #else
  1437. - #define BitLeft(b,c)    ((b) >> (c))
  1438. - #define BitRight(b,c)    ((b) << (c))
  1439. - #endif
  1440. -         if (!rshift)
  1441. -         {
  1442. -         if (srcbpr == bpr)
  1443. -         {
  1444. -             r = (cim->ascent + cim->descent) * width;
  1445. -             bcopy (src, dst, r);
  1446. -             dst += r;
  1447. -         }
  1448. -         else
  1449. -         {
  1450. -             for (r = cim->ascent + cim->descent; r; r--)
  1451. -             {
  1452. -             for (w = width; w; w--)
  1453. -                 *dst++ = *src++;
  1454. -             dst += dst_extra;
  1455. -             src += src_extra;
  1456. -             }
  1457. -         }
  1458. -         }
  1459. -         else
  1460. -         {
  1461. -         for (r = cim->ascent + cim->descent; r; r--)
  1462. -         {
  1463. -             bits2 = 0;
  1464. -             for (w = width; w; w--)
  1465. -             {
  1466. -             bits1 = *src++;
  1467. -             *dst++ = BitRight(bits1, rshift) |
  1468. -                  BitLeft (bits2, lshift);
  1469. -             bits2 = bits1;
  1470. -             }
  1471. -             dst += dst_extra;
  1472. -             src += src_extra;
  1473. -         }
  1474. -         }
  1475. -         dst += skiprows;
  1476. -         l->length = dst - gd;
  1477. -         gd = dst;
  1478. -         l++;
  1479. -     }
  1480. -     }
  1481. -     bitorder = (bitorder == BitmapFormatBitOrderLSB) ?
  1482. -     LSBFirst : MSBFirst;
  1483. -     byteorder = (byteorder == BitmapFormatByteOrderLSB) ?
  1484. -     LSBFirst : MSBFirst;
  1485. -     /* now do the bit, byte, word swapping */
  1486. -     if (bitorder != src_bit_order)
  1487. -     BitOrderInvert(gdata, size);
  1488. -     if (byteorder != src_byte_order) {
  1489. -     if (scanlineunit == 2)
  1490. -         TwoByteSwap(gdata, size);
  1491. -     else if (scanlineunit == 4)
  1492. -         FourByteSwap(gdata, size);
  1493. -     }
  1494. -     *data = gdata;
  1495. -     *tsize = size;
  1496. -     *offsets = lengths;
  1497. -     return Successful;
  1498. - }
  1499. - /* ARGSUSED */
  1500. - static int
  1501. - get_sp_bitmaps(client, pfont, format, flags, num_ranges, range,
  1502. -            size, num_glyphs, offsets, data, freeData)
  1503. -     pointer     client;
  1504. -     FontPtr     pfont;
  1505. -     fsBitmapFormat format;
  1506. -     Mask        flags;
  1507. -     unsigned long num_ranges;
  1508. -     fsRange    *range;
  1509. -     unsigned long *size;
  1510. -     unsigned long *num_glyphs;
  1511. -     fsOffset  **offsets;
  1512. -     pointer    *data;
  1513. -     int        *freeData;
  1514. - {
  1515. -     *size = 0;
  1516. -     *data = (pointer) 0;
  1517. -     *num_glyphs = 0;
  1518. -     return pack_sp_glyphs(pfont, format, flags,
  1519. -           num_ranges, range, size, num_glyphs, offsets, data, freeData);
  1520. - }
  1521. - static int
  1522. X  get_sp_glyphs(pFont, count, chars, charEncoding, glyphCount, glyphs)
  1523. X      FontPtr     pFont;
  1524. X      unsigned long count;
  1525. --- 64,70 ----
  1526. ***************
  1527. *** 626,632 ****
  1528. X  {
  1529. X      SpeedoFontPtr spf;
  1530. X      SpeedoMasterFontPtr spmf;
  1531. -     FontPtr     mpfont;
  1532. X      int         ret;
  1533. X      char        tmpname[MAXFONTNAMELEN];
  1534. X      specs_t     specs;
  1535. --- 241,246 ----
  1536. ***************
  1537. *** 633,660 ****
  1538. X      FontScalableRec vals;
  1539. X      double      pointsize;
  1540. X  
  1541. !     /* make a master if we don't have one */
  1542. !     if (entry) {
  1543. !     mpfont = (FontPtr) entry->u.scalable.extra->private;
  1544. !     if (!mpfont) {
  1545. !         mpfont = (FontPtr) xalloc(sizeof(FontRec));
  1546. !         if (!mpfont)
  1547. !         return AllocError;
  1548. !         flags |= FontLoadBitmaps;    /* make sure a master is all there */
  1549. !         ret = load_sp_font(entry->name.name, filename, (FontEntryPtr) 0,
  1550. !                    format, fmask, mpfont, flags);
  1551. !         if (ret != Successful) {
  1552. !         xfree(mpfont);
  1553. !         return ret;
  1554. !         }
  1555. !         entry->u.scalable.extra->private = (pointer) mpfont;
  1556. !     }
  1557. !     spf = (SpeedoFontPtr) mpfont->fontPrivate;
  1558. !     spmf = spf->master;
  1559. !     } else {
  1560. X      ret = open_master(filename, &spmf);
  1561. X      if (ret != Successful)
  1562. X          return ret;
  1563. X      }
  1564. X  
  1565. X      spf = (SpeedoFontPtr) xalloc(sizeof(SpeedoFontRec));
  1566. --- 247,261 ----
  1567. X      FontScalableRec vals;
  1568. X      double      pointsize;
  1569. X  
  1570. !     /* find a master (create it if necessary) */
  1571. !     spmf = (SpeedoMasterFontPtr) entry->u.scalable.extra->private;
  1572. !     if (!spmf)
  1573. !     {
  1574. X      ret = open_master(filename, &spmf);
  1575. X      if (ret != Successful)
  1576. X          return ret;
  1577. +     entry->u.scalable.extra->private = (pointer) spmf;
  1578. +     spmf->entry = entry;
  1579. X      }
  1580. X  
  1581. X      spf = (SpeedoFontPtr) xalloc(sizeof(SpeedoFontRec));
  1582. ***************
  1583. *** 663,675 ****
  1584. --- 264,281 ----
  1585. X      bzero((char *) spf, sizeof(SpeedoFontRec));
  1586. X  
  1587. X      spf->master = spmf;
  1588. +     spf->entry = entry;
  1589. X      spmf->refcount++;
  1590. X      sp_reset_master(spmf);
  1591. +     /* now we've done enough that if we bail out we must call close_sp_font */
  1592. X  
  1593. X      /* tear apart name to get sizes */
  1594. X      strcpy(tmpname, fontname);
  1595. X      if (!FontParseXLFDName(tmpname, &vals, FONT_XLFD_REPLACE_NONE))
  1596. +     {
  1597. +     close_sp_font(spf);
  1598. X      return BadFontName;
  1599. +     }
  1600. X  
  1601. X      fixup_vals(&vals);
  1602. X      if (vals.point > 0)
  1603. ***************
  1604. *** 697,709 ****
  1605. X      specs.flags = MODE_SCREEN;
  1606. X      specs.out_info = NULL;
  1607. X  
  1608. X      if (!sp_set_specs(&specs))
  1609. X      return BadFontName;
  1610. X  
  1611. X      spf->specs = specs;
  1612. X  
  1613. X      *spfont = spf;
  1614. X      return Successful;
  1615. X  }
  1616. X  
  1617. --- 303,334 ----
  1618. X      specs.flags = MODE_SCREEN;
  1619. X      specs.out_info = NULL;
  1620. X  
  1621. +     /* When Speedo tries to generate a very small font bitmap, it
  1622. +        often crashes or goes into an infinite loop.
  1623. +        Don't know why this is so, but until we can fix it properly,
  1624. +        return BadFontName for anything smaller than 4 pixels.
  1625. +        */
  1626. + #define TINY_FACTOR (4 << 16)
  1627. +     /* XXX may have to do more tweaking for ROTATED_TEXT */
  1628. +     if (specs.xxmult < TINY_FACTOR  ||  specs.yymult < TINY_FACTOR)
  1629. +     {
  1630. +     close_sp_font(spf);
  1631. +     return BadFontName;
  1632. +     }
  1633. +     /* clobber global state to avoid wrecking future obliqued fonts */
  1634. +     bzero ((char *) &sp_globals, sizeof(sp_globals));
  1635. X      if (!sp_set_specs(&specs))
  1636. +     {
  1637. +     close_sp_font(spf);
  1638. X      return BadFontName;
  1639. +     }
  1640. X  
  1641. X      spf->specs = specs;
  1642. +     spf->master = spmf;
  1643. X  
  1644. X      *spfont = spf;
  1645. X      return Successful;
  1646. X  }
  1647. X  
  1648. ***************
  1649. *** 724,729 ****
  1650. --- 349,357 ----
  1651. X  
  1652. X      ret = open_sp_font(fontname, filename, entry, format, fmask, flags, &spf);
  1653. X  
  1654. +     if (ret != Successful)
  1655. +     return ret;
  1656. X      spmf = spf->master;
  1657. X      sp_reset_master(spmf);
  1658. X      esize = sizeof(CharInfoRec) * (spmf->max_id - spmf->first_char_id + 1);
  1659. ***************
  1660. *** 759,773 ****
  1661. X  
  1662. X      pfont->format = format;
  1663. X  
  1664. -     pfont->get_bitmaps = get_sp_bitmaps;
  1665. X      pfont->get_metrics = get_sp_metrics;
  1666. X      pfont->get_glyphs = get_sp_glyphs;
  1667. -     pfont->get_extents = get_sp_extents;
  1668. X      pfont->unload_font = SpeedoCloseFont;
  1669. X      pfont->refcnt = 0;
  1670. X      pfont->maxPrivate = -1;
  1671. X      pfont->devPrivates = (pointer *) 0;
  1672. X  
  1673. X      close_master_file(spmf);
  1674. X  
  1675. X      return ret;
  1676. --- 387,400 ----
  1677. X  
  1678. X      pfont->format = format;
  1679. X  
  1680. X      pfont->get_metrics = get_sp_metrics;
  1681. X      pfont->get_glyphs = get_sp_glyphs;
  1682. X      pfont->unload_font = SpeedoCloseFont;
  1683. X      pfont->refcnt = 0;
  1684. X      pfont->maxPrivate = -1;
  1685. X      pfont->devPrivates = (pointer *) 0;
  1686. X  
  1687. +     /* have to hold on to master for min/max id */
  1688. X      close_master_file(spmf);
  1689. X  
  1690. X      return ret;
  1691. ***************
  1692. *** 794,800 ****
  1693. X  
  1694. X      if (ret == Successful)
  1695. X      *ppfont = pfont;
  1696. X      return ret;
  1697. X  }
  1698. X  
  1699. --- 421,429 ----
  1700. X  
  1701. X      if (ret == Successful)
  1702. X      *ppfont = pfont;
  1703. !     else
  1704. !     xfree (pfont);
  1705. !     
  1706. X      return ret;
  1707. X  }
  1708. X  
  1709. ***************
  1710. *** 805,817 ****
  1711. X      SpeedoMasterFontPtr spmf;
  1712. X  
  1713. X      spmf = spf->master;
  1714. !     if (--spmf->refcount == 0) {
  1715. !     if (spmf->state & MasterFileOpen) {
  1716. !         (void) fclose(spmf->fp);
  1717. !         xfree(spmf->f_buffer);
  1718. !         xfree(spmf->c_buffer);
  1719. !     }
  1720. !     }
  1721. X      xfree(spf->encoding);
  1722. X      xfree(spf->bitmaps);
  1723. X      xfree(spf);
  1724. --- 434,442 ----
  1725. X      SpeedoMasterFontPtr spmf;
  1726. X  
  1727. X      spmf = spf->master;
  1728. !     --spmf->refcount;
  1729. !     if (spmf->refcount == 0)
  1730. !     close_master_font (spmf);
  1731. X      xfree(spf->encoding);
  1732. X      xfree(spf->bitmaps);
  1733. X      xfree(spf);
  1734. *** /tmp/da11514    Mon Jul 20 16:43:06 1992
  1735. --- mit/fonts/lib/font/Speedo/spfuncs.c    Mon Jul 20 16:43:06 1992
  1736. ***************
  1737. *** 1,4 ****
  1738. ! /* $XConsortium: spfuncs.c,v 1.5 91/09/16 11:42:30 keith Exp $ */
  1739. X  /*
  1740. X   * Copyright 1990, 1991 Network Computing Devices;
  1741. X   * Portions Copyright 1987 by Digital Equipment Corporation and the
  1742. --- 1,4 ----
  1743. ! /* $XConsortium: spfuncs.c,v 1.7 92/04/15 14:35:48 gildea Exp $ */
  1744. X  /*
  1745. X   * Copyright 1990, 1991 Network Computing Devices;
  1746. X   * Portions Copyright 1987 by Digital Equipment Corporation and the
  1747. ***************
  1748. *** 22,30 ****
  1749. X   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  1750. X   *
  1751. X   * Author: Dave Lemke, Network Computing Devices, Inc
  1752. -  *
  1753. -  * $NCDId: @(#)spfuncs.c,v 4.8 1991/07/02 17:01:44 lemke Exp $
  1754. -  *
  1755. X   */
  1756. X  
  1757. X  #include    <X11/Xos.h>
  1758. --- 22,27 ----
  1759. ***************
  1760. *** 72,79 ****
  1761. X  
  1762. X      err = open_sp_font(fontname, filename, entry,
  1763. X             (fsBitmapFormat) 0, (fsBitmapFormatMask) 0, (unsigned long) 0,
  1764. !                spfont);
  1765. !     spf = *spfont;
  1766. X  
  1767. X      if (err != Successful)
  1768. X      return err;
  1769. --- 69,75 ----
  1770. X  
  1771. X      err = open_sp_font(fontname, filename, entry,
  1772. X             (fsBitmapFormat) 0, (fsBitmapFormatMask) 0, (unsigned long) 0,
  1773. !                &spf);
  1774. X  
  1775. X      if (err != Successful)
  1776. X      return err;
  1777. ***************
  1778. *** 90,95 ****
  1779. SHAR_EOF
  1780. true || echo 'restore of fix-13 failed'
  1781. fi
  1782. echo 'End of  part 2'
  1783. echo 'File fix-13 is continued in part 3'
  1784. echo 3 > _shar_seq_.tmp
  1785. exit 0
  1786. -- 
  1787. ---
  1788. Senior Systems Scientist        mail: dcmartin@msi.com
  1789. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1790. 796 North Pastoria Avenue        at&t: 408/522-9236
  1791.