BRL-CAD
vectfont.c
Go to the documentation of this file.
1 /* V E C T F O N T . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 /** @addtogroup plot */
22 /** @{ */
23 /** @file libbn/vectfont.c
24  *
25  * Terminal Independent Graphics Display Package.
26  * Mike Muuss July 31, 1978
27  *
28  * This routine is used to plot a string of ASCII symbols
29  * on the plot being generated, using a built-in set of fonts
30  * drawn as vector lists.
31  *
32  * Internally, the basic font resides in a 10x10 unit square.
33  * Externally, each character can be thought to occupy one square
34  * plotting unit; the 'scale'
35  * parameter allows this to be changed as desired, although scale
36  * factors less than 10.0 are unlikely to be legible.
37  *
38  * The vector font table here was provided courtesy of Dr. Bruce
39  * Henrikson and Dr. Stephen Wolff, US Army Ballistic Research
40  * Laboratory, Summer of 1978. They had developed it for their
41  * remote Houston Instruments pen plotter package for the
42  * GE Tymeshare system.
43  *
44  */
45 /** @} */
46 
47 #include "common.h"
48 
49 #include <stdio.h>
50 #include <math.h>
51 
52 #include "vmath.h"
53 #include "plot3.h"
54 #include "vectfont.h"
55 #include "bu/malloc.h"
56 
57 #define NUM_SYMBOLS 8
58 
59 static int *tp_cindex[256]; /* index to stroke tokens */
60 
61 
62 /* tables for markers */
63 
64 static int tp_ctable[] = {
65 
66 /* + */
67  drk(0, 5),
68  brt(8, 5),
69  drk(4, 8),
70  brt(4, 2),
71  LAST,
72 
73 /* x */
74  drk(0, 2),
75  brt(8, 8),
76  drk(0, 8),
77  brt(8, 2),
78  LAST,
79 
80 /* triangle */
81  drk(0, 2),
82  brt(4, 8),
83  brt(8, 2),
84  brt(0, 2),
85  LAST,
86 
87 /* square */
88  drk(0, 2),
89  brt(0, 8),
90  brt(8, 8),
91  brt(8, 2),
92  brt(0, 2),
93  LAST,
94 
95 /* hourglass */
96  drk(0, 2),
97  brt(8, 8),
98  brt(0, 8),
99  brt(8, 2),
100  brt(0, 2),
101  LAST,
102 
103 /* plus-minus */
104  drk(5, 7),
105  brt(5, 2),
106  drk(2, 2),
107  brt(8, 2),
108  drk(2, 5),
109  brt(8, 5),
110  LAST,
111 
112 /* centerline symbol */
113  drk(8, 4),
114  brt(7, 6),
115  brt(4, 7),
116  brt(1, 6),
117  brt(0, 4),
118  brt(1, 2),
119  brt(4, 1),
120  brt(7, 2),
121  brt(8, 4),
122  drk(1, 1),
123  brt(7, 7),
124  LAST,
125 
126 /* degree symbol */
127  drk(1, 9),
128  brt(2, 9),
129  brt(3, 8),
130  brt(3, 7),
131  brt(2, 6),
132  brt(1, 6),
133  brt(0, 7),
134  brt(0, 8),
135  brt(1, 9),
136  LAST,
137 
138 /* table for ascii 040, ' ' */
139  LAST,
140 
141 /* table for ! */
142  drk(3, 0),
143  brt(5, 2),
144  brt(5, 0),
145  brt(3, 2),
146  brt(3, 0),
147  drk(4, 4),
148  brt(3, 10),
149  brt(5, 10),
150  brt(4, 4),
151  brt(4, 10),
152  LAST,
153 
154 /* table for " */
155  drk(1, 10),
156  brt(3, 10),
157  brt(2, 7),
158  brt(1, 10),
159  drk(5, 10),
160  brt(7, 10),
161  brt(6, 7),
162  brt(5, 10),
163  LAST,
164 
165 
166 /* table for # */
167  drk(1, 0),
168  brt(3, 9),
169  drk(6, 9),
170  brt(4, 0),
171  drk(6, 3),
172  brt(0, 3),
173  drk(1, 6),
174  brt(7, 6),
175  LAST,
176 
177 /* table for $ */
178  drk(1, 2),
179  brt(1, 1),
180  brt(7, 1),
181  brt(7, 5),
182  brt(1, 5),
183  brt(1, 9),
184  brt(7, 9),
185  brt(7, 8),
186  drk(4, 10),
187  brt(4, 0),
188  LAST,
189 
190 /* table for % */
191  drk(3, 10),
192  brt(3, 7),
193  brt(0, 7),
194  brt(0, 10),
195  brt(8, 10),
196  brt(0, 0),
197  drk(8, 0),
198  brt(5, 0),
199  brt(5, 3),
200  brt(8, 3),
201  brt(8, 0),
202  LAST,
203 
204 /* table for & */
205  drk(7, 3),
206  brt(4, 0),
207  brt(1, 0),
208  brt(0, 3),
209  brt(5, 8),
210  brt(4, 10),
211  brt(3, 10),
212  brt(1, 8),
213  brt(8, 0),
214  LAST,
215 
216 /* table for ' */
217  drk(4, 6),
218  brt(5, 10),
219  brt(6, 10),
220  brt(4, 6),
221  LAST,
222 
223 /* table for ( */
224  drk(5, 0),
225  brt(3, 1),
226  brt(2, 4),
227  brt(2, 6),
228  brt(3, 9),
229  brt(5, 10),
230  LAST,
231 
232 /* table for) */
233  drk(3, 0),
234  brt(5, 1),
235  brt(6, 4),
236  brt(6, 6),
237  brt(5, 9),
238  brt(3, 10),
239  LAST,
240 
241 /* table for * */
242  drk(4, 2),
243  brt(4, 8),
244  drk(6, 7),
245  brt(2, 3),
246  drk(6, 3),
247  brt(2, 7),
248  drk(1, 5),
249  brt(7, 5),
250  LAST,
251 
252 /* table for + */
253  drk(1, 5),
254  brt(7, 5),
255  drk(4, 8),
256  brt(4, 2),
257  LAST,
258 
259 /* table for, */
260  drk(5, 0),
261  brt(3, 2),
262  brt(3, 0),
263  brt(5, 2),
264  brt(5, 0),
265  bneg(2, 2),
266  brt(4, 0),
267  LAST,
268 
269 /* table for - */
270  drk(1, 5),
271  brt(7, 5),
272  LAST,
273 
274 /* table for . */
275  drk(5, 0),
276  brt(3, 2),
277  brt(3, 0),
278  brt(5, 2),
279  brt(5, 0),
280  LAST,
281 
282 /* table for / */
283  brt(8, 10),
284  LAST,
285 
286 /* table for 0 */
287  drk(8, 10),
288  brt(0, 0),
289  brt(0, 10),
290  brt(8, 10),
291  brt(8, 0),
292  brt(0, 0),
293  LAST,
294 
295 /* table for 1 */
296  drk(4, 0),
297  brt(4, 10),
298  brt(2, 8),
299  LAST,
300 
301 /* table for 2 */
302  drk(0, 6),
303  brt(0, 8),
304  brt(3, 10),
305  brt(5, 10),
306  brt(8, 8),
307  brt(8, 7),
308  brt(0, 2),
309  brt(0, 0),
310  brt(8, 0),
311  LAST,
312 
313 /* table for 3 */
314  drk(0, 10),
315  brt(8, 10),
316  brt(8, 5),
317  brt(0, 5),
318  brt(8, 5),
319  brt(8, 0),
320  brt(0, 0),
321  LAST,
322 
323 /* table for 4 */
324  drk(0, 10),
325  brt(0, 5),
326  brt(8, 5),
327  drk(8, 10),
328  brt(8, 0),
329  LAST,
330 
331 /* table for 5 */
332  drk(8, 10),
333  brt(0, 10),
334  brt(0, 5),
335  brt(8, 5),
336  brt(8, 0),
337  brt(0, 0),
338  LAST,
339 
340 /* table for 6 */
341  drk(0, 10),
342  brt(0, 0),
343  brt(8, 0),
344  brt(8, 5),
345  brt(0, 5),
346  LAST,
347 
348 /* table for 7 */
349  drk(0, 10),
350  brt(8, 10),
351  brt(6, 0),
352  LAST,
353 
354 /* table for 8 */
355  drk(0, 5),
356  brt(0, 0),
357  brt(8, 0),
358  brt(8, 5),
359  brt(0, 5),
360  brt(0, 10),
361  brt(8, 10),
362  brt(8, 5),
363  LAST,
364 
365 /* table for 9 */
366  drk(8, 5),
367  brt(0, 5),
368  brt(0, 10),
369  brt(8, 10),
370  brt(8, 0),
371  LAST,
372 
373 /* table for : */
374  drk(5, 6),
375  brt(3, 8),
376  brt(3, 6),
377  brt(5, 8),
378  brt(5, 6),
379  drk(5, 0),
380  brt(3, 2),
381  brt(3, 0),
382  brt(5, 2),
383  brt(5, 0),
384  LAST,
385 
386 /* table for ; */
387  drk(5, 6),
388  brt(3, 8),
389  brt(3, 6),
390  brt(5, 8),
391  brt(5, 6),
392  drk(5, 0),
393  brt(3, 2),
394  brt(3, 0),
395  brt(5, 2),
396  brt(5, 0),
397  bneg(2, 2),
398  brt(4, 0),
399  LAST,
400 
401 /* table for < */
402  drk(8, 8),
403  brt(0, 5),
404  brt(8, 2),
405  LAST,
406 
407 /* table for = */
408  drk(0, 7),
409  brt(8, 7),
410  drk(0, 3),
411  brt(8, 3),
412  LAST,
413 
414 /* table for > */
415  drk(0, 8),
416  brt(8, 5),
417  brt(0, 2),
418  LAST,
419 
420 /* table for ? */
421  drk(3, 0),
422  brt(5, 2),
423  brt(5, 0),
424  brt(3, 2),
425  brt(3, 0),
426  drk(1, 7),
427  brt(1, 9),
428  brt(3, 10),
429  brt(5, 10),
430  brt(7, 9),
431  brt(7, 7),
432  brt(4, 5),
433  brt(4, 3),
434  LAST,
435 
436 /* table for @ */
437  drk(0, 8),
438  brt(2, 10),
439  brt(6, 10),
440  brt(8, 8),
441  brt(8, 2),
442  brt(6, 0),
443  brt(2, 0),
444  brt(1, 1),
445  brt(1, 4),
446  brt(2, 5),
447  brt(4, 5),
448  brt(5, 4),
449  brt(5, 0),
450  LAST,
451 
452 /* table for A */
453  brt(0, 8),
454  brt(2, 10),
455  brt(6, 10),
456  brt(8, 8),
457  brt(8, 0),
458  drk(0, 5),
459  brt(8, 5),
460  LAST,
461 
462 /* table for B */
463  brt(0, 10),
464  brt(5, 10),
465  brt(8, 9),
466  brt(8, 6),
467  brt(5, 5),
468  brt(0, 5),
469  brt(5, 5),
470  brt(8, 4),
471  brt(8, 1),
472  brt(5, 0),
473  brt(0, 0),
474  LAST,
475 
476 /* table for C */
477  drk(8, 2),
478  brt(6, 0),
479  brt(2, 0),
480  brt(0, 2),
481  brt(0, 8),
482  brt(2, 10),
483  brt(6, 10),
484  brt(8, 8),
485  LAST,
486 
487 /* table for D */
488  brt(0, 10),
489  brt(5, 10),
490  brt(8, 8),
491  brt(8, 2),
492  brt(5, 0),
493  brt(0, 0),
494  LAST,
495 
496 /* table for E */
497  drk(8, 0),
498  brt(0, 0),
499  brt(0, 10),
500  brt(8, 10),
501  drk(0, 5),
502  brt(5, 5),
503  LAST,
504 
505 /* table for F */
506  brt(0, 10),
507  brt(8, 10),
508  drk(0, 5),
509  brt(5, 5),
510  LAST,
511 
512 /* table for G */
513  drk(5, 5),
514  brt(8, 5),
515  brt(8, 2),
516  brt(6, 0),
517  brt(2, 0),
518  brt(0, 2),
519  brt(0, 8),
520  brt(2, 10),
521  brt(6, 10),
522  brt(8, 8),
523  LAST,
524 
525 /* table for H */
526  brt(0, 10),
527  drk(8, 10),
528  brt(8, 0),
529  drk(0, 6),
530  brt(8, 6),
531  LAST,
532 
533 /* table for I */
534  drk(4, 0),
535  brt(6, 0),
536  drk(5, 0),
537  brt(5, 10),
538  brt(4, 10),
539  brt(6, 10),
540  LAST,
541 
542 /* table for J */
543  drk(0, 2),
544  brt(2, 0),
545  brt(5, 0),
546  brt(7, 2),
547  brt(7, 10),
548  brt(6, 10),
549  brt(8, 10),
550  LAST,
551 
552 /* table for K */
553  brt(0, 10),
554  drk(0, 5),
555  brt(8, 10),
556  drk(3, 7),
557  brt(8, 0),
558  LAST,
559 
560 /* table for L */
561  drk(8, 0),
562  brt(0, 0),
563  brt(0, 10),
564  LAST,
565 
566 /* table for M */
567  brt(0, 10),
568  brt(4, 5),
569  brt(8, 10),
570  brt(8, 10),
571  brt(8, 0),
572  LAST,
573 
574 /* table for N */
575  brt(0, 10),
576  brt(8, 0),
577  brt(8, 10),
578  LAST,
579 
580 /* table for O */
581  drk(0, 2),
582  brt(0, 8),
583  brt(2, 10),
584  brt(6, 10),
585  brt(8, 8),
586  brt(8, 2),
587  brt(6, 0),
588  brt(2, 0),
589  brt(0, 2),
590  LAST,
591 
592 /* table for P */
593  brt(0, 10),
594  brt(6, 10),
595  brt(8, 9),
596  brt(8, 6),
597  brt(6, 5),
598  brt(0, 5),
599  LAST,
600 
601 /* table for Q */
602  drk(0, 2),
603  brt(0, 8),
604  brt(2, 10),
605  brt(6, 10),
606  brt(8, 8),
607  brt(8, 2),
608  brt(6, 0),
609  brt(2, 0),
610  brt(0, 2),
611  drk(5, 3),
612  brt(8, 0),
613  LAST,
614 
615 /* table for R */
616  brt(0, 10),
617  brt(6, 10),
618  brt(8, 8),
619  brt(8, 6),
620  brt(6, 5),
621  brt(0, 5),
622  drk(5, 5),
623  brt(8, 0),
624  LAST,
625 
626 /* table for S */
627  drk(0, 1),
628  brt(1, 0),
629  brt(6, 0),
630  brt(8, 2),
631  brt(8, 4),
632  brt(6, 6),
633  brt(2, 6),
634  brt(0, 7),
635  brt(0, 9),
636  brt(1, 10),
637  brt(7, 10),
638  brt(8, 9),
639  LAST,
640 
641 /* table for T */
642  drk(4, 0),
643  brt(4, 10),
644  drk(0, 10),
645  brt(8, 10),
646  LAST,
647 
648 /* table for U */
649  drk(0, 10),
650  brt(0, 2),
651  brt(2, 0),
652  brt(6, 0),
653  brt(8, 2),
654  brt(8, 10),
655  LAST,
656 
657 /* table for V */
658  drk(0, 10),
659  brt(4, 0),
660  brt(8, 10),
661  LAST,
662 
663 /* table for W */
664  drk(0, 10),
665  brt(1, 0),
666  brt(4, 4),
667  brt(7, 0),
668  brt(8, 10),
669  LAST,
670 
671 /* table for X */
672  brt(8, 10),
673  drk(0, 10),
674  brt(8, 0),
675  LAST,
676 
677 /* table for Y */
678  drk(0, 10),
679  brt(4, 4),
680  brt(8, 10),
681  drk(4, 4),
682  brt(4, 0),
683  LAST,
684 
685 /* table for Z */
686  drk(0, 10),
687  brt(8, 10),
688  brt(0, 0),
689  brt(8, 0),
690  LAST,
691 
692 /* table for [ */
693  drk(6, 0),
694  brt(4, 0),
695  brt(4, 10),
696  brt(6, 10),
697  LAST,
698 
699 /* table for \ */
700  drk(0, 10),
701  brt(8, 0),
702  LAST,
703 
704 /* table for ] */
705  drk(2, 0),
706  brt(4, 0),
707  brt(4, 10),
708  brt(2, 10),
709  LAST,
710 
711 /* table for ^ */
712  drk(4, 0),
713  brt(4, 10),
714  drk(2, 8),
715  brt(4, 10),
716  brt(6, 8),
717  LAST,
718 
719 /* table for _ */
720  dneg(0, 1),
721  bneg(11, 1),
722  LAST,
723 
724 /* table for ascii 96: accent */
725  drk(3, 10),
726  brt(5, 6),
727  brt(4, 10),
728  brt(3, 10),
729  LAST,
730 
731 /* table for a */
732  drk(0, 5),
733  brt(1, 6),
734  brt(6, 6),
735  brt(7, 5),
736  brt(7, 1),
737  brt(8, 0),
738  drk(7, 1),
739  brt(6, 0),
740  brt(1, 0),
741  brt(0, 1),
742  brt(0, 2),
743  brt(1, 3),
744  brt(6, 3),
745  brt(7, 2),
746  LAST,
747 
748 /* table for b */
749  brt(0, 10),
750  drk(8, 3),
751  brt(7, 5),
752  brt(4, 6),
753  brt(1, 5),
754  brt(0, 3),
755  brt(1, 1),
756  brt(4, 0),
757  brt(7, 1),
758  brt(8, 3),
759  LAST,
760 
761 /* table for c */
762  drk(8, 5),
763  brt(7, 6),
764  brt(2, 6),
765  brt(0, 4),
766  brt(0, 4),
767  brt(0, 2),
768  brt(2, 0),
769  brt(7, 0),
770  brt(8, 1),
771  LAST,
772 
773 /* table for d */
774  drk(8, 0),
775  brt(8, 10),
776  drk(8, 3),
777  brt(7, 5),
778  brt(4, 6),
779  brt(1, 5),
780  brt(0, 3),
781  brt(1, 1),
782  brt(4, 0),
783  brt(7, 1),
784  brt(8, 3),
785  LAST,
786 
787 /* table for e */
788  drk(0, 4),
789  brt(1, 3),
790  brt(7, 3),
791  brt(8, 4),
792  brt(8, 5),
793  brt(7, 6),
794  brt(1, 6),
795  brt(0, 5),
796  brt(0, 1),
797  brt(1, 0),
798  brt(7, 0),
799  brt(8, 1),
800  LAST,
801 
802 /* table for f */
803  drk(2, 0),
804  brt(2, 9),
805  brt(3, 10),
806  brt(5, 10),
807  brt(6, 9),
808  drk(1, 5),
809  brt(4, 5),
810  LAST,
811 
812 /* table for g */
813  drk(8, 6),
814  drk(8, 3),
815  brt(7, 5),
816  brt(4, 6),
817  brt(1, 5),
818  brt(0, 3),
819  brt(1, 1),
820  brt(4, 0),
821  brt(7, 1),
822  brt(8, 3),
823  bneg(8, 2),
824  bneg(7, 3),
825  bneg(1, 3),
826  bneg(0, 2),
827  LAST,
828 
829 /* table for h */
830  brt(0, 10),
831  drk(0, 4),
832  brt(2, 6),
833  brt(6, 6),
834  brt(8, 4),
835  brt(8, 0),
836  LAST,
837 
838 /* table for i */
839  drk(4, 0),
840  brt(4, 6),
841  brt(3, 6),
842  drk(4, 9),
843  brt(4, 8),
844  drk(3, 0),
845  brt(5, 0),
846  LAST,
847 
848 /* table for j */
849  drk(5, 6),
850  brt(6, 6),
851  bneg(6, 2),
852  bneg(5, 3),
853  bneg(3, 3),
854  bneg(2, 2),
855  LAST,
856 
857 /* table for k */
858  brt(2, 0),
859  brt(2, 10),
860  brt(0, 10),
861  drk(2, 4),
862  brt(4, 4),
863  brt(8, 6),
864  drk(4, 4),
865  brt(8, 0),
866  LAST,
867 
868 /* table for l */
869  drk(3, 10),
870  brt(4, 10),
871  brt(4, 2),
872  brt(5, 0),
873  LAST,
874 
875 /* table for m */
876  brt(0, 6),
877  drk(0, 5),
878  brt(1, 6),
879  brt(3, 6),
880  brt(4, 5),
881  brt(4, 0),
882  drk(4, 5),
883  brt(5, 6),
884  brt(7, 6),
885  brt(8, 5),
886  brt(8, 0),
887  LAST,
888 
889 /* table for n */
890  brt(0, 6),
891  drk(0, 4),
892  brt(2, 6),
893  brt(6, 6),
894  brt(8, 4),
895  brt(8, 0),
896  LAST,
897 
898 /* table for o */
899  drk(8, 3),
900  brt(7, 5),
901  brt(4, 6),
902  brt(1, 5),
903  brt(0, 3),
904  brt(1, 1),
905  brt(4, 0),
906  brt(7, 1),
907  brt(8, 3),
908  LAST,
909 
910 /* table for p */
911  drk(0, 6),
912  bneg(0, 3),
913  drk(8, 3),
914  brt(7, 5),
915  brt(4, 6),
916  brt(1, 5),
917  brt(0, 3),
918  brt(1, 1),
919  brt(4, 0),
920  brt(7, 1),
921  brt(8, 3),
922  LAST,
923 
924 /* table for q */
925  drk(8, 6),
926  drk(8, 3),
927  brt(7, 5),
928  brt(4, 6),
929  brt(1, 5),
930  brt(0, 3),
931  brt(1, 1),
932  brt(4, 0),
933  brt(7, 1),
934  brt(8, 3),
935  bneg(8, 3),
936  bneg(9, 3),
937  LAST,
938 
939 /* table for r */
940  brt(1, 0),
941  brt(1, 6),
942  brt(0, 6),
943  drk(1, 4),
944  brt(3, 6),
945  brt(6, 6),
946  brt(8, 4),
947  LAST,
948 
949 /* table for s */
950  drk(0, 1),
951  brt(1, 0),
952  brt(7, 0),
953  brt(8, 1),
954  brt(7, 2),
955  brt(1, 4),
956  brt(0, 5),
957  brt(1, 6),
958  brt(7, 6),
959  brt(8, 5),
960  LAST,
961 
962 /* table for t */
963  drk(7, 1),
964  brt(6, 0),
965  brt(4, 0),
966  brt(3, 1),
967  brt(3, 10),
968  brt(2, 10),
969  drk(1, 5),
970  brt(5, 5),
971  LAST,
972 
973 /* table for u */
974  drk(0, 6),
975  brt(1, 6),
976  brt(1, 1),
977  brt(2, 0),
978  brt(6, 0),
979  brt(7, 1),
980  brt(7, 6),
981  drk(7, 1),
982  brt(8, 0),
983  LAST,
984 
985 /* table for v */
986  drk(0, 6),
987  brt(4, 0),
988  brt(8, 6),
989  LAST,
990 
991 /* table for w */
992  drk(0, 6),
993  brt(0, 5),
994  brt(2, 0),
995  brt(4, 5),
996  brt(6, 0),
997  brt(8, 5),
998  brt(8, 6),
999  LAST,
1000 
1001 /* table for x */
1002  brt(8, 6),
1003  drk(0, 6),
1004  brt(8, 0),
1005  LAST,
1006 
1007 /* table for y */
1008  drk(0, 6),
1009  brt(0, 1),
1010  brt(1, 0),
1011  brt(7, 0),
1012  brt(8, 1),
1013  drk(8, 6),
1014  bneg(8, 2),
1015  bneg(7, 3),
1016  bneg(1, 3),
1017  bneg(0, 2),
1018  LAST,
1019 
1020 /* table for z */
1021  drk(0, 6),
1022  brt(8, 6),
1023  brt(0, 0),
1024  brt(8, 0),
1025  LAST,
1026 
1027 /* table for ascii 123, left brace */
1028  drk(6, 10),
1029  brt(5, 10),
1030  brt(4, 9),
1031  brt(4, 6),
1032  brt(3, 5),
1033  brt(4, 4),
1034  brt(4, 1),
1035  brt(5, 0),
1036  brt(6, 0),
1037  LAST,
1038 
1039 /* table for ascii 124, vertical bar */
1040  drk(4, 4),
1041  brt(4, 0),
1042  brt(5, 0),
1043  brt(5, 4),
1044  brt(4, 4),
1045  drk(4, 6),
1046  brt(4, 10),
1047  brt(5, 10),
1048  brt(5, 6),
1049  brt(4, 6),
1050  LAST,
1051 
1052 /* table for ascii 125, right brace */
1053  drk(2, 0),
1054  brt(3, 0),
1055  brt(4, 1),
1056  brt(4, 4),
1057  brt(5, 5),
1058  brt(4, 6),
1059  brt(4, 9),
1060  brt(3, 10),
1061  brt(2, 10),
1062  LAST,
1063 
1064 /* table for ascii 126, tilde */
1065  drk(0, 5),
1066  brt(1, 6),
1067  brt(3, 6),
1068  brt(5, 4),
1069  brt(7, 4),
1070  brt(8, 5),
1071  LAST,
1072 
1073 /* table for ascii 127, rubout */
1074  drk(0, 2),
1075  brt(0, 8),
1076  brt(8, 8),
1077  brt(8, 2),
1078  brt(0, 2),
1079  LAST
1080 };
1081 
1082 void
1084 {
1085  register int *p; /* pointer to stroke table */
1086  register int i;
1087 
1088  p = tp_ctable; /* pointer to stroke list */
1089 
1090  /* Store start addrs of each stroke list */
1091  for (i = 040 - NUM_SYMBOLS; i < 128; i++) {
1092  tp_cindex[i+128] = tp_cindex[i] = p;
1093  while ((*p++) != LAST);
1094  }
1095  for (i = 1; i <= NUM_SYMBOLS; i++) {
1096  tp_cindex[i+128] = tp_cindex[i] = tp_cindex[040-NUM_SYMBOLS-1+i];
1097  }
1098  for (i = NUM_SYMBOLS + 1; i < 040; i++) {
1099  tp_cindex[i+128] = tp_cindex[i] = tp_cindex['?'];
1100  }
1101 }
1102 
1103 int *
1104 tp_getchar(const unsigned char *c)
1105 {
1106  if (tp_cindex[040] == 0) { tp_setup(); }
1107  return tp_cindex[*c];
1108 }
1109 
1110 
1111 
1112 /*
1113  * Local Variables:
1114  * mode: C
1115  * tab-width: 8
1116  * indent-tabs-mode: t
1117  * c-file-style: "stroustrup"
1118  * End:
1119  * ex: shiftwidth=4 tabstop=8
1120  */
Header file for the BRL-CAD common definitions.
int * tp_getchar(const unsigned char *c)
Definition: vectfont.c:1104
#define NUM_SYMBOLS
Definition: vectfont.c:57
void tp_setup(void)
Once-only setup routine Used by libplot3/symbol.c, so it can't be static. DEPRECATED: libplot3 has be...
Definition: vectfont.c:1083