about summary refs log tree commit diff
path: root/lib/libpbmfont.c
blob: 54cae47830393a9487469da4874ee029cbc364d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
/* libpbm5.c - pbm utility library part 5
**
** Font routines.
**
** BDF font code Copyright 1993 by George Phillips.
**
** Copyright (C) 1991 by Jef Poskanzer.
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for any purpose and without fee is hereby granted, provided
** that the above copyright notice appear in all copies and that both that
** copyright notice and this permission notice appear in supporting
** documentation.  This software is provided "as is" without express or
** implied warranty.
*/

#include <string.h>

#include "pm_c_util.h"
#include "nstring.h"
#include "pbm.h"
#include "pbmfont.h"
#include "mallocvar.h"

static unsigned int const firstCodePoint = 32;
    /* This is the code point of the first character in a pbmfont font.
       In ASCII, it is a space.
    */

static unsigned int const nCharsInFont = 96;
    /* The number of characters in a pbmfont font.  A pbmfont font defines
       characters at position 32 (ASCII space) through 127, so that's 96.
    */

/* The default font, packed in hex so this source file doesn't get huge.
** You can replace this with your own font using pbm_dumpfont().
*/
#define DEFAULTFONT_ROWS 155
#define DEFAULTFONT_COLS 112
static unsigned long defaultfont_bits[DEFAULTFONT_ROWS][(DEFAULTFONT_COLS+31)/32] = {
    {0x00000000L,0x20000c00L,0x10000000L,0x00000000L},
    {0xc600a000L,0x42000810L,0x00000002L,0x00000063L},
    {0x6c00a000L,0x45000810L,0x00000002L,0x00000036L},
    {0x6c00a000L,0x88800808L,0xf2e1dee2L,0x00000036L},
    {0x54000000L,0x80000800L,0x11122442L,0x0000002aL},
    {0x54000001L,0x00000800L,0x11122442L,0x0000002aL},
    {0x54000001L,0x00000800L,0x11122282L,0x0000002aL},
    {0x44000102L,0x00000800L,0x11122382L,0x00000022L},
    {0xee000102L,0x00000800L,0x11e1e102L,0x00000077L},
    {0x00000204L,0x00000800L,0x11002102L,0x00000000L},
    {0x00000000L,0x00000c00L,0x11002102L,0x00000000L},
    {0x00000000L,0x003f8000L,0xe3807600L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x02000080L,0x00040000L,0x00120000L,0x00000001L},
    {0x04000082L,0x828e1838L,0x20210100L,0x00000002L},
    {0x04000082L,0x82912448L,0x20210100L,0x00000002L},
    {0x08000082L,0x8fd01940L,0x404087c2L,0x00000004L},
    {0x08000080L,0x050c0622L,0x00408102L,0x00000004L},
    {0x10000080L,0x05061874L,0x0040828fL,0x00008008L},
    {0x10000080L,0x1f912688L,0x00408002L,0x00000008L},
    {0x20000000L,0x0a11098cL,0x00408002L,0x00000010L},
    {0x20000080L,0x0a0e0672L,0x00210000L,0x00000010L},
    {0x40000000L,0x00040000L,0x00210000L,0x00000020L},
    {0x00000000L,0x00000000L,0x00120000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x004e0838L,0x7023e1cfL,0x00008000L},
    {0x00000000L,0x00913844L,0x88620208L,0x00008000L},
    {0x08000000L,0x00910844L,0x08a20401L,0x00000004L},
    {0x10000000L,0x01110844L,0x08a20401L,0x00000008L},
    {0x20000000L,0x01110808L,0x3123c781L,0x00000010L},
    {0x400003e0L,0x02110810L,0x0a202441L,0x00000020L},
    {0x20000000L,0x02110820L,0x0bf02442L,0x00000010L},
    {0x10008000L,0x04110844L,0x88242442L,0x00000008L},
    {0x08008002L,0x040e3e7cL,0x7073c382L,0x00000004L},
    {0x00010000L,0x08000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x0000e1c0L,0x00000000L,0x00000000L,0x00000000L},
    {0x00011220L,0x00000000L,0x70e38f87L,0x00000000L},
    {0x20011220L,0x00020020L,0x89108448L,0x00008010L},
    {0x10011220L,0x00040010L,0x09314448L,0x00008008L},
    {0x0800e221L,0x02083e08L,0x11514788L,0x00000004L},
    {0x040111e0L,0x00100004L,0x2153e448L,0x00000002L},
    {0x08011020L,0x00083e08L,0x213a2448L,0x00008004L},
    {0x10011040L,0x02040010L,0x01022448L,0x00008008L},
    {0x2000e381L,0x02020020L,0x20e77f87L,0x00000010L},
    {0x00000000L,0x04000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x3803e7efL,0xc73bbe3dL,0xdb863ce7L,0x0000001cL},
    {0x44011224L,0x48910808L,0x91036648L,0x00008022L},
    {0x4c011285L,0x48910808L,0xa1036648L,0x00008026L},
    {0x54011387L,0x081f0808L,0xc102a548L,0x0000802aL},
    {0x54011285L,0x09910808L,0xe102a548L,0x0000802aL},
    {0x4e011204L,0x08910848L,0x9112a4c8L,0x00008027L},
    {0x40011224L,0x08910848L,0x891224c8L,0x00008020L},
    {0x3803e7efL,0x073bbe31L,0xcff77e47L,0x0000001cL},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000003L,0x00000000L},
    {0x0003e1cfL,0x87bff7efL,0xdfbf77c2L,0x00000000L},
    {0x00013224L,0x48a4a244L,0x89122442L,0x00000000L},
    {0x00011224L,0x4824a244L,0xa8a14482L,0x00000000L},
    {0x00013227L,0x8e04226cL,0xa8414102L,0x00000000L},
    {0x0001e224L,0x83842228L,0xa8a08102L,0x00000000L},
    {0x00010224L,0x40842228L,0xd8a08242L,0x00000000L},
    {0x00010224L,0x48843638L,0x51108442L,0x00000000L},
    {0x0003c1ceL,0x6f1f1c10L,0x53b9c7c2L,0x00000000L},
    {0x00000060L,0x00000000L,0x00000002L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000003L,0x00000000L},
    {0xfe000000L,0x00000000L,0x00000000L,0x0000007fL},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00010180L,0x000000c0L,0x003001c0L,0x00000000L},
    {0x08008081L,0x00040040L,0x00100200L,0x00000004L},
    {0x10008082L,0x80040040L,0x00100200L,0x00000008L},
    {0x10004084L,0x40023c78L,0x70f1c7c7L,0x00004008L},
    {0x10004080L,0x00000244L,0x89122208L,0x00008008L},
    {0x20002080L,0x00001e44L,0x8113e208L,0x00008010L},
    {0x10002080L,0x00002244L,0x81120208L,0x00008008L},
    {0x10001080L,0x00002244L,0x89122208L,0x00008008L},
    {0x10001080L,0x00001db8L,0x70e9c787L,0x00008008L},
    {0x10000880L,0x00000000L,0x00000000L,0x00008008L},
    {0x08000180L,0x00000000L,0x00000000L,0x00008004L},
    {0x00000000L,0x1fc00000L,0x00000007L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00030080L,0x981c0000L,0x00000000L,0x00000000L},
    {0x20010000L,0x08040000L,0x00000000L,0x00000010L},
    {0x10010000L,0x08040000L,0x00000000L,0x00000008L},
    {0x10016387L,0x898474b8L,0x72e1d5c7L,0x00000008L},
    {0x10019080L,0x8a042a64L,0x89122208L,0x00008008L},
    {0x08011080L,0x8c042a44L,0x89122207L,0x00000004L},
    {0x10011080L,0x8a042a44L,0x89122200L,0x00008008L},
    {0x10011080L,0x89042a44L,0x89122208L,0x00008008L},
    {0x1003bbe0L,0x98dfebe6L,0x71e1e787L,0x00000008L},
    {0x10000000L,0x80000000L,0x01002000L,0x00000008L},
    {0x20000000L,0x80000000L,0x01002000L,0x00000010L},
    {0x00000007L,0x00000000L,0x03807000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00008000L,0x00000000L,0x10410000L,0x00000000L},
    {0x00008000L,0x00000000L,0x20408000L,0x00000000L},
    {0x0001f66eL,0xfdfbf77cL,0x20408000L,0x00000000L},
    {0x24008224L,0x488a2248L,0x20408240L,0x00000012L},
    {0x54008224L,0x4a842210L,0x40404540L,0x0000002aL},
    {0x48008222L,0x8a8a1420L,0x20408480L,0x00000024L},
    {0x00008a23L,0x85111c44L,0x20408000L,0x00000000L},
    {0x000071d1L,0x0531887cL,0x20408000L,0x00000000L},
    {0x00000000L,0x00000800L,0x20408000L,0x00000000L},
    {0x00000000L,0x00000800L,0x10410000L,0x00000000L},
    {0x00000000L,0x00003000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x00000000L,0x00000000L,0x00000000L},
    {0x00000000L,0x20000c00L,0x10000000L,0x00000000L},
    {0xc600a000L,0x42000810L,0x00000002L,0x00000063L},
    {0x6c00a000L,0x45000810L,0x00000002L,0x00000036L},
    {0x6c00a000L,0x88800808L,0xf2e1dee2L,0x00000036L},
    {0x54000000L,0x80000800L,0x11122442L,0x0000002aL},
    {0x54000001L,0x00000800L,0x11122442L,0x0000002aL},
    {0x54000001L,0x00000800L,0x11122282L,0x0000002aL},
    {0x44000102L,0x00000800L,0x11122382L,0x00000022L},
    {0xee000102L,0x00000800L,0x11e1e102L,0x00000077L},
    {0x00000204L,0x00000800L,0x11002102L,0x00000000L},
    {0x00000000L,0x00000c00L,0x11002102L,0x00000000L},
    {0x00000000L,0x003f8000L,0xe3807600L,0x00000000L}
    };

