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
|
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
Copyright (C) 2007-2008, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
- Neither the name of The Numerical Algorithms Group Ltd. nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************
*
* extent2.h: HyperDoc extent computation routines
*
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
#define _EXTENT2_C
#include "openaxiom-c-macros.h"
#include "debug.h"
#include "sockio.h"
#include "extent.h"
#include "group.h"
#include "titlebar.h"
#include "all_hyper_proto.H1"
#include "pixmap.H1"
static int cur_height = 0;
static int max_x_value = 0;
/*
* start_newline updates the current header node, and also allocates if needed
* memory for the next Line Header. It also assigns the first TextNode on the
* line to the structure, because this is the last time I will be able to do
* this
*/
void
start_newline(int distance, TextNode * node)
{
if (gLineNode != NULL) {
if (gTopOfGroupStack->center)
center_nodes(gLineNode, node);
gLineNode = node;
}
text_y += distance;
past_line_height = distance;
present_line_height = line_height;
gInLine = 0;
}
/*
* center_nodes goes through and centers all the text between the two
* given nodes.
*/
static void
center_nodes(TextNode * begin_node, TextNode * end_node)
{
int begin_x, end_x, wmid_x, offset, mid_x;
TextNode *node;
end_x = text_x;
begin_x = x_value(begin_node);
mid_x = (int) (end_x + begin_x) / 2;
wmid_x = (int) (right_margin + indent) / 2;
if (mid_x > wmid_x)
offset = 0;
else
offset = wmid_x - mid_x;
for (node = begin_node; node != end_node; node = node->next)
if (node->x > 0)
node->x += offset;
}
static int
punctuation_width(TextNode * node)
{
int twidth, width = strlen(node->data.text);
twidth = XTextWidth(gTopOfGroupStack->cur_font, node->data.text, width);
/* check to see if there was some space in front */
if (gInLine && (node->space & FRONTSPACE))
twidth += inter_word_space;
# if 0
if (node->space & BACKSPACE) {
switch (node->data.text[0]) {
case '.':
case '?':
case '!':
twidth += term_punct_space;
break;
}
}
#endif
return twidth;
}
static int
input_string_width(TextNode * node)
{
InputItem *item;
int t_width;
/** search the symbol table for the proper entry **/
item = node->link->reference.string;
/** Once I have gotten this far, I should just be able to calculate
the width using the normal font **/
t_width = (item->size + 1) * gInputFont->max_bounds.width + 10;
return t_width;
}
static int
word_width(TextNode * node)
{
int twidth, len = strlen(node->data.text);
twidth = XTextWidth(gTopOfGroupStack->cur_font, node->data.text, len);
if (node->space & FRONTSPACE)
twidth += inter_word_space;
return twidth;
}
static int
verbatim_width(TextNode * node)
{
int twidth, len = strlen(node->data.text);
twidth = XTextWidth(gTopOfGroupStack->cur_font, node->data.text, len);
if (node->space)
twidth += inter_word_space;
return twidth;
}
static int
width_of_dash(TextNode * node)
{
int num_dashes, twidth;
num_dashes = strlen(node->data.text);
if (num_dashes > 1)
twidth = node->width = num_dashes * dash_width;
else
twidth = node->width = XTextWidth(gTopOfGroupStack->cur_font,
node->data.text, 1);
if (node->space)
twidth += inter_word_space;
return twidth;
}
/*
* return the gWindow->width in pixels of the given text node, when
* displayed
*/
int
text_width(TextNode * node, int Ender)
{
int twidth = 0, num_words;
for (num_words = 0; node != NULL; num_words++, node = node->next) {
if (Ender == Endtokens) {
if (node->type == Endtokens)
return twidth;
}
else if (node->type == Ender)
return twidth;
switch (node->type) {
case Macro:
case Pound:
if (node->space && gInLine)
twidth += inter_word_space;
break;
case Punctuation:
twidth += punctuation_width(node);
break;
case Dash:
if (gInLine && node->space)
twidth += inter_word_space;
twidth += width_of_dash(node);
break;
case Verbatim:
case Spadsrctxt:
twidth += verbatim_width(node);
break;
case Lsquarebrace:
case Rsquarebrace:
case Word:
twidth += word_width(node);
break;
case Box:
twidth += 2 * box_space;
break;
case Link:
case Downlink:
case Memolink:
case Windowlink:
case LispMemoLink:
case Lispwindowlink:
case Lisplink:
case Unixlink:
case Spadcall:
case Spadcallquit:
case Qspadcall:
case Qspadcallquit:
case LispDownLink:
case Lispcommand:
case Lispcommandquit:
case Spadlink:
case Spaddownlink:
case Spadmemolink:
case Unixcommand:
case Upbutton:
case Returnbutton:
case Description:
push_active_group();
break;
case Endbutton:
case Endspadcommand:
case Enddescription:
pop_group_stack();
break;
case Endlink:
pop_group_stack();
break;
case Inputstring:
twidth += input_string_width(node);
break;
case SimpleBox:
case Radiobox:
twidth += node->width + ((node->space) ? inter_word_space : 0);
break;
case Spadcommand:
case Spadgraph:
push_spad_group();
break;
case VSpace:
break;
case HSpace:
twidth +=
(node->data.node != NULL ? atoi(node->data.node->data.text) : 1);
break;
case Space:
twidth += (gTopOfGroupStack->cur_font->max_bounds.width) *
(node->data.node != NULL ? atoi(node->data.node->data.text) : 1);
break;
case Tab:
twidth = (gTopOfGroupStack->cur_font->max_bounds.width) *
(node->data.node != NULL ? atoi(node->data.node->data.text) : 1);
break;
case Table:
twidth = gWindow->width - left_margin - right_margin_space;
break;
case Tableitem:
case Group:
twidth += (node->space) ? inter_word_space : 0;
push_group_stack();
break;
case BoldFace:
if (node->space)
twidth += inter_word_space;
bf_top_group();
break;
case Emphasize:
if (node->space)
twidth += inter_word_space;
if (gTopOfGroupStack->cur_font == gRmFont)
em_top_group();
else
rm_top_group();
break;
case It:
if (node->space)
twidth += inter_word_space;
em_top_group();
break;
case Rm:
case Sl:
case Tt:
if (node->space)
twidth += inter_word_space;
rm_top_group();
break;
case Endgroup:
pop_group_stack();
break;
case Controlbitmap:
case Inputbitmap:
if (node->width == -1)
insert_bitmap_file(node);
twidth += node->width;
break;
case Inputpixmap:
if (node->width == -1)
insert_pixmap_file(node);
twidth += node->width;
break;
case Mbox:
case Indent:
case Endmacro:
case Free:
case Bound:
case Beep:
case Item:
case Titem:
case Beginitems:
case Noop:
case Endinputbox:
case Fi:
case Ifcond:
case Endif:
case Begintitems:
case Enditems:
case Endtitems:
case Endtableitem:
case Endtable:
case Endparameter:
case Endbox:
case Endheader:
case Endfooter:
case Endscrolling:
case Endverbatim:
case Endspadsrc:
break;
case Newline:
/* WOw, I guess I should ertunr a really big number */
twidth += gWindow->width;
break;
default:
/*
* fprintf(stderr, "Unknown nodetype %d in text_width\n",
* node->type);
*/
break;
}
}
return twidth;
}
/*
* total_width traces through the nodes, until it finds a blank space. It is
* used by compute_word_extent, and compute_punctuation extent to determine
* How far we go before we actually see white space.
*/
int
total_width(TextNode * node, int Ender)
{
int twidth = 0;
for (; (node != NULL); node = node->next) {
if (Ender == Endtokens) {
if (node->type >= Endtokens)
return twidth;
}
else if (node->type == Ender)
return twidth;
/*
* The first thing we check for is to see if there was space in front
* of the current node, if so we are done
*/
if (node->space)
return twidth;
/*** Else depending on the node type ***/
switch (node->type) {
case Noop:
case Endinputbox:
case Pound:
case Ifcond:
case Fi:
case Endif:
break;
case Rsquarebrace:
case Punctuation:
case Word:
case Dash:
twidth += XTextWidth(gTopOfGroupStack->cur_font, node->data.text,
strlen(node->data.text));
break;
case Box:
case Link:
case Downlink:
case Memolink:
case Windowlink:
case LispMemoLink:
case Lispwindowlink:
case Lisplink:
case Unixlink:
case Spadcall:
case Spadcallquit:
case Qspadcall:
case Qspadcallquit:
case LispDownLink:
case Lispcommand:
case Lispcommandquit:
case Spadlink:
case Spaddownlink:
case Spadmemolink:
case Unixcommand:
case Inputstring:
case SimpleBox:
case Radiobox:
case Upbutton:
case Returnbutton:
case Spadcommand:
case Spadgraph:
case VSpace:
case HSpace:
case Space:
case Table:
case Group:
case Controlbitmap:
case Inputbitmap:
case Inputpixmap:
case Free:
case Beep:
case Bound:
case Lsquarebrace:
case BoldFace:
case Emphasize:
case It:
case Rm:
case Sl:
case Tt:
case Newline:
case Verbatim:
case Spadsrctxt:
return twidth;
default:
break;
}
}
return twidth;
}
/*
* init_extents initialize some text size variables
*/
void
init_extents(void)
{
present_line_height = line_height;
gInLine = 0;
gInItem = 0;
gInAxiomCommand = 0;
item_indent = 0;
gInDesc = 0;
indent = left_margin;
text_x = indent;
gTopOfGroupStack->cur_font = gRmFont;
gTopOfGroupStack->cur_color = gRmColor;
right_margin = gWindow->width - right_margin_space;
clear_item_stack();
}
/*
* init_title_extents initialize some title text size variables
*/
void
init_title_extents(HyperDocPage * page)
{
present_line_height = line_height;
gInLine = 0;
gInAxiomCommand = 0;
item_indent = 0;
gInDesc = 0;
indent = left_margin + page->title->x;
text_x = indent;
gTopOfGroupStack->cur_font = gRmFont;
gTopOfGroupStack->cur_color = gRmColor;
right_margin = gWindow->width - right_margin_space - gWindow->border_width -
2 * twwidth;
clear_item_stack();
}
/*
* init_text initialize some text size variables
*/
void
init_text(void)
{
normal_text_height = gRmFont->ascent + gRmFont->descent;
line_height = gRmFont->ascent + gRmFont->descent + inter_line_space;
word_off_height = line_height - normal_text_height;
space_width = gRmFont->max_bounds.width;
}
/*
* text_height returns the height of a piece of formatted text in pixels
*/
int
text_height(TextNode * node, int Ender)
{
cur_height = 0;
return text_height1(node, Ender);
}
/*
* text_height1 is the recursive part of text_height
*/
static int
text_height1(TextNode * node, int Ender)
{
for (; node != NULL; node = node->next) {
if (Ender == Endtokens) {
if (node->type > -Endtokens)
return cur_height;
}
else if (node->type == Ender)
return cur_height;
switch (node->type) {
case Center:
case Downlink:
case Link:
case Spadcommand:
case Spadgraph:
case Upbutton:
case Returnbutton:
case Windowlink:
case Memolink:
case Lispwindowlink:
case Lisplink:
case Unixlink:
case Spadcall:
case Spadcallquit:
case Qspadcall:
case Qspadcallquit:
case LispDownLink:
case LispMemoLink:
case Lispcommand:
case Lispcommandquit:
case Spadlink:
case Spaddownlink:
case Spadmemolink:
case Unixcommand:
case SimpleBox:
case Radiobox:
case Group:
case Box:
case Controlbitmap:
case Inputbitmap:
case Inputpixmap:
case Horizontalline:
case Punctuation:
case Lsquarebrace:
case Rsquarebrace:
case Word:
case Verbatim:
case Math:
case Spadsrctxt:
case Dash:
case Inputstring:
cur_height = max(node->y, cur_height);
break;
case Mbox:
case Macro:
case Pound:
case Emphasize:
case BoldFace:
case It:
case Rm:
case Sl:
case Tt:
case Endparameter:
case Description:
case Enddescription:
case Noop:
case Fi:
case Ifcond:
case Endif:
case Endinputbox:
case Tab:
case Newline:
case Space:
case VSpace:
case HSpace:
case Beginitems:
case Begintitems:
case Endtitems:
case Titem:
case Enditems:
case Endtable:
case Endtableitem:
case Item:
case Par:
case Beep:
case Free:
case Bound:
case Endgroup:
case Endcenter:
case Endbutton:
case Endmacro:
case Tableitem:
case Endlink:
case Endspadcommand:
case Indent:
case Indentrel:
case Endbox:
case Endmbox:
case Table:
case Endverbatim:
case Endmath:
case Spadsrc:
case Endspadsrc:
break;
case Beginscroll:
case Endscroll:
break;
case Endscrolling:
return cur_height;
default:
/*
* fprintf(stderr, "Text_height1: Unknown Node Type %d\n",
* node->type);
*/
break;
}
}
return cur_height;
}
/*
* max_x returns the height of a piece of formatted text in pixels
*/
int
max_x(TextNode * node, int Ender)
{
max_x_value = 0;
for (; node != NULL; node = node->next) {
if (Ender == Endtokens) {
if (node->type >= Endtokens)
return max_x_value;
}
else if (node->type == Ender)
return max_x_value;
switch (node->type) {
case Lsquarebrace:
case Rsquarebrace:
case Word:
max_x_value = max(max_x_value, node->x + word_width(node));
break;
case Verbatim:
case Spadsrctxt:
max_x_value = max(max_x_value, node->x + verbatim_width(node));
break;
case Punctuation:
max_x_value = max(max_x_value, node->x + punctuation_width(node));
break;
case Dash:
max_x_value = max(max_x_value, node->x + width_of_dash(node));
break;
case HSpace:
max_x_value = max(max_x_value, node->x +
(node->data.node != NULL ? atoi(node->data.node->data.text) : 1));
break;
case Space:
max_x_value = max(max_x_value, node->x +
(gTopOfGroupStack->cur_font->max_bounds.width) *
(node->data.node != NULL ? atoi(node->data.node->data.text) : 1));
break;
case Group:
push_group_stack();
break;
case BoldFace:
bf_top_group();
break;
case Emphasize:
if (gTopOfGroupStack->cur_font == gRmFont)
em_top_group();
else
rm_top_group();
break;
case It:
em_top_group();
break;
case Rm:
case Sl:
case Tt:
rm_top_group();
break;
case Endgroup:
pop_group_stack();
break;
case Controlbitmap:
case Inputbitmap:
if (node->width == -1)
insert_bitmap_file(node);
max_x_value = max(max_x_value, node->x + node->width);
break;
case Inputpixmap:
if (node->width == -1)
insert_pixmap_file(node);
max_x_value = max(max_x_value, node->y + node->width);
break;
default:
break;
}
}
return cur_height;
}
static int
x_value(TextNode * node)
{
for (; node != NULL; node = node->next) {
switch (node->type) {
case Controlbitmap:
case Inputbitmap:
case Inputpixmap:
case Lsquarebrace:
case Rsquarebrace:
case Word:
case Verbatim:
case Spadsrctxt:
case Dash:
case Punctuation:
case VSpace:
case HSpace:
case Horizontalline:
case Box:
case Downlink:
case Link:
case Lispwindowlink:
case Lisplink:
case Unixlink:
case Spadcall:
case Spadcallquit:
case Qspadcall:
case Qspadcallquit:
case LispDownLink:
case LispMemoLink:
case Lispcommand:
case Lispcommandquit:
case Spadlink:
case Spaddownlink:
case Spadmemolink:
case Spadcommand:
case Spadgraph:
case Unixcommand:
case Space:
case SimpleBox:
case Radiobox:
return node->x;
default:
#ifdef DEBUG
fprintf(stderr, "X_value did not know x value of type %d\n", node->type);
#endif
return x_value(node->next);
}
}
return 0;
}
/*
* trailing_space computes the length of the trailing spaces of a node
*/
int
trailing_space(TextNode * node)
{
int space = 0;
for (; node->type < Endtokens; node = node->next);
if (node->type == Space)
space += inter_word_space *
(node->data.node != NULL ? atoi(node->data.node->data.text) : 1);
return space;
}
/*
* insert_bitmap_file reads a bitmap file into memory
*/
void
insert_bitmap_file(TextNode * node)
{
char *filename = node->data.text;
int bm_width, bm_height;
XImage *im;
ImageStruct *image;
if (*filename == ' ')
filename++;
if (node->image.pm == 0) {
if (
((image = (ImageStruct *) hash_find(&gImageHashTable, filename)) == NULL)
|| (getenv("HTCACHE"))) {
/*
* read the bitmap if not already in memory or if the environment
* variable HTCACHE is set (NAG addition).
*/
im = HTReadBitmapFile(gXDisplay, gXScreenNumber, filename,
&bm_width, &bm_height);
/** now add the image to the gImageHashTable **/
image = (ImageStruct *) halloc(sizeof(ImageStruct), "ImageStruct");
image->image.xi = im;
image->width = image->image.xi->width;
image->height = image->image.xi->height;
image->filename = (char *) halloc(sizeof(char) * strlen(filename) +1,"Image Filename");
/* strcpy(image->filename, filename); */
sprintf(image->filename, "%s", filename);
hash_insert(&gImageHashTable, (char *)image, image->filename);
}
node->width = image->width;
node->height = image->height;
node->image.xi = image->image.xi;
}
}
/*
* insert_pixmap_file reads a pixmap file into memory
*/
void
insert_pixmap_file(TextNode * node)
{
char *filename = node->data.text;
int bm_width, bm_height, ret_val;
XImage *xi;
ImageStruct *image;
if (*filename == ' ')
filename++;
if (node->image.xi == 0) {
if ((image = (ImageStruct *) hash_find(&gImageHashTable, filename)) == NULL) {
ret_val = read_pixmap_file(gXDisplay, gXScreenNumber, filename, &xi,
&bm_width, &bm_height);
switch (ret_val) {
case(-1):
gSwitch_to_mono = 1;
return;
case BitmapFileInvalid:
fprintf(stderr, "File %s contains invalid bitmap data\n", filename);
return;
case BitmapOpenFailed:
fprintf(stderr, "couldn't open bitmap file %s\n", filename);
return;
case BitmapNoMemory:
fprintf(stderr, "not enough memory to store bitmap\n");
return;
}
image = (ImageStruct *) halloc(sizeof(ImageStruct), "ImageStruct");
image->width = bm_width;
image->height = bm_height;
image->filename = (char *) halloc(sizeof(char) * strlen(filename) +1,
"insert_pixmap--filename");
/* strcpy(image->filename, filename); */
sprintf(image->filename, "%s", filename);
image->image.xi = xi;
hash_insert(&gImageHashTable, (char *)image, image->filename);
}
node->width = image->width;
node->height = plh(image->height + inter_line_space);
node->image.xi = image->image.xi;
}
}
/*
* plh calculates the closet value of line_height > height
*/
int
plh(int height)
{
int rheight = height;
if (gExtentRegion == Scrolling) {
for (rheight = line_height; rheight < height; rheight += line_height)
;
}
return rheight;
}
|