Commit 76e05c65d5693d53997430edc89e6791a58f2934

Werner Lemberg 2001-09-20T11:58:51

Initial revision

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
diff --git a/builds/amiga/README b/builds/amiga/README
new file mode 100644
index 0000000..8883b0a
--- /dev/null
+++ b/builds/amiga/README
@@ -0,0 +1,85 @@
+The smakefile is a makefile for Amiga SAS/C 6.58 (no longer available,
+latest sold version was 6.50, updates  can be found in Aminet).  It is
+based on the version found  in the sourcecode of ttf.library 0.83b for
+FreeType   1.3.1    from   Richard   Griffith   (ragriffi@sprynet.com,
+http://ragriffi.home.sprynet.com).
+
+You will  also need  the latest include  files and amiga.lib  from the
+Amiga Developer  CD V2.1  (or newer, I  hope...) for AmigaOS  3.5, the
+generated code should work under AmigaOS 2.04 (V37) and up.
+
+To use it, call "smake  assign" and then "smake" from the builds/amiga
+directory.  The results are:
+
+- A link  library "ft2_680x0.lib" (where  x depends on the  setting of
+  the  CPU entry  in  the smakefile)  containing  all FreeType2  parts
+  except of  the init code,  debugging code, and the  system interface
+  code.
+
+- ftsystem.o, an object module  containing the standard version of the
+  system interface  code which  uses fopen() fclose()  fread() fseek()
+  ftell() malloc() realloc() and free() from lib:sc.lib (not pure).
+
+- ftsystempure.o, an object module  containing the pure version of the
+  system  interface  code  which  uses Open()  Close()  Read()  Seek()
+  ExamineFH() AsmAllocPooled() AsmFreePooled()  etc.  This version can
+  be used in both normal  programs and in Amiga run-time shared system
+  librarys (can be  linked with lib:libinit.o, no copying  of DATA and
+  BSS  hunks for  each OpenLibrary()  necessary).  Source  code  is in
+  src/base/ftsystem.c.
+
+- ftdebug.o, an  object module containing the standard  version of the
+  debugging  code   which  uses  vprintf()  and   exit()  (not  pure).
+  Debugging can be  turned on in FT:include/freetype/config/ftoption.h
+  and with FT_SetTraceLevel().
+
+- ftdebugpure.o, an  object module containing the pure  version of the
+  debugging  code  which uses  KVPrintf()  from  lib:debug.lib and  no
+  exit().  For  debugging of  Amiga run-time shared  system libraries.
+  Source code is in src/base/ftdebug.c.
+
+- NO ftinit.o.   Since linking  with a link  library should  result in
+  linking  only  the  needed   object  modules  in  it,  but  standard
+  ftsystem.o would  force ALL FreeType2  modules to be linked  to your
+  program,  I decided  to use  a different  scheme: You  must #include
+  FT:src/base/ftinit.c  in your  sourcecode and  specify  with #define
+  statements       which       modules       you      need.        See
+  include/freetype/config/ftmodule.h.
+
+
+To use in your own programs:
+
+- Insert   the   #define  and   #include   statements   from  top   of
+  include/freetype/config/ftmodule.h in your source code and uncomment
+  the #define statements for the FreeType2 modules you need.
+
+- You  can  use  either  PARAMETERS=REGISTER or  PARAMETERS=STACK  for
+  calling  the FreeType2  functions, since  the link  library  and the
+  object files are compiled with PARAMETERS=BOTH.
+
+- "smake assign" (assign "FT:" to the FreeType2 main directory).
+
+- Compile your program.
+
+- Link with either ftsystem.o  or ftsystempure.o, if debugging enabled
+  with either ftdebug.o or (ftdebugpure.o and lib:debug.lib), and with
+  ft2_680x0.lib as link library.
+
+
+To adopt to other compilers:
+
+- The standard ANSI  C maximum length of 31  significant characters in
+  identifiers is not enough for FreeType2.  Check if your compiler has
+  a minimum length of 40  significant characters or can be switched to
+  it.   "idlen=40"   is  the   option  for  SAS/C.    Setting  #define
+  HAVE_LIMIT_ON_IDENTS in an include file may also work (not tested).
+
+- Make  sure that the  include directory  in builds/amiga  is searched
+  before the  normal FreeType2 include  directory, so you are  able to
+  replace problematic include files with your own version (same may be
+  useful for the src directory).
+
+- An example  of how to replace/workaround a  problematic include file
+  is  include/config/ftconfig.h;  it  changes  a  #define  that  would
+  prevent SAS/C  from generating  XDEF's where it  should do  that and
+  then includes the standard FreeType2 include file.
diff --git a/builds/amiga/include/freetype/config/ftconfig.h b/builds/amiga/include/freetype/config/ftconfig.h
new file mode 100644
index 0000000..ea88718
--- /dev/null
+++ b/builds/amiga/include/freetype/config/ftconfig.h
@@ -0,0 +1,11 @@
+// TetiSoft: We must change FT_BASE_DEF and FT_EXPORT_DEF
+
+//#define FT_BASE_DEF( x )  extern  x	// SAS/C wouldn't generate an XDEF
+//#define FT_EXPORT_DEF( x )  extern  x	// SAS/C wouldn't generate an XDEF
+#undef FT_BASE_DEF
+#define FT_BASE_DEF( x )  x
+#undef FT_EXPORT_DEF
+#define FT_EXPORT_DEF( x )  x
+
+// TetiSoft: now include original file
+#include "FT:include/freetype/config/ftconfig.h"
diff --git a/builds/amiga/include/freetype/config/ftmodule.h b/builds/amiga/include/freetype/config/ftmodule.h
new file mode 100644
index 0000000..602abff
--- /dev/null
+++ b/builds/amiga/include/freetype/config/ftmodule.h
@@ -0,0 +1,91 @@
+// TetiSoft: To specify which modules you need,
+// insert the following in your source file and uncomment as needed:
+
+/*
+//#define FT_USE_AUTOHINT	// autohinter
+//#define FT_USE_RASTER		// monochrome rasterizer
+//#define FT_USE_SMOOTH		// anti-aliasing rasterizer
+//#define FT_USE_TT		// truetype font driver
+//#define FT_USE_T1		// type1 font driver
+//#define FT_USE_T1CID		// cid-keyed type1 font driver	// no cmap support, useless
+//#define FT_USE_CFF		// opentype font driver		// does not work with TektonPro
+//#define FT_USE_PCF		// pcf bitmap font driver	// all tested fonts 12*12 (size unknown)
+//#define FT_USE_WINFNT		// windows .fnt|.fon bitmap font driver
+#include "FT:src/base/ftinit.c"
+*/
+
+// TetiSoft: make sure that needed support modules are built in
+
+#ifdef FT_USE_TT
+#define FT_USE_SFNT
+#endif
+
+#ifdef FT_USE_CFF
+#define FT_USE_SFNT
+#endif
+
+#ifdef FT_USE_T1
+#define FT_USE_PSAUX
+#endif
+
+#ifdef FT_USE_T1CID
+#define FT_USE_PSAUX
+#endif
+
+#ifdef FT_USE_PSAUX
+#define FT_USE_PSNAMES
+#endif
+
+#ifdef FT_USE_SFNT
+#define FT_USE_PSNAMES
+#endif
+
+// TetiSoft: Now include the modules
+
+#ifdef FT_USE_AUTOHINT
+FT_USE_MODULE(autohint_module_class)
+#endif
+
+#ifdef FT_USE_CFF
+FT_USE_MODULE(cff_driver_class)
+#endif
+
+#ifdef FT_USE_T1CID
+FT_USE_MODULE(t1cid_driver_class)
+#endif
+
+#ifdef FT_USE_PCF
+FT_USE_MODULE(pcf_driver_class)
+#endif
+
+#ifdef FT_USE_PSAUX
+FT_USE_MODULE(psaux_module_class)
+#endif
+
+#ifdef FT_USE_PSNAMES
+FT_USE_MODULE(psnames_module_class)
+#endif
+
+#ifdef FT_USE_RASTER
+FT_USE_MODULE(ft_raster1_renderer_class)
+#endif
+
+#ifdef FT_USE_SFNT
+FT_USE_MODULE(sfnt_module_class)
+#endif
+
+#ifdef FT_USE_SMOOTH
+FT_USE_MODULE(ft_smooth_renderer_class)
+#endif
+
+#ifdef FT_USE_TT
+FT_USE_MODULE(tt_driver_class)
+#endif
+
+#ifdef FT_USE_T1
+FT_USE_MODULE(t1_driver_class)
+#endif
+
+#ifdef FT_USE_WINFNT
+FT_USE_MODULE(winfnt_driver_class)
+#endif
diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile
new file mode 100644
index 0000000..d3274ff
--- /dev/null
+++ b/builds/amiga/smakefile
@@ -0,0 +1,219 @@
+#
+# Makefile for FreeType2 link library using Amiga SAS/C 6.58
+#
+# to build from the builds/amiga directory call
+#
+#  smake assign
+#  smake
+#
+# Your programs source code should start with this
+# (uncomment the parts you do not need to keep the program small):
+# ---8<---
+#define FT_USE_AUTOHINT	// autohinter
+#define FT_USE_RASTER	// monochrome rasterizer
+#define FT_USE_SMOOTH	// anti-aliasing rasterizer
+#define FT_USE_TT	// truetype font driver
+#define FT_USE_T1	// type1 font driver
+#define FT_USE_T1CID	// cid-keyed type1 font driver
+#define FT_USE_CFF	// opentype font driver
+#define FT_USE_PCF	// pcf bitmap font driver
+#define FT_USE_WINFNT	// windows .fnt|.fon bitmap font driver
+#include "FT:src/base/ftinit.c"
+# ---8<---
+#
+# link your programs with ft2_680x0.lib and either ftsystem.o or ftsystempure.o
+# (and either ftdebug.o or ftdebugpure.o if you enabled FT_DEBUG_LEVEL_ERROR or
+# FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h).
+
+OBJBASE = ftbase.o ftglyph.o ftbbox.o ftmm.o ftsynth.o
+
+OBJSYSTEM = ftsystem.o ftsystempure.o
+
+OBJDEBUG = ftdebug.o ftdebugpure.o
+
+OBJAHINT = autohint.o ahoptim.o
+
+OBJPSAUX = psaux.o
+
+OBJPSNAM = psnames.o
+
+OBJRAST = raster.o
+
+OBJSMOOTH = smooth.o
+
+OBJSFNT = sfnt.o
+
+OBJCACHE = ftcache.o
+
+OBJOT = cff.o
+
+OBJT1 = type1.o
+
+OBJT1C = type1cid.o
+
+OBJTT = truetype.o
+
+OBJWINFNT = winfnt.o
+
+OBJPCF = pcf.o
+
+OBJPS = $(OBJPSAUX) $(OBJPSNAM)
+
+OBJRASTER = $(OBJRAST) $(OBJSMOOTH)
+
+OBJFONTD = $(OBJOT) $(OBJT1) $(OBJT1C) $(OBJTT) $(OBJWINFNT) $(OBJPCF)
+
+CORE = FT:src/
+
+CPU       = 68000
+#CPU      = 68020
+#CPU      = 68030
+#CPU      = 68040
+#CPU      = 68060
+
+OPTIMIZER = optinlocal
+
+SCFLAGS = optimize opttime optsched strmerge strsect=near idlen=40 cpu=$(CPU)\
+	  idir=include/ idir=$(CORE) idir=FT:include/ nostackcheck nochkabort\
+	  noicons ignore=79,85,110,306 parameters=both
+
+LIB  = ft2_$(CPU).lib
+
+# sample linker options
+OPTS = link lib=$(LIB),lib:sc.lib,lib:amiga.lib,lib:debug.lib\
+       smallcode smalldata noicons utillib
+
+# sample program entry
+#myprog: myprog.c ftsystem.o $(LIB)
+#	sc $< programname=$@ ftsystem.o $(SCFLAGS) $(OPTS)
+
+all:	$(LIB) $(OBJSYSTEM) $(OBJDEBUG)
+
+assign:
+	assign FT: //
+
+# uses separate object modules in lib to make for easier debugging
+# also, can make smaller programs if entire engine is not used
+ft2_$(CPU).lib:  $(OBJBASE) $(OBJAHINT) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD)
+	oml $@ r $(OBJBASE) $(OBJAHINT) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD)
+
+clean:
+	-delete \#?.o
+
+realclean: clean
+	-delete ft2$(CPU).lib
+
+#
+# freetype library base
+#
+ftbase.o: $(CORE)base/ftbase.c
+	sc $(SCFLAGS) objname=$@ $<
+ftinit.o: $(CORE)base/ftinit.c
+	sc $(SCFLAGS) objname=$@ $<
+ftsystem.o: $(CORE)base/ftsystem.c
+	sc $(SCFLAGS) objname=$@ $<
+ftsystempure.o: src/base/ftsystem.c	## pure version for use in run-time library etc
+	sc $(SCFLAGS) objname=$@ $<
+ftdebug.o: $(CORE)base/ftdebug.c
+	sc $(SCFLAGS) objname=$@ $<
+ftdebugpure.o: src/base/ftdebug.c	## pure version for use in run-time library etc
+	sc $(SCFLAGS) objname=$@ $<
+#
+# freetype library base extensions
+#
+ftglyph.o: $(CORE)base/ftglyph.c
+	sc $(SCFLAGS) objname=$@ $<
+ftbbox.o: $(CORE)base/ftbbox.c
+	sc $(SCFLAGS) objname=$@ $<
+ftmm.o: $(CORE)base/ftmm.c
+	sc $(SCFLAGS) objname=$@ $<
+ftsynth.o: $(CORE)base/ftsynth.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library autohinting module
+#
+autohint.o: $(CORE)autohint/autohint.c
+	sc $(SCFLAGS) objname=$@ $<
+#
+# freetype library autohinting module extensions
+#
+ahoptim.o: $(CORE)autohint/ahoptim.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library PS support module
+#
+psaux.o: $(CORE)psaux/psaux.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library PS glyph names module
+#
+psnames.o: $(CORE)psnames/psnames.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library monochrome raster module
+#
+raster.o: $(CORE)raster/raster.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library anti-aliasing raster module
+#
+smooth.o: $(CORE)smooth/smooth.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library 'sfnt' module
+#
+sfnt.o: $(CORE)sfnt/sfnt.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library glyph and image caching system (still experimental)
+#
+ftcache.o: $(CORE)cache/ftcache.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library OpenType font driver
+#
+cff.o: $(CORE)cff/cff.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library TrueType font driver
+#
+truetype.o: $(CORE)truetype/truetype.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library Type1 font driver
+#
+type1.o: $(CORE)type1/type1.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library CID-keyed Type1 font driver
+#
+type1cid.o: $(CORE)cid/type1cid.c
+	sc $(SCFLAGS) objname=$@ $<
+#
+# freetype library CID-keyed Type1 font driver extensions
+#
+#cidafm.o: $(CORE)cid/cidafm.c
+#	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library Windows FNT/FON bitmap font driver
+#
+winfnt.o: $(CORE)winfonts/winfnt.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library PCF bitmap font driver
+#
+pcf.o: $(CORE)pcf/pcf.c
+	sc $(SCFLAGS) objname=$@ $<
diff --git a/builds/amiga/src/base/ftdebug.c b/builds/amiga/src/base/ftdebug.c
new file mode 100644
index 0000000..3e16337
--- /dev/null
+++ b/builds/amiga/src/base/ftdebug.c
@@ -0,0 +1,123 @@
+// TetiSoft: replaced vprintf() with KVPrintF() and commented out exit()
+extern void __stdargs KVPrintF( const char *formatString, const void *values );
+
+/***************************************************************************/
+/*                                                                         */
+/*  ftdebug.c                                                              */
+/*                                                                         */
+/*    Debugging and logging component (body).                              */
+/*                                                                         */
+/*  Copyright 1996-2001 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* This component contains various macros and functions used to ease the */
+  /* debugging of the FreeType engine.  Its main purpose is in assertion   */
+  /* checking, tracing, and error detection.                               */
+  /*                                                                       */
+  /* There are now three debugging modes:                                  */
+  /*                                                                       */
+  /* - trace mode                                                          */
+  /*                                                                       */
+  /*   Error and trace messages are sent to the log file (which can be the */
+  /*   standard error output).                                             */
+  /*                                                                       */
+  /* - error mode                                                          */
+  /*                                                                       */
+  /*   Only error messages are generated.                                  */
+  /*                                                                       */
+  /* - release mode:                                                       */
+  /*                                                                       */
+  /*   No error message is sent or generated.  The code is free from any   */
+  /*   debugging parts.                                                    */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+  char  ft_trace_levels[trace_max];
+#endif
+
+
+#if defined( FT_DEBUG_LEVEL_ERROR ) || defined( FT_DEBUG_LEVEL_TRACE )
+
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+  FT_EXPORT_DEF( void )
+  FT_Message( const char*  fmt, ... )
+  {
+    va_list  ap;
+
+
+    va_start( ap, fmt );
+//  vprintf( fmt, ap );
+    KVPrintF( fmt, ap );
+    va_end( ap );
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FT_Panic( const char*  fmt, ... )
+  {
+    va_list  ap;
+
+
+    va_start( ap, fmt );
+//  vprintf( fmt, ap );
+    KVPrintF( fmt, ap );
+    va_end( ap );
+
+//  exit( EXIT_FAILURE );
+  }
+
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+  FT_EXPORT_DEF( void )
+  FT_SetTraceLevel( FT_Trace  component,
+                    char      level )
+  {
+    if ( component >= trace_max )
+      return;
+
+    /* if component is `trace_any', change _all_ levels at once */
+    if ( component == trace_any )
+    {
+      int  n;
+
+
+      for ( n = trace_any; n < trace_max; n++ )
+        ft_trace_levels[n] = level;
+    }
+    else        /* otherwise, only change individual component */
+      ft_trace_levels[component] = level;
+  }
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
+
+
+  /* ANSI C doesn't allow empty files, so we insert a dummy symbol */
+  extern const int  ft_debug_dummy;
+
+
+/* END */
diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c
new file mode 100644
index 0000000..702b253
--- /dev/null
+++ b/builds/amiga/src/base/ftsystem.c
@@ -0,0 +1,389 @@
+// TetiSoft: Modified to avoid fopen() fclose() fread() fseek() ftell()
+// malloc() realloc() and free() which can't be used in an amiga
+// shared run-time library linked with libinit.o
+
+#include <proto/exec.h>
+#include <proto/dos.h>
+
+/* TetiSoft: Missing in alib_protos.h, see amiga.lib autodoc
+ * (These amiga.lib functions work under AmigaOS V33 and up)
+ */
+extern APTR __asm AsmCreatePool(register __d0 ULONG memFlags,
+				register __d1 ULONG puddleSize,
+				register __d2 ULONG threshSize,
+				register __a6 struct ExecBase *SysBase);
+
+extern VOID __asm AsmDeletePool(register __a0 APTR poolHeader,
+				register __a6 struct ExecBase *SysBase);
+
+extern APTR __asm AsmAllocPooled(register __a0 APTR poolHeader,
+				 register __d0 ULONG memSize,
+				 register __a6 struct ExecBase *SysBase);
+
+extern VOID __asm AsmFreePooled(register __a0 APTR poolHeader,
+				register __a1 APTR memory,
+				register __d0 ULONG memSize,
+				register __a6 struct ExecBase *SysBase);
+
+
+// TetiSoft: C implementation of AllocVecPooled (see autodoc exec/AllocPooled)
+APTR AllocVecPooled(APTR poolHeader, ULONG memSize)
+{
+	ULONG newSize = memSize + 4;
+	ULONG *mem = AsmAllocPooled(poolHeader, newSize, SysBase);
+
+	if (!mem)
+		return NULL;
+	*mem = newSize;
+	return mem + 1;
+}
+
+// TetiSoft: C implementation of FreeVecPooled (see autodoc exec/AllocPooled)
+void FreeVecPooled(APTR poolHeader, APTR memory)
+{
+	ULONG *realmem = (ULONG *)memory - 1;
+
+	AsmFreePooled(poolHeader, realmem, *realmem, SysBase);
+}
+
+/***************************************************************************/
+/*                                                                         */
+/*  ftsystem.c                                                             */
+/*                                                                         */
+/*    ANSI-specific FreeType low-level system interface (body).            */
+/*                                                                         */
+/*  Copyright 1996-2001 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* This file contains the default interface used by FreeType to access   */
+  /* low-level, i.e. memory management, i/o access as well as thread       */
+  /* synchronisation.  It can be replaced by user-specific routines if     */
+  /* necessary.                                                            */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_SYSTEM_H
+#include FT_ERRORS_H
+#include FT_TYPES_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /*                       MEMORY MANAGEMENT INTERFACE                     */
+  /*                                                                       */
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* It is not necessary to do any error checking for the                  */
+  /* allocation-related functions.  This will be done by the higher level  */
+  /* routines like FT_Alloc() or FT_Realloc().                             */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    ft_alloc                                                           */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The memory allocation function.                                    */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    memory :: A pointer to the memory object.                          */
+  /*                                                                       */
+  /*    size   :: The requested size in bytes.                             */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The address of newly allocated block.                              */
+  /*                                                                       */
+  FT_CALLBACK_DEF( void* )
+  ft_alloc( FT_Memory  memory,
+            long       size )
+  {
+//  FT_UNUSED( memory );
+
+//  return malloc( size );
+    return AllocVecPooled( memory->user, size );
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    ft_realloc                                                         */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The memory reallocation function.                                  */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    memory   :: A pointer to the memory object.                        */
+  /*                                                                       */
+  /*    cur_size :: The current size of the allocated memory block.        */
+  /*                                                                       */
+  /*    new_size :: The newly requested size in bytes.                     */
+  /*                                                                       */
+  /*    block    :: The current address of the block in memory.            */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The address of the reallocated memory block.                       */
+  /*                                                                       */
+  FT_CALLBACK_DEF( void* )
+  ft_realloc( FT_Memory  memory,
+              long       cur_size,
+              long       new_size,
+              void*      block )
+  {
+//  FT_UNUSED( memory );
+//  FT_UNUSED( cur_size );
+
+//  return realloc( block, new_size );
+
+    void* new_block;
+
+    new_block = AllocVecPooled ( memory->user, new_size );
+    if ( new_block != NULL )
+    {
+      CopyMem ( block, new_block,
+                ( new_size > cur_size ) ? cur_size : new_size );
+      FreeVecPooled ( memory->user, block );
+    }
+    return new_block;
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    ft_free                                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The memory release function.                                       */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    memory  :: A pointer to the memory object.                         */
+  /*                                                                       */
+  /*    block   :: The address of block in memory to be freed.             */
+  /*                                                                       */
+  FT_CALLBACK_DEF( void )
+  ft_free( FT_Memory  memory,
+           void*      block )
+  {
+//  FT_UNUSED( memory );
+
+//  free( block );
+
+    FreeVecPooled( memory->user, block );
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /*                     RESOURCE MANAGEMENT INTERFACE                     */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
+  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
+  /* messages during execution.                                            */
+  /*                                                                       */
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_io
+
+  /* We use the macro STREAM_FILE for convenience to extract the       */
+  /* system-specific stream handle from a given FreeType stream object */
+//#define STREAM_FILE( stream )  ( (FILE*)stream->descriptor.pointer )
+#define STREAM_FILE( stream )  ( (BPTR)stream->descriptor.pointer )	// TetiSoft
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    ft_close_stream                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The function to close a stream.                                    */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    stream :: A pointer to the stream object.                          */
+  /*                                                                       */
+  FT_CALLBACK_DEF( void )
+  ft_close_stream( FT_Stream  stream )
+  {
+//  fclose( STREAM_FILE( stream ) );
+    Close( STREAM_FILE( stream ) );	// TetiSoft
+
+    stream->descriptor.pointer = NULL;
+    stream->size               = 0;
+    stream->base               = 0;
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    ft_io_stream                                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The function to open a stream.                                     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    stream :: A pointer to the stream object.                          */
+  /*                                                                       */
+  /*    offset :: The position in the data stream to start reading.        */
+  /*                                                                       */
+  /*    buffer :: The address of buffer to store the read data.            */
+  /*                                                                       */
+  /*    count  :: The number of bytes to read from the stream.             */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The number of bytes actually read.                                 */
+  /*                                                                       */
+  FT_CALLBACK_DEF( unsigned long )
+  ft_io_stream( FT_Stream       stream,
+                unsigned long   offset,
+                unsigned char*  buffer,
+                unsigned long   count )
+  {
+//  FILE*  file;
+    BPTR   file;	// TetiSoft
+
+
+    file = STREAM_FILE( stream );
+
+//  fseek( file, offset, SEEK_SET );
+    Seek( file, offset, OFFSET_BEGINNING );	// TetiSoft
+
+//  return (unsigned long)fread( buffer, 1, count, file );
+    return (unsigned long)FRead( file, buffer, 1, count);
+  }
+
+
+  /* documentation is in ftobjs.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_New_Stream( const char*  filepathname,
+                 FT_Stream    astream )
+  {
+//  FILE*  file;
+    BPTR   file;		// TetiSoft
+    struct FileInfoBlock *fib;	// TetiSoft
+
+
+    if ( !astream )
+      return FT_Err_Invalid_Stream_Handle;
+
+//  file = fopen( filepathname, "rb" );
+    file = Open( filepathname, MODE_OLDFILE );	// TetiSoft
+    if ( !file )
+    {
+      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( " could not open `%s'\n", filepathname ));
+
+      return FT_Err_Cannot_Open_Resource;
+    }
+
+//  fseek( file, 0, SEEK_END );
+//  astream->size = ftell( file );
+//  fseek( file, 0, SEEK_SET );
+    fib = AllocDosObject( DOS_FIB, NULL );
+    if ( !fib )
+    {
+      Close ( file );
+      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( " could not open `%s'\n", filepathname ));
+
+      return FT_Err_Cannot_Open_Resource;
+    }
+    if (!( ExamineFH ( file, fib )))
+    {
+      FreeDosObject(DOS_FIB, fib);
+      Close ( file );
+      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( " could not open `%s'\n", filepathname ));
+
+      return FT_Err_Cannot_Open_Resource;
+    }
+    astream->size = fib->fib_Size;
+    FreeDosObject(DOS_FIB, fib);
+
+//  astream->descriptor.pointer = file;
+    astream->descriptor.pointer = (void *)file;
+
+    astream->pathname.pointer   = (char*)filepathname;
+    astream->pos                = 0;
+
+    astream->read  = ft_io_stream;
+    astream->close = ft_close_stream;
+
+    FT_TRACE1(( "FT_New_Stream:" ));
+    FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
+                filepathname, astream->size ));
+
+    return FT_Err_Ok;
+  }
+
+
+  /* documentation is in ftobjs.h */
+
+  FT_EXPORT_DEF( FT_Memory )
+  FT_New_Memory( void )
+  {
+    FT_Memory  memory;
+
+
+//  memory = (FT_Memory)malloc( sizeof ( *memory ) );
+    memory = (FT_Memory)AllocVec( sizeof ( *memory ), MEMF_PUBLIC );
+    if ( memory )
+    {
+//    memory->user    = 0;
+      memory->user    = AsmCreatePool ( MEMF_PUBLIC, 2048, 2048, SysBase );
+      memory->alloc   = ft_alloc;
+      memory->realloc = ft_realloc;
+      memory->free    = ft_free;
+      if ( memory->user == NULL )
+      {
+        FreeVec ( memory );
+        memory = NULL;
+      }
+    }
+
+    return memory;
+  }
+
+
+  /* documentation is in ftobjs.h */
+
+  FT_EXPORT_DEF( void )
+  FT_Done_Memory( FT_Memory  memory )
+  {
+//  memory->free( memory, memory );
+
+    AsmDeletePool( memory->user, SysBase );
+    FreeVec( memory );
+  }
+
+
+/* END */