/* A default BDF font */
/* Not as nicely compacted as the PBM font, oh well. */

static struct glyph _g[190] = {
 { 1, 1, 0, 0, 3, "\0" },
 { 1, 9, 1, 0, 3, "\1\1\1\1\1\1\1\0\1" },
 { 3, 3, 1, 6, 5, "\1\0\1\1\0\1\1\0\1" },
 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 _g + 14,
 _g + 15,
 _g + 16,
 _g + 17,
 _g + 18,
 _g + 19,
 _g + 20,
 _g + 21,
 _g + 22,
 _g + 23,
 _g + 24,
 _g + 25,
 _g + 26,
 _g + 27,
 _g + 28,
 _g + 29,
 _g + 30,
 _g + 31,
 _g + 32,
 _g + 33,
 _g + 34,
 _g + 35,
 _g + 36,
 _g + 37,
 _g + 38,
 _g + 39,
 _g + 40,
 _g + 41,
 _g + 42,
 _g + 43,
 _g + 44,
 _g + 45,
 _g + 46,
 _g + 47,
 _g + 48,
 _g + 49,
 _g + 50,
 _g + 51,
 _g + 52,
 _g + 53,
 _g + 54,
 _g + 55,
 _g + 56,
 _g + 57,
 _g + 58,
 _g + 59,
 _g + 60,
 _g + 61,
 _g + 62,
 _g + 63,
 _g + 64,
 _g + 65,
 _g + 66,
 _g + 67,
 _g + 68,
 _g + 69,
 _g + 70,
 _g + 71,
 _g + 72,
 _g + 73,
 _g + 74,
 _g + 75,
 _g + 76,
 _g + 77,
 _g + 78,
 _g + 79,
 _g + 80,
 _g + 81,
 _g + 82,
 _g + 83,
 _g + 84,
 _g + 85,
 _g + 86,
 _g + 87,
 _g + 88,
 _g + 89,
 _g + 90,
 _g + 91,
 _g + 92,
 _g + 93,
 _g + 94,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 _g + 95,
 _g + 96,
 _g + 97,
 _g + 98,
 _g + 99,
 _g + 100,
 _g + 101,
 _g + 102,
 _g + 103,
 _g + 104,
 _g + 105,
 _g + 106,
 _g + 107,
 _g + 108,
 _g + 109,
 _g + 110,
 _g + 111,
 _g + 112,
 _g + 113,
 _g + 114,
 _g + 115,
 _g + 116,
 _g + 117,
 _g + 118,
 _g + 119,
 _g + 120,
 _g + 121,
 _g + 122,
 _g + 123,
 _g + 124,
 _g + 125,
 _g + 126,
 _g + 127,
 _g + 128,
 _g + 129,
 _g + 130,
 _g + 131,
 _g + 132,
 _g + 133,
 _g + 134,
 _g + 135,
 _g + 136,
 _g + 137,
 _g + 138,
 _g + 139,
 _g + 140,
 _g + 141,
 _g + 142,
 _g + 143,
 _g + 144,
 _g + 145,
 _g + 146,
 _g + 147,
 _g + 148,
 _g + 149,
 _g + 150,
 _g + 151,
 _g + 152,
 _g + 153,
 _g + 154,
 _g + 155,
 _g + 156,
 _g + 157,
 _g + 158,
 _g + 159,
 _g + 160,
 _g + 161,
 _g + 162,
 _g + 163,
 _g + 164,
 _g + 165,
 _g + 166,
 _g + 167,
 _g + 168,
 _g + 169,
 _g + 170,
 _g + 171,
 _g + 172,
 _g + 173,
 _g + 174,
 _g + 175,
 _g + 176,
 _g + 177,
 _g + 178,
 _g + 179,
 _g + 180,
 _g + 181,
 _g + 182,
 _g + 183,
 _g + 184,
 _g + 185,
 _g + 186,
 _g + 187,
 _g + 188,
 _g + 189
 }
};



struct font *
pbm_defaultfont(const char * const name) {
/*----------------------------------------------------------------------------
   Generate the built-in font with name 'name'.
-----------------------------------------------------------------------------*/
    struct font * retval;

    if (strcmp(name, "bdf") == 0)
        retval = &default_bdffont;
    else {
        bit** defaultfont;
        unsigned int row;

        if (strcmp(name, "fixed") != 0)
            pm_error( "built-in font name unknown, try 'bdf' or 'fixed'" );

        defaultfont = pbm_allocarray( DEFAULTFONT_COLS, DEFAULTFONT_ROWS );
        for (row =  0; row < DEFAULTFONT_ROWS; ++row) {
            unsigned int col;
            for (col = 0; col < DEFAULTFONT_COLS; col += 32) {
                int scol;
                unsigned long l;

                l = defaultfont_bits[row][col / 32]; /* initial value */

                for (scol = MIN( col + 32, DEFAULTFONT_COLS) - 1;
                     scol >= (int)col; 
                     --scol) {
                    if (l & 0x01)
                        defaultfont[row][scol] = 1;
                    else
                        defaultfont[row][scol] = 0;
                    l >>= 1;
                }
            }
        }

        retval = 
            pbm_dissectfont(defaultfont, DEFAULTFONT_ROWS, DEFAULTFONT_COLS);
    }
    return retval;
}


struct font*
pbm_dissectfont(bit ** const font,
                int    const frows,
                int    const fcols) {
    /*
    ** This routine expects a font bitmap representing the following text:
    **
    ** (0,0)
    **    M ",/^_[`jpqy| M
    **
    **    /  !"#$%&'()*+ /
    **    < ,-./01234567 <
    **    > 89:;<=>?@ABC >
    **    @ DEFGHIJKLMNO @
    **    _ PQRSTUVWXYZ[ _
    **    { \]^_`abcdefg {
    **    } hijklmnopqrs }
    **    ~ tuvwxyz{|}~  ~
    **
    **    M ",/^_[`jpqy| M
    **
    ** The bitmap must be cropped exactly to the edges.
    **
    ** The border you see is irrelevant.  The 12 x 8 array in the center is
    ** the font.  The top left character there belongs to code point 0, and
    ** the code points increase in standard reading order, so the bottom
    ** right character is code point 127.  You can't define code points 
    ** < 32 or > 127 with this font format.
    **
    ** The dissection works by finding the first blank row and column; that
    ** gives the height and width of the maximum-sized character, which is
    ** not too useful.  But the distance from there to the opposite side is
    ** an integral multiple of the cell size, and that's what we need.  Then
    ** it's just a matter of filling in all the coordinates.
    **
    ** The difference between cell_height, cell_width and char_height,
    ** char_width is that the first is the size of the cell including
    ** spacing, while the second is just the actual maximum-size character.
    */
    int cell_width, cell_height, char_width, char_height;
    int brow, bcol, row, col, d, ch, r, c, i;
    struct font* fn;
    struct glyph* glyph;
    char* bmap;
    bit b;

    /* Find first blank row. */
    for ( brow = 0; brow < frows / 6; ++brow ) {
        b = font[brow][0];
        for ( col = 1; col < fcols; ++col )
            if ( font[brow][col] != b )
                goto nextrow;
        goto gotblankrow;
    nextrow: ;
    }
    pm_error( "couldn't find blank row in font" );

 gotblankrow:
    /* Find first blank col. */
    for ( bcol = 0; bcol < fcols / 8; ++bcol ) {
        b = font[0][bcol];
        for ( row = 1; row < frows; ++row )
            if ( font[row][bcol] != b )
                goto nextcol;
        goto gotblankcol;
    nextcol: ;
    }
    pm_error( "couldn't find blank col in font" );

 gotblankcol:
    /* Now compute character cell size. */
    d = frows - brow;
    cell_height = d / 11;
    if ( cell_height * 11 != d )
        pm_error( "problem computing character cell height" );
    d = fcols - bcol;
    cell_width = d / 15;
    if ( cell_width * 15 != d )
        pm_error( "problem computing character cell width" );
    char_height = brow;
    char_width = bcol;

    /* Now convert to a general font */

    MALLOCVAR(fn);
    if ( fn == NULL )
        pm_error( "out of memory allocating font structure" );

    fn->maxwidth  = char_width;
    fn->maxheight = char_height;
    fn->x = fn->y = 0;

    fn->oldfont = font;
    fn->frows = frows;
    fn->fcols = fcols;
    
    /* Initialize all character positions to "undefined."  Those that
       are defined in the font will be filled in below.
    */
    for (i = 0; i < 256; i++)
        fn->glyph[i] = NULL;

    MALLOCARRAY(glyph, nCharsInFont);
    if ( glyph == NULL )
        pm_error( "out of memory allocating glyphs" );
    
    bmap = (char*) malloc( fn->maxwidth * fn->maxheight * nCharsInFont );
    if ( bmap == (char*) 0)
        pm_error( "out of memory allocating glyph data" );

    /* Now fill in the 0,0 coords. */
    row = cell_height * 2;
    col = cell_width * 2;
    for (i = 0; i < firstCodePoint; ++i)
        fn->glyph[i] = NULL;

    for ( ch = 0; ch < nCharsInFont; ++ch ) {
        glyph[ch].width = fn->maxwidth;
        glyph[ch].height = fn->maxheight;
        glyph[ch].x = glyph[ch].y = 0;
        glyph[ch].xadd = cell_width;

        for ( r = 0; r < glyph[ch].height; ++r )
            for ( c = 0; c < glyph[ch].width; ++c )
                bmap[r * glyph[ch].width + c] = font[row + r][col + c];
    
        glyph[ch].bmap = bmap;
        bmap += glyph[ch].width * glyph[ch].height;

        fn->glyph[firstCodePoint + ch] = &glyph[ch];

        col += cell_width;
        if ( col >= cell_width * 14 ) {
            col = cell_width * 2;
            row += cell_height;
        }
    }
    for (i = firstCodePoint + nCharsInFont; i < 256; ++i)
        fn->glyph[i] = NULL;
    
    return fn;
}



struct font*
pbm_loadfont(const char * const filename)
{
    FILE* fp;
    struct font* fn;
    char line[256];

    fp = pm_openr( filename );
    fgets(line, 256, fp);
    pm_close( fp );

    if (line[0] == PBM_MAGIC1 && 
        (line[1] == PBM_MAGIC2 || line[1] == RPBM_MAGIC2)) {
        return pbm_loadpbmfont( filename );
    } else if (!strncmp(line, "STARTFONT", 9)) {
        if (!(fn = pbm_loadbdffont( filename )))
          pm_error( "could not load BDF font file" );
        return fn;
    } else {
      pm_error( "font file not in a recognized format ");
      return NULL;  /* should never reach here */
  }
}



struct font* pbm_loadpbmfont(const char * const filename)
{
    FILE* ifp;
    bit** font;
    int fcols, frows;

    ifp = pm_openr( filename );
    font = pbm_readpbm( ifp, &fcols, &frows );
    pm_close( ifp );
    return pbm_dissectfont( font, frows, fcols );
}

void
pbm_dumpfont( fn )
    struct font* fn;
{
    /* Dump out font as C source code. */
    int row, col, scol, lperrow;
    unsigned long l;

    if (fn->oldfont) {
    printf( "#define DEFAULTFONT_ROWS %d\n", fn->frows );
    printf( "#define DEFAULTFONT_COLS %d\n", fn->fcols );
    printf( "static unsigned long defaultfont_bits[DEFAULTFONT_ROWS][(DEFAULTFONT_COLS+31)/32] = {\n" );
    for ( row = 0; row < fn->frows; ++row )
        {
        lperrow = 0;
        for ( col = 0; col < fn->fcols; col += 32 )
        {
        if ( lperrow == 0 )
            printf( "    {" );
        else if ( lperrow % 6 == 0 )
            {
            printf( ",\n     " );
            lperrow = 0;
            }
        else
            printf( "," );
        l = 0;
        for ( scol = col; scol < MIN( col + 32, fn->fcols ); ++scol )
            {
            l <<= 1;
            if ( fn->oldfont[row][scol] )
            l |= 1;
            }
        printf( "0x%08lxL", l );
        ++lperrow;
        }
        printf( "}%s\n", row == fn->frows - 1 ? "" : "," );
        }
    printf( "    };\n" );
    }
    else {
    struct glyph* glyph;
    int i, j, ng;

    ng = 0;
    for (i = 0; i < 256; i++)
        if (fn->glyph[i])
            ng++;

    printf("static struct glyph _g[%d] = {\n", ng);
    for (i = 0; i < 256; i++) {
        if (!(glyph = fn->glyph[i]))
            continue;

        printf(" { %d, %d, %d, %d, %d, \"", glyph->width, glyph->height,
            glyph->x, glyph->y, glyph->xadd);

        for (j = 0; j < glyph->width * glyph->height; j++)
            if (glyph->bmap[j])
                printf("\\1");
            else
                printf("\\0");
        
        ng--;
        printf("\" }%s\n", ng ? "," : "");
    }
    printf("};\n");

    printf("static struct font default_bdffont = { %d, %d, %d, %d, {\n",
        fn->maxwidth, fn->maxheight, fn->x, fn->y);

    for (i = 0; i < 256; i++) {
        if (fn->glyph[i])
            printf(" _g + %d", ng++);
        else
            printf(" 0");
        
        if (i != 255) printf(",");
        printf("\n");
    }

    printf(" }\n};\n");
    exit(0);

    }

}


/* Routines for loading a BDF font file */

static int readline ARGS((FILE* fp, char* buf, char* arg[]));

#define expect(str) if (readline(fp, line, arg) < 0 || strcmp(arg[0], (str))) \
    { fclose(fp); return 0; }

struct font* pbm_loadbdffont(const char * const name)
{
    FILE* fp;
    char line[1024], *arg[32], *hex;
    char *b;
    int n, numchar, hdig, encoding;
    struct font* font;
    struct glyph* glyph;

    if (!(fp = fopen(name, "rb")))
        return 0;

    expect("STARTFONT");

    MALLOCVAR(font);
    if (font == NULL)
        pm_error("no memory for font");
    font->oldfont = 0;
    { 
        /* Initialize all characters to nonexistent; we will fill the ones we
           find in the bdf file later.
        */
        int i;
        for (i = 0; i < 256; i++) 
            font->glyph[i] = NULL;
    }

    while (readline(fp, line, arg) >= 0) {
        if (!strcmp(arg[0], "COMMENT"))
            continue;
        if (!strcmp(arg[0], "SIZE"))
            continue;
        
        if (!strcmp(arg[0], "STARTPROPERTIES")) {
            n = atoi(arg[1]);
            for (; n > 0 && readline(fp, line, arg) >= 0; n--)
                ;
        }
        else if (!strcmp(arg[0], "FONTBOUNDINGBOX")) {
            font->maxwidth = atoi(arg[1]);
            font->maxheight = atoi(arg[2]);
            font->x = atoi(arg[3]);
            font->y = atoi(arg[4]);
        }
        else if (!strcmp(arg[0], "ENDFONT")) {
            fclose(fp);
            return font;
        }
        else if (!strcmp(arg[0], "CHARS")) {
            numchar = atoi(arg[1]);
            while (numchar > 0) {
                if (readline(fp, line, arg) < 0) { fclose(fp); return 0; }
                if (!strcmp(arg[0], "COMMENT"))
                    continue;
                if (strcmp(arg[0], "STARTCHAR")) { fclose(fp); return 0; }
                MALLOCVAR(glyph);
                if (glyph == NULL)
                    pm_error("no memory for font glyph");

                expect("ENCODING");
                if ((encoding = atoi(arg[1])) < 0) {
                    if (arg[2])
                        encoding = atoi(arg[2]);
                    else {
                        while (readline(fp, line, arg) >= 0)
                            if (!strcmp(arg[0], "ENDCHAR"))
                                break;
                        
                        numchar--;
                        continue;
                    }
                }
                expect("SWIDTH");
                expect("DWIDTH");
                glyph->xadd = atoi(arg[1]);
                expect("BBX");
                glyph->width = atoi(arg[1]);
                glyph->height = atoi(arg[2]);
                glyph->x = atoi(arg[3]);
                glyph->y = atoi(arg[4]);

                b = (char*)malloc(glyph->width * glyph->height * sizeof(char));
                glyph->bmap = b;
                if (!glyph->bmap)
                    pm_error("no memory for font glyph byte map");

                if (readline(fp, line, arg) < 0) { fclose(fp); return 0; }
                if (!strcmp(arg[0], "ATTRIBUTES"))
                    if (readline(fp, line, arg) < 0) { fclose(fp); return 0; }
                
                for (n = glyph->height; n > 0; n--) {
                    int i;  /* dot counter */
                    if (readline(fp, line, arg) < 0) { fclose(fp); return 0; }
                    hex = line;
                    for (i = glyph->width; i > 0; i -= 4) {
                        hdig = *hex++;
                        if (hdig >= '0' && hdig <= '9')
                            hdig -= '0';
                        else if (hdig >= 'a' && hdig <= 'f')
                            hdig -= 'a' - 10;
                        else if (hdig >= 'A' && hdig <= 'F')
                            hdig -= 'A' - 10;
                        
                        *b++ = hdig & 8 ? 1 : 0;
                        if (i > 1) *b++ = hdig & 4 ? 1 : 0;
                        if (i > 2) *b++ = hdig & 2 ? 1 : 0;
                        if (i > 3) *b++ = hdig & 1;
                    }
                }

                expect("ENDCHAR");

                if (encoding < 256)
                    /* We ignore any characters with codes that don't fit 
                       in 8 bits.  We may want to change this someday.
                       */
                    font->glyph[encoding] = glyph;

                numchar--;
            }
        }
    }
    return font;
}

static int readline(fp, buf, arg)
FILE* fp;
char* buf;
char* arg[];
{
    if (!fgets(buf, 1024, fp))
        return -1;
    
    return mk_argvn(buf, arg, 32);
}

int mk_argvn(s, vec, mk_max)
char* s;
char* vec[];
int mk_max;
{
    int n;

    n = 0;
    while (*s) {
        if (ISSPACE(*s)) {
            *s++ = '\0';
            continue;
        }
        vec[n++] = s;
        if (n >= mk_max)
            break;
        while (*s && !ISSPACE(*s))
            s++;
    }
    vec[n] = 0;

    /* Caller expects there to be at least one element in vec[], so we
       can't return an empty line.  More advanced releases of Netpbm
       just ignore blank lines.  If important, we can fairly easily port
       the required code back to this release, by replacing readline()
       with a current one, modified somewhat so it compiles here.

       - Bryan 2010.03.23 
    */
    if (n < 1)
        pm_error("Invalid font file -- contains a blank line");

    return n;
}