summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-16 00:09:26 +0000
committerKarl Berry <karl@freefriends.org>2006-01-16 00:09:26 +0000
commit6c0eafbb1395d426a72a74538e0b2a95e8344ca6 (patch)
tree2a5f80b80fc76086a2602b812c2a182d00f961b7 /Build/source/libs/freetype
parent70f7efeb5c9965a63a4143ad1c1f473585dc364c (diff)
libs 1
git-svn-id: svn://tug.org/texlive/trunk@1483 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype')
-rw-r--r--Build/source/libs/freetype/.cvsignore7
-rw-r--r--Build/source/libs/freetype/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/FILES80
-rw-r--r--Build/source/libs/freetype/INSTALL733
-rw-r--r--Build/source/libs/freetype/MakeSub.in7
-rw-r--r--Build/source/libs/freetype/Makefile.in70
-rw-r--r--Build/source/libs/freetype/PATENTS28
-rw-r--r--Build/source/libs/freetype/README708
-rw-r--r--Build/source/libs/freetype/aclocal.m4430
-rw-r--r--Build/source/libs/freetype/announce68
-rwxr-xr-xBuild/source/libs/freetype/config.guess1465
-rwxr-xr-xBuild/source/libs/freetype/config.sub1579
-rwxr-xr-xBuild/source/libs/freetype/configure5027
-rw-r--r--Build/source/libs/freetype/configure.in262
-rw-r--r--Build/source/libs/freetype/docs/FAQ843
-rw-r--r--Build/source/libs/freetype/docs/FTL.txt165
-rw-r--r--Build/source/libs/freetype/docs/GPL.txt339
-rw-r--r--Build/source/libs/freetype/docs/apiref.txt1918
-rw-r--r--Build/source/libs/freetype/docs/apirefx.txt1223
-rw-r--r--Build/source/libs/freetype/docs/bitmaps.txt770
-rw-r--r--Build/source/libs/freetype/docs/changes.txt1031
-rw-r--r--Build/source/libs/freetype/docs/convntns.txt970
-rw-r--r--Build/source/libs/freetype/docs/credits97
-rw-r--r--Build/source/libs/freetype/docs/freetype.lsm17
-rw-r--r--Build/source/libs/freetype/docs/glyphs.htm1257
-rw-r--r--Build/source/libs/freetype/docs/glyphs.txt999
-rw-r--r--Build/source/libs/freetype/docs/i18n.txt161
-rw-r--r--Build/source/libs/freetype/docs/image/baselin2.gifbin0 -> 1282 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/baseline.gifbin0 -> 2976 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/emsquare.gifbin0 -> 2917 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/freetype.gifbin0 -> 10545 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/freetype.pngbin0 -> 10756 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/grid1.gifbin0 -> 1399 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/grid2.gifbin0 -> 3390 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/grid3.gifbin0 -> 3313 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/metrics.gifbin0 -> 3296 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/metrics2.gifbin0 -> 2934 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/small2.gifbin0 -> 8814 bytes
-rw-r--r--Build/source/libs/freetype/docs/image/tfp-back.pngbin0 -> 53962 bytes
-rw-r--r--Build/source/libs/freetype/docs/optimize.txt181
-rw-r--r--Build/source/libs/freetype/docs/porting.txt1078
-rw-r--r--Build/source/libs/freetype/docs/raster.txt577
-rw-r--r--Build/source/libs/freetype/docs/readme.txt106
-rw-r--r--Build/source/libs/freetype/docs/threads.txt117
-rw-r--r--Build/source/libs/freetype/docs/user.txt916
-rw-r--r--Build/source/libs/freetype/freetype.ac58
-rw-r--r--Build/source/libs/freetype/freetype.spec171
-rw-r--r--Build/source/libs/freetype/ft_conf.h.in220
-rw-r--r--Build/source/libs/freetype/howto/mac.txt19
-rw-r--r--Build/source/libs/freetype/howto/msdos.txt272
-rw-r--r--Build/source/libs/freetype/howto/os2.txt200
-rw-r--r--Build/source/libs/freetype/howto/unix.txt258
-rw-r--r--Build/source/libs/freetype/howto/windows.txt349
-rwxr-xr-xBuild/source/libs/freetype/install-sh250
-rw-r--r--Build/source/libs/freetype/lib/.cvsignore3
-rw-r--r--Build/source/libs/freetype/lib/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/lib/arch/amigaos/Makefile.gcc77
-rw-r--r--Build/source/libs/freetype/lib/arch/amigaos/freetype.c25
-rw-r--r--Build/source/libs/freetype/lib/arch/amigaos/ft_conf.h212
-rw-r--r--Build/source/libs/freetype/lib/arch/amigaos/smakefile126
-rw-r--r--Build/source/libs/freetype/lib/arch/ansi/freetype.c32
-rw-r--r--Build/source/libs/freetype/lib/arch/ansi/ft_conf.h245
-rw-r--r--Build/source/libs/freetype/lib/arch/beos/Makefile102
-rw-r--r--Build/source/libs/freetype/lib/arch/beos/freetype.c32
-rw-r--r--Build/source/libs/freetype/lib/arch/beos/ft_conf.h214
-rw-r--r--Build/source/libs/freetype/lib/arch/beos/ttmutex.c150
-rw-r--r--Build/source/libs/freetype/lib/arch/debugger/Makefile107
-rw-r--r--Build/source/libs/freetype/lib/arch/debugger/freetype.c32
-rw-r--r--Build/source/libs/freetype/lib/arch/debugger/ft_conf.h249
-rw-r--r--Build/source/libs/freetype/lib/arch/mac/README47
-rw-r--r--Build/source/libs/freetype/lib/arch/mac/freetype.c44
-rw-r--r--Build/source/libs/freetype/lib/arch/mac/ft_conf.h198
-rw-r--r--Build/source/libs/freetype/lib/arch/mac/ttmmap.c1072
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.BC171
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.MS127
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.TC127
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.VC129
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.dm94
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.gcc108
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/Makefile.wat105
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/depend.dos111
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/freetype.c39
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/ft_conf.h251
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/hugefile.c87
-rw-r--r--Build/source/libs/freetype/lib/arch/msdos/hugemem.c496
-rwxr-xr-xBuild/source/libs/freetype/lib/arch/msdos/makedep39
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/Makefile.dm94
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/Makefile.emx102
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/Makefile.icc82
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/Makefile.wat98
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/freetype.c32
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/ft_conf.h229
-rw-r--r--Build/source/libs/freetype/lib/arch/os2/os2file.c1236
-rw-r--r--Build/source/libs/freetype/lib/arch/unix/.cvsignore1
-rw-r--r--Build/source/libs/freetype/lib/arch/unix/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/lib/arch/unix/Makefile.in256
-rw-r--r--Build/source/libs/freetype/lib/arch/unix/freetype.c27
-rw-r--r--Build/source/libs/freetype/lib/arch/unix/ttmmap.c1028
-rw-r--r--Build/source/libs/freetype/lib/arch/vms/README20
-rw-r--r--Build/source/libs/freetype/lib/arch/vms/descrip.mms163
-rw-r--r--Build/source/libs/freetype/lib/arch/vms/ft_conf.h212
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/Makefile.BC190
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/Makefile.MS116
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/Makefile.VC185
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/depend.win113
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/freetype.c51
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/ft_conf.h235
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/hugefile.c51
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/hugemem.c539
-rwxr-xr-xBuild/source/libs/freetype/lib/arch/win16/makedef28
-rwxr-xr-xBuild/source/libs/freetype/lib/arch/win16/makedep48
-rw-r--r--Build/source/libs/freetype/lib/arch/win16/ttf.def134
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/Makefile.BC171
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/Makefile.CL175
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/Makefile.Min109
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/Makefile.VC205
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/Makefile.gcc107
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/depend.win107
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/freetype.c44
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/freetype.dsp138
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/freetype.dsw54
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/freetype.idebin0 -> 35542 bytes
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/freetype.mak363
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/freetype.mdpbin0 -> 37376 bytes
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/ft_conf.h243
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/ft_dll.dsp106
-rwxr-xr-xBuild/source/libs/freetype/lib/arch/win32/makedef28
-rwxr-xr-xBuild/source/libs/freetype/lib/arch/win32/makedep45
-rw-r--r--Build/source/libs/freetype/lib/arch/win32/ttf.def134
-rw-r--r--Build/source/libs/freetype/lib/depend.mak222
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxcmap.c404
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxcmap.h60
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxerr18.c281
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxerr18.h38
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgasp.c69
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgasp.h53
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgdef.c1126
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgdef.h218
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgpos.c6224
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgpos.h865
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgsub.c4425
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxgsub.h600
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxkern.c645
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxkern.h181
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxopen.c1458
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxopen.h290
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxopenf.h143
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxpost.c544
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxpost.h109
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxsbit.c1393
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxsbit.h490
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxwidth.c185
-rw-r--r--Build/source/libs/freetype/lib/extend/ftxwidth.h80
-rw-r--r--Build/source/libs/freetype/lib/extend/readme.1st61
-rw-r--r--Build/source/libs/freetype/lib/freetype.h1184
-rw-r--r--Build/source/libs/freetype/lib/freetype.rc36
-rw-r--r--Build/source/libs/freetype/lib/fterrid.h162
-rw-r--r--Build/source/libs/freetype/lib/ftnameid.h877
-rw-r--r--Build/source/libs/freetype/lib/ttapi.c2220
-rw-r--r--Build/source/libs/freetype/lib/ttcache.c464
-rw-r--r--Build/source/libs/freetype/lib/ttcache.h216
-rw-r--r--Build/source/libs/freetype/lib/ttcalc.c426
-rw-r--r--Build/source/libs/freetype/lib/ttcalc.h119
-rw-r--r--Build/source/libs/freetype/lib/ttcmap.c635
-rw-r--r--Build/source/libs/freetype/lib/ttcmap.h202
-rw-r--r--Build/source/libs/freetype/lib/ttconfig.h273
-rw-r--r--Build/source/libs/freetype/lib/ttdebug.c404
-rw-r--r--Build/source/libs/freetype/lib/ttdebug.h170
-rw-r--r--Build/source/libs/freetype/lib/ttengine.h116
-rw-r--r--Build/source/libs/freetype/lib/ttextend.c212
-rw-r--r--Build/source/libs/freetype/lib/ttextend.h167
-rw-r--r--Build/source/libs/freetype/lib/ttfile.c1176
-rw-r--r--Build/source/libs/freetype/lib/ttfile.h430
-rw-r--r--Build/source/libs/freetype/lib/ttgload.c1353
-rw-r--r--Build/source/libs/freetype/lib/ttgload.h51
-rw-r--r--Build/source/libs/freetype/lib/ttinterp.c6681
-rw-r--r--Build/source/libs/freetype/lib/ttinterp.h55
-rw-r--r--Build/source/libs/freetype/lib/ttload.c1598
-rw-r--r--Build/source/libs/freetype/lib/ttload.h238
-rw-r--r--Build/source/libs/freetype/lib/ttmemory.c399
-rw-r--r--Build/source/libs/freetype/lib/ttmemory.h129
-rw-r--r--Build/source/libs/freetype/lib/ttmutex.c85
-rw-r--r--Build/source/libs/freetype/lib/ttmutex.h63
-rw-r--r--Build/source/libs/freetype/lib/ttobjs.c1500
-rw-r--r--Build/source/libs/freetype/lib/ttobjs.h881
-rw-r--r--Build/source/libs/freetype/lib/ttraster.c2725
-rw-r--r--Build/source/libs/freetype/lib/ttraster.h127
-rw-r--r--Build/source/libs/freetype/lib/tttables.h216
-rw-r--r--Build/source/libs/freetype/lib/tttags.h61
-rw-r--r--Build/source/libs/freetype/lib/tttypes.h151
-rw-r--r--Build/source/libs/freetype/lib/win32.mak75
-rw-r--r--Build/source/libs/freetype/license.txt7
-rwxr-xr-xBuild/source/libs/freetype/ltconfig3078
-rwxr-xr-xBuild/source/libs/freetype/ltmain.sh4012
-rwxr-xr-xBuild/source/libs/freetype/mkinstalldirs40
-rw-r--r--Build/source/libs/freetype/net.m455
-rw-r--r--Build/source/libs/freetype/pascal/README10
-rw-r--r--Build/source/libs/freetype/po/.cvsignore8
-rw-r--r--Build/source/libs/freetype/po/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/po/Makefile.in.in220
-rw-r--r--Build/source/libs/freetype/po/POTFILES.in10
-rw-r--r--Build/source/libs/freetype/po/cs.po883
-rw-r--r--Build/source/libs/freetype/po/de.po885
-rw-r--r--Build/source/libs/freetype/po/es.po888
-rw-r--r--Build/source/libs/freetype/po/fr.po883
-rw-r--r--Build/source/libs/freetype/po/freetype.pot842
-rw-r--r--Build/source/libs/freetype/po/nl.po883
-rw-r--r--Build/source/libs/freetype/readme.1st10
-rw-r--r--Build/source/libs/freetype/test/.cvsignore12
-rw-r--r--Build/source/libs/freetype/test/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/test/README6
-rw-r--r--Build/source/libs/freetype/test/arabic.c386
-rw-r--r--Build/source/libs/freetype/test/arabic.h66
-rw-r--r--Build/source/libs/freetype/test/arch/amigaos/Makefile.gcc118
-rw-r--r--Build/source/libs/freetype/test/arch/amigaos/TODO16
-rw-r--r--Build/source/libs/freetype/test/arch/amigaos/gfsamiga.c428
-rw-r--r--Build/source/libs/freetype/test/arch/amigaos/gw_amiga.c519
-rw-r--r--Build/source/libs/freetype/test/arch/amigaos/smakefile195
-rw-r--r--Build/source/libs/freetype/test/arch/debugger/Makefile110
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/Makefile.BC191
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/Makefile.MS152
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/Makefile.TC267
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/Makefile.VC153
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/Makefile.dm156
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/Makefile.gcc151
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/depend.dos76
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/gfs_dos.c374
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/gmain_dj.c470
-rwxr-xr-xBuild/source/libs/freetype/test/arch/msdos/makedep35
-rw-r--r--Build/source/libs/freetype/test/arch/msdos/time_tc.h124
-rw-r--r--Build/source/libs/freetype/test/arch/os2/Makefile.dm153
-rw-r--r--Build/source/libs/freetype/test/arch/os2/Makefile.emx119
-rw-r--r--Build/source/libs/freetype/test/arch/os2/Makefile.icc157
-rw-r--r--Build/source/libs/freetype/test/arch/os2/Makefile.wat172
-rw-r--r--Build/source/libs/freetype/test/arch/os2/gfs_os2.c219
-rw-r--r--Build/source/libs/freetype/test/arch/os2/gpm_os2.c654
-rw-r--r--Build/source/libs/freetype/test/arch/os2/gpm_os2.def5
-rw-r--r--Build/source/libs/freetype/test/arch/unix/.cvsignore1
-rw-r--r--Build/source/libs/freetype/test/arch/unix/.cvsignore.delete0
-rw-r--r--Build/source/libs/freetype/test/arch/unix/Makefile.in184
-rw-r--r--Build/source/libs/freetype/test/arch/unix/gwin_x11.c451
-rw-r--r--Build/source/libs/freetype/test/arch/win16/Makefile.BC222
-rw-r--r--Build/source/libs/freetype/test/arch/win16/Makefile.MS155
-rw-r--r--Build/source/libs/freetype/test/arch/win16/Makefile.VC197
-rw-r--r--Build/source/libs/freetype/test/arch/win16/depend.win78
-rw-r--r--Build/source/libs/freetype/test/arch/win16/gw_win16.c431
-rwxr-xr-xBuild/source/libs/freetype/test/arch/win16/makedep43
-rw-r--r--Build/source/libs/freetype/test/arch/win32/Makefile.BC207
-rw-r--r--Build/source/libs/freetype/test/arch/win32/Makefile.CL185
-rw-r--r--Build/source/libs/freetype/test/arch/win32/Makefile.Min134
-rw-r--r--Build/source/libs/freetype/test/arch/win32/Makefile.gcc143
-rw-r--r--Build/source/libs/freetype/test/arch/win32/depend.win78
-rw-r--r--Build/source/libs/freetype/test/arch/win32/gw_win32.c378
-rwxr-xr-xBuild/source/libs/freetype/test/arch/win32/makedep42
-rw-r--r--Build/source/libs/freetype/test/blitter.c492
-rw-r--r--Build/source/libs/freetype/test/blitter.h52
-rw-r--r--Build/source/libs/freetype/test/common.c276
-rw-r--r--Build/source/libs/freetype/test/common.h81
-rw-r--r--Build/source/libs/freetype/test/display.c299
-rw-r--r--Build/source/libs/freetype/test/display.h73
-rw-r--r--Build/source/libs/freetype/test/fdebug.c286
-rw-r--r--Build/source/libs/freetype/test/ftdump.c1146
-rw-r--r--Build/source/libs/freetype/test/fterror.c107
-rw-r--r--Build/source/libs/freetype/test/ftlint.c296
-rw-r--r--Build/source/libs/freetype/test/ftmetric.c399
-rw-r--r--Build/source/libs/freetype/test/ftsbit.c295
-rw-r--r--Build/source/libs/freetype/test/ftstring.c484
-rw-r--r--Build/source/libs/freetype/test/ftstrpnm.c534
-rw-r--r--Build/source/libs/freetype/test/ftstrtto.c1476
-rw-r--r--Build/source/libs/freetype/test/fttimer.c455
-rw-r--r--Build/source/libs/freetype/test/ftview.c539
-rw-r--r--Build/source/libs/freetype/test/ftzoom.c682
-rw-r--r--Build/source/libs/freetype/test/gdriver.h55
-rw-r--r--Build/source/libs/freetype/test/gevents.h43
-rw-r--r--Build/source/libs/freetype/test/gmain.c475
-rw-r--r--Build/source/libs/freetype/test/gmain.h71
-rw-r--r--Build/source/libs/freetype/test/textdisp.c47
-rw-r--r--Build/source/libs/freetype/test/textdisp.h32
-rw-r--r--Build/source/libs/freetype/win32.mak29
-rw-r--r--Build/source/libs/freetype/withenable.ac10
281 files changed, 113078 insertions, 0 deletions
diff --git a/Build/source/libs/freetype/.cvsignore b/Build/source/libs/freetype/.cvsignore
new file mode 100644
index 00000000000..acd3f61f5f7
--- /dev/null
+++ b/Build/source/libs/freetype/.cvsignore
@@ -0,0 +1,7 @@
+config.cache
+MakeSub
+Makefile
+config.status
+libtool
+ft_conf.h
+config.log
diff --git a/Build/source/libs/freetype/.cvsignore.delete b/Build/source/libs/freetype/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/.cvsignore.delete
diff --git a/Build/source/libs/freetype/FILES b/Build/source/libs/freetype/FILES
new file mode 100644
index 00000000000..f626728c73d
--- /dev/null
+++ b/Build/source/libs/freetype/FILES
@@ -0,0 +1,80 @@
+This text file contains an overview of this package's directory and
+file hierarchy.
+
+ howto/ Various system-specific HOWTOs, explaining how
+ to compile the library on different platforms.
+
+ lib/ The C engine source directory.
+ lib/extend Some standard engine extensions.
+ lib/arch/<system> System-specific configuration header files.
+
+ docs/ Documentation.
+ docs/image GIF images for documentation.
+
+ test/ The C test programs.
+ test/arch/<system> System-specific graphics drivers for test
+ programs.
+
+ contrib/ Contributions directory.
+ contrib/mac An HQX archive containing a port to the Mac.
+ contrib/ttf2pk The ttf2pk TrueType to PK converter source
+ code.
+ contrib/ttf2pfb The ttf2pfb TrueType to PS font converter
+ source code.
+ contrib/ttf2bdf The ttf2bdf TrueType to BDF converter source
+ code.
+ contrib/ftos2 The FreeType/2 font server source code for
+ OS/2.
+ contrib/ttfbanner An ASCII poster program source code.
+
+ po/ Contributions to the internationalized error
+ message strings extension.
+
+ pascal/ Used to hold a Pascal version of the engine,
+ which is now available separately.
+
+
+The following files might be helpful:
+
+FILES This file.
+
+readme.1st A notice about the possible interaction of patents
+PATENTS owned by Apple on TrueType, with respect to FreeType.
+
+README A short and general introduction to FreeType.
+
+INSTALL The FreeType installation How-To. Everything you need
+ to know to build the library and the test programs.
+ This file contains only generic explanations. See the
+ `freetype/howto' directory for system-specific hints.
+
+license.txt The FreeType licensing conditions.
+docs/FTL.txt
+docs/GPL.txt
+
+announce The FreeType UseNet announce post. This file is sent
+ to some newsgroups when a new release is made.
+
+
+The following files are Unix-specific and can be ignored on other
+platforms:
+
+ft_conf.h.in Generic library configuration header file for
+ autoconf.
+configure.in Generic configure script for autoconf.
+configure Configure script generated from `configure.in' by
+ autoconf.
+config.sub Script needed by configure.
+config.guess Script needed by configure.
+Makefile.in Generic makefile for configure.
+MakeSub.in Generic makefile for libtool.
+ltconfig Libtool configuration script.
+ltmain.sh Libtool script.
+mkinstalldirs Tool for generating subdirectories.
+aclocal.m4,
+net.m4 Auxiliary data files for autoconf.
+install-sh Script used to install the library in a portable way
+freetype.spec This file can be used as a specification to build RPMs
+ from the FreeType package.
+
+--- end of FILES ---
diff --git a/Build/source/libs/freetype/INSTALL b/Build/source/libs/freetype/INSTALL
new file mode 100644
index 00000000000..42ce7020a8b
--- /dev/null
+++ b/Build/source/libs/freetype/INSTALL
@@ -0,0 +1,733 @@
+
+ The FreeType compilation guide
+
+
+Table of contents
+-----------------
+
+ I. Introduction
+
+ II. Compiling and installing the C library
+
+ 1. Choosing a configuration file
+ 2. Compiling the library
+ 3. System-specific builds
+ 4. Compiling the extensions
+ 5. Using a Makefile
+ 6. Building a dynamic library (`so' or `DLL')
+ 7. Internationalization and the `ftxerr18' extension
+ 8. TrueType patents
+
+
+III. Compiling the test programs
+
+ 1. Compiling the graphics sub-system
+ 2. Internationalization on Unix
+ 3. Compiling the test programs
+ 4. The `fdebug' program
+
+
+ IV. Compiling the Pascal source
+
+
+--------------------------------------------------------------------
+
+
+
+I. Introduction
+===============
+
+ This file gives detailed information on how to compile and install
+ this release of FreeType on your system.
+
+
+********************************************************************
+* *
+* FOR A QUICK INSTALLATION GUIDE, WE STRONGLY RECOMMEND TO READ *
+* THE SYSTEM-SPECIFIC DOCUMENTS LOCATED IN THE `howto' DIRECTORY *
+* INSTEAD OF THIS GENERIC DOCUMENTATION. *
+* *
+********************************************************************
+
+
+ This package, known as the FreeType 1.5 Public Release, contains
+ several things which are best described by the directories
+ containing them:
+
+ - `lib'
+
+ Contains the 1.5 release of the FreeType library. It is written
+ in portable ANSI C and should compile fine with any type of ANSI
+ C compiler.
+
+ Note however that some system-specific files are provided in the
+ `lib/arch' directory, in order to provide enhanced performance.
+
+ If you need to include FreeType in a graphics library or an
+ embedded system, you will most probably only need to use its
+ contents and discard the rest.
+
+ - `test'
+
+ Contains test and demo programs used during development. Note
+ that some of these programs might not compile on all platforms,
+ as they need to display graphics.
+
+ - `po'
+
+ On Unix, all of FreeType test programs support
+ internationalization through the use of the `gettext' library.
+ This directory contains `po' files, which are used to translate
+ the original English text into language-specific one.
+
+ Note also that this release contains an extension, called
+ `ftxerr18' used to return internationalized strings from the
+ usual FreeType error codes. The `po' files also contain
+ translations for this extension.
+
+ If you don't plan to use `ftxerr18' or internationalization,
+ simply ignore it. Note also that even if `gettext' isn't
+ available on your system, the test programs will be compiled
+ correctly (using the `--disable-nls' configure switch).
+
+ - `contrib'
+
+ Contains a set of contributed tools and utilities related to
+ TrueType or FreeType. Here you can find real situations how to
+ use the library.
+
+
+ This file explains how to compile the library, and the test
+ programs on various platforms.
+
+
+
+II. Compiling the C library
+===========================
+
+
+********************************************************************
+* *
+* NOTE THAT WE STRONGLY RECOMMEND TO READ THE SYSTEM-SPECIFIC *
+* DOCUMENTS LOCATED IN THE `howto' DIRECTORY FOR A *
+* `QUICK'N'EASY' COMPILATION & INSTALLATION GUIDE ON YOUR *
+* PLATFORM. THE FOLLOWING IS A VERY DETAILED EXPLANATION ON HOW *
+* TO COMPILE THE LIBRARY. *
+* *
+********************************************************************
+
+
+ The following concepts are important to build the library.
+
+
+ 1. Choosing a configuration file
+ --------------------------------
+
+ The source code for the C library is located in the `lib'
+ directory.
+
+ It uses a file named `ft_conf.h', which contains the definitions
+ of many configuration macros to toggle various engine features,
+ as well as tell system-specific information (e.g., the size of
+ the `int' type in bytes, etc).
+
+ There are several configuration files provided with this
+ release. They are located in the `lib/arch/<system>' directory,
+ where <system> stands for a given architecture or environment.
+
+ For example, the file `lib/arch/ansi/ft_conf.h' can be used to
+ build the library with any ANSI-compliant compiler and runtime
+ library.
+
+ This release also provides configuration files for the following
+ systems: MS-DOS, OS/2, Unix, VMS, Win 16, Win 32, Amiga OS, Mac,
+ and BeOS.
+
+ Make sure, when compiling each source file of the FreeType
+ library, to include the path to your configuration file in your
+ include directories.
+
+
+ 2. Compiling the library
+ ------------------------
+
+ The library can be quickly compiled by invoking a Makefile, as
+ described in the system-specific documents in the `howto'
+ directory.
+
+ We will now describe how to compile the library by hand.
+
+ Traditionally, building a library like FreeType needs the
+ following steps:
+
+ - Compile each individual `.c' file into the corresponding
+ object file, whose extension might be `.o' or `.obj',
+ depending on the platform.
+
+ - Group all object files into a library (e.g. `libfreetype.a' or
+ `freetype.lib'), which is later used at link time to build the
+ executables using it.
+
+ For example, to build a static FreeType library on an ANSI
+ system, with gcc, one should type
+
+ cd lib # go to `lib' directory
+ gcc -c -I arch/ansi tt*.c # compile base engine sources
+ ar -r libfreetype.a tt*.o # create library from objects
+
+ Note that we included the path to the configuration file in the
+ include list during compilation, by using the `-I' switch on the
+ `arch/ansi' directory. This is required to use the
+ configuration file named `lib/arch/ansi/ft_conf.h'.
+
+ However, we recommend you to build the base FreeType engine as a
+ SINGLE OBJECT FILE, i.e., a single `freetype.o' or
+ `freetype.obj' file containing all the code for the base engine.
+ It works by including all the `.c' files in a single one, and
+ has a few advantages over a `traditional build':
+
+ - Because all the code is `part' of a single source file, many
+ internal functions need not be declared as `extern' anymore.
+
+ This means that when compiling the engine as a dynamic
+ library, only FreeType external functions will (correctly) be
+ exported as entry points.
+
+ This also typically allows the compiler to perform more
+ aggressive optimizations on the source code, and results in
+ somewhat faster and/or smaller overall code size depending on
+ your compiler and environment.
+
+ - Compilation speed is greatly improved, as the pre-processor
+ and compiler need to be called only once, instead of a dozen
+ times.
+
+ - During development, this allows to detect very easily
+ unresolved dependencies regarding the base engine's internal
+ symbols.
+
+ To compile the engine as a single object file, simply go to the
+ `lib' directory and compile the file
+ `lib/arch/<system>/freetype.c'.
+
+ For example, to compile the ANSI build with gcc in SINGLE OBJECT
+ MODE, use
+
+ cd lib
+ gcc -c -I arch/ansi -I . arch/ansi/freetype.c
+
+ This will create a single file called `freetype.o' containing
+ the object code for the base TrueType engine.
+
+ Note that we did include the paths to the configuration file
+ (i.e. `arch/ansi') AND to the current directory (i.e. `.',
+ where the included source files are located).
+
+ `freetype.o' only contains the base engine. Extensions to the
+ engine are located in the `lib/extend' directory and must be
+ compiled separately as described later.
+
+
+ 3. System-specific builds
+ -------------------------
+
+ The files `ttfile.c', `ttmemory.c', and `ttmutex.c' are used to
+ provide an implementation of i/o access, memory management, and
+ thread synchronization for the rest of the library.
+
+ These source files, located in the `lib' directory, use the ANSI
+ C library for i/o and memory, and simply ignore threads (as the
+ C standard doesn't know about threads at all).
+
+ However, this release provides, for each supported platform,
+ system-specific versions of these files, located in the
+ `lib/arch/<system>' hierarchy. Here are a few examples:
+
+ lib/arch/os2/os2file.c:
+
+ A replacement for `ttfile' which directly uses OS/2 system
+ calls for i/o access. This results in slightly better
+ performance, but much reduced resource requirements.
+
+ lib/arch/unix/ttmmap.c:
+
+ A replacement for `ttfile' which uses memory-mapped files
+ instead of buffered-based reads on Unix. This increases
+ *dramatically* the engine's performance when reading font
+ files and loading glyphs.
+
+ These files are directly included by the platform specific
+ versions of `freetype.c' which are located in
+ `lib/arch/<system>'. This means that, by default, the
+ single-object build of FreeType always chooses the best
+ implementation available for a supported system.
+
+ Note that it is also possible to redefine `ttmemory' or
+ `ttmutex' with a similar scheme. This is used, for example, by
+ the OS/2 font driver based on FreeType (called FreeType/2),
+ which uses some special system calls to allocate memory
+ shareable among distinct processes.
+
+ By providing your own version of `ttfile', `ttmemory', and
+ `ttmutex', you are able to tailor the FreeType engine for
+ optimal performance and resource usage on your system.
+
+
+ 4. Compiling the extensions
+ ---------------------------
+
+ The base TrueType engine is located in the `lib' directory.
+ This release also provides many specific extensions in
+ `lib/extend'.
+
+ An extension is a simple way to extend FreeType's capabilities.
+ It is used to perform any of the following:
+
+ - Access some TrueType tables that are not loaded and returned
+ by the base engine, like
+
+ * the kerning table(s)
+ * the `gasp' table
+ * the glyph Postscript names
+ * the OpenType layout tables (GDEF, GPOS, GSUB)
+
+ - Perform some advanced operations on the TrueType data for very
+ specific uses, like
+
+ * enumerate the contents of a given charmap
+ * access a font file's embedded bitmaps (called sbits)
+ * return an array containing the dimensions of each glyph in
+ the font
+
+ The idea is to keep the base engine small (under 60 kByte),
+ while providing optional enhancements for specific uses.
+
+ Writing an extension is rather easy. And adding a new extension
+ to the engine doesn't need any modifications to the base
+ engine's source code.
+
+ To compile the extensions, simply go to the `lib' directory,
+ then compile each file in `lib/extend'. Here is an example with
+ gcc:
+
+ cd lib # go to `lib'
+ gcc -c -I arch/ansi -I . -I extend extend/ftx*.c
+ # compile all extensions
+
+
+ You can later add each extension object file to the FreeType
+ library file. For example, here is how to create the static
+ library on Unix:
+
+ cd lib
+ # .. compile the engine, then the extensions
+ ar libfreetype.a *.o # create static library
+
+
+ 5. Using a Makefile
+ -------------------
+
+ This release also provides Makefiles for many systems and
+ compilers in the `lib/arch/<system>' hierarchy. For more
+ information, please read the documentation in the `howto'
+ directory, which contains system-specific instructions on how to
+ use them.
+
+ Generally, you should go the `lib' directory, then invoke your
+ system-specific Makefile from there. Here is an example:
+
+ cd lib
+ make -farch\msdos\Makefile.TC
+
+ to compile the library under DOS with the Turbo C compiler and
+ Borland make tool. Or:
+
+ cd lib
+ wmake -f arch\msdos\Makefile.wat
+
+ to compile it under DOS with the Watcom compiler and wmake tool.
+
+ The ANSI target does not come with a Makefile, as there is no
+ standard make tool available on all platforms. You will have to
+ compile the library by hand as described in section I.3.
+
+ Finally, note that most of the makefiles will build the library
+ in single object mode; for a `traditional compile', try the
+ `debug' target (i.e., say `make debug').
+
+
+ 6. Building a dynamic library (`so' or `DLL')
+ ---------------------------------------------
+
+ It is possible to build the engine as a dynamic library. The
+ method to do so can vary greatly depending on the platform.
+
+ a. Building a shared object on Unix
+
+ NOTE THAT THIS RELEASE USES `libtool' TO AUTOMATICALLY CREATE
+ A SHARED OBJECT FOR FREETYPE ON UNIX SYSTEMS THAT SUPPORT
+ DYNAMIC LIBRARIES. WE STRONGLY RECOMMEND YOU TO READ THE
+ `howto/unix.txt' FILE TO KNOW HOW TO USE THE `configure'
+ SCRIPT. THIS SUB-SECTION DESCRIBES HOW TO COMPILE THE SHARED
+ OBJECT BY HAND.
+
+ In order to build a shared object like `libfreetype.so' on
+ Unix, one has to compile each object file as
+ position-independent code (a.k.a. PIC).
+
+ We also strongly recommend to build the base engine as a
+ single object, as this prevents internal `extern' functions to
+ be exported as entry points (and creating a smaller overall
+ .so file).
+
+ For example, this with gcc, one can use the `-fPIC' flag when
+ compiling the object files. Here is an example:
+
+ cd lib # go to `lib'
+ gcc -c -fPIC -I arch/ansi -I . \
+ arch/ansi/freetype.c # compile engine
+ gcc -c -fPIC -I arch/ansi -I . -I extend
+ extend/ftx*.c # & extensions
+
+ You can now invoke your linker to create the shared object
+ from the various object files. See your system's
+ documentation for details, or read the Unix-specific howto to
+ know how to do it `easily' through the use of `libtool'.
+
+ b. Building a DLL on Windows or OS/2
+
+ The dynamic linkers of Windows and OS/2 differ greatly from
+ Unix ones.
+
+ - The first difference is that the object files that make up
+ the DLL do not need to be compiled as position-independent
+ code.
+
+ - The second difference is that the DLL's entry points must
+ generally be declared as so in the source file, and/or maybe
+ listed in a `definition' file used at link time when
+ creating the DLL.
+
+ Each FreeType API function is declared with the help of a
+ special macro named FT_EXPORT_DEF. For example, here is the
+ declaration of the function `FT_Init_FreeType', as written in
+ `freetype.h':
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_FreeType( TT_Engine* engine );
+
+ If the configuration file `ft_conf.h' doesn't define
+ FT_EXPORT_DEF, it is automatically set to `extern' by default.
+
+ In order to build FreeType as a DLL, one might need to define
+ FT_EXPORT_DEF in its `ft_conf.h' to the keywords tagging the
+ function as a DLL entry point. This keyword varies with
+ compilers and platforms; examples are `__system',
+ `__dllentry', `_FAR _PASCAL _export' after the type name, etc.
+ Note that FT_EXPORT_DEF is a (macro) function, taking the type
+ name as argument, in order to allow the last example.
+
+ Please refer to your compiler's user guide for instructions.
+
+ You can also `grep' for FT_EXPORT_DEF in the `freetype.h'
+ source file to obtain the list of exported functions of the
+ FreeType API, which could then be used to write a `def' file
+ for the DLL. We provide a sample .def file (built with an Unix
+ script) for Windows.
+
+ Note also that the definition (i.e. its implementation) of
+ each exported function is preceded with the FT_EXPORT_FUNC
+ macro, as in
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_FreeType( TT_Engine* engine )
+ {
+ TT_Error error;
+ ...
+ }
+
+ (to be found in `ttapi.c').
+
+ By default, FT_EXPORT_FUNC converts to an empty string, but it
+ can also be redefined if you need to.
+
+
+ 7. Internationalization and the `ftxerr18' extension
+ ----------------------------------------------------
+
+ The engine extension named `ftxerr18' is used to convert a
+ FreeType error code into a human-readable string of text.
+
+ However, it is able to support internationalization on Unix
+ systems through the use of the `gettext' library. This means
+ that the error messages will be localized to your system's
+ language, provided it is available in this release. The
+ currently available languages are
+
+ - English (by default)
+ - Czech
+ - German
+ - Spanish
+ - French
+ - Dutch
+
+ One can add a new language by adding a `.po' file in the `po'
+ directory. Please read the file `docs/i18n.txt' for more
+ details on how to use `gettext'.
+
+ In order to enable localization of the `ftxerr18' extension, one
+ has to set the macro HAVE_LIBINTL_H at compile time. By
+ default, the extension will build with support for the English
+ language.
+
+ Unix-specific: -------------------------------------------------
+
+ Note that the Unix `configure' script that comes with this
+ release is able to automatically detect whether your system
+ has `gettext' installed and set HAVE_LIBINTL_H in the
+ `ft_conf_h' file accordingly.
+
+ To disable internationalization, run `configure' with the
+ option `--disable-nls' (NLS stands for `National Language
+ Support'). Then rebuild the library.
+
+ ----------------------------------------------------------------
+
+ Note that we do not support internationalization on non-Unix
+ platforms, as the `gettext' library isn't available everywhere,
+ or does not work in a consistent way in different environments.
+
+
+ 8. TrueType patents
+ -------------------
+
+ We have recently discovered that Apple owns several patents that
+ relate to the rendering of TrueType fonts. This could mean that
+ the free use and distribution of the FreeType library could be
+ illegal in the US, UK, France, and possibly other countries.
+
+ For more information, please see the FreeType Patents page at:
+
+ http://www.freetype.org/patents.htm
+
+ To avoid problems, we have decided to turn off by default the
+ compilation of the TrueType bytecode interpreter (which is the
+ only part of FreeType that might violate an Apple patent). This
+ has two effects:
+
+ - saving about 18 kbyte of code in the engine
+ - ignoring completely the grid-fitting of vector outlines, which
+ results in extremely low quality at small pixel sizes.
+
+ Nevertheless, such an engine can be used by font converters
+ and/or graphics libraries to display glyphs at high pixel sizes.
+
+ If you believe you can go ahead, this section will now explain
+ how to build a `complete' engine, at the cost of possible patent
+ violation. This is done simply by activating the compilation of
+ the TrueType bytecode interpreter. In order to do so, simply
+ recompile the library (more exactly, it affects only ttinterp.c)
+ while #defin'ing TT_CONFIG_OPTION_BYTECODE_INTERPRETER. Look
+ for the following line in your configuration file `ft_conf.h':
+
+ #undef FT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+ Then change the `#undef' into a `#define':
+
+ #define FT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+ Now rebuild the engine with this new configuration file.
+
+
+
+III. Compiling the test programs
+================================
+
+ This section explains how to compile the FreeType test programs
+ located in the `test' directory. Note that you should have
+ successfully compiled the library, as described in section I
+ before proceeding.
+
+ WE STRONGLY RECOMMEND TO READ THE SYSTEM-SPECIFIC DOCUMENTS IN THE
+ `howto' DIRECTORY FOR A `QUICK'N'EASY' GUIDE ON HOW TO COMPILE AND
+ RUN THE TEST PROGRAMS.
+
+
+ 1. Compile the graphics sub-system and utility sources
+ ------------------------------------------------------
+
+ Some of the test programs need to display a graphics window to
+ show their results. In order to do so, they use a tiny graphics
+ system which was specifically written for FreeType (Note: The
+ code isn't really clean there -- you have been warned).
+
+ Also, some simple C sources in the `test' directory are utility
+ functions used by nearly all test programs, and they should also
+ be compiled before them. These are the following files:
+
+ gmain.h: the sub-system interface
+ gmain.c: the sub-system device-independent implementation
+ gevents.h: the definition of the events used by the test
+ program
+ gdriver.h: the system-specific device interface
+ blitter.c: a set of simple bitmap blitting functions
+ common.c: common routines used by all test programs
+ display.c: some routines dealing with text display
+
+ as well as a system-specific `graphics driver' located in the
+ `test/arch/<system>' hierarchy. For example:
+
+ test/arch/msdos/gfs_dos.c: used to display graphics in a
+ full-screen Dos session
+ test/arch/os2/gpm_os2.c: used to display graphics in an OS/2
+ Presentation Manager window
+ test/arch/unix/gwin_x11.c: used to display graphics in an X11
+ window.
+
+ You must compile the graphics sub-system and utilities before
+ compiling the test programs. This can be done simply with gcc
+ as:
+
+ cd test
+ gcc -c -I../lib gmain.c blitter.c common.c display.c
+ gcc -c -I../lib -I. arch/<system>/yourdriver.c -o ./gdriver.o
+
+ Note that a given test program may require some specific include
+ paths (like `/usr/X11/include' with X11 for example).
+
+ The resulting object files can be grouped in a library if you
+ want to.
+
+
+ 2. Internationalization on Unix
+ -------------------------------
+
+ On Unix and Unix-like systems, the test programs are able to
+ support internationalization through the use of the `gettext'
+ library and the `ftxerr18' engine extension (see section I.7).
+
+ To enable it, one has to compile each test program with the
+ macro HAVE_LIBINTL_H set. This is the same macro used to enable
+ it in `ftxerr18'.
+
+ Note that the Unix `configure' script that comes with this
+ release is able to automatically detect whether `gettext' is
+ available on your system and set the macro accordingly when
+ compiling the test programs.
+
+ You can disable internationalisation with the `--disable-nls'
+ option when invoking the `configure' script.
+
+
+ 3. Compile the test programs
+ ----------------------------
+
+ All test programs begin with the `ft' prefix in the `test'
+ directory, as in `ftzoom', `ftdump', `ftmetric'", etc. are test
+ programs.
+
+ The easiest way to compile the test programs is compiling each
+ source file to an object file, including the path to the
+ FreeType engine source and its extensions. You need to use the
+ following include paths:
+
+ - the path to the engine's public header file, i.e. `freetype.h'
+ which normally is `lib'
+
+ - the path to the engine's extensions header files, located
+ normally in `lib/extend'
+
+ - the path to the configuration file `ft_conf.h'. This is only
+ required to support internationalisation, as the test programs
+ read `ft_conf.h' only to see whether HAVE_LIBINTL_H is
+ defined.
+
+ When compiling your own programs to FreeType, you shouldn't
+ normally need this file and path.
+
+ Here is an example, compiling a test program with the ANSI
+ build:
+
+ cd test
+ gcc -c -I../lib -I../lib/extend -I../lib/arch/ansi \
+ <program name>.c
+
+ Then, link this object file to the FreeType library, utilities
+ and graphics sub-system to build an executable.
+
+ You can then invoke each program directly.
+
+
+ 4. The `fdebug' test program
+ ----------------------------
+
+ All test programs begin with the `ft' prefix (in the `test'
+ directory) as in `ftzoom', `ftdump', `ftmetric', etc.
+
+ However, one test program named `fdebug' is used exclusively by
+ FreeType developers. It is a very simple TrueType bytecode
+ debugger, and was written to inspect the execution of the
+ TrueType interpreter.
+
+ Note that we rather use the Pascal debugger for real work on the
+ interpreter, as it provides a much easier windowed interface
+ through the use of the Turbo Vision library. The C debugger is
+ mainly used to check that both Pascal and C sources produce the
+ same output. The Pascal debugger is available in the `ftpascal'
+ package, it is not included with this release.
+
+ You will need gcc to compile the debugger. It uses a special
+ build of the FreeType engine to work. Follow these steps to
+ compile it:
+
+ 1. Ensure the bytecode interpreter is not turned off (using
+ the debugger with the default build which is patents-compliant
+ is not really useful). How to process is explained in part 8
+ of chapter II above (but of course you should modify the
+ `ft_conf.h' file which is specific to the debugger). This
+ implies that you must first be sure that you are really
+ allowed to use such a version of FreeType.
+
+ 2. Compile the library for the `debugger' system, i.e.
+
+ cd freetype/lib
+ make -f arch/debugger/Makefile
+
+ this will create a file named `libttf.a' in the directory
+ `freetype/lib/arch/debugger' which will NOT interfere with
+ your normal build (which is located in `freetype/lib').
+
+ 3. Compile the debugger:
+
+ cd freetype/test
+ make -f arch/debugger/Makefile
+
+ This will create an executable called `fdebug.exe' or
+ `fdebug', which is linked with the version of the library
+ found in `freetype/lib/arch/debugger' as described above.
+
+ [For old Unix variants like 4.2BSD please uncomment the flag
+ HAVE_POSIX_TERMIOS in the makefile.]
+
+ You can invoke the debugger in two ways:
+
+ a. To debug a given glyph program in a given font, type
+
+ fdebug glyph_number pointsize fontfile[.ttf]
+
+ b. To debug a given font's CVT program, type
+
+ fdebug --cvt pointsize fontfile[.ttf]
+
+ Type `?' while running fdebug for a list of key bindings.
+
+
+IV. Compiling the Pascal source
+===============================
+
+ The Pascal source code is no longer part of this package. It has
+ been moved to another archive (resp. CVS repository). Please
+ visit http://www.freetype.org for more information.
+
+
+--- end of INSTALL ---
diff --git a/Build/source/libs/freetype/MakeSub.in b/Build/source/libs/freetype/MakeSub.in
new file mode 100644
index 00000000000..90d10b9ecae
--- /dev/null
+++ b/Build/source/libs/freetype/MakeSub.in
@@ -0,0 +1,7 @@
+# this file is part of the FreeType project
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+bindir = @bindir@
+includedir = @includedir@
diff --git a/Build/source/libs/freetype/Makefile.in b/Build/source/libs/freetype/Makefile.in
new file mode 100644
index 00000000000..f238b0c4d2a
--- /dev/null
+++ b/Build/source/libs/freetype/Makefile.in
@@ -0,0 +1,70 @@
+# 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.
+
+RMF = @RM@ -f
+
+MAKEFILE = arch/unix/Makefile
+
+FTLIBDIR = lib
+FTTESTDIR = test
+FTPODIR = po
+
+all: ttlib tttest ttpo
+
+debug: ttlibdebug tttest ttpo
+
+# we can't use the target names 'lib', 'test', etc.
+# because make will believe that the directories are
+# the targets and are up-to-date! Grrr... >:-(
+
+ttlib:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) all
+
+ttlibdebug:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) debug
+
+tttest:
+ cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) all
+
+ttpo:
+ cd $(FTPODIR); $(MAKE) all
+
+install:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) install
+ cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) install
+ cd $(FTPODIR); $(MAKE) install
+
+uninstall:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) uninstall
+ cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) uninstall
+ cd $(FTPODIR); $(MAKE) uninstall
+
+clean:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) clean
+ cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) clean
+ cd $(FTPODIR); $(MAKE) clean
+
+distclean:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) distclean
+ cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) distclean
+ cd $(FTPODIR); $(MAKE) distclean
+ $(RMF) config.cache config.log config.status Makefile \
+ MakeSub ft_conf.h libtool
+
+check:
+ @echo This package does not yet have a validation suite
+
+depend:
+ cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) depend
+ cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) depend
+
+.PHONY: all debug ttlib ttlibdebug tttest ttpo install uninstall \
+ clean distclean depend
+
+# end of Makefile.in
diff --git a/Build/source/libs/freetype/PATENTS b/Build/source/libs/freetype/PATENTS
new file mode 100644
index 00000000000..ce34bc830a2
--- /dev/null
+++ b/Build/source/libs/freetype/PATENTS
@@ -0,0 +1,28 @@
+
+ FreeType Patents Disclaimer
+ August 1999
+
+
+
+WE HAVE DISCOVERED THAT APPLE OWNS SEVERAL PATENTS RELATED TO THE
+RENDERING OF TRUETYPE FONTS. THIS COULD MEAN THAT THE FREE USE OF
+THE FREETYPE LIBRARY MIGHT BE ILLEGAL IN FRANCE, UK, USA, AND
+POSSIBLY OTHER COUNTRIES, BE IT IN COMMERCIAL OR OPEN SOURCE
+PRODUCTS.
+
+FOR MORE DETAILS, WE STRONGLY ADVISE YOU TO GO TO THE FREETYPE
+PATENTS PAGE AT THE FOLLOWING WEB ADDRESS:
+
+ http://www.freetype.org/patents.html
+
+WE WILL NOT PLACE INFORMATION IN THIS FILE AS THE SITUATION IS STILL
+UNDETERMINED FOR NOW. AT THE TIME THESE LINES ARE WRITTEN, WE HAVE
+CONTACTED APPLE'S LEGAL DEPARTMENT AND ARE STILL WAITING FOR THEIR
+ANSWER ON THE SUBJECT.
+
+PLEASE READ THE `INSTALL' FILE TO SEE HOW TO DISABLE THE ENGINE'S
+BYTECODE INTERPRETER IN ORDER TO BUILD A PATENT-FREE ENGINE, AT THE
+COST OF RENDERING QUALITY.
+
+
+--- end of PATENTS ---
diff --git a/Build/source/libs/freetype/README b/Build/source/libs/freetype/README
new file mode 100644
index 00000000000..79dcd59ec3e
--- /dev/null
+++ b/Build/source/libs/freetype/README
@@ -0,0 +1,708 @@
+
+
+ Welcome to the
+
+ F R E E T Y P E P R O J E C T
+
+ http://www.freetype.org
+
+ Release 1.5
+
+ The FREE TrueType Font Engine
+
+ Copyright 1996 David Turner <david.turner@freetype.org>
+ - 2001 Robert Wilhelm <robert.wilhelm@freetype.org>
+ Werner Lemberg <werner.lemberg@freetype.org>
+
+
+ Table of Contents
+ -----------------
+
+ I. Introduction
+
+ II. The FreeType mini-FAQ
+
+ III. How to use the test programs
+
+ 1. ftzoom
+ 2. ftlint
+ 3. ftview
+ 4. fttimer
+ 5. ftdump
+ 6. ftstring
+ 7. ftstrpnm
+ 8. fterror
+ 9. ftsbit
+ 10. ftmetric
+ 11. ftstrtto
+
+ IV. How to use the programs in the `contrib' directory
+
+ V. Final remarks
+
+
+I. Introduction
+===============
+
+ Please read the file `INSTALL' for installation instructions!
+
+ The FreeType engine is a free and portable TrueType font rendering
+ engine. It has been developed to provide TrueType support to a
+ great variety of platforms and environments.
+
+ Notice that FreeType is a *library*. It is *not* a font server
+ for your preferred environment, even though it has been written to
+ allow the design of many font servers.
+
+ To our knowledge, this is the only royalty-free complete TrueType
+ engine available. Moreover, its quality fully matches these of
+ Windows or the Macintosh, a thing that cannot be said for most
+ other commercial engines available.
+
+ FreeType is a clean-room implementation that is not derived from
+ the original TrueType engine developed by Apple and Microsoft. It
+ has been created with the sole help of the published TrueType
+ specifications, which, to our great surprise and pain, turned out
+ to be extremely poor or misleading in critical areas. Much hard
+ work has been undertaken to solve numerous ambiguities;
+ nevertheless, its end result is a portable, fast quality renderer!
+
+ The library itself takes about 53 kByte of Intel code, complete
+ with a TrueType byte-code interpreter and a high-performance
+ scan-line converter.
+
+ You will find in this release:
+
+ - A TrueType engine, with source code in ANSI C. It has been
+ successfully compiled and run on various platforms, including
+ MS-DOS, OS/2, Amiga, Linux, and several other variants of Unix.
+ It should be portable to many other platforms too.
+
+ - An API to be used by client applications and font servers,
+ providing several low level abstractions that can be used to
+ open font files and collections, create point sizes and load,
+ process and render glyph outlines and bitmaps.
+
+ - Support for the following features:
+
+ o Font smoothing, a.k.a. gray-level rendering.
+
+ Just like Windows 95, the renderer uses a `fine' algorithm
+ that only smoothes diagonals and curves, while keeping the
+ horizontal and vertical stems intact.
+
+ This results in glyphs that are much more legible than the
+ `fuzzy' ones generated by programs like Acrobat.
+
+ o Support for all character mapping formats.
+
+ o A full-featured TrueType byte-code interpreter.
+
+ The engine is able to hint the glyphs to produce excellent
+ output at small sizes. It was extremely difficult to get this
+ component right, due to the ambiguous and misleading TrueType
+ specifications. However, we now *match* Windows and Macintosh
+ qualities.
+
+ o TrueType collection support, when several fonts are embedded
+ in the same file.
+
+ o Support for extensions.
+
+ It is now possible to extend the library in parts to support
+ additional features, like optional tables that are not
+ considered by the current core engine.
+
+ o Kerning support.
+
+ Provided as a sample extension with this release, kerning
+ tables can be accessed from a TrueType font for applications
+ that need it.
+
+ o Support for vertical metrics.
+
+ It is possible to load vertical metrics when they are present
+ in a font file. Metrics can be retrieved glyph by glyph,
+ using the loader, or in arrays with a new API.
+
+ o Support for thread-safety and re-entrancy.
+
+ You will only need to specialize the file `ttmutex.c' for your
+ platform to include system-specific synchronization calls.
+
+ o Support for embedded bitmaps.
+
+ This feature is already used in x-tt, a TrueType font server
+ for X Window System.
+
+ o Support for OpenType. With this release, GSUB and GPOS have
+ been completely implemented.
+
+ Note also that:
+
+ - Though development of the library is mainly performed on OS/2
+ and Linux, the library does not contain system-specific code.
+
+ - The package contains some graphics drivers used by the test
+ programs for display purposes on MS-DOS, OS/2, Amiga, X11, and
+ Windows. These drivers are absolutely not mandatory for running
+ the FreeType engine. Some console-mode test programs like
+ `ftlint' or `ftdump' don't use graphics at all.
+
+ - There was a Pascal version that was distributed along with the C
+ version. Unfortunately, it is not up to date when compared to
+ the C version, so we decided to split the two projects. If you
+ are interested, you can find the Pascal version in packages
+ named like `ftpascal-1.x.tar.gz' or `ftpas1x.zip'.
+
+
+
+II. The FreeType mini-FAQ
+=========================
+
+ Summary
+
+ 0. Where to find the latest FreeType release?
+
+ 1. Did the API change?
+
+ 2. What does the `Free' in FreeType means? Can you use it in a
+ commercial product? (YES!)
+
+ 3. I have made a small program based on the test programs but I
+ would like to know how to do xxx?
+
+ 4. When will I be able to use FreeType to display TrueType fonts
+ under X11, OS/2 or Wine? (NOW!)
+
+ 5. Trying to compile the FreeType sources gives me lots of
+ warnings with my ANSI C compliant compiler!
+
+ ------------------------------------------------------------------
+
+ 0. Where to find the latest FreeType release?
+
+ The latest package is usually uploaded to various source
+ repositories, like SunSite, SimTel, or Hobbes. There are two
+ archive formats (zip and tar.gz), which also differ by their
+ CR/LF conventions.
+
+ * for DOS and OS/2: `ft-15.zip'
+
+ which should be available at:
+
+ Hobbes: ftp://ftp.cdrom.com/pub/os2/misc
+ SimTel: ftp://ftp.simtel.net/pub/msdos/graphics
+
+ * for UNIX and Amiga: `freetype-1.5.tar.gz'
+
+ look at:
+
+ SunSite: ftp://sunsite.unc.edu/pub/Linux/X11/fonts
+
+ As uploading can take several days before the package becomes
+ available to the public, we advise you to download it from our
+ own ftp site if you read this message few days after the
+ announcement at:
+
+ ftp://ftp.freetype.org/freetype/
+
+ Our home page is at:
+
+ http://www.freetype.org
+
+ Screen shots are available!
+
+ There are also three mailing lists:
+
+ o announce@freetype.org
+
+ Announcements only about new versions of FreeType and
+ related packages. This list is moderated and expected to
+ have very low traffic.
+
+ o freetype@freetype.org
+
+ Discusses general use of FreeType, future, and needed
+ additions, as well as many other font-related discussions
+ which do not always relate directly to the FreeType code
+ itself...
+
+ o devel@freetype.org
+
+ Discusses development, design choices, portability issues,
+ internals, specific licenses, etc.
+
+ To subscribe, send the usual "subscribe" command to:
+
+ announce-request@freetype.org
+ freetype-request@freetype.org
+ devel-request@freetype.org
+
+ To report bugs please use send an e-mail to devel@freetype.org.
+
+ ------------------------------------------------------------------
+
+ 1. Did the API change since the version 1.2?
+
+ Only very marginally. Please refer to `changes.txt'.
+
+ ------------------------------------------------------------------
+
+ 2. What does the `Free' in FreeType means? Can you use it in a
+ commercial product? (YES!)
+
+ We have placed this release under our special FreeType license.
+
+ It was inspired by the BSD, Artistic, and IJG (Independent JPEG
+ group) licences, which specifically encourage the use of this
+ software in commercial products!
+
+ The reason we did this is that we believe that TrueType is a
+ very useful technology, and want to make it available on all
+ machines and platforms. The license is there to ensure that
+ the engine can be spread as widely as possible.
+
+ Since version 1.5, you can also optionally choose to use the
+ GNU Public Licence (GPL) instead. The GPL is used only to allow
+ GPL-ed applications to use FreeType (since the "disclaimer
+ clause" is considered an unacceptable "restriction" in GNU
+ speak); for a commercial product, you should avoid the GPL, and
+ then elect the FreeType licence.
+
+ However, free does not mean public domain. This engine is
+ copyrighted by its authors, and they will fiercely defend their
+ rights.
+
+ ------------------------------------------------------------------
+
+ 3. I have made a small program based on the test programs but I
+ would like to know how to do xxx?
+
+ (Where xxx is a feature lacking from the current
+ implementation).
+
+ First of all, read the documentation. The user guide gives
+ some basic hints and concepts. You can also read the source
+ code of the test programs that you didn't consider yet. If
+ you are really stuck, mail your question to:
+
+ freetype@freetype.org
+
+ We shall try to help you.
+
+ ------------------------------------------------------------------
+
+ 4. When will I be able to use FreeType to display TrueType fonts
+ under X11, OS/2, or Wine?
+
+ You can already do that under X11 and OS/2 :-) Go to the
+ FreeType web page (http://www.freetype.org) for up-to-date
+ information.
+
+ And yes, it looks terrific!
+
+ For X11, you could also take a look at `xfstt', an independent
+ TrueType font server for Unix which doesn't rely on the
+ FreeType code.
+
+ You are welcome to volunteer for other platforms, like:
+
+ Amiga, RISC OS, BeOS, and others
+
+ [Note that the FreeType library is already available with Amiga
+ and BeOS.]
+
+ Please contact devel@freetype.org for more information.
+
+ ------------------------------------------------------------------
+
+ 5. Trying to compile the FreeType sources gives me lots of
+ warnings with my ANSI C compliant compiler!
+
+ We use gcc as our reference compiler for warnings. This means
+ that we use the `-ansi -pedantic -Wall' flags and try to get
+ rid of warnings in this situation.
+
+ If you are compiling with another compiler, you may encounter
+ warnings, not errors.
+
+ We have spent much efforts to reduce seriously the number of
+ warnings produced by major compilers, including Visual Age,
+ Visual C++ and Borland C++.
+
+ Note that the Borland compilers seem to produce lots of
+ irrelevant warnings (like `potential loss of precision').
+
+
+III. How to use the test programs
+=================================
+
+ All test programs having a graphic interface use the same key
+ convention:
+
+ x : fine counter_clockwise rotation
+ c : fine clockwise rotation
+
+ v : fast counter_clockwise rotation
+ b : fast clockwise rotation
+
+ h : toggle hinting on/off
+ K : toggle kerning on/off
+ B : toggle display of embedded bitmaps on/off
+ S : toggle GSUB on/off
+ P : toggle GPOS on/off
+
+ + : fast scale up
+ - : fast scale down
+ u : fine scale up
+ j : fine scale down
+
+ l : go to next glyph
+ k : go to previous glyph
+
+ o : go to tenth next glyph
+ i : go to tenth previous glyph
+
+ 0 : go to hundredth next glyph (useful for CJK fonts)
+ 9 : go to hundredth previous glyph
+
+ ) : go to thousandth next glyph
+ ( : go to thousandth previous glyph
+
+ } : go to tenthousandth next glyph
+ { : go to tenthousandth previous glyph
+
+ q :
+ ESC : exit
+
+ These keys were chosen because they are available on all
+ platforms. Note also that each program uses only a subset of this
+ key map.
+
+ 1. FTZOOM
+ ---------
+
+ `ftzoom' is a very simple glyph viewer that supports font
+ smoothing. Its usage is:
+
+ ftzoom [-g] [-p platformID -e encodingID]
+ [-r resolution] [-z magnification] [-n] fontfilename
+
+ With -g you can select gray-scaling; with -n you can suppress
+ usage of the `post' table in the TrueType font.
+
+ For example:
+
+ ftzoom arial.ttf to show the glyphs found
+ in the Arial font
+ ftzoom -g times.ttf to show smoothed version of
+ Times's glyphs.
+ ftzoom -p 3 -e 1 uwjmg3.ttf use cmap for platform ID 3,
+ encoding ID 1 for this Japanese
+ font.
+
+ 2. FTLINT
+ ---------
+
+ `ftlint' is used to execute all glyphs instructions found in a
+ font file at a given char size size. Its usage is:
+
+ ftlint pointsize fontfilename [fontfilename] ...
+
+ For example:
+
+ ftlint 12 arial.ttf
+ ftlint 15 times.ttf
+
+ It reports error codes and faulty glyph numbers. This is a
+ console tool that doesn't need the graphics subsystem.
+
+ NOTE: Trying to hint at sizes smaller than 7 is irrelevant.
+
+ 3. FTVIEW
+ ---------
+
+ A font viewer that supports hinting and font smoothing. Its
+ usage:
+
+ ftview [-g] -[r resolution] [-B] pointsize fontfilename
+
+ like in:
+
+ ftview 12 arial.ttf show the hinted Arial at size 12pt.
+
+ ftview -g 15 timesi.ttf show the hinted and font-smoothed
+ Times at size 15pt.
+
+ `-r' selects the resolution; `-B' forces the use of embedded
+ bitmaps.
+
+ Note that it is possible to change the point size during display
+ with the keys `u', `j', `+', and `-'. It is also possible to
+ browse the whole glyph set with the `k', `l', `i', `o', `0',
+ `9', `(', `)', `{', and `}' keys (see key map above).
+
+ The OS/2 PM driver comes with an additional magnifying window.
+ The magnified zone is set with the mouse, while the scale is
+ changed with the help of `PageUp' and `PageDown'.
+
+ Note 1: The engine uses the font's CVT program to determine at
+ which size to enable or disable glyph hinting. Don't be
+ surprised to see unhinted glyphs at sizes < 7pt.
+
+ Note 2: Vertical drop-out control has been added to the gray
+ scaling renderer. As a consequence, the library doesn't
+ produce unpleasant results at small ppems with badly
+ hinted glyphs.
+
+ 4. FTTIMER
+ ----------
+
+ This program is used to benchmark FreeType's scan-converter (the
+ component in charge of translating a vectorial shape description
+ into a bitmap). It does so in preloading all glyphs from a font
+ file, then rendering them as fast as possible in a 640x450
+ buffer. The glyphs are rendered at size 400pt / 96dpi, which is
+ _quite_ big.
+
+ Its usage is:
+
+ fttimer [-g] [-v] fontfilename
+
+ where
+
+ -g : Asks for gray-level rendering at size 200pt instead
+ (a.k.a. font-smoothing).
+
+ -v : Asks for the display of the produced bitmap. Beware
+ that display slows things down (display on X11 is
+ _terrible_, especially with gray-levels, but this is
+ not a problem for us :-).
+
+ Note that the returned numbers are not a benchmark of FreeType's
+ overall performance! Only of the scan-line renderer (which
+ seems quite fast, apparently :-).
+
+ When comparing measured performances across machines, please
+ only consider the undisplayed ones. We're interested in all
+ kinds of results (please provide the following information:
+
+ font file
+ number of rendered glyphs
+ render time
+ total time
+ glyphs / s
+ processor type
+ CPU clock
+
+ and which compiler used (with optimization involved)! This
+ can make a great difference!
+
+ etc.)
+
+ 5. FTDUMP
+ ---------
+
+ This program is a very simple font dumper. In its current
+ incarnation, it will only output a font's name table, character
+ encoding maps IDs and total memory consumption. For TrueType
+ Open files, the available GSUB and GPOS tables are also shown.
+
+ The `total memory used' reported is the amount that is used by
+ the engine to load one face, with one instance (a point size).
+
+ Each additional instance takes only a fraction of that amount,
+ and is labeled by `instance object'. As you can see, FreeType
+ isn't really greedy.
+
+ Usage: ftdump fontpathname[.ttf|.ttc]
+
+ 6. FTSTRING
+ -----------
+
+ This program demonstrates string text generation. It only
+ displays a given message on the screen, and lets you resize it
+ with the classic key bindings `u', `j', `+', and `-'.
+
+ Usage:
+
+ ftstring ptsize fontname[.ttf|.ttc] [message_string]
+
+ If the message is omitted, it will revert to the classic
+ typographic test sentence:
+
+ The quick brown fox jumps over the lazy dog
+
+ which is made of all letters of the English alphabet.
+
+ `ftstring' only works with font files that contain a Unicode
+ character mapping table (either Windows Unicode or Apple
+ Unicode). For the moment, the message can however only be
+ written in ASCII, as accents aren't supported yet.
+
+ 7. FTSTRPNM
+ -----------
+
+ Usage:
+
+ ftstrpnm [options] filename [string]
+
+ Options:
+
+ -g gray-level rendering (default: off)
+ -h hinting off (default: on)
+ -r X resolution X dpi (default: 96)
+ -p X pointsize X pt (default: 12)
+ -b X border X pixels wide (default: 0)
+
+ This program is quite similar to ftstring but converts the
+ rendered image of the specified string into a bitmap in PBM or
+ PGM format written to stdout; PBM (Portable BitMap) and PGM
+ (Portable GrayMap) formats can be further converted to popular
+ graphics formats like GIF or PNG with the netpbm tool suite
+ available via Internet.
+
+ 8. FTERROR
+ ----------
+
+ This program tests the gettext() functionality on UNIX platforms
+ (usually provided in the GNU gettext package). It will return
+ language specific error and warning messages depending on your
+ locale. Currently Czech, Dutch, French, German, and Spanish
+ translations of the FreeType messages are included -- we invite
+ you to contribute more translations.
+
+ Typically, you have to set the LANG environment variable to your
+ locale to get localized messages. Example:
+
+ LANG=de fterror
+
+ fterror also gives you a textual interpretation of a particular
+ (numerical) error code, as returned by the Freetype library.
+ Example:
+
+ LANG=fr fterror 0x40E
+
+ Note that providing message strings for FreeType's error and
+ warning messages is an extension and not part of the FreeType
+ library itself. Please refer to `docs/i18n.txt' for further
+ details.
+
+ 9. FTSBIT
+ ---------
+
+ Usage:
+
+ ftsbit ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]
+
+ This tool dumps the information in the tables for embedded
+ bitmaps. Additionally, it prints (to the console) a selected
+ glyph bitmap.
+
+ 10. FTMETRIC
+ ------------
+
+ Usage:
+
+ ftmetric [options below] point fontname[.ttf|.ttc] ...
+
+ -B show sbit's metrics (default: none)
+ -c C use C'th font index of TrueType collection
+ (default: 0)
+ -i index glyph index (default: 0)
+ -r R use resolution R dpi (default: 72dpi)
+
+ With this small program you can inspect the metric data of a
+ given glyph; additionally, it dumps the particular glyph to the
+ console.
+
+ 11. FTSTRTTO
+ ------------
+
+ Usage:
+
+ ftstrtto [options below] ppem fontname[.ttf|.ttc] [string|-]
+
+ -c C use font with index C in TrueType collection
+ (default: 0)
+ -f F use feature F (can be specified more than once)
+ -g gray-level rendering
+ -l L use language L
+ -r R use resolution R dpi (default: 96dpi)
+ -s S use script S
+ -u interpret input data as UTF8-encoded
+ -v display string vertically
+ -x display string from right to left
+
+ F, L, and S must be specified as 4-character tags.
+ Specifying only F and S selects default language system of S.
+ Specifying only L and S selects the req. feature of L only
+ (if any).
+
+ If `-' is specified as input string, stdin is read instead.
+
+ This program uses almost all features of FreeType to display a
+ string on screen. Its usage is similar to `ftstring', but you
+ can additionally select GSUB and GPOS features, the collection
+ in a font, toggle kerning and embedded bitmaps interactively,
+ and input the optional string in UTF8 encoding.
+
+ For a list of available script, language, and feature tags
+ please refer to the TrueType Open (resp. OpenType)
+ specification.
+
+ Example:
+
+ ftstrtto -s "latn" -l "DEU " -f "liga" -f "frac" \
+ 40 pala.ttf "fi ff ffi ffl 1/2"
+
+ Note that you can inspect the available tags in a font with
+ `ftdump'.
+
+ The features `init', `medi', and `fina', and `isol' are treated
+ specially. Internally, ftstrtto assigns initial, medial,
+ isolated, and final properties to Arabic characters in the input
+ string. If one of the features is switched on, all glyphs with
+ the corresponding property are modified (if covered).
+
+ Example:
+
+ ftstrtto -s arab -f init -f medi -f fina -f isol \
+ -f liga -f mset -x -u 20 trado.ttf - < arab.utf8
+
+ `mset' is another, Arabic specific feature to position combining
+ marks.
+
+ If you select the swash feature `swsh', the displayed
+ alternative in the string is always the first available one.
+
+
+
+IV. HOW TO USE THE PROGRAMS IN THE `CONTRIB' DIRECTORY
+======================================================
+
+ These programs are contributions to FreeType and not really part
+ of it. Please read the documentation files in the respective
+ subdirectories how to compile and install them.
+
+
+V. FINAL REMARKS
+================
+
+Of course, all source code is provided `as is'. Please read the
+file `license.txt' for more information.
+
+We hope you will find this engine useful, and look forward to file.
+your feed-back. We're of course very interested in bug reports, as
+well as FreeType success stories :-)
+
+
+Thanks for your time and consideration,
+
+
+ David Turner, Robert Wilhelm, Werner Lemberg,
+ and all the FreeType enthusiasts...
+
+
+--- end of README ---
diff --git a/Build/source/libs/freetype/aclocal.m4 b/Build/source/libs/freetype/aclocal.m4
new file mode 100644
index 00000000000..47abe430644
--- /dev/null
+++ b/Build/source/libs/freetype/aclocal.m4
@@ -0,0 +1,430 @@
+## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
+## Copyright (C) 1996-1999 Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+changequote(,)dnl
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$lt_target" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library, adds --enable-ltdl-convenience to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library, and adds --enable-ltdl-install to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
diff --git a/Build/source/libs/freetype/announce b/Build/source/libs/freetype/announce
new file mode 100644
index 00000000000..60318b40423
--- /dev/null
+++ b/Build/source/libs/freetype/announce
@@ -0,0 +1,68 @@
+
+
+ Announcing
+
+
+ F R E E T Y P E 1 . 4 . 9
+
+
+ The FREE TrueType Font Engine
+
+
+ Copyright (C) 1996-2001 The FreeType Development Team
+
+
+
+ The FreeType engine is a free and portable TrueType font rendering
+ engine, available in ANSI C and Pascal source code. It has been
+ developed to provide TrueType support to a great variety of
+ platforms and environments.
+
+ Notice that FreeType is a *library*. It is *not* a font server
+ for your preferred environment, even though it has been designed
+ to be the basis of many high-level libraries, tools and font
+ servers.
+
+
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+
+ WE HAVE RECENTLY DISCOVERED THAT APPLE OWNS SEVERAL PATENTS
+ RELATED TO THE RENDERING OF TRUETYPE FONTS. THIS COULD MEAN THAT
+ THE FREE USE OF THE FREETYPE LIBRARY MIGHT BE ILLEGAL IN FRANCE,
+ UK, USA, AND POSSIBLY OTHER COUNTRIES. FOR MORE INFORMATION, WE
+ STRONGLY ADVISE YOU TO GO TO THE FREETYPE WEB SITE AT:
+
+ http://www.freetype.org/patents.html
+
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
+
+
+ It's a clean-room implementation that is not derived from the
+ original TrueType engine developed by Apple and Microsoft, though
+ it matches it regarding rendering quality. To our knowledge, it's
+ the only royalty-free complete TrueType engine available.
+
+ Some news:
+
+ . version 1.5 fixes minor bugs found in 1.3.1.
+ . version 1.4 were never released officially (by us).
+ . full support for GSUB and GPOS tables in OpenType fonts.
+ . enhanced ftdump/ftstrtto test programs using GPOS support.
+ . ftstrpnm supports coloured text.
+ . TT_Char_Index() now uses a TT_ULong for char codes.
+ . support files for BeOS.
+ . the Pascal version is no longer part of the package but is
+ available separately.
+ . uses a new version of libtool, solving some compilation problems
+ with the test programs on some platforms like Solaris.
+
+
+ For more information, please visit the freetype web site at:
+
+ http://www.freetype.org
diff --git a/Build/source/libs/freetype/config.guess b/Build/source/libs/freetype/config.guess
new file mode 100755
index 00000000000..d0d57f6945f
--- /dev/null
+++ b/Build/source/libs/freetype/config.guess
@@ -0,0 +1,1465 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-09-19'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ x86:Interix*:[34]*)
+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+ exit ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Build/source/libs/freetype/config.sub b/Build/source/libs/freetype/config.sub
new file mode 100755
index 00000000000..1c366dfde9a
--- /dev/null
+++ b/Build/source/libs/freetype/config.sub
@@ -0,0 +1,1579 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ms1 \
+ | msp430 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | ms1-* \
+ | msp430-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ m32c-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/Build/source/libs/freetype/configure b/Build/source/libs/freetype/configure
new file mode 100755
index 00000000000..18f2d7908ae
--- /dev/null
+++ b/Build/source/libs/freetype/configure
@@ -0,0 +1,5027 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-static[=PKGS] build static libraries [default=no]"
+ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
+ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+ac_help="$ac_help
+ --disable-nls don't use NLS"
+ac_help="$ac_help
+ --with-locale-dir=DIR Location of the locale file(s)
+ [PREFIX/share/locale]"
+ac_help="$ac_help
+ --with-x use the X Window System"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+ac_config_files=
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; }
+ fi
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=lib/freetype.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+srcdir=`cd $srcdir; pwd`
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=no
+fi
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:658: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:679: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:699: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:730: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:761: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:813: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:846: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 857 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:888: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:893: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:921: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:964: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:988: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:991: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1026: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1042: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi
+fi
+
+NM="$ac_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1078: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+# MS-DOS is a special case, because it sort of pretends that ln -s
+# works for executables.
+if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+libtool_flags="$libtool_flags --enable-win32-dll"
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 1135 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1157: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1162 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+*-*-cygwin* | *-*-mingw*)
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1192: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+ echo "$ac_t""$DLLTOOL" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_DLLTOOL"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1225: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_DLLTOOL="dlltool"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+ echo "$ac_t""$DLLTOOL" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ DLLTOOL="false"
+fi
+fi
+
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1261: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+ echo "$ac_t""$AS" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_AS"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1294: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_AS="as"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+ echo "$ac_t""$AS" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ AS="false"
+fi
+fi
+
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1330: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+ echo "$ac_t""$OBJDUMP" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_OBJDUMP"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1363: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_OBJDUMP="objdump"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+ echo "$ac_t""$OBJDUMP" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ OBJDUMP="false"
+fi
+fi
+
+ ;;
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+freetype_version='1.5'
+
+version_info='6:0:4'
+
+# Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=no
+else
+ USE_NLS=yes
+fi
+
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:1522: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:1543: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1561: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1587: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1618: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1670: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1703: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1714 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1745: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1750: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1778: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1810: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1825 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1842 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1859 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+
+
+if test "x$CC" = xgcc; then
+ XX_CFLAGS="-Wall -pedantic -ansi -D_REENTRANT"
+else
+ case "$host" in
+ *-dec-osf*)
+ XX_CFLAGS="-std1 -O2 -g3"
+ ;;
+ *)
+ XX_CFLAGS=
+ ;;
+ esac
+fi
+
+
+
+case "$host" in
+ *-dec-osf*)
+ ln -s ../../MakeSub lib/arch
+ ln -s ../../MakeSub test/arch
+ ;;
+esac
+
+
+
+
+
+
+if test "$USE_NLS" = "yes"; then
+
+ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1921: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+for ac_hdr in locale.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1951: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1956 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in setlocale
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1990: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1995 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+ for ac_hdr in libintl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2048: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2053 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+ ALL_LINGUAS="de fr cs nl es"
+
+ LIBINTL=
+ LTLIBINTL=
+
+ echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6
+echo "configure:2092: checking for GNU gettext in libc" >&5
+if eval "test \"`echo '$''{'ftgt_cv_func_gnugettext_libc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2097 "configure"
+#include "confdefs.h"
+
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+
+int main() {
+
+bindtextdomain ("", "");
+return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings
+
+; return 0; }
+EOF
+if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ftgt_cv_func_gnugettext_libc=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ftgt_cv_func_gnugettext_libc=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ftgt_cv_func_gnugettext_libc" 1>&6
+
+ if test "$ftgt_cv_func_gnugettext_libc" != "yes"; then
+ echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
+echo "configure:2127: checking for gettext in -lintl" >&5
+ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2135 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gettext();
+
+int main() {
+gettext()
+; return 0; }
+EOF
+if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo intl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lintl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ if test "$ac_cv_lib_intl_gettext" != "yes"; then
+ echo $ac_n "checking for GNU gettext in libintl, using libiconv""... $ac_c" 1>&6
+echo "configure:2176: checking for GNU gettext in libintl, using libiconv" >&5
+if eval "test \"`echo '$''{'ftgt_cv_func_gnugettext_libintliconv'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+echo "configure:2181: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl -liconv $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2189 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char bindtextdomain();
+
+int main() {
+bindtextdomain()
+; return 0; }
+EOF
+if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ftgt_cv_func_gnugettext_libintliconv=yes LIBS="$LIBS -lintl -liconv"
+else
+ echo "$ac_t""no" 1>&6
+ftgt_cv_func_gnugettext_libintliconv=no
+ USE_NLS=no
+fi
+
+fi
+
+echo "$ac_t""$ftgt_cv_func_gnugettext_libintliconv" 1>&6
+ fi
+ fi
+fi
+
+if test "$USE_NLS" = "yes"; then
+ LOCALEDIR='${prefix}/share/locale'
+ # Check whether --with-locale-dir or --without-locale-dir was given.
+if test "${with_locale_dir+set}" = set; then
+ withval="$with_locale_dir"
+
+ if test x$withval = xyes; then
+ echo "configure: warning: Usage is: --with-locale-dir=basedir" 1>&2
+ else
+ if test x$withval = xno; then
+ echo "configure: warning: Usage is: --with-locale-dir=basedir" 1>&2
+ else
+ LOCALEDIR=$withval
+ fi
+ fi
+
+fi
+
+
+
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2252: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*|[A-z]:/*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -n "$MSGFMT"; then
+ for ac_func in dcgettext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2290: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2295 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2345: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*|[A-z]:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2382: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*|[A-z]:/*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="$XGETTEXT"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2419: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGMERGE'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGMERGE" in
+ /*|[A-z]:/*)
+ ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_path_MSGMERGE="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE="$MSGMERGE"
+ ;;
+esac
+fi
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test -n "$MSGMERGE"; then
+ echo "$ac_t""$MSGMERGE" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ if test -n "$XGETTEXT"; then
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6
+ XGETTEXT=""
+ fi
+ fi
+
+ if test -n "$XGETTEXT"; then
+ if $XGETTEXT --help > /dev/null 2> /dev/null; then
+ : ;
+ else
+ echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6
+ XGETTEXT=""
+ fi
+ fi
+
+ if test -n "$MSGFMT"; then
+ if $MSGFMT < /dev/null 2> /dev/null; then
+ echo "$ac_t""found msgfmt program is not GNU msgfmt; NLS won't be installed" 1>&6
+ MSGFMT=""
+ fi
+ fi
+
+ cat > conftest.$ac_ext <<EOF
+#line 2480 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:2488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+fi
+rm -f conftest*
+ INSTOBJEXT=.mo
+ fi
+
+ if test -n "$ALL_LINGUAS"; then
+ for lang in $ALL_LINGUAS; do
+ CATALOGS="$CATALOGS $lang$CATOBJEXT"
+ done
+ fi
+
+
+
+
+fi
+
+if test x"$MSGFMT" = x; then
+ USE_NLS=no
+fi
+
+
+# Extract the first word of "rm", so it can be a program name with args.
+set dummy rm; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2522: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RM"; then
+ ac_cv_prog_RM="$RM" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_RM="rm"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+RM="$ac_cv_prog_RM"
+if test -n "$RM"; then
+ echo "$ac_t""$RM" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "rmdir", so it can be a program name with args.
+set dummy rmdir; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2552: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RMDIR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RMDIR"; then
+ ac_cv_prog_RMDIR="$RMDIR" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_RMDIR="rmdir"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+RMDIR="$ac_cv_prog_RMDIR"
+if test -n "$RMDIR"; then
+ echo "$ac_t""$RMDIR" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:2591: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ # Hack for MSDOS and descendants.
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test $ac_x $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:2646: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+# MS-DOS is a special case, because it sort of pretends that ln -s
+# works for executables.
+if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ # Most operating systems have gethostbyname() in the default searched
+ # libraries (i.e. libc):
+ echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:2675: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2680 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostbyname(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+# Some OSes (eg. Solaris) place it in libnsl:
+ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:2722: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2730 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:2741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+# Some strange OSes (SINIX) have it in libsocket:
+ echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6
+echo "configure:2768: checking for gethostbyname in -lsocket" >&5
+ac_lib_var=`echo socket'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2776 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+# Unfortunately libsocket sometimes depends on libnsl.
+ # AC_CHECK_LIB's API is essentially broken so the following
+ # ugliness is necessary:
+ echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6
+echo "configure:2816: checking for gethostbyname in -lsocket" >&5
+ac_lib_var=`echo socket'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket -lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2824 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:2835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="-lsocket -lnsl $LIBS"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for gethostbyname in -lresolv""... $ac_c" 1>&6
+echo "configure:2854: checking for gethostbyname in -lresolv" >&5
+ac_lib_var=`echo resolv'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lresolv $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2862 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:2873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lresolv $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ echo $ac_n "checking for socket""... $ac_c" 1>&6
+echo "configure:2912: checking for socket" >&5
+if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2917 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char socket(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char socket();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_socket) || defined (__stub___socket)
+choke me
+#else
+socket();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_socket=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_socket=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+echo "configure:2958: checking for socket in -lsocket" >&5
+ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2966 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char socket();
+
+int main() {
+socket()
+; return 0; }
+EOF
+if { (eval echo configure:2977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+echo "configure:3003: checking for socket in -lsocket" >&5
+ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket -lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3011 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char socket();
+
+int main() {
+socket()
+; return 0; }
+EOF
+if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="-lsocket -lnsl $LIBS"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+
+echo $ac_n "checking for cos in -lm""... $ac_c" 1>&6
+echo "configure:3048: checking for cos in -lm" >&5
+ac_lib_var=`echo m'_'cos | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3056 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char cos();
+
+int main() {
+cos()
+; return 0; }
+EOF
+if { (eval echo configure:3067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lm $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+# If we find X, set shell vars x_includes and x_libraries to the
+# paths, otherwise set no_x=yes.
+# Uses ac_ vars as temps to allow command line to override cache and checks.
+# --without-x overrides everything else, but does not touch the cache.
+echo $ac_n "checking for X""... $ac_c" 1>&6
+echo "configure:3100: checking for X" >&5
+
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+ withval="$with_x"
+ :
+fi
+
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+ # The user explicitly disabled X.
+ have_x=disabled
+else
+ if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+ # Both variables are already set.
+ have_x=yes
+ else
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=NO ac_x_libraries=NO
+rm -fr conftestdir
+if mkdir conftestdir; then
+ cd conftestdir
+ # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+ cat > Imakefile <<'EOF'
+acfindx:
+ @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+EOF
+ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+ eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+ for ac_extension in a so sl; do
+ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+ test -f $ac_im_libdir/libX11.$ac_extension; then
+ ac_im_usrlibdir=$ac_im_libdir; break
+ fi
+ done
+ # Screen out bogus values from the imake configuration. They are
+ # bogus both because they are the default anyway, and because
+ # using them would break gcc on systems where it needs fixed includes.
+ case "$ac_im_incroot" in
+ /usr/include) ;;
+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+ esac
+ case "$ac_im_usrlibdir" in
+ /usr/lib | /lib) ;;
+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+ esac
+ fi
+ cd ..
+ rm -fr conftestdir
+fi
+
+if test "$ac_x_includes" = NO; then
+ # Guess where to find include files, by looking for this one X11 .h file.
+ test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+
+ # First, try using that file with no special directory specified.
+cat > conftest.$ac_ext <<EOF
+#line 3162 "configure"
+#include "confdefs.h"
+#include <$x_direct_test_include>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ # Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ for ac_dir in \
+ /usr/X11/include \
+ /usr/X11R6/include \
+ /usr/X11R5/include \
+ /usr/X11R4/include \
+ \
+ /usr/include/X11 \
+ /usr/include/X11R6 \
+ /usr/include/X11R5 \
+ /usr/include/X11R4 \
+ \
+ /usr/local/X11/include \
+ /usr/local/X11R6/include \
+ /usr/local/X11R5/include \
+ /usr/local/X11R4/include \
+ \
+ /usr/local/include/X11 \
+ /usr/local/include/X11R6 \
+ /usr/local/include/X11R5 \
+ /usr/local/include/X11R4 \
+ \
+ /usr/X386/include \
+ /usr/x386/include \
+ /usr/XFree86/include/X11 \
+ \
+ /usr/include \
+ /usr/local/include \
+ /usr/unsupported/include \
+ /usr/athena/include \
+ /usr/local/x11r5/include \
+ /usr/lpp/Xamples/include \
+ \
+ /usr/openwin/include \
+ /usr/openwin/share/include \
+ ; \
+ do
+ if test -r "$ac_dir/$x_direct_test_include"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+ done
+fi
+rm -f conftest*
+fi # $ac_x_includes = NO
+
+if test "$ac_x_libraries" = NO; then
+ # Check for the libraries.
+
+ test -z "$x_direct_test_library" && x_direct_test_library=Xt
+ test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+ test -z "$x_direct_test_arguments" && x_direct_test_arguments=1
+
+ # See if we find them without any special options.
+ # Don't add to $LIBS permanently.
+ ac_save_LIBS="$LIBS"
+ LIBS="-l$x_direct_test_library $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3237 "configure"
+#include "confdefs.h"
+#include <${x_direct_test_include}>
+int main() {
+${x_direct_test_function}(${x_direct_test_arguments})
+; return 0; }
+EOF
+if { (eval echo configure:3244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ LIBS="$ac_save_LIBS"
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ LIBS="$ac_save_LIBS"
+# First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
+ /usr/X11/lib \
+ /usr/X11R6/lib \
+ /usr/X11R5/lib \
+ /usr/X11R4/lib \
+ \
+ /usr/lib/X11 \
+ /usr/lib/X11R6 \
+ /usr/lib/X11R5 \
+ /usr/lib/X11R4 \
+ \
+ /usr/local/X11/lib \
+ /usr/local/X11R6/lib \
+ /usr/local/X11R5/lib \
+ /usr/local/X11R4/lib \
+ \
+ /usr/local/lib/X11 \
+ /usr/local/lib/X11R6 \
+ /usr/local/lib/X11R5 \
+ /usr/local/lib/X11R4 \
+ \
+ /usr/X386/lib \
+ /usr/x386/lib \
+ /usr/XFree86/lib/X11 \
+ \
+ /usr/lib \
+ /usr/local/lib \
+ /usr/unsupported/lib \
+ /usr/athena/lib \
+ /usr/local/x11r5/lib \
+ /usr/lpp/Xamples/lib \
+ /lib/usr/lib/X11 \
+ \
+ /usr/openwin/lib \
+ /usr/openwin/share/lib \
+ ; \
+do
+ for ac_extension in a so sl; do
+ if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+ ac_x_libraries=$ac_dir
+ break 2
+ fi
+ done
+done
+fi
+rm -f conftest*
+fi # $ac_x_libraries = NO
+
+if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+ # Didn't find X anywhere. Cache the known absence of X.
+ ac_cv_have_x="have_x=no"
+else
+ # Record where we found X for the cache.
+ ac_cv_have_x="have_x=yes \
+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+ fi
+ eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+ echo "$ac_t""$have_x" 1>&6
+ no_x=yes
+else
+ # If each of the values was on the command line, it overrides each guess.
+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+ # Update the cache value to reflect the command line values.
+ ac_cv_have_x="have_x=yes \
+ ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+ echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+fi
+
+if test "$no_x" = yes; then
+ # Not all programs may use this symbol, but it does not hurt to define it.
+ cat >> confdefs.h <<\EOF
+#define X_DISPLAY_MISSING 1
+EOF
+
+ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+ if test -n "$x_includes"; then
+ X_CFLAGS="$X_CFLAGS -I$x_includes"
+ fi
+
+ # It would also be nice to do this for all -L options, not just this one.
+ if test -n "$x_libraries"; then
+ X_LIBS="$X_LIBS -L$x_libraries"
+ # For Solaris; some versions of Sun CC require a space after -R and
+ # others require no space. Words are not sufficient . . . .
+ case "`(uname -sr) 2>/dev/null`" in
+ "SunOS 5"*)
+ echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
+echo "configure:3350: checking whether -R must be followed by a space" >&5
+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
+ cat > conftest.$ac_ext <<EOF
+#line 3353 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_R_nospace=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_R_nospace=no
+fi
+rm -f conftest*
+ if test $ac_R_nospace = yes; then
+ echo "$ac_t""no" 1>&6
+ X_LIBS="$X_LIBS -R$x_libraries"
+ else
+ LIBS="$ac_xsave_LIBS -R $x_libraries"
+ cat > conftest.$ac_ext <<EOF
+#line 3376 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_R_space=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_R_space=no
+fi
+rm -f conftest*
+ if test $ac_R_space = yes; then
+ echo "$ac_t""yes" 1>&6
+ X_LIBS="$X_LIBS -R $x_libraries"
+ else
+ echo "$ac_t""neither works" 1>&6
+ fi
+ fi
+ LIBS="$ac_xsave_LIBS"
+ ;;
+ OSF1*|IRIX*)
+ # OSF1 refers to Dec-Unix. -rpath is required in du 4.0 - at least
+ # -rpath is required in irix 5.x and 6.x - at least
+ # (Is -rpath really needed in IRIX? OJM)
+ X_LIBS="$X_LIBS -Wl,-rpath,$x_libraries"
+ ;;
+ esac
+ fi
+
+ # Check for system-dependent libraries X programs must link with.
+ # Do this before checking for the system-independent R6 libraries
+ # (-lICE), since we may need -lsocket or whatever for X linking.
+
+ if test "$ISC" = yes; then
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+ else
+ # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
+ # libraries were built with DECnet support. And karl@cs.umb.edu says
+ # the Alpha needs dnet_stub (dnet does not exist).
+ echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
+echo "configure:3422: checking for dnet_ntoa in -ldnet" >&5
+ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldnet $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3430 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dnet_ntoa();
+
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:3441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+ echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
+echo "configure:3463: checking for dnet_ntoa in -ldnet_stub" >&5
+ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldnet_stub $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3471 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dnet_ntoa();
+
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:3482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+ # to get the SysV transport functions.
+ # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
+ # needs -lnsl.
+ # The nsl library prevents programs from opening the X display
+ # on Irix 5.2, according to dickey@clark.net.
+ echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:3511: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3516 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostbyname(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_gethostbyname = no; then
+ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:3560: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3568 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:3579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # lieder@skyler.mavd.honeywell.com says without -lsocket,
+ # socket/setsockopt and other routines are undefined under SCO ODT
+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
+ # on later versions), says simon@lia.di.epfl.ch: it contains
+ # gethostby* variants that don't use the nameserver (or something).
+ # -lsocket must be given before -lnsl if both are needed.
+ # We assume that if connect needs -lnsl, so does gethostbyname.
+ echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:3609: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3614 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char connect(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_connect=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_connect=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_connect = no; then
+ echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:3658: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3666 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+connect()
+; return 0; }
+EOF
+if { (eval echo configure:3677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
+ echo $ac_n "checking for remove""... $ac_c" 1>&6
+echo "configure:3701: checking for remove" >&5
+if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3706 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char remove(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char remove();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_remove) || defined (__stub___remove)
+choke me
+#else
+remove();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_remove=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_remove=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_remove = no; then
+ echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
+echo "configure:3750: checking for remove in -lposix" >&5
+ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lposix $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3758 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char remove();
+
+int main() {
+remove()
+; return 0; }
+EOF
+if { (eval echo configure:3769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+ echo $ac_n "checking for shmat""... $ac_c" 1>&6
+echo "configure:3793: checking for shmat" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3798 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shmat(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shmat();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_shmat) || defined (__stub___shmat)
+choke me
+#else
+shmat();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shmat=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_shmat=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_shmat = no; then
+ echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
+echo "configure:3842: checking for shmat in -lipc" >&5
+ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lipc $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3850 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shmat();
+
+int main() {
+shmat()
+; return 0; }
+EOF
+if { (eval echo configure:3861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ fi
+
+ # Check for libraries that X11R6 Xt/Xaw programs need.
+ ac_save_LDFLAGS="$LDFLAGS"
+ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+ # check for ICE first), but we must link in the order -lSM -lICE or
+ # we get undefined symbols. So assume we have SM if we have ICE.
+ # These have to be linked with before -lX11, unlike the other
+ # libraries we check for below, so use a different variable.
+ # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+ echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
+echo "configure:3894: checking for IceConnectionNumber in -lICE" >&5
+ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3902 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char IceConnectionNumber();
+
+int main() {
+IceConnectionNumber()
+; return 0; }
+EOF
+if { (eval echo configure:3913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ LDFLAGS="$ac_save_LDFLAGS"
+
+fi
+
+if test "$no_x" = yes; then
+ echo "configure: warning: Test programs needing X11 won't be compiled." 1>&2
+else
+ X_PROGRAMS="\$(X_PROGRAMS)"
+
+fi
+
+for ac_hdr in stdlib.h fcntl.h unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3948: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3953 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:3986: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3991 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:4040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking size of int""... $ac_c" 1>&6
+echo "configure:4061: checking size of int" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4069 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(int));
+ exit(0);
+}
+EOF
+if { (eval echo configure:4080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_int=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_int=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_int" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+EOF
+
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:4100: checking size of long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4108 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:4144: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4149 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4183: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4188 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:4236: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4244 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propogated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+
+ /*
+ * First, make a file with some known garbage in it.
+ */
+ data = malloc(pagesize);
+ if (!data)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand();
+ umask(0);
+ fd = creat("conftestmmap", 0600);
+ if (fd < 0)
+ exit(1);
+ if (write(fd, data, pagesize) != pagesize)
+ exit(1);
+ close(fd);
+
+ /*
+ * Next, try to mmap the file at a fixed address which
+ * already has something else allocated at it. If we can,
+ * also make sure that we see the same garbage.
+ */
+ fd = open("conftestmmap", O_RDWR);
+ if (fd < 0)
+ exit(1);
+ data2 = malloc(2 * pagesize);
+ if (!data2)
+ exit(1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit(1);
+
+ /*
+ * Finally, make sure that changes to the mapped area
+ * do not percolate back to the file as seen by read().
+ * (This is a bug on some variants of i386 svr4.0.)
+ */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = malloc(pagesize);
+ if (!data3)
+ exit(1);
+ if (read(fd, data3, pagesize) != pagesize)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit(1);
+ close(fd);
+ unlink("conftestmmap");
+ exit(0);
+}
+
+EOF
+if { (eval echo configure:4384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
+ TT_FILE_COMPONENT=ttfile.c
+else
+ TT_FILE_COMPONENT=arch/unix/ttmmap.c
+fi
+
+
+for ac_func in memcpy memmove
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4416: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4421 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+$srcdir/mkinstalldirs lib/arch/unix test/arch/unix
+
+ac_config_files="$ac_config_files Makefile
+ MakeSub
+ lib/arch/unix/Makefile
+ test/arch/unix/Makefile
+ po/Makefile.in"
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+
+trap 'rm -fr `echo "$ac_config_files ft_conf.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
+s%@LN_S@%$LN_S%g
+s%@DLLTOOL@%$DLLTOOL%g
+s%@AS@%$AS%g
+s%@OBJDUMP@%$OBJDUMP%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@USE_NLS@%$USE_NLS%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@CPP@%$CPP%g
+s%@XX_CFLAGS@%$XX_CFLAGS%g
+s%@freetype_version@%$freetype_version%g
+s%@version_info@%$version_info%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@HAVE_LOCALE_H@%$HAVE_LOCALE_H%g
+s%@HAVE_LIBINTL_H@%$HAVE_LIBINTL_H%g
+s%@LOCALEDIR@%$LOCALEDIR%g
+s%@MSGFMT@%$MSGFMT%g
+s%@GMSGFMT@%$GMSGFMT%g
+s%@XGETTEXT@%$XGETTEXT%g
+s%@MSGMERGE@%$MSGMERGE%g
+s%@CATALOGS@%$CATALOGS%g
+s%@CATOBJEXT@%$CATOBJEXT%g
+s%@INSTOBJEXT@%$INSTOBJEXT%g
+s%@DATADIRNAME@%$DATADIRNAME%g
+s%@RM@%$RM%g
+s%@RMDIR@%$RMDIR%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@X_CFLAGS@%$X_CFLAGS%g
+s%@X_PRE_LIBS@%$X_PRE_LIBS%g
+s%@X_LIBS@%$X_LIBS%g
+s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
+s%@X_PROGRAMS@%$X_PROGRAMS%g
+s%@TT_FILE_COMPONENT@%$TT_FILE_COMPONENT%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*|[A-z]:/*) # Absolute path.
+ srcdir="$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ rm -f conftest.in
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+ #
+ # Replace lines of the form ac_include foo with the contents of foo:
+ # first, from the ac_include lines construct a list of file names.
+ # From that list, we construct a second list of those files that exist.
+ # Then we construct lists of sed commands for including those files,
+ # and a sed command that removes the ac_include lines. We don't attempt
+ # to read non-existent files because some (buggy) versions of sed choke
+ # on this. Have to use sed because old (Ultrix, SunOS) awk does not support
+ # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+ # Can't use only one -e and commands {dr foo} because foo has to be last.
+ # Be careful, because the filename may contain /. Be careful with
+ # whitespace; we need to use echo.
+ #
+ file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in`
+ # Create the sed command line ...
+ if test -n "$file_substs"; then
+ echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2
+ file_subst_cmd="sed -e 's/^ac_include/kpse_include/'"
+ else
+ file_subst_cmd='sed'
+ fi
+ kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in`
+ for ac_inc in $file_substs $kpse_substs; do
+ if test -f "$ac_given_srcdir/$ac_inc"; then
+ ac_mung=`echo $ac_inc | sed 's,/,%,g'`
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'"
+ fi
+ done
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'"
+ # ... and fix the whitespace and escaped slashes.
+ file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \
+-e 's/kpse_include /kpse_include[ ]*/g'`
+ # I can't find any way to do variable substitution in the sed commands
+ # (so the user could have, e.g., $top_srcdir in their ac_include line).
+ (eval $file_subst_cmd conftest.in) \
+ | sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s* conftest.in
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS=" ft_conf.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file and --srcdir arguments so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $ac_configure_args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case "$ac_arg" in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ for ac_config_dir in : $subdirs; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ if test ! -d $srcdir/$ac_config_dir; then
+ continue
+ fi
+
+ echo configuring in $ac_config_dir
+
+ case "$srcdir" in
+ .) ;;
+ *)
+ if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+ else
+ { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+ fi
+ ;;
+ esac
+
+ ac_popdir=`pwd`
+ cd $ac_config_dir
+
+ # A "../" for each directory in /$ac_config_dir.
+ ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+
+ case "$srcdir" in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ /*|[A-z]:/*) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f ./configure; then
+ ac_sub_configure=./configure
+ elif test -f $ac_sub_srcdir/configure; then
+ ac_sub_configure=$ac_sub_srcdir/configure
+ elif test -f $ac_sub_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ then :
+ else
+ { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+ fi
+ fi
+
+ cd $ac_popdir
+ done
+fi
+
+
+
diff --git a/Build/source/libs/freetype/configure.in b/Build/source/libs/freetype/configure.in
new file mode 100644
index 00000000000..5b921af78b3
--- /dev/null
+++ b/Build/source/libs/freetype/configure.in
@@ -0,0 +1,262 @@
+dnl This file is part of the FreeType project, and may only be used,
+dnl modified, and distributed under the terms of the FreeType project
+dnl license, LICENSE.TXT. By continuing to use, modify, or distribute
+dnl this file you indicate that you have read the license and understand
+dnl and accept it fully.
+dnl
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(lib/freetype.h)
+
+dnl Due to a bug in autoconf we must set $srcdir explicitly to an absolute
+dnl path.
+srcdir=`cd $srcdir; pwd`
+
+AM_DISABLE_STATIC
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+
+dnl FreeType version
+freetype_version='1.5'
+
+dnl libttf.so version
+version_info='6:0:4'
+
+AC_ARG_ENABLE(nls,
+ [ --disable-nls don't use NLS],
+ USE_NLS=no, USE_NLS=yes)
+AC_SUBST(USE_NLS)
+
+dnl Checks for system type.
+AC_CANONICAL_SYSTEM
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CPP
+
+dnl get Compiler flags right.
+
+if test "x$CC" = xgcc; then
+ XX_CFLAGS="-Wall -pedantic -ansi -D_REENTRANT"
+else
+ case "$host" in
+ *-dec-osf*)
+ XX_CFLAGS="-std1 -O2 -g3"
+ ;;
+ *)
+ XX_CFLAGS=
+ ;;
+ esac
+fi
+AC_SUBST(XX_CFLAGS)
+
+dnl at least Digital UNIX 4.0d needs this due to a strange make program
+
+case "$host" in
+ *-dec-osf*)
+ ln -s ../../MakeSub lib/arch
+ ln -s ../../MakeSub test/arch
+ ;;
+esac
+
+AC_SUBST(freetype_version)
+AC_SUBST(version_info)
+
+
+dnl NLS/gettext nightmare^H^H^H^H^H^H^H^H^H^H support...
+
+if test "$USE_NLS" = "yes"; then
+ AC_REQUIRE([AC_PROG_MAKE_SET])
+ AC_CHECK_HEADERS(locale.h)
+ AC_CHECK_FUNCS(setlocale)
+ AC_SUBST(HAVE_LOCALE_H)
+
+ AC_CHECK_HEADERS(libintl.h)
+ AC_SUBST(HAVE_LIBINTL_H)
+
+ ALL_LINGUAS="de fr cs nl es"
+
+ dnl We now need to check whether the "intl" library is available.
+ dnl The bad news is that a number of possibilities can happen:
+ dnl a) GNU gettext support is already available from the (modern) libc
+ dnl b) some version of gettext is available as standalone "intl" lib
+ dnl No real problem (this was the only case previously detected)
+ dnl c) a recent version of gettext is used, and it needs the
+ dnl (separate) "iconv" library to work
+ dnl
+ dnl This test has been adapted from gettext.m4, written by Bruno Haible
+ LIBINTL=
+ LTLIBINTL=
+
+ dnl First, test case a)
+ AC_CACHE_CHECK([for GNU gettext in libc], ftgt_cv_func_gnugettext_libc,
+ [AC_TRY_LINK([
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+ ],[
+bindtextdomain ("", "");
+return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings
+ ], ftgt_cv_func_gnugettext_libc=yes,
+ ftgt_cv_func_gnugettext_libc=no)])
+
+ if test "$ftgt_cv_func_gnugettext_libc" != "yes"; then
+ dnl It does not come for free. Let's check case b),
+ dnl id est see whether libintl exists and does not depend on libiconv.
+ AC_CHECK_LIB(intl, gettext)
+
+ if test "$ac_cv_lib_intl_gettext" != "yes"; then
+ dnl Does not work; so let's check case c),
+ dnl id est see whether libintl exists and depends on libiconv.
+ AC_CACHE_CHECK([for GNU gettext in libintl, using libiconv],
+ ftgt_cv_func_gnugettext_libintliconv,
+ [AC_CHECK_LIB(intl, bindtextdomain,
+ ftgt_cv_func_gnugettext_libintliconv=yes LIBS="$LIBS -lintl -liconv",
+ [ftgt_cv_func_gnugettext_libintliconv=no
+ dnl No NLS support then!
+ USE_NLS=no],
+ -liconv)])
+ fi
+ fi
+fi
+
+if test "$USE_NLS" = "yes"; then
+ dnl Handle localedir
+ LOCALEDIR='${prefix}/share/locale'
+ AC_ARG_WITH(locale-dir,
+ [ --with-locale-dir=DIR Location of the locale file(s)
+ [PREFIX/share/locale]],[
+ if test x$withval = xyes; then
+ AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
+ else
+ if test x$withval = xno; then
+ AC_MSG_WARN(Usage is: --with-locale-dir=basedir)
+ else
+ LOCALEDIR=$withval
+ fi
+ fi
+ ])
+ AC_SUBST(LOCALEDIR)
+
+ AC_PATH_PROG(MSGFMT, msgfmt, $MSGFMT)
+ if test -n "$MSGFMT"; then
+ AC_CHECK_FUNCS(dcgettext)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AC_PATH_PROG(XGETTEXT, xgettext, $XGETTEXT)
+ AC_PATH_PROG(MSGMERGE, msgmerge, $MSGMERGE)
+
+ dnl Test whether we really found GNU xgettext.
+ if test -n "$XGETTEXT"; then
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext program is not GNU xgettext; ignore it])
+ XGETTEXT=""
+ fi
+ fi
+
+ dnl We add another test for comparing GNU xgettext with openwin xgettext
+ if test -n "$XGETTEXT"; then
+ if $XGETTEXT --help > /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext program is not GNU xgettext; ignore it])
+ XGETTEXT=""
+ fi
+ fi
+
+ dnl Test whether we really found GNU msgfmt.
+ if test -n "$MSGFMT"; then
+ if $MSGFMT < /dev/null 2> /dev/null; then
+ AC_MSG_RESULT(
+ [found msgfmt program is not GNU msgfmt; NLS won't be installed])
+ MSGFMT=""
+ fi
+ fi
+
+ AC_TRY_LINK(,
+ [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [CATOBJEXT=.mo
+ DATADIRNAME=lib])
+ INSTOBJEXT=.mo
+ fi
+
+ if test -n "$ALL_LINGUAS"; then
+ for lang in $ALL_LINGUAS; do
+ CATALOGS="$CATALOGS $lang$CATOBJEXT"
+ done
+ fi
+ AC_SUBST(CATALOGS)
+ AC_SUBST(CATOBJEXT)
+ AC_SUBST(INSTOBJEXT)
+ AC_SUBST(DATADIRNAME)
+fi
+
+dnl don't use NLS, when there is no gettext installed
+if test x"$MSGFMT" = x; then
+ USE_NLS=no
+fi
+
+
+AC_CHECK_PROG(RM, rm, rm)
+AC_CHECK_PROG(RMDIR, rmdir, rmdir)
+AC_PROG_INSTALL
+AC_PROG_LN_S
+
+dnl Checks for libraries.
+sinclude(net.m4)
+AC_LIBRARY_NET
+AC_CHECK_LIB(m, cos)
+
+dnl Checks for header files.
+AC_PATH_XTRA
+dnl Don't compile X programs (and emit a warning message)
+dnl if X isn't available.
+if test "$no_x" = yes; then
+ AC_MSG_WARN([Test programs needing X11 won't be compiled.])
+else
+ X_PROGRAMS="\$(X_PROGRAMS)"
+ AC_SUBST(X_PROGRAMS)
+fi
+
+AC_CHECK_HEADERS(stdlib.h fcntl.h unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+
+dnl Checks for library functions.
+
+dnl Here we check whether we can use our mmap file component.
+AC_FUNC_MMAP
+if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
+ TT_FILE_COMPONENT=ttfile.c
+else
+ TT_FILE_COMPONENT=arch/unix/ttmmap.c
+fi
+AC_SUBST(TT_FILE_COMPONENT)
+
+AC_CHECK_FUNCS(memcpy memmove)
+
+AC_CONFIG_HEADER(ft_conf.h)
+
+dnl Another bug: to make --srcdir work correctly we have to create the
+dnl directory hierarchy first since autoconf only uses mkdir.
+$srcdir/mkinstalldirs lib/arch/unix test/arch/unix
+
+KPSE_CONFIG_FILES(Makefile
+ MakeSub
+ lib/arch/unix/Makefile
+ test/arch/unix/Makefile
+ po/Makefile.in,
+ [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
+AC_OUTPUT
+
+
+dnl end of configure.in
diff --git a/Build/source/libs/freetype/docs/FAQ b/Build/source/libs/freetype/docs/FAQ
new file mode 100644
index 00000000000..3e80f2b69ba
--- /dev/null
+++ b/Build/source/libs/freetype/docs/FAQ
@@ -0,0 +1,843 @@
+ FreeType 1 User FAQ
+
+--------------------------------------------------------------------
+
+
+ Table of contents
+
+
+1. How do I compile the test programs?
+
+2. What are the test programs?
+
+3. How do I use them?
+
+4. How do I only compile the FreeType library?
+
+5. The library compiles fine on my system, unfortunately it seems
+ the test programs won't. What can I do?
+
+6. I did compile the test programs `out of the box' without
+ problems, but the results are ugly. What did I have wrong?
+
+7. What is FreeType, and what is it not?
+
+8. Can FreeType be ported to other platforms?
+
+9. My TrueType font only works on a Mac/in Windows. Will I be able
+ to use it with FreeType?
+
+10. What are the most common character mappings?
+
+11. How do I render text with FreeType?
+
+12. How do I render rotated/slanted text with FreeType?
+
+13. How do I compute a glyph bitmap's dimensions?
+
+14. Why is text rendering so slow? Does FreeType cache glyphs?
+
+15. Do you always render the same glyphs as Windows or the Mac?
+
+16. The program `ftlint' reports errors with one of my fonts, though
+ it works perfectly under Windows. What does this mean?
+
+17. What does the `fttimer' test program benchmarks?
+
+18. Is it possible to perform styling (like oblique, italic, bold,
+ underline, etc.) with FreeType?
+
+19. When does glyph hinting takes place? Is it when the glyph is
+ loaded, or when it is converted to a bitmap/pixmap?
+
+20. Which is the best, caching outlines or bitmaps?
+
+21. Can I open OpenType and/or TrueType GX fonts with FreeType?
+
+22. How can I access additional TrueType tables that FreeType
+ doesn't support?
+
+23. When will I be able to use FreeType to display TrueType fonts in
+ X11, Wine, or OS/2, or even other systems?
+
+24. What does the `free' in FreeType really means?
+
+25. Does FreeType support threads? Is it re-entrant?
+
+26. Does FreeType support `foreign languages'?
+
+27. I'm using fractional char sizes, but the glyphs stay at the same
+ integer size. Why?
+
+28. Hinting doesn't work at very small sizes. Why?
+
+--------------------------------------------------------------------
+
+1. How do I compile the test programs?
+
+ Detailed compilation steps are given in the `freetype/INSTALL'
+ file, as well as system and compiler specific hints in the
+ `freetype/howto' directory. What follows is a _very_ simple
+ guide:
+
+ For Unix:
+
+ Do the following on the prompt while in the base directory of
+ the FreeType package:
+
+ % ./configure
+ % make
+ % make install
+
+ This will build and install the library (shared, if supported)
+ together with the test programs. Say `./configure --help' to
+ see the available configuring options.
+
+ This should work with any ANSI C compiler.
+
+ For other platforms:
+
+ Go to the `test' directory. Look at one of the makefiles
+ located in the `arch/<system>' directory, and use the
+ appropriate makefile from there.
+
+ For example:
+
+ make -f arch/msdos/makefile.gcc (DJGPP or emx)
+ wmake -f=arch\msdos\makefile.wat (Watcom DOS)
+ nmake -f arch\os2\makefile.icc (Visual Age OS/2)
+ make -f arch/amigaos/makefile.gcc (GCC Amiga)
+
+ This will compile both the library and the test programs.
+
+
+--------------------------------------------------------------------
+
+2. What are the test programs?
+
+ The test programs are simple sources that `show off' the FreeType
+ library. They are located in the `test' directory. They make use
+ of a small graphics sub-system which is able to display bitmaps
+ and pixmaps on a variety of platforms through the use of
+ system-specific `drivers'.
+
+ The test programs are:
+
+ ftdump: A simple TTF information dumper. Also prints the
+ memory used by each opened font file with FreeType.
+ Doesn't use the graphics sub-system.
+
+ ftlint: A simple TrueType bytecode verifier. It simply hints
+ all glyphs of one or more font files at a given size
+ and reports errors. Doesn't use the graphics
+ sub-system.
+
+ ftview: A simple font viewer. Displays all glyphs in a font
+ file in a window.
+
+ ftstring: Renders a simple string to the screen. Demonstrates
+ how to produce text with FreeType.
+
+ fttimer: A simple benchmark, used to profile the scan-line
+ conversion routines (and only them). Supports also
+ display.
+
+ ftstrpnm: A version of `ftstring' which saves a bit/pixmap to a
+ PNM file rather than to the screen. No graphics
+ sub-system needed.
+
+ ftzoom: A simple glyph viewer, useful to view, zoom and rotate
+ individual glyphs in a font file.
+
+ fterror: This program demonstrates how to use the ftxerr18
+ extension. Note that internationalized strings will
+ be available on some platforms only (e.g. Linux).
+
+ ftmetric: A simple metric/glyph dumper. No graphics sub-system
+ needed.
+
+ ftsbit: Displays data about embedded bitmaps in a TrueType
+ font.
+
+ ftstrtto: Renders a string to screen, using TrueType Open
+ features.
+
+ NOTE: The file `ftdebug.c' isn't part of the test suite. It is
+ used only by the developers team to debug the engine at a
+ higher level. It won't work with a standard library
+ compile.
+
+
+ The tiny graphics subsystem is defined in the following files:
+
+ gmain.h/gmain.c: The subsystem's main body/interface.
+
+ gevents.h: The definition of events defined for the
+ subsystem
+
+ gdriver.h: The generic interface of all system-specific
+ drivers.
+
+ System-specific drivers are in the `test/arch/<system>'
+ directories, like:
+
+ test/arch/msdos/gfs_dos.c Full-Screen DOS driver
+ test/arch/os2/gpm_os2.c PM (Windowed) OS/2 driver
+ test/arch/unix/gwin_x11.c X11 Windowed driver
+
+ etc.
+
+
+--------------------------------------------------------------------
+
+3. How do I use them?
+
+ Please read the file freetype/README for a full description.
+
+
+--------------------------------------------------------------------
+
+4. How do I only compile the FreeType library?
+
+ For Unix:
+
+ Do a `configure' run as described in section 1. Then change to
+ the lib subdirectory and say `make' and `make install'.
+
+ For other platforms:
+
+ Go to the `lib' directory. Look at one of the makefiles located
+ in the `arch/<system>' directory, and use it from `lib'.
+
+ For example:
+
+ make -f arch/msdos/makefile.gcc (DJGPP or emx)
+ wmake -f=arch\msdos\makefile.wat (Watcom DOS)
+ nmake -f arch\os2\makefile.icc (Visual Age OS/2)
+ make -f arch/amigaos/makefile.gcc (GCC Amiga)
+
+ The library is pure ANSI C and doesn't depend on any
+ system-specific package. You do not need gcc to compile it.
+
+
+--------------------------------------------------------------------
+
+5. The library compiles fine on my system, unfortunately it seems
+ the test programs won't. What can I do?
+
+ As said before, some test programs rely on a small graphics
+ sub-system to display the bitmaps and pixmaps produced by the
+ library. The following systems are currently supported:
+
+ DOS Full-Screen Note that the windowed graphics
+ Amiga Full-Screen driver are very 'basic', they do
+ Amiga Windowed not provide menus, dialog boxes,
+ OS/2 Full-Screen etc. Rather, they provide one
+ OS/2 Windowed windowed bitmap/pixmap and translate
+ X11 Windowed events to the ones defined in
+ Win32 Windowed `test/gevents'.
+
+ If you want to add support to your system, you should write a new
+ graphics driver. To do that, read the file `test/gdriver.h' which
+ contains the driver generic interface, then browse the drivers
+ that are already provided.
+
+ The graphics drivers are located in the `test/arch/<system>'
+ directories. They're not part of the library proper.
+
+ IMPORTANT NOTE:
+
+ You can also directly link the library to your own application
+ and render glyphs directly into your own bitmaps with very few
+ efforts.
+
+
+--------------------------------------------------------------------
+
+6. I did compile the test programs `out of the box' without
+ problems, but the results are ugly. What did I have wrong?
+
+ Well, chances are you built the `patents-free' version of the
+ Freetype library, which does not enable the bytecode interpreter,
+ which means that at small to normal point sizes, the glyphs are
+ distorded, hence ugly.
+
+ Apple Computer owns three patents that are related to the
+ processing of glyph outlines within TrueType fonts. This process
+ if also called hinting or grid-fitting and is used to enhance the
+ quality of glyphs at small bitmap sizes.
+
+ When the work with Freetype began, we were not aware of these
+ patents. Since version 1.3, however, we have provided a way to
+ build a patent-compliant version of the library, which completely
+ disables the TrueType interpreter (quite a rude way). If the
+ result is usable with big point sizes, or for special tasks such
+ as font converting, it results about useless for normal screen
+ reading. Beginning with version 1.5, this behaviour is even by
+ default, so this is what you get if you compile `out of the box'.
+
+ However, the source code for the bytecode interpreter is still
+ available and can be activated at compile time, for those who
+ want to use it anyway (because they purchased a license from
+ Apple, or because they are in a country where the patents do not
+ apply, etc.). For details, check the `freetype/INSTALL' file.
+
+
+--------------------------------------------------------------------
+
+7. What is FreeType, and what is it not?
+
+ FreeType is a rather low-level font engine. It has been designed
+ primarily to be the basis of several font servers, for very
+ different systems which all have their own metrics and graphics
+ models. This means that it focuses on the following points:
+
+ - Opening and loading font files in memory.
+
+ - Giving access to most important font properties and TrueType
+ tables.
+
+ - Providing a simple way to translate system-specific character
+ codes into glyph indexes, according to the TrueType `cmap'
+ specification.
+
+ - Loading and rendering _individual_ glyphs as nicely as possible
+ (either in outlines, bitmaps, or pixmaps), and performing
+ excellent hinting.
+
+ It isn't a high-level text rendering library, and many tasks will
+ have to be performed by higher level layers like:
+
+ - glyph caching (outlines and/or maps)
+ - text rendering
+ - justification, kerning
+ - font mapping
+ - rotated/slanted text
+
+ However, its API provides many functions that ease these
+ operations considerably:
+
+ - Glyph outlines can be copied and transformed easily with the API
+ functions, then rendered to bitmaps or pixmaps with FreeType's
+ scan-line converter, which is very fast.
+
+ - The glyph loader places the outlines in order to ease the
+ process of text rendering. See the documentation file named
+ `glyphs.htm' (resp. `glyphs.txt') or `ftstring's source for more
+ details.
+
+ - The engine gives you access to several TrueType tables that can
+ be processed by your application to provide more powerful
+ rendering (e.g. kerning).
+
+ - It is possible, and rather simple, to write separately
+ compilable extensions to the engine to access other TrueType
+ tables that are not supported by the engine in this release.
+ This can be handy if one wants to access data in TrueType GX or
+ OpenType fonts (as these formats comply to the TrueType `sfnt'
+ file storage format, they can be opened by the FreeType engine
+ as a normal TrueType file).
+
+
+--------------------------------------------------------------------
+
+8. Can FreeType be ported to other platforms?
+
+ FreeType is written in pure ANSI C and should compile well on all
+ 16, 32, and 64 bit processors. Note, however, that the 16-bit
+ port requires a large memory model. Furthermore, some tables
+ found in TrueType programs may exceed 64 kBytes, which calls for
+ the so-called huge memory model. This is really true for CJK and
+ Unicode fonts. Nearly all others should work fine with the large
+ model.
+
+ It does not support some very exotic platforms though, like a
+ 32-bit only processor (where the only word size is 32-bit, even
+ for chars and shorts). However, nothing prevents you to test it
+ by yourself...
+
+ The memory management and file access routines have been gathered
+ in two components, namely `ttmemory' and `ttfile', which can be
+ specialized for a specific system. Their standard version, found
+ in the `lib' directory, uses simply the ANSI libc. However,
+ examples are given of alternative file components for OS/2 and
+ Unix in:
+
+ lib/arch/os2/ttfile.c
+ (accessing the low-level OS/2 file API directly)
+
+ lib/arch/unix/ttmmap.c
+ (using memory-mapped files for improved access)
+
+ You would certainly need to rewrite these components if you intend
+ to use FreeType in an embedded system.
+
+
+--------------------------------------------------------------------
+
+9. My TrueType font only works on a Mac/in Windows. Will I be able
+ to use it with FreeType?
+
+ Short Answer: YES, but be cautious!
+
+ If you have read section 9 or 25, you know that a font file might
+ have different charMaps entries, used to translate character codes
+ to glyph indexes. The problem of most `system-specific' TrueType
+ fonts (sigh) is that they only contain one single mapping, like
+ Apple Roman, or Windows Glyph List, making it usable only on the
+ platform it was `designed' for.
+
+ The test program `ftdump' can be used to display the character
+ encodings supported in a font file. Most fonts come with Apple
+ Roman and Windows Unicode.
+
+ FreeType can use every charmap found in a font file, so it is up
+ to your application to choose the one that fits its task best. If
+ you use a font which only provides an Apple Roman charcode, you'll
+ probably have a hard time rendering Unicode strings without an
+ additional translation.
+
+ Note that the tool `ttf_edit' can actually add missing cmaps to a
+ TrueType font file. More info on this can be found at:
+
+ http://www.truetex.com
+
+ Another possibility is to use Just van Rossum's TTX compiler
+ (still beta) which can convert a TrueType font into an XML
+ description and vice versa; it can be found at
+
+ http://www.letterror.com/ttx/
+ http://sourceforge.net/projects/fonttools/
+
+
+--------------------------------------------------------------------
+
+10. What are the most common character mappings?
+
+ If you don't want to read the TrueType specification, here is some
+ information about the most used char maps. Each map is designed
+ by a `platform ID', followed by a platform-specific `encoding ID':
+
+ Examples:
+
+ 0, 0 : Apple Unicode
+ 1, 0 : Apple Roman
+ 3, 0 : Windows Symbol
+ 3, 1 : Windows Unicode
+
+ Windows and Apple Unicode charmaps differ only in internal storage
+ layout. Both can be used transparently with FreeType.
+
+ Many fonts come also with both Apple Roman and Windows Unicode.
+
+
+--------------------------------------------------------------------
+
+11. How do I render text with FreeType?
+
+ This is explained with great detail in the glyphs documentation
+ file available in both text (glyphs.txt) and HTML (glyphs.htm,
+ including schematics).
+
+ Text rendering isn't difficult. One can also look at the code for
+ `ftstring' or `ftstrtto' to see how it is done.
+
+
+--------------------------------------------------------------------
+
+12. How do I render rotated/slanted text with FreeType?
+
+ It is possible to transform the outlines returned by the glyph
+ loader, hence producing rotated or slanted text. Please read the
+ `glyphs' documentation file, which explains this in great detail,
+ as well as some other important things.
+
+
+--------------------------------------------------------------------
+
+13. How do I compute a glyph bitmap's dimensions?
+
+ You should grid-fit its bounding box, then compute its width and
+ height. This is explained in the `bitmaps.txt' documentation
+ file.
+
+
+--------------------------------------------------------------------
+
+14. Why is text rendering so slow?
+ Does FreeType cache glyphs?
+
+ The FreeType 1 engine doesn't cache anything, be it outlines or
+ bitmaps. Hence, a program that renders text by calling the glyph
+ loader on each letter is slow.
+
+ Because caching cannot be performed in both an _easy_ and
+ _portable_ way it is left to the application. Moreover, some
+ graphics systems already provide some sort of caching, and it is
+ better to take advantage of it rather than re-implementing it.
+
+ The `how's and `when's of caching are explained in the `glyphs'
+ documentation file. The `bitmaps' documentation file is also a
+ good source of information if you intend to render individual
+ glyph bitmaps.
+
+
+--------------------------------------------------------------------
+
+15. Do you always render the same glyphs as Windows or the Mac?
+
+ Short answer: No for rare cases.
+
+ There are a lot of technical details, too numerous and lengthy to
+ be put here, that prevents the FreeType library from matching 100%
+ the glyphs produced by the Windows or Macintosh rasterizers.
+
+ This engine is a clean-room implementation, and most of the
+ reasons why its development took so much time is the largely
+ deficient TrueType specification published by Apple and Microsoft.
+ A number of key technical aspects are missing, and we found many
+ `undocumented' features in the TrueType bytecode, after several
+ months of testing and trying. We are now very satisfied with the
+ current quality, though still try to improve it.
+
+ The glyph metrics (bearings and advances) also match significantly
+ those computed by Windows, or found in the TrueType pre-calc
+ tables.
+
+ As hinting glyphs also makes use of several rounding operations,
+ we will be unable to provide a perfect clone unless we implement
+ the exact same computations _and_ rounding errors -- this is
+ very unlikely...
+
+
+--------------------------------------------------------------------
+
+16. The program `ftlint' reports errors with one of my fonts, though
+ it works perfectly under Windows. What does this mean?
+
+ Associated to each glyph is a small `program', written in a
+ specific bytecode language, which is in charge of hinting the
+ glyph's outline to make it perfect on screen as on paper. Some of
+ these programs can be broken (e.g., accessing invalid areas of
+ memory, performing a divide by zero, etc.), and these are the
+ errors that are reported by `ftlint'.
+
+ They can also mean a bug in the TrueType bytecode interpreter (or
+ more likely an `undocumented' feature we haven't discovered yet),
+ but should now be extremely rare.
+
+ Surprisingly, even largely distributed fonts can contain broken
+ glyph programs. For example:
+
+ - antqua.ttf, glyph 163 (MS Office 4.2):
+
+ The program tries to access point number 0x127, which is too
+ much.
+
+ - timesbs, arialbs, courbs (MS Office International):
+
+ The back-slanted versions of the MS core fonts produce stack
+ overflows in many glyphs, and other oddities. It seems their
+ `maximum profile' table is invalid.
+
+ - a ton of `free' fonts, apparently designed with mediocre tools.
+
+ It seems the Windows TrueType engine doesn't check its arguments
+ often, and let all overflows run, possibly writing to critical
+ portions of memory. Please, don't ask us what this could do to
+ Windows NT :-)
+
+ The FreeType engine performs checks on every opcode. We cannot
+ guarantee that it is bullet proof, of course, but it seems to work
+ well and catch font bugs accordingly.
+
+ We also have artificially `enlarged' some allocated tables to make
+ the engine work with the back-slanted fonts without compromising
+ security, but it's clearly a hack we would have preferred to
+ avoid!
+
+
+--------------------------------------------------------------------
+
+17. What does the `fttimer' test program benchmarks?
+
+ This test program is only dedicated to profiling FreeType's
+ scan-line converter, a component also called `rasterizer', which
+ is in charge of converting a vectorial outline into a bitmap, or a
+ pixmap.
+
+ It simply loads all glyphs of a font file (by slices of 512 at
+ once), then converts them. Only the conversion is actually
+ benchmarked.
+
+ The glyphs are rendered at size 400pt at a resolution of 96dpi
+ (this is about 500 pixels high). As you'll see by running
+ `fttimer', the rasterizer is very fast.
+
+
+--------------------------------------------------------------------
+
+18. Is it possible to perform styling (like oblique, italic, bold,
+ underline, etc.) with FreeType?
+
+ Actually, these refer to very different things:
+
+ - Italic and Bold styles usually mean many variations from the
+ `Regular' font. This is why you normally need a proper font
+ file for each of these. For example, the MS core font Times
+ comes in the following TrueType files:
+
+ TIMES.TTF Times New Roman Regular
+ TIMESI.TTF Times New Roman Italic
+ TIMESB.TTF Times New Roman Bold
+ TIMESBI.TTF Times New Roman Bold Italic
+ (sometimes named TIMESZ.TTF)
+
+ With FreeType, you simply need the required font file to use it.
+
+ - Oblique style refers to a transformation that is applied to a
+ regular font in order to make it `slanted', likes italics do.
+ However, an italic font very frequently contains small but
+ important variations that cannot be produced by this method and
+ make the font more appealing.
+
+ Slanting can easily be done with a transformation under
+ FreeType, with the exact same process as rendering rotated text.
+ Please read the `glyphs' documentation file where it is
+ explained in details.
+
+ Usually, Windows or the Macintosh produce oblique versions of a
+ regular font if the corresponding italic TrueType file isn't
+ available. They also stretch regular fonts horizontally if the
+ bold one isn't available. All of this can be done with trivial
+ transformations.
+
+ - Underlining and stroking are not really part of the glyphs.
+ They're simply lines that are printed on the glyph after it has
+ been rendered. Each TrueType file provides, in its OS/2 table
+ (which is accessible through the face object properties in
+ FreeType), several values that define the position and width of
+ those lines, in notional font units.
+
+ If you want to use them, you'll have to scale these values to
+ your current instance/point size, then draw the lines yourself.
+
+
+--------------------------------------------------------------------
+
+19. When does glyph hinting takes place? Is it when the glyph is
+ loaded, or when it is converted to a bitmap/pixmap?
+
+ The glyph loader returns fitted outlines by default (it can be
+ asked to return a non-fitted one, or simply the original outline
+ in notional coordinates too).
+
+ This is important to have a glyph's correct metrics, even if it is
+ not to be rendered immediately, like when caching outlines for
+ rotated text.
+
+
+--------------------------------------------------------------------
+
+20. Which is the best, caching outlines or bitmaps?
+
+ It depends on your application, and what it does with text.
+
+ Usually, if all you need is render some simple text at specific
+ point sizes, then simply cache the bitmaps or pixmaps.
+
+ However, if you want to do more advanced things, like rotated
+ text, which require sub-pixel placement to look good, you should
+ then only cache the outlines, and transform/place them as needed
+ before sending them to the scan-line converter.
+
+ It's always possible to produce a bitmap from an outline, and the
+ scan-converter is very fast. It's up to you then...
+
+
+--------------------------------------------------------------------
+
+21. Can I open OpenType and/or TrueType GX fonts with FreeType?
+
+ TrueType GX fonts are normal TrueType fonts with enhanced tables
+ and capabilities. They can always be opened by a normal TrueType
+ engine (like Windows, the Mac, or FreeType), but their improved
+ features won't be available.
+
+ On the contrary, OpenType fonts may vary. While some may contain
+ legal TrueType glyphs, an `otf' file may only contain glyphs
+ encoded in the Type 2 format. You won't be able to produce any
+ glyphs from such a font file without a dedicated font engine (like
+ the ones promised in NT 5 and Java 2D... or with Freetype 2).
+
+ FreeType 1 is a TrueType glyph engine and doesn't support Type 2
+ fonts. Supporting them would require a very different philosophy
+ and a different core engine (even though they could share an API).
+
+ Note that you can write extensions to the engine to access
+ supplemental tables defined in these formats (see next question).
+
+ Note that FreeType version 2 (which is now widely available)
+ includes a PostScript Type 1 / Type 2 interpreter...
+
+
+--------------------------------------------------------------------
+
+22. How can I access additional TrueType tables that FreeType
+ doesn't support?
+
+ You can write an `engine extension'. This is a separately
+ compilable component which can enhance the base library's
+ functionalities, without recompiling it. Some important
+ extensions are provided in the `lib/extend' directory.
+
+ You'll need of course to know the TrueType specification
+ precisely, as well as some of the conventions used to access
+ tables and to manage memory. Read the documentation files for
+ more details, or contact the developers at:
+
+ devel@freetype.org
+
+
+--------------------------------------------------------------------
+
+23. When will I be able to use FreeType to display TrueType fonts in
+ X11, Wine or OS/2, or even other systems?
+
+ Actually, an OS/2 replacement for TRUETYPE.DLL based on FreeType
+ is part of this package (to be found in contrib/ftos2). Thanks go
+ to Michal Necasek (mike@mendelu.cz) for his excellent work!
+
+ At least three X11 TrueType font servers are available; two of
+ them (xfsft and xtt) are based on FreeType, whereas the third
+ (xfstt) uses a separately developed TrueType engine.
+
+ More information about these servers is available at the FreeType
+ homepage (http://www.freetype.org).
+
+ Don't hesitate to contact us if you plan to use or port the engine
+ to exotic platforms, we're always interested in helping out.
+
+
+--------------------------------------------------------------------
+
+24. What does the `free' in FreeType really means?
+
+ The previous releases of FreeType (alphas and beta) were placed
+ under the LGPL. FreeType 1.0, and later releases, come with an an
+ alternate license, inspired from the BSD, Artistic, and IJG's
+ (Independent JPEG Group) ones. In short:
+
+ - You are encouraged to use and distribute this program in all
+ kinds of products, including commercial ones.
+
+ - You don't have to pay us anything for it (royalty-free).
+
+ - You may not pretend you wrote it, or part of it that you may use
+ in one of your product, and you have to state clearly that you
+ use the FreeType code if you distribute products based on it, or
+ parts of it (credits clause).
+
+ - This source code is provided AS IS, with no warranty whatsoever,
+ and we cannot promise support for it.
+
+ From version 1.5 and later releases, we added the choice for the
+ user of the library to use the GNU General Public License instead.
+ As a result, you can link the Freetype library with any GPL-ed
+ software, without any inconvenience; however, you then have the
+ obligation to publish all of the source code of the products you
+ release.
+
+ The exact and legal terms are in the files `docs/FTL.txt' and
+ `docs/GPL.txt', respectively.
+
+ Enjoy ;-)
+
+
+--------------------------------------------------------------------
+
+25. Does FreeType support threads? Is it re-entrant?
+
+ Short answer: Basically yes, but not fully tested.
+
+ We have changed some code since FreeType 1.0 in order to support
+ multi-threaded environments. However, these have not been tested
+ yet. Apparently, the thread-safe and reentrant builds now work
+ well perfectly once compiled; however, no serious concurrency
+ testing has been performed (of course, a serious lock analysis was
+ done in order to modify the source).
+
+ Right now, the mutex management functions are all gathered in the
+ component `ttmutex', which has to be specialized for your own
+ system if a thread build will be necessary.
+
+
+--------------------------------------------------------------------
+
+26. Does FreeType support `foreign languages'?
+
+ Short Answer: YES, it does!
+
+ From a TrueType font file point of view, there are several parts
+ to the file, one of them being the `glyphs', i.e., picture
+ representations of the symbols.
+
+ Another part is the mapping table, also called `charMap'.
+
+ For example, glyph #1 could be letter `A', and glyph #2 could be
+ letter `Z'. Glyphs can be stored in any order in a font file.
+
+ The mapping tables contain at least one char-map entry. For
+ example, you could have an ASCII-map that maps character code 0x41
+ to glyph #1, and code 0x5A to glyph #2, etc. FreeType provides a
+ `charMap' object class to access and use this information easily.
+
+ There are several character encodings recognized and defined by
+ the TrueType specification, like Latin-1, Unicode, Apple Scripts,
+ WGL, etc., but a font file might only contain one or two of them.
+
+ When using a more `exotic' character encoding like EBCDIC (this is
+ IBM mainframe stuff!), you would need to translate it to one of
+ the available formats (or to add a charmap table to the font).
+ Cf. section 8.
+
+
+--------------------------------------------------------------------
+
+27. I'm using fractional char sizes, but the glyphs stay at the same
+ integer size. Why?
+
+ Because hinting only works well with integer pixel sizes. There
+ is a flag that can be set in a TrueType font file to force integer
+ pixel size scaling, even if you ask for fractional sizes with an
+ API function like TT_Set_Instance_CharSize(). Needless to say,
+ nearly all fonts have the flag set. So this is normal.
+
+ Also, notice that when giving a charsize in fractional points,
+ this will be converted to integer pixels with the formula:
+
+ pixel_size = char_size * y_resolution / 72
+
+ For example, using a resolution of 96 dpi, we would have:
+
+ 9.5 pts => 12.666 pixels => 13 pixels
+ 10.0 pts => 13.333 pixels => 13 pixels, i.e. same size
+ 10.5 pts => 14 pixels => 14 pixels
+ 11.0 pts => 14.666 pixels => 15 pixels
+ 11.5 pts => 15.333 pixels => 15 pixels, i.e. same size
+
+ If you want to control the exact size in pixels of your glyphs,
+ simply use a resolution of 72dpi, where char_size = pixel_size.
+
+
+--------------------------------------------------------------------
+
+28. Hinting doesn't work at very small sizes. Why?
+
+ This is normal. There are very good technical reasons why hinting
+ doesn't work well at sizes under 7 ppem, usually meaning the
+ appearance of ugly spikes and glyph distortions. This is why the
+ engine disables hinting by default at such low sizes.
+
+
+--- end of FAQ ---
diff --git a/Build/source/libs/freetype/docs/FTL.txt b/Build/source/libs/freetype/docs/FTL.txt
new file mode 100644
index 00000000000..be596b35e4c
--- /dev/null
+++ b/Build/source/libs/freetype/docs/FTL.txt
@@ -0,0 +1,165 @@
+ The FreeType Project LICENSE
+ ----------------------------
+
+ 2000-Feb-08
+
+ Copyright 1996-2002 by
+ David Turner, Robert Wilhelm, and Werner Lemberg
+
+ Minor editings 2001-Mar-01
+
+
+
+Introduction
+============
+
+ The FreeType Project is distributed in several archive packages;
+ some of them may contain, in addition to the FreeType font engine,
+ various tools and contributions which rely on, or relate to, the
+ FreeType Project.
+
+ This license applies to all files found in such packages, and
+ which do not fall under their own explicit license. The license
+ affects thus the FreeType font engine, the test programs,
+ documentation and makefiles, at the very least.
+
+ This license was inspired by the BSD, Artistic, and IJG
+ (Independent JPEG Group) licenses, which all encourage inclusion
+ and use of free software in commercial and freeware products
+ alike. As a consequence, its main points are that:
+
+ o We don't promise that this software works. However, we will be
+ interested in any kind of bug reports. (`as is' distribution)
+
+ o You can use this software for whatever you want, in parts or
+ full form, without having to pay us. (`royalty-free' usage)
+
+ o You may not pretend that you wrote this software. If you use
+ it, or only parts of it, in a program, you must acknowledge
+ somewhere in your documentation that you have used the
+ FreeType code. (`credits')
+
+ We specifically permit and encourage the inclusion of this
+ software, with or without modifications, in commercial products.
+ We disclaim all warranties covering The FreeType Project and
+ assume no liability related to The FreeType Project.
+
+
+Legal Terms
+===========
+
+0. Definitions
+--------------
+
+ Throughout this license, the terms `package', `FreeType Project',
+ and `FreeType archive' refer to the set of files originally
+ distributed by the authors (David Turner, Robert Wilhelm, and
+ Werner Lemberg) as the `FreeType Project', be they named as alpha,
+ beta or final release.
+
+ `You' refers to the licensee, or person using the project, where
+ `using' is a generic term including compiling the project's source
+ code as well as linking it to form a `program' or `executable'.
+ This program is referred to as `a program using the FreeType
+ engine'.
+
+ This license applies to all files distributed in the original
+ FreeType Project, including all source code, binaries and
+ documentation, unless otherwise stated in the file in its
+ original, unmodified form as distributed in the original archive.
+ If you are unsure whether or not a particular file is covered by
+ this license, you must contact us to verify this.
+
+ The FreeType Project is copyright (C) 1996-2002 by David Turner,
+ Robert Wilhelm, and Werner Lemberg. All rights reserved except as
+ specified below.
+
+1. No Warranty
+--------------
+
+ THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
+ USE, OF THE FREETYPE PROJECT.
+
+2. Redistribution
+-----------------
+
+ This license grants a worldwide, royalty-free, perpetual and
+ irrevocable right and license to use, execute, perform, compile,
+ display, copy, create derivative works of, distribute and
+ sublicense the FreeType Project (in both source and object code
+ forms) and derivative works thereof for any purpose; and to
+ authorize others to exercise some or all of the rights granted
+ herein, subject to the following conditions:
+
+ o Redistribution of source code must retain this license file
+ unaltered; any additions, deletions or changes to the original
+ files must be clearly indicated in accompanying documentation.
+ The copyright notices of the unaltered, original files must be
+ preserved in all copies of source files.
+
+ o Redistribution in binary form must provide a disclaimer that
+ states that the software is based in part of the work of the
+ FreeType Team, in the distribution documentation. We also
+ encourage you to put an URL to the FreeType web page in your
+ documentation, though this isn't mandatory.
+
+ These conditions apply to any software derived from or based on
+ the FreeType Project, not just the unmodified files. If you use
+ our work, you must acknowledge us. However, no fee need be paid
+ to us.
+
+3. Advertising
+--------------
+
+ Neither the FreeType authors and contributors nor you shall use
+ the name of the other for commercial, advertising, or promotional
+ purposes without specific prior written permission.
+
+ We suggest, but do not require, that you use one or more of the
+ following phrases to refer to this software in your documentation
+ or advertising materials: `FreeType Project', `FreeType Engine',
+ `FreeType library', or `FreeType Distribution'.
+
+ As you have not signed this license, you are not required to
+ accept it. However, as the FreeType Project is copyrighted
+ material, only this license, or another one contracted with the
+ authors, grants you the right to use, distribute, and modify it.
+ Therefore, by using, distributing, or modifying the FreeType
+ Project, you indicate that you understand and accept all the terms
+ of this license.
+
+4. Contacts
+-----------
+
+ There are two mailing lists related to FreeType:
+
+ o freetype@freetype.org
+
+ Discusses general use and applications of FreeType, as well as
+ future and wanted additions to the library and distribution.
+ If you are looking for support, start in this list if you
+ haven't found anything to help you in the documentation.
+
+ o devel@freetype.org
+
+ Discusses bugs, as well as engine internals, design issues,
+ specific licenses, porting, etc.
+
+ o http://www.freetype.org
+
+ Holds the current FreeType web page, which will allow you to
+ download our latest development version and read online
+ documentation.
+
+ You can also contact us individually at:
+
+ David Turner <david.turner@freetype.org>
+ Robert Wilhelm <robert.wilhelm@freetype.org>
+ Werner Lemberg <werner.lemberg@freetype.org>
+
+
+--- end of FTL.txt ---
diff --git a/Build/source/libs/freetype/docs/GPL.txt b/Build/source/libs/freetype/docs/GPL.txt
new file mode 100644
index 00000000000..e8a612e5c3b
--- /dev/null
+++ b/Build/source/libs/freetype/docs/GPL.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Build/source/libs/freetype/docs/apiref.txt b/Build/source/libs/freetype/docs/apiref.txt
new file mode 100644
index 00000000000..b40e66d93d1
--- /dev/null
+++ b/Build/source/libs/freetype/docs/apiref.txt
@@ -0,0 +1,1918 @@
+ The FreeType Engine
+
+ Core Library Reference
+
+
+ -----------------------------------
+
+
+ Table of Contents:
+
+ Introduction
+
+ I. Types
+
+ II. Functions
+
+ III. Error codes
+
+
+ --------------------
+
+
+Introduction
+============
+
+ This reference presents the types, functions, and error codes
+ defined in the high-level API header file `freetype.h'. Note that
+ all symbols defined in this file are prefixed by `TT_' to avoid
+ conflict of names with other packages at link time.
+
+ The reference for extensions of the FreeType library can be found
+ in the file `apirefx.txt'.
+
+
+
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+
+
+
+I. Types
+========
+
+ Here is the list of all types defined in the core FreeType API.
+ Their exact definition can be found in the file `freetype.h' which
+ should be included in every client application.
+
+
+ TT_Bool
+
+ Can be either non-zero (true) or zero (false).
+
+ ..................................................................
+
+ TT_Fixed
+
+ A signed 16.16 fixed float integer type used to specify
+ transform coefficients and other important data.
+
+ ..................................................................
+
+ TT_FWord
+
+ A signed 16-bit type used to express a distance measured in the
+ font's original EM units. These are also called `FUnits' in the
+ TrueType specification.
+
+ ..................................................................
+
+ TT_UFWord
+
+ An unsigned 16-bit type.
+
+ ..................................................................
+
+ TT_String
+ TT_Char
+ TT_Byte
+
+ These types represent various 8-bit integer values (for strings,
+ signed, and unsigned values, respectively).
+
+ ..................................................................
+
+ TT_Short
+ TT_UShort
+ TT_Long
+ TT_ULong
+
+ These four types are aliases for 16-bit integer (signed and
+ unsigned) and 32-bit integer types (signed and unsigned).
+
+ ..................................................................
+
+ TT_Int
+
+ A signed type, either 16-bit or 32-bit, whichever is the most
+ efficient for the target platform.
+
+ ..................................................................
+
+ TT_F2Dot14
+
+ A 2.14 fixed float integer type used for unary vectors and some
+ scaling coefficients. Its layout is:
+
+ s : 1 -- sign bit
+ m : 1 -- mantissa bit
+ f : 14 -- unsigned fractional value
+
+ where `s:m' denotes a 2-bit signed integer value to which the
+ positive fractional part `f' should always be added.
+
+ ..................................................................
+
+ TT_F26Dot6
+
+ A 26.6 fixed float integer format used to define fractional
+ pixel coordinates. Here, 1 unit = 1/64 pixel.
+
+ ..................................................................
+
+ TT_Pos
+
+ This type is used to store point coordinates, either in
+ fractional pixels (26.6 fixed floats) or in EM units (simple
+ integers).
+
+ The interpretation of the value depends on the context. For
+ example, all distances relative to a scaled glyph are expressed
+ in fractional pixels (including bearings, advances, etc).
+ However, the same distances are measured in notional font units
+ when the glyph has been loaded unscaled.
+
+ ..................................................................
+
+ TT_UnitVector
+
+ A simple structure used to store a unit vector. The vector's
+ coordinates are expressed in fixed float format (2.14).
+
+ struct
+ {
+ TT_F2Dot14 x;
+ TT_F2Dot14 y;
+ }
+
+ ..................................................................
+
+ TT_Vector
+
+ A simple structure used to store a single vector. Its
+ coordinates are expressed in fixed float format (26.6).
+
+ struct
+ {
+ TT_F26Dot6 x;
+ TT_F26Dot6 y;
+ }
+
+ ..................................................................
+
+ TT_Matrix
+
+ A simple structure used to store a single 2x2 matrix. Its
+ coefficients are expressed in 16.16 fixed float format. This
+ matrix is used to perform linear transformations on the glyph
+ outline, such as slanting or rotation.
+
+ struct
+ {
+ TT_Fixed xx, xy;
+ TT_Fixed yx, yy;
+ };
+
+ The computation performed is:
+
+ x' = xx * x + xy * y
+ y' = yx * x + yy * y
+
+ ..................................................................
+
+ TT_BBox
+
+ A simple type to hold a glyph's bounding box. Used by the
+ TT_Get_Outline_BBox() API.
+
+ struct
+ {
+ TT_Pos xMin, yMin;
+ TT_Pos xMax, yMax;
+ }
+
+ ..................................................................
+
+ TT_Outline
+
+ Outlines are represented from now on as a class in itself, with
+ their own API.
+
+ This structure is used to describe a vectorial glyph
+ representation to the rasterizer. It consists of several fields
+ as described below. Note however that:
+
+ ***** THIS STRUCTURE MAY CHANGE IN THE FUTURE. We thus
+ ***** encourage you to use the outlines APIs described below to
+ ***** process your outlines i.e., create/copy/translate/
+ ***** transform them, as well as rendering bitmaps and pixmaps.
+
+ ***** THE STRUCTURE CHANGED BETWEEN 1.0 and 1.1!
+
+ Now that you have been warned, the fields are:
+
+ - An array of points:
+
+ The `n_points' field gives the number of points in the
+ outline, while their coordinates are found in the single
+ vector array called `points'. The `flags' array holds a flag
+ for each point indicating its type.
+
+ Currently, only the first bit (bit 0, the least significant
+ bit) of each byte is meaningful to the rasterizer. If set, it
+ indicates that the point is _on_ the curve. If not set, the
+ point is said to be _off_ the curve. It is then a Bezier
+ control point.
+
+ For more information about point states, read the TrueType
+ specification or the scan-line documentation `raster.txt'.
+
+ - An array of contours end-point indices:
+
+ The `n_contours' field gives the number of contours, while the
+ `contours' array holds the indices of each contour's last
+ point. Note that the first contour always begins at point 0.
+
+ Hence, `contours[0]' holds the index of the last point of the
+ first contour. The second contour starts at point number
+ `contours[0]+1', and ends at point number `contours[1]'.
+
+ ** IMPORTANT NOTE: **
+ *********************
+
+ The last table entry _must_ always give the total number of
+ points used to draw the contours, i.e.:
+
+ contours[n_contours - 1] == n_points
+
+ If this value is greater than `n_points' when calling the
+ scan-line converter, the component will immediately return
+ an error (TT_Err_Too_Many_Points). If the value is smaller,
+ only the points contained in the described contours will be
+ used in the conversion process.
+
+ - An owner field:
+
+ This flag should **NEVER** be changed by the user. It
+ indicates whether the pointer fields own the arrays they refer
+ to (when the flag is set), or if they simply alias them (flag
+ unset).
+
+ - A high precision flag:
+
+ If this boolean is set (i.e. not zero), the scan-line
+ converter uses a higher precision to compute segment and
+ Bezier coordinates (more precisely, it uses 1/1024 precision,
+ instead of the normal 1/64). This is of course slower but can
+ be important for glyphs rendered at small sizes.
+
+ - A second pass flag:
+
+ If this boolean is set, the scan-line converter performs a
+ second sweep on the bitmap/pixmap to detect vertical drop-out.
+ Only horizontal drop-outs are detected in the first pass.
+ This is slower, but important for glyphs rendered at small
+ sizes.
+
+ - A dropout mode:
+
+ Used to specify which method applies for drop-out control
+ (also called `continuity testing' in other environments). The
+ mode value must be one of the values defined by the TrueType
+ specification.
+
+ The more recent modes 4 and 5 introduced in the newest
+ TrueType specification (Version 1.66) are fully supported.
+
+ An invalid value (i.e., not 0, 1, 2, 4, or 5) is taken as no
+ dropout control (equivalent to mode 0).
+
+ NOTE 1:
+
+ The outline returned by TT_Get_Glyph_Outline() only alias the
+ data that is part of a glyph container (see below). However,
+ it is possible to create and process your own outlines with
+ the new API functions TT_New_Outline(), TT_Done_Outline(),
+ TT_Copy_Outline(), TT_Translate_Outline(), etc.
+
+ TT_Done_Outline() will only discard an outline's array if it
+ owns them.
+
+ NOTE 2:
+
+ The outlines created by TT_New_Outline() are _not_ released by
+ the engine while executing TT_Done_FreeType(), they must be
+ explicitly discarded by the user who has created them!
+
+ NOTE 3:
+
+ The glyph loader sets the fields `high_precision',
+ `dropout_mode', and `second_pass' automatically.
+
+ NOTE 4:
+
+ This structure was called TT_Glyph_Outline in beta versions of
+ FreeType.
+
+ ..................................................................
+
+ TT_Glyph_Metrics
+
+ A structure used to return simple glyph metrics, applicable for
+ either horizontal or vertical layout. The values are expressed
+ in fractional pixels (26.6 format) if scaling was active,
+ otherwise in FUnits.
+
+ The main idea was to accomodate vertical text layouts by
+ eradicating the two explicit `leftSideBearing' and
+ `advanceWidth' names.
+
+ The interpretation of the fields varies with the text layout:
+
+ bearingX: Also known as the `left side bearing'. In
+ horizontal metrics, this value gives the horizontal
+ distance from the pen position to the glyph's bbox
+ xmin, otherwise it specifies the vertical distance.
+
+ bearingY: Also known as the `top side bearing', this is the
+ vertical distance from the baseline to the glyph's
+ bbox ymax in horizontal metrics, otherwise the
+ horizontal distance.
+
+ struct
+ {
+ TT_BBox bbox; /* the glyph's bbox */
+
+ TT_Pos bearingX; /* left-side bearing */
+ TT_Pos bearingY; /* top-side bearing */
+
+ TT_Pos advance; /* advance width or height */
+ };
+
+ ** IMPORTANT NOTE **
+
+ Because of the conventions inherent to the TrueType engine,
+ the outlines generated at glyph-load time are all placed so
+ that the pen is at position (0,0). This means that it is not
+ necessary to increase the pen position by `bearingX' and/or
+ `bearingY' before writing a glyph. Text output can be
+ performed with simple lines such as:
+
+ for (glyphs in text)
+ {
+ TT_Load_Glyph( ... );
+ TT_Get_Glyph_Outline( glyph, &outline );
+ TT_Translate_Outline( outline,
+ cur_pos_x * 64, cur_pos_y * 64 );
+
+ TT_Get_Outline_Bitmap( outline, bitmap );
+ /* blit bitmap to surface */
+
+ cur_pos_x += (metrics.advance + 32) / 64
+ }
+
+ For an example see the file `test/ftstring.c'.
+
+ NOTE 2:
+
+ This structure has changed from the beta version of FreeType.
+
+ NOTE 3:
+
+ FreeType only implements TT_Get_Glyph_Metrics() to return
+ horizontal metrics. For extracting vertical metrics you
+ should use TT_Get_Glyph_Big_Metrics().
+
+ ..................................................................
+
+ TT_Big_Glyph_Metrics
+
+ This structure is used to return the metrics of a glyph for both
+ horizontal and vertical layout.
+
+ The `linearXXX' fields represent unhinted scaled metrics values.
+ They can be useful for applications which need to compute device
+ independent placement of glyphs. Applying these metrics to
+ hinted glyphs will in most cases ruin the grid fitting performed
+ by the bytecode interpreter.
+
+ struct
+ {
+ TT_BBox bbox; /* the glyph's bounding box */
+
+ TT_Pos horiBearingX; /* horizontal left-side bearing */
+ TT_Pos horiBearingY; /* horizontal top-side bearing */
+
+ TT_Pos vertBearingX; /* vertical left-side bearing */
+ TT_Pos vertBearingY; /* vertical top-side bearing */
+
+ TT_Pos horiAdvance; /* horizontal advance */
+ TT_Pos vertAdvance; /* vertical advance */
+
+ TT_Pos linearHoriBearingX; /* lin. scaled hor. lsb. */
+ TT_Pos linearHoriAdvance; /* lin. scaled hor. adv. */
+
+ TT_Pos linearVertBearingY; /* lin. scaled vert. tsb. */
+ TT_Pos linearVertAdvance; /* lin. scaled vert. adv. */
+ }
+
+ ..................................................................
+
+ TT_Instance_Metrics
+
+ A structure used to return instance (point size) metrics.
+
+ struct
+ {
+ int pointSize;
+ /* point size in points (1 point = 1/72 inch) */
+
+ TT_UShort x_ppem; /* horizontal pixels per EM square */
+ TT_UShort y_ppem; /* vertical pixels per EM square */
+
+ TT_Fixed x_scale; /* 16.16 scale for EM -> frac pixels */
+ TT_Fixed y_scale; /* 16.16 scale for EM -> frac pixels */
+
+ TT_UShort x_resolution; /* device hor. res. in dpi */
+ TT_UShort y_resolution; /* device vert. res. in dpi */
+ };
+
+ The fields `x_scale' and `y_scale' can be used by clients to
+ convert notional units (in funits) in fractional pixels (in 26.6
+ fixed float format), e.g.:
+
+ TT_FUnit em_distance;
+ TT_F26Dot6 frac_distance;
+ TT_Fixed x_scale;
+
+ frac_distance = (em_distance * x_scale) / 0x10000;
+
+ ..................................................................
+
+ TT_Raster_Map
+
+ This structure is used to specify a target bitmap (or pixmap)
+ for the scan-line converter. It _must_ be set up by the client
+ application.
+
+ - The `rows' field contains the total number of rows in the
+ bitmap.
+
+ - The `width' field gives the number of pixels per row (a bit or
+ a byte, depending on the map's nature).
+
+ - The `cols' field gives the number of columns, i.e. bytes,
+ taken by each row in the map buffer.
+
+ ** IMPORTANT: ** The `cols' field must be a multiple of 4 for
+ pixmaps!
+
+ Usually, its value should be `(width+7)/8' for bitmaps, and
+ `(width+3) & -4' for pixmaps.
+
+ - The `flow' field gives the map's vertical orientation.
+
+ If the first bytes of the bitmap buffer pertain to its upper
+ row, the flow is said to be going `down' and the field should
+ take the value `TT_Flow_Down', otherwise the flow is going
+ `up', and the value is `TT_Flow_Up'.
+
+ To cite an example, the PC video modes use a `down' flow,
+ where the first VRAM byte corresponds to the upper and
+ leftmost corner of the screen.
+
+ - The `bitmap' field is a typeless pointer to the map's buffer.
+
+ - The `size' field contains the buffer's size in bytes. It is
+ usually computed as follows:
+
+ size = rows * cols;
+
+ NOTE 1:
+
+ For bitmaps, the leftmost-pixel is related to the highest
+ (i.e. most significant) bit of its byte. There is currently
+ no support for the opposite convention found in some systems.
+
+ (It can be easily added if you really need it, just ask the
+ development team.)
+
+ struct
+ {
+ int rows; /* number of rows */
+ int cols; /* number of columns (bytes) per row */
+ int width; /* number of pixels per line */
+ int flow; /* bitmap orientation */
+
+ void* bitmap; /* bit/pixmap buffer */
+ long size; /* bit/pixmap size in bytes */
+ } TT_Raster_Map;
+
+ NOTE 2:
+
+ TT_Get_Outline_Bitmap() resp. TT_Get_Glyph_Bitmap() are used
+ to render bitmaps into a TT_Raster_Map. The convention used
+ is 0 for the background, and 1 for the foreground. The glyph
+ is simply `or-ed' to the bitmap buffer.
+
+ NOTE 3:
+
+ TT_Get_Outline_Pixmap() and TT_Get_Glyph_Pixmap() are used to
+ render pixmaps into a TT_Raster_Map. Note that pixels are
+ drawn in spans of 4 successive bytes, only if needed. This
+ means that you must ALWAYS pass a clean pixmap buffer to these
+ functions. Otherwise, garbage could accumulate!
+
+ ..................................................................
+
+ TT_Header
+
+ This structure is used to hold the font's header. Its layout
+ and meaning are defined in the TrueType specification, in the
+ `head' section.
+
+ ..................................................................
+
+ TT_Horizontal_Header
+
+ This structure is used to hold the font's horizontal header.
+ Its layout and meaning are defined in the TrueType
+ specification, in the `hhead' section.
+
+ ..................................................................
+
+ TT_OS2
+
+ This structure is used to hold the font's OS/2 table. Its
+ layout and meaning are defined in the TrueType specification, in
+ the `OS/2' section.
+
+ Note that since FreeType 1.3, we support fonts without an OS/2
+ table (mainly old but popular Mac fonts). In this case, the
+ table's `version' field will be set to 0xFFFF by the loader, and
+ all other fields will be zeroed.
+
+ ..................................................................
+
+ TT_Postscript
+
+ This structure is used to hold the font's PostScript table. Its
+ layout and meaning are defined in the TrueType specification, in
+ the `post' section.
+
+ ..................................................................
+
+ TT_Hdmx
+
+ This structure is used to hold the font's horizontal device
+ metrics. Its layout and meaning are defined in the in the
+ `hdmx' section of the TrueType specification.
+
+ ..................................................................
+
+ TT_Face_Properties
+
+ This structure is used to return an opened face's properties.
+ These are:
+
+ - The total number of glyphs in the font, given by the field
+ `num_Glyphs'.
+
+ - The maximum number of points for the font's glyphs. This
+ value is used to allocate the points tables of a glyph
+ container's outline. It can be fairly large (like 256 points
+ for Roman fonts).
+
+ - The maximum number of contours for the font's glyphs. This
+ value is used to allocate the contours tables of a glyph
+ container's outline. It can be fairly large (over 16, even in
+ Roman fonts).
+
+ - The number of character mappings and name records within the
+ font. These values can still be retrieved through the APIs
+ TT_Get_CharMapCount() and TT_Get_Num_Names(), though these
+ have been _seriously_ deprecated.
+
+ - The number of associated faces. This number is always 1 for a
+ normal TrueType font file. However, when the face object was
+ opened from a TrueType collection, it contains the total
+ number of embedded fonts.
+
+ - Pointers to the face's header and horizontal header, the OS/2
+ and PostScript tables, and the horizontal device metrics.
+
+ struct
+ {
+ TT_UShort num_Glyphs; /* number of glyphs in face */
+ TT_UShort max_Points; /* max. numb. of points in a glyph */
+ TT_Short max_Contours;
+ /* maximum number of contours in a glyph */
+
+ TT_ULong num_Faces;
+ /* 1 for normal TrueType files resp. */
+ /* the number of embedded faces for TT */
+ /* collections */
+
+ TT_Header* header; /* TrueType header table */
+ TT_Horizontal_Header* horizontal;
+ /* TrueType horizontal header */
+ TT_Vertical_Header* vertical;
+ /* TrueType vertical header */
+ TT_OS2* os2; /* TrueType OS/2 table */
+ TT_Postscript* postscript;
+ /* TrueType PostScript table */
+ TT_Hdmx* hdmx; /* TrueType hdmx table */
+
+ } TT_Face_Properties;
+
+ - Note that the `vertical' field is set to NULL if the font file
+ does not contain any vertical metrics.
+
+ - Note also that since version 1.3 we support font files without
+ an OS/2 table. See the definition of TT_OS2 for more details.
+
+ ..................................................................
+
+ TT_Stream
+
+ This handle type defines a stream used to access a font file's
+ data. A client application should never deal with streams
+ directly, but some engine extensions need it to support more
+ advanced features like sbit support.
+
+ ..................................................................
+
+ TT_Face
+
+ This type defines a handle used to reference a face object. The
+ objects are never accessed directly by a client application; it
+ can only obtain handles to new objects, and use them to query
+ specific information or processes.
+
+ See also:
+
+ TT_Open_Face(), TT_Open_Collection(), TT_Close_Face(),
+ TT_Get_Face_Properties(), etc.
+
+ ..................................................................
+
+ TT_Instance
+
+ This type defines a handle used to reference an instance object
+ (also called a `pointsize' in other type engines). An instance
+ is always created from a valid face object, and is destroyed
+ with it by the engine.
+
+ See also:
+
+ TT_New_Instance(), TT_Done_Instance(),
+ TT_Set_Instance_CharSizes(), TT_Set_Instance_Resolutions(),
+ etc.
+
+ ..................................................................
+
+ TT_Glyph
+
+ This type defines a handle used to reference a glyph container
+ object. A glyph container is an object owning tables sized to
+ the font's maximum profile to hold any glyph of a given font
+ file.
+
+ It contains an outline, some metrics, as well as some data
+ related to the way it should be processed by the scan-line
+ converter.
+
+ Note that a glyph container doesn't contain any bitmap or
+ pixmap!
+
+ See also:
+
+ TT_New_Glyph(), TT_Done_Glyph(), TT_Load_Glyph(),
+ TT_Get_Glyph_Metrics(), TT_Get_Glyph_Big_Metrics(),
+ TT_Get_Glyph_Outline(), TT_Get_Glyph_Bitmap(),
+ TT_Get_Glyph_Pixmap()
+
+ ..................................................................
+
+ TT_CharMap
+
+ This type defines a handle used to reference a charMap object.
+ A charMap is an object owning the tables needed to perform the
+ mapping from characters code to glyphs numbers. A charMap is
+ always created from a valid face object, and is destroyed with
+ it by the engine.
+
+ See also:
+
+ TT_Get_CharMap(), TT_Char_Index().
+
+ ..................................................................
+
+ TT_Error
+
+ This is the type of all error codes returned by the API. Nearly
+ all functions return an error code, set to 0 in case of success.
+
+ A list of all error codes is given in section III.
+
+ ..................................................................
+
+ TT_Engine
+
+ For the sake of re-entrancy it is possible to distinguish
+ `engines' to separate several running instances of the library.
+ For example, it could be used as a DLL shared by several client
+ applications.
+
+ Each client program must begin by creating its own engine,
+ through a call to TT_Init_FreeType(). The engine must also be
+ passed as the first argument of the following functions:
+
+ TT_Open_Face()
+ TT_Open_Collection()
+ TT_Set_Raster_Gray_Palette()
+ TT_Get_Outline_Bitmap()
+ TT_Get_Outline_Pixmap()
+ TT_Done_FreeType()
+
+ Note that any FreeType object pertains to one single engine
+ (there is no sharing). Closing an engine with
+ TT_Done_FreeType() will delete all the objects that have been
+ allocated within its instance.
+
+
+
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+
+
+
+II. Functions
+=============
+
+ Here is a list of the core library's API.
+
+ NOTE:
+
+ A function's default result is an error code of type TT_Error; a
+ list of error codes is given in section III below.
+
+ Some functions return other types, in which case the result type
+ is documented with its description.
+
+ ..................................................................
+
+ TT_FreeType_Version( int* major, int* minor );
+
+ Queries the major and minor version of the library.
+
+ ..................................................................
+
+ TT_Init_FreeType( TT_Engine* engine );
+
+ Creates and initializes a new engine. Returns a handle to the
+ engine in the `*engine' variable.
+
+ This call must be performed before any other function of
+ FreeType is invoked. The engine handle must be passed to the
+ following functions:
+
+ TT_Open_Face()
+ TT_Open_Collection()
+ TT_Set_Raster_Gray_Palette()
+ TT_Done_FreeType()
+
+ ..................................................................
+
+ TT_Done_FreeType( TT_Engine engine );
+
+ Finalizes and destroys an engine. This call destroys _all_
+ objects that were previously created and used with the engine.
+
+ ..................................................................
+
+ TT_Open_Face( TT_Engine engine,
+ TT_Text* fontPathName,
+ TT_Face* face );
+
+ This call opens a font file, located by `fontPathName', and
+ returns a handle to the newly corresponding face object in the
+ handle `*face'. The object is part of the `engine' instance.
+
+ Example:
+
+ error = TT_Open_Face( engine, "c:\ttf\wingding.ttf", &face );
+ if ( error )
+ fprintf( stderr, "Could not open face.\n" );
+
+ NOTE 1:
+
+ The font file can be a TrueType collection; in this case, the
+ engine will always open the first embedded font found in the
+ file.
+
+ NOTE 2:
+
+ `TT_Text' is usually defined as `char' by a typedef
+ declaration. It may be a 16-bit quantity (or even wider) for
+ some operating systems; see ttconfig.h for details.
+
+ ..................................................................
+
+ TT_Open_Collection( TT_Engine engine,
+ TT_Text* collectionPathName,
+ TT_ULong fontIndex,
+ TT_Face* face );
+
+ This call opens one of the fonts found in a TrueType collection.
+ The font is selected through the `fontIndex' argument. The
+ first font has index 0.
+
+ Note that to know a collection's number of embedded fonts,
+ you will have to:
+
+ 1 - open the first collection font with TT_Open_Face().
+
+ 2 - query the face's properties through
+ TT_Get_Face_Properties().
+
+ The number of embedded faces is then `properties->num_Faces'.
+
+ Example:
+
+ TT_Face face;
+ TT_Face_Properties properties;
+
+
+ /* Open first embedded collection font */
+ error = TT_Open_Face( engine, "c:\ttf\sample.ttc", &face );
+ if ( error ) { ...error... }
+
+ /* Get face properties */
+ error = TT_Get_Face_Properties( face, &properties );
+ if ( error ) { ...error... }
+
+ printf( "There are %d fonts in this collection.\n",
+ properties->num_Faces );
+
+ TT_Close_Face( face );
+
+ /* Open second font in collection */
+ error = TT_Open_Collection( engine, "c:\ttf\sample.ttc", 1,
+ &face );
+ if ( error ) { ...error... }
+
+ NOTE 1:
+
+ If the file isn't a collection, `fontIndex' must be zero.
+ Otherwise, an error will be returned.
+
+ NOTE 2:
+
+ `TT_Text' is usually defined as `char' by a typedef
+ declaration. It may be a 16-bit quantity (or even wider) for
+ some operating systems; see ttconfig.h for details.
+
+ ..................................................................
+
+ TT_Set_Raster_Gray_Palette( TT_Engine engine,
+ TT_Byte* palette );
+
+ Sets the gray-level palette for an engine. The palette is used
+ to create pixmaps through the TT_Get_Glyph_Pixmap() function.
+ It is an array of five bytes, following the convention:
+
+ palette[0] = background (white)
+ palette[1] = light
+ palette[2] = medium
+ palette[3] = dark
+ palette[4] = foreground (black)
+
+ ..................................................................
+
+ TT_Get_Face_Properties( TT_Face face,
+ TT_Face_Properties* properties );
+
+ Returns the `face' object's `*properties'. This structure
+ contains various data like the total number of glyphs and
+ pointers to some mandatory TrueType tables.
+
+ See the definition of TT_Face_Properties in section I for more
+ details.
+
+ Note that since version 1.3, FreeType supports fonts with no
+ OS/2 table, like many old Mac fonts. See the definition of
+ TT_OS2 for more details.
+
+ ..................................................................
+
+ TT_Get_Face_Metrics( TT_Face face,
+ TT_UShort firstGlyph,
+ TT_UShort lastGlyph,
+ TT_Short* leftBearings,
+ TT_UShort* widths,
+ TT_Short* topBearings,
+ TT_UShort* heights );
+
+ This function returns the original horizontal AND vertical
+ metrics for a given face `face' and a given glyph range specified
+ by `firstGlyph' and `lastGlyph' as found in the `hmtx' and `vmtx'
+ tables. These are the glyphs' left-side bearings (in
+ `leftBearings') and horizontal advance widths (in `widths'), as
+ well as top-side bearings (in `topBearings') and vertical advance
+ heights (in `heights'). If you aren't interested in any of the
+ metrics fields, simply set its value to NULL.
+
+ All are expressed in font units, a.k.a. EM units.
+
+ The metrics arrays must be allocated by the client program.
+
+ IMPORTANT NOTE:
+
+ As vertical metrics are optional in a TrueType font, this
+ function will return an error (TT_Err_No_Vertical_Data) if this
+ function is called on such a face with non-NULL `topBearings'
+ or `heights' arguments.
+
+ If a font has no vertical data, the `vertical' field in its
+ properties structure is set to NULL.
+
+ ..................................................................
+
+ TT_Set_Face_Pointer( TT_Face face,
+ void* data );
+
+ For convenience purposes, each face object has a `generic'
+ pointer which value is unused by the engine, but that can be set
+ freely by client applications through this function.
+
+ Do what you want with it; it is here to give you a chance to
+ link a face object to your own structures and data.
+
+ ..................................................................
+
+ void* TT_Get_Face_Pointer( TT_Face face );
+ ^^^^
+ Returns a face object's generic pointer. See
+ TT_Set_Face_Pointer() above.
+
+ ..................................................................
+
+ TT_Flush_Face( TT_Face face );
+
+ Closes a given face object's file handler or descriptor. This
+ is useful to save system resources if your application opens
+ dozens or even hundreds of fonts. The face object is still
+ valid, and its file will be re-opened automatically on the next
+ request which requires disk access.
+
+ ..................................................................
+
+ TT_Close_Face( TT_Face face );
+
+ Closes a given `face' object. This function will also destroy
+ all the face's child instances. The face's glyphs will not be
+ destroyed, however.
+
+ ..................................................................
+
+ TT_New_Instance( TT_Face face,
+ TT_Instance* instance );
+
+ Creates a new instance object related to the `face' object. A
+ handle to the newly created instance is returned in `instance'.
+
+ The default instance resolution is 96dpi in both vertical and
+ horizontal direction; the default point size is 10pt.
+
+ ..................................................................
+
+ TT_Set_Instance_Resolutions( TT_Instance instance,
+ TT_UShort xResolution,
+ TT_UShort yResolution );
+
+ Sets the target device resolutions for a given instance. The
+ values are expressed in dots per inch (dpi). A value of 96dpi
+ is typical for an SVGA display, 72dpi for a Macintosh one, and
+ 300 to 6000dpi for printers. Default value (before a call to
+ this function) is 96dpi.
+
+ ..................................................................
+
+ TT_Set_Instance_CharSize( TT_Instance instance,
+ TT_F26Dot6 charsize );
+
+ Sets the point size for a given instance. The size is expressed
+ in fractional (26.6) `points', where 1 point = 1/72 inch. The
+ default value is 10pt (before a call to this function).
+
+ For example, to use a char size of 12pt, call the function with:
+
+ TT_Set_Instance_CharSize( instance, 12 * 64 );
+
+ Fractional point sizes are thus possible.
+
+ Call this function after TT_Set_Instance_Resolutions().
+
+ ..................................................................
+
+ TT_Set_Instance_CharSizes( TT_Instance instance,
+ TT_F26Dot6 charWidth,
+ TT_F26Dot6 charHeight );
+
+ Sets an instance's glyph width and height independently in
+ fractional (26.6) points. Similar to Set_Instance_CharSize()
+ with the exception that the horizontal and vertical glyph
+ dimensions can differ.
+
+ Call this function after TT_Set_Instance_Resolutions().
+
+ ..................................................................
+
+ TT_Set_Instance_PixelSizes( TT_Instance instance,
+ TT_UShort pixelWidth,
+ TT_UShort pixelHeight,
+ TT_F26Dot6 pointSize );
+
+ This function can be used to specify directly the pixel sizes
+ and point size of a given instance, independently of device
+ resolutions. This is not the recommended way to do it, but can
+ be used for debugging or simplicity in some special cases.
+
+ Note that you _must_ provide a point size!
+
+ Call this function after TT_Set_Instance_Resolutions().
+
+ ..................................................................
+
+ TT_Set_Instance_Transform_Flags( TT_Instance instance,
+ TT_Bool rotated,
+ TT_Bool stretched );
+
+ Sets the transform flags for a given instance. These flags are
+ passed to the interpreter each time a glyph is loaded within the
+ instance. Their role is to notify the glyph hinting mechanism
+ that the resulting glyph will be transformed in a special way.
+ Setting one of these flags to true usually disables hinting,
+ though this behaviour varies with each font file.
+
+ NOTE:
+
+ The glyph loader doesn't perform the rotation or the
+ stretching automatically; this must be done explicitly by the
+ client application. Use the function TT_Transform_Outline()
+ for that purpose.
+
+ ..................................................................
+
+ TT_Get_Instance_Metrics( TT_Instance instance,
+ TT_Instance_Metrics* imetrics );
+
+ This call returns a given instance's current metrics. They are
+ returned in the `imetrics' structure, which contains, among
+ other things, the current point size, ppem, and device
+ resolution (horizontal and vertical).
+
+ ..................................................................
+
+ TT_Set_Instance_Pointer( TT_Instance instance,
+ void* data );
+
+ For convenience purposes, each instance object has a `generic'
+ pointer which value is unused by the engine, but that can be set
+ freely by client applications through this function.
+
+ Do what you want with it, it is here to give you a chance to
+ link a face object to your own structures and data.
+
+ ..................................................................
+
+ void* TT_Get_Instance_Pointer( TT_Instance instance )
+ ^^^^
+
+ This function returns an instance object's generic pointer set
+ through TT_Set_Instance_Pointer().
+
+ ..................................................................
+
+ TT_Done_Instance( TT_Instance instance );
+
+ Closes a given instance object, destroying its associated data.
+ Note that this is performed automatically when a face is closed
+ on all its child instances. However, explicit deallocation can
+ help in freeing the memory used by the application earlier.
+
+ ..................................................................
+
+ TT_New_Glyph( TT_Face face,
+ TT_Glyph* glyph );
+
+ Creates a new glyph container for the glyphs of the font
+ described by the `face' handle. A pointer to the container is
+ returned in `glyph'. The face is said to be the glyph's parent.
+
+ NOTE:
+
+ A glyph is destroyed with its parent face object. However, it
+ is possible to delete it explicitly with TT_Done_Glyph().
+
+ ..................................................................
+
+ TT_Done_Glyph( TT_Glyph glyph );
+
+ Discards a glyph container. This is also done automatically for
+ all glyphs when closing its parent face object.
+
+ ..................................................................
+
+ TT_Load_Glyph( TT_Instance instance,
+ TT_Glyph glyph,
+ TT_UShort glyphIndex,
+ TT_UShort loadFlags );
+
+ Loads and processes (scales and/or hints) a glyph at a given
+ `instance' into the `glyph' container.
+
+ Note that `glyph' and `instance' must have the _same_ parent
+ face object, otherwise an error message will be returned.
+
+ `glyph_index' is the glyph's index as found in the TrueType
+ font. It is _not_ a character code (see the charmap functions
+ below).
+
+ `load_flags' is an integer that specifies which operations are
+ to be performed on the loaded glyph. The following values/bits
+ are used:
+
+ TTLOAD_SCALE_GLYPH
+
+ Indicates that the glyph must be scaled to the instance's
+ resolution. The pixel coordinates returned in the glyph
+ outline structure (see below) are then expressed in
+ fractional pixels represented in the 26.6 fixed point
+ floating format (F26Dot6).
+
+ If scaling is disabled, the coordinates returned in the
+ outline structure are integer font units, also called
+ `FUnits' by the TrueType specification.
+
+ TTLOAD_HINT_GLYPH
+
+ This flag is only valid when scaling is on. It informs the
+ loader that the glyph must be hinted (i.e., grid-fitted for
+ optimal display). Note that hinting will occur only if the
+ instance's transformations and metrics allow it (for
+ example, most font programs disable hinting automatically in
+ case of rotation or stretching).
+
+ When loading a hinted glyph, the metrics computed by the
+ loader, including the bounding box, will also be
+ grid-fitted.
+
+ TTLOAD_PEDANTIC
+
+ Starting with FreeType version 1.3, the bytecode interpreter
+ can ignore even more errors (like out-of-bound array
+ accesses). Using this flag it is possible to force TrueType
+ compliant interpretation of font programs.
+
+ TTLOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
+
+ A flag to handle monospaced fonts with an incorrect global
+ advance width in the `hhea' table. If set, the actual
+ advance width value of a particular glyph will be used; if
+ unset, the advance widths for all glyphs are forced to be
+ equal to the global value.
+
+
+ NOTE:
+
+ You can also use the constant TTLOAD_DEFAULT, which is simply
+ the union of TTLOAD_SCALE_GLYPH and TTLOAD_HINT_GLYPH for most
+ `typical' loads.
+
+ ..................................................................
+
+ TT_Get_Glyph_Outline( TT_Glyph glyph,
+ TT_Outline* outline );
+
+ This call returns the glyph's `outline'. This is a simple
+ structure which contains pointers to the data used to describe
+ an outline to the rasterizer. See the definition of
+ TT_Outline in section I.
+
+ ..................................................................
+
+ TT_Get_Glyph_Metrics( TT_Glyph glyph,
+ TT_Glyph_Metrics* metrics );
+
+ Extracts the glyph's metrics and copies them to the `*metrics'
+ structure. Its format is described in section I.
+
+ If the glyph has been loaded without scaling, the values are
+ expressed in FUnits (integers relative to the original font grid
+ called the EM Square).
+
+ If the glyph has been loaded _with_ scaling, which is the
+ default, the values are expressed in fractional pixels in 26.6
+ fixed point float format (F26Dot6; 1 unit = 1/64th of a pixel).
+
+ If the glyph has been loaded with hinting, the metrics are also
+ grid-fitted, including the bounding box. To get the un-fitted
+ bbox, call TT_Get_Outline_BBox() on the glyph's outline.
+
+ NOTE:
+
+ BBox fitting occurs according to the following scheme:
+
+ #define FLOOR( x ) ( (x) & -64 )
+ #define CEILING( x ) ( ( (x) + 63 ) & -64 )
+
+ xMin = FLOOR( xMin );
+ yMin = FLOOR( yMin );
+ xMax = CEILING( xMax );
+ yMax = CEILING( yMax );
+
+ This means that the outline's width and height in pixels can be
+ computed simply from the fitted bbox, namely
+
+ (xMax-xMin)/64 and (yMax-yMin)/64
+
+ ..................................................................
+
+ TT_Get_Glyph_Big_Metrics( TT_Glyph glyph,
+ TT_Big_Glyph_Metrics* metrics );
+
+ Extracts the glyph's big metrics and copies them to the
+ `*metrics' structure. Its format is described in section I.
+
+ If the glyph has been loaded without scaling, the values are
+ expressed in FUnits (integers relative to the original font grid
+ called the EM Square).
+
+ If the glyph has been loaded _with_ scaling, which is the
+ default, the values are expressed in fractional pixels in 26.6
+ fixed point float format (F26Dot6; 1 unit = 1/64th of a pixel).
+
+ If the glyph has been loaded with hinting, the metrics are also
+ grid-fitted, including the bounding box. To get the un-fitted
+ bbox, just call TT_Get_Outline_BBox() on the glyph's outline.
+
+ NOTE 1:
+
+ BBox fitting occurs according to the following scheme:
+
+ #define FLOOR( x ) ( (x) & -64 )
+ #define CEILING( x ) ( ( (x) + 63 ) & -64 )
+
+ xMin = FLOOR( xMin );
+ yMin = FLOOR( yMin );
+ xMax = CEILING( xMax );
+ yMax = CEILING( yMax );
+
+ This means that the outline's width and height in pixels can be
+ computed simply from the fitted bounding box, namely
+
+ (xMax-xMin)/64 and (yMax-yMin)/64
+
+ NOTE 2:
+
+ The vertBearingX value in `metrics' cannot be extracted for
+ outline glyphs -- it is defined for embedded bitmaps only.
+ Instead, it is set to (xMin-xMax)/2; this will center the
+ bounding box on the vertical `baseline'.
+
+ ..................................................................
+
+ TT_Get_Glyph_Bitmap( TT_Glyph glyph,
+ TT_Raster_Map* bitmap,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset );
+
+ This call converts the vectorial glyph representation contained
+ in the object handled by `glyph' into a bitmap.
+
+ The target bitmap is described by the `bitmap' pointer.
+ Clipping will be done if necessary. You can also specify an
+ offset to be applied before the scan-line conversion; `xOffset'
+ and `yOffset' must be expressed in fractional pixels (where
+ 1 unit = 1/64th pixel).
+
+ NOTE 1:
+
+ Choosing non integer pixel offsets, i.e., values of `xOffset'
+ and `yOffset' that are not multiples of 64, will ruin the
+ hinting performed by the interpreter, and result in bad
+ rendering at small sizes.
+
+ NOTE 2:
+
+ The glyph's point coordinates must be scaled before calling
+ this function. Never call this function with a glyph that
+ were loaded with no scaling!
+
+ NOTE 3:
+
+ FreeType always shifts the glyph horizontally so that the left
+ side bearing is equal to the left side of the bounding box.
+
+ ..................................................................
+
+ TT_Get_Glyph_Pixmap( TT_Glyph glyph,
+ TT_Raster_Map* pixmap,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset );
+
+ This call converts the vectorial glyph representation contained
+ in the object handled by `glyph' into a pixmap (i.e., an
+ 8-bit/pixel map). The result is an anti-aliased version of the
+ glyph (`anti-aliasing' is also known as `font-smoothing').
+
+ The target pixmap is described by the `pixmap' pointer. Note
+ that its width _must_ be a multiple of 4. For the definition
+ and description of a pixmap see Section I.
+
+ As with TT_Get_Glyph_Bitmap(), you can specify offsets to be
+ applied before the rendering (`xOffset' and `yOffset' must be
+ expressed in fractional pixel coordinates).
+
+ NOTE 1:
+
+ You don't need to supply a temporary bitmap for the
+ anti-aliaser. The rasterizer uses its own scheme to optimize
+ memory usage.
+
+ NOTE 2:
+
+ The glyph's point coordinates must be scaled before calling
+ this function. This means that you should never call it with
+ a glyph which has been loaded without scaling!
+
+ NOTE 3:
+
+ The pixmap passed to this function should always be EMPTY
+ (i.e., filled with zero bytes) before the call. If not,
+ garbage will accumulate!
+
+ NOTE 4:
+
+ FreeType always shifts the glyph horizontally so that the left
+ side bearing is equal to the left side of the bounding box.
+
+ ..................................................................
+
+ TT_New_Outline( TT_UShort numPoints,
+ TT_UShort numContours,
+ TT_Outline* outline );
+
+ Creates a new outline object. This function creates the arrays
+ necessary to hold `numPoints' points and `numContours' contours,
+ and set `outline's pointers to them.
+
+ The new outline owns the arrays, and they will be destroyed with
+ it through TT_Done_Outline().
+
+ NOTE 1:
+
+ Outlines created with this function are called `user'
+ outlines, in contrast with the outlines returned by
+ TT_Get_Glyph_Outline(), which fields refer to the data
+ contained within a glyph object (i.e., these outlines do not
+ own the arrays they refer to).
+
+ NOTE 2:
+
+ User outlines aren't tracked by the engine, which means they
+ are not destroyed by a TT_Done_FreeType(). You have to
+ explicitly discard them through TT_Done_Outline() to avoid
+ memory leaks.
+
+ ..................................................................
+
+ TT_Done_Outline( TT_Outline* outline );
+
+ Deletes an outline's data. Note that you need not destroy the
+ outlines returned by TT_Get_Glyph_Outline(), only those created
+ by TT_New_Outline().
+
+ ..................................................................
+
+ TT_Copy_Outline( TT_Outline* source,
+ TT_Outline* target );
+
+ Copies the content of the `source' outline into the content of
+ the `target' outline. The two outlines must have been created
+ with the same dimensions (num_points and num_contours),
+ otherwise this function will return an error code.
+
+ ..................................................................
+
+ void TT_Transform_Outline( TT_Glyph_Outline* outline,
+ ^^^^ TT_Matrix* matrix );
+
+ Applies a simple transformation matrix on a given outline. This
+ will multiply each point coordinate vector by a 2x2 matrix,
+ which coefficients are given in the 16.16 fixed float format.
+
+ Rotation can be performed with this function.
+
+ NOTE:
+
+ This function takes an outline, and not a glyph handle, as a
+ parameter. This `feature' lets you apply transformations on
+ your own copies of glyphs.
+
+ ..................................................................
+
+ void TT_Translate_Outline( TT_Glyph_Outline* outline,
+ ^^^^ TT_Pos xOffset,
+ TT_Pos yOffset );
+
+ Applies a simple translation on a given outline.
+
+ NOTE:
+
+ This function takes an outline, and not a glyph handle, as a
+ parameter. This `feature' lets you apply translation to your
+ own copies of glyphs.
+
+ ..................................................................
+
+ TT_Get_Outline_Bitmap( TT_Engine engine,
+ TT_Outline* outline,
+ TT_Raster_Map* bitmap );
+
+ Renders an outline into a bitmap. The latter must be setup by
+ the user before the call (i.e., it is not created by this
+ function, instead it must be provided by the user).
+
+ ..................................................................
+
+ TT_Get_Outline_Pixmap( TT_Engine engine,
+ TT_Outline* outline,
+ TT_Raster_Map* pixmap );
+
+ Renders an outline into a pixmap. The latter must be setup by
+ the user before the call (i.e., it is not created by this
+ function, instead it must be provided by the user).
+
+ NOTE:
+
+ The pixmap passed to this function must always be EMPTY (i.e.,
+ filled with zero bytes) before the call. Otherwise, garbage may
+ accumulate!
+
+ ..................................................................
+
+ TT_Get_Outline_BBox( TT_Outline* outline,
+ TT_BBox* bbox );
+
+ Returns an outline's bounding box in the `bbox' structure. Note
+ that the returned coordinates are not grid fitted!
+
+ NOTE:
+
+ The current release of FreeType (1.x) does compute the bounding
+ box for the outline's control points, and not the `exact' box
+ based on Bezier arcs extrema. Hence, the bbox returned by this
+ function may be slightly larger than necessary if the glyph
+ doesn't have control points at its extrema, or if it has been
+ rotated.
+
+ ..................................................................
+
+ void TT_Transform_Vector( TT_Pos* x,
+ ^^^^ TT_Pos* y,
+ TT_Matrix* matrix );
+
+ Applies a 2x2 matrix to a vector.
+
+ ..................................................................
+
+ int TT_Get_CharMapCount( TT_Face face );
+ ^^^
+
+ Gets the number of character mappings present in the TrueType
+ file described by the `face' handle. Returns -1 if the handle
+ is invalid.
+
+ IMPORTANT NOTE: ********
+
+ This function is deprecated. Get the number of character maps
+ from the `num_CharMaps' field in the structure returned by
+ TT_Get_Face_Property() instead.
+
+ ..................................................................
+
+ TT_Get_CharMap_ID( TT_Face face,
+ TT_UShort charmapIndex,
+ TT_UShort* platformID,
+ TT_UShort* encodingID );
+
+ Returns the platform ID and platform-specific encoding ID for
+ the charmap numbered `charmapIndex' in the `face' object. The
+ total number of character mapping tables can be found in the
+ `num_CharMaps' field in the structure returned by
+ TT_Get_Face_Property().
+
+ ..................................................................
+
+ TT_Get_CharMap( TT_Face face,
+ TT_UShort charmapIndex,
+ TT_CharMap* charMap );
+
+ Returns a handle for the character map number `charmapIndex' of
+ `face'. The handle is placed in `*charMap' and can be used
+ later for fast lookup with the TT_Char_Index() API function.
+
+ Charmap objects are automatically destroyed when their face
+ object is destroyed.
+
+ ..................................................................
+
+ TT_UShort TT_Char_Index( TT_CharMap charMap,
+ ^^^^^^^^^ TT_ULong charCode );
+
+ Applies a charMap to translate `charCode' into a glyph index
+ that can be used to load and address a glyph in the TrueType
+ file. In case of error, the undefined glyph (index 0) is
+ returned.
+
+ Note: Since FT 1.5, the `charCode' is an unsigned long instead
+ of an unsigned short.
+
+ The charmap handle can be obtained with TT_Get_CharMap().
+
+ ..................................................................
+
+ int TT_Get_Name_Count( TT_Face face );
+ ^^^
+
+ Gets the number of name strings found in a face's name table.
+ This function will return -1 if the face handle is invalid.
+
+ IMPORTANT NOTE: ********
+
+ This function is deprecated. Get the number of name strings
+ from the `num_Names' field in the structure returned by
+ TT_Get_Face_Property() instead.
+
+ ..................................................................
+
+ TT_Get_Name_ID( TT_Face face,
+ TT_UShort nameIndex,
+ TT_UShort* platformID,
+ TT_UShort* encodingID,
+ TT_UShort* languageID,
+ TT_UShort* nameID );
+
+ Returns the ID of a given name string, indexed by the number
+ `nameIndex' in a given face. The name index ranges from 0 to
+ `num_names' minus one; this value can be found in the structure
+ returned by TT_Get_Face_Property().
+
+ Each string has a `platformID', `encodingID', `languageID' and
+ `nameID', as defined by the TrueType specification.
+
+ The platformID is typically in the range [0,3]. Some font files
+ have unusual name table entries; these can be detected from
+ their platformID which is larger than 3.
+
+ ..................................................................
+
+ TT_Get_Name_String( TT_Face face,
+ TT_UShort nameIndex,
+ TT_String** stringPtr,
+ TT_UShort* length );
+
+ Returns a name string's address and length. Note that an
+ invalid name table entry always returns NULL for `stringPtr' and
+ zero for `length'.
+
+ NOTE 1:
+
+ The string belongs to the face object and should not be
+ written to or freed by the client application.
+
+ NOTE 2:
+
+ The library does not care about endianess here! If you are
+ using a little-endian machine and you have to interpret the
+ string bytes as 16-bit-wide characters (e.g. Unicode encoded),
+ you must byte-swap the data because 16-bit data is stored as
+ big-endian in TrueType fonts, and FreeType reads in the whole
+ name table bytewise.
+
+ ..................................................................
+
+ TT_Get_Font_Data( TT_face face,
+ TT_Long tag,
+ TT_Long offset,
+ void* buffer,
+ TT_Long* length );
+
+ Gets font or table data. Similar to the GetFontData() API of
+ the Windows world. You can use the macro MAKE_TT_TAG() to
+ generate TrueType table tags from character descriptions, like
+
+ MAKE_TT_TAG( 'e', 'b', 'l', 'c' )
+
+ Use the value 0 instead for `tag' if you want to access the
+ whole font file. `offset' specifies the starting offset in the
+ table (or the offset in the file if tag == 0), `buffer' the
+ address of target buffer.
+
+ Depending on the value of length, various actions are performed.
+ If `length' is NULL, the whole table will be loaded. An error
+ will be returned if `offset' is not 0. If `*length' is zero,
+ TT_Get_Font_Data() exits immediately, returning only the length
+ of the given table (in the variable `length'), or of the font
+ file, depending on the value of `tag'. Finally, if `*length' is
+ not zero, the next `length' bytes of the table (resp. the font)
+ are loaded into an array pointed to by `buffer', starting at
+ offset `offset'. Note that the `buffer' array must be large
+ enough to hold `length' bytes.
+
+
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+
+
+
+III. Error Messages
+===================
+
+ Most functions return an error code, typed to TT_Error. A return
+ value of zero indicates no error. The error values are defined in
+ the file `freetype.h'. In the following table, the prefix
+ `TT_Err_' is omitted, e.g. `Ok' -> `TT_Err_Ok'.
+
+
+ Error Unprefixed Error
+ Code Macro Name Description
+ ------------------------------------------------------------------
+
+ 0x0000 Ok Successful function call.
+ Always 0!
+
+ ----------------- high-level API error codes ---------------------
+
+ The following error codes are returned by the high-level API to
+ indicate an invalid client request.
+
+ 0x0001 Invalid_Face_Handle An invalid face object handle was
+ passed to an API function.
+
+ 0x0002 Invalid_Instance_Handle An invalid instance object handle
+ was passed to an API function.
+
+ 0x0003 Invalid_Glyph_Handle An invalid glyph container handle
+ was passed to an API function.
+
+ 0x0004 Invalid_CharMap_Handle An invalid charmap handle was
+ passed to an API function.
+
+ 0x0005 Invalid_Result_Address An output parameter (a result)
+ was given a NULL address in an
+ API call.
+
+ 0x0006 Invalid_Glyph_Index An invalid glyph index was passed
+ to an API function.
+
+ 0x0007 Invalid_Argument An invalid argument was passed to
+ an API function. Usually, this
+ means a simple out-of-bounds
+ error.
+
+ 0x0008 Could_Not_Open_File The pathname passed doesn't point
+ to an existing or accessible
+ file.
+
+ 0x0009 File_Is_Not_Collection Returned by TT_Open_Collection
+ while trying to open a file which
+ isn't a collection.
+
+ 0x000A Table_Missing The requested TrueType table is
+ missing in the font file.
+
+ 0x000B Invalid_Horiz_Metrics The font's HMTX table is invalid.
+ Denotes a broken font.
+
+ 0x000C Invalid_CharMap_Format A font's charmap entry has an
+ invalid format. Some other
+ entries may be valid though.
+
+ 0x000D Invalid_PPem Invalid PPem values specified,
+ i.e., you are accessing a scaled
+ glyph without having called
+ TT_Set_Instance_CharSize() or
+ TT_Set_Instance_PixelSizes().
+
+ 0x0010 Invalid_File_Format The file isn't a TrueType font or
+ collection.
+
+ 0x0011 Invalid_Vert_Metrics The font's VMTX table is invalid.
+ Denotes a broken font.
+
+ 0x0020 Invalid_Engine An invalid engine handle was
+ passed to one of the API
+ functions.
+
+ 0x0021 Too_Many_Extensions The client application is trying
+ to initialize too many
+ extensions. The default max
+ extensions number is 8 (this
+ value can be changed at compile
+ time).
+
+ 0x0022 Extensions_Unsupported This build of the engine doesn't
+ support extensions.
+
+ 0x0023 Invalid_Extension_Id This error indicates that the
+ client application is trying to
+ use an extension that has not
+ been initialized yet.
+
+ 0x0030 No_Vertical_Data There is no vertical data, but
+ you are requesting it. Instead,
+ call TT_Get_Face_Metrics() with
+ NULL pointers for `topBearings'
+ and `heights'.
+
+ 0x0080 Max_Profile_Missing The max profile table is missing.
+ => broken font file
+
+ 0x0081 Header_Table_Missing The font header table is missing.
+ => broken font file
+
+ 0x0082 Horiz_Header_Missing The horizontal header is missing.
+ => broken font file
+
+ 0x0083 Locations_Missing The locations table is missing.
+ => broken font file
+
+ 0x0084 Name_Table_Missing The name table is missing.
+ => broken font file
+
+ 0x0085 CMap_Table_Missing The character encoding tables are
+ missing.
+ => broken font file
+
+ 0x0086 Hmtx_Table_Missing The hmtx table is missing.
+ => broken font file
+
+ 0x0087 OS2_Table_Missing The OS/2 table is missing.
+ Some Mac fonts don't have it.
+
+ 0x0088 Post_Table_Missing The PostScript table is missing.
+ => broken font file
+
+ 0x0089 Glyf_Table_Missing The glyph table is missing.
+ => broken font file
+
+ ----------------- memory component error codes -------------------
+
+ 0x0100 Out_Of_Memory An operation couldn't be
+ performed due to memory
+ exhaustion.
+
+ ----------------- file component error codes ---------------------
+
+ 0x0200 Invalid_File_Offset Trying to seek to an invalid
+ portion of the font file.
+ Denotes a broken file.
+
+ 0x0201 Invalid_File_Read Trying to read an invalid portion
+ of the font file. Denotes a
+ broken file.
+
+ 0x0202 Invalid_Frame_Access Trying to frame an invalid
+ portion of the font file.
+ Denotes a broken file.
+
+ ----------------- glyph loader error codes -----------------------
+
+ These errors are produced by the glyph loader. They denote an
+ invalid glyph record within the font file.
+
+ 0x0300 Too_Many_Points The glyph has too many points to
+ be valid for its font file.
+
+ 0x0301 Too_Many_Contours The glyph has too many contours
+ to be valid for its font file.
+
+ 0x0302 Invalid_Composite_Glyph A composite glyph's description
+ is broken.
+
+ 0x0303 Too_Many_Ins The glyph has too many
+ instructions to be valid for its
+ font file.
+
+ ----------------- byte-code interpreter error codes --------------
+
+ These error codes are produced by the TrueType byte-code
+ interpreter. They usually indicate a broken font file or a broken
+ glyph within a font.
+
+ 0x0400 Invalid_Opcode Found an invalid opcode in a
+ TrueType byte-code stream.
+
+ 0x0401 Too_Few_Arguments An opcode was invoked with too
+ few arguments on the stack.
+
+ 0x0402 Stack_Overflow The interpreter's stack has been
+ filled up and operations can't
+ continue.
+
+ 0x0403 Code_Overflow The byte-code stream runs out of
+ its valid bounds.
+
+ 0x0404 Bad_Argument A function received an invalid
+ argument.
+
+ 0x0405 Divide_By_Zero A division by 0 operation was
+ queried by the interpreter
+ program.
+
+ 0x0406 Storage_Overflow The program tried to access data
+ outside of its storage area.
+
+ 0x0407 Cvt_Overflow The program tried to access data
+ outside of its control value
+ table.
+
+ 0x0408 Invalid_Reference The program tried to reference an
+ invalid point, zone, or contour.
+
+ 0x0409 Invalid_Distance The program tried to use an
+ invalid distance.
+
+ 0x040A Interpolate_Twilight The program tried to interpolate
+ twilight points.
+
+ 0x040B Debug_Opcode The now invalid `debug' opcode
+ was found in the byte-code
+ stream.
+
+ 0x040C ENDF_In_Exec_Stream A misplaced ENDF was encountered
+ in the byte-code stream.
+
+ 0x040D Out_Of_CodeRanges The program tried to allocate too
+ much code ranges (this is really
+ an engine internal error that
+ should never happen).
+
+ 0x040E Nested_DEFS Nested function definitions
+ encountered.
+
+ 0x040F Invalid_CodeRange The program tried to access an
+ invalid code range.
+
+ 0x0410 Invalid_Displacement The program tried to use an
+ invalid displacement.
+
+ 0x0411 Execution_Too_Long In order to get rid of `poison'
+ fonts, the interpreter produces
+ this error if more than one
+ million opcodes have been
+ interpreted in a single glyph
+ program. This detects infinite
+ loops softly.
+
+ ----------------- internal failure error codes -------------------
+
+ These error codes are produced if an incoherent library state has
+ been detected. All of these reflect a severe bug in the engine
+ (or a severe memory corruption due to massive overwrites by your
+ application into the library's data)!
+
+ If you do encounter a font that makes one of the test programs
+ produce such an error, please report it!
+
+ 0x0500 Nested_Frame_Access
+ 0x0501 Invalid_Cache_List
+ 0x0502 Could_Not_Find_Context
+ 0x0503 Unlisted_Object
+
+ ----------------- scan-line converter error codes ----------------
+
+ These error codes are produced by the raster component. They
+ indicate that an outline structure was incoherently set up, or
+ that you are trying to render a horribly complex glyph.
+
+ They should be _extremely_ rare, however.
+
+ 0x0600 Raster_Pool_Overflow Render pool overflow. This should
+ never happen in this release.
+
+ 0x0601 Raster_Negative_Height A negative height was produced.
+
+ 0x0602 Raster_Invalid_Value The outline data wasn't set
+ properly. Check that:
+ points >= endContours[contours]
+
+ 0x0603 Raster_Not_Initialized You did not call
+ TT_Init_FreeType()!
+
+
+--- end of apiref.txt ---
diff --git a/Build/source/libs/freetype/docs/apirefx.txt b/Build/source/libs/freetype/docs/apirefx.txt
new file mode 100644
index 00000000000..19bc7d9feb3
--- /dev/null
+++ b/Build/source/libs/freetype/docs/apirefx.txt
@@ -0,0 +1,1223 @@
+ The FreeType Engine
+
+ Extension Library Reference
+
+
+ -----------------------------------
+
+
+ Table of Contents:
+
+ I. Engine extensions
+ 1. kerning (ftxkern)
+ 2. PostScript names (ftxpost)
+ 3. TrueType Open (ftxopen)
+ a. The `BASE' table (baseline data)
+ b. The `GDEF' table (glyph definitions)
+ c. The `GPOS' table (glyph positions)
+ d. The `GSUB' table (glyph substitions)
+ e. The `JSTF' table (justification data)
+ f. auxiliary functions
+ 4. embedded bitmaps (ftxsbit)
+
+ II. API extensions
+ 1. cmap iteration (ftxcmap)
+ 2. internationalized error messages (ftxerr18)
+ 3. access to the `gasp' table (ftxgasp)
+ 4. fast retrieval of glyph widths and heights (ftxwidth)
+
+ III. Error codes
+
+
+ --------------------
+
+
+Please read the file `user.txt' for an introduction into FreeType's
+extension mechanism and the difference between engine and API
+extensions.
+
+
+I. Engine extensions
+====================
+
+To use engine extensions you have to compile the library with the
+macro TT_CONFIG_OPTION_EXTEND_ENGINE. By default, this macro is set
+and all engine extensions are linked to the FreeType library.
+
+
+ 1. kerning (ftxkern)
+ --------------------
+
+ TT_Init_Kerning_Extension( TT_Engine engine )
+
+ Initializes the kerning extension for a given engine. This must
+ be called just after the engine creation, and before any face
+ object allocation. Example:
+
+ TT_Init_FreeType( &engine );
+ TT_Init_Kerning_Extension( engine );
+
+ ..................................................................
+
+ TT_Get_Kerning_Directory( TT_Face face,
+ TT_Kerning* directory )
+
+ Queries the kerning directory found in a face object. If no
+ kerning table is found in the TrueType file, the error
+ TT_Err_Table_Is_Missing will be returned.
+
+ You can access the subtables through the pointers of the
+ directory. However, by default, the directory is only loaded if
+ a face object is created. You must load the subtables that
+ interest you with a call to TT_Load_Kerning_Table().
+
+ The layout of all kerning structures is defined in the file
+ `lib/extend/ftxkern.h'. Formats 0 and 2 (as defined in the
+ Microsoft TrueType specification) are exposed by this API.
+
+ NOTE:
+
+ This function must be called after the kerning extension has
+ been initialized.
+
+ ..................................................................
+
+ TT_Load_Kerning_Table( TT_Face face,
+ TT_UShort kernIndex )
+
+ Loads the kerning subtable number `kern_index' into memory. The
+ subtable can be accessed through the pointers provided by the
+ kerning directory, obtained from a call to the function
+ TT_Get_Kerning_Directory().
+
+ Note that the interpretation of the kerning data is left to the
+ client application. Read the TrueType specification for more
+ information on kerning encoding.
+
+ NOTE 1:
+
+ This function must be called after the kerning extension were
+ initialized.
+
+ NOTE 2:
+
+ An example can be found in the file `test/ftstrtto.c'.
+
+
+====================================================================
+
+
+ 2. PostScript names (ftxpost)
+ -----------------------------
+
+ TT_Init_Post_Extension( TT_Engine engine )
+
+ Initializes the PostScript name extension to load the PostScript
+ glyph names given in the `post' table. This must be called just
+ after creation of the engine, and before any face object
+ allocation. See description of TT_Get_PS_Name() for an example.
+
+ ..................................................................
+
+ TT_Load_PS_Names( TT_Face face,
+ TT_Post* post )
+
+ Loads the PostScript glyph names into memory. This must be done
+ before TT_Get_PS_Name() is called. In case of error, either
+ TT_Err_Invalid_Post_Table or TT_Err_Invalid_Post_Table_Format is
+ returned. See description of TT_Get_PS_Name() for an example.
+
+ ..................................................................
+
+ TT_Get_PS_Name( TT_Face face,
+ TT_UShort index,
+ TT_String** PSname )
+
+ Get the PostScript glyph name for a given glyph index. A
+ pointer to the name is returned in `PSname'. Example:
+
+ ...
+ TT_Post post;
+ char* PSname;
+
+ ...
+ TT_Init_Post_Extension( engine );
+ TT_Load_PS_Names( face, &post );
+
+ ...
+ TT_Get_PS_Name( face, index, &PSname );
+
+
+ NOTE 1:
+
+ You must not alter the PostScript glyph name string returned
+ in `PSname'.
+
+ NOTE 2:
+
+ Some standard names sometimes present some variations, as:
+
+ Omega vs. Ohm
+ Delta vs. increment
+ macron vs. overscore
+ mu vs. mu1
+ periodcentered vs. middot
+
+ We always return the first listed name, which correspond to
+ the last version of the TrueType specifications (which did
+ vary in the past on this respect). You may have to adjust the
+ source (in lib/extend/ftxpost.c) in order to interface with
+ some old applications.
+
+
+====================================================================
+
+
+ 3. TrueType Open (ftxopen)
+ --------------------------
+
+ Please note that TrueType Open specific error codes have the
+ prefix `TTO_Err_' instead of `TT_Err_'.
+
+ a. The `BASE' table (baseline data)
+
+ Not yet supported.
+
+ b. The `GDEF' table (glyph definitions)
+
+ TT_Init_GDEF_Extension( TT_Engine engine )
+
+ Initializes the GDEF extension to load the glyph definition
+ data given in the `GDEF' table. This must be called just
+ after creation of the engine, and before any face object
+ allocation. See the file `ftstrtto.c' for an example.
+
+ ................................................................
+
+ TT_Load_GDEF_Table( TT_Face face,
+ TTO_GDEFHeader* gdef )
+
+ Loads the GDEF table into `gdef' for a given face `face'.
+ This must be done before any queries about glyph properties
+ with TT_GSUB_Get_Property(). Returns TT_Err_Table_Missing if
+ there is no GDEF table in the font.
+
+ ................................................................
+
+ TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef,
+ TT_UShort glyphID,
+ TT_UShort* property )
+
+ Use this function to get glyph properties in the variable
+ `property' for the glyph with index `glyphID' stored in the
+ `gdef' table. This data is essential for many fonts to
+ correctly apply contextual substitution (both GSUB and GPOS).
+ As a special case, zero is assigned to `property' if `gdef' is
+ NULL or the glyph has no special glyph property assigned to
+ it. The other return values of `property' are TTO_BASE,
+ TTO_LIGATURE, TTO_MARK, and TTO_COMPONENT; you can directly
+ apply the `LookupFlag' mask to check for certain properties:
+
+ TTO_GDEFHeader* gdef;
+ TTO_Lookup* lo;
+ TT_UShort glyph_ID;
+ TT_UShort p;
+
+
+ TT_GDEF_Get_Property( gdef, glyph_ID, &p );
+
+ if ( p & lo->LookupFlag )
+ return TTO_Err_Not_Covered;
+
+ Usually, you don't need to take care of glyph properties by
+ yourself since TT_GSUB_Apply_String() will do this for you by
+ calling TT_GDEF_Get_Property().
+
+ Some fonts need GDEF-like data even if no GDEF table is
+ provided (for example, the Arabic script needs information
+ which glyphs are base glyphs and which are mark glyphs). In
+ such cases, you should use TT_GDEF_Build_ClassDefinition() to
+ build the necessary structures so that TT_GDEF_Get_Property()
+ returns meaningful values.
+
+ See also TT_Load_GSUB_Table() and TT_Load_GPOS_Table().
+
+ ................................................................
+
+ TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef,
+ TT_UShort num_glyphs,
+ TT_UShort glyph_count,
+ TT_UShort* glyph_array,
+ TT_UShort* class_array )
+
+ Fills a `gdef' structure with data to make
+ TT_GDEF_Get_Property() work in case no GDEF table is
+ available. `num_glyphs' is the number of glyphs in the font.
+
+ `glyph_count' is the number of glyphs resp. class values (as
+ specified in the GDEF specification) given in the arrays
+ `glyph_array' and `class_array', respectively. The glyph
+ indices in `glyph_array' must be all different and sorted in
+ ascending order; the function expects that glyph index
+ `glyph_array[n]' has its class value in `class_array[n]'.
+
+ Note that mark attach classes as defined in OpenType 1.2 are
+ not supported for constructed GDEF tables.
+
+ See `arabic.c' for an example.
+
+
+ c. The `GPOS' table (glyph positionings)
+
+ For glyph positioning, a data object of type TTO_GPOS_Data is
+ used. The `x_pos' and `y_pos' fields contain offsets to be
+ added to the glyph's position; `x_advance' and `y_advance' hold
+ values to be added to the horizonal and vertical advance widths,
+ respectively. If `new_advance' is TRUE, `x_advance' and
+ `y_advance' are absolute, i.e., they won't be added to the
+ original glyph's value but rather replace them. All offset
+ values are given as fractional pixels.
+
+ To position marks, `back' holds the number of glyphs to go back
+ for applying `x_pos' and `y_pos' (advance values are always zero
+ in this case). If the target glyph itself has a non-zero `back'
+ value, it is necessary to repeat this process -- the offset
+ values have to be accumulated then.
+
+ As a consequence, it is necessary to track glyph positions.
+
+ struct TTO_GPOS_Data_
+ {
+ TT_Pos x_pos;
+ TT_Pos y_pos;
+ TT_Pos x_advance;
+ TT_Pos y_advance;
+ TT_UShort back;
+ TT_Bool new_advance;
+ };
+
+ typedef struct TTO_GPOS_Data_ TTO_GPOS_Data;
+
+ Here some pseudo code to demonstrate the needed algorithm:
+
+ TT_GSUB_Apply_String()
+ TT_GPOS_Apply_String()
+ collect_glyph_positions() /* don't advance for marks */
+ /* take care of kerning */
+ /* apply GPOS data */
+
+ for all glyphs do
+ {
+ if `back' == 0
+ render_glyph_at_current_position()
+ else
+ {
+ search_base_glyph()
+ render_glyph_at_base_glyph_position()
+ }
+ }
+
+ A real example can be found in ftstrtto.c. Please note that the
+ code in this test program is not optimized; using a glyph cache
+ could improve speed considerably.
+
+ Contrary to GSUB handling, GPOS needs data from the glyphs
+ itself. Some formats of anchor tables (used e.g. to attach mark
+ glyphs to base glyphs) and device tables refer to contour
+ points, and cursive connections need advance values and
+ dimensions of the glyphs if used vertically (vertical cursive
+ connections have not been implemented yet -- this is the only
+ omission of GPOS support currently).
+
+ Two hooks are defined to get this data: TTO_GlyphFunction and
+ TTO_MMFunction. The former defaults to TT_Load_Glyph() and
+ should be replaced with a similar function which caches data if
+ necessary, the latter (to access data from Multiple Master
+ fonts) defaults to an error message.
+
+ GPOS handling must always be done *after* GSUB handling!
+
+ ................................................................
+
+ TT_Init_GPOS_Extension( TT_Engine engine )
+
+ Initializes the GPOS extension to load the glyph positioning
+ data given in the `GPOS' table. This must be called just
+ after creation of the engine, and before any face object
+ allocation. See the files `ftstrtto.c' and `ftdump.c' for
+ detailed examples.
+
+ ................................................................
+
+ TT_Load_GPOS_Table( TT_Face face,
+ TTO_GPOSHeader* gpos,
+ TTO_GDEFHeader* gdef )
+
+ Loads the GPOS table into `gpos' for a given face `face'.
+ This must be done before any queries about or selection of
+ scripts, languages, and features. Returns
+ TT_Err_Table_Missing if there is no GPOS table in the font.
+
+ `gdef' should contain a pointer to an associated GDEF table,
+ either a native one loaded with TT_Load_GDEF_Table() or
+ emulated with TT_GDEF_Build_ClassDefinition(). If `gdef' is
+ set to NULL, no GDEF data will be used.
+
+ ................................................................
+
+ TT_GPOS_Select_Script( TTO_GPOSHeader* gpos,
+ TT_ULong script_tag,
+ TT_UShort* script_index )
+
+ This function sets the script index of a given script tag
+ `script_tag' in the variable `script_index' for the GPOS table
+ `gpos'. Returns TTO_Err_Not_Covered if the script tag cannot
+ be found. The available script tags can be queried with the
+ function TT_GPOS_Query_Scripts().
+
+ ................................................................
+
+ TT_GPOS_Select_Language( TTO_GPOSHeader* gpos,
+ TT_ULong language_tag,
+ TT_UShort script_index,
+ TT_UShort* language_index,
+ TT_UShort* req_feature_index )
+
+ This function sets the language index of a given language tag
+ `language_tag' and script index `script_index' in the variable
+ `language_index' for the GPOS table `gpos'. Returns
+ TTO_Err_Not_Covered if the language tag cannot be found. The
+ available language tags can be queried with the function
+ TT_GPOS_Query_Languages().
+
+ Additionally, the index of the required feature for this
+ language system is returned in `req_feature_index'; it must be
+ later registered for use with TT_GPOS_Add_Feature().
+
+ ................................................................
+
+ TT_GPOS_Select_Feature( TTO_GPOSHeader* gpos,
+ TT_ULong feature_tag,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_UShort* feature_index )
+
+ This function sets the feature index of a feature tag
+ `feature_tag', script index `script_index', and language index
+ `language_index' in the variable `feature_index' for the GPOS
+ table `gpos'. Returns TTO_Err_Not_Covered if the feature tag
+ cannot be found. The available feature tags can be queried
+ with the function TT_GPOS_Query_Features(). Setting
+ language_index to 0xFFFF selects the default language system.
+
+ ................................................................
+
+ TT_GPOS_Query_Scripts( TTO_GPOSHeader* gpos,
+ TT_ULong** script_tag_list )
+
+ Returns the available script tags for a given GPOS table
+ `gpos' in the array `script_tag_list'. The array can be later
+ deallocated with free().
+
+ ................................................................
+
+ TT_GPOS_Query_Languages( TTO_GPOSHeader* gpos,
+ TT_UShort script_index,
+ TT_ULong** language_tag_list )
+
+ Returns the available language tags for a given GPOS table
+ `gpos' and script index `script_index' in the array
+ `language_tag_list'. The array can be later deallocated with
+ free().
+
+ ................................................................
+
+ TT_GPOS_Query_Features( TTO_GPOSHeader* gpos,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_ULong** feature_tag_list )
+
+ Returns the available feature tags for a given GPOS table
+ `gpos', script index `script_index', and language index
+ `language_index' in the array `feature_tag_list'. If language
+ index is set to 0xFFFF, the values for the default language
+ system are returned. The array can be later deallocated with
+ free().
+
+ ................................................................
+
+ TT_GPOS_Add_Feature( TTO_GPOSHeader* gpos,
+ TT_UShort feature_index,
+ TT_UShort property )
+
+ To prepare a call to TT_GPOS_Apply_String() which should
+ process a given feature with index `feature_index' and the
+ property `property', you must use this function. Its task is
+ to mark the lookup tables used by the feature for further
+ processing.
+
+ `property' defines a relationship between the input string
+ object and the specific feature. The client must handle this
+ variable as a bit field, i.e., up to 16 user properties can be
+ defined. If `property' is set to ALL_GLYPHS (0xFFFF, the only
+ predefined value), or if the input string object has no set
+ bits in the `properties' field, the feature applies to all
+ glyphs. If bit `x' is set in `property', the feature applies
+ only to glyphs which have bit `x' not set in glyph's
+ `properties' field in the input string object. See
+ TT_GPOS_Apply_String() for an example.
+
+ Returns TT_Err_Invalid_Argument in case of error.
+
+ ................................................................
+
+ TT_GPOS_Clear_Features( TTO_GPOSHeader* gpos )
+
+ Clears the list of used features and properties. No lookup
+ tables will be processed.
+
+ ................................................................
+
+ TT_GPOS_Register_Glyph_Function( TTO_GPOSHeader* gpos,
+ TTO_GlyphFunction gfunc );
+
+ Installs a function `gfunc' which loads a glyph. Its
+ parameters are the same as in a call to TT_Load_Glyph() -- if
+ no glyph loading function will be registered with
+ TTO_GPOS_Register_Glyph_Function(), TT_Load_Glyph() will be
+ called indeed. The purpose of this function is to provide a
+ hook for caching glyph outlines and sbits (using the
+ instance's generic pointer to hold the data).
+
+ If for some reason no outline data is available (e.g. for an
+ embedded bitmap glyph), _glyph->outline.n_points should be set
+ to zero. _glyph can be computed with
+
+ _glyph = HANDLE_Glyph( glyph )
+
+ `gfunc' is defined as
+
+ typedef TT_Error
+ (*TTO_GlyphFunction)(TT_Instance instance,
+ TT_Glyph glyph,
+ TT_UShort glyphIndex,
+ TT_UShort loadFlags );
+
+ ................................................................
+
+ TT_GPOS_Register_MM_Function( TTO_GPOSHeader* gpos,
+ TTO_MMFunction mmfunc,
+ void* data );
+
+ Installs a function `mmfunc' which accesses the PostScript
+ interpreter. Multiple Master fonts need this interface to
+ convert a metric ID (as stored in an OpenType font version 1.2
+ or higher) into a metric value.
+
+ `data' points to a user-defined structure which will not be
+ used by the GPOS extension itself. It is passed directly to
+ `mmfunc', which is defined as
+
+ typedef TT_Error
+ (*TTO_MMFunction)(TT_Instance instance,
+ TT_UShort metric_id,
+ TT_Pos* metric_value,
+ void* data );
+
+ `metric_value' must be returned as a scaled value (but
+ shouldn't be rounded).
+
+ ................................................................
+
+ TT_GPOS_Apply_String( TT_Instance instance,
+ TT_Glyph glyph,
+ TTO_GPOSHeader* gpos,
+ TT_Bool load_flags,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data** out,
+ TT_Bool dvi,
+ TT_Bool r2l )
+
+ This is the very function which handles glyph positioning
+ according to the features set up with TT_GPOS_Add_Feature(),
+ using both GPOS and GDEF data (if defined). A TTO_GSUB_String
+ object `in' (see the next section for a complete description)
+ and a TTO_GPOS_Data object array pointer `out' (as described
+ above) are taken for input and output; after successful
+ excecution, the GPOS data can been found in `out'. Note that
+ the `out' array has in->length elements.
+
+ `instance', `glyph', and `load_flags' are directly forwarded
+ to the glyph function registered with
+ TTO_GPOS_Register_Glyph_Function(). Note that glyphs are
+ always loaded as scaled.
+
+ If `dvi' is TRUE, `glyph' is ignored completely. Use this to
+ get device independent positioning values.
+
+ The parameter `r2l' should be set to TRUE if you process a
+ right-to-left script like Arabic. It is used for cursive
+ connections only to compute correct advance values.
+
+ Example:
+
+ /* We assume that the feature `xxxx' has index 5, and */
+ /* feature `yyyy' has index 8, applying only to glyphs */
+ /* with the property `FINAL_GLYPHS' set (0x1000 is an */
+ /* ad-hoc value just for this example). */
+
+ /* The order of calls to TT_GPOS_Add_Feature() is not */
+ /* significant. */
+
+ #define FINAL_GLYPHS 0x1000
+
+ TTO_GPOS_DATA* gd = NULL;
+
+
+ TT_GPOS_Clear_Features( &gpos );
+ TT_GPOS_Add_Feature( &gpos, 8, FINAL_GLYPHS );
+ TT_GPOS_Add_Feature( &gpos, 5, ALL_GLYPHS );
+
+ TT_GSUB_Apply_String( &gsub, &in, &out );
+ TT_GPOS_Apply_String( instance, glyph, &gpos,
+ TTLOAD_HINT_GLYPH,
+ &out, &gd, 0, 0 );
+
+ You must initialize the `gd' pointer to NULL; allocation
+ necessary for the `gd' array will be handled automatically.
+ If necessary, you can use free() to deallocate `gd'.
+
+
+ d. The `GSUB' table (glyph substitions)
+
+ For glyph substitution, a string object of type TTO_GSUB_String
+ is used. The field `length' holds the length of the string,
+ `pos' points to the actual position in the glyph string `string'
+ (for input strings) resp. the position where the substituted
+ glyphs should be placed at (for output strings).
+
+ Within the `properties' array (which must always have the same
+ length as `string' if set), you can define properties for glyphs
+ -- `string[n]' is associated with `properties[n]'. The idea is
+ that some features apply to specific glyphs only. As an
+ example, the `fina' feature for Arabic applies only to glyphs
+ which appear at the end of a word (strictly speaking, this
+ feature is used only for glyphs which have a `final' property;
+ such glyphs can occur in the middle of a word also under certain
+ circumstances which is dependent on Arabic script rules). The
+ relationship between properties and features can be set up with
+ the function TT_GSUB_Add_Feature(). If `properties' is set to
+ NULL, all selected features apply to all glyphs in the given
+ string object. If `properties' is non-NULL, the elements of the
+ array are treated as bit fields. A set flag means that the
+ corresponding feature (as set with the TT_GSUB_Add_Feature()
+ function) should not be applied to the particular glyph. As a
+ consequence, a zero value for these 16 bits means that all
+ features should be applied, and a value of 0xFFFF implies that
+ no feature at all should be used for the glyph.
+
+ The field `allocated' is for internal use only and must not be
+ modified. If its value is larger than zero, you should use
+ free() to deallocate the memory used by `string' (and
+ `properties' if set) in case you want to destroy a
+ TTO_GSUB_String object (memory for `string' and `properties' is
+ allocated automatically e.g. by TT_GSUB_Apply_String() for
+ output string objects).
+
+ struct TTO_GSUB_String_
+ {
+ TT_ULong length;
+ TT_ULong pos;
+ TT_ULong allocated;
+ TT_UShort* string;
+ TT_UShort* properties;
+ };
+
+ typedef struct TTO_GSUB_String_ TTO_GSUB_String;
+
+ Note that the `string' field must contain glyph indices, not
+ character codes.
+
+ For initializing an input string object, you should set the
+ `length', `string', and `properties' fields (the last one only
+ if necessary) to appropriate values. `pos' has to be set to the
+ position where the substitution lookups should start (usually
+ zero). The `allocated' field will be ignored.
+
+ For initializing an output string object, all fields (except
+ `length' which will be ignored) must be set to zero. If you
+ want to reuse the object, set `pos' to the position where the
+ substituted glyphs should be placed at (usually zero), but don't
+ touch the `allocated', `string', and `properties' fields.
+
+ ................................................................
+
+ TT_Init_GSUB_Extension( TT_Engine engine )
+
+ Initializes the GSUB extension to load the glyph substitution
+ data given in the `GSUB' table. This must be called just
+ after creation of the engine, and before any face object
+ allocation. See the files `ftstrtto.c' and `ftdump.c' for
+ detailed examples.
+
+ ................................................................
+
+ TT_Load_GSUB_Table( TT_Face face,
+ TTO_GSUBHeader* gsub,
+ TTO_GDEFHeader* gdef )
+
+ Loads the GSUB table into `gsub' for a given face `face'.
+ This must be done before any queries about or selection of
+ scripts, languages, and features. Returns
+ TT_Err_Table_Missing if there is no GSUB table in the font.
+
+ `gdef' should contain a pointer to an associated GDEF table,
+ either a native one loaded with TT_Load_GDEF_Table() or
+ emulated with TT_GDEF_Build_ClassDefinition(). If `gdef' is
+ set to NULL, no GDEF data will be used.
+
+ ................................................................
+
+ TT_GSUB_Select_Script( TTO_GSUBHeader* gsub,
+ TT_ULong script_tag,
+ TT_UShort* script_index )
+
+ This function sets the script index of a given script tag
+ `script_tag' in the variable `script_index' for the GSUB table
+ `gsub'. Returns TTO_Err_Not_Covered if the script tag cannot
+ be found. The available script tags can be queried with the
+ function TT_GSUB_Query_Scripts().
+
+ ................................................................
+
+ TT_GSUB_Select_Language( TTO_GSUBHeader* gsub,
+ TT_ULong language_tag,
+ TT_UShort script_index,
+ TT_UShort* language_index,
+ TT_UShort* req_feature_index )
+
+ This function sets the language index of a given language tag
+ `language_tag' and script index `script_index' in the variable
+ `language_index' for the GSUB table `gsub'. Returns
+ TTO_Err_Not_Covered if the language tag cannot be found. The
+ available language tags can be queried with the function
+ TT_GSUB_Query_Languages().
+
+ Additionally, the index of the required feature for this
+ language system is returned in `req_feature_index'; it must be
+ later registered for use with TT_GSUB_Add_Feature().
+
+ ................................................................
+
+ TT_GSUB_Select_Feature( TTO_GSUBHeader* gsub,
+ TT_ULong feature_tag,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_UShort* feature_index )
+
+ This function sets the feature index of a feature tag
+ `feature_tag', script index `script_index', and language index
+ `language_index' in the variable `feature_index' for the GSUB
+ table `gsub'. Returns TTO_Err_Not_Covered if the feature tag
+ cannot be found. The available feature tags can be queried
+ with the function TT_GSUB_Query_Features(). Setting
+ language_index to 0xFFFF selects the default language system.
+
+ ................................................................
+
+ TT_GSUB_Query_Scripts( TTO_GSUBHeader* gsub,
+ TT_ULong** script_tag_list )
+
+ Returns the available script tags for a given GSUB table
+ `gsub' in the array `script_tag_list'. The array can be later
+ deallocated with free().
+
+ ................................................................
+
+ TT_GSUB_Query_Languages( TTO_GSUBHeader* gsub,
+ TT_UShort script_index,
+ TT_ULong** language_tag_list )
+
+ Returns the available language tags for a given GSUB table
+ `gsub' and script index `script_index' in the array
+ `language_tag_list'. The array can be later deallocated with
+ free().
+
+ ................................................................
+
+ TT_GSUB_Query_Features( TTO_GSUBHeader* gsub,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_ULong** feature_tag_list )
+
+ Returns the available feature tags for a given GSUB table
+ `gsub', script index `script_index', and language index
+ `language_index' in the array `feature_tag_list'. If language
+ index is set to 0xFFFF, the values for the default language
+ system are returned. The array can be later deallocated with
+ free().
+
+ ................................................................
+
+ TT_GSUB_Add_Feature( TTO_GSUBHeader* gsub,
+ TT_UShort feature_index,
+ TT_UShort property )
+
+ To prepare a call to TT_GSUB_Apply_String() which should
+ process a given feature with index `feature_index' and the
+ property `property', you must use this function. Its task is
+ to mark the lookup tables used by the feature for further
+ processing.
+
+ `property' defines a relationship between the input string
+ object and the specific feature. The client must handle this
+ variable as a bit field, i.e., up to 16 user properties can be
+ defined. If `property' is set to ALL_GLYPHS (0xFFFF, the only
+ predefined value), or if the input string object has no set
+ bits in the `properties' field, the feature applies to all
+ glyphs. If bit `x' is set in `property', the feature applies
+ only to glyphs which have bit `x' not set in glyph's
+ `properties' field in the input string object. See
+ TT_GSUB_Apply_String() for an example.
+
+ Returns TT_Err_Invalid_Argument in case of error.
+
+ ................................................................
+
+ TT_GSUB_Clear_Features( TTO_GSUBHeader* gsub )
+
+ Clears the list of used features and properties. No lookup
+ tables will be processed.
+
+ ................................................................
+
+ TT_GSUB_Register_Alternate_Function( TTO_GSUBHeader* gsub,
+ TTO_AltFunction altfunc,
+ void* data )
+
+ Installs a callback function to handle alternate
+ substitutions. `data' is a generic pointer to a user-defined
+ structure which will be completely ignored by the ftxopen
+ extension. `altfunc' is a function pointer defined as
+
+ typedef TT_UShort
+ (*TTO_AltFunction)(TT_ULong pos,
+ TT_UShort glyphID,
+ TT_UShort num_alternates,
+ TT_UShort* alternates,
+ void* data );
+
+ If TT_GSUB_Apply_String() encounters an alternate lookup while
+ processing the input string, it will call the function
+ `altfunc' to find out which alternate glyph it should use.
+ `pos' gives the position in the string, `glyphID' the glyph ID
+ of the glyph to be replaced with an alternate glyph, and
+ `num_alternates' the number of alternate glyphs in the
+ `alternates' array. A pointer to the user-defined `data'
+ structure is also available. `altfunc' must return an index
+ into `alternates'.
+
+ If `altfunc' is NULL or if this function isn't called at all,
+ TT_GSUB_Apply_String() will always use the first alternate
+ glyph.
+
+ Please note that theoretically an alternate lookup can happen
+ during any other lookup! For example, a lookup chain like
+
+ single subst -> alternate subst -> ligature subst
+
+ *is* possible (albeit rather unlikely). Thus be warned that
+ `pos' does not necessarily reflect the position of a glyph to
+ be displayed at all, nor does `glyphID' specifies a glyph
+ which will be in the final output string.
+
+ ................................................................
+
+ TT_GSUB_Apply_String( TTO_GSUBHeader* gsub,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out )
+
+ This is the very function which handles glyph substitution
+ according to the features set up with TT_GSUB_Add_Feature(),
+ using both GSUB and GDEF data (if defined). Two
+ TTO_GSUB_String objects `in' and `out' (as described above)
+ are taken for input and output; after successful excecution,
+ the converted glyph string can been found in `out', and
+ `out.length' gives the actual length of the output string
+ (counted from the begin of the array).
+
+ Example:
+
+ /* We assume that the feature `xxxx' has index 5, and */
+ /* feature `yyyy' has index 8, applying only to glyphs */
+ /* with the property `FINAL_GLYPHS' set (0x1000 is an */
+ /* ad-hoc value just for this example). */
+
+ /* The order of calls to TT_GSUB_Add_Feature() is not */
+ /* significant. */
+
+ #define FINAL_GLYPHS 0x1000
+
+ TT_GSUB_Clear_Features( &gsub );
+ TT_GSUB_Add_Feature( &gsub, 8, FINAL_GLYPHS );
+ TT_GSUB_Add_Feature( &gsub, 5, ALL_GLYPHS );
+
+ TT_GSUB_Apply_String( &gsub, &in, &out );
+
+ You must initialize both `in' and `out' structures; allocation
+ necessary for the `out' object will be handled automatically.
+
+ In case you don't register a function to handle alternate
+ substitutions (GSUB lookup 3), always the first alternate
+ glyph will be used. See TT_GSUB_Register_Alternate_Function()
+ above for more details.
+
+
+ e. The `JSTF' table (justification data)
+
+ Not yet supported.
+
+
+ f. auxiliary functions
+
+ TT_GSUB_Add_String( TTO_GSUB_String* in,
+ TT_UShort num_in,
+ TTO_GSUB_String* out,
+ TT_UShort num_out,
+ TT_UShort* glyph_data,
+ TT_UShort component,
+ TT_UShort ligID )
+
+ This function copies `num_out' elements from `glyph_data' to
+ `out', advancing the array pointer in the `in' structure by
+ `num_in' elements, and in `out' by `num_out' elements. If the
+ string (resp. the properties) array in `out' is empty or too
+ small, it allocates resp. reallocates the string (and
+ properties) array. Finally, it sets the `length' field of
+ `out' equal to `pos' of the `out' structure.
+
+ The properties (if defined) for all replaced glyphs are taken
+ from the glyph at position `in->pos'.
+
+ If `component' is 0xFFFF, the value `in->component[in->pos]'
+ will be copied `num_out' times, otherwise `component' itself
+ will be used to fill `out->component'.
+
+ If `ligID' is 0xFFFF, the value `in->lig_IDs[in->pos]' will be
+ copied `num_out' times, otherwise `ligID' itself will be used
+ to fill `out->ligIDs'.
+
+ TT_GSUB_Add_String() is normally used in
+ TT_GSUB_Apply_String(); you will need it for the special case
+ to skip some glyphs (i.e., copy glyphs directly from the `in'
+ to the `out' object), bypassing a possible GSUB substitution.
+
+ Here an example which copies one glyph:
+
+ TT_GSUB_Add_String( in, 1,
+ out, 1,
+ &in->string[in->pos],
+ 0xFFFF, 0xFFFF );
+
+
+====================================================================
+
+
+ 4. embedded bitmaps (ftxsbit)
+ -----------------------------
+
+ TT_Init_SBit_Extension( TT_Engine engine )
+
+ Initializes the embedded bitmap extension to load the bitmap
+ glyphs given in the various sbit tables: `EBLC', `bloc', `EBDT',
+ and `bdat' (`bloc' and `bdat' tables are only in Apple fonts;
+ the former is equivalent to `EBLC', the latter equivalent to
+ `EBDT'). This must be called just after creation of the engine,
+ and before any face object allocation. See description of
+ TT_Load_Glyph_Bitmap() for an example.
+
+ ..................................................................
+
+ TT_Get_Face_Bitmaps( TT_Face face,
+ TT_EBLC* eblc_table )
+
+ Loads the `EBLC' (resp. `bloc') table from a font file into the
+ `eblc_table' structure. Use this function for testing whether
+ embedded bitmaps are available or not.
+
+ This function returns TT_Err_Table_Missing if the font contains
+ no embedded bitmaps. All fields in `eblc_table' will then be
+ set to 0.
+
+ ..................................................................
+
+ TT_New_SBit_Image( TT_SBit_Image** image )
+
+ Allocates a new embedded bitmap container, pointed to by
+ `image'.
+
+ ..................................................................
+
+ void TT_Done_SBit_Image( TT_SBit_Image* image )
+ ^^^^
+
+ Releases the embedded bitmap container `image'.
+
+ ..................................................................
+
+ TT_Get_SBit_Strike( TT_Face face,
+ TT_Instance instance,
+ TT_SBit_Strike* strike )
+
+ Loads a suitable strike (i.e. bitmap sizetable) for the given
+ instance. Will return TT_Err_Invalid_PPem if there is no strike
+ for the current x_ppem and y_ppem values.
+
+ ..................................................................
+
+ TT_Load_Glyph_Bitmap( TT_Face face,
+ TT_Instance instance,
+ TT_UShort glyph_index,
+ TT_SBit_Image* bitmap );
+
+ Loads a glyph bitmap for a given glyph index `glyph_index' (in
+ face `face' and instance `instance') into `bitmap'. It calls
+ TT_Get_SBit_Strike() internally for checking the current x_ppem
+ and y_ppem values.
+
+ This function returns an error if there is no embedded bitmap
+ for the glyph at the given instance.
+
+ Example (omitting the error handling):
+
+ ...
+ TT_SBit_Image* bitmap;
+
+ ...
+ TT_Init_SBit_Extension( engine );
+ TT_New_SBit_Image( &bitmap );
+ ...
+ TT_Load_Glyph_Bitmap( face, instance, glyph_index, bitmap );
+
+
+
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+
+
+
+II. API extensions
+==================
+
+To use API extensions, simply compile the specific extension file
+and link it to the library or your program. By default, all
+extensions described below are linked to the library.
+
+
+ 1. cmap iteration (ftxcmap)
+ ---------------------------
+
+ TT_Long TT_CharMap_First( TT_CharMap charMap,
+ ^^^^^^^ TT_UShort* glyph_index )
+
+ Returns the first valid character code in a given character map
+ `charMap'. Also returns the corresponding glyph index (in the
+ parameter `*glyph_index'). In case of failure, -1 is returned,
+ and `*glyph_index' is undefined.
+
+ ..................................................................
+
+ TT_Long TT_CharMap_Next( TT_CharMap charMap,
+ ^^^^^^^ TT_ULong last_char,
+ TT_UShort* glyph_index )
+
+ Returns the next valid character code in a given character map
+ `charMap' which follows `last_char'. Also returns the
+ corresponding glyph index (in the parameter `*glyph_index'). In
+ case of failure, -1 is returned, and `glyph_index' is undefined.
+
+ ..................................................................
+
+ TT_Long TT_CharMap_Last( TT_CharMap charMap,
+ ^^^^^^^ TT_UShort* glyph_index )
+
+ Returns the last valid character code in a given character map
+ `charMap'. Also returns the corresponding glyph index (in the
+ parameter `*glyph_index'). In case of failure, -1 is returned,
+ and `*glyph_index' is undefined.
+
+
+====================================================================
+
+
+ 2. internationalized error messages (ftxerr18)
+ ----------------------------------------------
+
+ This extension provides internationalized error strings from the
+ various error messages. It uses the `gettext' package if
+ available or returns English/American message strings if not.
+ Currently, the gettext package is only available on UNIX-like
+ systems like Linux (and on similarly inspired systems, like DJGPP
+ or MinGW); this means that for other platforms only English error
+ strings are returned.
+
+ If the gettext package is found on your system, the configure
+ script automatically includes it by default. In case you don't
+ want to use it, or if you encounter some problems compiling this
+ file, try to disable nls support by configuring FreeType with
+ `./configure --disable-nls'.
+
+ Please read the gettext info files for more information how to set
+ up your system for internationalized messages. A short
+ introduction is also given in the file `i18n.txt'.
+
+
+ TT_String* TT_ErrToString18( TT_Error i )
+ ^^^^^^^^^^
+
+ This function returns an error string for a given error code
+ `i'. The type `TT_String' usually defaults to `char'; see
+ apiref.txt for more details.
+
+ An example how to use this function (in connection with the
+ gettext interface) is given in test/ftdump.c or test/fterror.c.
+
+
+====================================================================
+
+
+ 3. access to the `gasp' table (ftxgasp)
+ ---------------------------------------
+
+ The `gasp' table is currently loaded by the core engine, but the
+ standard API doesn't give access to it.
+
+
+ TT_Get_Face_Gasp_Flags( TT_Face face,
+ TT_UShort point_size,
+ TT_Bool* grid_fit,
+ TT_Bool* smooth_font )
+
+ This function returns for a given `point_size' the values of the
+ gasp flags `grid_fit' and `smooth_font'. The returned values
+ are booleans (where 0 = NO, and 1 = YES).
+
+ Note that this function will return TT_Err_Table_Missing if the
+ font file doesn't contain any gasp table.
+
+
+====================================================================
+
+
+ 4. fast retrieval of glyph widths and heights (ftxwidth)
+ --------------------------------------------------------
+
+ This extension is used to parse the `glyf' table of a TrueType
+ file in order to extract the bounding box of a given range of
+ glyphs.
+
+ The bounding box is then used to build font unit widths and
+ heights that are returned in two parallel arrays.
+
+ This extension is needed by the FreeType/2 OS/2 Font Driver.
+
+
+ TT_Get_Face_Widths( TT_Face face,
+ TT_UShort first_glyph,
+ TT_UShort last_glyph,
+ TT_UShort* widths,
+ TT_UShort* heights )
+
+ Returns the widths (in array `widths') and heights (in array
+ `heights') of a glyph range which starts at `first_glyph' and
+ ends at `last_glyph'. All returned values are returned in font
+ units. If either `widths' or `heights' is set to a NULL
+ pointer, no data will be returned for that particular array.
+
+ Note: TT_Get_Face_Widths() does *not* allocate the two arrays!
+
+
+
+--------------------------------------------------------------------
+--------------------------------------------------------------------
+
+
+
+III. Error Messages
+===================
+
+ Most functions return an error code, typed to TT_Error. A return
+ value of zero indicates no error. The error values are defined in
+ the various extension header files (e.g. ftxkern.h). In the
+ following table, the prefix `TT_Err_' is omitted, e.g. `Ok' ->
+ `TT_Err_Ok'.
+
+
+ Error Unprefixed Error
+ Code Macro Name Description
+ ------------------------------------------------------------------
+
+ 0x0A00 Invalid_Kerning_Table_Format
+ An invalid kerning subtable
+ format was found in this font.
+
+ 0x0A01 Invalid_Kerning_Table A kerning table contains illegal
+ glyph indices.
+
+ 0x0B00 Invalid_Post_Table_Format
+ The post table format specified
+ in the font is invalid.
+
+ 0x0B01 Invalid_Post_Table The post table contains illegal
+ entries.
+
+
+ Here the TrueType Open error codes. In the following table, the
+ prefix `TTO_Err_' is omitted.
+
+
+ Error Unprefixed Error
+ Code Macro Name Description
+ ------------------------------------------------------------------
+ 0x1000 Invalid_SubTable_Format The TrueType Open subtable format
+ specified in the font is invalid.
+
+ 0x1001 Invalid_SubTable A TrueType Open subtable contains
+ illegal entries.
+
+ 0x1002 Not_Covered The requested feature, glyph,
+ etc. isn't covered by the actual
+ function.
+
+ 0x1003 Too_Many_Nested_Contexts
+ A loop in the contextual lookup
+ tables (either GSUB or GPOS) has
+ been detected.
+
+ 0x1004 No_MM_Interpreter The interface to a PostScript
+ interpreter with Multiple Master
+ font support is missing.
+
+ 0x1010 Invalid_GSUB_SubTable_Format
+ The GSUB subtable format
+ specified in the font is invalid.
+
+ 0x1011 Invalid_GSUB_SubTable The GSUB subtable contains
+ illegal entries.
+
+ 0x1020 Invalid_GPOS_SubTable_Format
+ The GPOS subtable format
+ specified in the font is invalid.
+
+ 0x1021 Invalid_GPOS_SubTable The GPOS subtable contains
+ illegal entries.
+
+ 0x1030 Invalid_GDEF_SubTable_Format
+ The GDEF subtable format
+ specified in the font is invalid.
+
+ 0x1031 Invalid_GDEF_SubTable The GDEF subtable contains
+ illegal entries.
+
+
+--- end of apirefx.txt ---
diff --git a/Build/source/libs/freetype/docs/bitmaps.txt b/Build/source/libs/freetype/docs/bitmaps.txt
new file mode 100644
index 00000000000..79ed2ddbea9
--- /dev/null
+++ b/Build/source/libs/freetype/docs/bitmaps.txt
@@ -0,0 +1,770 @@
+
+ Bitmap and Pixmap generation with FreeType
+ ------------------------------------------
+
+ Table of Contents
+
+
+ Introduction
+
+ I. The rasterizer component
+
+ II. Bitmap & pixmap descriptors
+
+ III. Rendering an outline
+
+ IV. Anti-aliasing palette and other concerns
+
+ Conclusion
+
+
+
+Introduction
+------------
+
+ This document describes the steps that are needed to render a
+ glyph outline into a bitmap or a pixmap with the FreeType library.
+ It contains several important details needed to generate bitmaps
+ correctly in all situations, including if an outline has been
+ transformed or translated.
+
+
+--------------------------------------------------------------------
+
+
+I. The rasterizer component
+---------------------------
+
+ In FreeType, the component in charge of performing bitmap and
+ pixmap rendering is called the `rasterizer'. Generation is
+ performed through a traditional process called `scan-line
+ conversion', but exhibits certain properties:
+
+ - The rasterizer doesn't allocate bitmaps:
+
+ In fact, it is only able to render an outline into an existing
+ bitmap or pixmap, which is passed to one of its rendering
+ functions. This means that the target bitmap/pixmap must be set
+ up correctly by the caller to achieve desired results. Setting
+ up bitmap and pixmap descriptors is explained in section II.
+
+ - It is able to render anti-aliased pixmaps directly:
+
+ This is unlike other graphics packages, which render to a
+ `large' bitmap which is then filtered down. Putting the
+ anti-aliasing logic within the rasterizer improves performance
+ and reduces memory usage, as well as lets us use better
+ algorithms which couldn't work in a `two-phase' process.
+
+ The rasterizer is located in the files `ttraster.h' and
+ `ttraster.c'.
+
+ The format of outlines isn't important for most developers and
+ won't be discussed here. However, a few conventions must be
+ explained regarding the vector outlines:
+
+
+ 1. Units
+
+ All point coordinates within an outline are stored in 32-bit
+ fractional pixel values, using the 26.6 fixed float format
+ (which uses 26 bits for the integer part, and 6 bits for the
+ fractional part). The following table gives some examples of
+ real versus 26.6 coordinates:
+
+ -----------------------------------------
+ real real coord 26.6 coord
+ coord. * 2^6
+ -----------------------------------------
+ 0 0*64 = 0.0 0
+ 2.4 2.4*64 = 153.6 154
+ 3 3*64 = 192.0 192
+ -1.7 -1.7*64 = -108.8 -109
+
+ As you can see, conversion is relatively simple -- basically a
+ multiplication by 64.
+
+ In order to differentiate coordinates expressed in real or 26.6
+ systems, we'll use in the following lines brackets (`[' and `]')
+ for real coordinates, and simple parentheses (`(' and `)') for
+ fractional coordinates so that
+
+ [1.0,2.5] equals (64,160)
+
+ [0,0] equals (0,0)
+
+ [-2,3] equals (-128,192)
+
+
+ 2. Orientation
+
+ The rasterizer uses the traditional convention of an X axis
+ oriented from left to right, and of a Y axis oriented from
+ bottom to top.
+
+ ^ Y
+ |
+ |
+ |
+ -*-----> X
+ |
+
+ You've probably already used it at school when doing math :-)
+
+ Though the orientation of bitmap lines has the opposite
+ direction on nearly all graphics systems, the former convention
+ is the _right_ one when it comes to vector graphics. The reason
+ is simply that for managing angles and vector cross-products
+ resp. orientations in complex algorithms, a single convention,
+ used in math as well as computing alike solves many headaches.
+
+ And due to education, most people expect a 45 degrees angle to
+ be in the top right quadrant, at coordinate (1,1).
+
+
+ 3. Pixels and the grid
+
+ In a vector outline, a point is immaterial and has no size or
+ width, just like in usual geometry. A `pixel' is an element of
+ a computer image called a `map' (like a bitmap or a pixmap).
+
+ The FreeType rasterizer follows the convention defined by the
+ TrueType specification regarding pixel placement:
+
+ - The map can be seen as a `grid' placed in the vector plane.
+ The grid lines are set on integer real coordinates (i.e., on
+ multiples of 64 in 26.6 fractional notation).
+
+ Each pixel is one `cell' of the grid, and can be `lit' with
+ any color. Hence, each pixel has a width and a height of
+ [1.0] units, (i.e., 64 fixed float units).
+
+ ^ Y
+ |
+ | The pixel grid with two
+ | points (not pixels!)
+ +-----+-----+-----+-----+-----+ at coordinates [0,0]
+ | | | | | | and [2,2].
+ | | | | | |
+ | | | | |[2,2]|
+ +-----+-----+-----+-----@-----+ The pixels are the
+ | | |11111|22222| | grid's cells, and this
+ | | |11111|22222| | example show the four
+ | | |11111|22222| | pixels enclosed within
+ +-----+-----+-----+-----+-----+ the rectangle delimited
+ | | |33333|44444| | by these two points.
+ | | |33333|44444| |
+ | | |33333|44444| |
+ --+-----+-----@-----+-----+-----+----> X
+ | | |[0,0]| | |
+ | | | | | | Note that the numbering
+ | | | | | | of pixels isn't
+ +-----+-----+-----+-----+-----+ meaningful here, it's
+ | | | | | | only used to distinguish
+ | | | | | | them.
+ | | | | | |
+ +-----+-----+-----+-----+-----+
+ |
+ |
+
+ - The `center' of each pixel is always located on a
+ `half-integer' coordinate, i.e., at -1.5, -0.5, 0.5, 1.5, etc.
+
+ - When drawing a shape, the rasterizer only `lits' a pixel when
+ its center is placed _within_ the shape. This is important
+ because an outline point may not be necessarily be on a grid
+ line.
+
+ - When a pixel center falls on the shape, the pixel is lit too.
+
+ For example, the following graphics show the `lit' pixels
+ corresponding to the rectangle enclosed by the points:
+
+ [-0.2, 0] and [2.4, 2.7]
+
+
+ ^ Y As one can see, the
+ | newest pixels `1'
+ | and `2' are now lit,
+ | because its centers
+ +-----+-----+-----+-----+--[2.4,2.7] are located at
+ | | |11111|22222| @ | coordinates
+ | . | . |11.11|22.22| . | [0.5,2.5] and
+ | | |11111|22222| | [1.5,2.5],
+ +-----+-----+-----+-----+-----+ respectively.
+ | | |33333|44444| |
+ | . | . |33.33|44.44| . | Note that pixel
+ | | |33333|44444| | centers are
+ +-----+-----+-----+-----+-----+ represented with a
+ | | |55555|66666| | dot in the graphics.
+ | . | . |55.55|66.66| . |
+ | | |55555|66666| |
+ --+-----+----@+-----+-----+-----+----> X
+ | | [-0.2,0] | | |
+ | . | . | . | . | . |
+ | | | | | | Note also that pixel
+ +-----+-----+-----+-----+-----+ numbering is still
+ | | | | | | meaningless there.
+ | . | . | . | . | . |
+ | | | | | |
+ +-----+-----+-----+-----+-----+
+ |
+ |
+
+
+ 4. Drop-out control
+
+ Sometimes, a stroke is too thin to even contain a single pixel
+ center. This results in `lost continuity' in the resulting
+ bitmap, i.e., some unpleasant `holes' or `breaks' in the
+ rendered shape, which are called a `drop-out'.
+
+ Because a glyph representation uses curves (Bezier arcs), this
+ case is not easily controllable during the `hinting' of glyph
+ outlines by the font driver, which means that the rasterizer
+ must be able to correct these `artefacts'.
+
+ This processing is called `drop-out control', and can be
+ performed in several modes, defined by the TrueType
+ specification, and which details do not belong to this document.
+ However, the important idea is that, in _some_ cases, a pixel
+ may be lit even if its center isn't part of the shape.
+
+ This case is relatively rare, but is mentioned because it has
+ consequences of the rendering of maps. More precisely, in the
+ way an outline's extent is computed (see below).
+
+
+--------------------------------------------------------------------
+
+
+II. Bitmap and pixmap descriptors
+---------------------------------
+
+ The Freetype rasterizer only supports bitmaps and 8-bit pixmaps.
+ In order to render an outline, a map descriptor must be sent to
+ its rendering functions, along with a vectorial outline.
+
+
+ 1. Bitmap properties
+
+ This section explains how to set up a bitmap descriptor, and how
+ vector coordinates in the outline plane relate to pixel
+ positions within the bitmap buffer.
+
+ A bitmap's `raw data' is made of a simple bit buffer where each
+ bit corresponds to a monochrome pixel. For the sake of
+ simplicity, the FreeType rasterizer uses the following
+ conventions to store bitmaps in a buffer:
+
+ - The value 0 is used for `unlit' pixels, usually the
+ `background' when rendering text. Hence 1 is used for `lit'.
+
+ - Lines are padded to 8 bits, i.e. bytes. A bitmap row thus
+ takes an integral number of bytes in its buffer. No further
+ alignment is required.
+
+ (Some systems compress bitmaps by _not_ padding bit rows to
+ byte boundaries. It is not possible to render into such a
+ bitmap buffer with FreeType.)
+
+ - In a bitmap buffer byte, the left-most pixel is represented by
+ the most significant bit (i.e., 0x80).
+
+ The opposite convention is not supported by the FreeType
+ rasterizer, though it may possibly be implemented too if this
+ ever comes useful (ask the developers -- for now, nobody did).
+
+ - Increasing offsets within a row correspond to right-most
+ positions in the bitmap (i.e., byte 1 contains the
+ 8 bits/pixels that are located on the right of the
+ 8 bits/pixels of byte 0).
+
+ - A bitmap can be oriented in two ways:
+
+ o If increasing row addresses within the buffer correspond to
+ lower vertical lines, the bitmap is said to go `down'. This
+ is, for example, the case of nearly all video RAMs.
+
+ o If increasing row addresses within the buffer correspond to
+ higher vertical lines, the bitmap is said to go `up'. This
+ is the case, for example, for OS/2 bitmaps.
+
+ The `direction' of a bitmap is called `flow' to avoid any
+ confusion. In both cases, the rasterizer ALWAYS matches the
+ vector coordinate (0,0) with the lower-left corner of the
+ *lower-left* pixel in the bitmap.
+
+ The following graphics illustrate these ideas:
+
+
+
+ Y ^
+ | A `down-flow' bitmap.
+ +--+--+--+--+--+--+--+--+ On the left is each
+ | | | | | | | | | row's number and its
+ 0: 0 | | | | | | | | | offset in the bitmap
+ +--+--+--+--+--+--+--+--+ buffer (where `w' is
+ | | | | | | | | | the width, in bytes,
+ 1: w | | | | | | | | | of a single bitmap
+ +--+--+--+--+--+--+--+--+ row). Note that the
+ | | | | | | | | | origin is located at
+ 2: 2*w | | | | | | | | | the lower left, i.e.,
+ +--+--+--+--+--+--+--+--+ near the leftmost bit
+ | | | | | | | | | of the last bitmap
+ 3: 3*w | | | | | | | | | row.
+ -@--+--+--+--+--+--+--+-----> X
+ |[0,0]
+
+
+
+ Y ^
+ | An `up-flow' bitmap.
+ +--+--+--+--+--+--+--+--+ On the left is each
+ | | | | | | | | | row's number and its
+ 3: 3*w | | | | | | | | | offset in the bitmap
+ +--+--+--+--+--+--+--+--+ buffer (where `w' is
+ | | | | | | | | | the width, in bytes,
+ 2: 2*w | | | | | | | | | of a single bitmap
+ +--+--+--+--+--+--+--+--+ row). Note that the
+ | | | | | | | | | origin is located at
+ 1: w | | | | | | | | | the lower left, i.e.,
+ +--+--+--+--+--+--+--+--+ near the first bit in
+ | | | | | | | | | the buffer.
+ 0: 0 | | | | | | | | | The first buffer bit
+ -@--+--+--+--+--+--+--+-----> X corresponds to the
+ |[0,0] rectangle [0,0]-[1,1]
+ in the vector plane.
+
+
+ 2. Bitmap descriptors
+
+ Now that you understand all these details, a bitmap can be
+ described to the rasterizer engine through a map, which
+ structure must be set up by client application:
+
+ struct TT_Raster_Map_
+ {
+ int rows; /* number of rows */
+ int cols; /* number of columns (bytes) per row */
+ int width; /* number of pixels per line */
+ int flow; /* bitmap orientation */
+
+ void* bitmap; /* bit/pixmap buffer */
+ long size; /* bit/pixmap size in bytes */
+ };
+ typedef struct TT_Raster_Map_ TT_Raster_Map;
+
+ where the fields stand for:
+
+ rows:
+ The number of rows within the bitmap buffer.
+
+ cols:
+ The number of columns, i.e. bytes per row within the
+ buffer. It corresponds to the `w' value used in the above
+ graphics.
+
+ width:
+ The number of pixels (i.e. bits) per row in the buffer. The
+ rasterizer always clips its rendering to the bit width
+ specified in this field, even if the `cols' fields
+ corresponds to a larger width.
+
+ flow:
+ The bitmap flow. Use the constants TT_Flow_Up and
+ TT_Flow_Down exclusively for this field.
+
+ bitmap:
+ A typeless pointer to the bit buffer.
+
+ size:
+ The total size of the bit buffer in bytes. This is not used
+ directly by the rasterizer, so applications can use it.
+
+ Note that the `cols' field should always be bigger than the
+ value of `width' multiplied by 8. The rasterizer clips the
+ generated bitmap to the `width' first bits in a row.
+
+ Note also that it is of course allowed to create, for example, a
+ Windows or X11 bitmap through a normal system-specific API call,
+ using a TT_Raster_Map that describes it to the rasterizer. It
+ is thus possible to draw directly into such OS specific
+ structures.
+
+
+ IMPORTANT: *****************************************************
+
+ When rendering a bitmap, the rasterizer always OR-es the shape
+ on the target bitmap. It is thus possible to draw several
+ shapes into a single surface which successive calls to the
+ render functions.
+
+ ****************************************************************
+
+
+ 3. Pixmap properties
+
+ The rasterizer only supports 8-bit pixmaps, where one pixel is
+ represented by a single byte. They must conform to the
+ following rules:
+
+ - A 5-entries palette is used to generate an outline's pixmap in
+ the buffer. They correspond to:
+
+ palette[0] -> background
+ palette[1] -> `light'
+ palette[2] -> `medium'
+ palette[3] -> `dark'
+ palette[4] -> foreground
+
+ where the terms `light', `medium', and `dark' correspond to
+ intermediate values between the first (background) and last
+ (foreground) entry.
+
+ The upcoming FreeType 2.0 will feature an additional
+ anti-aliasing logic with a 17-entries palette.
+
+ - Lines are padded to 32 bits, i.e. 4 bytes. A pixmap row thus
+ takes a multiple of 4 bytes in its buffer.
+
+ - Increasing offsets within a row correspond to right-most
+ positions in the bitmap (i.e., byte/pixel 1 is to the right of
+ byte/pixel 0).
+
+ - A pixmap can be oriented in two ways, following the same rules
+ as a bitmap regarding its flow.
+
+
+ IMPORTANT: *****************************************************
+
+ In order to improve performance when rendering large outlines
+ with anti-aliasing, the rasterizer draws pixels in runs of
+ 4-bytes ONLY when at least one of their `colour' isn't 0
+ (background).
+
+ This means that you should ALWAYS CLEAR the pixmap buffer before
+ calling the rendering function, you may otherwise experience
+ ugly artefacts, which are possibly left from a previous
+ rendering!
+
+ In general, it is not possible to do colour compositing with the
+ FreeType rasterizer (compositing is if you want to superpose a
+ transparent coloured layer on top of an image). This is mainly
+ due to the fact that:
+
+ - There are too many pixel formats to support.
+
+ - There is not a single portable way to do it anyway.
+
+ - It really is a graphics processing question, not one that
+ should be solved by a text rendering engine.
+
+ ****************************************************************
+
+
+ 4. Pixmap descriptors
+
+ Pixmaps use the same descriptor structure as bitmaps, with a few
+ differences in interpretation:
+
+ - The `cols' field is used to indicate the number of _bytes_ in
+ a pixmap row. It must thus be a multiple of 4!
+
+ - The rasterizer clips the outline to the first `width'
+ pixels/width within each buffer row.
+
+ As usual, it should be possible to use a system-specific pixmap
+ and render directly into it, as long as you set up a descriptor
+ for it.
+
+
+-------------------------------------------------------------------------
+
+
+III. Rendering an outline
+-------------------------
+
+ Now that you understand how the rasterizer sees the target bitmaps
+ and pixmaps it renders to, this section will explain how the
+ rendering eventually happen.
+
+
+ 1. Outline coordinates and extents
+
+ Let's first consider the case where we're rendering text
+ directly into a huge single bitmap. To do that, we simply
+ translate each glyph outline before calling the rasterizer.
+ Here the roadmap:
+
+ - Vectorial coordinates [0,0] are mapped to the lower left
+ `corner' (in the grid) of the lower left pixel in the bitmap
+ (whatever its flow is).
+
+ - When the glyph loader returns an outline, the latter is placed
+ so that the coordinate [0,0] corresponds to the current cursor
+ position.
+
+ This means that:
+
+ - If we use our own cursor (cx,cy) within the bitmap during text
+ rendering, we must translate the outline to its position
+ before rendering it, e.g. with
+
+ TT_Translate_Outline( outline, cx, cy )
+
+ (and the cursor position must be incremented after rendering
+ each glyph).
+
+ - Before translation (i.e., when it is returned by the glyph
+ loader), the glyph outline doesn't necessarily lie on any of
+ the coordinate axes, nor is it limited to the first quadrant
+ (i.e., x>0 and y>0 is not true in general).
+
+ Its extent can be computed with the function
+ TT_Get_Outline_BBox(), which returns the minimum and maximum
+ values of its X and Y point coordinates (in 26.6 format, of
+ course).
+
+
+ 2. Computing an outline's dimensions in pixels
+
+ In many cases, however, it is much better to render individual
+ glyph bitmaps, then cache them with appropriate metrics in order
+ to render text much more quickly at a given point size.
+
+ To be able to render the smallest possible bitmap, the exact
+ outline's extent dimensions in pixel are required. Again a
+ roadmap:
+
+ - Get the outline's bounding box in vector coordinates:
+
+ Simply call the TT_Get_Outline_BBox() function which will
+ return the values of xMin, yMin, xMax, and yMax in vector
+ (i.e. fractional) coordinates.
+
+ - Grid-fit the bounding box:
+
+ Because of the way pixels are lit in the bitmaps relative to
+ the position of their `centers' within the shape (see
+ section I), it is necessary to align the values of xMin, xMax,
+ yMin, and yMax to the pixel grid in order to compute the width
+ and height of the resulting bitmap. This can be done with:
+
+ xMin = FLOOR ( xMin ); with FLOOR(x) == (x & -64)
+ xMax = CEILING( xMax ); CEILING(x) == ((x+63) & -64)
+ yMin = FLOOR ( yMin );
+ yMax = CEILING( yMax );
+
+ The extents in pixels can then be simply computed as:
+
+ pixel_width = (xMax - xMin) / 64;
+ pixel_height = (yMax - yMin) / 64;
+
+ Note that because of drop-out control, and because the
+ bounding box computed currently includes all Bezier control
+ points from the outline, the bitmap may be slightly larger
+ than necessary in some cases.
+
+ Some improvements are planned for FreeType 2.0; for now, you
+ should consider that finding the `exact' bitmap bounding box
+ requires to scan all `borders' to detect null columns or rows.
+ However, the values are right in most cases.
+
+ NOTE: It seems that in some *rare* cases, which relate to
+ weird drop-out control situations, the above dimensions
+ are not enough to store all bits from the outline (there
+ are one or more bits `cut' on the edge).
+
+ This being hard to study (it only appears in very poorly
+ hinted fonts), we leave this problem to FreeType 2.0.
+
+ - Create/setup a bitmap with the computed dimensions. DON'T
+ FORGET TO CLEAR ITS BUFFER TOO!
+
+ - Translate the outline to stick within the bitmap space. This
+ is done easily by translating it by (-xMin,-yMin), where you
+ should ALWAYS USE THE GRID-FITTED VALUES computed above for
+ xMin and yMin:
+
+ TT_Translate_Outline( outline, -xMin, -yMin );
+
+
+ IMPORTANT: ***************************************************
+
+ For technical reasons, you should never translate a HINTED
+ outline by a non-integer vector (i.e., a vector which
+ coordinates aren't multiples of 64)! This would CERTAINLY
+ completely RUIN the delicate HINTING of the glyph, and will
+ result probably in pure GARBAGE at small point sizes.
+
+ Of course, if you're not interested in hinting, like when
+ displaying rotated text, you can ignore this rule and
+ translate to any position freely.
+
+ **************************************************************
+
+ - Render the bitmap (or pixmap).
+
+ DON'T FORGET TO STORE THE GRID-FITTED xMin and yMin WITH THE
+ BITMAP! This will allow you later to place it correctly
+ relative to your cursor position.
+
+
+ Here's some example pseudo code:
+
+ {
+ ... load the glyph ...
+
+ TT_Outline outline;
+ TT_BBox bbox;
+ TT_Raster_Map bitmap;
+
+
+ /* get the outline */
+ TT_Get_Glyph_Outline( glyph, &outline );
+
+ /* compute its extent */
+ TT_Get_Outline_BBox( &outline, &bbox );
+
+ /* Grid-fit it */
+ bbox.xMin &= -64;
+ bbox.xMax = ( bbox.xMax + 63 ) & -64;
+ bbox.yMin &= -64;
+ bbox.yMax = ( bbox.yMax + 63 ) & -64;
+
+ /* compute pixel dimensions */
+ width = (bbox.xMax - bbox.xMin) / 64;
+ height = (bbox.yMax - bbox.yMin) / 64;
+
+ /* set up bitmap */
+ bitmap.rows = height;
+ bitmap.width = width;
+ bitmap.cols = (width + 7) / 8;
+ bitmap.size = bitmap.rows * bitmap.cols;
+ bitmap.bitmap = malloc( bitmap.size );
+ if ( !bitmap.bitmap )
+ return error_memory...
+
+ /* clear the bitmap buffer! */
+ memset( bitmap.bitmap, 0, bitmap.size );
+
+ /* translate outline */
+ TT_Translate_Outline( &outline, -bbox.xMin, -bbox.yMin );
+
+ /* render it within the bitmap */
+ TT_Get_Outline_Bitmap( engine, &outline, &bitmap );
+
+ /* We're done; don't forget to save bbox.xMin and */
+ /* bbox.yMin to adjust the bitmap position when */
+ /* rendering text with it */
+
+ ...
+ }
+
+
+ 3. The case of transformed/rotated glyphs:
+
+ You may want to apply a transformation other than a translation
+ to your glyph outlines before rendering them. For example, a
+ simple slant to synthesize italics, or a slight rotation.
+
+ In all cases, it is possible to render individual glyph bitmaps.
+ Just make sure to follow the same process AFTER you have
+ transformed you outline!
+
+ DON'T FORGET THAT YOU NEED TO RE-COMPUTE THE BBOX TO GET THE
+ CORRECT PIXEL DIMENSIONS AFTER A TRANSFORMATION.
+
+
+--------------------------------------------------------------------
+
+
+IV. Anti-aliasing palette and other concerns
+
+ When rendering pixmaps, using the TT_Get_Outline_Pixmap() or
+ TT_Get_Glyph_Pixmap() functions, the rasterizer uses a 5-entries
+ palette of 8-bit deep `colors'.
+
+ By default, this palette is set to ( 0, 1, 2, 3, 4 ), but one can
+ change it to suit your needs with TT_Set_Raster_Palette().
+
+ While in bitmap mode, it simply OR-es the pixel values to the
+ target bitmap that has been passed to TT_Get_Outline_Bitmap().
+
+ For pixmaps it simply writes directly the palette entries
+ corresponding to the `color' of the `lit' pixels it has computed.
+ This means that it is NOT POSSIBLE to render text in a single
+ pixmap with multiple calls to TT_Get_Outline_Pixmaps() within the
+ same target!
+
+ The reason is that `gray' pixels of two distinct outlines are not
+ `added' when they overlap (the operation called 'compositing'), as
+ it could be expected by applications.
+
+ The following graphic shows this effect when rendering two
+ overlapping anti-aliased shapes:
+
+
+ *** ***
+ .** .**
+ ** **. **. **
+ .*. .*.. .*..*.
+ .*. + .*. = ---> ..*.
+ .*. ** | .*. **
+ ** | **
+ **. | **.
+ *** | ***
+ |
+
+ missing black pixel after second
+ rendering...
+
+
+ There is no simple way to perform a composition within the
+ rasterizer. This would not be portable; moreover, it would be
+ extremely slow if it is too general. This operation is thus left
+ to client applications which can use their own system-specific API
+ for transparently blitting the glyph pixmaps into a surface to
+ form text.
+
+ NOTE:
+
+ If your system doesn't support transparent/alpha blits, you can
+ still have a look at the source file `freetype/test/display.c'.
+ It uses a large pixmap, with a special palette trick to render all
+ text quickly, then convert everything to `real' colors for
+ display.
+
+
+--------------------------------------------------------------------
+
+
+Conclusion
+----------
+
+ We've seen how the FreeType rasterizer sees bitmaps through
+ descriptors, as well as the mapping which exists between the
+ vector coordinate space and the pixel position space.
+
+ You should now be able to render outlines into bitmaps and pixmaps
+ while applying transformations like translation, slanting, or
+ rotation. Don't forget a few rules, however:
+
+ - Always clear the bitmap/pixmap buffer before rendering (unless
+ you want to render several glyphs in a single _bitmap_; it won't
+ work on a pixmap).
+
+ - A pixmap `cols' field, i.e. the size in bytes of each rows, must
+ be a multiple of 4.
+
+ - Never translate a hinted outline by a non-integer vector if you
+ want to preserve the hints (i.e., the vector's coordinates must
+ be multiples of 64).
+
+ - Finally, don't expect the rasterizer to composite transparent
+ `grays' for you in a single target pixmap through multiple
+ calls.
+
+
+--- end of bitmaps.txt ---
diff --git a/Build/source/libs/freetype/docs/changes.txt b/Build/source/libs/freetype/docs/changes.txt
new file mode 100644
index 00000000000..e76cf6fce66
--- /dev/null
+++ b/Build/source/libs/freetype/docs/changes.txt
@@ -0,0 +1,1031 @@
+Changes between FreeType version 1.3.1 and version 1.5
+======================================================
+**
+** WARNING: Because of the Apple patents problem, the TrueType
+** bytecode interpreter is now turned *OFF* by default. Edit
+** ft_conf.h if you want to (and can) use grid-fitting.
+**
+
+Note: Version 1.4 has never been released officially.
+
+
+Documentation
+-------------
+
+ apiref.txt has been again revised.
+
+
+ apirefx.txt has been extended to document the GPOS interface.
+
+
+ TODO has been dropped (since we consider there will be no
+ further development).
+
+
+API functions
+-------------
+
+ TT_Char_Index() now uses TT_ULong for character codes. It now
+ supports cmap tables in format 8 and 12.
+
+
+ New error code (TT_Err_Too_Many_FDefs) when a font defines too
+ many functions.
+
+
+Architectures
+-------------
+
+ Support files for BeOS have been contributed by Chris Herborth
+ <cherborth@vdelta.com>.
+
+
+ The EXPORT_DEF/EXPORT_FUNC/etc. stuff has been replaced with a
+ more elaborate scheme (coming from the Freetype 2 experience)
+ that allows more complex cases of interface to be handled. See
+ ttconfig.h for details.
+
+
+ Cleaning up of the ft_conf.h files to remove obsolete stuff.
+
+
+Extensions
+----------
+**
+** Full support for the GPOS table has been implemented. As usual,
+** the documentation is available in apirefx.txt, and ftstrtto
+** demonstrates how to use it.
+**
+
+ TT_GSUB_Add_String() has two additional parameters needed for
+ GPOS support.
+
+
+ TT_CharMap_Next() of the ftxcmap extension now uses `TT_ULong'
+ as the second parameter.
+
+
+ A long-lived bug in ftxpost.c (with 2.0 format, when the
+ additional names were out of order, the names were incorrectly
+ assigned) has been extermined. Thanks to Jean-Christophe Dubacq
+ <Jean-Christophe.Dubacq@lri.fr>.
+
+
+Test programs
+-------------
+
+ ftstrtto now uses `S' instead of `G' to toggle activation of
+ GSUB. `P' will toggle GPOS activation (this is new). UTF-8
+ values greater than U+FFFF are supported.
+
+
+ ftdump will dump some information about the GPOS table also.
+
+
+ ftstrpnm now supports coloured text.
+
+
+Miscellaneous
+-------------
+**
+** You can now at your option use either the FreeType license
+** (usable in commercial products) or the GPL license (usable with
+** other free software, but this requires any further development
+** to be released to the public).
+**
+
+ The library has been updated to use libtool 1.3.4.
+
+
+ Fixed a mutex bug in the ttraster module.
+
+
+ The FreeType license has been reworded to improve legibility
+ (thanks to Ruthanna Wilson <ruthanna@us.ibm.com>).
+
+
+ Fixed a property bug in the arabic module.
+
+
+ Various small fixes to reduce compiler warnings.
+
+
+ Fixed the thread-safe build. The following files didn't compile
+ properly when TT_CONFIG_OPTION_THREAD_SAFE is defined:
+
+ lib/arch/unix/ttmmap.c
+ lib/extend/ftxsbit.c
+ lib/extend/ftxgpos.c
+ lib/extend/ftxgdef.c
+ lib/extend/ftxgsub.c
+
+
+ More tests to prevent division by zero.
+
+
+ <ttnameid.h> has been updated.
+
+
+ OS/2 table version 2 is now recognized.
+
+
+Contributed programs
+--------------------
+
+ ttf2bdf:
+ Changed bitmap generation for outline glyphs to Flow_Down.
+
+
+ Added support for strikes (bitmaps).
+
+
+ Added missing parameter documentation.
+
+
+ Minor documentation changes and compatibility with latest
+ Freetype.
+
+
+ ttf2pk:
+ Added support for multiple SFD files.
+
+ New option `-L' to provide a ligature mapping file (patch from
+ CHO Jin-Hwan <chofchof@kias.re.kr>).
+
+ New option `-w' to emit PostScript encoding vectors for
+ subfont files to be used with pdfLaTeX (patch from CHO
+ Jin-Hwan <chofchof@kias.re.kr>).
+
+ Add support for a configuration file (ttf2pk.cfg) which can
+ read more than a single map file, similar to pdfTeX (patch
+ from CHO Jin-Hwan <chofchof@kias.re.kr>).
+
+ Support for character codes greater than 0xFFFF (patch from
+ Dominique Unruh <dominique@unruh.de>).
+
+ ttf2tfm no longer assumes that the x-height is always 400 PS
+ units.
+
+
+Pascal source code
+------------------
+**
+** The Pascal source files have been completely removed from the
+** FreeType distribution. It is now available as an extra package;
+** for more information please visit http://www.freetype.org.
+**
+
+
+Changes between FreeType version 1.3 and version 1.3.1
+======================================================
+
+ Bug fixes.
+
+
+
+Changes between FreeType version 1.2 and version 1.3
+====================================================
+
+
+Documentation
+-------------
+
+ Improved installation instructions.
+
+
+ Complete revision of almost all documentation files.
+
+**
+** Added the file apirefx.txt to document all extensions to the
+** FreeType library. Consequently, errstr.txt has been removed.
+**
+
+ Added the file optimize.txt, explaining how to improve FreeType
+ on a given architecture.
+
+**
+** Documentation about possible patent restrictions added.
+**
+
+ Added howto/mac.txt (stating basically that the FreeType team
+ can't support the Macintosh platform because of lack of
+ knowledge).
+
+
+ Added howto/msdos.txt, documenting compilation for various 16bit
+ and 32bit compilers.
+
+
+API functions
+-------------
+
+ TT_Load_Kerning_Table() now returns TT_Err_Invalid_Argument
+ instead of TT_Err_Bad_Argument (which is used for an internal
+ error only) for an invalid argument. The same holds for
+ TT_Get_Face_Widths() and TT_Get_Glyph_Big_Metrics().
+
+
+ If the glyf table is missing, the new error code
+ TT_Err_Glyf_Table_Missing is returned instead of
+ TT_Err_Table_Missing. This affects TT_Get_Face_Widths(),
+ TT_Load_Glyph(), and TT_Open_Face().
+
+**
+** New function TT_FreeType_Version() to get the major and minor
+** version dynamically.
+**
+
+ TT_Load_Glyph() has now two additional flags. TTLOAD_PEDANTIC
+ will force pedantic handling of the glyph instructions, and
+ TTLOAD_IGNORE_GLOBAL_ADVANCE_WIDTH is needed for some fonts
+ which have correct advance width values for the glyphs but an
+ incorrect global advance width value.
+
+
+ TT_Get_Glyph_Big_Metrics() now returns correct vertical bearing
+ values (both linear and pixel values).
+
+
+ New error code TT_Err_Glyf_Table_Missing (0x89) used to indicate
+ a missing `glyf' table.
+
+
+ The following macros have been shortened to stay within the
+ limit of 32 characters (the longer macro names are still
+ available if HAVE_LIMITS_ON_IDENTS is not defined).
+
+ TT_UCR_ARABIC_PRESENTATION_FORMS_A ->
+ TT_UCR_ARABIC_PRESENTATIONS_A
+ TT_UCR_ARABIC_PRESENTATION_FORMS_B ->
+ TT_UCR_ARABIC_PRESENTATIONS_B
+
+ TT_UCR_COMBINING_DIACRITICAL_MARKS ->
+ TT_UCR_COMBINING_DIACRITICS
+ TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB ->
+ TT_UCR_COMBINING_DIACRITICS_SYMB
+
+
+ freetype.h:
+
+ TT_Bool is now typedef'ed as `typedef int'.
+
+ New typedefs: TT_Int and TT_UInt.
+
+ Declarations of TT_Matrix_Multiply() and TT_Matrix_Invert()
+ have been removed since these functions were never
+ implemented.
+
+
+Architectures
+-------------
+
+ Added `ansi' directory to the supported architectures -- any
+ ANSI C compiler should compile FreeType with these files.
+
+
+ Added `debugger' directory to the architectures. Use this to
+ build a special version of FreeType for bytecode debugging
+ (tested with OS/2 and Unix).
+
+
+ Added more files to the `mac' architecture directory to make
+ basic support complete.
+
+
+ Support for VMS added (to compile the library only).
+ Contributed by Jouk Jansen <joukj@hrem.stm.tudelft.nl>.
+
+
+ Added `win16' architecture directory for older Windows versions.
+ A graphics driver (gw_win16.c) for the example programs is
+ available also.
+
+**
+** Antoine Leca contributed support for many MS-DOS and Windows
+** compilers (including library fixes to make it 16bit compliant):
+**
+ Borland C++ for MS-DOS (tested with v. 3.1, 4.02, 5.0),
+ Microsoft C for MS-DOS,
+ Turbo C (versions 1.5 and 2.0 -- version 1.0 is too old),
+ Borland C++ 4.0 and 5.0 for Windows (both 16bit and 32bit
+ versions),
+ gcc under Win32 (Cygwin32 or MinGW32),
+ Microsoft Visual C++ 2.x, 4.x, 5.0, and 6.0 for Windows
+
+
+ Support for the gettext package with DJGPP compiler has been
+ added.
+
+
+ Since many older compilers on both MS-DOS and Windows platforms
+ have problems to build dependency files automatically, scripts
+ for gcc under Unix have been added to do this. Similarly, a
+ script to produce a DLL definition file is now included in the
+ distribution.
+
+
+ Moved old win32 support to contrib/win32, replacing all CR/LF
+ with LF, and using only lowercase file names for consistency.
+ Additionally, some missing files in the FreeType 1.2
+ distribution have been added. Antoine Leca has written a new,
+ light-weight graphics driver (gw_win32.c) which fits better into
+ the current scheme.
+
+
+ Small additions have been made to the Amiga graphics driver.
+
+
+ The use of the ARM macro (intended for this architecture) has
+ been completely removed due to lack of support.
+
+
+ Checks for endianness have been removed completely since
+ FreeType isn't dependent on it.
+
+
+Global compilation macros
+-------------------------
+
+ The TT_HUGE_PTR macro has been added to support fonts with more
+ than 16000 characters or so with 16bit MS-DOS compilers.
+ Consequently, the files hugefile.c and hugemem.c have been added
+ which provide special versions for these compilers.
+
+
+ HAVE_LIMITS_ON_IDENTS has been introduced to overcome
+ restrictions with old compilers which can't digest identifiers
+ longer than 32 characters.
+
+**
+** Added option TT_CONFIG_OPTION_NO_INTERPRETER to desactivate the
+** bytecode interpreter completely. This option is off by default.
+**
+
+ Added options TT_CONFIG_OPTION_STATIC_RASTER and
+ TT_CONFIG_OPTION_STATIC_INTERPRETER to build static versions of
+ the respective components. Off by default. (It was formerly
+ called TT_STATIC_RASTER.)
+
+ Better debugging support (see ttconfig.h for details):
+ DEBUG_LEVEL_TRACE, DEBUG_LEVEL_ERROR, DEBUG_INTERPRETER,
+ DEBUG_MEMORY, DEBUG_FILE.
+
+ Added TT_MAX_EXTENSIONS to define the maximal number of
+ extensions (currently set to 8 -- this macro was previously in
+ ttextend.c).
+
+
+Extensions
+----------
+**
+** Full support for TrueType Open resp. OpenType GSUB tables has
+** been implemented. It uses a GDEF table if available; otherwise,
+** a method to construct an artificial GDEF table has been added
+** (note that GDEF parts not related to GSUB are loaded but not
+** further handled). An example how to use it can be found in the
+** new test program ftstrtto.
+**
+
+ Rudimentary GPOS support -- currently, you can load the GPOS
+ subtables but nothing more.
+
+**
+** Documentation for all extensions can be found in the file
+** apirefx.txt.
+**
+
+ Fixed a bug in TT_Load_PS_Names() which returned a local, thus
+ invalid pointer.
+
+**
+** Support for embedded bitmaps has been added (thanks to
+** YAMANO'UCHI Hidetoshi <mer@interlink.or.jp> who has contributed
+** a lot of the code). It can handle `bloc', `bdat', `EBLC', and
+** `EBDT' tables. [TrueType embedded bitmaps are also called
+** `sbits' (for `scaler bitmaps').]
+**
+
+Test programs
+-------------
+**
+** A new test program called ftstrtto has been added to test
+** TrueType Open features. Almost all available FreeType
+** extensions are used in this program -- it displays a UTF 8
+** encoded string on screen, allowing to toggle kerning, embedded
+** bitmaps, GSUB support, and hinting. Additionally, it has a
+** special module to handle the Arabic script properly (in
+** arabic.c), i.e., it treats initial, medial, final, and isolated
+** glyphs correctly.
+**
+
+ The new module `blitter.c' provides the blitting function
+ Blit_Bitmap() for bitmaps of various depth.
+
+
+ The debugging program `fdebug' has been rewritten to provide a
+ better user interface.
+
+
+ ftdump has been extended to show information about embedded
+ bitmaps and GSUB data. It will now also show the PostScript
+ name of the font.
+
+
+ The new test program ftmetric can dump metrics and glyphs -- it
+ uses the gettext package for i18n support.
+
+
+ Another new test program is ftsbit to dump embedded bitmaps
+ contained in a font.
+
+
+ A small bug has been fixed in ftstring to compute the right
+ bounding box of the string.
+
+
+ ftview has been extended to display embedded bitmaps also
+ (switch `-B').
+
+
+ The maximal point size of glyphs in ftview has been increased to
+ 5000pt -- this has shown some clipping bugs in the engine which
+ have been fixed meanwhile. As a demonstration, it also
+ activates tracing of the raster and gload component if
+ DEBUG_LEVEL_TRACE (see above) is defined.
+
+
+Miscellaneous
+-------------
+
+ The library has been updated to use autoconf 2.13 and libtool
+ 1.3.3 throughout.
+
+**
+** FreeType will now install its header files in
+** <prefix>/freetype/... since the number of files has grown again.
+**
+
+ Added a lot of EXPORT_FUNC/EXPORT_DEF macros to functions for
+ correct exporting in DLLs.
+
+**
+** FreeType can now successfully load Mac fonts which don't have an
+** `OS/2' table.
+**
+
+ Fixed a bug in handling composite glyphs where the composite
+ elements use attached points.
+
+
+ Better debugging support for instructions.
+
+
+ Various workarounds have been implemented to support slightly
+ broken fonts (or rather, fonts not following exactly the
+ TrueType specifications).
+
+
+Contributed programs
+--------------------
+
+ ttf2bdf:
+**
+** Swapped all the columns in the mapping files.
+**
+
+ Changed the mapping table loader to index on the second column
+ instead of the first.
+
+
+ Changed the includes to deal with compilation on Windows.
+
+
+ Added some new mapping tables.
+
+
+ Fixed an incorrect parameter for Traditional C compilers.
+
+
+ Added generation of the _XFREE86_GLYPH_RANGES properties.
+
+
+ Change all CRLF's, CR's, or LF's in copyright strings to
+ double spaces.
+
+
+ Changed it so gcc 2.8.1 likes the return type of main() again.
+
+
+ Changed Makefile.in a bit to make installation more
+ consistent.
+
+
+ Changed the lower limit for the vertical and horizontal
+ resolutions to be 10dpi instead of 50dpi.
+
+
+ ttf2pfb:
+
+ Has now rudimentary support for mapping tables (switch `-m')
+ and better PostScript name support for ordinary Type 1 fonts
+ -- nevertheless, it is far from finished, and there are some
+ plans to merge it with ttf2pt1.
+
+ configure script added.
+
+ Option `-k' added to keep output file in case of error.
+
+ `-v' is now really verbose.
+
+ ttf2pk:
+**
+** Support for MiKTeX's file searching mechanism added (ttf2pk
+** and ttf2tfm are now part of the MiKTeX).
+**
+**
+** Support for rotated glyphs added (only for subfonts; switches
+** `-x' and `-y' to activate rotation resp. controlling the y
+** offset). If a GSUB table with the `vert' feature is available
+** in the font, vertical glyph presentation forms are used.
+**
+
+ Added warning message to the configure script in case the
+ kpathsea library isn't used.
+
+
+ Fixed an omission in Bg5.sfd.
+
+**
+** Added UBg5plus.sfd for mapping Unicode to Bg5+ encoding.
+** Similar SFD files now available: UBg5.sfd, UGB.sfd, UGBK.sfd,
+** UJIS.sfd, UKS.sfd.
+**
+
+ Added documentation for dvidrv.btm.
+
+
+ Will now compile with kpathsea version 3.3 or newer also.
+
+
+ Subfont ligature support added as needed in the HLaTeX package
+ for Korean (switch `-l').
+
+**
+** Since ttf2pk support has been added to teTeX version 1.0 and
+** newer, no patch are necessary.
+**
+
+ Fixed a string initialization bug in buildtfm() (file
+ tfmaux.c).
+
+
+ Added more documentation about file searching and a full
+ example how to use ttf2tfm.
+
+
+ Fixed a small bug in ttf2tfm.c which printed `(null)' instead
+ of nothing for the ttfonts.map entry if the font name prefix
+ string was empty.
+
+
+ ttf2tfm will now use the first type 0 kerning table only
+ (instead of the first kerning table only).
+
+
+ Both ttf2pk and ttf2tfm will now apply stretching and slanting
+ directly to the outline. This usually yields smaller bounding
+ boxes.
+
+
+ ttf2tfm will now output a comment string to the VPL file to
+ illustrate the meaning of the `HEADER' lines.
+
+
+ ttfbanner:
+
+ Added Makefile for emx+gcc compiler.
+
+
+ Added autoconf support.
+
+
+ Fixed a lot of compilation warnings.
+
+
+Pascal source code
+------------------
+
+ The Pascal source code has been seriously updated since 1.2.
+ Here are the most important changes.
+
+**
+** A. Support for charmaps and the name table
+**
+**
+** The Charmap functions were not correctly implemented before
+** 1.3. They are now available in the Pascal API.
+**
+**
+** Similarly, the `name' table was not loaded, and the
+** TT_Get_Name function wasn't implemented before 1.3. It is now
+** done.
+**
+**
+** The Pascal engine is now feature-complete, except that it
+** provides no extensions like the C source code.
+**
+
+ B. Improvements in the glyph loader and the interpreter
+
+
+ Several changes were made in order to be able to load more
+ broken fonts, as well as old Apple fonts which happened to use
+ some very rarely-used aspects of the specification.
+
+
+ Note that the Pascal bytecode interpreter, contrary to the C
+ version, is not able to silently accept broken glyphs yet, or
+ even use the flag TTLOAD_PEDANTIC. Implementing this in
+ Pascal would require some serious work (unlike to C, where
+ this feature was introduced easily with the use of a few
+ macros to minimize source changes). So TT_Load_Glyph might
+ return an error with the Pascal engine while the C one accept
+ the same request successfully.
+
+
+ C. Ports to Delphi and Free Pascal
+
+ This release has been compiled on the following compilers:
+
+ - Free Pascal 0.9 (Dos,Linux,Win32,OS/2)
+ - Virtual Pascal 1.1 and 2.0 (Win32 and OS/2)
+ - Turbo Pascal 6.0 and Borland Pascal 7.0 (Dos)
+ - Delphi 1, 2, and 3. It should work with D4 and D5 also.
+ (Windows)
+
+ Note that most of the test programs will not compile on
+ anything except MS-DOS or OS/2. The debugger also needs the
+ Turbo Vision library. The library, however, should compile
+ fine with all tools cited above.
+
+
+
+Changes between FreeType 1.1 and 1.2
+====================================
+
+Mostly bug fixes and build fixes.
+
+
+
+Changes between FreeType 1.0 and 1.1
+====================================
+
+There were various changes since the 1.0 release. Here they are
+summarized:
+
+- Added vertical layout support
+
+ The engine now loads the vertical header and metrics if available
+ and makes them visible through the new `vertical' field of the
+ face properties (it is set to NULL if no vertical data was found
+ in the font file).
+
+ The glyph loader now loads all metrics (horizontal and vertical),
+ but still returns the horizontal ones only with the API
+ TT_Get_Glyph_Metrics(). However, TT_Get_Glyph_Bit_Metrics() has
+ been added to extract them from a glyph container.
+
+
+- Serialization of coordinates arrays in TT_Outline()
+
+ As announced in the previous API reference, the structure of
+ TT_Outline changed slightly, as well as the naming of its fields.
+ The points are now stored in a single array of TT_Vector, instead
+ of two parallel arrays (one for the Xs, the other for the Ys).
+
+
+- New API function TT_Get_Face_Metrics()
+
+ Useful to access unscaled metrics like left side bearings, advance
+ widths, top side bearings, and advance height, for a given range
+ of glyphs.
+
+
+- New extension: ftxcmap.c
+
+ Used by some applications to enumerate and parse the charmap
+ tables in an easier way.
+
+
+- New extension: ftxpost.c
+
+ With this extension you can access the PostScript glyph names
+ given in the `post' table.
+
+
+- New extension: ftxwidth.c
+
+ This extension is used to parse the `glyf' table to extract the
+ bounding boxes of a given range of glyphs. This is much faster
+ than loading individual glyphs.
+
+
+- The FreeType engine is now THREAD-SAFE and REENTRANT
+
+ However, the implementation of ttmutex must be refined for your
+ system -- the default one is a dummy and doesn't do anything!
+ Beware! THIS IS STILL IN BETA.
+
+ The thread-safe and reentrant builds now compile and seem to run
+ well when used with a single thread. Some efforts have been spent
+ to check the coherency of the lock contentions within the engine,
+ but we haven't tested multi-threading heavily.
+
+
+- Large internal re-organization
+
+ Too technical to explain shortly, but results in a much better
+ memory footprint and smaller code, especially when opening
+ multiple faces.
+
+
+- Fixes/enhancements to the interpreter
+
+ The infamous Monotype.com bug (a new free font released by
+ Microsoft Typography a few days after the FreeType 1.0 release!)
+ is fixed, of course, as well as few other little and unpleasant
+ artifacts...
+
+ The interpreter was also seriously re-organized to allow the use
+ of a very large `switch' statement, instead of a jump table, which
+ results in smaller and faster code on some systems (depending of
+ the compiler too). Users of the library can experiment with the
+ TT_CONFIG_OPTION_INTERPRETER_SWITCH configuration macro to test
+ this.
+
+
+- Single object compilation mode
+
+ The core engine can now be compiled into a single object file.
+ This allows optimizing compilers to do more global optimizations,
+ and get rid of many of the `intermediate' internal symbols used to
+ link internal engine components together.
+
+ The engine now takes only 48kByte of stripped Intel object code!
+
+
+- DLL compilation mode
+
+ In order to allow the compilation of the library as a DLL, the
+ keyword EXPORT has been added as a prefix to all high-level API
+ functions found in `freetype.h'. Define it to the value you need
+ before `#include "freetype.h"' when building the DLL (if undefined
+ it will default to nothing within this header file).
+
+ (Apparently, this is only useful on Win32, maybe on OS/2.)
+
+
+- Renamed configuration macros
+
+ These were renamed to forms of TT_CONFIG_OPTION_XXXXX_YYYYY.
+ They're located in ttconfig.h and can be defined/undefined
+ manually by developers who want to tune the compilation of the
+ engine:
+
+ TT_CONFIG_OPTION_EXTEND_ENGINE
+
+ Allows extensions to be linked with the single object engine.
+ If you don't need any of them, you may save one or more
+ kilobytes by undefining it.
+
+
+ TT_CONFIG_OPTION_GRAY_SCALING
+
+ Allows the compilation of the gray-scaling (font smoothing)
+ code in ttraster. If undefined, some APIs won't be available:
+
+ TT_Set_Raster_Palette(),
+ TT_Get_Glyph_Pixmap(),
+ TT_Get_Outline_Pixmap()
+
+
+ TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+ Uses a large `switch' statement in the bytecode interpreter
+ instead of a constant call-table. Depending on your processor
+ and compiler, this can lead to significant reduction of code
+ size and/or increase of performance.
+
+
+ TT_CONFIG_OPTION_THREAD_SAFE
+
+ When defined, a thread-safe version of the engine is built. A
+ thread-safe version is a bit bigger, probably not slower, than
+ a non-threaded build. ATTENTION: You must redefine the file
+ `lib/ttmutex.c' for your own platform to get it to work
+ correctly.
+
+
+ Some more options may come in the future...
+
+
+- New API functions TT_MulDiv() and TT_MulFix()"
+
+ To help you compute `a*b/c' with 64-bit intermediate precision, or
+ `a*b/0x10000' with the same one...
+
+ These are not necessarily the fastest functions but they are
+ clearly portable and overflow-safe. Your runtime/compiler may
+ provide better replacements, though...
+
+
+
+Changes between FreeType Beta and 1.0
+=====================================
+
+There were a number of changes since the public beta:
+
+
+I. Bug fixes
+------------
+
+ The following bugs have been fixed in this release:
+
+
+ - Incorrect advance width and left side bearings
+
+ The glyph loader has been re-designed to match the values found
+ in the pre-calc tables...
+
+
+ - Problems when opening multiple fonts
+
+ Fixed. A stupid bug in the i/o component.
+
+
+ - Problems with some Georgian fonts
+
+ Fixed. Discovered some new undocumented opcodes behaviour...
+
+
+ - Buglets in the test programs which made them return invalid
+ error codes
+
+ Fixed.
+
+
+ - Memory leaks when trying to open broken some font files
+
+ Fixed. Waiting for more broken fonts to test...
+
+
+ - Non-square resolutions don't work or display correctly
+
+ They now work very well!
+
+
+ - The scan-line converter, while in font-smoothing mode, doesn't
+ perform horizontal drop-out control
+
+ This wasn't really bug, but the feature has been correctly
+ added.
+
+
+The remaining `features' persist, as they're not essential yet:
+
+ - The `rotated' and `stretched' flags do not work (glyph loading
+ will then return errors). However, it is still possible to
+ rotate or transform any outline without setting these flags.
+
+ - We always use drop-out mode number 2, as some of the values
+ returned by some `cvt programs' seem invalid for now...
+
+
+Note also that an `event hook/callback' has been introduced in this
+release, but is still under alpha (not even beta; it is commented
+out currently). You should not rely on this...
+
+
+II. Code changes
+----------------
+
+ 1. API Changes
+
+ A few API changes were necessary in order to support important
+ features, or future improvements which will come in later
+ releases.
+
+
+ - TT_Set_Instance_Resolution() was renamed to
+ TT_Set_Instance_Resolutions().
+
+
+ - TT_Set_Instance_PointSize() has disappeared. Instead, the
+ following APIs have been defined:
+
+ TT_Set_Instance_CharSize()
+ TT_Set_Instance_CharSizes()
+ TT_Set_Instance_PixelSizes()
+
+
+ - The TT_Engine class has been introduced. It models one
+ instance of the library, and is used to allow re-entrance and
+ shared library code. The functions which now depend on a
+ TT_Engine parameter are:
+
+ TT_Init_FreeType()
+ TT_Done_FreeType()
+ TT_Open_Face()
+ TT_Open_Collection()
+ TT_Set_Raster_Palette()
+ TT_Get_Outline_Bitmap()
+ TT_Get_Outline_Pixmap()
+
+ Note that there is _no_ sharing of objects between distinct
+ engines.
+
+
+ - Each face and instance object have an inside pointer which use
+ is reserved to client application. Several functions are
+ defined to set and read it:
+
+ TT_Set_Face_Pointer() / TT_Get_Face_Pointer()
+ TT_Set_Instance_Pointer() / TT_Get_Instance_Pointer()
+
+
+ - TT_Apply_Outline_Matrix() has been renamed to
+ TT_Transform_Outline().
+ TT_Apply_Outline_Translation() has been renamed to
+ TT_Translate_Outline()
+ TT_Apply_Vector_Matrix() has been renamed to
+ TT_Transform_Vector()
+
+ all for the sake of clarity.
+
+
+ 2. Structural changes
+
+ Some structures have evolved.
+
+
+ - The instance metrics have now two new fields which are
+ `x_scale' and `y_scale'. Each one is a scaling factor,
+ expressed in the 16.16 fixed float format (TT_Fixed), used to
+ convert one distance expressed in font units into the same
+ distance in fractional (26.6) pixels.
+
+
+ - A new structure TT_BBox has been defined to describe an
+ outline's bounding box.
+
+
+ - The outlines are now full-class citizen. It is possible to
+ create new outlines, copy, clone, transform, translate and
+ render them through specific methods of the TT_Outline class
+ (previously called TT_Glyph_Outline). Read the API reference
+ for a complete listing.
+
+
+ - The glyph metrics have a new structure: they contain a TT_BBox
+ field, a TT_Outline field, as well as three metrics values,
+ which are `bearingX', `bearingY', and `advance'. Read the
+ file `glyphs.txt' for more information about their definitions
+ and uses.
+
+
+ 3. Small but IMPORTANT changes
+
+
+ - The `max_Faces' field of a face's properties has disappeared.
+ It is replaced by `num_Faces' which gives the total number of
+ fonts embedded in a collection (the previous field gave the
+ total minus one).
+
+
+ - TT_Load_Glyph() now returns correctly placed outlines, and
+ computes advance widths which match the pre-calc values in the
+ "hdmx" table in nearly all cases.
+
+
+ - TT_Get_Glyph_Metrics() returns grid-fitted metrics for hinted
+ glyphs (i.e., loaded with the TTLOAD_HINT_GLYPH, or
+ TTLOAD_DEFAULT, flags). This includes the bounding box. To
+ get the exact bounding box of a hinted glyph, you should
+ extract its outline, then call TT_Get_Outline_BBox().
+
+
+ - Some improvements in the glyph loader, which improves
+ drastically the placement of glyphs (especially composite
+ ones) which previously caused trouble for some fonts
+ (e.g. goudy.ttf).
+
+
+ - Several minor improvements in the interpreter to improve
+ rendering and bounds checking...
+
+
+ - Up-to-date Pascal source code, with output equivalent to the C
+ tree...
+
+
+--- END ---
diff --git a/Build/source/libs/freetype/docs/convntns.txt b/Build/source/libs/freetype/docs/convntns.txt
new file mode 100644
index 00000000000..01177854f3d
--- /dev/null
+++ b/Build/source/libs/freetype/docs/convntns.txt
@@ -0,0 +1,970 @@
+
+ Conventions and Design in the FreeType library
+ ----------------------------------------------
+
+
+Table of Contents
+
+Introduction
+
+I. Style and Formatting
+
+ 1. Naming
+ 2. Declarations & Statements
+ 3. Blocks
+ 4. Macros
+
+II. Design conventions
+
+ 1. Modularity and Components Layout
+ 2. Configuration and Debugging
+
+III. Usage conventions
+
+ 1. Error handling
+ 2. Font File I/O
+ 3. Memory management (due to change soon)
+ 4. Support for threaded environments
+ 5. Object Management
+
+
+Introduction
+============
+
+This text introduces the many conventions used within the FreeType
+library code. Please read it before trying any modifications or
+extensions of the source code.
+
+
+
+I. Style and Formatting
+=======================
+
+The following coding rules are extremely important to keep the
+library's source code homogeneously. Keep in mind the following
+points:
+
+ - `Humans read source code, not machines' (Donald Knuth)
+
+ The library source code should be as readable as possible, even
+ by non-C experts. With `readable', two things are meant: First,
+ the source code should be pleasant to the eye, with sufficient
+ whitespace and newlines, to not look like a boring stack of
+ characters stuck to each other. Second, the source should be
+ _expressive_ enough about its goals. This convention contains
+ rules that can help the source focus on its purpose, not on a
+ particular implementation.
+
+ - `Paper is the _ultimate_ debugger' (David Turner :-)
+
+ There is nothing like sheets of paper (and a large floor) to
+ help you understand the design of a library you're new to, or to
+ debug it. The formatting style presented here is targeted at
+ printing. For example, it is more than highly recommended to
+ never produce a source line that is wider than 78 columns. More
+ on this below.
+
+
+1. Naming
+---------
+
+ a. Components
+
+ A unit of the library is called a `component'. Each component
+ has at least an interface, and often a body. The library comes
+ in two language flavors, C and Pascal (the latter severely out
+ of date unfortunately). A component in C is defined by two
+ files, one `.h' header and one `.c' body, while a Pascal
+ component is contained in a single `.pas' file.
+
+ All component source file names begin with the `tt' prefix, with
+ the exception of the `FreeType' component. For example, the
+ file component is implemented by the files `ttfile.h',
+ `ttfile.c', and `ttfile.pas'. Only lowercase letters should be
+ used, following the 8+3 naming convention to allow compilation
+ under DOS.
+
+ In the C version, a single component can have multiple bodies.
+ For example, `ttfile.c' provides stream i/o through standard
+ ANSI libc calls, while `ttfile2.c' implements the same thing
+ using a Unix memory-mapping API.
+
+ The FreeType component is an interface-only component.
+
+ b. Long and expressive labels
+
+ Never hesitate to use long labels for your types, variables,
+ etc.! Except maybe for things like very trivial types, the
+ longest is the best, as it increases the source's
+ _expressiveness_. Never forget that the role of a label is to
+ express the `function' of the entity it represents, not its
+ implementation!
+
+ NOTE: Hungarian notation is NOT expressive, as it sticks the
+ `type' of a variable to its name. A label like `usFoo'
+ rarely tells the use of the variable it represents.
+
+ And the state of a variable (global, static, dynamic)
+ isn't helpful anymore.
+
+ Avoid Hungarian Notation like the *plague*!
+
+
+ When forging a name with several nouns
+ (e.g. `number-of-points'), use an uppercase letter for the first
+ letter of each word (except the first), like:
+
+ numberOfPoints
+
+ You are also welcomed to introduce underscores `_' in your
+ labels, especially when sticking large nouns together, as it
+ `airs' the code greatly. E.g.:
+
+ `numberOfPoints' or `number_Of_Points'
+
+ `IncredibleFunction' or `Incredible_Function'
+
+ And finally, always put a capital letter after an underscore,
+ except in variable labels that are all lowercase:
+
+ `number_of_points' is OK for a variable (_all_ lowercase label)
+
+ `incredible_function' is NOT for a function!
+ ^ ^
+
+ `Microsoft_windows' is a *shame*!
+ ^ ^
+
+ `Microsoft_Windows' isn't really better, but at least its a
+ ^ ^ correct function label within this
+ convention ;-)
+
+ c. Types
+
+ All types that are defined for use by FreeType client
+ applications are defined in the FreeType component. All types
+ defined there have a label beginning with `TT_'. Examples:
+
+ TT_Face, TT_F26Dot6, etc.
+
+ However, the library uses a lot more of internal types that are
+ defined in the Types, Tables, and Objs components (`tttypes' &
+ `tttables' files).
+
+ By convention, all internal types, except the simplest ones like
+ integers, have their name beginning with a capital `T', like in
+ 'TFoo'. Note that the first letter of `foo' is also
+ capitalized. The corresponding pointer type uses a capital `P'
+ instead, i.e. (TFoo*) is simply named 'PFoo'. Examples:
+
+ typedef struct _TTableDir
+ {
+ TT_Fixed version; /* should be 0x10000 */
+ UShort numTables; /* Tables number */
+
+ UShort searchRange; /* These parameters are only used */
+ UShort entrySelector;/* for a dichotomy search in the */
+ UShort rangeShift; /* directory. We ignore them. */
+ } TTableDir;
+
+ typedef TTableDir* PTableDir;
+
+ Note that we _always_ define a typedef for structures. The
+ original struct label starts with `_T'.
+
+ This convention is a famous one from the Pascal world.
+
+ Try to use C or Pascal types to the very least! Rely on
+ internally defined equivalent types instead. For example, not
+ all compilers agree on the sign of `char'; the size of `int' is
+ platform-specific, etc.
+
+ There are equivalents to the most common types in the `Types'
+ components, like `Short', `UShort', etc. Using the internal
+ types will guarantee that you won't need to replace every
+ occurence of `short' or wathever when compiling on a weird
+ platform or with a weird compiler, and there are many more than
+ you could think of...
+
+ d. Functions
+
+ The name of a function should always begin with a capital
+ letter, as lowercase first letters are reserved for variables.
+ The name of a function should be, again, _expressive_! Never
+ hesitate to put long function names in your code: It will make
+ the code much more readable.
+
+ Expressiveness doesn't necessarily imply lengthiness though; for
+ instance, reading shorts from a file stream is performed using
+ the following functions defined in the `File' component:
+
+ Get_Byte, Get_Short, Get_UShort, Get_Long, etc.
+
+ Which is somewhat more readable than:
+
+ cget, sget, usget, lget, etc.
+
+ e. Variables
+
+ Variable names should always begin with a lowercase letter.
+ Lowercase first letters are reserved for variables in this
+ convention, as it has been already explained above. You're
+ still welcome to use long and expressive variable names.
+
+ Something like `numP' can express a number of pixels, porks,
+ pancakes, and much more... Something like `num_points' won't.
+
+ Today, we are still using short variable labels in some parts of
+ the library. We're working on removing them however...
+
+ As a side note, a field name of a structure counts as a variable
+ name too. There are exceptions to the first-lowercase-letter
+ rule, but these are only related to fields within the structure
+ defined by the TrueType specification (well, at least it
+ _should_ be that way).
+
+
+2. Declarations & Statements
+----------------------------
+
+ a. Columning
+
+ Try to align declarations and assignments in columns, if it
+ proves logical. For example (taken from `ttraster.c'):
+
+ struct _TProfile
+ {
+ Int flow; /* Profile orientation : Asc/Descending */
+ Int height; /* profile's height in scanlines */
+ Int start; /* profile's start scanline */
+ ULong offset; /* offset of profile's data in render pool */
+ PProfile link; /* link to next profile */
+ Int index; /* index of profile's entry in trace table */
+ Int count_lines; /* count of lines having to be drawn */
+ Int start_line; /* lines to be rendered before this profile */
+ PTraceRec trace; /* pointer to profile's current trace table */
+ };
+
+ instead of
+
+ struct _TProfile {
+ Int flow; /* Profile orientation : Asc/Descending */
+ Int height; /* profile's height in scanlines */
+ Int start; /* profile's start scanline */
+ ULong offset; /* offset of profile's data in render pool */
+ PProfile link; /* link to next profile */
+ Int index; /* index of profile's entry in trace table */
+ Int count_lines; /* count of lines having to be drawn */
+ Int start_line; /* lines to be rendered before this profile */
+ PTraceRec trace; /* pointer to profile's current trace table */
+ };
+
+ This comes from the fact that you're more interested by the
+ field and its function than by its type.
+
+ Or:
+
+ x = i + 1;
+ y += j;
+ min = 100;
+
+ instead of
+
+ x=i+1;
+ y+=j;
+ min=100;
+
+ And don't hesitate to separate blocks of declarations with
+ newlines to `distinguish' logical sections.
+
+ E.g., taken from an old source file, in the declarations of the CMap
+ loader:
+
+ long n, num_SH;
+ unsigned short u;
+ long off;
+ unsigned short l;
+ long num_Seg;
+ unsigned short* glArray;
+ long table_start;
+ int limit, i;
+
+ TCMapDir cmap_dir;
+ TCMapDirEntry entry_;
+ PCMapTable Plcmt;
+ PCMap2SubHeader Plcmsub;
+ PCMap4 Plcm4;
+ PCMap4Segment segments;
+
+ instead of
+
+ long n, num_SH;
+ unsigned short u;
+ long off;
+ unsigned short l;
+ long num_Seg;
+ unsigned short *glArray;
+ long table_start;
+ int limit, i;
+ TCMapDir cmap_dir;
+ TCMapDirEntry entry_;
+ PCMapTable Plcmt;
+ PCMap2SubHeader Plcmsub;
+ PCMap4 Plcm4;
+ PCMap4Segment segments;
+
+ b. Aliases and the `with' clause
+
+ The Pascal language comes with a very handy `with' clause that
+ is often used when dealing with the fields of a same record.
+ The following Pascal source extract
+
+ with table[incredibly_long_index] do
+ begin
+ x := some_x;
+ y := some_y;
+ z := wathever_the_hell;
+ end;
+
+ is usually translated to:
+
+ table[incredibly_long_index].x = some_x;
+ table[incredibly_long_index].y = some_y;
+ table[incredibly_long_index].z = wathever_the_hell;
+
+ When a lot of fields are involved, it is usually helpful to
+ define an `alias' for the record, like in:
+
+ alias = table + incredibly_long_index;
+
+ alias->x = some_x;
+ alias->y = some_y;
+ alias->z = wathever_the_hell;
+
+ which gives cleaner source code, and eases the compiler's
+ optimization work.
+
+ Though the use of aliases is currently not fixed in the current
+ library source, it is useful to follow one of these rules:
+
+ - Avoid an alias with a stupid, or cryptic name, something like:
+
+ TFooRecord tfr;
+ ....
+ [lots of lines snipped]
+ ....
+
+ tfr = weird_table + weird_index;
+
+ ...
+
+ tfr->num = n;
+
+ It doesn't really help to guess what 'tfr' stands for several
+ lines after its declaration, even if it's an extreme
+ contraction of one particular type.
+
+ Something like `cur_record' or `alias_cmap' is better. The
+ current source also uses a prefix of `Pl' for such aliases
+ (like Pointer to Local alias), but this use is _not_
+ encouraged. If you want to use prefixes, use `loc_', `cur_',
+ or `al_' at the very least, with a descriptive name following.
+
+ - Or simply use a local variable with a semi-expressive name:
+
+ {
+ THorizontalHeader hheader;
+ TVerticalHeader vheader;
+
+
+ hheader = instance->fontRes->horizontalHeader;
+ vheader = instance->fontRes->verticalHeader;
+
+ hheader->foo = bar;
+ vheader->foo = bar2;
+ ...
+ }
+
+ which is much better than
+
+ {
+ THorizontalHeader Plhhead;
+ TVerticalHeader Plvhead;
+
+ Plhhead = instance->fontRes->horizontalHeader;
+ Plvhead = instance->fontRes->verticalHeader;
+
+ Plhhead->foo = bar;
+ Plvhead->foo = bar2;
+ ...
+ }
+
+
+3. Blocks
+---------
+
+ Block separation is done with `{' and `}'. We do not use the K&R
+ convention which becomes only useful with an extensive use of
+ tabs. The `{' and its corresponding `}' should always be on the
+ same column. It makes it easier to separate a block from the rest
+ of the source, and it helps your _brain_ associates the accolades
+ easily (ask any Lisp programmer on the topic!).
+
+ Use two spaces for the next indentation level.
+
+ Never use tabs in your code, their widths may vary with editors
+ and systems.
+
+ Example:
+
+ if (condition_test) {
+ waow mamma;
+ I'm doing K&R format;
+ just like the Linux kernel;
+ } else {
+ This test failed poorly;
+ }
+
+ is _OUT_!
+
+ if ( condition_test )
+ {
+ This code isn't stuck to the condition;
+ read it on paper, you'll find it more;
+ pleasant to the eye;
+ }
+ else
+ {
+ Of course, this is a matter of taste;
+ That's just the way it is in this convention;
+ and you should follow it to be homogenous with;
+ the rest of the FreeType code;
+ }
+
+ is _IN_!
+
+
+4. Macros
+---------
+
+ Macros should be made of uppercase letters. When a macro label is
+ forged from several words, it is possible to only uppercasify the
+ first word, using an underscore to separate the nouns. This is
+ used in ttload.c, ttgload.c and ttfile.c with macros like
+
+ ACCESS_Frame, GET_UShort, CUR_Stream
+
+ The role of the macros used throughout the engine is explained
+ later in this document.
+
+
+
+II. Design Conventions
+======================
+
+
+1. Modularity and Components Layout
+-----------------------------------
+
+ The FreeType engine has been designed with portability in mind.
+ This implies the ability to compile and run it on a great variety
+ of systems and weird environments, unlike many packages where the
+ word strictly means `runs on a bunch of Unix-like systems'. We
+ have thus decided to stick to the following restrictions:
+
+ - The C version is written in ANSI C. The Pascal version compiles
+ and run under Turbo Pascal 5.0 and compatible compilers.
+
+ - The library, if compiled with gcc, doesn't produce any warning
+ with the `-ansi -pedantic' flags. Other compilers with better
+ checks may produce ANSI warnings that we'd be happy to now
+ about.
+
+ (NOTE: It can of course be compiled by an `average' C compiler,
+ and even by a C++ one.)
+
+ - It only requires in its simplest form an ANSI libc to compile,
+ and no utilities other than a C pre-processor, compiler, and
+ linker.
+
+ - It is written in a modular fashion. Each module is called a
+ `component' and is made of two files in the C version (an
+ interface with suffix `.h' and body with suffix `.c' ) and one
+ file in the Pascal one.
+
+ - The very low-level components can be easily replaced by
+ system-specific ones that do not rely on the standard libc.
+ These components deal mainly with i/o, memory, and mutex
+ operations.
+
+ - A client application must only include one interface file named
+ `freetype.h' resp. `freetype.pas' to use the engine. All other
+ components should never be used or accessed by client
+ applications, and their name always begin with a `tt' prefix:
+
+ ttmemory, ttobjs, ttinterp, ttapi, etc.
+
+ - All configuration options are gathered in two files. One
+ contains the processor and OS specific configuration options,
+ while the other treats options that may be enabled or disabled
+ by the developer to test specific features (like assertions,
+ debugging, etc).
+
+ IMPORTANT NOTES:
+
+ These restrictions only apply to the core engine. The package
+ that comes with it contains several test programs sources that
+ are much less portable, even if they present a modular model
+ inspired from the engine's layout.
+
+ The components currently found in the `lib' directory are:
+
+ -------- high-level interface ----------------------------------
+
+ freetype.h High-level API, to be used by client applications.
+
+ ttapi.c Implementation of the api found in `freetype.h'.
+
+ -------- configuration -----------------------------------------
+
+ ttconfig.h Engine configuration options. These are commented
+ and switched by hand by the developer. See
+ section 2 below for more info.
+
+ ft-conf.h Included by ttconfig.h, this file isn't part of
+ the `lib' directory, but depends on the target
+ environment. See section 2 blow for more info.
+
+ -------- definitions -------------------------------------------
+
+ tttypes.h The engine's internal types definitions.
+ tttables.h The TrueType tables definitions, per se the Specs.
+ tttags.h The TrueType table tags definitions.
+ tterror.[ch] The error and debugging component.
+
+ ttdebug.[ch] Only used by the debugger, should not be linked
+ into a release build.
+
+ ttcalc.[ch] Math component used to perform some computations
+ with an intermediate 64-bit precision.
+
+ -------- replaceable components --------------------------------
+
+ ttmemory.[ch] Memory component. This version uses the ANSI libc
+ but can be replaced easily by your own version.
+
+ ttfile.[ch] Stream i/o component. This version uses the ANSI
+ libc but can be replaced easily by your own
+ version. Compiled only if file memory mapping
+ isn't available on your system.
+
+ ttfile2.[ch] Unix-specific file memory mapping version of the
+ file component. It won't compile on other
+ systems. Usually results in much faster file
+ access (about 2x on a SCSI P166 system)
+
+ ttmutex.[ch] Generic mutex component. This version is a dummy
+ and should only be used for a single-thread build.
+ You _need_ to replace this component's body with
+ your own implementation to be able to build a
+ threaded version of the engine.
+
+ -------- data management ---------------------------------------
+
+ ttengine.h The engine instance record definition, root of all
+ engine data.
+
+ ttlists.[ch] Generic lists manager.
+ ttcache.[ch] Generic cache manager.
+
+ ttobjs.[ch] The engine's object definitions and
+ implementations module contains structures,
+ constructors, destructors and methods for the
+ following objects:
+
+ face, instance, glyph, execution_context
+
+ ttload.[c] The TrueType tables loader.
+
+ ttgload.[ch] The glyph loader. A component in itself, due to
+ the task's complexity.
+
+ ttindex.[ch] The character mapping to glyph index conversion
+ routines. Implements functions defined in
+ `freetype.h'.
+
+ ttinterp.[ch] The TrueType instructions interpreter. Probably
+ the nicest source in this engine. Apparently,
+ many have failed to produce a comparable one due
+ to the very poorly written specification! It took
+ David Turner three months of his spare time to get
+ it working correctly! :-)
+
+ ttraster.[ch] The engine's second best piece. This is the
+ scan-line converter. Performs gray-level
+ rendering (also known as font-smoothing) as well
+ as dropout-control.
+
+
+2. Configuration and Debugging
+------------------------------
+
+ As stated above, configuration depends on two files:
+
+ The environment configuration file `ft-conf.h':
+
+ This file contains the definitions of many configuration options
+ that are processor and OS-dependent. On Unix systems, this file
+ is generated automatically by the `configure' script that comes
+ with the released package.
+
+ On other environments, it is located in one of the architecture
+ directories found in `arch' (e.g. `arch/os2/ft-conf.h').
+
+ The path to this file should be passed to the compiler when
+ compiling _each_ component. (typically with an -I option).
+
+ The engine configuration file `ttconfig.h':
+
+ This file contains many configuration options that the developer
+ can turn on or off to experiment with some `features' of the
+ engine that are not part of its `simplest' form. The options
+ are commented.
+
+ Note that the makefiles are compiler-specific.
+
+ It is possible to enable the dumping of debugging information by
+ compiling the components with the various debug macros. Please
+ consult the file `ttconfig.h' for details.
+
+ If you want to port the engine to another environment, you will
+ need to
+
+ - Write a new `ft-conf.h' file for it. Just copy one of those
+ available and change the flags accordingly (they're all
+ commented).
+
+ - Replace the memory, file, and mutex components with yours,
+ presenting the same interface and behaviour.
+
+ - Eventually add some code in ttapi.c to initialize
+ system-specific data with the engine.
+
+
+
+III. Usage conventions
+======================
+
+
+1. Error Handling
+-----------------
+
+ Error handling has been refined to allow reentrant builds of the
+ library, available only in the C version. We thus have now two
+ different conventions.
+
+ In Pascal:
+
+ A global error variable is used to report errors when they are
+ detected. All functions return a boolean that indicates success
+ or failure of the call. If an error occurs within a given
+ function, the latter must set the error variable and return
+ `false' (which means failure).
+
+ It is then possible to make several calls in a single `if'
+ statement like:
+
+ if not Perform_Action_1( parms_of_1 ) or
+ not Perform_Action_2( parms_of_2 ) or
+ not Perform_Action_3( parms_of_3 ) then goto Fail;
+
+ where execution will jump to the `Fail' label whenever an error
+ occurs in the sequence of actions invoked in the condition.
+
+ In C:
+
+ Global errors are forbidden in re-entrant builds. Each function
+ thus returns directly an error code. A return value of 0 means
+ that no error occured, while a non-zero other value indicates a
+ failure of any kind.
+
+ This convention is more constraining than the one used in the
+ Pascal source. The above Pascal statement should be translated
+ into the following C fragment:
+
+ rc = Perform_Action_1( parms_of_1 );
+ if ( rc )
+ goto Fail;
+
+ rc = Perform_Action_2( parms_of_2 );
+ if ( rc )
+ goto Fail;
+
+ rc = Perform_Action_3( parms_of_3 );
+ if ( rc )
+ goto Fail;
+
+ which, while being equivalent, isn't as pleasantly readable.
+
+ One `simple' way to match the original fragment would be to
+ write:
+
+ if ( (rc = Perform_Action_1( parms_of_1 )) ||
+ (rc = Perform_Action_2( parms_of_2 )) ||
+ (rc = Perform_Action_3( parms_of_3 )) )
+ goto Fail;
+
+ which is better but uses assignments within expressions, which
+ are always delicate to manipulate in C (the risk of writing `=='
+ exists, and would go unnoticed by a compiler). Moreover, the
+ assignments are a bit redundant and don't express much things
+ about the actions performed (they only speak of the error
+ management issue).
+
+ That is why some macros have been defined for the most
+ frequently used functions. They relate to low-level routines
+ that are called very often (mainly i/o, mutex, and memory
+ handling functions). Each macro produces an implicit assignment
+ to a variable called `error' and can be used instead as a simple
+ function call. Example:
+
+ if ( PERFORM_Action_1( parms_of_1 ) ||
+ PERFORM_Action_2( parms_of_2 ) ||
+ PERFORM_Action_3( parms_of_3 ) )
+ goto Fail;
+
+ with
+
+ #define PERFORM_Action_1( parms_1 ) \
+ ( error = Perform_Action_1( parms_1 ) )
+ #define PERFORM_Action_2( parms_1 ) \
+ ( error = Perform_Action_2( parms_1 ) )
+ #define PERFORM_Action_3( parms_1 ) \
+ ( error = Perform_Action_3( parms_1 ) )
+
+ defined at the beginning of the file.
+
+ There, the developer only needs to define a local `error'
+ variable and use the macros directly in the code, without caring
+ about the actual error handling performed. Examples of such a
+ usage can be found in `ttload.c' and `ttgload.c'. Moreover, the
+ structure of the source files remain very similar, even though
+ the error handling is very different.
+
+ This convention is very close to the use of exceptions in
+ languages like C++, Pascal, Java, etc. where the developer
+ focuses on the actions to perform, and not on every little error
+ checking.
+
+
+2. Font File I/O
+----------------
+
+ a. Streams
+
+ The engine uses `streams' to access the font files. A stream is
+ a structure defined in the `File' component containing
+ information used to access files through a system-specific i/o
+ library.
+
+ The current implementation of the File component uses the ANSI
+ libc i/o functions. However, for the sake of embedding in light
+ systems and independence of a complete libc, it is possible to
+ re-implement the component for a specific system or OS, letting
+ it use system calls.
+
+ A stream is of type `TStream' defined in the `TTObjs' interface.
+ The type is `(void*)' but actually points to a structure defined
+ within the File component.
+
+ A stream is created, managed and closed through the interface of
+ the `File' component. Several implementations of the same
+ component can co-exist, each taking advantage of specific system
+ features (the file `ttfile2.c' uses memory-mapped files for
+ instance) as long as it respects the interface.
+
+ b. Frames
+
+ TrueType is tied to the big-endian format, which implies that
+ reading shorts or longs from the font file may need conversions
+ depending on the target processor. To be able to easily detect
+ read errors and allow simple conversion calls or macros, the
+ engine is able to access a font file using `frames'.
+
+ A frame is simply a sequence of successive bytes taken from the
+ input file at the current position. A frame is pre-loaded into
+ memory by a `TT_Access_Frame()' call of the `File' component.
+
+ It is then possible to read all sizes of data through the
+ `Get_xxx()' functions, like Get_Byte(), Get_Short(),
+ Get_UShort(), etc.
+
+ When all important data is read, the frame can be released by a
+ call to `TT_Forget_Frame()'.
+
+ The benefits of frames are various. Consider these two
+ approaches at extracting values:
+
+ if ( (error = Read_Short( &var1 )) ||
+ (error = Read_Long ( &var2 )) ||
+ (error = Read_Long ( &var3 )) ||
+ (error = Read_Short( &var4 )) )
+
+ return FAILURE;
+
+ and
+
+ /* Read the next 16 bytes */
+ if ( (error = TT_Access_Frame( 16L )) )
+ return error; /* The Frame could not be read */
+
+ var1 = Get_Short(); /* extract values from the frame */
+ var2 = Get_Long();
+ var3 = Get_Long();
+ var4 = Get_Short();
+
+ TT_Forget_Frame(); /* release the frame */
+
+ In the first case, there are four error assignments with four
+ checks of the file read. This unnecessarily increases the size
+ of the generated code. Moreover, you must be sure that `var1'
+ and `var4' are short variables, `var2' and `var3' long ones, if
+ you want to avoid bugs and/or compiler warnings.
+
+ In the second case, you perform only one check for the read, and
+ exit immediately on failure. Then the values are extracted from
+ the frame, as the result of function calls. This means that you
+ can use automatic type conversion; there is no problem if
+ e.g. `var1' and `var4' are longs, unlike previously.
+
+ On big-endian machines, the `Get_xxx()' functions could also be
+ simple macros that merely peek the values directly from the
+ frame, which speeds up and simplifies the generated code!
+
+ And finally, frames are ideal when you are using memory-mapped
+ files, as the frame is not really `pre-loaded' and never uses
+ any `heap' space.
+
+ IMPORTANT: You CANNOT nest several frame accesses. There is
+ only one frame available at a time for a specific
+ instance.
+
+ It is also the programmer's responsibility to never
+ extract more data than was pre-loaded in the frame!
+ (But you usually know how many values you want to
+ extract from the file before doing so).
+
+
+3. Memory Management
+--------------------
+
+ The library now uses a component which interface is similar to
+ malloc()/free(). It defines only two functions.
+
+ * Alloc()
+
+ To be used like malloc(), except that it returns an error code,
+ not an address. Its arguments are the size of the requested
+ block and the address of the target pointer to the `fresh'
+ block. An error code is returned in case of failure (and this
+ will also set the target pointer to NULL), 0 in case of success.
+
+ Alloc() should always respect the following rules:
+
+ - Requesting a block of size 0 should set the target pointer to
+ NULL and return no error code (i.e., return 0).
+
+ - The returned block is always zeroed. This is an important
+ assumption of other parts of the library.
+
+ If you wish to replace the memory component with your own,
+ please respect this behaviour, or your engine won't work
+ correctly.
+
+ * Free()
+
+ As you may have already guessed, Free() is Alloc()'s
+ counterpart. It takes as argument the _target pointer's
+ address_! You should _never_ pass the block's address directly,
+ i.e. the pointer, to Free().
+
+ Free should always respect the following rules:
+
+ - Calling it with a NULL argument, or the address of a NULL
+ pointer is valid, and should return success.
+
+ - The pointer is always set to NULL after the block's
+ deallocation. This is also an important assumption of many
+ other parts of the library.
+
+ If you wish to replace the memory component with your own,
+ please respect this behaviour, or your engine won't work
+ correctly.
+
+ As the pointers addresses needed as arguments are typed `void**',
+ the component's interface also provides in the C version some
+ macros to help use them more easily, these are:
+
+ MEM_Alloc A version of Alloc that casts the argument pointer
+ to (void**).
+
+ ALLOC Same as MEM_Alloc, but with an assignment to a
+ variable called `error'. See the section `error
+ handling' above for more info on this.
+
+ FREE A version of Free() that casts the argument
+ pointer to (void**). There is currently no error
+ handling by with this macro.
+
+ MEM_Set An alias for `memset()', which can be easily
+ changed to anything else if you wish to use a
+ different memory manager than the functions
+ provided by the ANSI libc.
+
+ MEM_Copy An alias of `memcpy()' or `bcopy()' used to move
+ blocks of memory. You may change it to something
+ different if you wish to use something else that
+ your standard libc.
+
+
+4. Support for threaded environments
+------------------------------------
+
+ Support for threaded environments have been added to the C
+ sources, and only to these. It is now theorically possible to
+ build three distinct versions of the library:
+
+ single-thread build:
+
+ The default build. This one doesn't known about different
+ threads. Hence, no code is generated to perform coherent data
+ sharing and locking.
+
+ thread-safe build:
+
+ With this build, several threads can use the library at the
+ same time. However, some key components can only be used by
+ one single thread at a time, and use a mutex to synchronize
+ access to their functions. These are mainly the file, raster
+ and interpreter components.
+
+ re-entrant build:
+
+ A re-entrant version is able to perform certain actions in
+ parallel that a thread-safe one cannot. This includes
+ accessing file(s) in parallel, interpreting different
+ instruction streams in parallel, or even scan-line converting
+ distinct glyphs at the same time.
+
+ Note that most of the latest changes in the engine are making the
+ distinction between the thread-safe and re-entrant builds thinner
+ than ever.
+
+ There is a `ttmutex' component that presents a generic interface
+ to mutex operations. It should be re-implemented for each
+ platform.
+
+<to be continued>
+
+
+--- end of convntns.txt ---
diff --git a/Build/source/libs/freetype/docs/credits b/Build/source/libs/freetype/docs/credits
new file mode 100644
index 00000000000..661cde2c1a2
--- /dev/null
+++ b/Build/source/libs/freetype/docs/credits
@@ -0,0 +1,97 @@
+
+NOTE: This list is far from being complete. Please send a mail if
+ you want to be included.
+
+
+David TURNER (david.turner@freetype.org)
+
+ Main engine design and coding.
+
+
+Robert WILHELM (robert.wilhelm@freetype.org)
+
+ Web, FTP and CVS wizard & administrator. C source maintainer.
+ Incredible bug and spell fixer!
+
+
+Werner LEMBERG (werner.lemberg@freetype.org)
+
+ Internationalization and CJK guru. ttf2pk author.
+
+
+Antoine LECA (Antoine-Freetype@Leca-Marti.org)
+
+ 16-bit support for various compilers and platforms, and current
+ Pascal maintainer.
+
+
+Mark LEISHER (mleisher@crl.nmsu.edu)
+
+ Internationalization. X11 font server prototype author. ttf2bdf
+ author.
+
+
+Pavel KANKOVSKY (peak@argo.troja.mff.cuni.cz)
+
+ Old logo, internationalization, on-line demo, humor, and
+ remarkable bug hunter!
+
+
+Erwin DIETERICH (erwin.dieterich.ed@bayer-ag.de)
+
+ *Real* internationalization :-) Author of the ftxerr18 and gettext
+ support.
+
+
+Michal NECASEK (mike@mendelu.cz)
+
+ Author and maintainer of the OS/2 font driver based on FreeType.
+
+
+Munagala V. S. RAMANATH, CurveSoft, Inc. (ram@curvesoft.com)
+
+ Contributor of many bug fixes and code improvements.
+
+
+Dave WILLISS (dwilliss@tnt.microimages.com)
+
+ GSUB support. Author of the Mac port.
+
+
+YAMANO-UCHI, Hidetoshi
+
+ Embedded bitmap support.
+
+
+
+The following people have also contributed to the development of
+FreeType:
+
+ Beebe, Nelson H. F.: Tested FreeType on many platforms.
+ Benett, Kendall
+ Cho, Jin-Hwan: Contributed extensions to the ttf2pk package.
+ Choi, Junho
+ Chong, Chin Soon
+ Chroboczek, Juliusz: Author of the xfsft Truetype font server.
+ Cohen, Marc L.
+ Davis, Jack
+ Demaille, Akim
+ Dubacq, Jean-Christophe
+ Ellis, Duane
+ Feinberg, Matthew
+ Furr, Anthony
+ Hoo, Dave: 16bit support
+ Jamme, Thibault
+ Lewis, Kevin
+ Long, Jeff
+ Marukawa, Kazushi
+ Nijtmans, Jan
+ Olson, Eric
+ Paterson-Jones, Roland
+ Pommnitz, Joerg
+ Quigley, Ian
+ Steger, Helmut
+ Taggart, Scott
+
+
+--- end of credits ---
diff --git a/Build/source/libs/freetype/docs/freetype.lsm b/Build/source/libs/freetype/docs/freetype.lsm
new file mode 100644
index 00000000000..a8190f9d562
--- /dev/null
+++ b/Build/source/libs/freetype/docs/freetype.lsm
@@ -0,0 +1,17 @@
+Begin3
+Title: freetype
+Version: 1.5
+Entered-date: 18JAN02
+Description: truetype font rasterizer
+Keywords: font truetype rasterizer freetype
+Author: david.turner@freetype.org (David Turner)
+ werner.lemberg@freetype.org (Werner Lemberg)
+ robert.wilhelm@freetype.org (Robert Wilhelm)
+Maintained-by: robert.wilhelm@freetype.org (Robert Wilhelm)
+ werner.lemberg@freetype.org (Werner Lemberg)
+ Antoine-Freetype@Leca-Marti.org (Antoine Leca)
+Primary-site: ftp.freetype.org /freetype
+ 1400 KB freetype-1.5.tar.gz
+Alternate-site: sunsite.unc.edu /pub/Linux/X11/fonts/
+Copying-policy: BSD-like or GPL
+End
diff --git a/Build/source/libs/freetype/docs/glyphs.htm b/Build/source/libs/freetype/docs/glyphs.htm
new file mode 100644
index 00000000000..d6f0b54374a
--- /dev/null
+++ b/Build/source/libs/freetype/docs/glyphs.htm
@@ -0,0 +1,1257 @@
+<html>
+<head>
+<title>An introduction to glyphs</title>
+
+<META name="description"
+ content="Glyphs in the FreeType engine">
+<META name="keywords"
+ content="FreeType TrueType library engine glyphs baseline bearing
+ bounding box">
+</head>
+
+<body text="#000000"
+ bgcolor="#FFFFFF"
+ link="#0000EF"
+ vlink="#51188E"
+ alink="#FF0000">
+
+
+<font size=1>http://www.freetype.org</font><p>
+
+<center>
+ <font size="+2">Glyph Hell<p>
+
+ <font size="+1">An introduction to glyphs, as used and defined in
+ the FreeType engine<p>
+</center>
+
+<hr><p>
+
+<font size="+2">Introduction<p>
+
+<font size="+0">This article discusses in great detail the definition
+of glyph metrics, per se the TrueType specification, and the way they
+are managed and used by the FreeType engine. This information is
+crucial when it comes to rendering text strings, either in a
+conventional (i.e. Roman) layout, or with vertical or right-to-left
+ones. Some aspects like glyph rotation and transformation are
+explained too.<p>
+
+Comments and corrections are highly welcome, and can be sent to the
+<a href="mailto:devel@freetype.org">FreeType developers list</a>.<p>
+
+<hr><p>
+
+
+<font size="+2">I. An overview of font files<p>
+
+<font size="+0">In TrueType, a single font file is used to contain
+information related to classification, modeling and rendering of text
+using a given typeface. This data is located in various independent
+`tables', which can be sorted in four simple classes, as described
+below:<p>
+
+<ul>
+
+ <b><font size="+1"><li>Face Data</font></b><p>
+
+ We call <i>face data</i> the amount of information related to a
+ given typeface, independently of any particular scaling,
+ transformation, and/or glyph index. This usually means some
+ typeface-global metrics and attributes, like family and styles,
+ PANOSE number, typographic ascenders and descenders, as well as
+ some very TrueType specific items like the font `programs' found
+ in the <i>fpgm</i> and <i>prep</i> tables, the <i>gasp</i> table,
+ character mappings, etc.<p>
+
+ In FreeType, a <i>face object</i> is used to model a font file's
+ face data.<p>
+
+ <b><font size="+1"><li>Instance Data</font></b><p>
+
+ We call <i>instance</i> a given pointsize/transformation, at a
+ given device resolution (e.g.&nbsp;8pt at 96x96dpi, or 12pt at
+ 300x600dpi, etc). Some tables found in the font files are used to
+ produce instance-specific data, like the <i>cvt</i> table, or the
+ <i>prep</i> program. Though they are often part of the face data,
+ their processing results in information called <i>instance
+ data</i>.<p>
+
+ In FreeType, it is modeled through an <i>instance object</i>,
+ which is always created from an existing face object.<p>
+
+ <b><font size="+1"><li>Glyph Data</font></b><p>
+
+ We call <i>glyph data</i> the piece of information related to
+ specific glyphs. This includes the following things that are
+ described in more details in the next sections:<p>
+
+ <ul>
+
+ <li>The glyph's vectorial representation, also called its
+ <i>outline</i>.<p>
+
+ <li>Various metrics, like the glyph's <i>bounding box</i>, its
+ <i>bearings</i> and <i>advance</i> values.<p>
+
+ <li>TrueType specifies a specific instruction <i>bytecode</i>,
+ used to associate each glyph with a small <i>program</i>,
+ called the <i>glyph code</i>. Its purpose is to grid-fit the
+ outline to any target instance, in order to produce excellent
+ output at small pixel sizes.
+
+ </ul><p>
+
+ The FreeType engine doesn't map each glyph to a single structure,
+ as this would waste memory for no good reason. Rather, a <i>glyph
+ object</i> is a <i>container</i>, created from any active face,
+ which can be used to load and/or process any font glyph at any
+ instance (or even no instance at all). Of course, the glyph
+ properties (outline, metrics, bitmaps, etc.) can be extracted
+ independently from an object once it has been loaded or
+ processed.<p>
+
+ <b><font size="+1"><li>Text and Layout Data</font></b><p>
+
+ Finally, there is a last class of data that doesn't really fit in
+ all others, and that can be called <i>text</i> data. It comprises
+ information related to the grouping of glyphs together to form
+ text. Simple examples are the <i>kerning</i> table, which
+ controls the spacing between adjacent glyphs, as well as some of
+ the extensions introduced in <i>TrueType Open</i>,
+ <i>OpenType</i>, and <i>TrueType GX</i> like glyph substitution
+ (ligatures, vertical representations), baseline management,
+ justification, etc.<p>
+
+ This article focuses on the basic TrueType tables, and hence, will
+ only talk about kerning, as FreeType doesn't support OpenType nor
+ GX (yet). [Support for TrueType Open is already partially
+ available.]
+
+</ul><p>
+
+<hr><p>
+
+
+<font size="+2">II. Glyph Outlines<p>
+
+<font size="+0">TrueType is a scalable font format; it is thus
+possible to render glyphs at any scale, and under any affine
+transform, from a single source representation. However, simply
+scaling vectorial shapes exhibits at small sizes (where `small' refers
+here to anything smaller than at least 150&nbsp;pixels) a collection
+of un-harmonious artifacts, like widths and/or heights
+degradations.<p>
+
+Because of this, the format also provides a complete programming
+language used to design small programs associated to each glyph. Its
+role is to align the point positions on the pixel grid after the
+scaling. This operation is hence called <i>grid-fitting</i>, or even
+<i>hinting</i>.<p>
+
+<ol>
+
+ <font size="+1"><li>Vectorial representation</font><p>
+
+ The source format of outlines is a collection of closed paths
+ called <i>contours</i>. Each contour delimits an outer or inner
+ region of the glyph, and can be made of either line segments
+ and/or second-order beziers (also called <i>conic beziers</i> or
+ <i>quadratics</i>).<p>
+
+ It is described internally as a series of successive points, with
+ each point having an associated flag indicating whether it is `on'
+ or `off' the curve. These rules are applied to decompose the
+ contour:<p>
+
+ <ul>
+
+ <li>Two successive `on' points indicate a line segment joining
+ them.<p>
+
+ <li>One `off' point amidst two `on' points indicates a conic
+ bezier, the `off' point being the control point, and the `on'
+ ones the start and end points.<p>
+
+ <li>Finally, two successive `off' points forces the rasterizer
+ to create (only during bitmap rendering) a virtual `on' point
+ amidst them, at their exact middle. This greatly facilitates
+ the definition of successive Bezier arcs.
+
+ </ul><p>
+
+<pre>
+ * # on
+ * off
+ __---__
+ #-__ _-- -_
+ --__ _- -
+ --__ # \
+ --__ #
+ -#
+ Two `on' points
+ Two `on' points and one `off' point
+ between them
+
+
+
+ *
+ # __ Two `on' points with two `off'
+ \ - - points between them. The point
+ \ / \ marked `0' is the middle of the
+ - 0 \ `off' points, and is a `virtual
+ -_ _- # on' point where the curve passes.
+ -- It does not appear in the point
+ list.
+ *
+</pre>
+
+ <img src="image/emsquare.gif" align="right" width=333 height=274>
+
+ Each glyph's original outline points are located on a grid of
+ indivisible units. The points are stored in the font file as
+ 16-bit integer grid coordinates, with the grid origin's being at
+ (0,0); they thus range from -16384 to&nbsp;16383.<p>
+
+ In creating the glyph outlines, a type designer uses an imaginary
+ square called the <i>EM square</i>. Typically, the EM square
+ encloses the capital letter `M' and most other letters of a
+ typical roman alphabet. The square's size, i.e., the number of
+ grid units on its sides, is very important for two reasons:<p>
+
+ <ul>
+
+ <li>It is the reference used to scale the outlines to a given
+ instance. For example, a size of 12pt at 300x300dpi
+ corresponds to 12*300/72&nbsp;= 50&nbsp;pixels. This is the
+ size the EM square would appear on the output device if it was
+ rendered directly. In other words, scaling from grid units to
+ pixels uses the formula<p>
+
+ <center>
+ pixel_size&nbsp;= point_size&nbsp;*
+ resolution&nbsp;/&nbsp;72
+ </center><p>
+
+ <center>
+ pixel_coordinate&nbsp;= grid_coordinate&nbsp;*
+ pixel_size&nbsp;/&nbsp;EM_size
+ </center><p>
+
+ <li>The greater the EM size is, the larger resolution the
+ designer can use when digitizing outlines. For example, in
+ the extreme example of an EM size of 4&nbsp;units, there are
+ only 25&nbsp;point positions available within the EM square
+ which is clearly not enough. Typical TrueType fonts use an EM
+ size of 2048&nbsp;units (note: with Type&nbsp;1 PostScript
+ fonts, the EM size is fixed to 1000&nbsp;grid units. However,
+ point coordinates can be expressed in floating values).
+
+ </ul><p>
+
+ Note that glyphs can freely extend beyond the EM square if the
+ font designer wants this. The EM is used as a convenience, and is
+ a valuable convenience from traditional typography.<p>
+
+ <center>
+ <font size="+1">
+ Grid units are very often called <i>font units</i> or <i>EM
+ units</i>.
+ </font>
+ </center><p>
+
+ <hr>
+ <i>IMPORTANT NOTE:</i><p>
+
+ Under FreeType, scaled pixel positions are all expressed in the
+ 26.6 fixed float format (made of a 26-bit integer mantissa, and a
+ 6-bit fractional part). In other words, all coordinates are
+ multiplied by&nbsp;64. The grid lines along the integer pixel
+ positions, are multiples of&nbsp;64, like (0,0), (64,0), (0,64),
+ (128,128), etc., while the pixel centers lie at middle coordinates
+ (32&nbsp;modulo&nbsp;64) like (32,32), (96,32), etc.
+ <hr><p>
+
+ <font size="+1"><li>Hinting and Bitmap rendering</font><p>
+
+ As said before, simply scaling outlines to a specific instance
+ always creates undesirable artifacts, like stems of different
+ widths or heights in letters like `E' or `H'. Proper glyph
+ rendering needs that the scaled points are aligned along the pixel
+ grid (hence the name <i>grid-fitting</i>), and that important
+ widths and heights are respected throughout the whole font (for
+ example, it is very often desirable that the letters `I' and `T'
+ have their central vertical line of the same pixel width).<p>
+
+ Type&nbsp;1 PostScript font files include with each glyph a small
+ series of distances called <i>hints</i>, which are later used by
+ the type manager to try grid-fitting the outlines as cleverly as
+ possible. On one hand, it has the consequence that upgrading your
+ font engine can enhance the visual aspects of all fonts of your
+ system; on the other hand, the quality of even the best version of
+ Adobe's Type Manager isn't always very pleasing at small sizes
+ (notwithstanding font smoothing).<p>
+
+ TrueType takes a radically different approach: Each glyph has an
+ associated `program', designed in a specific geometrical language,
+ which is used to align explicitly each outline point to the pixel
+ grid, preserving important distances and metrics. A stack-based
+ low-level bytecode is used to store it in the font file, and is
+ interpreted later when rendering the scaled glyphs.<p>
+
+ This means that even very complex glyphs can be rendered perfectly
+ at very small sizes, as long as the corresponding glyph code is
+ designed correctly. Moreover, a glyph can loose some of its
+ details, like serifs, at small sizes to become more readable,
+ because the bytecode provides interesting features.<p>
+
+ However, this also have the sad implication that an ill-designed
+ glyph code will always render junk, whatever the font engine's
+ version, and that it's very difficult to produce quality glyph
+ code. There are about 200&nbsp;TrueType opcodes, and no known
+ `high-level language' for it. Most type artists aren't
+ programmers at all and the only tools able to produce quality code
+ from vectorial representation have been distributed to only a few
+ font foundries, while tools available to the public, e.g.
+ Fontographer, are usually expensive though generating average to
+ mediocre glyph code.<p>
+
+ All this explains why an enormous number of broken or ugly `free'
+ fonts have appeared on the TrueType scene, and that this format is
+ now mistakenly thought as `crap' by many people. Funnily, these
+ are often the same who stare at the `beauty' of the classic `Times
+ New Roman' and `Arial/Helvetica' at 8&nbsp;points.<p>
+
+ Once a glyph's code has been executed, the scan-line converter
+ converts the fitted outline into a bitmap (or a pixmap with
+ font-smoothing).
+
+</ol><p>
+
+
+<hr><p>
+
+<font size="+2">III. Glyph metrics</font><p>
+
+<ol>
+
+ <font size="+1"><li>Baseline, Pens and Layouts</font><p>
+
+ The baseline is an imaginary line that is used to `guide' glyphs
+ when rendering text. It can be horizontal (e.g. Roman, Cyrillic,
+ Arabic, etc.) or vertical (e.g. Chinese, Japanese, etc).
+ Moreover, to render text, a virtual point, located on the
+ baseline, called the <i>pen position</i>, is used to locate
+ glyphs.<p>
+
+ Each layout uses a different convention for glyph placement:<p>
+
+ <ul>
+
+ <li>With horizontal layout, glyphs simply `rest' on the
+ baseline. Text is rendered by incrementing the pen position,
+ either to the right or to the left.<p>
+
+ <center>
+ <img src="image/baseline.gif" width=458 height=179><p>
+ </center>
+
+ The distance between two successive pen positions is
+ glyph-specific and is called the <i>advance width</i>. Note
+ that its value is <b>always</b> positive, even for
+ right-to-left oriented alphabets, like Arabic. This
+ introduces some differences in the way text is rendered.<p>
+
+ <hr>
+ <i>IMPORTANT NOTE:</i><p>
+
+ The pen position is always placed on the baseline in
+ TrueType, unlike the convention used by some graphics
+ systems, like Windows, to always put the pen above the line,
+ at the ascender's position.
+ <hr><p>
+
+ <li>With vertical layout, glyphs are centered around the
+ baseline:<p>
+
+ <center>
+ <img src="image/baselin2.gif" width=162 height=275>
+ </center>
+
+ </ul><p>
+
+ <font size="+1"><li>Typographic metrics and bounding
+ boxes</font><p>
+
+ A various number of face metrics are defined for all glyphs in
+ a given font. Three of them have a rather curious status in
+ the TrueType specification; they only apply to horizontal
+ layouts:<p>
+
+ <ul>
+
+ <li>The <i>ascent</i><p>
+
+ This is the distance from the baseline to the highest/upper
+ grid coordinate used to place an outline point. It is a
+ positive value, due to the grid's orientation with the
+ y&nbsp;axis upwards.<p>
+
+ <li>The <i>descent</i><p>
+
+ The distance from the baseline to the lowest grid coordinate
+ used to place an outline point. This is a negative value,
+ due to the grid's orientation.<p>
+
+ <li>The <i>linegap</i><p>
+
+ The distance that must be placed between two lines of text.
+ The baseline-to-baseline distance should be computed as<p>
+
+ <center>
+ ascent&nbsp;- descent&nbsp;+ linegap
+ </center><p>
+
+ if you use the typographic values.
+
+ </ul><p>
+
+ The problem with these metrics is that they appear three times
+ in a single font file, each version having a slightly different
+ meaning:<p>
+
+ <ol>
+
+ <li>The font's horizontal header provides the ascent, descent
+ and linegap fields, which are used to express the designer's
+ intents, rather than the real values that may be computed
+ from all glyphs in the outline. These are used by the
+ Macintosh font engine to perform font mapping (i.e. font
+ substitution).<p>
+
+ <li>The OS/2 table provides the <i>usWinAscent</i> and
+ <i>usWinDescent</i> fields. These values are computed for
+ glyphs of the Windows ANSI charset only, which means that
+ they are wrong for any other glyph. Note that
+ <i>usWinDescent</i> is always positive (i.e. looks like
+ `-descent').<p>
+
+ <li>The OS/2 table provides the <i>typoAscender</i>,
+ <i>typoDescender</i> and <i>typoLinegap</i> values, which
+ hopefully concern the whole font file. These are the
+ correct system-independent values!
+
+ </ol><p>
+
+ All metrics are expressed in font units. If you want to use any
+ of the two first versions of these metrics, the TrueType
+ specification contains some considerations and computing tips
+ that might help you.<p>
+
+ Other, simpler metrics are:<p>
+
+ <ul>
+
+ <li>The glyph's bounding box, also called <i>bbox</i><p>
+
+ This is an imaginary box that encloses any glyph (usually as
+ tightly as possible). It is represented by four fields,
+ namely <i>xMin</i>, <i>yMin</i>, <i>xMax</i>, and
+ <i>yMax</i>, that can be computed for any outline. In
+ FreeType, their values can be in font units (if measured in
+ the original outline) or in 26.6&nbsp;pixel units (if
+ measured on scaled outlines).<p>
+
+ Note that if it wasn't for grid-fitting, you wouldn't need
+ to know a box's complete values, but only its dimensions to
+ know how big is a glyph outline/bitmapa. However, correct
+ rendering of hinted glyphs needs the preservation of
+ important grid alignment on each glyph translation/placement
+ on the baseline, which is why FreeType always returns the
+ complete glyph outline.<p>
+
+ Note also that the font's header contains a global font
+ bounding box in font units which should enclose all glyphs
+ in a font. This can be used to pre-compute the maximum
+ dimensions of any glyph at a given instance.<p>
+
+ <li>The <i>internal leading</i><p>
+
+ This concept comes directly from the world of traditional
+ typography. It represents the amount of space within the
+ `leading' which is reserved for glyph features that lay
+ outside of the EM square (like accentuation). It usually
+ can be computed as<p>
+
+ <center>
+ internal_leading&nbsp;= ascent&nbsp;- descent&nbsp;-
+ EM_size
+ </center><p>
+
+ <li>The <i>external leading</i><p>
+
+ This is another name for the linegap.
+
+ </ul><p>
+
+ <font size="+1"><li><i>Bearings</i> and <i>Advances</i></font><p>
+
+ Each glyph has also distances called <i>bearings</i> and
+ <i>advances</i>. Their definition is constant, but their values
+ depend on the layout, as the same glyph can be used to render
+ text either horizontally or vertically.<p>
+
+ <ol>
+ <li>The <i>left side bearing</i>: a.k.a. <i>bearingX</i><p>
+
+ This is the horizontal distance from the current pen
+ position to the glyph's left bounding box edge. It is
+ positive for horizontal layouts, and most generally negative
+ for vertical one.<p>
+
+ <li>The <i>top side bearing</i>: a.k.a. <i>bearingY</i><p>
+
+ This is the vertical distance from the baseline to the top
+ of the glyph's bounding box. It is usually positive for
+ horizontal layouts, and negative for vertical ones<p>
+
+ <li>The <i>advance width</i>: a.k.a. <i>advanceX</i><p>
+
+ This is the horizontal distance the pen position must be
+ incremented (for left-to-right writing) or decremented (for
+ right-to-left writing) by after each glyph is rendered when
+ processing text. It is always positive for horizontal
+ layouts, and null for vertical ones.<p>
+
+ <li>The <i>advance height</i>: a.k.a. <i>advanceY</i><p>
+
+ This is the vertical distance the pen position must be
+ decremented by after each glyph is rendered. It is always
+ null for horizontal layouts, and positive for vertical
+ layouts.<p>
+
+ <li>The <i>glyph width</i><p>
+
+ The glyph's horizontal extent. More simply, it is
+ (bbox.xMax&nbsp;- bbox.xMin) for unscaled font coordinates.
+ For scaled glyphs, its computation requests specific care,
+ described in the grid-fitting chapter below.<p>
+
+ <li>The <i>glyph height</i><p>
+
+ The glyph's vertical extent. More simply, it is
+ (bbox.yMax&nbsp;- bbox.yMin) for unscaled font coordinates.
+ For scaled glyphs, its computation requests specific care,
+ described in the grid-fitting chapter below.<p>
+
+ <li>The <i>right side bearing</i><p>
+
+ Only used for horizontal layouts to describe the distance
+ from the bbox's right edge to the advance width. It is in
+ most cases a non-negative number. The FreeType library
+ doesn't provide this metric directly, as it isn't really
+ part of the TrueType specification. It can be computed
+ simply as<p>
+
+ <center>
+ advance_width&nbsp;- left_side_bearing&nbsp;- (xMax-xMin)
+ </center>
+
+ </ol><p>
+
+ <center>
+ <img src="image/metrics.gif" width=388 height=253><p>
+
+ <img src="image/metrics2.gif" width=294 height=278>
+ </center><p>
+
+ Finally, if you use `ABC widths' under Windows and OS/2, the
+ following relations apply:
+
+<pre>
+ A = left side bearing
+ B = width
+ C = right side bearing
+
+ A+B+C = advance width
+</pre>
+
+ <font size="+1"><li>The effects of grid-fitting</font><p>
+
+ All these metrics are stored in font units in the font file.
+ They must be scaled and grid-fitted properly to be used at a
+ specific instance. This implies several things:<p>
+
+ <ul>
+
+ <li>First, a glyph program not only aligns the outline along
+ the grid pixel, it also processes the left side bearing and
+ the advance width. Other grid-fitted metrics are usually
+ available in optional TrueType tables if you need them.<p>
+
+ <li>A glyph program may decide to extend or stretch any of
+ these two metrics if it has a need for it. This means that
+ you cannot assume that the fitted metrics are simply equal
+ to the scaled one plus or minus a liberal distance
+ <&nbsp;1&nbsp;pixel (i.e., less than 64&nbsp;fractional
+ pixel units). For example, it is often necessary to stretch
+ the letter `m' horizontally at small pixel sizes to make all
+ vertical stems visible, while the same glyph can be
+ perfectly `square' at larger sizes.<p>
+
+ <li>Querying the fitted metrics of all glyphs at a given
+ instance is very slow, as it needs to load and process each
+ glyph independently. For this reason, some optional
+ TrueType tables are defined in the specification, containing
+ pre-computed metrics for specific instances (the most
+ commonly used, like 8, 9, 10, 11, 12, and 14&nbsp;points at
+ 96dpi, for example). These tables aren't always present in
+ a TrueType font.<p>
+
+ If you don't need the exact fitted value, it's much faster
+ to query the metrics in font units, then scale them to the
+ instance's dimensions.
+
+ </ul><p>
+
+ <hr>
+ <i>IMPORTANT NOTE:</i><p>
+
+ Another very important consequence of grid-fitting is the fact
+ that moving a fitted outline by a non-integer pixel distance
+ will simply ruin the hinter's work, as alignments won't be
+ preserved. The translated glyph will then look `ugly' when
+ converted to a bitmap!<p>
+
+ In other words, each time you want to translate a fitted glyph
+ outline, you must take care of only using integer pixel
+ distances (the x and y&nbsp;offsets must be multiples
+ of&nbsp;64, which equals to&nbsp;1.0 in the 26.6 fixed float
+ format).
+
+ If you don't care about grid-fitting (typically when rendering
+ rotated text), you can use any offset you want and use sub-pixel
+ glyph placement.
+ <hr><p>
+
+ </ol>
+
+<hr><p>
+
+
+<font size="+2">IV. Text processing</font><p>
+
+This section demonstrates how to use the concepts previously defined
+to render text, whatever the layout you use.<p>
+
+<ol>
+
+ <font size="+1"><li>Writing simple text strings</font><p>
+
+ We will start by generating a simple string with a Roman alphabet.
+ The layout is thus horizontal, left to right.<p>
+
+ For now, we will assume all glyphs are rendered in a single target
+ bitmap. The case of generating individual glyph bitmaps, then
+ placing them on demand on a device is presented in a later chapter
+ of this section.<p>
+
+ Rendering the string needs to place each glyph on the baseline;
+ this process looks like the following:<p>
+
+ <ol>
+
+ <li>Place the pen to the cursor position. The pen is always
+ located on the baseline. Its coordinates must be grid-fitted
+ (i.e. multiples of&nbsp;64)!<p>
+
+<pre>
+ pen_x = cursor_x;
+ pen_y = cursor_y;
+</pre>
+
+ <li>Load the glyph outline and its metrics. Using the flag
+ TTLOAD_DEFAULT will scale and hint the glyph:
+
+<pre>
+ TT_Load_Glyph( instance,
+ glyph,
+ glyph_index,
+ TTLOAD_DEFAULT );
+
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+ TT_Get_Glyph_Outline( glyph, &outline );
+</pre>
+
+ <li>The loader always places the glyph outline relative to the
+ imaginary pen position (0,0). You thus simply need to
+ translate the outline by the vector:
+
+<pre>
+ ( pen_x, pen_y )
+</pre>
+
+ To place it on its correct position, you can use the call
+
+<pre>
+ TT_Translate_Outline( outline, pen_x, pen_y );
+</pre>
+
+ <li>Render the outline in the target bitmap, the glyph will be
+ surimposed on it with a binary `or' operation (FreeType never
+ creates glyph bitmaps by itself, it simply renders glyphs in
+ the arrays you pass to it. See the API reference for a
+ complete description of bitmaps and pixmaps).
+
+<pre>
+ TT_Get_Outline_Bitmap( outline, &target_bitmap );
+</pre>
+
+ <hr>
+ <i>IMPORTANT NOTE:</i><p>
+
+ If you don't want to access the outline in your code, you can
+ also use the API function TT_Get_Glyph_Bitmap() which does the
+ same as the previous lines:
+
+<pre>
+ TT_Get_Glyph_Outline( glyph, &outline );
+ TT_Translate_Outline( outline, x_offset, y_offset );
+ TT_Get_Outline_Bitmap( outline, &target_bitmap );
+ TT_Translate_Outline( outline, -x_offset, -y_offset );
+</pre>
+
+ is equivalent to:
+
+<pre>
+ TT_Get_Glyph_Bitmap( glyph,
+ x_offset,
+ y_offset,
+ &target_bitmap );
+</pre>
+ <hr><p>
+
+ <li>Now advance the pen to its next position. The advance is
+ always grid-fitted when the glyph was hinted:<p>
+
+<pre>
+ pen_x += metrics.advance;
+</pre>
+
+ The advance being grid-fitted, the pen position remains
+ aligned on the grid.<p>
+
+ <li>Start over on item&nbsp;2 until string completion. That's
+ it!
+
+ </ol><p>
+
+ <font size="+1"><li>Writing right-to-left and vertical text</font><p>
+
+ Generating strings for different layouts is very similar. Here
+ are the most important differences.<p>
+
+ <ul>
+
+ <li>For right-to-left text (like Arabic)<p>
+
+ The main difference here is that, as the advance width and
+ left side bearings are oriented against the flow of text, the
+ pen position must be <i>decremented</i> by the advance width,
+ <i>before</i> placing and rendering the glyph. Other than
+ that, the rest is strictly similar.<p>
+
+ <li>For vertical text (like Chinese or Japanese)<p>
+
+ In this case, the baseline is vertical, which means that the
+ pen position must be shifted in the vertical direction. You
+ need the vertical glyph metrics to do that (using the
+ TT_Get_Big_Glyph_Metrics() function).<p>
+
+ Once you get these, the rest of the process is very similar.
+ The glyph outline is placed relative to an imaginary origin of
+ (0,0), and you should translate it to the pen position before
+ rendering it.<p>
+
+ The big difference is that you must decrement pen_y, rather
+ than increment pen_x (this is for the TrueType convention of y
+ oriented upwards).
+
+<pre>
+ pen_y -= metrics.advance;
+</pre>
+
+ </ul><p>
+
+ <font size="+1"><li>Generating individual glyph bitmaps and using
+ them to render text</font><p>
+
+ Loading each glyph when rendering text is slow, and it's much
+ more efficient to render each one in a standalone bitmap to place
+ it in a cache. Text can then be rendered fast by applying simple
+ blit operations on the target device.<p>
+
+ To be able to render text correctly with the bitmaps, you must
+ record and associate with them its fitted bearings and advances.
+ Hence the following process:<p>
+
+ <ol>
+
+ <li>Generate the bitmaps.<p>
+
+ <ul>
+
+ <li>Load the glyph and get its metrics.
+
+<pre>
+ TT_Load_Glyph( instance,
+ glyph,
+ glyph_index,
+ TTLOAD_DEFAULT );
+
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+</pre>
+
+ The bbox is always fitted when calling
+ TT_Get_Glyph_Metrics() on a hinted glyph. You can then
+ easily compute the glyph's dimension in pixels as:
+
+<pre>
+ width = (bbox.xMax - bbox.xMin) / 64;
+ height = (bbox.yMax - bbox.yMin) / 64;
+</pre>
+
+ NOTE 1:<br>
+ The fitted bounding box always contains all the dropouts
+ that may be produced by the scan-line converter. This
+ width and height are thus valid for all kinds of
+ glyphs).<p>
+
+ NOTE 2:<br>
+ If you want to compute the dimensions of a rotated
+ outline's bitmap, compute its bounding box with
+ TT_Get_Outline_BBox(), then grid-fit the bbox manually:
+
+<pre>
+ #define FLOOR(x) ((x) & -64)
+ #define CEILING(x) (((x)+63) & -64)
+
+ xMin = FLOOR(xMin);
+ yMin = FLOOR(yMin);
+ yMin = CEILING(xMax);
+ yMax = CEILING(yMax);
+</pre>
+
+ then compute width and height as above.<p>
+
+ <li>Create a bitmap of the given dimension, e.g.:
+
+<pre>
+ bitmap.width = width;
+ bitmap.cols = (width+7) & -8;
+ bitmap.rows = height;
+ bitmap.flow = TT_Flow_Up;
+ bitmap.size = bitmap.cols * bitmap.rows;
+ bitmap.buffer = malloc( bitmap.size );
+</pre>
+
+ <li>Render the glyph into the bitmap.<p>
+
+ Don't forget to shift it by (-xMin, -yMin) to fit it in
+ the bitmap:
+
+<pre>
+ /* Note that the offsets must be grid-fitted to */
+ /* preserve hinting! */
+ TT_Get_Glyph_Bitmap( glyph,
+ &bitmap,
+ -bbox.xMin,
+ -bbox.yMin );
+</pre>
+
+ </ul>
+
+ <li>Store the bitmap with the following values:
+
+<pre>
+ bearingX / 64 = left side bearing in pixels
+ advance / 64 = advance width/height in pixels
+</pre>
+
+ When your cache is set up, you can then render text using a
+ scheme similar to the ones describe in&nbsp;1. and&nbsp;2.,
+ with the exception that now pen positions and metrics are
+ expressed in pixel values. We are done!
+
+<pre>
+ pen_x = cursor_x;
+ pen_y = cursor_y;
+
+ while ( glyph_to_render )
+ {
+ access_cache( glyph_index, metrics, bitmap );
+
+ blit_bitmap_to_position
+ ( pen_x + bearingX,
+ pen_y (+ bearingY depending on orientation ) );
+
+ pen_x += advance;
+ }
+</pre>
+
+ </ol>
+
+ <font size="+1"><li>Device-independent text rendering</font><p>
+
+ The previously described rendering processes all align glyphs on
+ the baseline according to metrics fitted for the display's
+ distance. In some cases, the display isn't the final output, and
+ placing the glyphs in a device-independent way is more important
+ than anything.<p>
+
+ A typical case is a word processor which displays text as it
+ should appear on paper when printed. As you've probably noticed,
+ the glyphs aren't always spaced uniformly on the screen as you
+ type them, sometimes the space between an `m' and a `t' is too
+ small, some other it is too large, etc.<p>
+
+ These differences are simply due to the fact that the word
+ processor aligns glyphs in an device-independent way, using
+ original metrics in font units to do it, then scale them as it
+ can to display text on screen, usually at a very smaller
+ resolution than your printer's one.<p>
+
+ Device-independence is a crucial part of document portability,
+ and it is very saddening to see that most professional word
+ processors don't do it correctly. For example, MS&nbsp;Word uses
+ the fitted metrics of the printer's resolution, rather than the
+ originals in font units.<p>
+
+ This is great to get sure that your text prints very well on your
+ printer, but it also implies that someone printing the exact same
+ document on a device with different output resolutions (e.g.
+ bubble-jet vs. laser printers) may encounter trouble.<p>
+
+ As the differences in advances accumulate on one line, they can
+ sum to the width of one or more glyphs in extreme cases, which is
+ enough to `overflow' the automatic justification algorithm. This
+ may add additional lines of printed text, or even remove some.
+ Moreover, supplemental lines can produce unexpected page breaks
+ and `blank' pages. This can be extremely painful when working
+ with large documents, as this `feature' may require you to
+ redesign completely your formatting to re-print it.<p>
+
+ In conclusion, if you want portable document rendering, never
+ hesitate to use and apply device-independent terms! For example,
+ a simple way to produce text would be:<p>
+
+ <ol>
+
+ <li>Get a scale to convert from your device-independent units
+ to 26.6 pixels.<p>
+
+ <li>Get another scale to convert from original font units to
+ device-independent units.<p>
+
+ <li>Perform pen placement and advances in device-independent
+ units.<p>
+
+ <li>To render each glyph, compute the pen's rounded position,
+ as well as the rounded glyph left side bearing, both
+ expressed in 26.6 pixels (don't use the fitted metrics). You
+ will then be able to place the glyph and/or blit its bitmap.
+
+ </ol><p>
+
+ <font size="+1"><li>Kerning glyphs</font><p>
+
+ An interesting effect that most people appreciate is
+ <i>kerning</i>. It consists of modifying the spacing between two
+ successive glyphs according to their outlines. For example, the
+ letters `T' and a `y' can be easily moved closer, as the top of
+ the `y' fits nicely under the `T's upper right bar.<p>
+
+ To perform kerning, the TrueType specification provides a
+ specific table (its tag being `kern'), with several storage
+ formats. This section doesn't explain how to access this
+ information; however, you can have a look at the standard
+ extension called `ttkern.h' which comes with FreeType.<p>
+
+ The <i>kerning distance</i> between two glyphs is a value
+ expressed in font units which indicates whether their outline can
+ be moved together or apart when one follows the other. The
+ distance isn't reflexive, which means that the kerning for the
+ glyph pair (`T',`y') isn't the same as the one for (`y',`T').<p>
+
+ The value is positive when the glyphs must be moved apart, and
+ negative when they must be moved closer. You can implement
+ kerning simply by adding its scaled and rounded value to the
+ advance width when moving the pen position. Here an example for
+ horizontal kerning:
+
+<pre>
+ #define ROUND( x ) ( (x + 32) & -64 )
+
+ scaled_kerning = kerning * imetrics.x_scale / 0x10000;
+
+ pen_x += metrics.advance + ROUND( scaled_kerning );
+</pre>
+
+ <font size="+1"><li>Rotated and stretched/slanted text</font><p>
+
+ In order to produce rotated glyphs with FreeType, one must
+ understand a few things:<p>
+
+ <ul>
+
+ <li>The engine doesn't apply specific transformations to the
+ glyphs it loads and processes (other than the simpler
+ resolution-base scaling and grid-fitting). If you want to
+ rotate glyphs, you will have to load their outline, then apply
+ the geometric transformations that please you (a number of
+ APIs are there to help you to do it easily).<p>
+
+ <li>Even if the glyph loader hints `straight' glyphs, it is
+ possible to inform the font and glyph programs that you're
+ going to later transform the resulting outlines. Two flags
+ can be passed to the bytecode interpreter:<p>
+
+ <ul>
+
+ <li>The `rotated' flag indicates that you are going to
+ rotate the glyphs in a non-trivial direction (i.e., on
+ neither of the two coordinate axis). You are advised not
+ to set it when writing 90&nbsp;degrees-rotated text for
+ example.<p>
+
+ <li>The `stretched' flag indicates that you are going to
+ apply a transformation that will distort distances. While
+ rotations and symmetries keep distances constant, slanting
+ and stretching do modify them.
+
+ </ul>
+
+ </ul><p>
+
+ These flags can be interpreted by the glyph code to toggle certain
+ processings which vary from one font to the other. However, most
+ of the TrueType fonts that were tested with FreeType, if not all
+ of them, simply change the dropout-mode when any of these flags is
+ set, and/or disable hinting when rotation is detected. We advise
+ you to never set these flags, even when rotating text. For what
+ it's worth, hinted rotated text is no uglier than un-hinted
+ one.<p>
+
+ You can use the function TT_Set_Instance_Transform_Flags() to set
+ them. Then, rendering can be done with the following calls:
+
+<pre>
+ /* set the flags */
+ TT_Set_Instance_Transforms( instance,
+ rotated,
+ stretched );
+
+ /* load a given glyph */
+ TT_Get_Glyph_Outline( instance,
+ glyph,
+ index,
+ TTLOAD_DEFAULT );
+
+ /* access its outline */
+ TT_Get_Glyph_Outline( instance, &outline );
+
+ /* in order to transform it */
+ TT_Transform_Outline( outline, &matrix );
+ /* and/or */
+ TT_Translate_Outline( outline,
+ x_offset, y_offset );
+
+ /* to render it */
+ TT_Get_Outline_Bitmap( outline, &bitmap );
+</pre>
+
+ Here is an example, assuming that the following variables
+
+<pre>
+ TT_Matrix matrix; /* 2x2 matrix */
+ TT_Pos x_off, y_off; /* corrective offsets */
+</pre>
+
+ define a transformation that can be correctly applied to a glyph
+ outline which have been previously placed relative to the
+ imaginary point position (0,0) with bearings preserved. Rendering
+ text can now be done as follows:<p>
+
+ <ol>
+
+ <li>Initialize the pen position; when rotating, it is extremely
+ well advised to use sub-pixel placement as you don't care
+ about hinting.
+
+<pre>
+ pen_x = cursor_x;
+ pen_y = cursor_y;
+</pre>
+
+ <li>Transform the glyph as needed, then translate it to the
+ current pen position:
+
+<pre>
+ TT_Transform_Outline( outline, &matrix );
+ TT_Translate_Outline( outline,
+ pen_x + x_off,
+ pen_y + y_off );
+</pre>
+
+ (Note that the transformation offsets have been included in
+ the translation.)<p>
+
+ <li>Render the bitmap, as it has now been placed correctly.<p>
+
+ <li>To change the pen position, transform the vector (0,advance)
+ with your matrix, and add it:
+
+<pre>
+ vec_x = metrics.advance;
+ vec_y = 0;
+ TT_Transform_Vector( &vec_x, &vec_y, &matrix );
+ pen_x += vec_x;
+ pen_y += vec_y;
+</pre>
+
+ <li>Start over at&nbsp;2. until completion.
+
+ </ol><p>
+
+ <hr>
+ <i>IMPORTANT NOTE:</i><p>
+
+ Do not grid-fit the pen position before rendering your glyph when
+ rendering rotated text. If you do, your transformed baseline
+ won't be preserved on each glyph, and the text will look like it's
+ `hopping' randomly. This is particularly visible at small
+ sizes.<p>
+
+ Sub-pixel precision placement is <i>very</i> important for clean
+ rotated text.
+ <hr><p>
+
+ <font size="+1"><li>Font-smoothing, a.k.a. gray-levels
+ rendering</font><p>
+
+ The FreeType engine's scan-line converter (the component also
+ called the <i>rasterizer</i>) is able to convert a vectorial glyph
+ outline into either a normal bitmap, or an 8-bit pixmap (a.k.a.
+ <i>colored bitmaps</i> on some systems). This last feature is
+ called <i>gray-level rendering</i> or <i>font-smoothing</i>,
+ because it uses a user-supplied palette to produce anti-aliased
+ versions of the glyphs.<p>
+
+ Its principle is to render a bitmap which is twice as large than
+ the target pixmap, then simply filtering it using a 2x2
+ summation.<p>
+
+ <hr>
+ <i>NOTE:</i><p>
+
+ FreeType's scan-line converter doesn't use or need an intermediate
+ second bitmap. Rather, filtering is performed in a single pass
+ during the sweep (see the file `raster.txt' for more information
+ about it).
+ <hr><p>
+
+ You'll notice that, as with Windows&nbsp;95, FreeType's rasterizer
+ only grays those parts of the glyph which need it, i.e., diagonals
+ and curves, while keeping horizontal and vertical stems straight
+ `black'. This greatly improves the legibility of text, while
+ avoiding the `blurry' look anti-aliased fonts typically found with
+ Adobe's Type Manager or Acrobat.<p>
+
+ There are thus five available gray-levels, ranging from 0
+ to&nbsp;4, where level&nbsp;0 and level&nbsp;4 are the background
+ and foreground colors, respectively, and where levels&nbsp;1,
+ 2,&nbsp;3 are intermediate. For example, to render black text on
+ a white background, one can use a palette like:<p>
+
+ <ul>
+
+ palette[0]&nbsp;= white (background) <br>
+ palette[1]&nbsp;= light gray <br>
+ palette[2]&nbsp;= medium gray <br>
+ palette[3]&nbsp;= dark gray <br>
+ palette[4]&nbsp;= black (foreground) <br>
+
+ </ul><p>
+
+ To set the engine's gray-level palette, simply use the API
+ function TT_Set_Raster_Palette() after initialization. It expects
+ an array of 5&nbsp;chars which will be used to render the
+ pixmaps.<p>
+
+ Note that the rasterizer doesn't create bitmaps or pixmaps.
+ Rather, it simply renders glyphs in the arrays you pass to it.
+ The generated glyph bitmaps are simply `or'-ed to the target (with
+ 0 being the background as a convention); in the case of pixmaps,
+ pixels are simply written to the buffer, in spans of four aligned
+ bytes.<p>
+
+ <hr>
+ <i>NOTE:</i><p>
+
+ The raster isn't able to superpose `transparent' glyphs on the
+ target pixmap. This means that you should always call the API
+ functions TT_Get_Glyph_Pixmap() and TT_Get_Outline_Pixmap() with
+ an empty map, and perform the superposition yourself.<p>
+
+ This can be more or less tricky, depending on the palette you are
+ using and your target graphics resolution. One of the components
+ found in the test directory, called `display.c', has large
+ comments on the way it implements it for the test programs. You
+ are encouraged to read the test program sources to understand how
+ one can take advantage of font smoothing.<p>
+
+ Pixmap surimposition is too system-specific a feature to be part
+ of the FreeType engine. Moreover, not everybody needs it!
+ <hr><p>
+
+ Finally, the question of sur-imposing anti-aliased colored text on
+ any texture, since being even more tricky, is left as an exercise
+ to the reader&nbsp;;-) If this topic really interests you, the
+ FreeType mailing list may host some helpful enthusiasts ready to
+ answer your questions. Who knows&nbsp;:-)<p>
+
+ <font size="+1"><li>Other interesting text processes</font><p>
+
+ <ul>
+
+ <li>Glyph substitution<p>
+
+ Substitution is used to replace one glyph by another when some
+ specific condition is met in the text string. Its most common
+ examples are ligatures (like replacing the `f' followed by `i'
+ by the single glyph `fi' if available in the font), as well as
+ positional selection as performed in the Arabic script (for
+ those not aware of this, each letter of the Arabic alphabet
+ can be written differently according to its position on words:
+ starting, ending, intermediate, or isolated).<p>
+
+ The base TrueType format doesn't define any table for glyph
+ substitution. However, GX, TrueType Open, and OpenType
+ provide (incompatible) extensions to perform it. Of course,
+ it isn't supported by the engine, but an extension could be
+ easily written to access the required tables.<p>
+
+ [Support for TrueType Open is already partially available.]<p>
+
+ <li>Justification<p>
+
+ ...
+
+ </ul>
+
+</ol>
+
+To be continued...
+
+</body>
+</html>
diff --git a/Build/source/libs/freetype/docs/glyphs.txt b/Build/source/libs/freetype/docs/glyphs.txt
new file mode 100644
index 00000000000..239686aefea
--- /dev/null
+++ b/Build/source/libs/freetype/docs/glyphs.txt
@@ -0,0 +1,999 @@
+http://www.freetype.org
+
+ Glyph Hell
+
+ An introduction to glyphs, as used and defined in the FreeType engine
+
+ ------------------------------------------------------------------------
+
+Introduction
+
+This article discusses in great detail the definition of glyph metrics, per
+se the TrueType specification, and the way they are managed and used by the
+FreeType engine. This information is crucial when it comes to rendering text
+strings, either in a conventional (i.e. Roman) layout, or with vertical or
+right-to-left ones. Some aspects like glyph rotation and transformation are
+explained too.
+
+Comments and corrections are highly welcome, and can be sent to the FreeType
+developers list.
+
+ ------------------------------------------------------------------------
+
+I. An overview of font files
+
+In TrueType, a single font file is used to contain information related to
+classification, modeling and rendering of text using a given typeface. This
+data is located in various independent `tables', which can be sorted in four
+simple classes, as described below:
+
+ * Face Data
+
+ We call face data the amount of information related to a given
+ typeface, independently of any particular scaling, transformation,
+ and/or glyph index. This usually means some typeface-global metrics and
+ attributes, like family and styles, PANOSE number, typographic
+ ascenders and descenders, as well as some very TrueType specific items
+ like the font `programs' found in the fpgm and prep tables, the gasp
+ table, character mappings, etc.
+
+ In FreeType, a face object is used to model a font file's face data.
+
+ * Instance Data
+
+ We call instance a given pointsize/transformation, at a given device
+ resolution (e.g. 8pt at 96x96dpi, or 12pt at 300x600dpi, etc). Some
+ tables found in the font files are used to produce instance-specific
+ data, like the cvt table, or the prep program. Though they are often
+ part of the face data, their processing results in information called
+ instance data.
+
+ In FreeType, it is modeled through an instance object, which is always
+ created from an existing face object.
+
+ * Glyph Data
+
+ We call glyph data the piece of information related to specific glyphs.
+ This includes the following things that are described in more details
+ in the next sections:
+
+ o The glyph's vectorial representation, also called its outline.
+
+ o Various metrics, like the glyph's bounding box, its bearings and
+ advance values.
+
+ o TrueType specifies a specific instruction bytecode, used to
+ associate each glyph with a small program, called the glyph code.
+ Its purpose is to grid-fit the outline to any target instance, in
+ order to produce excellent output at small pixel sizes.
+
+ The FreeType engine doesn't map each glyph to a single structure, as
+ this would waste memory for no good reason. Rather, a glyph object is a
+ container, created from any active face, which can be used to load
+ and/or process any font glyph at any instance (or even no instance at
+ all). Of course, the glyph properties (outline, metrics, bitmaps, etc.)
+ can be extracted independently from an object once it has been loaded
+ or processed.
+
+ * Text and Layout Data
+
+ Finally, there is a last class of data that doesn't really fit in all
+ others, and that can be called text data. It comprises information
+ related to the grouping of glyphs together to form text. Simple
+ examples are the kerning table, which controls the spacing between
+ adjacent glyphs, as well as some of the extensions introduced in
+ TrueType Open, OpenType, and TrueType GX like glyph substitution
+ (ligatures, vertical representations), baseline management,
+ justification, etc.
+
+ This article focuses on the basic TrueType tables, and hence, will only
+ talk about kerning, as FreeType doesn't support OpenType nor GX (yet).
+ [Support for TrueType Open is already partially available.]
+
+ ------------------------------------------------------------------------
+
+II. Glyph Outlines
+
+TrueType is a scalable font format; it is thus possible to render glyphs at
+any scale, and under any affine transform, from a single source
+representation. However, simply scaling vectorial shapes exhibits at small
+sizes (where `small' refers here to anything smaller than at least
+150 pixels) a collection of un-harmonious artifacts, like widths and/or
+heights degradations.
+
+Because of this, the format also provides a complete programming language
+used to design small programs associated to each glyph. Its role is to align
+the point positions on the pixel grid after the scaling. This operation is
+hence called grid-fitting, or even hinting.
+
+ 1. Vectorial representation
+
+ The source format of outlines is a collection of closed paths called
+ contours. Each contour delimits an outer or inner region of the glyph,
+ and can be made of either line segments and/or second-order beziers
+ (also called conic beziers or quadratics).
+
+ It is described internally as a series of successive points, with each
+ point having an associated flag indicating whether it is `on' or `off'
+ the curve. These rules are applied to decompose the contour:
+
+ o Two successive `on' points indicate a line segment joining them.
+
+ o One `off' point amidst two `on' points indicates a conic bezier,
+ the `off' point being the control point, and the `on' ones the
+ start and end points.
+
+ o Finally, two successive `off' points forces the rasterizer to
+ create (only during bitmap rendering) a virtual `on' point amidst
+ them, at their exact middle. This greatly facilitates the
+ definition of successive Bezier arcs.
+
+ * # on
+ * off
+ __---__
+ #-__ _-- -_
+ --__ _- -
+ --__ # \
+ --__ #
+ -#
+ Two `on' points
+ Two `on' points and one `off' point
+ between them
+
+ *
+ # __ Two `on' points with two `off'
+ \ - - points between them. The point
+ \ / \ marked `0' is the middle of the
+ - 0 \ `off' points, and is a `virtual
+ -_ _- # on' point where the curve passes.
+ -- It does not appear in the point
+ list.
+ *
+
+ Each glyph's original outline points are located on a grid of
+ indivisible units. The points are stored in the font file as
+ 16-bit integer grid coordinates, with the grid origin's being at (0,0);
+ they thus range from -16384 to 16383.
+
+ In creating the glyph outlines, a type designer uses an imaginary
+ square called the EM square. Typically, the EM square encloses the
+ capital letter `M' and most other letters of a typical roman alphabet.
+ The square's size, i.e., the number of grid units on its sides, is very
+ important for two reasons:
+
+ o It is the reference used to scale the outlines to a given
+ instance. For example, a size of 12pt at 300x300dpi corresponds to
+ 12*300/72 = 50 pixels. This is the size the EM square would appear
+ on the output device if it was rendered directly. In other words,
+ scaling from grid units to pixels uses the formula
+
+ pixel_size = point_size * resolution / 72
+
+ pixel_coordinate = grid_coordinate * pixel_size / EM_size
+
+ o The greater the EM size is, the larger resolution the designer can
+ use when digitizing outlines. For example, in the extreme example
+ of an EM size of 4 units, there are only 25 point positions
+ available within the EM square which is clearly not enough.
+ Typical TrueType fonts use an EM size of 2048 units (note: with
+ Type 1 PostScript fonts, the EM size is fixed to 1000 grid units.
+ However, point coordinates can be expressed in floating values).
+
+ Note that glyphs can freely extend beyond the EM square if the font
+ designer wants this. The EM is used as a convenience, and is a valuable
+ convenience from traditional typography.
+
+ Grid units are very often called font units or EM units.
+
+ -----------------------------------------------------------------------
+ IMPORTANT NOTE:
+
+ Under FreeType, scaled pixel positions are all expressed in the 26.6
+ fixed float format (made of a 26-bit integer mantissa, and a 6-bit
+ fractional part). In other words, all coordinates are multiplied by 64.
+ The grid lines along the integer pixel positions, are multiples of 64,
+ like (0,0), (64,0), (0,64), (128,128), etc., while the pixel centers
+ lie at middle coordinates (32 modulo 64) like (32,32), (96,32), etc.
+ -----------------------------------------------------------------------
+
+ 2. Hinting and Bitmap rendering
+
+ As said before, simply scaling outlines to a specific instance always
+ creates undesirable artifacts, like stems of different widths or
+ heights in letters like `E' or `H'. Proper glyph rendering needs that
+ the scaled points are aligned along the pixel grid (hence the name
+ grid-fitting), and that important widths and heights are respected
+ throughout the whole font (for example, it is very often desirable that
+ the letters `I' and `T' have their central vertical line of the same
+ pixel width).
+
+ Type 1 PostScript font files include with each glyph a small series of
+ distances called hints, which are later used by the type manager to try
+ grid-fitting the outlines as cleverly as possible. On one hand, it has
+ the consequence that upgrading your font engine can enhance the visual
+ aspects of all fonts of your system; on the other hand, the quality of
+ even the best version of Adobe's Type Manager isn't always very
+ pleasing at small sizes (notwithstanding font smoothing).
+
+ TrueType takes a radically different approach: Each glyph has an
+ associated `program', designed in a specific geometrical language,
+ which is used to align explicitly each outline point to the pixel grid,
+ preserving important distances and metrics. A stack-based low-level
+ bytecode is used to store it in the font file, and is interpreted later
+ when rendering the scaled glyphs.
+
+ This means that even very complex glyphs can be rendered perfectly at
+ very small sizes, as long as the corresponding glyph code is designed
+ correctly. Moreover, a glyph can loose some of its details, like
+ serifs, at small sizes to become more readable, because the bytecode
+ provides interesting features.
+
+ However, this also have the sad implication that an ill-designed glyph
+ code will always render junk, whatever the font engine's version, and
+ that it's very difficult to produce quality glyph code. There are about
+ 200 TrueType opcodes, and no known `high-level language' for it. Most
+ type artists aren't programmers at all and the only tools able to
+ produce quality code from vectorial representation have been
+ distributed to only a few font foundries, while tools available to the
+ public, e.g. Fontographer, are usually expensive though generating
+ average to mediocre glyph code.
+
+ All this explains why an enormous number of broken or ugly `free' fonts
+ have appeared on the TrueType scene, and that this format is now
+ mistakenly thought as `crap' by many people. Funnily, these are often
+ the same who stare at the `beauty' of the classic `Times New Roman' and
+ `Arial/Helvetica' at 8 points.
+
+ Once a glyph's code has been executed, the scan-line converter converts
+ the fitted outline into a bitmap (or a pixmap with font-smoothing).
+
+ ------------------------------------------------------------------------
+
+III. Glyph metrics
+
+ 1. Baseline, Pens and Layouts
+
+ The baseline is an imaginary line that is used to `guide' glyphs when
+ rendering text. It can be horizontal (e.g. Roman, Cyrillic, Arabic,
+ etc.) or vertical (e.g. Chinese, Japanese, etc). Moreover, to render
+ text, a virtual point, located on the baseline, called the pen
+ position, is used to locate glyphs.
+
+ Each layout uses a different convention for glyph placement:
+
+ o With horizontal layout, glyphs simply `rest' on the baseline. Text
+ is rendered by incrementing the pen position, either to the right
+ or to the left.
+
+ [Image]
+
+ The distance between two successive pen positions is
+ glyph-specific and is called the advance width. Note that its
+ value is always positive, even for right-to-left oriented
+ alphabets, like Arabic. This introduces some differences in the
+ way text is rendered.
+
+ ------------------------------------------------------------------
+ IMPORTANT NOTE:
+
+ The pen position is always placed on the baseline in TrueType,
+ unlike the convention used by some graphics systems, like Windows,
+ to always put the pen above the line, at the ascender's position.
+ ------------------------------------------------------------------
+
+ o With vertical layout, glyphs are centered around the baseline:
+
+ [Image]
+
+ 2. Typographic metrics and bounding boxes
+
+ A various number of face metrics are defined for all glyphs in a given
+ font. Three of them have a rather curious status in the TrueType
+ specification; they only apply to horizontal layouts:
+
+ o The ascent
+
+ This is the distance from the baseline to the highest/upper grid
+ coordinate used to place an outline point. It is a positive value,
+ due to the grid's orientation with the y axis upwards.
+
+ o The descent
+
+ The distance from the baseline to the lowest grid coordinate used
+ to place an outline point. This is a negative value, due to the
+ grid's orientation.
+
+ o The linegap
+
+ The distance that must be placed between two lines of text. The
+ baseline-to-baseline distance should be computed as
+
+ ascent - descent + linegap
+
+ if you use the typographic values.
+
+ The problem with these metrics is that they appear three times in a
+ single font file, each version having a slightly different meaning:
+
+ 1. The font's horizontal header provides the ascent, descent and
+ linegap fields, which are used to express the designer's intents,
+ rather than the real values that may be computed from all glyphs
+ in the outline. These are used by the Macintosh font engine to
+ perform font mapping (i.e. font substitution).
+
+ 2. The OS/2 table provides the usWinAscent and usWinDescent fields.
+ These values are computed for glyphs of the Windows ANSI charset
+ only, which means that they are wrong for any other glyph. Note
+ that usWinDescent is always positive (i.e. looks like `-descent').
+
+ 3. The OS/2 table provides the typoAscender, typoDescender and
+ typoLinegap values, which hopefully concern the whole font file.
+ These are the correct system-independent values!
+
+ All metrics are expressed in font units. If you want to use any of the
+ two first versions of these metrics, the TrueType specification
+ contains some considerations and computing tips that might help you.
+
+ Other, simpler metrics are:
+
+ o The glyph's bounding box, also called bbox
+
+ This is an imaginary box that encloses any glyph (usually as
+ tightly as possible). It is represented by four fields, namely
+ xMin, yMin, xMax, and yMax, that can be computed for any outline.
+ In FreeType, their values can be in font units (if measured in the
+ original outline) or in 26.6 pixel units (if measured on scaled
+ outlines).
+
+ Note that if it wasn't for grid-fitting, you wouldn't need to know
+ a box's complete values, but only its dimensions to know how big
+ is a glyph outline/bitmapa. However, correct rendering of hinted
+ glyphs needs the preservation of important grid alignment on each
+ glyph translation/placement on the baseline, which is why FreeType
+ always returns the complete glyph outline.
+
+ Note also that the font's header contains a global font bounding
+ box in font units which should enclose all glyphs in a font. This
+ can be used to pre-compute the maximum dimensions of any glyph at
+ a given instance.
+
+ o The internal leading
+
+ This concept comes directly from the world of traditional
+ typography. It represents the amount of space within the `leading'
+ which is reserved for glyph features that lay outside of the EM
+ square (like accentuation). It usually can be computed as
+
+ internal_leading = ascent - descent - EM_size
+
+ o The external leading
+
+ This is another name for the linegap.
+
+ 3. Bearings and Advances
+
+ Each glyph has also distances called bearings and advances. Their
+ definition is constant, but their values depend on the layout, as the
+ same glyph can be used to render text either horizontally or
+ vertically.
+
+ 1. The left side bearing: a.k.a. bearingX
+
+ This is the horizontal distance from the current pen position to
+ the glyph's left bounding box edge. It is positive for horizontal
+ layouts, and most generally negative for vertical one.
+
+ 2. The top side bearing: a.k.a. bearingY
+
+ This is the vertical distance from the baseline to the top of the
+ glyph's bounding box. It is usually positive for horizontal
+ layouts, and negative for vertical ones
+
+ 3. The advance width: a.k.a. advanceX
+
+ This is the horizontal distance the pen position must be
+ incremented (for left-to-right writing) or decremented (for
+ right-to-left writing) by after each glyph is rendered when
+ processing text. It is always positive for horizontal layouts, and
+ null for vertical ones.
+
+ 4. The advance height: a.k.a. advanceY
+
+ This is the vertical distance the pen position must be decremented
+ by after each glyph is rendered. It is always null for horizontal
+ layouts, and positive for vertical layouts.
+
+ 5. The glyph width
+
+ The glyph's horizontal extent. More simply, it is (bbox.xMax -
+ bbox.xMin) for unscaled font coordinates. For scaled glyphs, its
+ computation requests specific care, described in the grid-fitting
+ chapter below.
+
+ 6. The glyph height
+
+ The glyph's vertical extent. More simply, it is (bbox.yMax -
+ bbox.yMin) for unscaled font coordinates. For scaled glyphs, its
+ computation requests specific care, described in the grid-fitting
+ chapter below.
+
+ 7. The right side bearing
+
+ Only used for horizontal layouts to describe the distance from the
+ bbox's right edge to the advance width. It is in most cases a
+ non-negative number. The FreeType library doesn't provide this
+ metric directly, as it isn't really part of the TrueType
+ specification. It can be computed simply as
+
+ advance_width - left_side_bearing - (xMax-xMin)
+
+ [Image]
+
+ [Image]
+
+ Finally, if you use `ABC widths' under Windows and OS/2, the following
+ relations apply:
+
+ A = left side bearing
+ B = width
+ C = right side bearing
+
+ A+B+C = advance width
+
+ 4. The effects of grid-fitting
+
+ All these metrics are stored in font units in the font file. They must
+ be scaled and grid-fitted properly to be used at a specific instance.
+ This implies several things:
+
+ o First, a glyph program not only aligns the outline along the grid
+ pixel, it also processes the left side bearing and the advance
+ width. Other grid-fitted metrics are usually available in optional
+ TrueType tables if you need them.
+
+ o A glyph program may decide to extend or stretch any of these two
+ metrics if it has a need for it. This means that you cannot assume
+ that the fitted metrics are simply equal to the scaled one plus or
+ minus a liberal distance < 1 pixel (i.e., less than 64 fractional
+ pixel units). For example, it is often necessary to stretch the
+ letter `m' horizontally at small pixel sizes to make all vertical
+ stems visible, while the same glyph can be perfectly `square' at
+ larger sizes.
+
+ o Querying the fitted metrics of all glyphs at a given instance is
+ very slow, as it needs to load and process each glyph
+ independently. For this reason, some optional TrueType tables are
+ defined in the specification, containing pre-computed metrics for
+ specific instances (the most commonly used, like 8, 9, 10, 11, 12,
+ and 14 points at 96dpi, for example). These tables aren't always
+ present in a TrueType font.
+
+ If you don't need the exact fitted value, it's much faster to
+ query the metrics in font units, then scale them to the instance's
+ dimensions.
+
+ -----------------------------------------------------------------------
+ IMPORTANT NOTE:
+
+ Another very important consequence of grid-fitting is the fact that
+ moving a fitted outline by a non-integer pixel distance will simply
+ ruin the hinter's work, as alignments won't be preserved. The
+ translated glyph will then look `ugly' when converted to a bitmap!
+
+ In other words, each time you want to translate a fitted glyph outline,
+ you must take care of only using integer pixel distances (the x and
+ y offsets must be multiples of 64, which equals to 1.0 in the 26.6
+ fixed float format). If you don't care about grid-fitting (typically
+ when rendering rotated text), you can use any offset you want and use
+ sub-pixel glyph placement.
+ -----------------------------------------------------------------------
+
+ ------------------------------------------------------------------------
+
+IV. Text processing
+
+This section demonstrates how to use the concepts previously defined to
+render text, whatever the layout you use.
+
+ 1. Writing simple text strings
+
+ We will start by generating a simple string with a Roman alphabet. The
+ layout is thus horizontal, left to right.
+
+ For now, we will assume all glyphs are rendered in a single target
+ bitmap. The case of generating individual glyph bitmaps, then placing
+ them on demand on a device is presented in a later chapter of this
+ section.
+
+ Rendering the string needs to place each glyph on the baseline; this
+ process looks like the following:
+
+ 1. Place the pen to the cursor position. The pen is always located on
+ the baseline. Its coordinates must be grid-fitted (i.e. multiples
+ of 64)!
+
+ pen_x = cursor_x;
+ pen_y = cursor_y;
+
+ 2. Load the glyph outline and its metrics. Using the flag
+ TTLOAD_DEFAULT will scale and hint the glyph:
+
+ TT_Load_Glyph( instance,
+ glyph,
+ glyph_index,
+ TTLOAD_DEFAULT );
+
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+ TT_Get_Glyph_Outline( glyph, &outline );
+
+ 3. The loader always places the glyph outline relative to the
+ imaginary pen position (0,0). You thus simply need to translate
+ the outline by the vector:
+
+ ( pen_x, pen_y )
+
+ To place it on its correct position, you can use the call
+
+ TT_Translate_Outline( outline, pen_x, pen_y );
+
+ 4. Render the outline in the target bitmap, the glyph will be
+ surimposed on it with a binary `or' operation (FreeType never
+ creates glyph bitmaps by itself, it simply renders glyphs in the
+ arrays you pass to it. See the API reference for a complete
+ description of bitmaps and pixmaps).
+
+ TT_Get_Outline_Bitmap( outline, &target_bitmap );
+
+ ------------------------------------------------------------------
+ IMPORTANT NOTE:
+
+ If you don't want to access the outline in your code, you can also
+ use the API function TT_Get_Glyph_Bitmap() which does the same as
+ the previous lines:
+
+ TT_Get_Glyph_Outline( glyph, &outline );
+ TT_Translate_Outline( outline, x_offset, y_offset );
+ TT_Get_Outline_Bitmap( outline, &target_bitmap );
+ TT_Translate_Outline( outline, -x_offset, -y_offset );
+
+ is equivalent to:
+
+ TT_Get_Glyph_Bitmap( glyph,
+ x_offset,
+ y_offset,
+ &target_bitmap );
+
+ ------------------------------------------------------------------
+
+ 5. Now advance the pen to its next position. The advance is always
+ grid-fitted when the glyph was hinted:
+
+ pen_x += metrics.advance;
+
+ The advance being grid-fitted, the pen position remains aligned on
+ the grid.
+
+ 6. Start over on item 2 until string completion. That's it!
+
+ 2. Writing right-to-left and vertical text
+
+ Generating strings for different layouts is very similar. Here are the
+ most important differences.
+
+ o For right-to-left text (like Arabic)
+
+ The main difference here is that, as the advance width and left
+ side bearings are oriented against the flow of text, the pen
+ position must be decremented by the advance width, before placing
+ and rendering the glyph. Other than that, the rest is strictly
+ similar.
+
+ o For vertical text (like Chinese or Japanese)
+
+ In this case, the baseline is vertical, which means that the pen
+ position must be shifted in the vertical direction. You need the
+ vertical glyph metrics to do that (using the
+ TT_Get_Big_Glyph_Metrics() function).
+
+ Once you get these, the rest of the process is very similar. The
+ glyph outline is placed relative to an imaginary origin of (0,0),
+ and you should translate it to the pen position before rendering
+ it.
+
+ The big difference is that you must decrement pen_y, rather than
+ increment pen_x (this is for the TrueType convention of y oriented
+ upwards).
+
+ pen_y -= metrics.advance;
+
+ 3. Generating individual glyph bitmaps and using them to render text
+
+ Loading each glyph when rendering text is slow, and it's much more
+ efficient to render each one in a standalone bitmap to place it in a
+ cache. Text can then be rendered fast by applying simple blit
+ operations on the target device.
+
+ To be able to render text correctly with the bitmaps, you must record
+ and associate with them its fitted bearings and advances. Hence the
+ following process:
+
+ 1. Generate the bitmaps.
+
+ + Load the glyph and get its metrics.
+
+ TT_Load_Glyph( instance,
+ glyph,
+ glyph_index,
+ TTLOAD_DEFAULT );
+
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+
+ The bbox is always fitted when calling TT_Get_Glyph_Metrics()
+ on a hinted glyph. You can then easily compute the glyph's
+ dimension in pixels as:
+
+ width = (bbox.xMax - bbox.xMin) / 64;
+ height = (bbox.yMax - bbox.yMin) / 64;
+
+ NOTE 1:
+ The fitted bounding box always contains all the dropouts that
+ may be produced by the scan-line converter. This width and
+ height are thus valid for all kinds of glyphs).
+
+ NOTE 2:
+ If you want to compute the dimensions of a rotated outline's
+ bitmap, compute its bounding box with TT_Get_Outline_BBox(),
+ then grid-fit the bbox manually:
+
+ #define FLOOR(x) ((x) & -64)
+ #define CEILING(x) (((x)+63) & -64)
+
+ xMin = FLOOR(xMin);
+ yMin = FLOOR(yMin);
+ yMin = CEILING(xMax);
+ yMax = CEILING(yMax);
+
+ then compute width and height as above.
+
+ + Create a bitmap of the given dimension, e.g.:
+
+ bitmap.width = width;
+ bitmap.cols = (width+7) & -8;
+ bitmap.rows = height;
+ bitmap.flow = TT_Flow_Up;
+ bitmap.size = bitmap.cols * bitmap.rows;
+ bitmap.buffer = malloc( bitmap.size );
+
+ + Render the glyph into the bitmap.
+
+ Don't forget to shift it by (-xMin, -yMin) to fit it in the
+ bitmap:
+
+ /* Note that the offsets must be grid-fitted to */
+ /* preserve hinting! */
+ TT_Get_Glyph_Bitmap( glyph,
+ &bitmap,
+ -bbox.xMin,
+ -bbox.yMin );
+
+ 2. Store the bitmap with the following values:
+
+ bearingX / 64 = left side bearing in pixels
+ advance / 64 = advance width/height in pixels
+
+ When your cache is set up, you can then render text using a scheme
+ similar to the ones describe in 1. and 2., with the exception that
+ now pen positions and metrics are expressed in pixel values. We
+ are done!
+
+ pen_x = cursor_x;
+ pen_y = cursor_y;
+
+ while ( glyph_to_render )
+ {
+ access_cache( glyph_index, metrics, bitmap );
+
+ blit_bitmap_to_position
+ ( pen_x + bearingX,
+ pen_y (+ bearingY depending on orientation ) );
+
+ pen_x += advance;
+ }
+
+ 4. Device-independent text rendering
+
+ The previously described rendering processes all align glyphs on the
+ baseline according to metrics fitted for the display's distance. In
+ some cases, the display isn't the final output, and placing the glyphs
+ in a device-independent way is more important than anything.
+
+ A typical case is a word processor which displays text as it should
+ appear on paper when printed. As you've probably noticed, the glyphs
+ aren't always spaced uniformly on the screen as you type them,
+ sometimes the space between an `m' and a `t' is too small, some other
+ it is too large, etc.
+
+ These differences are simply due to the fact that the word processor
+ aligns glyphs in an device-independent way, using original metrics in
+ font units to do it, then scale them as it can to display text on
+ screen, usually at a very smaller resolution than your printer's one.
+
+ Device-independence is a crucial part of document portability, and it
+ is very saddening to see that most professional word processors don't
+ do it correctly. For example, MS Word uses the fitted metrics of the
+ printer's resolution, rather than the originals in font units.
+
+ This is great to get sure that your text prints very well on your
+ printer, but it also implies that someone printing the exact same
+ document on a device with different output resolutions (e.g. bubble-jet
+ vs. laser printers) may encounter trouble.
+
+ As the differences in advances accumulate on one line, they can sum to
+ the width of one or more glyphs in extreme cases, which is enough to
+ `overflow' the automatic justification algorithm. This may add
+ additional lines of printed text, or even remove some. Moreover,
+ supplemental lines can produce unexpected page breaks and `blank'
+ pages. This can be extremely painful when working with large documents,
+ as this `feature' may require you to redesign completely your
+ formatting to re-print it.
+
+ In conclusion, if you want portable document rendering, never hesitate
+ to use and apply device-independent terms! For example, a simple way to
+ produce text would be:
+
+ 1. Get a scale to convert from your device-independent units to 26.6
+ pixels.
+
+ 2. Get another scale to convert from original font units to
+ device-independent units.
+
+ 3. Perform pen placement and advances in device-independent units.
+
+ 4. To render each glyph, compute the pen's rounded position, as well
+ as the rounded glyph left side bearing, both expressed in 26.6
+ pixels (don't use the fitted metrics). You will then be able to
+ place the glyph and/or blit its bitmap.
+
+ 5. Kerning glyphs
+
+ An interesting effect that most people appreciate is kerning. It
+ consists of modifying the spacing between two successive glyphs
+ according to their outlines. For example, the letters `T' and a `y' can
+ be easily moved closer, as the top of the `y' fits nicely under the
+ `T's upper right bar.
+
+ To perform kerning, the TrueType specification provides a specific
+ table (its tag being `kern'), with several storage formats. This
+ section doesn't explain how to access this information; however, you
+ can have a look at the standard extension called `ttkern.h' which comes
+ with FreeType.
+
+ The kerning distance between two glyphs is a value expressed in font
+ units which indicates whether their outline can be moved together or
+ apart when one follows the other. The distance isn't reflexive, which
+ means that the kerning for the glyph pair (`T',`y') isn't the same as
+ the one for (`y',`T').
+
+ The value is positive when the glyphs must be moved apart, and negative
+ when they must be moved closer. You can implement kerning simply by
+ adding its scaled and rounded value to the advance width when moving
+ the pen position. Here an example for horizontal kerning:
+
+ #define ROUND( x ) ( (x + 32) & -64 )
+
+ scaled_kerning = kerning * imetrics.x_scale / 0x10000;
+
+ pen_x += metrics.advance + ROUND( scaled_kerning );
+
+ 6. Rotated and stretched/slanted text
+
+ In order to produce rotated glyphs with FreeType, one must understand a
+ few things:
+
+ o The engine doesn't apply specific transformations to the glyphs it
+ loads and processes (other than the simpler resolution-base
+ scaling and grid-fitting). If you want to rotate glyphs, you will
+ have to load their outline, then apply the geometric
+ transformations that please you (a number of APIs are there to
+ help you to do it easily).
+
+ o Even if the glyph loader hints `straight' glyphs, it is possible
+ to inform the font and glyph programs that you're going to later
+ transform the resulting outlines. Two flags can be passed to the
+ bytecode interpreter:
+
+ + The `rotated' flag indicates that you are going to rotate the
+ glyphs in a non-trivial direction (i.e., on neither of the
+ two coordinate axis). You are advised not to set it when
+ writing 90 degrees-rotated text for example.
+
+ + The `stretched' flag indicates that you are going to apply a
+ transformation that will distort distances. While rotations
+ and symmetries keep distances constant, slanting and
+ stretching do modify them.
+
+ These flags can be interpreted by the glyph code to toggle certain
+ processings which vary from one font to the other. However, most of the
+ TrueType fonts that were tested with FreeType, if not all of them,
+ simply change the dropout-mode when any of these flags is set, and/or
+ disable hinting when rotation is detected. We advise you to never set
+ these flags, even when rotating text. For what it's worth, hinted
+ rotated text is no uglier than un-hinted one.
+
+ You can use the function TT_Set_Instance_Transform_Flags() to set them.
+ Then, rendering can be done with the following calls:
+
+ /* set the flags */
+ TT_Set_Instance_Transforms( instance,
+ rotated,
+ stretched );
+
+ /* load a given glyph */
+ TT_Get_Glyph_Outline( instance,
+ glyph,
+ index,
+ TTLOAD_DEFAULT );
+
+ /* access its outline */
+ TT_Get_Glyph_Outline( instance, &outline );
+
+ /* in order to transform it */
+ TT_Transform_Outline( outline, &matrix );
+ /* and/or */
+ TT_Translate_Outline( outline,
+ x_offset, y_offset );
+
+ /* to render it */
+ TT_Get_Outline_Bitmap( outline, &bitmap );
+
+ Here is an example, assuming that the following variables
+
+ TT_Matrix matrix; /* 2x2 matrix */
+ TT_Pos x_off, y_off; /* corrective offsets */
+
+ define a transformation that can be correctly applied to a glyph
+ outline which have been previously placed relative to the imaginary
+ point position (0,0) with bearings preserved. Rendering text can now be
+ done as follows:
+
+ 1. Initialize the pen position; when rotating, it is extremely well
+ advised to use sub-pixel placement as you don't care about
+ hinting.
+
+ pen_x = cursor_x;
+ pen_y = cursor_y;
+
+ 2. Transform the glyph as needed, then translate it to the current
+ pen position:
+
+ TT_Transform_Outline( outline, &matrix );
+ TT_Translate_Outline( outline,
+ pen_x + x_off,
+ pen_y + y_off );
+
+ (Note that the transformation offsets have been included in the
+ translation.)
+
+ 3. Render the bitmap, as it has now been placed correctly.
+
+ 4. To change the pen position, transform the vector (0,advance) with
+ your matrix, and add it:
+
+ vec_x = metrics.advance;
+ vec_y = 0;
+ TT_Transform_Vector( &vec_x, &vec_y, &matrix );
+ pen_x += vec_x;
+ pen_y += vec_y;
+
+ 5. Start over at 2. until completion.
+
+ -----------------------------------------------------------------------
+ IMPORTANT NOTE:
+
+ Do not grid-fit the pen position before rendering your glyph when
+ rendering rotated text. If you do, your transformed baseline won't be
+ preserved on each glyph, and the text will look like it's `hopping'
+ randomly. This is particularly visible at small sizes.
+
+ Sub-pixel precision placement is very important for clean rotated text.
+ -----------------------------------------------------------------------
+
+ 7. Font-smoothing, a.k.a. gray-levels rendering
+
+ The FreeType engine's scan-line converter (the component also called
+ the rasterizer) is able to convert a vectorial glyph outline into
+ either a normal bitmap, or an 8-bit pixmap (a.k.a. colored bitmaps on
+ some systems). This last feature is called gray-level rendering or
+ font-smoothing, because it uses a user-supplied palette to produce
+ anti-aliased versions of the glyphs.
+
+ Its principle is to render a bitmap which is twice as large than the
+ target pixmap, then simply filtering it using a 2x2 summation.
+
+ -----------------------------------------------------------------------
+ NOTE:
+
+ FreeType's scan-line converter doesn't use or need an intermediate
+ second bitmap. Rather, filtering is performed in a single pass during
+ the sweep (see the file `raster.txt' for more information about it).
+ -----------------------------------------------------------------------
+
+ You'll notice that, as with Windows 95, FreeType's rasterizer only
+ grays those parts of the glyph which need it, i.e., diagonals and
+ curves, while keeping horizontal and vertical stems straight `black'.
+ This greatly improves the legibility of text, while avoiding the
+ `blurry' look anti-aliased fonts typically found with Adobe's Type
+ Manager or Acrobat.
+
+ There are thus five available gray-levels, ranging from 0 to 4, where
+ level 0 and level 4 are the background and foreground colors,
+ respectively, and where levels 1, 2, 3 are intermediate. For example,
+ to render black text on a white background, one can use a palette like:
+
+ palette[0] = white (background)
+ palette[1] = light gray
+ palette[2] = medium gray
+ palette[3] = dark gray
+ palette[4] = black (foreground)
+
+ To set the engine's gray-level palette, simply use the API function
+ TT_Set_Raster_Palette() after initialization. It expects an array of
+ 5 chars which will be used to render the pixmaps.
+
+ Note that the rasterizer doesn't create bitmaps or pixmaps. Rather, it
+ simply renders glyphs in the arrays you pass to it. The generated glyph
+ bitmaps are simply `or'-ed to the target (with 0 being the background
+ as a convention); in the case of pixmaps, pixels are simply written to
+ the buffer, in spans of four aligned bytes.
+
+ -----------------------------------------------------------------------
+ NOTE:
+
+ The raster isn't able to superpose `transparent' glyphs on the target
+ pixmap. This means that you should always call the API functions
+ TT_Get_Glyph_Pixmap() and TT_Get_Outline_Pixmap() with an empty map,
+ and perform the superposition yourself.
+
+ This can be more or less tricky, depending on the palette you are using
+ and your target graphics resolution. One of the components found in the
+ test directory, called `display.c', has large comments on the way it
+ implements it for the test programs. You are encouraged to read the
+ test program sources to understand how one can take advantage of font
+ smoothing.
+
+ Pixmap surimposition is too system-specific a feature to be part of the
+ FreeType engine. Moreover, not everybody needs it!
+ -----------------------------------------------------------------------
+
+ Finally, the question of sur-imposing anti-aliased colored text on any
+ texture, since being even more tricky, is left as an exercise to the
+ reader ;-) If this topic really interests you, the FreeType mailing
+ list may host some helpful enthusiasts ready to answer your questions.
+ Who knows :-)
+
+ 8. Other interesting text processes
+
+ o Glyph substitution
+
+ Substitution is used to replace one glyph by another when some
+ specific condition is met in the text string. Its most common
+ examples are ligatures (like replacing the `f' followed by `i' by
+ the single glyph `fi' if available in the font), as well as
+ positional selection as performed in the Arabic script (for those
+ not aware of this, each letter of the Arabic alphabet can be
+ written differently according to its position on words: starting,
+ ending, intermediate, or isolated).
+
+ The base TrueType format doesn't define any table for glyph
+ substitution. However, GX, TrueType Open, and OpenType provide
+ (incompatible) extensions to perform it. Of course, it isn't
+ supported by the engine, but an extension could be easily written
+ to access the required tables.
+
+ [Support for TrueType Open is already partially available.]
+
+ o Justification
+
+ ...
+
+To be continued...
diff --git a/Build/source/libs/freetype/docs/i18n.txt b/Build/source/libs/freetype/docs/i18n.txt
new file mode 100644
index 00000000000..22f5da9c1fd
--- /dev/null
+++ b/Build/source/libs/freetype/docs/i18n.txt
@@ -0,0 +1,161 @@
+
+Using national language support (NLS) in FreeType
+=================================================
+
+21. 1. 1998
+Erwin Dieterich
+
+
+1) Introduction
+2) Using gettext (user's view)
+3) Using gettext (programmer's view)
+4) Using gettext (maintainer's view)
+5) How can I switch off NLS? I don't need/want it.
+
+
+Only Unix NLS using gettext() is covered here. If you are able to
+help with internationalization (i18n) for different operating
+systems, please e-mail me at Erwin.Dieterich.ED@Bayer-AG.de.
+
+
+
+1) Introduction
+
+If a program is to be used by people who are not fluent speakers of
+English, the first thing they will ask for is communication in their
+native language. If someone tries to implement NLS in a program
+using only #ifdefs and other such programming strategies, it's
+likely that this someone will get nowhere.
+
+Gettext() is a possible way to help. Only minimal extra programming
+effort is needed; the translations are implemented separately from
+the program, and it is not necessary to recompile a program if you
+want to switch the messages to a different language. If you wouldd
+like to know more about gettext(), I recommend reading the GNU
+gettext tools manual, written by Ulrich Drepper, Jim Meyering, and
+Francois Pinard.
+
+Currently supported languages are:
+
+ Czech (cz) translator: Pavel Kankovsky
+ <peak@kerberos.troja.mff.cuni.cz>
+ Dutch (nl) translator: Gertjan de Back <gertjan.de.back@pi.net>
+ French (fr) translator: David Turner <david.turner@freetype.org>
+ German (de) translator: Erwin Dieterich
+ <erwin.dieterich.ed@bayer-ag.de>
+ Spain (es) translator: Miguel A. Perez Valdenebro
+ <map@fujitsu.es>
+
+Currently supported programs in the `test' directory are:
+
+ ftlint
+ ftdump
+ fterror
+ ftmetric
+ ftsbit
+
+
+2) Using gettext (user's view)
+
+Using gettext as an end user is very simple. If FreeType is
+correctly installed on your computer, you can simply issue an
+`export LANG=<language id>' in your Bourne shell or `setenv
+LANG=<language id>' if you are using csh. That's all. In order to
+switch back to English, just use `export LANG=' or `setenv LANG='.
+
+<language id> is a two character code describing your language:
+de=German, fr=French etc. Every supported language has its own
+<language id>.po file in the `po' directory of FreeType. If your
+language is not there you should consider contributing a
+translation. Just e-mail me. Here is a transcript of what `export
+LANG=<language id>' does:
+
+ test> ftlint 24 furiosot.ttf
+ Could not find or open furiosot.ttf.
+ FreeType error message: OS/2 table missing.
+
+ test> export LANG=de
+ test> ftlint 24 furiosot.ttf
+ Datei `furiosot.ttf' konnte nicht gefunden oder geöffnet werden.
+ FreeType Fehlermeldung: `OS/2'-Tabelle fehlt.
+
+ test> export LANG=
+ test> ftlint 24 furiosot.ttf
+ Could not find or open file furioso.ttf.
+ FreeType error message: OS/2 table missing.
+
+Doesn't this look good? But what if nothing happens if you set
+LANG? Here are some hints:
+
+First: Is your language really supported? If it is, you need to be
+sure that you have gettext() installed (if you are sitting at a
+Linux box, chances are very good that you have). If you compiled
+FreeType yourself and nothing strange happened, then your version of
+FreeType has NLS compiled in, as this is the default, unless you
+forgot to install the translation files in the right places (`make
+install' in the po/ directory should be enough, but you need root
+permissions as these files are installed somewhere in /usr/local) --
+good luck :-)
+
+
+3) Using gettext (programmer's view)
+
+If you intend to use NLS in your program, you just need to make a
+few simple changes. Here I only describe how NLS is enabled in the
+programs that come with FreeType in test/. If you would like to add
+NLS to other programs using FreeType as well, take a look at
+FreeType's installation files; you can probably use these files as a
+model.
+
+Every string that should be translated needs gettext() around it.
+So
+
+ Message( "Usage: %s fontname[.ttf|.ttc]\n\n",
+ execname );
+
+becomes
+
+ Message( gettext( "Usage: %s fontname[.ttf|.ttc]\n\n" ),
+ execname );
+
+
+Yes, it's that simple. Next you need to initialize gettext. Put
+the following in the header section of your file:
+
+ #include "ft_conf.h"
+ #ifdef HAVE_LIBINTL_H
+ #include <libintl.h>
+ #endif
+
+ #ifndef HAVE_LIBINTL_H
+ #define gettext( x ) ( x )
+ #endif
+
+and this at the very beginning of your main program:
+
+ #ifdef HAVE_LIBINTL_H
+ setlocale(LC_ALL, "");
+ bindtextdomain( "freetype", LOCALEDIR );
+ textdomain( "freetype" );
+ #endif
+
+
+That's all. Just have a look at fterror.c in test/.
+
+
+4) Using gettext (maintainer's view)
+
+I am too lazy today :-) If something isn't clear, just ask me.
+
+
+5) How can I switch off NLS? I don't need/want it.
+
+Just say `configure --disable-nls' and recompile FreeType.
+
+
+If you have any questions or comments regarding this short
+introduction to NLS & FreeType, feel free to email me at
+Erwin.Dieterich.ED@Bayer-AG.de.
+
+
+--- end of i18n.txt ---
diff --git a/Build/source/libs/freetype/docs/image/baselin2.gif b/Build/source/libs/freetype/docs/image/baselin2.gif
new file mode 100644
index 00000000000..b9c28bd6523
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/baselin2.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/baseline.gif b/Build/source/libs/freetype/docs/image/baseline.gif
new file mode 100644
index 00000000000..f966ad21817
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/baseline.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/emsquare.gif b/Build/source/libs/freetype/docs/image/emsquare.gif
new file mode 100644
index 00000000000..21dcfb34ead
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/emsquare.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/freetype.gif b/Build/source/libs/freetype/docs/image/freetype.gif
new file mode 100644
index 00000000000..8be6d2153ee
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/freetype.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/freetype.png b/Build/source/libs/freetype/docs/image/freetype.png
new file mode 100644
index 00000000000..d520046feea
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/freetype.png
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/grid1.gif b/Build/source/libs/freetype/docs/image/grid1.gif
new file mode 100644
index 00000000000..db15e23cf1c
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/grid1.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/grid2.gif b/Build/source/libs/freetype/docs/image/grid2.gif
new file mode 100644
index 00000000000..d0d9529603e
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/grid2.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/grid3.gif b/Build/source/libs/freetype/docs/image/grid3.gif
new file mode 100644
index 00000000000..5b8035dafd2
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/grid3.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/metrics.gif b/Build/source/libs/freetype/docs/image/metrics.gif
new file mode 100644
index 00000000000..b8813b41004
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/metrics.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/metrics2.gif b/Build/source/libs/freetype/docs/image/metrics2.gif
new file mode 100644
index 00000000000..1366ef237e9
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/metrics2.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/small2.gif b/Build/source/libs/freetype/docs/image/small2.gif
new file mode 100644
index 00000000000..25f6afe83ab
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/small2.gif
Binary files differ
diff --git a/Build/source/libs/freetype/docs/image/tfp-back.png b/Build/source/libs/freetype/docs/image/tfp-back.png
new file mode 100644
index 00000000000..53be67191db
--- /dev/null
+++ b/Build/source/libs/freetype/docs/image/tfp-back.png
Binary files differ
diff --git a/Build/source/libs/freetype/docs/optimize.txt b/Build/source/libs/freetype/docs/optimize.txt
new file mode 100644
index 00000000000..2f7af918eca
--- /dev/null
+++ b/Build/source/libs/freetype/docs/optimize.txt
@@ -0,0 +1,181 @@
+
+ FreeType Optimization HOWTO
+
+
+
+Introduction
+============
+
+ This file describes several ways to improve the performance of the
+ FreeType engine on specific builds. Each `trick' has some
+ drawbacks, be it on code size or portability.
+
+ The performance improvement cannot be quantified here simply
+ because id depends significantly on platforms _and_ compilers.
+
+
+
+I. Tweaking the configuration file
+==================================
+
+ The FreeType configuration file is named `ft_conf.h' and contains
+ the definition of various macros that are used to configure the
+ engine at build time.
+
+ Apart from the Unix configuration file, which is generated when
+ calling the `configure' script from the template called
+
+ freetype/ft_conf.h.in ,
+
+ all configuration files are located in
+
+ freetype/lib/arch/<system>/ft_conf.h ,
+
+ where <system> stands for your platform. This release also
+ provides an `ansi' build, i.e., the directory `lib/arch/ansi' used
+ to compile with any ANSI-compliant compiler.
+
+ The configuration macros that relate to performance are described
+ next.
+
+
+ 1. TT_CONFIG_OPTION_INTERPRETER_SWITCH
+ --------------------------------------
+
+ If set, this macro builds a bytecode interpreter which uses a
+ huge `switch' statement to parse the bytecode stream during
+ glyph hinting.
+
+ If unset, the interpreter uses a big jump table to call each
+ bytecode's routine.
+
+ This macro is *set* by default. However, it may be worthwile on
+ some platforms to unset it.
+
+ Note that this macro is ignored until
+ TT_CONFIG_OPTION_BYTECODE_INTERPRETER is set.
+
+
+ 2. TT_CONFIG_OPTION_STATIC_INTERPRETER
+ --------------------------------------
+
+ If set, this macro builds a bytecode interpreter which uses a
+ static variable to store its state. On some processors, this
+ will produce code which is bigger but slightly faster.
+
+ Note that you should NOT DEFINE this macro when building a
+ thread-safe version of the engine.
+
+ This macro is *unset* by default.
+
+
+ 3. TT_CONFIG_OPTION_STATIC_RASTER
+ ---------------------------------
+
+ If set, this macro builds a scan-line converter which uses a
+ static variable to store its state. On some processors, though
+ depending on the compiler used, this will produce code which is
+ bigger but moderately faster.
+
+ Note that you should NOT DEFINE this macro when building a
+ thread-safe version of the engine.
+
+ This macro is *unset* by default. We do not recommend using it
+ except for extreme cases where a performance `edge' is needed.
+
+
+ 4. TT_USE_LONG_LONG
+ -------------------
+
+ Define TT_USE_LONG_LONG if you want to enable the use of the
+ 'long long' 64-bit type provided by gcc and other compilers.
+ Note that:
+
+ 1. The type wasn't ANSI C in 1989 (but is now OK with the new
+ C99), and thus will produce many warnings during library
+ compilation with many compilers, including gcc 2.8.x.
+
+ 2. Though the generated object files are slightly smaller, the
+ resulting executables are bigger of about 4kB! gcc must be
+ linking some extra code in there!
+
+ 3. There is really no speed gain in doing so (but it may help
+ debug the ttcalc component).
+
+ IMPORTANT NOTE: You don't need to define it on 64-bits machines!
+
+ NOTE 2 : This flag used to be _GNUC_LONG64_
+
+
+
+II. Replacing some components with optimized versions
+=====================================================
+
+ You can also, in order to improve performance, replace one or more
+ components from the original source files. Here are our
+ suggestions.
+
+
+ 1. Use memory-mapped files whenever available
+ ---------------------------------------------
+
+ Loading a glyph from a TrueType file needs many random seeks,
+ which take a lot of time when using disk-based files.
+
+ Whenever possible, use memory-mappings to improve load
+ performance dramatically. For an example, see the source file
+
+ freetype/lib/arch/unix/ttmmap.c
+
+ which uses Unix memory-mapped files.
+
+
+ 2. Replace the computation routines in `ttcalc.c'
+ ---------------------------------------------------
+
+ This file contains many computation routines that can easily be
+ replaced by inline-assembly, tailored for a specific processor
+ and/or compiler.
+
+ After heavy testing, we have found that these functions,
+ especially TT_MulDiv(), are the ones that are most extensively
+ used and called when loading glyphs from a font file.
+
+ We do not provide inline-assembly with this release, as we want
+ to emphasize the portability of our library. However, when
+ working on a specific project where the hardware is known to be
+ fixed (like on an embedded system), great performance gains
+ could be achieved by replacing these routines.
+
+ (By the way, the square root function is not optimal, but it is
+ very seldom called. However, its accuracy is _critical_.
+ Replacing it with a fast but inaccurate algorithm will ruin the
+ rendering of glyphs at small sizes.)
+
+
+
+III. Measuring performance improvements
+=======================================
+
+ Once you have chosen some improvements and rebuilt the library,
+ some quick ways to measure the `new' speed are:
+
+ - Run the test program `ftlint' on a directory containing many
+ TrueType fonts, and measure the time it takes. On Unix, you can
+ use the shell command `time' to do it like in
+
+ % time test/ftlint 10 /ttfonts/*.ttf
+
+ This will measure the performance improvement of the TrueType
+ interpreter.
+
+ - Run the test program `fttimer' on a font containing many complex
+ glyphs (the latest available versions of Times or Arial should
+ do it), probaby using anti-aliasing, as in:
+
+ % time test/fttimer -g /ttfonts/arial.ttf
+
+ Compare the results of several of these runs for each build.
+
+
+--- end of OPTIMIZE ---
diff --git a/Build/source/libs/freetype/docs/porting.txt b/Build/source/libs/freetype/docs/porting.txt
new file mode 100644
index 00000000000..f5dd737e8dc
--- /dev/null
+++ b/Build/source/libs/freetype/docs/porting.txt
@@ -0,0 +1,1078 @@
+
+
+ The FreeType Porting Guide
+
+ or
+
+ Everything you need to know to make FreeType
+ run on the weirdest system
+
+
+--------------------------------------------------------------------
+
+ Table of Contents
+
+
+ Introduction
+
+ I. General design and system modules
+
+ II. Memory component API
+
+ 1. The alloction function: TT_Alloc()
+ 2. The release function: TT_Free()
+ 3. The ALLOC() and ALLOC_ARRAY() macros
+ 4. The MEM_xxxx() macros
+
+ III. File component API
+
+ 1. Streams and their functions
+ 2. Frames and file access
+ 3. Differences in thread support levels
+
+ IV. Mutex component API
+
+ V. Summary & Advanced concepts
+
+ 1. Porting summary
+ 2. Exotic filesystems
+
+ VI. Troubleshooting
+
+ Conclusion
+
+
+--------------------------------------------------------------------
+
+Introduction
+============
+
+The FreeType engine is portable in many ways:
+
+- First, it can be compiled by any ANSI C compliant compiler, which
+ guarantees the widest possible uses.
+
+- Its default build uses a tiny fraction of the ANSI libc, mainly
+ for memory management and I/O access, which should be available on
+ most systems (i.e., malloc(), free(), fopen(), fread(), etc).
+
+- Its design is modular, and allows an implementer to remove all
+ dependencies on a particular runtime environment, to adapt the
+ engine to its specific needs. For example, it is possible to use
+ memory-mapped files on systems which support them.
+
+This document explains the engine's design, presenting the `system'
+modules that need to be changed by porters of the library, as well
+as how to do it.
+
+Note that this documentation is _very_ detailed, and you may
+DIRECTLY JUMP to SECTION V (Summary and advanced concepts) which
+gives you a QUICK STEP-BY-STEP GUIDE TO PORTING each component,
+without the need to understand all the guts of the TrueType engine.
+
+Several issues are discussed, including the use of exotic font
+storage conventions.
+
+
+--------------------------------------------------------------------
+
+
+I. General design, and system modules
+=====================================
+
+ The engine's design is intentionally highly modular. It is made
+ of several `components', each with its own specific goals. Three
+ of these play an important role with regards to portability. They
+ are:
+
+ - the memory component:
+
+ Found in the files `ttmemory.h' and `ttmemory.c'. It defines
+ several macros and a few functions used by _all_ other modules
+ to allocate, release, copy, and move memory blocks.
+
+ - the file component:
+
+ Found in the files `ttfile.h' and `ttfile.c'. It defines
+ several types and abstractions (streams, frames), that are used
+ by _all_ other modules to access font files.
+
+ - the mutex component:
+
+ This component compiles to a null object if the engine is built
+ in single-thread mode. Otherwise, for thread-safe and reentrant
+ builds, the macros and functions it defines are used by the rest
+ of the engine to protect shared variables.
+
+ NOTE:
+
+ Because the ANSI libc does not provide synchronisation
+ primitives (synchronisation isn't portable accross platforms),
+ the default implementation, found in `ttmutex.c', is made of
+ dummy functions which always return a successful error
+ condition.
+
+ You _need_ to re-define this component for your system if you
+ decide to make a thread-safe or reentrant build, even if you
+ use the ANSI libc.
+
+
+ When specializing a component, i.e., rewriting it for your
+ platform, you should respect a few conventions which are explained
+ in the following sections. Note also that the system-specific
+ implementations are usually placed in the
+ `freetype/lib/arch/<system>' directory. For example:
+
+ freetype/lib/arch/unix/ttmmap.c
+
+ A Unix-only implementation of ttfile which uses the
+ memory-mapped file API (this greatly improves the engine's
+ performance, due to the random access pattern typicals of
+ glyph data retrieval).
+
+ freetype/lib/arch/os2/os2file.c
+
+ This is an implementation of ttfile specific to OS/2, which
+ directly calls the system functions DosOpen(), DosRead(), etc.
+
+ The FreeType/2 DLL (a free TrueType font driver for OS/2) also
+ uses its own memory component which calls a special allocation
+ routine required in its runtime environment, and also provides
+ additional statistics that can be displayed by an auxiliary
+ tool while the driver is running in the system.
+
+We ask you to respect this directory convention. This really needs
+a minor Makefile change, and still having the ability to compile the
+`default' ttfile and ttmemory will help you debug your specific
+ports by easy comparisons.
+
+
+--------------------------------------------------------------------
+
+
+II. Memory component API
+========================
+
+ This section presents the macros and functions defined in
+ ttmemory.h, and how they should be implemented, if you decide to
+ rewrite the source file ttmemory.c from scratch. An easier
+ solution would be to replace the calls to malloc() and free() with
+ your own functions, though.
+
+
+1. Allocation routine : TT_Alloc()
+----------------------------------
+
+ This function is used to allocate blocks of memory, just like
+ malloc(), but defines a very different interface. Its prototype
+ is:
+
+ TT_Error TT_Alloc( long size, void** p );
+
+ [The FreeType source files use abstract data types like `Long' for
+ all internal functions and `TT_Long' for externally visible
+ structures. See tttypes.h and freetype.h, respectively.]
+
+ We can see that:
+
+ - The function returns an error code, and _not_ a pointer. The
+ reason for this is that your own implementation may perfectly
+ fail for more than one good reason. For example, it could
+ detect a corrupted heap, a memory exhaustion or an unusually
+ large block, and have a different error code for each of these
+ cases.
+
+ If a memory allocation error occurs in a FreeType function, it
+ is always taken into account (of course, for safety reasons),
+ but its code is directly sent to the caller. This means that
+ your own applications and font servers will be able to interpret
+ these errors and let you handle them appropriately.
+
+ - Its second argument is the _address_ of a typeless pointer.
+ This means the need to typecast it before calling this function.
+
+ The macro MEM_Alloc() is defined in ttmemory.h to do it for you,
+ as well as the `memory extraction' performed by the `&'
+ operator, so that you can write:
+
+ char* buffer;
+
+
+ MEM_Alloc( size, buffer );
+
+ instead of
+
+ TT_Alloc( size, (void**)&buffer );
+
+ Note that the engine _never_ uses this macro directly, but
+ ALLOC() instead (see below) in order to _always_ test the error
+ code.
+
+ *****************
+ *** IMPORTANT ***
+ *****************
+
+ - A newly allocated block should _always_ be filled with zeroes!
+ This is a _very_ strong convention used within all the engine.
+ It helps greatly to reduce code size, in general. If your
+ implementation of TT_Alloc() does not respect it, you are pretty
+ certain to build an unrunnable (at best) or (worse) instable
+ engine! Beware.
+
+
+2. Release routine: TT_Free()
+-----------------------------
+
+ This routine is naturally used to release any block created
+ through TT_Alloc(). Its prototype is:
+
+ TT_Error TT_Free( void** P );
+
+ We can see that:
+
+ - It also returns an error code. Note, however, that the error is
+ ignored in most, if not all, parts of the engine. This is
+ because freeing memory usually happens when all necessary work
+ has been finished, or when something already wrong happened.
+
+ - It takes the address of a typeless-pointer, and _not_ the
+ pointer's value itself. This is used to set the pointer's value
+ to NULL just after the block was released, which avoids dangling
+ references in objects. Of course, there is a macro defined to
+ simplify source writing. One can use FREE() like:
+
+ char* buffer;
+
+
+ MEM_Alloc( size, buffer );
+
+ .... work ....
+
+ FREE( buffer );
+
+ /* now `buffer' is set to NULL; the following line will */
+ /* seg-fault */
+
+ a = buffer[0];
+
+
+ *****************
+ *** IMPORTANT ***
+ *****************
+
+ - The function TT_Free() (and thus the macro FREE()) will accept a
+ NULL pointer successfully! This means more precisely that the
+ address of a pointer may have the value NULL; in this case it
+ will return with a successful error code (TT_Err_Ok == 0).
+
+ This convention is also _very_ strong in the engine, and
+ simplifies both code size and style. One of its primary origin
+ is the engine's object management which requires the ability to
+ release an object, be it normal or `partial', with the same
+ code.
+
+
+3. The ALLOC() and ALLOC_ARRAY() macros
+---------------------------------------
+
+ Two macros are also defined to make the FreeType source code
+ easier to read and understand. Their role is to perform an
+ allocation, while saving the error condition in an _implicit_
+ local variable called `error', and returning a boolean which is
+ set to true in case of error. Their definition is
+
+ #define ALLOC( pointer, size ) \
+ ( ( error = MEM_Alloc( pointer, size ) ) != TT_Err_Ok )
+
+ and
+
+ #define ALLOC_ARRAY( pointer, count, type ) \
+ ( ( error = MEM_Alloc( pointer, \
+ (count) * sizeof ( type ) ) ) \
+ != TT_Err_Ok )
+
+ They are always used in `if' statements, and can be chained
+ together. Here is some example code:
+
+ char* buffer1 = 0; /* temporary buffer 1 */
+ char* buffer2 = 0; /* temporary buffer 2 */
+ TT_Error error;
+
+
+ ...
+
+ if ( ALLOC_ARRAY( buffer1, n, TT_F26Dot6 ) ||
+ ALLOC_ARRAY( buffer2, n, short ) )
+ goto Fail;
+
+ ... work ...
+
+ Fail:
+ FREE( buffer2 );
+ FREE( buffer1 );
+ return error;
+
+
+ Notes:
+
+ - If an error occurs during the first allocation, execution will
+ jump immediately to the `Fail' label.
+
+ - The failure code, which releases the buffers, does not need to
+ differentiate whether the first allocation succeeded or not
+ (simply because FREE() accepts null pointers with no
+ problems).
+
+ The equivalent code, without macros, would be:
+
+ char* buffer1;
+ char* buffer2;
+ TT_Error error;
+
+
+ error = TT_Alloc( n * sizeof ( TT_F26Dot6 ),
+ (void**)&buffer1 );
+ if ( error ) goto Fail_Buffer1;
+
+ error = TT_Alloc( n * sizeof ( short ),
+ (void**)&buffer2 );
+ if ( error ) goto Fail_Buffer2;
+
+ .... work ....
+
+ Fail_Buffer2:
+ TT_Free( (void**)&buffer2 );
+
+ Fail_Buffer1:
+ TT_Free( (void**)&buffer1 );
+
+
+ Which is a lot less clear about its intents, and uses more special
+ cases.
+
+
+4. The MEM_xxxx() macros
+------------------------
+
+ Finally, three macros are defined to perform some common memory
+ block operations. Their names are rather explicative:
+
+ - MEM_Copy()
+
+ Used by the engine to copy one block of data in memory to
+ another one.
+
+ - MEM_Set()
+
+ Used to set all bytes of a block of memory to a given value.
+
+ - MEM_Move()
+
+ Well, guess what ;-)
+
+
+ These operations could have been embedded in functions like
+ TT_Mem_Copy(), TT_Mem_Set(), and TT_Mem_Move(), but a lot of
+ compilers are able to inline directly calls to such `intrinsic'
+ functions as memcpy() and memmove(). Hence, macros make sense
+ here.
+
+
+--------------------------------------------------------------------
+
+
+III. File Component API
+=======================
+
+ This section describes the file component's API, and the things
+ that are needed to port it to a specific system. Note that only a
+ fraction of the source code in `ttfile.c' needs to be rewritten
+ during a port.
+
+
+1. Streams and their functions
+------------------------------
+
+ A stream in FreeType (version 1.x) encapsulates both the
+ location/naming of a file, and its access. This is due to the
+ fact that they were originally designed to embed a simple ANSI
+ `FILE*' file pointer.
+
+ This means several things:
+
+ - A stream is created and opened via the TT_Open_Stream()
+ function. It takes, in the default build, a font pathname of
+ type `char*' that it uses when calling fopen().
+
+ - It can be released/closed via the function TT_Close_Stream().
+
+ - It embeds a `current file position', just like an ordinary file
+ descriptor. It is thus seekable, through the function
+ TT_Seek_File().
+
+ - Raw data can be extracted from a stream through TT_Read_File()
+ and TT_Read_At_File().
+
+ However, it has certain properties that differ from a libc `FILE*'
+ data type:
+
+ - Because each face object has its own stream, and because most
+ operating systems limit the number of opened system resources in
+ each process, it is more than helpful to be able to `flush' a
+ stream.
+
+ A stream is said to be flushed if the system resource it
+ contains (like a file descriptor) has been closed. However,
+ this resource is re-opened automatically when needed.
+
+ The function TT_Flush_Stream() is used to flush a stream. If a
+ stream has been flushed, it is also said to be `asleep'.
+
+ - The engine calls TT_Use_Stream() before each new stream access.
+ With it, the file component is able to awake (or `activate')
+ streams that are flushed, if needed.
+
+ - Consequently, the engine calls TT_Done_Stream() when it has
+ performed all I/O access. These two APIs (TT_Use_Stream() and
+ TT_Done_Stream()) let the file component track and manage the
+ engine's access patterns, and allows it to cache opened streams
+ more cleverly.
+
+ For example, one could implement an LRU list used to track the
+ `oldest' streams, and only activate the 10 `freshest' ones, thus
+ limiting the total number of system stream resources used by the
+ library, independently of the total number of opened faces in
+ the engine.
+
+
+2. Frames and file access
+-------------------------
+
+ In order to resolve endianess and alignment issues, the engine
+ uses the concept of `frames' to extract data from a TrueType
+ table.
+
+ - A frame is simply a sequence of successive bytes, taken from a
+ stream from its current position. A frame can only exist within
+ a stream.
+
+ - The function TT_Access_Frame() (ideally) reads its data and
+ places it into an intermediate buffer, which is later used for
+ parsing. This function also checks that the whole frame fits
+ into the original file. For example, it will return an error if
+ detecting `over-reads' in the file (which can happen if the font
+ file is broken).
+
+ Note that the intermediate buffer disappears in the case of
+ memory-mapped files.
+
+ - Each frame has an internal cursor, which is set to its buffer's
+ base by the previous function. Note, however, that it differs
+ from the stream's current position, which has been advanced once
+ TT_Acess_Frame() is completed.
+
+ - Data is extracted from the frame through calls to functions of
+ the form:
+
+ TT_Get_<IntegerType>();
+
+ where <IntegerType> can be any of: Byte (unsigned char), Char
+ (signed char), Short, UShort, Long, or ULong.
+
+ Each function returns the integer below the current frame
+ cursor, and advances the latter in the buffer.
+
+ - Finally, when the frame access ends, the engine calls the
+ TT_Forget_Frame() function, which will release the intermediate
+ buffer and set the cursor to NULL.
+
+ Here is a typical frame read sequence:
+
+ /* first - read the next 12-bytes frame in memory */
+ error = TT_Access_Frame( 12 );
+ if ( error )
+ return error;
+
+ /* now, extract all data */
+ object->field1 = TT_Get_Short();
+ object->field2 = TT_Get_Long();
+ object->field3 = TT_Get_Char();
+ object->filed4 = TT_Get_Long();
+ object->field5 = TT_Get_Byte();
+
+ /* done - now release the frame */
+ TT_Forget_Frame();
+
+ /* now perform some checks */
+ if ( object->field1 == -1 )
+ return Error_1;
+
+ if ( object->field2 > object->field4 )
+ return Error_2;
+
+
+ *****************
+ *** IMPORTANT ***
+ *****************
+
+ A few things need to be noticed by porters when they implement
+ frame loading (i.e. the TT_Access_Frame() function):
+
+ - The functions that need to be ported are TT_Access_Frame() and
+ TT_Forget_Frame(). The TT_Get_XXXX() functions should be left
+ as is.
+
+ - A frame has a state, and must _always_ be released through
+ TT_Forget_Frame() in case of an error. This means that the
+ engine will _never_ use code like the following:
+
+ error = TT_Access_Frame( 12 );
+ if ( error )
+ goto Fail;
+
+ object->field1 = TT_Get_Short();
+
+ /* now check error and return immediately -- */
+ /* WITHOUT RELEASING FRAME! ERROR! */
+ if ( object->field1 == -1 )
+ goto Fail;
+
+ object->field2 = TT_Get_Long();
+ object->field3 = TT_Get_Char();
+ object->field4 = TT_Get_Long();
+
+ /* check for error, return immediately -- */
+ /* WITHOUT RELEASING FRAME! ERROR! */
+ if ( object->field2 > object->field4 )
+ goto Fail;
+
+ /* now release frame */
+ TT_Forget_Frame();
+
+ This means more simply that EACH successful call to
+ TT_Access_Frame() will ALWAYS be followed by a call to
+ TT_Forget_Frame()!
+
+ - As a consequence of the first rule, and also in order to keep
+ things simple, NESTING FRAME ACCESSES are not allowed. For
+ example, the following code will produce an error:
+
+ /* First frame access */
+ error = TT_Access_Frame( 8 );
+ if ( error )
+ goto Fail;
+
+ /* read a file offset */
+ offset = TT_Get_Long();
+
+ /* seek and load another frame */
+ error = TT_File_Seek( stream, offset );
+ if ( error )
+ goto Fail;
+
+ error = TT_Access_Frame( 4 );
+ /* The function TT_Access_Frame detects nested calls */
+ /* and ALWAYS returns TT_Err_Nested_Frame_Access! */
+ if ( error )
+ goto Fail;
+
+ data1 = TT_Get_Long();
+
+ /* release second frame */
+ TT_Forget_Frame();
+
+ /* read next integer from the first frame */
+ data2 = TT_Get_Long();
+
+ /* release first frame */
+ TT_Forget_Frame();
+
+ This simplifies the work that needs to be done wen porting the
+ TT_Access_Frame() and TT_Forget_Frame() functions.
+
+
+3. Differences in thread support levels
+---------------------------------------
+
+ The FreeType library can be built to three distinct thread-support
+ levels. This section will present each other, and show how this
+ translates within the ttfile.c source code.
+
+ a. Levels
+
+ The three levels are
+
+ - single thread
+
+ No synchronization primitive is used to protect the data in
+ the file component. Hence, there is only one `current' stream
+ at any one time. Note, however, that in some cases, more than
+ one stream may be `active' (or `awakened'); e.g., when using
+ memory-mapped files, each opened face needs a valid mapping
+ before it can be used/parsed by the engine.
+
+ - thread-safe
+
+ The thread safe mode synchronizes concurrent accesses to the
+ renderer's component through mutexes. For the file component,
+ this means a single mutex which is `locked' by a call to
+ TT_Use_Stream(), and `released' by TT_Done_Stream().
+
+ As a consequence, there is only one possible `current' stream
+ when the engine reads files, like in the single thread case.
+
+ - re-entrant
+
+ In this mode, concurrent accesses are possible on many
+ components, including ttfile. This means that each
+ TT_Use_Stream() must _really_ create its own system/ANSI
+ stream for a single file, and that the file component _cannot_
+ have any state (only stream objects have!), like a `current
+ stream' and `current frame'.
+
+ This mode must use mutexes to protect all shared variables and
+ lists from concurrent changes/reads. The only component which
+ is still serialized in this mode is the scan-line converter
+ (a.k.a. ttraster).
+
+ b. Implementation differences
+
+ Because the TrueType engine serves more as a `font format
+ driver' than a general and high-level text-rendering library, it
+ has been decided to keep its code as simple and compact as
+ possible.
+
+ This implies some implementation differences between the three
+ thread modes, which are briefly explained below:
+
+ - Single-thread and thread-safe mode can have a state, which
+ means for ttfile.c, a `current stream' and `current frame'.
+
+ - In the reentrant mode, the `state' must be stored in a
+ thread-local place, which means the stack (or more simply
+ local function variables).
+
+ What follows is that some `ttfile' functions will not take the
+ same number of arguments depending on the thread-support mode.
+ Let us take the example of frame access and parsing:
+
+ In single-thread and thread-safe mode, the current frame is
+ automatically set by the TT_Access_Frame() function, which only
+ takes a `size' argument to determine the run of bytes to extract
+ from the _current_stream_ within ttfile's state.
+
+ Moreover, the TT_Get_XXXX() functions extract data from the
+ current frame, and need no arguments. A simple frame access
+ then looks like this:
+
+ /* read the next 12-bytes frame from the _current_stream_ */
+ error = TT_Access_Frame( 12 );
+ if ( error )
+ return error;
+
+ /* now, extract all data from the _current_frame_ */
+ object->field1 = TT_Get_Short();
+ object->field2 = TT_Get_Long();
+ object->field3 = TT_Get_Char();
+ object->filed4 = TT_Get_Long();
+ object->field5 = TT_Get_Byte();
+
+ /* done - now release the current frame */
+ TT_Forget_Frame();
+
+ In reentrant mode, things are a bit different. The current
+ stream and current frame must be passed as parameters, and the
+ code looks like this (notice the new function parameters!):
+
+
+ TT_Frame frame; /* define a local variable to handle */
+ /* the current frame */
+
+ .... /* we suppose we already have a stream variable */
+ .... /* named `stream' (how surprising ;-) */
+
+ /* read the next 12-bytes frame from a given stream */
+ error = TT_Access_Frame( stream, 12, &frame );
+ if ( error )
+ return error;
+
+ /* now, extract all data from the given frame */
+ object->field1 = TT_Get_Short( frame );
+ object->field2 = TT_Get_Long ( frame );
+ object->field3 = TT_Get_Char ( frame );
+ object->filed4 = TT_Get_Long ( frame );
+ object->field5 = TT_Get_Byte ( frame );
+
+ /* done - now release the current frame */
+ TT_Forget_Frame( frame );
+
+
+ The differences between these two schemes are striking. Though
+ an `easy' solution would have been to only write the engine in
+ reentrant-mode, it would have resulted in larger and slightly
+ slower code, as well as the source a bit more obscure about its
+ intents and thus harder to maintain. Also, the reentrant
+ version is only needed in rare cases and environments, and it
+ was not thought as a good idea to complexify _source_ code in
+ order to comply with rare uses.
+
+ The problem is solved within the engine by the use of a set of
+ carefully selected macros, which help generate both versions
+ from a _single_ source file.
+
+ Moreover, as the macros imitate the non-reentrant syntax (i.e.,
+ the use of the `stream' and `frame' parameters is implicit to
+ the macros), the source is kept clear and easy to understand,
+ even if compiled in re-entrant mode.
+
+ The code looks then like the following in the engine:
+
+ /* read the next 12-bytes frame from the current stream */
+ /* assignment of the error code in the local `error' */
+ /* variable is also implicit to the ACCESS_Frame macro, */
+ /* and its result is always a boolean (no ANSI warnings) */
+
+ if ( ACCESS_Frame( 12 ) )
+ goto Fail;
+
+ /* Now, extract all data from the current frame. */
+ /* The macros GET_xxxxx use an implicit local `frame' */
+ /* variable in reentrant mode. */
+
+ object->field1 = GET_Short();
+ object->field2 = GET_Long();
+ object->field3 = GET_Char();
+ object->filed4 = GET_Long();
+ object->field5 = GET_Byte();
+
+ /* done - now release the current frame */
+
+ FORGET_Frame();
+
+ Another advantage of the above code is its `expressiveness' in
+ the sense that it really describes what is happening during the
+ frame load, hiding the boring but necessary details required by
+ error checking and reentrancy. And if the error checks are
+ within the macros, we are sure we won't forget them because they
+ are `too boring to code' (one of the reason why `exceptions'
+ caught so quickly in C++ and Java).
+
+ c. Consequences on ttfile
+
+ Of course, the macros only hide real differences in
+ implementation which must be reflected in ttfile.h and ttfile.c.
+ In order to ease this task, some other macros are used, which
+ use is reserved for these two files. There are:
+
+ STREAM_ARG
+ STREAM_ARGS
+ FRAME_ARG
+ FRAME_ARGS in ttfile.h
+
+ CUR_Stream
+ STREAM_VAR
+ STREAM_VARS
+ FRAME_VAR
+ FRAME_VARS in ttfile.c
+
+ All of these macros (with the exception of CUR_Stream) default
+ to nothing (i.e. a void macro) in single-thread and re-entrant
+ mode, which only differ from the use of a mutex lock and release
+ in the functions TT_Use_Stream() and TT_Done_Stream().
+ CUR_Stream defaults to the file component's current stream,
+ found in its internal state (as you can guess, it designates the
+ `current stream').
+
+ On the opposite, the macros are used to define additional
+ function parameters (if a function is called) and arguments (if
+ calling in a function). For example, the following (fictional)
+ code:
+
+ /* return the size of a given stream */
+ long Stream_Size( STREAM_ARG )
+ {
+ return CUR_Stream.size;
+ }
+
+ expands to:
+
+ long Stream_Size()
+ {
+ return file_component.current_stream.size;
+ }
+
+ in non-reentrant mode, and to:
+
+ long Stream_Size( TT_Stream stream )
+ {
+ return (*stream).size;
+ }
+
+ otherwise.
+
+ Thus, we can see the following reentrant expansions:
+
+ STREAM_ARG --> TT_Stream stream
+ STREAM_ARGS --> TT_Stream stream, (note the comma)
+
+ FRAME_ARG --> TT_Frame frame
+ FRAME_ARGS --> TT_Frame frame, (note the comma)
+
+ STREAM_VAR --> stream
+ STREAM_VARS --> stream,
+
+ FRAME_VAR --> frame
+ FRAME_VARS --> frame,
+
+ They follow these simple rules:
+
+ - An XXXX_ARG is used to define a single optional parameter in
+ a function _prototype_. The parameter is said to be single
+ if it is not followed by anything, e.g.
+
+ long Stream_Size( STREAM_ARG )
+
+ - An XXXX_ARGS is the same, followed by a comma, in order to
+ place other (non-optional) parameters behind, e.g.
+
+ TT_Error Stream_Seek( STREAM_ARGS long pos )
+
+ - An XXXX_VAR is used, _only_ within ttfile.c, to _call_ a
+ function having an XXXX_ARG or XXXX_ARGS in its prototype
+ resp. declaration.
+
+ long Stream_Left( STREAM_ARG )
+ {
+ return ( Stream_Size( STREAM_VAR ) -
+ Stream_Pos( STREAM_VAR ) );
+ }
+
+ - An XXXX_VARS is the same, but can be followed by non-optional
+ parameters.
+
+ The macros allow you to write some code independently of the
+ thread level within ttfile.c.
+
+ *****************
+ *** IMPORTANT ***
+ *****************
+
+ In general, porters should not be concerned about the use of
+ these macros. One easy way to port is to take the ANSI code in
+ ttfile.c and modify only the parts that really access the system
+ (like fopen(), fread(), fseek(), etc).
+
+ These details are explained here to make you understand how the
+ code works, in case you are interested in more elaborate ports.
+
+
+--------------------------------------------------------------------
+
+
+IV. Mutex Component API
+=======================
+
+ As said before, the default library source code uses the ANSI libc
+ only, and the source code in ttmutex.c only contains dummy
+ functions which return a successful error condition in all cases.
+
+ You thus NEED to specialize it in order to successfully use a
+ thread-safe or reentrant build. Here is explained what is really
+ important:
+
+
+1. The TMutex type
+------------------
+
+ The engine uses the `TMutex' type defined in ttmutex.h to handle
+ mutexes. It is only a typedef of a `void*' and should be kept
+ that way for the fastest porting.
+
+ Your job will most probably be to store a system mutex/semaphore
+ handle or pointer in it.
+
+
+2. The mutex macros and functions
+---------------------------------
+
+ The interface file ttmutex.h defines several macros that are used
+ within the engine to protect all shared variables (like lists)
+ from concurrent accesses. All macros default to `void' (nothing)
+ in single thread mode, and to calls to the TT_Mutex_XXXX()
+ functions in multi-threaded modes.
+
+ These functions are:
+
+ o TT_Mutex_Create()
+
+ Takes a TMutex address as an argument. It should place a NULL
+ pointer in this output variable in case of failure.
+
+ o TT_Mutex_Lock()
+
+ It also takes the address of a TMutex as an argument. Used to
+ lock the mutex/semaphore, of course.
+
+ o TT_Mutex_Release()
+
+ Guess what ;-) Same interface.
+
+ o TT_Mutex_Delete()
+
+ Destroys a mutex/semaphore.
+
+
+3. Redefining the TMutex type
+-----------------------------
+
+ You can also get rid of the TT_Mutex_xxxx() functions if you want
+ to use your system's synchronization API. This can be done in two
+ simple steps:
+
+ a. Redefine the TMutex type to suit your system's handle types.
+
+ b. Redefine the MUTEX_xxxx() macros in order to call directly your
+ API in the case of multi-threaded builds.
+
+ Both methods (specializing the TT_Mutex_xxx() functions or
+ redefining the macros) are possible.
+
+
+--------------------------------------------------------------------------
+
+
+V. Summary and Advanced Concepts
+================================
+
+1. Quick step-by-step guide to porting the system components
+------------------------------------------------------------
+
+ a. Port the memory component
+
+ o Look at the `ttmemory.h' file and change the macros
+ MEM_Copy(), MEM_Move(), and MEM_Set() to reflect your system's
+ API providing the equivalent functionality. The reason that
+ macros instead of functions are used there is that many
+ compilers are able to inline directly these functions within
+ your code.
+
+ o Look at the `ttmemory.c' file. Replace the single malloc()
+ call with your own allocation routine, and the single free()
+ with your own release routine. If your allocator uses more
+ sophisticated functions, you will probably have to rewrite
+ more parts of this file. See section I above.
+
+ b. Port the mutex component
+
+ o Look at the file `ttmutex.c' and specialize each routine to
+ have it use your system's synchronization API.
+
+ o For a more advanced port, you can also directly redefine the
+ definition of the TMutex type in ttmutex.h, as well as the
+ macro definitions (like MUTEX_Create(), MUTEX_Lock(), etc.) to
+ use directly your system's API. The TT_Mutex_xxxx() will not
+ be necessary then.
+
+ c. Port the file component
+
+ o For a quick port, look at the following functions and replace
+ the ANSI libc calls (like fopen(), fclose(), fread(), etc.):
+
+ Stream_Activate(), Stream_Deactivate(), TT_Open_Stream(),
+ TT_Done_Stream(), TT_Seek_File(), TT_Skip_File(),
+ TT_Read_File(), TT_File_Pos()
+
+ o If you plan to use memory-mapped files, you can have a look at
+ the Unix file component found in
+ `freetype/lib/arch/unix/ttmmap.c'. It should give you an
+ indication of what to do.
+
+
+2. Exotic file systems and font resources
+-----------------------------------------
+
+ a. Other file naming conventions
+
+ The high-level library uses the `TT_Text*' type to define the
+ type of characters used for a font file's pathname. By default,
+ it equals to the `char*' type, which allow you to open a face
+ object with the following call:
+
+ error = TT_Open_Face( engine, "c:\fonts\times.ttf", &face );
+
+ The implementation of TT_Open_Face() passes directly the
+ pathname pointer to the internal TT_Open_Stream() function,
+ located in the file component, which really opens the file.
+
+ Some filesystems use different naming conventions, like UTF-16
+ code, where each character is coded in 16 bits. In order to
+ help them to use FreeType, all you need to do is the following:
+
+ - Define the macro HAVE_TT_TEXT.
+
+ - Define the type `TT_Text' to the character type you need, like
+ 'wchar_t' for Unicode.
+
+ Note that this should apply when compiling the FreeType library,
+ as well as WHEN INCLUDING THE FILE `freetype.h' IN YOUR
+ APPLICATIONS.
+
+ If the configuration macro HAVE_TT_TEXT is not defined, the file
+ `freetype.h' defines TT_Text as `char*'. You can read its
+ source code to see it more explicitly (look at the very first
+ lines of the code).
+
+ You can also use TT_Text as a pointer to more specific files,
+ like a simple memory address when the font is located in ROM,
+ etc.
+
+ Just synchronize the definition of TT_Text with the
+ implementation in ttfile.c!
+
+ b. Font Resources
+
+ FreeType 2.0 will feature many architectural changes that will
+ help make porting easier, especially with regards of the file
+ component.
+
+ To do this, it will separate the concepts of a `font resource',
+ i.e. a file seen as a storage, from a `font stream', i.e. a
+ file seen as a stream of data. Only the resource related code
+ will be visible to porters, and it will be much easier to port
+ (for example, nearly all thread-support levels issues will be
+ treated internally in the rest of the engine, and will be
+ invisible to the resource component).
+
+ We are sorry for the current design and state, but TT_Stream
+ started as a simple encapsulation of an ANSI FILE* variable,
+ before font-specific access patterns made them become what they
+ now are.
+
+ FreeType 2.0 will be a good reason to re-design I/O access more
+ clearly, and fortunately with more power and flexibility (like
+ using easily files of different type, ROM-based, memory-mapped,
+ disk-based, in a single engine).
+
+ However, all of this does not mean than the current design
+ does not work. It does, so do not hesitate to use it :-)
+
+
+--------------------------------------------------------------------
+
+
+VI. Troubleshooting
+===================
+
+ To be written.
+
+
+--------------------------------------------------------------------
+
+
+Conclusion
+==========
+
+ To be written.
+
+
+--- end of porting.txt ---
diff --git a/Build/source/libs/freetype/docs/raster.txt b/Build/source/libs/freetype/docs/raster.txt
new file mode 100644
index 00000000000..34d05eb311d
--- /dev/null
+++ b/Build/source/libs/freetype/docs/raster.txt
@@ -0,0 +1,577 @@
+This file is an attempt at explaining the internals of the FreeType
+rasterizer. This component is quite general purpose and could
+easily be integrated into other programs (but still under the
+current license).
+
+--------------------------------------------------------------------
+
+ The HOWs and WHYs of the FreeType rasterizer
+
+ by David Turner
+
+
+ I. Introduction
+
+ II. Rendering Technology
+
+III. Implementation Details
+
+ IV. Gray-Level Support
+
+
+
+I. Introduction
+===============
+
+ A rasterizer is a library in charge of converting a vectorial
+ representation of a shape into a bitmap. The FreeType rasterizer
+ has been developed to render the glyphs found in TrueType files,
+ made up of segments and second-order Beziers. This document is an
+ explanation of its design and implementation.
+
+ Though these explanations start from the basics, a knowledge of
+ common rasterization techniques is assumed.
+
+
+--------------------------------------------------------------------
+
+
+II. Rendering Technology
+========================
+
+1. Requirements
+---------------
+
+ We will assume that all scaling/rotating/hinting/whatever has been
+ already done. The glyph is thus described, as in the TrueType
+ specification, by a list of points. Each point has an x and y
+ coordinate, as well as a flag that indicates whether the point is
+ _on_ or _off_ the curve.
+
+ More precisely:
+
+ - All point coordinates are in the 26.6 fixed float format as
+ defined by the specification. The orientation used is:
+
+ ^ y
+ | reference orientation
+ |
+ *----> x
+ 0
+
+ This means that the `distance' between two neighbouring pixels
+ is 64 `units' (1 unit = 1/64th of a pixel).
+
+ Note that, for the rasterizer, pixel centers are located at
+ integer coordinates, i.e., (0.0, 0.0) is the coordinate of the
+ origin's center (unlike what happens within the TrueType
+ bytecode interpreter where this point's center lies at (0.5,
+ 0.5)).
+
+ A pixel line in the target bitmap is called a `scanline'.
+
+ - A glyph is usually made of several contours, also called
+ outlines. A contour is simply a closed curve that delimits an
+ outer or inner region of the glyph. It is described by a series
+ of successive points of the points table.
+
+ Each point of the glyph has an associated flag that indicates
+ whether it is `on' or `off' the curve. Two successive `on'
+ points indicate a line segment joining the two points.
+
+ One `off' point amidst two `on' points indicates a second degree
+ Bezier parametric arc, defined by these three points (the `off'
+ point being the control point, and the `on' ones the start and
+ end points).
+
+ Finally, two successive `off' points forces the rasterizer to
+ create, during rendering, an `on' point amidst them, at their
+ exact middle. This greatly facilitates the definition of
+ successive Bezier arcs.
+
+ * # on curve
+ * off curve
+ __---__
+ #-__ _-- -_
+ --__ _- -
+ --__ # \
+ --__ #
+ -#
+ Two `on' points
+ Two `on' points and one `off' point
+ between them
+
+ *
+ # __ Two `on' points with two `off'
+ \ - - points between them. The point
+ \ / \ marked `0' is the middle of the
+ - 0 \ `off' points, and is a `virtual
+ -_ _- # on' point where the curve passes.
+ -- It does not appear in the point
+ * list.
+
+
+ The FreeType rasterizer, as intended to render TrueType glyphs,
+ does not support third order Beziers, usually found in Type 1
+ fonts. Type 1 support may lead to further development of the
+ engine (it is already part of FreeType 2.0).
+
+ The parametric form of a second-order Bezier is:
+
+ P(t) = (1-t)^2*P1 + 2*t*(1-t)*P2 + t^2*P3
+
+ with t a real number in the range [0..1]
+
+ P1 and P3 are the endpoints, P2 the control point.
+
+ Note that the rasterizer does not use this formula. It exhibits,
+ however, one very useful property of Bezier arcs: Each point of
+ the curve is a weighted average of the control points.
+
+ As all weights are positive and always sum up to 1, whatever the
+ value of t, each arc point lies within the triangle defined by the
+ arc's three control points.
+
+
+2. Profiles and Spans
+---------------------
+
+ The following is a basic explanation of the _kind_ of computations
+ made by the rasterizer to build a bitmap from a vector
+ representation. Note that the actual implementation is slightly
+ different, due to performance tuning and other factors.
+
+ However, the following ideas remain in the same category, and are
+ more convenient to understand.
+
+ a. Sweeping the shape
+
+ The best way to fill a shape is to decompose it into a number of
+ simple horizontal segments, then turn them on in the target
+ bitmap. These segments are called `spans'.
+
+ __---__
+ _-- -_
+ _- -
+ - \
+ / \
+ / \
+ | \
+
+ __---__ Example: filling a shape
+ _----------_ with spans.
+ _--------------
+ ----------------\
+ /-----------------\ This is typically done from the top
+ / \ to the bottom of the shape, in a
+ | | \ movement called a `sweep".
+ V
+
+ __---__
+ _----------_
+ _--------------
+ ----------------\
+ /-----------------\
+ /-------------------\
+ |---------------------\
+
+
+ In order to draw a span, the rasterizer must compute its
+ coordinates, which are simply the shape's contours'
+ x-coordinates taken on the y-scanlines.
+
+
+ /---/ |---| Note that there are usually
+ /---/ |---| several spans per scanline.
+ | /---/ |---|
+ | /---/_______|---| When rendering this shape to the
+ V /----------------| current scanline y, we must
+ /-----------------| compute the x values of the
+ a /----| |---| points a, b, c, and d.
+ - - - * * - - - - * * - - y -
+ / / b c| |d
+
+
+ /---/ |---|
+ /---/ |---| And then turn on the spans a-b
+ /---/ |---| and c-d.
+ /---/_______|---|
+ /----------------|
+ /-----------------|
+ a /----| |---|
+ - - - ####### - - - - ##### - - y -
+ / / b c| |d
+
+ b. Decomposing outlines into profiles
+
+ For each scanline during the sweep, we need the following
+ information:
+
+ o The number of spans on the current scanline, given by the
+ number of shape points intersecting the scanline (these are
+ the points a, b, c, and d in the above example).
+
+ o The x coordinates of these points.
+
+ These are computed before the sweep, in a phase called
+ `decomposition' which converts the glyph into *profiles*.
+
+ Put it simply, a `profile' is a contour's portion that can only
+ be either ascending or descending, i.e., it is monotonic in the
+ vertical direction (we will also say y-monotonic). There is no
+ such thing as a horizontal profile, as we shall see.
+
+ Here are a few examples:
+
+
+ this square
+ 1 2
+ ---->---- is made of two
+ | | | |
+ | | profiles | |
+ ^ v ^ + v
+ | | | |
+ | | | |
+ ----<----
+
+ up down
+
+
+ this triangle
+
+ P2 1 2
+
+ |\ is made of two | \
+ ^ | \ \ | \
+ | | \ \ profiles | \ |
+ | | \ v ^ | \ |
+ | \ | | + \ v
+ | \ | | \
+ P1 ---___ \ ---___ \
+ ---_\ ---_ \
+ <--__ P3 up down
+
+
+
+ A more general contour can be made of more than two profiles:
+
+ __ ^
+ / | / ___ / |
+ / | / | / | / |
+ | | / / => | v / /
+ | | | | | | ^ |
+ ^ | |___| | | ^ + | + | + v
+ | | | v | |
+ | | | up |
+ |___________| | down |
+
+ <-- up down
+
+
+ Successive profiles are always joined by horizontal segments
+ that are not part of the profiles themselves.
+
+ Note that for the rasterizer, a profile is simply an *array*
+ that associates one horizontal *pixel* coordinate to each bitmap
+ *scanline* crossed by the contour's section containing the
+ profile. Note also that profiles are *oriented* up or down
+ along the glyph's original flow orientation.
+
+ In other graphics libraries, profiles are also called `edges' or
+ `edgelists'.
+
+ c. The Render Pool
+
+ FreeType has been designed to be able to run well on _very_
+ light systems, including embedded systems with very few memory.
+
+ A render pool will be allocated once; the rasterizer uses this
+ pool for all its needs by managing this memory directly in it.
+ The algorithms that are used for profile computation make it
+ possible to use the pool as a simple growing heap. This means
+ that this memory management is actually easy, and faster than
+ any kind of malloc()/free() combination.
+
+ Moreover, we'll see later that the rasterizer is able, when
+ dealing with profiles too large and numerous to lie all at once
+ in the render pool, to immediately decompose recursively the
+ rendering process into independent sub-tasks, each taking less
+ memory to be performed (see `sub-banding' below).
+
+ The render pool doesn't need to be large. A 4kByte pool is
+ enough for nearly all renditions, though nearly 100% slower than
+ a more confortable 16 or 32kByte pool (that was tested with
+ complex glyphs at sizes over 500 pixels).
+
+ d. Computing Profiles Extents
+
+ Remember that a profile is an array, associating a _scanline_ to
+ the x pixel coordinate of its intersection with a contour.
+
+ Though it's not exactly how the FreeType rasterizer works, it is
+ convenient to think that we need a profile's height before
+ allocating it in the pool and computing its coordinates.
+
+ The profile's height is the number of scanlines crossed by the
+ y-monotonic section of a contour. We thus need to compute these
+ sections from the vectorial description. In order to do that,
+ we are obliged to compute all (local and global) y-extrema of
+ the glyph (minima and maxima).
+
+
+ P2 For instance, this triangle has only
+ two y-extrema, which are simply
+ |\
+ | \ P2.y as an y-maximum
+ | \ P3.y as an y-minimum
+ | \
+ | \ P1.y is not an y-extremum (though it is
+ | \ a x-minimum, which we don't need).
+ P1 ---___ \
+ ---_\
+ P3
+
+ Note that the extrema are expressed in pixel units, not in
+ scanlines. The triangle's height is certainly (P3.y-P2.y+1)
+ pixel units, but its profiles' heights are computed in
+ scanlines. The exact conversion is simply:
+
+ - min scanline = FLOOR ( min y )
+ - max scanline = CEILING( max y )
+
+ A problem arises with Bezier Arcs. While a segment is always
+ necessarily y-monotonic (i.e., flat, ascending, or descending),
+ which makes extrema computations easy, the ascent of an arc can
+ vary between its control points.
+
+ P2
+ *
+ # on curve
+ * off curve
+ __-x--_
+ _-- -_
+ P1 _- - A non y-monotonic Bezier arc.
+ # \
+ - The arc goes from P1 to P3.
+ \
+ \ P3
+ #
+
+ We first need to be able to easily detect non-monotonic arcs,
+ according to their control points. I will state here, without
+ proof, that the monotony condition can be expressed as:
+
+ P1.y <= P2.y <= P3.y for an ever-ascending arc
+
+ P1.y >= P2.y >= P3.y for an ever-descending arc
+
+ with the special case of
+
+ P1.y = P2.y = P3.y where the arc is said to be `flat'.
+
+ As you can see, these conditions can be very easily tested.
+ They are, however, extremely important, as any arc that does not
+ satisfy them necessarily contains an extremum.
+
+ Note also that a monotonic arc can contain an extremum too,
+ which is then one of its `on' points:
+
+ P1 P2
+ #---__ * P1P2P3 is ever-descending, but P1
+ -_ is an y-extremum.
+ -
+ ---_ \
+ -> \
+ \ P3
+ #
+
+ Let's go back to our previous example:
+
+ P2
+ *
+ # on curve
+ * off curve
+ __-x--_
+ _-- -_
+ P1 _- - A non-y-monotonic Bezier arc.
+ # \
+ - Here we have
+ \ P2.y >= P1.y &&
+ \ P3 P2.y >= P3.y (!)
+ #
+
+ We need to compute the y-maximum of this arc to be able to
+ compute a profile's height (the point marked by an `x'). The
+ arc's equation indicates that a direct computation is possible,
+ but we'll rely on a different technique, which use will become
+ apparent a bit later.
+
+ Bezier arcs have the special property of being very easily
+ decomposed into two other sub-arcs, which are themselves Beziers
+ arcs. Moreover, it is easy to prove that there is at most one
+ y-extremum on each Bezier arc (for second degree ones).
+
+ For instance, the following arc P1P2P3 can be decomposed into
+ two sub-arcs Q1Q2Q3 and R1R2R3 that look like:
+
+ P2
+ *
+ # on curve
+ * off curve
+
+
+ Original Bezier Arc P1P2P3.
+ __---__
+ _-- --_
+ _- -_
+ - -
+ / \
+ / \
+ # #
+ P1 P3
+
+
+
+
+ P2
+ *
+
+
+
+ Q3 Decomposed into two subarcs
+ Q2 R2 Q1Q2Q3 and R1R2R3
+ * __-#-__ *
+ _-- --_
+ _- R1 -_ Q1 = P1 R3 = P3
+ - - Q2 = (P1+P2)/2 R2 = (P2+P3)/2
+ / \
+ / \ Q3 = R1 = (Q2+R2)/2
+ # #
+ Q1 R3 Note that Q2, R2, and Q3=R1
+ are on a single line which is
+ tangent to the curve.
+
+ We have then decomposed a non-y-monotonic bezier into two
+ smaller sub-arcs. Note that in the above drawing, both sub-arcs
+ are monotonic, and that the extremum is then Q3=R1. However, in
+ a more general case, only one sub-arc is guaranteed to be
+ monotonic. Getting back to our former example:
+
+ Q2
+ *
+
+ __-x--_ R1
+ _-- #_
+ Q1 _- Q3 - R2
+ # \ *
+ -
+ \
+ \ R3
+ #
+
+ Here, we see that, though Q1Q2Q3 is still non-monotonic, R1R2R3
+ is ever descending: we thus know that it doesn't contain the
+ extremum. We can then re-subdivide Q1Q2Q3 into two sub-arcs and
+ go on recursively, stopping when we encounter two monotonic
+ subarcs, or when the subarcs become simply too small.
+
+ We will finally find the y-extremum. Note that the iterative
+ process of finding an extremum is called `flattening'.
+
+ e. Computing Profiles coordinates
+
+ Once we have the height of each profile, we are able to allocate
+ it in the render pool. We now have to compute its coordinate
+ for each scanline.
+
+ In the case of segments, the computation is straightforward, and
+ uses good old Euclide (also known as Bresenham ;-). However,
+ for Bezier arcs, things get a little more complicated.
+
+ We assume that all Beziers that are part of a profile are the
+ result of `flattening' the curve, which means that they are all
+ y-monotonic (ascending or descending, and never flat). We now
+ have to compute the arcs' intersections with the profile's
+ scanlines. One way is to use a similar scheme to `flattening',
+ called `stepping'.
+
+ Consider this arc, going from P1 to
+ --------------------- P3. Suppose that we need to
+ compute its intersections with the
+ drawn scanlines. Again, this is
+ --------------------- feasible directly, if we dare
+ to compute one square root per
+ * P2 _---# P3 scanline (how great!).
+ ------------- _-- --
+ _-
+ _/ Rather, it is still possible to use
+ ---------/----------- the decomposition property in the
+ / same recursive way, i.e. subdivide
+ | the arc into subarcs until these
+ ------|-------------- get too small to cross more than
+ | one scanline!
+ |
+ -----|--------------- This is very easily done using a
+ | rasterizer-managed stack of
+ | subarcs.
+ # P1
+
+ f. Sweeping and Sorting the spans
+
+ Once all our profiles have been computed, we begin the sweep to
+ build (and fill) the spans.
+
+ As the TrueType specification uses the winding fill rule, we
+ place on each scanline the profiles present in two separate
+ lists.
+
+ One list, called the `left' one, only contains ascending
+ profiles, while the other `right' list contains the descending
+ profiles.
+
+ As each glyph is made of closed curves, a simple geometric
+ property is that the two lists necessarily contain the same
+ number of elements.
+
+ Creating spans is there straightforward:
+
+ 1. We sort each list in increasing x order.
+
+ 2. We pair each value of the left list, with its corresponding
+ value in the right one.
+
+
+ / / | | For example, we have here
+ / / | | four profiles. Two of
+ >/ / | | | them are ascending (1 &
+ 1// / ^ | | | 2 3), while the two others
+ // // 3| | | v are descending (2 & 4).
+ / //4 | | | On the given scanline,
+ a / /< | | the left list is (1,3),
+ - - - *-----* - - - - *---* - - y - and the right one is
+ / / b c| |d (4,2) (sorted).
+
+ There are then two spans, joining
+ 1 to 4 (i.e. a-b) and 3 to 2
+ (i.e. c-d)!
+
+ Sorting doesn't necessarily take much time, as in 99 cases out
+ of 100, the lists' order is kept from one scanline to the next.
+ We can thus implement it with two simple singly-linked lists,
+ sorted by a classic bubble-sort, which takes a minimum amount of
+ time when the lists are already sorted.
+
+ A previous version of the rasterizer used more elaborate
+ structures, like arrays to perform `faster' sorting. It turned
+ out that this old scheme is not faster than the one described
+ above.
+
+ Once the spans have been `created', we can simply draw them in
+ the target bitmap.
+
+ g. Drop-out control
+
+ To be continued.
+
+
+--- end of raster.txt ---
diff --git a/Build/source/libs/freetype/docs/readme.txt b/Build/source/libs/freetype/docs/readme.txt
new file mode 100644
index 00000000000..ff3db7176ed
--- /dev/null
+++ b/Build/source/libs/freetype/docs/readme.txt
@@ -0,0 +1,106 @@
+Welcome to the documentation directory of FreeType.
+
+Here are short overview where you can find which information.
+
+
+ apiref.txt FreeType high-level API reference. All the types,
+ functions, and error codes of FreeType.
+
+ ..................................................................
+
+ apirefx.txt The API reference of FreeType extensions which come
+ with the library itself.
+
+ ..................................................................
+
+ bitmaps.txt How to render a glyph outline into a bitmap.
+
+ ..................................................................
+
+ changes.txt Guess what :-)
+
+ ..................................................................
+
+ convntns.txt The FreeType developer's conventions guide. Lists
+ the design and coding conventions used in the
+ engine's source code. This file is incomplete but
+ contains information that should be read by any
+ person willing to hack the FreeType code.
+
+ ..................................................................
+
+ credits A list of persons who have contributed to FreeType.
+
+ ..................................................................
+
+ glyphs.htm An introduction to glyphs in general, its usage in
+ glyphs.txt TrueType, and how FreeType handles them. The file
+ `glyphs.txt' is a simple text dump (done with
+ Netscape) of glyphs.htm.
+
+ ..................................................................
+
+ i18n.txt A short introduction to the GNU gettext package.
+
+ ..................................................................
+
+ porting.txt The FreeType porting guide. All you need to
+ configure and adapt very easily FreeType's source
+ code to tailor it to your own platform.
+
+ Learn how to provide your own memory, i/o, and mutex
+ components, optimally fitted to your system. See
+ how you can build a singly-threaded, thread-safe, or
+ re-entrant version of the engine from the same
+ source code!
+
+ ..................................................................
+
+ raster.txt The scan-line converter's internals explained. The
+ document is still incomplete but presents many key
+ concepts.
+
+ ..................................................................
+
+ threads.txt How to use threads with FreeType.
+
+ ..................................................................
+
+ user.txt FreeType's user guide. A guide to FreeType's
+ concepts, a step by step example, and a note about
+ future works and projects.
+
+ ..................................................................
+
+ FAQ The new up-to-date FreeType FAQ. Look here first if
+ you have problems with the library.
+
+ ..................................................................
+
+ TODO Things which probably will come, which would be nice
+ to have, problems still here, etc.
+
+
+
+These documents were scheduled, but will probably never come...
+
+ develop.txt The FreeType developer's guide. All you need to know
+ in order to be able to understand and even hack the
+ engine's core source code.
+
+ extend.txt The FreeType extension writer's how-to. All you need
+ to be able to provide new extensions to the engine.
+
+ undoc.txt Undocumented TrueType!
+
+ Yes, ladies and gentlemen, the TrueType
+ specification is fuzzy and misleading enough to
+ disband some serious commercial developers, but that
+ wasn't enough for us. Even though it took some time
+ (aaargh...), we finally discovered through hard work
+ the real meanings of the specs, fixed some errors
+ and even found surprising undocumented behaviour or
+ features!
+
+
+--- end of readme.txt ---
diff --git a/Build/source/libs/freetype/docs/threads.txt b/Build/source/libs/freetype/docs/threads.txt
new file mode 100644
index 00000000000..6e157fa3e1a
--- /dev/null
+++ b/Build/source/libs/freetype/docs/threads.txt
@@ -0,0 +1,117 @@
+Threads with FreeType
+=====================
+
+
+The FreeType engine can now be compiled in thread-safe mode.
+Because we want to keep the engine small and fast, the thread
+protection is simple. This file gives an overview of what you can
+do, and what you should strictly never do.
+
+
+How to enable thread-safe support?
+
+A. You must have a valid replacement for the file `lib/ttmutex.c'
+ which calls your system's API to create, lock, and release
+ mutexes or semaphores. The current implementation is a dummy and
+ doesn't do anything.
+
+B. You must re-define the configuration macro
+ TT_CONFIG_OPTION_THREAD_SAFE located in `ttconfig.h'. Then
+ recompile.
+
+
+IMPORTANT NOTE:
+
+ If two threads create and use their own TT_Engine structure, they
+ can freely call the library concurrently on each of them (as well
+ as all their related objects), even in the non-threaded build.
+ The following remarks only apply to concurrent requests performed
+ on a single TT_Engine shared by multiple threads.
+
+
+--------------------------------------------------------------------
+
+- What you can do:
+
+ With the exceptions listed below (in `What you can't do'), you can
+ call all API functions concurrently with two different threads.
+ This includes:
+
+ Creating two or more faces from the same engine (i.e. concurrent
+ calls to TT_Open_Face()/TT_Open_Collection()).
+
+ Creating two or more instances from the same face object
+ (i.e. concurrent calls to TT_New_Instance()).
+
+ Creating two or more glyph containers from the same face object
+ (i.e. concurrent calls to TT_New_Glyph()).
+
+ The same holds for destruction of objects.
+
+ Load two or more glyphs concurrently for the same face or
+ instance (i.e. concurrent TT_Load_Glyph() calls).
+
+ Render two or more glyphs at the same time, in the same engine
+ (i.e. calling TT_Get_Glyph_Bitmap()/TT_Get_Glyph_Pixmap() or
+ TT_Get_Outline_Bitmap()/TT_GetOutline_Pixmap() concurrently).
+
+ NOTE: The scan-line converter can only render one glyph at a
+ time, for a given TT_Engine. Concurrent calls are
+ synchronized through a mutex, though.
+
+ If you really, _really_, need to generate bitmaps or
+ pixmaps concurrently, create an additional engine and use
+ it with TT_Get_Outline_Bitmap()/TT_Get_Outline_Pixmap()
+ (you don't need to create any object in it, the outline
+ can come from any source too).
+
+ This is, however, not recommended (it works perfectly, but
+ this could change in the future for various technical
+ reasons).
+
+
+---------------------------------------------------------------------------
+
+- What you cannot do:
+
+ - You shouldn't try to delete an object while still using it with
+ another thread. The engine doesn't protect you from stupidity!
+ For example, these concurrent calls:
+
+ TT_Close_Face( face );
+ TT_Get_Glyph_Bitmap( glyph, &bitmap );
+
+ will act unexpectedly if the glyph is a child of the face (i.e.,
+ was created with TT_New_Glyph( face, &glyph ))
+ ^^^^
+ same face
+
+ Here are some other examples:
+
+ TT_Get_Glyph_Outline( glyph1, ... );
+ TT_Load_Glyph( instance, glyph1, ... );
+
+ or
+
+ TT_Get_Outline_BBox( outline, &bbox );
+ TT_Transform_Outline( outline );
+
+ etc.
+
+ You get the idea: Only the face and instances are protected --
+ glyph containers and outlines should be thread-specific.
+
+
+ - You shouldn't initialize extensions in an engine concurrently
+ (which is what every mere mortal will do anyway :-).
+
+
+
+That's about it. Now enjoy the lib ;-)
+
+
+PS: See the `MT-Note' and `MT-Safe' remarks in ttapi.c for more
+ detailed information on each specific function.
+
+
+--- end of threads.txt ---
diff --git a/Build/source/libs/freetype/docs/user.txt b/Build/source/libs/freetype/docs/user.txt
new file mode 100644
index 00000000000..d24d693b0ae
--- /dev/null
+++ b/Build/source/libs/freetype/docs/user.txt
@@ -0,0 +1,916 @@
+
+ The FreeType Engine
+
+ Core Library User Guide
+
+ or
+
+ How to use the engine in your applications and font servers
+
+ ---------------------------------------------------
+
+ Introduction
+
+
+ I. Basic Concepts
+
+ 1. Concepts
+ 2. Handles
+ 3. Conventions of use
+ 4. Object classes
+
+ II. Extensions
+
+ 1. What is an extension?
+ 2. Where to find them
+ 3. Writing your own extension
+
+ Conclusion
+
+--------------------------------------------------------------------
+
+Introduction
+============
+
+ This file has been written to present the FreeType core library to
+ would-be writers of applications and font servers. It first
+ describes the concepts on which the engine is based, then how to
+ use it to obtain glyph metrics, outlines and bitmaps.
+
+ The last part discusses the ability to add and use extensions to
+ the core library to get access to supplemental TrueType tables
+ which are not currently provided by the core engine. If you would
+ like to write your own extensions, read also the FreeType
+ developer's guide.
+
+
+I. Basic Concepts
+=================
+
+
+ 1. Concepts
+ -----------
+
+ FreeType defines several kinds of structures called `objects',
+ that are used to manage the various abstractions required to
+ access and display fonts.
+
+ In care of good encapsulation, these objects are not directly
+ accessible from a client application. Rather, the user receives
+ a `handle' for each object he or she queries and wants to use.
+ This handle is a stand-alone reference; it cannot be used like a
+ pointer to access directly the object's data.
+
+ 2. Properties
+ -------------
+
+ It is however possible to obtain and set object properties
+ through several functions of the API. For example, you can
+ query a face object's properties with only a handle for it,
+ using the function TT_Get_Face_Properties().
+
+ Note that the data will be returned in a user-allocated
+ structure, but will also contain pointers addressing directly
+ some data found within the object.
+
+ A client application should never modify the data through these
+ pointers! In order to set new properties' values, the user must
+ always call a specific API function to do so, as a certain
+ number of other related data might not appear in the returned
+ structure and imply various non-visible coherency and coercion
+ rules.
+
+ 3. Conventions of use
+ ---------------------
+
+ o All API functions have their label prefixed by `TT_', as well
+ as all external (i.e. client-side) types.
+
+ o To allow the use of FreeType's core engine in threaded
+ environments, nearly all API functions return an error code,
+ which is always set to 0 in case of success.
+
+ The error codes' type is `TT_Error', and a listing of them is
+ given in the API references (see `apiref.txt' and
+ `apirefx.txt').
+
+ Some functions do not return an error code. Their result is
+ usually a value that becomes negative in case of error (this
+ is used for functions where only one kind of error can be
+ reported, like an invalid glyph index).
+
+ An important note is that the engine should not leak memory
+ when returning an error, e.g., querying the creation of an
+ object will allocate several internal tables that will be
+ freed if a disk error occurs during a load.
+
+ o A handle is acquired through API functions labeled along the
+ names:
+
+ TT_Open_xxxx(), TT_New_xxxx()
+
+ where `xxxx' is the object's class (Face, Instance, etc).
+
+ Examples:
+
+ TT_Open_Face(), TT_Open_Collection(),
+ TT_New_Instance(), TT_New_Glyph()
+
+ o A handle is closed through an API labeled
+
+ TT_Close_xxxx() or TT_Done_xxxx()
+
+ where `xxxx' is the object's class (Face, Instance, etc).
+
+ Examples:
+
+ TT_Close_Face(), TT_Done_Instance(), TT_Done_Glyph()
+
+ o Properties are obtained through an API labeled
+
+ TT_Get_xxxx_yyyy()
+
+ where `xxxx' is the object's class, and `yyyy' its property.
+
+ Examples:
+
+ TT_Get_Face_Properties(), TT_Get_Instance_Metrics()
+ TT_Get_Glyph_Outline(), TT_Get_Glyph_Bitmap()
+
+ o Properties are set through an API labeled
+
+ TT_Set_xxxx_yyyy()
+
+ where `xxxx' is the object's class, and `yyyy' its property.
+
+ Examples:
+
+ TT_Set_Instance_Resolutions(),
+ TT_Set_Instance_CharSize()
+
+ 4. Object Classes
+ -----------------
+
+ The following object classes are defined in this release of the
+ engine:
+
+ o The Engine objects
+
+ The FreeType library can be built to be completely re-entrant,
+ even though its default build doesn't support threads (more on
+ this in the `threads.txt').
+
+ As a consequence, it is possible to open several instances of
+ the library, called `engines'. Each engine has its own set of
+ current objects (faces, instances, etc.), and there is no
+ sharing between them.
+
+ The idea is that the library could be compiled as a shared
+ library or DLL, and then be able to provide several distinct
+ engines to independent client applications. In this case,
+ each client program must create its own engine with
+ TT_Init_FreeType() to hold its data.
+
+ Closing an engine will destroy _all_ objects that were
+ allocated since its opening, releasing all resources, etc.,
+ with the exception of user-allocated outline objects.
+
+ o The Face objects
+
+ A face contains the data that is specific to a single TrueType
+ font file. It presents information common to all glyphs and
+ all point sizes like font-specific metrics and properties.
+
+ You can open a face object by simply giving a pathname to the
+ TrueType file. You can later close (i.e. discard) the face
+ object.
+
+ You can also open a single face embedded in a TrueType
+ collection.
+
+ See also:
+
+ TT_Open_Face(), TT_Open_Collection(), TT_Close_Face(),
+ TT_Get_face_Properties()
+
+ o The Instance objects
+
+ An instance is also called a `pointsize' or a `fontsize' in
+ some windowing systems. An instance holds the information
+ used to render glyphs on a specific device at a given point
+ size; it is always related to an opened face object.
+
+ For instance, if you want to generate glyphs for text from the
+ same typeface at `sizes' of 10 and 12 points, all you need is
+ one face object, from which you will create two distinct
+ instances.
+
+ A device is defined by its horizontal and vertical resolution,
+ usually specified in dots per inch (dpi). A point size is a
+ scaling number, given as _absolute_ values in points, where 1
+ point = 1/72 inch.
+
+ The `pixel' size, also known as the `ppem' value (for Points
+ Per EM square) is computed from both the device resolution and
+ the point size. It determines the size of the resulting glyph
+ bitmaps on your screen or sheet of paper.
+
+ The default device resolution for any new instance is 96dpi in
+ both directions, which corresponds to VGA screens. The
+ default point size is 10pt. The high-level API allows you to
+ change this whenever you want for any given instance object.
+
+ Note that closing a face object will automatically destroy all
+ its child instances (even though you can release them yourself
+ to free memory).
+
+ See also:
+
+ TT_New_Instance(), TT_Done_Instance(),
+ TT_Get_Instance_Metrics(), TT_Set_Instance_Resolutions(),
+ TT_Set_Instance_Pointsize()
+
+ o The Glyph objects
+
+ A Glyph object is a _container_ for the data that describes
+ any glyph of a given font. This means that it typically
+ holds:
+
+ - Glyph metrics information, like bounding box or advance
+ width.
+
+ - Outline arrays sized large enough to hold any glyph from the
+ face. This size is extracted from the face's internal
+ `maxProfile' table to optimize memory costs.
+
+ - Other important parameters related to the `fine' rendering
+ of the glyphs. This includes things like the
+ dropout-control mode used at low sizes.
+
+ - And it doesn't contain a bitmap or a pixmap!
+
+ A glyph object is used to load, hint, and rasterize a single
+ glyph, as taken from the font file.
+
+ See also:
+
+ TT_New_Glyph(), TT_Done_Glyph(), TT_Get_Glyph_Metrics(),
+ TT_Get_Glyph_Outline(), TT_Get_Glyph_Bitmap(),
+ TT_Get_Glyph_Pixmap()
+
+ o The Character Map (CharMap) handle
+
+ Glyphs can be indexed in a TrueType file in any order,
+ independently of any standard character encoding, like ASCII
+ or Unicode. For this reason, each file comes with one or more
+ character mapping tables, used to translate from one specific
+ encoding's character codes to font glyph indices.
+
+ There are many encoding formats, and each one can be
+ distinguished by two values:
+
+ - its platform ID
+ - its platform-specific encoding ID
+
+ Their values are defined in the TrueType specification and
+ won't be commented there. The FAQ lists the most commonly
+ used (platform,encoding) pairs.
+
+ It is possible to enumerate the charmaps provided by a
+ TrueType font and to use any of these to perform translations.
+
+ The charmaps are loaded into memory only on demand to save the
+ space taken by the maps that are not needed on your system.
+ They are part of the face object, however.
+
+ This means that even though a charmap can be accessed through
+ a handle (obtained through the TT_Get_CharMap() function), it
+ isn't a stand-alone object. For example, you never need to
+ de-allocate it; this is automatically done by the engine when
+ its face object expires.
+
+ See also:
+
+ TT_Get_CharMap_Count(), TT_Get_CharMap_ID(),
+ TT_Get_CharMap(), TT_Char_Index().
+
+ o The Outline Objects
+
+ An outline is a vector representation of a glyph. It is made
+ of several control points joined by line segments and Bezier
+ arcs, themselves gathered in closed paths called `contours'.
+ The outline have also several flags, or attributes, which are
+ used by the scan-line converter to select the best rendering
+ algorithms to convert the glyph's bitmap.
+
+ Unlike other objects in FreeType, outlines aren't managed
+ through handles, but directly with the structure `TT_Outline',
+ defined for client applications. Each glyph container
+ contains an outline sized large enough to hold any glyph from
+ its parent face. Client applications can access it with
+ TT_Get_Glyph_Outline(). However, one can also create its own
+ outlines if needed with TT_New_Outline() and
+ TT_Clone_Outline().
+
+ Note that user-created outlines are NOT tracked by the
+ library. Hence, the client must release them himself with one
+ or more calls to TT_Done_Outline().
+
+ A various number of methods/operations are defined for the
+ outline class to simplify its management.
+
+
+ IMPORTANT NOTE: **********************************************
+
+ The definition of TT_Outline may change in the future.
+ Developers are thus advised to always use the outline
+ methods provided by the API rather than reading or setting
+ data themselves.
+
+ **************************************************************
+
+ See also:
+
+ TT_New_Outline(), TT_Clone_Outline(), TT_Copy_Outline(),
+ TT_Done_Outline(), TT_Get_Outline_BBox(),
+ TT_Get_Outline_Bitmap(), TT_Get_Outline_Pixmap(),
+ TT_Translate_Outline(), TT_Transform_Outline()
+
+ o Bitmaps and Pixmaps
+
+ One very important aspect of FreeType is that it is unable to
+ create bitmaps on its own. Rather, it is up to the client
+ application to do it, and pass a reference, in the form of a
+ TT_Raster_Map, to the scan-line converter (the component in
+ charge of generating bitmaps from outlines).
+
+ Hence the importance of the TT_Raster_Map structure, which
+ layout is:
+
+ struct
+ {
+ int rows; /* number of rows */
+ int cols; /* number of columns (bytes) per row */
+ int width; /* number of pixels per line */
+ int flow; /* bitmap orientation */
+
+ void* bitmap; /* bit/pixmap buffer */
+ long size; /* bit/pixmap size in bytes */
+ } TT_Raster_Map;
+
+ - The `rows' field contains the total number of rows in the
+ bitmap.
+
+ - The `width' field gives the number of pixels per row (a bit
+ or a byte, depending on the map's nature).
+
+ - The `cols' field gives the number of columns, i.e. bytes,
+ taken by each row in the map buffer.
+
+ IMPORTANT: The `cols' field must be a multiple of 4 for
+ pixmaps!
+
+ Typically, its value should be `(width+7)/8' for bitmaps,
+ and `(width+3) & -4' for pixmaps.
+
+ - The `flow' field gives the map's vertical orientation.
+
+ For example, if the first bytes of the bitmap buffer pertain
+ to its upper row, the flow is said to be going `down', and
+ the field should take the value `TT_Flow_Down'. If these
+ bytes pertain to its lowest row, the flow is going `up', and
+ the value is `TT_Flow_Up'.
+
+ As an example, the PC video modes use a `down' flow, where
+ the first VRAM byte corresponds to the upper and leftmost
+ corner of the screen.
+
+ - The `bitmap' field is a typeless pointer to the map's
+ buffer.
+
+ - The `size' field contains the buffer's size in bytes. It is
+ usually computed as follows:
+
+ size = rows * cols;
+
+ NOTE: For bitmaps, the leftmost-pixel is related to the
+ highest (i.e. most significant) bit of its byte.
+ There is currently no support for the opposite
+ convention found in some systems.
+
+ (It can be easily added if you really need it, just
+ ask the development team.)
+
+
+II. Step-by-step Example
+========================
+
+ Here is an example to show, step by step, how a client application
+ can open a font file, set one or several instances, load any
+ glyph, then render it to a bitmap.
+
+ 1. Initialize the engine
+ ------------------------
+
+ This is the first thing to do. You need to initialize an engine
+ through a call to TT_Init_FreeType(). This function will set up
+ a various number of structures needed by the library.
+
+ This allocates about 68kByte, of which 64kByte are dedicated to
+ the scan-line converter's `render pool', a workspace used for
+ bitmap generation. Note that even though this space is bounded,
+ the raster is able to render a glyph to any size or bitmap, even
+ horribly huge ones.
+
+ NOTE: You can reduce the size of this pool by modifying the
+ constant RASTER_RENDER_POOL in the file `ttraster.c'. A
+ smaller pool will result in slower rendering at large
+ sizes. Take care of never assigning a value smaller than
+ 4kByte however, as bugs may start to lurk in!
+
+ Example:
+
+ TT_Engine engine;
+
+
+ error = TT_Init_FreeType( &engine );
+ if ( error )
+ {
+ printf( "could not create engine instance\n");
+ ...
+ }
+
+ 2. Initialize the extensions you need
+ -------------------------------------
+
+ FreeType provides several extensions which are optional,
+ separately compilable components to add some rare features to
+ the engine and its API.
+
+ You need to explicitly initialize the extensions you want to
+ use. Each extension must provide an initialization function,
+ following the naming convention:
+
+ TT_Init_xxx_Extension( engine );
+
+ where `xxx' is the extension's `kind'.
+
+ Example:
+
+ error = TT_Init_Kerning_Extension( engine );
+ if ( error )
+ ...
+
+ 3. Open the font file
+ ---------------------
+
+ There are two ways to open a font face, depending on its file
+ format:
+
+ - If it is a TrueType file (ttf), you can simply use the API
+ named TT_Open_Face(), which takes the file's pathname as
+ argument, as well as the address of the returned face handle.
+
+ Check the returned error code to see if the file could be
+ opened and accessed successfully.
+
+ TT_Face face; /* face handle */
+
+
+ error = TT_Open_Face( engine, "/fonts/arial.ttf", &face );
+ if ( error )
+ {
+ printf( "could not open the file\n" );
+ ...
+ }
+
+ - If the font is embedded in a TrueType collection (ttc), you
+ can use the API named TT_Open_Collection(), which takes also
+ the font's index within the collection's directory.
+
+ TT_Face face; /* face handle */
+
+
+ /* Load the collection's second face (index=1) */
+ error = TT_Open_Collection( engine, "/fonts/mingli.ttc",
+ 1, &face );
+ if ( error )
+ {
+ printf( "could not open the file\n" );
+ ...
+ }
+
+ - Finally, when you do not know the number of faces embedded in
+ a TrueType collection, the following technique can be used:
+
+ o Call TT_Open_Face() with the collection file's pathname.
+ This API recognizes collections automatically and always
+ return a handle for its first embedded font.
+
+ o Get the face's properties through TT_Get_Face_Properties().
+ These contain, among other things, the total number of fonts
+ embedded in the collection, in its field `num_Faces'.
+
+ TT_Face face; /* face handle */
+ TT_Face_Properties props; /* face properties */
+
+
+ /* open the first collection font */
+ error = TT_Open_Face( engine, "/fonts/mingli.ttc",
+ &face );
+ if ( error )
+ {
+ printf( "could not open the file\n" );
+ ...
+ }
+
+ /* Get the face properties */
+ TT_Get_Face_Properties( face, &props );
+
+ /* Now print the number of faces */
+ printf( "there are %d faces in this collection file\n",
+ props->num_Faces );
+
+ 4. Create an instance from the face object
+ ------------------------------------------
+
+ You must create an instance (also known as a `pointsize') which
+ contains information relative to the target output device's
+ resolutions and a given point size.
+
+ o The instance object is created through TT_New_Instance():
+
+ TT_Instance instance;
+
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ {
+ printf( "could not create instance\n" );
+ ...
+ }
+
+ TECHNICAL NOTE: Creating a new instance executes its font
+ program. This can fail if the font is broken.
+ Never assume that the error code returned here
+ is always 0.
+
+ o You must set the instance's properties to suit your needs.
+ These are simply its device resolutions, set through
+ TT_Set_Instance_Resolutions(), and its point size, set through
+ TT_Set_Instance_CharSize():
+
+ /* Set the target horizontal and vertical resolution to */
+ /* 300dpi in each direction (typically for a printer). */
+ /* A fresh instance's default resolutions are 96dpi in */
+ /* both directions. */
+ error = TT_Set_Instance_Resolutions( instance, 300, 300 );
+ if ( error )
+ {
+ printf( "could not set resolution\n" );
+ ...
+ }
+
+ /* Now set the point size to 12pt. Default is 10pt. */
+ /* Don't forget that the size is expressed in 26.6 fixed */
+ /* float format, so multiply by 64. */
+ error = TT_Set_Instance_CharSize( instance, 12 * 64 );
+ if ( error )
+ {
+ printf( "could not set point size\n" );
+ ...
+ }
+
+ TECHNICAL NOTE: These calls may execute the font's `prep'
+ program, which can fail if the font is broken.
+ Never assume that the error code returned is
+ are always 0.
+
+ o You can also set the instance's transformation flags to tell
+ the glyph loading function that you are going to perform a
+ transformation (like rotation or slanting) on the glyph. Note
+ that the glyph loader doesn't perform the transformation. It
+ only informs the glyphs' hinting instruction streams about
+ these flags which may use it to disable or enable various
+ features (grid-fitting, drop-out control, etc).
+
+ Use e.g.
+
+ TT_Set_Instance_Transforms( FALSE, TRUE );
+
+ to indicate that you're going to stretch, but not rotate, this
+ instance's glyphs. Default is, of course, both FALSE.
+
+ 5. Create a glyph container
+ ---------------------------
+
+ You need a glyph object to serve as a container for the glyphs
+ you want to load from the face. This is done simply by
+
+ TT_Glyph glyph; /* glyph object handle */
+
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ {
+ printf( "could not create glyph\n" );
+ ...
+ }
+
+ 6. Find your platform's character mappings
+ ------------------------------------------
+
+ Each font file can come with one or more character mapping
+ tables, used to convert character codes to glyph indices. You
+ must know the values of the `platformID' and `encodingID' as
+ defined in the TrueType specification for your platform. For
+ example, Windows Unicode encoding is (platform:3,encoding:1),
+ while Apple Unicode is (platform:0,encoding:0). Both formats
+ differ in internal storage layout and can be used transparently
+ with the same inputs with FreeType.
+
+ The function TT_Get_CharMap_Count() returns the number of
+ character mappings present in a face. You can then enumerate
+ these with the function TT_Get_CharMap_ID(). Once you've found
+ a mapping usable for your platform, use TT_Get_CharMap() to
+ return a TT_CharMap handle that will be used later to get glyph
+ indices.
+
+ 7. Load the glyph
+ -----------------
+
+ The glyph loader is easily queried through TT_Load_Glyph().
+ This API function takes several arguments:
+
+ o An instance handle to specify at which point size and
+ resolution the loaded glyph should be scaled and grid-fitted.
+
+ o A glyph container, used to hold the glyph's data in memory.
+ Note that the instance and the glyph must relate to the _same_
+ font file. An error would be produced immediately otherwise.
+
+ o A glyph index, used to reference the glyph within the font
+ file. This index is not a platform specific character code,
+ and a character's glyph index may vary from one font to
+ another. To compute glyph indices from character codes, use
+ the TT_CharMap handle created in section 6 with
+ TT_Char_Index().
+
+ We strongly recommend using the Unicode charmap whenever
+ possible.
+
+ o A load mode, indicating what kind of operations you need.
+ There are only two defined for the moment:
+
+ TTLOAD_SCALE_GLYPH:
+
+ If set, this flag indicates that the loaded glyph will be
+ scaled (according to the instance specified as an
+ argument) to fractional pixel coordinates (26.6). If not,
+ the coordinates will remain integer FUnits. Please refer
+ to the TrueType specification and the FreeType header
+ files for more details on the 26.6 format and other data
+ types.
+
+ TTLOAD_HINT_GLYPH:
+
+ This flag is only in effect if the TTLOAD_SCALE_GLYPH flag
+ is set. It indicates that the glyph must also be `hinted'
+ resp. `grid-fitted' for better display results. Note that
+ this also means that the glyph metrics will be
+ grid-fitted, including the bounding box.
+
+ You can simply `or' the flags. As most applications will
+ require both flags to be set, the constant TTLOAD_DEFAULT is
+ defined as:
+
+ #define TTLOAD_DEFAULT (TTLOAD_SCALE_GLYPH | \
+ TTLOAD_HINT_GLYPH )
+
+ Example:
+
+ error = TT_Load_Glyph( instance, glyph, 36,
+ TTLOAD_DEFAULT );
+ if ( error )
+ {
+ printf("could not load the glyph\n");
+ ...
+ }
+
+ 8. Query glyph properties
+ -------------------------
+
+ You're then able to query various glyph properties:
+
+ o The glyph metrics can be obtained through
+ TT_Get_Glyph_Metrics(). The data returned in the metrics
+ structure is:
+
+ - the glyph's left side bearing (bearingX)
+ - the glyph's top side bearing (bearingY)
+ - the glyph's advance width (advance)
+ - the glyph's bounding box (bbox)
+
+ These values are expressed in 26.6 pixel units when the glyph
+ was loaded with scaling, or in FUnits if not. To obtain
+ vertical metrics you should use the function
+ TT_Get_Glyph_Big_Metrics().
+
+ o The glyph outline can be queried through
+ TT_Get_Glyph_Outline(). This can be useful to process the
+ point coordinates (e.g. applying stretching or rotation) with
+ functions like TT_Apply_Outline_Matrix() or
+ TT_Apply_Outline_Translation(). Note that these functions do
+ not recompute a glyph's metrics after the transformation!
+
+ The outline's structure is described in the reference
+ `apiref.txt'.
+
+ A bitmap or pixmap for the glyph can be queried with the API
+ functions TT_Get_Glyph_Bitmap() and TT_Get_Glyph_Pixmap().
+ These functions take a glyph handle as an argument, as well as
+ a bitmap/pixmap description block and two offsets.
+
+ The target map is described through a TT_Raster_Map object,
+ which structure is defined in the reference (see
+ `apiref.txt'). The offsets are given in the same units as the
+ points coordinates and glyph metrics: 26.6 pixel units for a
+ scaled glyph, and FUnits for an unscaled one.
+
+ IMPORTANT TECHNICAL NOTE: If the glyph has been scaled and
+ hinted, the offsets _must_ be
+ multiples of 64 (i.e. integer pixel
+ offsets). Otherwise, you would ruin
+ the grid fitting (which usually
+ results in ugly glyphs).
+
+ Example:
+
+ TT_Glyph_Metrics metrics;
+ TT_Outline outline;
+ TT_Raster_Map bitmap;
+
+
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+ TT_Get_Glyph_Outline( glyph, &outline );
+
+ /* set up the bitmap */
+ ...
+ TT_Get_Glyph_Bitmap( glyph, &bitmap, 0, 0 );
+
+ 9. When you are done
+ --------------------
+
+ o You can close any font face object with TT_Close_Face(). This
+ call will automatically discard its child instances, glyphs
+ and charmaps.
+
+ o You can also close the engine with a single call to
+ TT_Done_FreeType(). This will release _all_ objects that were
+ previously allocated (with the exception of user-created
+ outlines), and close all font files, as well as extensions
+ that were inited for it.
+
+
+III. Extensions
+===============
+
+ 1. What is an extension?
+ ------------------------
+
+ FreeType allows you to access a various number of TrueType
+ tables, as well as to render individual glyphs. However:
+
+ 1. It doesn't perform some high-level operations, like
+ generating a string text from many individual glyphs.
+
+ 2. It doesn't perform kerning (which can be needed by operations
+ mentioned in item 1).
+
+ 3. It doesn't give access to all the defined TrueType tables,
+ especially the optional ones.
+
+ While item 1 is a feature that will never go into FreeType's
+ core engine, which goal is to provide easy access to font data
+ and rendering _individual_ glyphs, point 2 and 3 can be added to
+ the engine's features through extensions.
+
+ An extension is simply a small piece of code that extends the
+ engine's abilities and APIs. It is possible to extend the
+ engine without touching the core's source code, this is
+ described in chapter 3 below.
+
+ 2. The two kinds of extensions
+ ------------------------------
+
+ There are basically two kinds of extensions, which require
+ different implementations.
+
+ a. API extensions
+
+ An API extension is a set of functions that extend the
+ FreeType core API to give access to tables that are already
+ loaded by the engine, but not provided for now. An example of
+ such data can be:
+
+ - the horizontal metrics table (hmtx)
+ - the `gasp' table
+
+ This kind of extension is made of:
+
+ o an API extension header file, following the usage convention
+ introduced here (all labels prefixed with `TT_'), and which
+ will be included by the clients which want to use the
+ extension. By convention, such header names begin with
+ `ftx' (for FreeType eXtension).
+
+ Examples: ftxgasp.h, ftxhmtx.h
+
+ o One or more functions used to give access to the tables that
+ are already loaded and managed by the engine. They usually
+ only copy pointers to the target structure given by the
+ client application since these structures are not accessible
+ through the 'normal' API. An API extension doesn't need to
+ be initialized before being used.
+
+ b. Engine extensions
+
+ It can sometimes be useful to load and manage several tables
+ that are not considered by the core engine. These extensions
+ need to provide additional functions to fit into FreeType's
+ internal object management model, and are more sophisticated
+ than API extensions.
+
+ An example is given in this distribution to provide kerning
+ support (or more technically spoken, access to the kerning
+ tables found within the TrueType files). It is made of:
+
+ o An API extension providing new interfaces to the client
+ applications that need it. See the file `ftxkern.h'
+ resp. `apirefx.txt'.
+
+ o A specific implementation, providing services to create,
+ load, and manage kerning tables as additional parts of a
+ face object. In the case of kerning, the directory of
+ tables is loaded when the face is opened, and tables
+ themselves are fetched from the file on demand. This
+ implies several `hooks' in the core engine. See the files
+ `ttkern.h' and `ttkern.c'. These are called `engine
+ extensions'.
+
+ o A specific extension initialization function, namely
+ TT_Init_Kerning_Extension(), that must be called after an
+ engine's creation, and before any face object allocation.
+ This function will `register' the extension within the
+ engine and make its API workable.
+
+ 3. Writing your own extensions
+ ------------------------------
+
+ As it was suggested earlier, writing an engine extension is a
+ delicate process, as the additional code must follow a certain
+ number of design rules, presented in the FreeType developer's
+ guide. Unfortunately, there is currently no extension writer's
+ guide.
+
+ By writing your own extensions, it will be possible to support
+ more advanced TrueType formats like TrueType GX or OpenType in a
+ near future, without having to torture the engine core source at
+ each iteration.
+
+ If you encounter some difficulties when trying to create your
+ own extension, please read the core source file carefully, and
+ in the event that you may need changes that are not fitted to
+ the current extension mechanism, do not hesitate to contact the
+ authors at `devel@freetype.org'.
+
+
+Conclusion
+==========
+
+ The engine source code has become rather stable since now, and
+ its quality compares very favorably to Windows and the Macintosh
+ rasterizers. Its internals will continue to change, though very
+ slowly, even if the API isn't expected to grow much in a near
+ future.
+
+ FreeType is really a glyph-oriented TrueType driver. Its
+ purpose is to open and manage font files in order to load single
+ glyphs and render them as cleanly as possible. A number of
+ features, important to developers, like text string rendering,
+ font mapping and underlining/stroking, to name a few, aren't
+ provided there even though they'd be highly appreciated.
+
+ We hope you have success and fun using this engine. Much time
+ has been taken to make it one of the best in its genre.
+ Remember that it is not intended to be a complete font server or
+ text rendering library, but a pretty solid base for these kinds
+ of applications, as well as others.
+
+ We thank you for your time and consideration.
+
+ David Turner, Robert Wilhelm, Werner Lemberg,
+ and all the FreeType enthusiasts...
+
+
+--- End of user.txt ---
diff --git a/Build/source/libs/freetype/freetype.ac b/Build/source/libs/freetype/freetype.ac
new file mode 100644
index 00000000000..8079d8ac567
--- /dev/null
+++ b/Build/source/libs/freetype/freetype.ac
@@ -0,0 +1,58 @@
+if test "$needs_freetype" = no; then
+ FREETYPECPPFLAGS=
+ LDFREETYPE=
+ FREETYPEDEP=
+else
+ EXTRA_FREETYPE_INCLUDE=
+ EXTRA_FREETYPE_LIBDIR=
+
+ if test "$with_system_freetype" = yes; then
+ if test "x$with_freetype_libdir" != x; then
+ EXTRA_FREETYPE_LIBDIR="-L$with_freetype_libdir"
+ fi
+ if test "x$with_freetype_include" != x; then
+ EXTRA_FREETYPE_INCLUDE="-I$with_freetype_include"
+ fi
+ fi
+
+ OLD_LDFLAGS=$LDFLAGS
+ OLD_CPP=$CPP
+ OLD_LIBS=$LIBS
+
+ LDFLAGS="$LDFLAGS $EXTRA_FREETYPE_LIBDIR"
+ CPP="$CPP $EXTRA_FREETYPE_INCLUDE"
+
+ if test "$with_system_freetype" = yes; then
+ AC_CHECK_LIB(ttf, TT_Init_FreeType,,
+ AC_MSG_WARN(Standard FREETYPE library not found. Compiling my own.)
+ with_system_freetype=no)
+ fi
+
+ if test "$with_system_freetype" = yes; then
+ AC_CHECK_HEADERS(freetype.h)
+ if test "$ac_cv_header_freetype_h" != yes; then
+ AC_MSG_WARN(freetype.h not found. Using my own freetype sources.)
+ with_system_freetype=no
+ fi
+ fi
+
+ LDFLAGS=$OLD_LDFLAGS
+ CPP=$OLD_CPP
+ LIBS=$OLD_LIBS
+
+ if test "$with_system_freetype" != yes; then
+ FREETYPECPPFLAGS='-I$(FREETYPEDIR)/lib -I$(FREETYPESRCDIR)/lib'
+ LDFREETYPE='$(FREETYPEDIR)/lib/.libs/libttf.a'
+ FREETYPEDEP='$(FREETYPEDIR)/lib/.libs/libttf.a'
+ using_system_freetype=no
+ else
+ FREETYPECPPFLAGS="$EXTRA_FREETYPE_INCLUDE"
+ LDFREETYPE="$EXTRA_FREETYPE_LIBDIR -lttf"
+ FREETYPEDEP=
+ using_system_freetype=yes
+ fi
+fi
+
+AC_SUBST(FREETYPECPPFLAGS)
+AC_SUBST(LDFREETYPE)
+AC_SUBST(FREETYPEDEP)
diff --git a/Build/source/libs/freetype/freetype.spec b/Build/source/libs/freetype/freetype.spec
new file mode 100644
index 00000000000..9dc71c8ce07
--- /dev/null
+++ b/Build/source/libs/freetype/freetype.spec
@@ -0,0 +1,171 @@
+Summary: FreeType library
+Name: freetype
+Version: 1.5
+Release: 1
+Source: ftp://ftp.freetype.org/freetype/freetype1-%{version}-%{release}.tar.gz
+URL: http://www.freetype.org/
+Copyright: BSD-Like + GPL
+Group: Libraries
+BuildRoot: /var/tmp/freetype
+
+%description
+The FreeType engine is a free and portable TrueType font rendering
+engine. It has been developed to provide TrueType support to a
+great variety of platforms and environments.
+
+Note that FreeType is a *library*. It is not a font server for your
+favorite platform, even though it was designed to be used in many of
+them. Note also that it is *not* a complete text-rendering library.
+Its purpose is simply to open and manage font files, as well as
+load, hint and render individual glyphs efficiently. You can also
+see it as a `TrueType driver' for a higher-level library, though
+rendering text with it is extremely easy, as demo-ed by the test
+programs.
+
+This package contains the files needed to run programs that use the
+FreeType engine.
+
+%package devel
+Summary: FreeType development headers and libraries
+Group: Development/Libraries
+Requires: %{name} = %{version}
+
+%description devel
+The FreeType engine is a free and portable TrueType font rendering
+engine. It has been developed to provide TrueType support to a
+great variety of platforms and environments.
+
+Note that FreeType is a *library*. It is not a font server for your
+favorite platform, even though it was designed to be used in many of
+them. Note also that it is *not* a complete text-rendering library.
+Its purpose is simply to open and manage font files, as well as
+load, hint and render individual glyphs efficiently. You can also
+see it as a `TrueType driver' for a higher-level library, though
+rendering text with it is extremely easy, as demo-ed by the test
+programs.
+
+This package contains all supplementary files you need to develop
+your own programs using the FreeType engine.
+
+%package demo
+Summary: FreeType test and demo programs
+Group: Applications/Graphics
+Requires: %{name} = %{version}
+
+%description demo
+The FreeType engine is a free and portable TrueType font rendering engine.
+It has been developed to provide TT support to a great variety of platforms
+and environments.
+
+Note that FreeType is a *library*. It is not a font server for your favorite
+platform, even though it was designed to be used in many of them. Note also
+that it is *not* a complete text-rendering library. Its purpose is simply to
+open and manage font files, as well as load, hint and render individual
+glyphs efficiently. You can also see it as a "TrueType driver" for a
+higher-level library, though rendering text with it is extremely easy, as
+demo-ed by the test programs.
+
+This package contains several programs bundled with the FreeType engine for
+testing and demonstration purposes.
+
+%changelog
+* Tue Jan 08 2002 Werner Lemberg <werner.lemberg@freetype.org>
+- Updated to version 1.5.
+
+* Mon Oct 29 2001 Antoine Leca <Antoine-Freetype@Leca-Marti.org>
+- Updated to version 1.4.9 (pre 1.5); NOTE: 1.4 was never released officially.
+
+* Wed Feb 23 2000 Werner Lemberg <werner.lemberg@freetype.org>
+- Updated to version 1.4.
+
+* Thu Sep 9 1999 Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz>
+- Simplified (and fixed) file list.
+
+* Wed Jun 16 1999 Werner Lemberg <werner.lemberg@freetype.org>
+- Updated to version 1.3.
+
+* Sun Oct 25 1998 Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz>
+- libttf.so version number updated again.
+- Default localedir based on prefix.
+- File list adjustments (howto/).
+
+* Sun Oct 16 1998 Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz>
+- Source filename fixed.
+- HOWTO removed.
+- libttf.so version number updated.
+
+* Tue Sep 29 1998 Robert Wilhelm <robert@freetype.org>
+- Updated to version 1.2.
+
+* Tue Jul 14 1998 Alexander Zimmermann <Alexander.Zimmermann@fmi.uni-passau.de>
+- Added missing files.
+- Added %defattr tags.
+
+* Thu Jun 18 1998 Robert Wilhelm <robert@freetype.org>
+- Added lots of attr(-,root,root).
+
+* Wed May 27 1998 Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz>
+- Changed group attr of freetype and freetype-devel package.
+- Fixed misc glitches.
+
+* Sun May 24 1998 Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz>
+- Split the package into three parts (runtime library, development
+ tools, and demo programs).
+- Added missing files (headers, NLS).
+- Added ldconfing upon (de)installation.
+
+* Thu Mar 12 1998 Bruno Lopes F. Cabral <bruno@openline.com.br>
+- NLS for Portuguese language is missing, sorry (may be in a near future)
+ (please note the workaround using --with-locale-dir and gnulocaledir.
+ NLS Makefile needs a bit more rework but again I'll not patch it here).
+
+%prep
+%setup
+
+find . -name CVS -type d | xargs rm -rf
+
+%build
+./configure --prefix=/usr --enable-static
+make all
+
+%install
+make install prefix=$RPM_BUILD_ROOT/usr
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%defattr(644, root, root, 755)
+%doc announce license.txt docs/FTL.txt docs/GPL.txt
+/usr/lib/libttf.so.*
+/usr/share/locale/
+
+%files devel
+%defattr(644, root, root, 755)
+%doc INSTALL README PATENTS announce license.txt readme.1st
+%doc docs/ howto/
+/usr/lib/libttf.so
+/usr/lib/libttf.la
+/usr/lib/libttf.a
+/usr/include/freetype/
+
+%files demo
+%defattr(755, root, root, 755)
+%doc announce license.txt
+/usr/bin/ftdump
+/usr/bin/fterror
+/usr/bin/ftlint
+/usr/bin/ftmetric
+/usr/bin/ftsbit
+/usr/bin/ftstring
+/usr/bin/ftstrpnm
+/usr/bin/ftstrtto
+/usr/bin/fttimer
+/usr/bin/ftview
+/usr/bin/ftzoom
diff --git a/Build/source/libs/freetype/ft_conf.h.in b/Build/source/libs/freetype/ft_conf.h.in
new file mode 100644
index 00000000000..da296c4a6e0
--- /dev/null
+++ b/Build/source/libs/freetype/ft_conf.h.in
@@ -0,0 +1,220 @@
+/*******************************************************************
+ *
+ * ft_conf.h.in
+ *
+ * Template ft_conf.h for Unix systems
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+#undef const
+
+/* Define if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+
+/* The number of bytes in a int. */
+#undef SIZEOF_INT
+
+/* The number of bytes in a long. */
+#undef SIZEOF_LONG
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the memcpy function. */
+#undef HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+#undef HAVE_TT_TEXT
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+/* */
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+/* */
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
diff --git a/Build/source/libs/freetype/howto/mac.txt b/Build/source/libs/freetype/howto/mac.txt
new file mode 100644
index 00000000000..6ed97d9f7a3
--- /dev/null
+++ b/Build/source/libs/freetype/howto/mac.txt
@@ -0,0 +1,19 @@
+ The FreeType Mac Compilation HowTo
+
+
+ Please note that the FreeType team does *not* support the
+ Macintosh platform due to lack of knowledge.
+
+ However, we provide the basic files to compile the library in
+ the lib/arch/mac directory (OK, `folders'). Also the project
+ files for PowerPC with CodeWarrior have been contributed (in
+ contrib/mac).
+
+ A noteworthy point is that the precompiled standard MacOS
+ headers should be turned off to compile the library, to avoid
+ errors caused by conflicting definitions of `Fixed' and `Byte'.
+
+
+Good luck!
+
+--- end of mac.txt ---
diff --git a/Build/source/libs/freetype/howto/msdos.txt b/Build/source/libs/freetype/howto/msdos.txt
new file mode 100644
index 00000000000..01a01f93982
--- /dev/null
+++ b/Build/source/libs/freetype/howto/msdos.txt
@@ -0,0 +1,272 @@
+ The FreeType MS-DOS Compilation HowTo
+
+Contents
+
+Introduction
+I. Building the library
+ 1. Quick Compilation
+ 2. Manual compilation
+ 3. Notes
+II. Building other parts of the package
+ 1. Test programs
+ 2. Other contribs
+III. Compiler Issues
+ 1. Special issues of 16-bit MS-DOS
+ 2. Borland Turbo C v.2.0x
+
+
+
+Introduction
+============
+
+This file describes the compilation of the FreeType package on a
+MS-DOS system. It comes with Makefiles for the following compilers:
+
+ - gcc/emx and gcc/djgpp with GNU make (32 bit)
+
+ - wcc386 with wmake (Watcom -- tried with 10.6)
+
+ - gcc/emx with dmake (32 bit)
+
+ - cl with nmake (16-bit Microsoft C -- tried with 7 and VC++ 1.5x)
+
+ - bcc/tcc with Borland make (16-bit Borland C++ and Turbo C)
+
+NOTE:
+
+ You are advised to jump to section II.1 if you want to run the
+ FreeType test/demo programs as quick as possible.
+
+
+
+I. Building the library
+=======================
+
+
+1. Quick Compilation
+--------------------
+
+ The easiest way to compile the library on MS-DOS is to go to the
+ directory `freetype/lib'. Then type, depending on your compiler:
+
+ gcc/emx,
+ gcc/djgpp: make -f arch/msdos/Makefile.gcc
+ gcc/dmake: dmake -r -f arch/msdos/Makefile.dm
+
+ wcc386: wmake -f=arch\msdos\Makefile.wat
+
+ cl: nmake /f arch\msdos\Makefile.MS (for versions 6-7)
+ cl: nmake /f arch\msdos\Makefile.VC (for Visual C++ 1.x)
+
+ tcc: make -farch/msdos/Makefile.TC
+ bcc: make -farch/msdos/Makefile.BC
+
+ This should build the `libttf.a' or `libttf.lib' library files.
+
+ You can also use the following targets:
+
+ depend - (for gcc with emx or DJGPP only) Creates a file that
+ lists the dependancies. Useful for the developper.
+
+ clean - Cleans all intermediate object files created during
+ compilation. Keeps all library and executables in
+ place.
+
+ distclean - Cleans everything, leaving the directories as they
+ were before the compilation.
+
+ debug - Makes a development version of the library. Only
+ useful for FreeType developers and hackers.
+
+ Note that you can also select to use the `debugging' flags for
+ your compiler (instead of the `optimizing' ones), by defining
+ the `DEBUG' symbol, like in
+
+ nmake /f arch\msdos\Makefile.MS DEBUG=1
+ make -farch/msdos/Makefile.BC /DDEBUG
+ etc.
+
+ Doing so will automatically select the debug target instead of
+ the normal mode.
+
+ For 16-bit compilers, you can also try defining the `BIGFONTS'
+ symbol, to enable the use of the `huge pointers' needed to
+ handle some big fonts. More on this at the end of this file.
+
+
+2. Manual compilation
+---------------------
+
+ Here are explained the steps that are required to compile the
+ FreeType _library_ (and only this one) by hand.
+
+ Unlike previous versions, FreeType 1.1 and above can be compiled
+ in two modes, called `debug mode' and `single object mode'.
+
+ Debug mode is simply the normal way of compiling C programs, i.e.,
+ each `*.c' file is compiled into an individual `*.obj' object
+ file, and all of them are linked together into an archive (i.e.,
+ `*.lib' library).
+
+ Single object mode is slightly different: All C files are included
+ in a single source during compilation, resulting in a single final
+ object file for the core library. This has the advantage of
+ letting optimizing compilers do more global work, as well as
+ getting rid of all external which are used solely for the purpose
+ of components interfacing.
+
+ In both modes, you need to include the following paths to your
+ makefile/command line:
+
+ the location of all `tt*.[hc]' files
+ the location of system-specific files
+
+ For example, if you are compiling from the `freetype/lib'
+ directory, you can type for debug mode something like
+
+ gcc -c -I. -Iarch/msdos tt*.c
+
+ to compile all required files into object ones. Then assemble
+ them in a library with `ar', `lib', or `tlib'.
+
+ In single object mode, you only need to compile the file named
+ `freetype.c' which is located in `freetype/lib/arch/msdos'. From
+ the same directory as before, one would type
+
+ cl -c -I. -Iarch/msdos arch/msdos/freetype.c
+
+ You can also compile the extensions located in
+ `freetype/lib/extend' separately from the base engine. You will
+ need to include the same paths as before, though; be sure to add
+ the path to the `extend' directory, like in
+
+ bcc -c -I. -Iarch/msdos -Iextend extend/*.c
+
+
+3. Notes
+--------
+
+ `char' is always `signed char' in the sources!
+
+ `ttconfig.h' relies heavily on a file called `ft_conf.h' that
+ contains information related to the target platform, located in
+ the `freetype/lib/arch/msdos/' directory. Depending on your
+ compiler, you may need to slightly edit it.
+
+ We use gcc as our reference compiler for warnings. This means
+ that we use the `-ansi -pedantic -Wall' flags and try to get rid
+ of warnings in this situation. If you're compiling with another
+ compiler, you may encounter warnings, not errors. Note that the
+ Borland compilers seem to produce lots of irrelevant warnings
+ (like `potential loss of precision').
+
+
+
+II. Building other parts of the package
+=======================================
+
+
+1. Test programs
+----------------
+
+ These are located in `freetype/test'. Most of them use a tiny
+ graphics sub-system which is simply used to display bitmaps and
+ pixmaps on a variety of platforms. The MS-DOS version is a very
+ basic one that only works in full-screen using standard VGA mode.
+
+ To compile them, you must be in the `freetype/test' directory and
+ invoke the makefile in arch/msdos. For example:
+
+ nmake /f arch\msdos\Makefile.VC
+
+
+ NOTE 1:
+
+ This will automatically invoke the library makefile for you!
+
+ NOTE 2:
+
+ For now, the graphical test programs only run on the following
+ platforms: Unix, OS/2, Dos, Amiga, and Windows.
+
+ The library, being pure ANSI-C, can be used on any system to
+ generate bitmaps and pixmaps.
+
+
+2. Other contribs
+-----------------
+
+ You may find some other contributions to the FreeType project in
+ the `freetype/contrib' directory. Each of these programs should
+ have its own Makefiles and documentations. Also check their
+ licenses, as the programs are not necessarily distributed under
+ the FreeType one.
+
+ Most of these contributions are targeted to Unix. You are invited
+ to port them to MS-DOS, and then contribute your improvements.
+
+
+
+III. Compiler Issues
+====================
+
+ Many comments specific to a given compiler are now stored in its
+ relevant Makefile's, in the arch/msdos subdirectories.
+
+
+1. Special issues of 16-bit MS-DOS
+----------------------------------
+
+ As usual, 16-bit MS-DOS have some limitations.
+
+ First, and mainly, only the large model is usable. The small and
+ medium models are not usable, because the library uses more than
+ 64kByte of data; and the compact model is unusable as well, since
+ the code of the library itself is slightly less than 64kByte, thus
+ leaving very small place for the real work. The net effect of
+ that limitation is that performances are not very impressive, to
+ say the least (32-bit DOS extenders perform usually three-time
+ faster).
+
+ Even with the large model, the rasterizer is still limited in
+ size, particularly with pixmaps (that is, with anti-aliasing gray
+ levels).
+
+ Another annoying limitation exists with some East Asian fonts that
+ have 16,383 glyphs or more, since an internal table then
+ overflows. We tried to overcome this using the so-called `huge
+ pointers', but then good support for these in the run-time library
+ is needed. To enable this support, try defining the `BIGFONTS'
+ symbol with the makefile, like using
+
+ nmake /f arch\msdos\makefile.MS BIGFONTS=1
+ make -farch/msdos/makefile.BC /DBIGFONTS
+ etc.
+
+ The Makefiles for both Microsoft and Borland compilers depend on a
+ special file, `arch/msdos/depend.dos', which is built by a Unix
+ script named `makedep'. You may consider editing it if you
+ heavily modify the source files; or better yet, re-run the script,
+ using any clone of the Bourne shell and gcc, the GNU compiler,
+ with
+
+ arch/msdos/makedep
+
+ in both the `lib' and the `test' directories.
+
+
+2. Turbo C v. 2.0x
+------------------
+
+ Unlike the precedent version 1.5 (!), Turbo C v.2.0 is not able to
+ compile C sources if they use the Unix convention for end-of-
+ line. So make sure either you use the .zip archive (where files
+ are stored with CR-LF), or if you use the .tar.gz version, the
+ program that does the transformation (WinZip can do it if
+ instructed, look after "CR/LF conversion for TAR").
+
+
+Good luck!
+
+
+--- end of msdos.txt ---
diff --git a/Build/source/libs/freetype/howto/os2.txt b/Build/source/libs/freetype/howto/os2.txt
new file mode 100644
index 00000000000..2ce5bab50b7
--- /dev/null
+++ b/Build/source/libs/freetype/howto/os2.txt
@@ -0,0 +1,200 @@
+ The FreeType OS/2 Compilation HowTo
+
+Contents
+
+Introduction
+I. Building the library
+ 1. Quick Compilation
+ 2. Manual compilation
+ 3. Notes
+II. Building other parts of the package
+ 1. Test programs
+ 2. Other contribs
+III. Troubleshooting
+
+
+
+Introduction
+============
+
+This file describes the compilation of the FreeType package on an
+OS/2 system. It comes with makefiles for the following compilers:
+
+ - gcc/emx with GNU make
+
+ - icc with nmake (Visual Age C++)
+
+ - wcc386 with wmake (Watcom -- tried with 10.6)
+
+ - gcc/emx with dmake
+
+
+NOTE:
+
+ You're advised to jump to section II.1 if you want to run the
+ FreeType test/demo programs as quick as possible.
+
+
+
+I. Building the library
+=======================
+
+
+1. Quick Compilation
+--------------------
+
+ The easiest way to compile the library on OS/2 is to go to the
+ directory `freetype/lib'. Then type, depending on your compiler,
+
+ gcc/emx: make -f arch/os2/makefile.emx
+ gcc/dmake: dmake -f arch/os2/makefile.dm
+
+ icc: nmake -f arch\os2\makefile.icc
+ wcc386: wmake -f=arch\os2\makefile.wat
+
+ This should build the `libttf.a' or `libttf.lib' library files.
+
+ You can also use the following targets:
+
+ debug - Makes a development version of the library. Only
+ useful for FreeType developers and hackers.
+
+ clean - Cleans all intermediate object files created during
+ compilation. Keeps all library and executables in
+ place.
+
+ distclean - Cleans everything, leaving the directories as they
+ were before the compilation.
+
+
+2. Manual compilation
+---------------------
+
+ Here are explained the steps that are required to compile the
+ FreeType _library_ (and only this one) by hand.
+
+ Unlike previous versions, FreeType 1.1 and above can be compiled
+ in two modes, called `debug mode' and `single object mode'.
+
+ Debug mode is simply the normal way of compiling C programs, i.e.,
+ each `*.c' file is compiled into an individual `*.obj' object
+ file, and all of them are linked together into an archive (i.e.,
+ `*.lib' library).
+
+ Single object mode is slightly different: all C files are included
+ in a single source during compilation, resulting in a single final
+ object file for the core library. This has the advantage of
+ letting optimizing compilers do more global work, as well as
+ getting rid of all external symbols which are used solely for the
+ purpose of components interfacing.
+
+ In both modes, you need to include the following paths to your
+ makefile/command line:
+
+ the location of all `tt*.[hc]' files
+ the location of system-specific files
+
+ For example, if you are compiling from the `freetype/lib'
+ directory, you can type for debug mode something like
+
+ gcc -c -I. -Iarch/os2 tt*.c arch/os2/os2file.c
+
+ to compile all required files into object ones. Then assemble
+ them in a library with `ar' or `implib'.
+
+ In single object mode, you only need to compile the file named
+ `freetype.c' which is located in `freetype/lib/arch/os2'. From
+ the same directory as before, one would type:
+
+ gcc -c -I. -Iarch/os2 arch/os2/freetype.c
+
+ You can also compile the extensions located in
+ `freetype/lib/extend' separately from the base engine. You will
+ need to include the same paths as before, though; be sure to add
+ the path to the `extend' directory, like in
+
+ gcc -c -I. -Iarch/os2 -Iextend extend/*.c
+
+
+
+II. Building other parts of the package
+=======================================
+
+
+1. Test programs
+----------------
+
+ The test programs are located in `freetype/test'. Most of them
+ use a tiny graphics sub-system which is simply used to display
+ bitmaps and pixmaps in a windows on a variety of platforms. The
+ OS/2 version comes in two flavors: PM and full-screen.
+
+ To compile them, you must be in the `freetype/test' directory, and
+ invoke the makefile in arch/os2. For example:
+
+ nmake -f arch\os2\makefile.os2
+
+
+ NOTE 1:
+
+ This will automatically invoke the library makefile for you!
+
+ NOTE 2:
+
+ The test programs come in two flavors, distinguished by the `fs'
+ suffix appended to their name. For example:
+
+ ftview (PM version)
+ ftviewfs (Full Screen version)
+
+ The full-screen version is there mainly for debugging purposes.
+
+ NOTE 3:
+
+ For now, the graphical test programs only run on the following
+ platforms: Unix, OS/2, Dos, Amiga, and Windows.
+
+ The library, being pure ANSI-C, can be used on any system to
+ generate bitmaps and pixmaps.
+
+
+2. Other contributions
+----------------------
+
+ You may find some other contributions to the FreeType project in
+ the `freetype/contrib' directory. Each of these programs should
+ have its own Makefiles and documentations. Also check their
+ licenses, as the programs not necessarily distributed under the
+ FreeType one. You are invited to port the non-OS/2 applications
+ to OS/2.
+
+ For OS/2, you will find the source code for the FreeType/2 font
+ driver in `freetype/contrib/os2'. Read its documentation
+ carefully before trying to compile it, as it certainly won't be
+ easy.
+
+
+
+III. Troubleshooting
+====================
+
+ There is only one important point on OS/2:
+
+ `The test program crashes with anti-aliasing on!'
+
+ It has been discovered that some versions of Visual Age C++
+ contain a bug which miscompiles the anti-aliasing source in
+ ttraster.c, hence resulting in a page fault when trying to render
+ a pixmap in the engine. Apparently, not all levels/versions of
+ the compiler contain the bug. You'll notice the problem
+ immediately (page fault :-).
+
+ Please apply the most recent fixpack to your Visual Age C++ copy
+ in order to get rid of it (newer fixpacks seem to solve the
+ issue).
+
+
+Good luck!
+
+
+--- end of os2.txt ---
diff --git a/Build/source/libs/freetype/howto/unix.txt b/Build/source/libs/freetype/howto/unix.txt
new file mode 100644
index 00000000000..ba97452dc77
--- /dev/null
+++ b/Build/source/libs/freetype/howto/unix.txt
@@ -0,0 +1,258 @@
+ The FreeType Unix Compilation HOWTO
+
+Contents
+
+Introduction
+I. Building the library
+ 1. Quick Compilation
+ 2. Manual compilation
+ 3. Notes
+II. Building other parts of the package
+ 1. Test programs
+ 2. Other contribs
+III. Successful Build Reports
+
+
+
+Introduction
+============
+
+This file describes the compilation of the FreeType package on a
+Unix system. Using the `configure' script it should be rather easy
+to build the library. However, detailed instructions on how to
+compile the library manually are given later in this document.
+
+
+
+I. Building the library
+=======================
+
+
+1. Quick Compilation
+--------------------
+
+ The easiest way to compile the library on a Unix system is by
+ using the `configure' script that comes with it. Simply go to the
+ root directory of the FreeType package, then type
+
+ ./configure
+
+ to run a script that will probe your system and detect various
+ configuration issues, which are explained later in this document.
+
+ From there, you can simply type
+
+ make
+
+ to invoke compilation of the whole package. You can also use the
+ following commands:
+
+ make debug - Make a development version of the library.
+ Only useful for FreeType developers and
+ hackers. The default build should come with
+ `-g' (i.e., debug info in the object file)
+ already.
+
+ make clean - Clean all intermediate object files created
+ during compilation. Keeps all library and
+ executables in place.
+
+ make distclean - Clean everything, leaving the directories as
+ they were before the compilation. You'll need
+ to run `./configure' again to be able to
+ re-build it.
+
+ make install - Install the library files libttf.a, libttf.la
+ or libttf.so to your system library path
+ (`/usr/local/lib' by default). The path can be
+ set manually with ./configure.
+
+ make uninstall - Undo a `make install'.
+
+ Note that the Makefile uses nested variables which causes problems
+ with BSD make. Use GNU make instead.
+
+
+2. Trouble-shooting and simple customization
+--------------------------------------------
+
+ The make build seems to fail on some Solaris systems. This is
+ mainly due to the fact that the test programs (not the font
+ library itself) try to use certain libraries and/or utilities if
+ they find them on your system. In some cases, the Sun versions
+ are incompatible to the GNU ones. If you encounter such problems,
+ please report them to us so we can try to fix it.
+
+ The configure script and makefiles that it generates can/make use
+ of the following things:
+
+ - gettext - In order to compile the internationalized error
+ message string extension, which isn't part of the
+ core library. You can disable this and get a
+ clean compile with
+
+ ./configure --disable-nls
+
+
+ - libtool - Used to generate shared libraries. You can
+ disable it by typing
+
+ ./configure --disable-shared
+
+ which will generate and link the FreeType engine
+ as a static library.
+
+ By default, static compilation is disabled if the
+ configure script detects that your compiler
+ and/or operating system supports shared
+ libraries. You can ask for static libraries with
+
+ ./configure --enable-static
+
+ For more configuration options, type `./configure --help' to see a
+ summary of what is possible. The option to change the library
+ installation path for `make install' is, as usual,
+ `--prefix=<path>'. Example:
+
+ ./configure --prefix=${HOME}/local/lib --disable-shared
+
+ to install a static library (libttf.a) in `~/local/lib' (after a
+ `make install')
+
+
+3. Manual compilation
+---------------------
+
+ Here are explained the steps that are required to compile the
+ FreeType _library_ (and only this one) by hand.
+
+ a. Generate a configuration file named `ft_conf.h'
+
+ This file contains a certain number of configuration macro
+ declarations which must fit your system. The configure script
+ generates it automatically for you, but you can also take the
+ template file `freetype/ft_conf.h.in' and change it by hand,
+ then save it as `freetype/ft_conf.h'.
+
+ b. Choose your compilation mode
+
+ Unlike previous versions, FreeType 1.1 and above can be compiled
+ in two modes, called `debug mode' and `single object mode'.
+
+ Debug mode is simply the normal way of compiling C programs,
+ i.e., each *.c file is compiled into an individual *.o object
+ file, and all of them are linked together into an archive (i.e.,
+ a *.a library).
+
+ Single object mode is slightly different: All C files are
+ included in a single source file during compilation, resulting
+ in a single final object file for the core library. This has
+ the advantage of letting optimizing compilers do more global
+ work, as well as getting rid of all external symbols which are
+ used solely for the purpose of components interfacing.
+
+ In both modes, you need to include the following paths to your
+ makefile/command line:
+
+ . the location of the `ft_conf.h' file
+ . the location of all `tt*.[hc]' files
+ . the location of system-specific files, i.e., `ttmmap.c' on
+ Unix.
+
+ For example, if you are compiling from the `freetype/lib'
+ directory, you can type for debug mode something like
+
+ gcc -c -I.. -I. -Iarch/unix tt*.c arch/unix/ttmmap.c
+
+ to compile all required files. Then assemble them in a library
+ with `ar' (and run `runlib' if necessary).
+
+ In single object mode, you only need to compile the file named
+ `freetype.c' which is located in `freetype/lib/arch/unix'. From
+ the same directory as before, one would type:
+
+ gcc -c -I.. -I. -Iarch/unix arch/unix/freetype.c
+
+ You can also compile the extensions located in
+ `freetype/lib/extend' separately from the base engine. You'll
+ need to include the same paths as before, though.
+
+
+
+II. Building other parts of the package
+=======================================
+
+
+1. Test programs
+----------------
+
+ All test programs are located in `freetype/test'. Most of them
+ use a tiny graphics sub-system which simply display bitmaps and
+ pixmaps in a windows on a variety of platforms. Of course, the
+ Unix version uses X11.
+
+ The default `make' builds all tests programs automatically. Just
+ go the `freetype/test' and launch the programs when you are there.
+ Documentation on the test programs can be found in the file
+ `freetype/README'.
+
+ NOTE:
+
+ For now, the graphical test programs only run on the following
+ platforms: Unix, OS/2, Dos, Amiga, and Windows.
+
+ The library, being pure ANSI-C, can be used on any system to
+ generate bitmaps and pixmaps.
+
+
+2. Other contributions
+----------------------
+
+ You may find some other contributions to the FreeType project in
+ the `freetype/contrib' directory. Each of these programs should
+ have their own makefiles and documentations. Also check their
+ licenses, as they are not necessarily distributed under the
+ FreeType one.
+
+
+
+III. Successful Build Reports
+=============================
+
+Nelson H. F. Beebe <beebe@math.utah.edu> and others report the
+following successfully builds (with gcc 2.8.1) of freetype-1.1 on
+
+ DEC Alpha 2100-5/250: OSF/1 3.2
+ HP 9000/735: HP-UX 10.01
+ Intel Pentium (200MHz MMX): Linux 2.0.30
+ SGI Challenge L: IRIX 5.3
+ Sun SPARC 20/512: Solaris 2.6
+ Sun SPARC Ultra-2: SunOS 5.5.1
+ IBM RS/6000: AIX 4.1
+
+Chances are good the the current release will build on the same
+machines and platforms.
+
+There are build problems reported on SunOs 4.x which have the form
+
+ ld: /usr/tmp/cca07291.o: assert pure-text failed:
+ reference to [offset] at f754 in /usr/tmp/cca07291.o
+
+This may be a compiler bug in gcc 2.8.1.
+
+You can work around by just building a static library with
+
+ ./configure --disable-shared --enable-static --disable-nls
+
+Maybe `make debug' will help here too (untested).
+
+Other successful builds:
+
+ Sun SPARC Solaris 2.5 with Sun C compiler+linker
+
+For updated build reports, please consult our web site:
+
+ http://www.freetype.org
+
+
+--- end of unix.txt ---
diff --git a/Build/source/libs/freetype/howto/windows.txt b/Build/source/libs/freetype/howto/windows.txt
new file mode 100644
index 00000000000..f777f816431
--- /dev/null
+++ b/Build/source/libs/freetype/howto/windows.txt
@@ -0,0 +1,349 @@
+ The FreeType Windows Compilation HowTo
+
+Contents
+
+Introduction
+I. Building the library
+ 1. Quick Compilation
+ 2. Manual compilation
+ 3. Building a DLL
+ 4. Notes
+II. Building other parts of the package
+ 1. Test programs
+ 2. Other contributions
+III. Special issues of 16-bit Windows
+
+
+
+Introduction
+============
+
+This file describes the compilation of the FreeType package on a
+Windows system. It comes with Makefiles for the following
+compilers:
+
+ - gcc/CygWin32 and gcc/MinGW32 with GNU make (32 bit)
+
+ - cl with nmake (16-bit and 32-bit Microsoft C and Visual C++)
+
+ - bcc with make (16-bit and 32-bit Borland C++ and also Borland
+ C++ builder)
+
+Throughout this file, we use `winXX' if it applies indifferently to
+both 16-bit and 32-bit versions. You should replace it with win16
+resp. win32, as applicable.
+
+NOTE:
+
+ You are advised to jump to section II.1 if you want to run the
+ FreeType test/demo programs as quick as possible.
+
+
+
+I. Building the library
+=======================
+
+
+1. Quick Compilation
+--------------------
+
+ The easiest way to compile the library on Windows is to go to the
+ directory `freetype/lib'. Then type, depending on your compiler:
+
+ gcc: make -f arch/win32/Makefile.gcc
+
+ cl: nmake /f arch\win16\Makefile.MS (for C/C++ 7)
+ cl: nmake /f arch\win16\Makefile.VC (for VC++ 16bit)
+ cl: nmake /f arch\win32\Makefile.CL (for VC++ 32bit)
+
+ bcc: make -farch/win16/Makefile.BC
+ bcc32: make -farch/win32/Makefile.BC
+
+ This should build the `libttf.a' or `libttf.lib' library files.
+ Of course, this assumes that your compiler is regularly installed.
+
+ You can also use the following targets:
+
+ depend - (for gcc only) Creates a file that lists the
+ dependancies. Useful for the developper.
+
+ clean - Cleans all intermediate object files created during
+ compilation. Keeps all library and executables in
+ place.
+
+ distclean - Cleans everything, leaving the directories as they
+ were before the compilation.
+
+ debug - Makes a development version of the library. Only
+ useful for FreeType developers and hackers.
+
+ Note that you can also select to use the `debugging' flags for
+ your compiler (instead of the `optimizing' ones), by defining
+ the `DEBUG' symbol, like in
+
+ nmake /f arch\win32\Makefile.CL DEBUG=1
+ make -farch/winXX/Makefile.BC /DDEBUG
+ etc.
+
+ Doing so will automatically select the debug target instead of
+ the normal mode.
+
+ For 16-bit compilers, you can also try to define the `BIGFONTS'
+ symbol, enabling the use of the `huge pointers' needed to handle
+ some big fonts. More on this at the end of this file.
+
+ Another way to compile the library is to use the IDE provided with
+ the following compilers: Borland C++ 4.x/5.0, Visual C++ 4.0, and
+ Visual Studio. The project/workspace files can be found in the
+ `freetype/lib/arch/win32' directory:
+
+ freetype.ide for Borland C++ 4.0, 4.5, and 5.0
+
+ freetype.dsp project and workspace files for
+ freetype.dsw Visual Studio
+ ft_dll.dsp (a.k.a. Visual C++ 5, 6, and 7)
+
+ freetype.mdp project and makefile files for
+ freetype.mak Visual C++ 4.0
+
+ They generate a static library, which contain the core engine as a
+ single object file, as well as all standard extensions.
+
+ Notes:
+
+ - You may need to update the include paths in the Borland C++
+ workspace settings. The current one looks in the directory
+ "C:\Program Files\Borland\BC 5.0\Include" for include files.
+
+ - Take care that some compilers may overwrite these files when
+ generating the library (e.g. Borland C++ creates its own
+ `freetype.dsw' file, which isn't a Visual C++ project during
+ compilation).
+
+ This is only important if you try to compile the lib with
+ several compilers.
+
+ We gladly accept project files for other compilers.
+
+
+2. Manual compilation
+---------------------
+
+ Here are explained the steps that are required to compile the
+ FreeType _library_ (and only this one) by hand.
+
+ Unlike previous versions, FreeType 1.1 and above can be compiled
+ in two modes, called `debug mode' and `single object mode'.
+
+ Debug mode is simply the normal way of compiling C programs, i.e.,
+ each `*.c' file is compiled into an individual `*.obj' object
+ file, and all of them are linked together into an archive (i.e.,
+ `*.lib' library).
+
+ Single object mode is slightly different: All C files are included
+ in a single source during compilation, resulting in a single final
+ object file for the core library. This has the advantage of
+ letting optimizing compilers do more global work, as well as
+ getting rid of all external which are used solely for the purpose
+ of components interfacing.
+
+ In both modes, you need to include the following paths to your
+ makefile/command line:
+
+ the location of all `tt*.[hc]' files
+ the location of system-specific files
+
+ For example, if you are compiling from the `freetype/lib'
+ directory, you can type for debug mode something like
+
+ gcc -c -I. -Iarch/win32 tt*.c
+
+ to compile all required files into object ones. Then assemble
+ them in a library with `ar', `lib', or `tlib'.
+
+ In single object mode, you only need to compile the file named
+ `freetype.c' which is located in `freetype/lib/arch/winXX'. From
+ the same directory as before, one would type
+
+ gcc -c -I. -Iarch/win32 arch/win32/freetype.c
+
+ You can also compile the extensions located in
+ `freetype/lib/extend' separately from the base engine. You will
+ need to include the same paths as before, though; be sure to add
+ the path to the `extend' directory, like in
+
+ gcc -c -I. -Iarch/win32 -Iextend extend/*.c
+
+
+3. Building a DLL
+-----------------
+
+ The easiest way to build the library as a DLL is also to use the
+ Makefiles we provide! Go to the directory `freetype/lib', then
+ type, depending on your compiler:
+
+ gcc: (not yet supported)
+
+ cl: nmake /f arch\win16\Makefile.VC DLL=1 dll (16bit)
+ cl: nmake /f arch\win32\Makefile.CL DLL=1 dll (32bit)
+
+ bcc: make -farch/win16/Makefile.BC -DDLL dll
+ bcc32: make -farch/win32/Makefile.BC -DDLL dll
+
+ This should build `ft15_XX.dll' (`15' for versions 1.5.*, `XX' is
+ either 16 or 32), and the `libttf.lib' library file.
+
+ You can also use the following target:
+
+ install - Install the DLL `ft15_XX.dll' to your system directory
+ (`C:\WINDOWS' by default). You can override the
+ directory by specifying the name of the directory:
+
+ make -farch/winXX/Makefile.BC /DINSTALL_DIR=C:\TESTDLL install
+ nmake /f arch\win32\Makefile.CL INSTALL_DIR=D:\WINNT install
+
+ Note that you can also select to use the `debugging' flags for
+ your compiler (instead of the `optimizing' ones), by defining
+ the `DEBUG' symbol, like in
+
+ nmake /f arch\win16\Makefile.VC DEBUG=1 DLL=1 dll
+ make -farch/winXX/Makefile.BC /DDEBUG /DDLL dll
+ etc.
+
+ Another way to build to DLL with Visual C++ is to use a special
+ Makefile that does exactly that, without relying on any settings.
+
+ With VC++ 6.0, just type while in the `freetype/lib/arch/win32'
+ directory:
+
+ nmake /f makefile.vc
+
+ on the command line.
+
+ For other versions, modify the $(TOOLS32) variable to point to the
+ directory where the build tools are. No need to set any
+ environment variables.
+
+
+4. Notes
+--------
+
+ `char' is always `signed char' in the sources!
+
+ `ttconfig.h' relies heavily on a file called `ft_conf.h' that
+ contains information related to the target platform, located in
+ the `freetype/lib/arch/winXX/' directory. Depending on your
+ compiler, you may need to slightly edit it.
+
+ We use gcc as our reference compiler for warnings. This means
+ that we use the `-ansi -pedantic -Wall' flags and try to get rid
+ of warnings in this situation. If you are compiling with another
+ compiler, you may encounter warnings, not errors. Note that the
+ Borland compilers seem to produce lots of irrelevant warnings
+ (like `potential loss of precision').
+
+
+
+II. Building other parts of the package
+=======================================
+
+
+1. Test programs
+----------------
+
+ All test programs are located in `freetype/test'. Most of them
+ use a tiny graphics sub-system which is simply used to display
+ bitmaps and pixmaps on a variety of platforms. The Windows
+ version is a very basic one that only displays a small graphic
+ windows in addition to the console where the flow of messages
+ still goes.
+
+ To compile them, you must be in the `freetype/test' directory and
+ invoke the makefile in arch/winXX. For example:
+
+ nmake -f arch\os2\Makefile.VC
+
+ NOTE 1:
+
+ This will automatically invoke the library makefile for you!
+
+ NOTE 2:
+
+ For now, the graphical test programs only run on the following
+ platforms: Unix, OS/2, Dos, Amiga, and Windows.
+
+ The library, being pure ANSI-C, can be used on any system to
+ generate bitmaps and pixmaps.
+
+
+2. Other contributions
+----------------------
+
+ You may find some other contributions to the FreeType project in
+ the `freetype/contrib' directory. Each of these programs should
+ have its own Makefiles and documentations. Also check their
+ licenses, as the programs are not necessarily distributed under
+ the FreeType one.
+
+ Most of these contributions are targeted to Unix. You are invited
+ to port them to Windows, and then contribute your improvements.
+
+
+
+III. Special issues of 16-bit Windows
+=====================================
+
+ As usual, 16-bit Windows have some limitations.
+
+ First, and mainly, only the large model is usable. The small and
+ medium models are not usable, because the library uses more than
+ 64kByte of data; and the compact model is unusable as well, since
+ the code of the library itself is slightly less than 64kByte, thus
+ leaving very small place for the real work. The net effect of
+ that limitation is that performances are not very impressive, to
+ say the least (32-bit DOS extenders perform usually three-time
+ faster).
+
+ Even with the large model, the rasterizer is still limited in
+ size, particularly with pixmaps (that is, with anti-aliasing gray
+ levels).
+
+ The test programs rely on a tiny graphical driver that mimics the
+ ones available on other platforms. It has some peculiarities.
+ First, as the test programs need a `console', the programs should
+ linked with some emulation of that concept. We used successfully
+ Borland EasyWin and Microsoft QuickWin for this purpose. Then,
+ the graphics window that displays the bitmaps incur the usual
+ 64kByte limit: The size of the window is quite tiny, particularly
+ when displaying `gray-level' bitmaps (the size is then 320x200,
+ but contrary to full-screen MS-DOS the pixels are not magnified).
+ Ultimately, no efforts have been done to accomodate the colors of
+ the screen: As a result, displaying gray bitmaps in 256-color mode
+ uses only 4 levels of gray (instead of 5 rendered by the library).
+
+ Another annoying limitation exists with some East Asian fonts that
+ have 16,383 glyphs or more, since an internal table then
+ overflows. We tried to overcome this using so-called `huge
+ pointers', but then good support for these in the run-time library
+ is needed. To enable huge pointers, try defining the `BIGFONTS'
+ symbol with the makefile, like
+
+ nmake /f arch\win16\makefile.VC BIGFONTS=1
+ make -farch/win16/makefile.BC /DBIGFONTS
+ etc.
+
+ The makefiles for both Microsoft and Borland compilers depend on a
+ special file, arch/winXX/depend.win, which is built by a Unix
+ script named `makedep'. You may consider editing it if you
+ heavily modify the source files; or better yet, re-run the script,
+ using any clone of the Bourne shell, sed, and gcc, the GNU
+ compiler, with
+
+ arch/winXX/makedep
+
+ in both the `lib' and the `test' directories.
+
+
+Good luck!
+
+--- end of windows.txt ---
diff --git a/Build/source/libs/freetype/install-sh b/Build/source/libs/freetype/install-sh
new file mode 100755
index 00000000000..ebc66913e94
--- /dev/null
+++ b/Build/source/libs/freetype/install-sh
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/Build/source/libs/freetype/lib/.cvsignore b/Build/source/libs/freetype/lib/.cvsignore
new file mode 100644
index 00000000000..e61a727f46f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/.cvsignore
@@ -0,0 +1,3 @@
+.libs
+*.lo
+libttf.la
diff --git a/Build/source/libs/freetype/lib/.cvsignore.delete b/Build/source/libs/freetype/lib/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/.cvsignore.delete
diff --git a/Build/source/libs/freetype/lib/arch/amigaos/Makefile.gcc b/Build/source/libs/freetype/lib/arch/amigaos/Makefile.gcc
new file mode 100644
index 00000000000..d91dde3d291
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/amigaos/Makefile.gcc
@@ -0,0 +1,77 @@
+# This file builds the library for Amiga using ADE environment.
+#
+# You will need GNU make.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# make -f arch/amigaos/Makefile.gcc
+#
+#
+# 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.
+
+ARCH = arch/amigaos
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+AR = ar
+RM = rm
+
+CC = gcc
+
+CFLAGS = -Wall -pedantic -ansi -O2 -g -noixemul -I$(ARCH) -I. -Iextend
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
+ extend/ftxopen.c extend/ftxerr18.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttextend.c ttfile.c ttgload.c ttinterp.c ttload.c \
+ ttmemory.c ttmutex.c ttobjs.c ttraster.c
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+
+libttf.a: $($(LIB_FILES))
+ $(AR) src $@ $^
+
+clean:
+ $(RM) $($(LIB_FILES))
+
+distclean: clean
+ $(RM) dep.end libttf.a
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) -E -MM -I$(ARCH) -I. -Iextend $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/lib/arch/amigaos/freetype.c b/Build/source/libs/freetype/lib/arch/amigaos/freetype.c
new file mode 100644
index 00000000000..723c8f463ce
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/amigaos/freetype.c
@@ -0,0 +1,25 @@
+/* This file is part of the FreeType project */
+
+/* Single object library component for AmigaOS */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttfile.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttmemory.c"
+#include "ttmutex.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/amigaos/ft_conf.h b/Build/source/libs/freetype/lib/arch/amigaos/ft_conf.h
new file mode 100644
index 00000000000..fef44662e75
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/amigaos/ft_conf.h
@@ -0,0 +1,212 @@
+/*******************************************************************
+ *
+ * ft_conf.h for AmigaOS using ADE environment
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+#define HAVE_LOCALE_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/amigaos/smakefile b/Build/source/libs/freetype/lib/arch/amigaos/smakefile
new file mode 100644
index 00000000000..533c75195b4
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/amigaos/smakefile
@@ -0,0 +1,126 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for amiga using SAS/C and smake
+#
+# Use this file while in the 'lib/arch/amigaos' directory with
+# the following statements:
+#
+# smake assign
+# smake
+#
+# the 'assign' step creates an assignment to simplify referencing
+# the core library module, as smake has quite a few limitations in
+# dealing with multi-directory projects.
+#
+#
+# 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.
+
+OBJB = ttapi.o ttcache.o ttcalc.o ttcmap.o ttdebug.o \
+ ttextend.o ttfile.o ttgload.o ttinterp.o ttload.o \
+ ttmemory.o ttmutex.o ttobjs.o ttraster.o
+
+OBJS = freetype.o
+
+OBJX = ftxgasp.o ftxkern.o ftxpost.o ftxcmap.o ftxwidth.o \
+ ftxsbit.o ftxgsub.o ftxgpos.o ftxgdef.o ftxopen.o
+
+CORE = FT:lib/
+COREXT = $(CORE)extend/
+
+OPTIMIZER = optimize optcomp=5 optdep=4 optinlocal optrdep=4
+
+SCFLAGS = idlen=40 idir=$(CORE)arch/amigaos idir=$(CORE) idir=$(COREXT)
+
+LIB=ttf.lib
+
+all: ttf.lib
+
+assign:
+ assign FT: ///
+
+ttf.lib: $(OBJS) $(OBJX)
+ oml $@ r $(OBJS) $(OBJX)
+
+ttfdbg.lib: $(OBJB) $(OBJX)
+ oml $@ r $(OBJB) $(OBJX)
+
+clean:
+ -delete \#?.o
+ -delete //\#?.o
+
+distclean: clean
+ -delete \#?.lib
+
+
+#
+# freetype library core single object
+#
+freetype.o: $(CORE)arch/amigaos/freetype.c
+ sc $(SCFLAGS) code=far $(OPTIMIZER) objname=$@ $<
+
+#
+# freetype library core as separate objects
+#
+ttapi.o: $(CORE)ttapi.c
+ sc $(SCFLAGS) objname=$@ $<
+ttcache.o: $(CORE)ttcache.c
+ sc $(SCFLAGS) objname=$@ $<
+ttcalc.o: $(CORE)ttcalc.c
+ sc $(SCFLAGS) objname=$@ $<
+ttcmap.o: $(CORE)ttcmap.c
+ sc $(SCFLAGS) objname=$@ $<
+ttdebug.o: $(CORE)ttdebug.c
+ sc $(SCFLAGS) objname=$@ $<
+ttextend.o: $(CORE)ttextend.c
+ sc $(SCFLAGS) objname=$@ $<
+ttfile.o: $(CORE)ttfile.c
+ sc $(SCFLAGS) objname=$@ $<
+ttgload.o: $(CORE)ttgload.c
+ sc $(SCFLAGS) objname=$@ $<
+ttinterp.o: $(CORE)ttinterp.c
+ sc $(SCFLAGS) objname=$@ $<
+ttload.o: $(CORE)ttload.c
+ sc $(SCFLAGS) objname=$@ $<
+ttmemory.o: $(CORE)ttmemory.c
+ sc $(SCFLAGS) objname=$@ $<
+ttmutex.o: $(CORE)ttmutex.c
+ sc $(SCFLAGS) objname=$@ $<
+ttobjs.o: $(CORE)ttobjs.c
+ sc $(SCFLAGS) objname=$@ $<
+ttraster.o: $(CORE)ttraster.c
+ sc $(SCFLAGS) objname=$@ $<
+
+#
+# library extentions
+#
+ftxgasp.o: $(COREXT)ftxgasp.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxkern.o: $(COREXT)ftxkern.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxpost.o: $(COREXT)ftxpost.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxcmap.o: $(COREXT)ftxcmap.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxwidth.o: $(COREXT)ftxwidth.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxerr18.o: $(COREXT)ftxerr18.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxsbit.o: $(COREXT)ftxsbit.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxgsub.o: $(COREXT)ftxgsub.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxgpos.o: $(COREXT)ftxgpos.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxgdef.o: $(COREXT)ftxgdef.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxopen.o: $(COREXT)ftxopen.c
+ sc $(SCFLAGS) objname=$@ $<
+
+# end of smakefile
diff --git a/Build/source/libs/freetype/lib/arch/ansi/freetype.c b/Build/source/libs/freetype/lib/arch/ansi/freetype.c
new file mode 100644
index 00000000000..820687a1533
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/ansi/freetype.c
@@ -0,0 +1,32 @@
+/* This file is part of the FreeType project */
+
+/* Single file library component for the ANSI target */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#include "ttfile.c"
+#include "ttmemory.c"
+#include "ttmutex.c"
+
+/* the extensions are compiled separately, but we need to */
+/* include the file ttextend.c if we want to support them */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/ansi/ft_conf.h b/Build/source/libs/freetype/lib/arch/ansi/ft_conf.h
new file mode 100644
index 00000000000..011ee118f17
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/ansi/ft_conf.h
@@ -0,0 +1,245 @@
+/*******************************************************************
+ *
+ * ft_conf.h for the `bare ANSI' build
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Some systems (read: M$-DOS/Windows command.com) can't pipe stderr */
+/* into a file; so we redirect any message into stdout. */
+#define HAVE_PRINT_FUNCTION 1
+
+#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
+
+
+/* The number of bytes in a int. We use the ANSI header file limits.h */
+/* for determining it since there is no easy way to guess. */
+/* */
+#include <limits.h>
+#if UINT_MAX == 0xFFFF
+#define SIZEOF_INT 2
+#elif UINT_MAX == 0xFFFFFFFF
+#define SIZEOF_INT 4
+#else
+#error "Unsupported number of bytes in `int' type!"
+#endif
+
+/* We now try to guess the size of longs in the same way */
+/* */
+#if ULONG_MAX == 0xFFFFFFFF
+#define SIZEOF_LONG 4
+#elif ULONG_MAX == 0xFFFFFFFFFFFFFFFF
+#define SIZEOF_LONG 8
+#else
+#error "Unsupported number of bytes in `long' type!"
+#endif
+
+/* Define if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+#define HAVE_LOCALE_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#define TT_CONFIG_OPTION_STATIC_RASTER
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available. */
+/* INT64 must then be defined to this type. */
+#define LONG64
+#define INT64 long
+
+#elif defined( __STDC_VERSION__ ) && ( __STDC_VERSION__ >= 199901L )
+
+/* `long long' was officially introduced in the C99 standard. */
+/* Purists will note that the defined() test above is unnecessary */
+/* (according to the standard, undefined macros in #if expressions */
+/* default to 1), but we don't rely on this, and since it is easy */
+/* to avoid problems... */
+/* If your compiler complains a lot about possible ANSI violations */
+/* because of this setting, report this as a bug to the compiler */
+/* vendor. */
+#define LONG64
+#define INT64 long long
+
+#else
+
+/* GCC provides the non-ANSI89 'long long' 64-bit type. You can */
+/* activate it by defining the TT_USE_LONG_LONG macro. Note that */
+/* this will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/beos/Makefile b/Build/source/libs/freetype/lib/arch/beos/Makefile
new file mode 100644
index 00000000000..d0403a56fef
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/beos/Makefile
@@ -0,0 +1,102 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for BeOS with gcc.
+#
+# You will need GNU make.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# make -f arch/beos/Makefile.gcc
+#
+# If you have the GNU gettext package installed, you can also try
+#
+# make -f arch/beos/Makefile.gcc HAVE_GETTEXT
+#
+#
+# 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.
+
+ARCH = arch/beos
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+CC = gcc
+
+ifndef GETTEXT
+GETTEXT=NO_GETTEXT
+endif
+
+ifdef DEBUG
+CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend -D$(GETTEXT)
+else
+CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend -D$(GETTEXT)
+endif
+
+
+TTFILE = ./ttfile.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = $(ARCH)/ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
+ extend/ftxopen.c extend/ftxerr18.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M DEBUG=1 libttf.a
+
+HAVE_GETTEXT:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S GETTEXT=HAVE_GETTEXT \
+ libttf.a
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+libttf.a: $($(LIB_FILES))
+ -del $@
+ ar src $@ $^
+
+clean:
+ -del *.o
+ -del extend\*.o
+ -del $(ARCH)\*.o
+ -del response
+
+distclean: clean
+ -del dep.end
+ -del libttf.a
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) -E -MM -I$(ARCH) -I. -Iextend $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/lib/arch/beos/freetype.c b/Build/source/libs/freetype/lib/arch/beos/freetype.c
new file mode 100644
index 00000000000..a08c39b44b3
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/beos/freetype.c
@@ -0,0 +1,32 @@
+/* This file is part of the FreeType project */
+
+/* Single file library component for the ANSI target */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#include "ttfile.c"
+#include "ttmemory.c"
+#include "arch/beos/ttmutex.c"
+
+/* the extensions are compiled separately, but we need to */
+/* include the file ttextend.c if we want to support them */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/beos/ft_conf.h b/Build/source/libs/freetype/lib/arch/beos/ft_conf.h
new file mode 100644
index 00000000000..758126de897
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/beos/ft_conf.h
@@ -0,0 +1,214 @@
+/*******************************************************************
+ *
+ * ft_conf.h for BeOS
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+#ifndef BEOS
+#define BEOS
+#endif
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+#define HAVE_LOCALE_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#define TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#define TT_USE_LONG_LONG
+
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
diff --git a/Build/source/libs/freetype/lib/arch/beos/ttmutex.c b/Build/source/libs/freetype/lib/arch/beos/ttmutex.c
new file mode 100644
index 00000000000..2df23d34161
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/beos/ttmutex.c
@@ -0,0 +1,150 @@
+/*******************************************************************
+ *
+ * ttmutex.c 1.0
+ *
+ * Mutual exclusion object, BeOS implementation
+ *
+ * Copyright 1999-2001 by
+ * Catharon Productions, Inc.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include "ttmutex.h"
+
+#include <kernel/OS.h>
+#include <support/SupportDefs.h>
+#include <stdio.h>
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_mutex
+
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+
+/* New and improved BeOS mutex in the form of a "benaphore". */
+
+typedef struct
+{
+ sem_id _sem;
+ int32 _atom;
+} beos_mutex_t;
+
+/* Counter so the semaphores have unique names; access this with */
+/* atomic_*() functions only! */
+
+static int32 _mutex_counter = 0;
+
+/* Allocate and initialize the mutex. */
+
+FT_INTERNAL_FUNC( void )
+TT_Mutex_Create( TMutex* mutex )
+{
+ beos_mutex_t* m = NULL;
+
+
+ m = (beos_mutex_t *)malloc( sizeof( beos_mutex_t ) );
+ if ( m )
+ {
+ char mutex_name[B_OS_NAME_LENGTH];
+ int32 prev = atomic_add( &_mutex_counter, 1 );
+
+
+ sprintf( mutex_name, "FreeType mutex (%d)", (int)prev );
+
+ m->_atom = 0;
+ m->_sem = create_sem( 0, mutex_name );
+
+ if ( m->_sem < B_NO_ERROR )
+ {
+ /* Can't get a semaphore, so we're screwed. */
+ free( m );
+ m = NULL;
+ }
+ }
+
+ /* Send back the new mutex. */
+ *mutex = (TMutex)m;
+}
+
+
+/* Delete a mutex. */
+
+FT_INTERNAL_FUNC( void )
+TT_Mutex_Delete( TMutex* mutex )
+{
+ if ( mutex )
+ {
+ beos_mutex_t* m = (beos_mutex_t *)*mutex;
+
+
+ if ( m->_sem >= B_NO_ERROR )
+ {
+ status_t retval = delete_sem( m->_sem );
+
+
+ /* Make the compiler shut up... */
+ retval = retval;
+ }
+
+ free( m );
+ }
+}
+
+
+/* Attempt to lock a mutex; blocks until we can lock it or the semaphore */
+/* is destroyed. */
+
+FT_INTERNAL_FUNC( void )
+TT_Mutex_Lock( TMutex* mutex )
+{
+ int32 prev = 0;
+ beos_mutex_t* m = (beos_mutex_t *)*mutex;
+
+
+ if ( !mutex )
+ return;
+
+ prev = atomic_add( &(m->_atom), 1 );
+ if ( prev > 0 )
+ {
+ status_t retval = acquire_sem( m->_sem );
+
+
+ /* Make the compiler shut up... */
+ retval = retval;
+ }
+}
+
+
+/* Release a mutex. */
+
+FT_INTERNAL_FUNC( void )
+TT_Mutex_Release( TMutex* mutex )
+{
+ int32 prev = 0;
+ beos_mutex_t* m = (beos_mutex_t *)*mutex;
+
+
+ if ( !mutex )
+ return;
+
+ prev = atomic_add( &(m->_atom), -1 );
+ if ( prev > 1 ) {
+ status_t retval = release_sem( m->_sem );
+
+ /* Make the compiler shut up... */
+ retval = retval;
+ }
+}
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/debugger/Makefile b/Build/source/libs/freetype/lib/arch/debugger/Makefile
new file mode 100644
index 00000000000..9d361a78176
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/debugger/Makefile
@@ -0,0 +1,107 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc under OS/2 or under
+# Unix with extra debugging capabilities.
+#
+# You will need GNU make.
+#
+# Use this file while in the lib directory with the following statements:
+#
+# make -f arch/debugger/Makefile depend
+# make -f arch/debugger/Makefile
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/debugger
+FT_MAKEFILE = $(ARCH)/Makefile
+
+CC = gcc
+
+#CFLAGS = -W -Wall -O0 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
+
+CFLAGS = -Wall -O0 -g -ansi -I$(ARCH) -I. -Iextend
+
+#CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend
+
+# Detect OS/2 to add the flag -DOS2 when compiling ttinterp.c
+#
+ifdef OS2_SHELL
+OS := OS2
+RM := del
+else
+OS := UNIX # Unix build otherwise
+RM := rm -f
+endif
+
+TTFILE = ./ttfile.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = ./ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
+ extend/ftxgdef.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+# We place the library file in the ARCH directory, so that it doesn't
+# interfere with the normal build.
+#
+LIBTTF_A = $(ARCH)/libttf.a
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $< -D$(OS)
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S $(LIBTTF_A)
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M $(LIBTTF_A)
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+$(LIBTTF_A): $($(LIB_FILES))
+ -$(RM) $@
+ ar src $@ $^
+
+clean:
+ifdef OS2_SHELL
+ -$(RM) $(subst /,\,$(LIBTTF_A))
+ -$(RM) $(subst /,\,$(OBJS_S))
+else
+ -$(RM) $(LIBTTF_A)
+ -$(RM) $(OBJS_S)
+endif
+
+distclean: clean
+ -$(RM) dep.end
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) $(CFLAGS) -E -MM -I$(ARCH) -I. -Iextend $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/lib/arch/debugger/freetype.c b/Build/source/libs/freetype/lib/arch/debugger/freetype.c
new file mode 100644
index 00000000000..b431cdfadc5
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/debugger/freetype.c
@@ -0,0 +1,32 @@
+/* This file is part of the FreeType project */
+
+/* Single file library component for the debugging target */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#include "ttfile.c"
+#include "ttmemory.c"
+#include "ttmutex.c"
+
+/* the extensions are compiled separately, but we need to */
+/* include the file ttextend.c if we want to support them */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/debugger/ft_conf.h b/Build/source/libs/freetype/lib/arch/debugger/ft_conf.h
new file mode 100644
index 00000000000..6673dd960e4
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/debugger/ft_conf.h
@@ -0,0 +1,249 @@
+/*******************************************************************
+ *
+ * ft_conf.h for a debugging build
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* command.com can't pipe stderr into a file; so any message will */
+/* be redirected into stdout (which is manageable). */
+#define HAVE_PRINT_FUNCTION 1
+
+#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
+
+
+/* The number of bytes in a int. We use the ANSI header file limits.h */
+/* for determining it since there is no easy way to guess. */
+/* */
+#include <limits.h>
+#if UINT_MAX == 0xFFFF
+#define SIZEOF_INT 2
+#elif UINT_MAX == 0xFFFFFFFF
+#define SIZEOF_INT 4
+#else
+#error "Unsupported number of bytes in `int' type!"
+#endif
+
+/* We now try to guess the size of longs in the same way */
+/* */
+#if ULONG_MAX == 0xFFFFFFFF
+#define SIZEOF_LONG 4
+#elif ULONG_MAX == 0xFFFFFFFFFFFFFFFF
+#define SIZEOF_LONG 8
+#else
+#error "Unsupported number of bytes in `long' type!"
+#endif
+
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+#define HAVE_LOCALE_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+/* */
+/* The debugger is useless (and can't be compiled) without the bytecode */
+/* interpreter. But we require TT_CONFIG_OPTION_BYTECODE_INTERPRETER to */
+/* be passed explicitly to avoid disputes with the lawyers. */
+
+/* #undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+/* */
+/* For debugging, we use a jump table; this allows some interesting */
+/* things during development. */
+
+#undef TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a `static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine. */
+/* */
+/* We use a static interpreter in the debugger; this helps in setting */
+/* data breakpoints to fixed memory addresses. */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+/* an extra for the debugger */
+#define DEBUG_INTERPRETER
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode. */
+/* Set to DEBUG_LEVEL_TRACE for the debugger. */
+#define DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+/* Note that contrary to the `ansi' target, there is no test against C99 */
+/* here, because we really want to control whether we use 64-bit type or */
+/* not. So you have to use TT_USE_LONG_LONG to use it on a 32-bit machine. */
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/mac/README b/Build/source/libs/freetype/lib/arch/mac/README
new file mode 100644
index 00000000000..80334869bdd
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/mac/README
@@ -0,0 +1,47 @@
+
+This is the readme of the freetype.hqx archive in the contrib/mac
+subdirectory. Please note that the FreeType team does *not* support the
+Macintosh platform due to lack of knowledge. All questions regarding the
+code should be sent to both David Williss and the freetype-devel list.
+
+
+----------------------------------------------------------------------------
+
+
+These are CodeWarrior projects for building the FreeType library on a Macintosh
+I've only provided PPC projects here, but building for 68K shouldn't be hard.
+There are two directories here (OK, "folders"). One contains a project for
+building freetype.ppc.lib and the other is for freetype.ppc.dll. (I havn't
+actually tested the DLL yet.)
+
+The Macintosh stores TrueType fonts in a "Fonts" folder under the "System"
+folder. There is a standard MacOS API for finding this folder, so I use it.
+However, the fonts aren't normal flat files. They have all the data in
+resources in the resource fork. Each font is an 'sfnt' resource, and each
+file can have more than one 'sfnt' resource.
+
+To get at them, I made a copy of ttmmap.c from the Unix implementation and
+modified it to load/release the resource and lock/unlock the handle as needed.
+This only required a change to the open and close functions. After that, it
+works just as if it was using Unix memory mapping.
+
+One thing however. Because of the bizarre scheme for storing the fonts, I
+made up a way of specifying the font filename.
+
+ fonts:/fontfile/fontname
+
+Where fonts:/ is a literal string that means "the fonts folder", fontfile is
+the name of the actual file and fontname is the name of the 'sfnt' resource.
+Currently, this is the only thing it understands. It might be nice if some
+day (2.0 maybe?) ttfile.c and ttmmap.c wern't mutialy exclusive and it could
+decide which method to use based on the filename or something.
+
+Another thing that I had to change to make this work. It seems that Macintosh
+TrueType fonts have no OS/2 table, so ttload.c needs to be modified to make
+that nonfatal, at least on a Macintosh.
+
+---
+
+David Williss
+MicroImages, Inc.
+dwilliss@microimages.com
diff --git a/Build/source/libs/freetype/lib/arch/mac/freetype.c b/Build/source/libs/freetype/lib/arch/mac/freetype.c
new file mode 100644
index 00000000000..66af7f1f7aa
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/mac/freetype.c
@@ -0,0 +1,44 @@
+/* This file is *not* part of the FreeType project, because the team */
+/* lacks the necessary expertise to support it. */
+
+/* freetype.c for MacOS */
+/* single object library component for MacOS */
+
+/* Written by Dave Willis <dwilliss@microimages.com> on 1998-07-30. */
+/* Modified by Antoine Leca for the 1.3 release, but untested. */
+
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* Note, you should define the FT_EXPORT_xxx macros here if you want */
+/* special builds. See 'ttconfig.h' for details. */
+
+
+/* first include common core components */
+
+#define MAC_MAIN_OBJECT
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#include "ttmmap.c" /* Was "ttfile.c" */
+#include "ttmemory.c"
+#include "ttmutex.c"
+
+/* finally, add some extensions */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/mac/ft_conf.h b/Build/source/libs/freetype/lib/arch/mac/ft_conf.h
new file mode 100644
index 00000000000..1507fd882cf
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/mac/ft_conf.h
@@ -0,0 +1,198 @@
+/* This file is *not* part of the FreeType project, because the team */
+/* lacks the necessary expertise to support it. */
+
+/* ft_conf.h for MacOS */
+
+/* Written by Dave Willis <dwilliss@microimages.com> on 1998-07-30. */
+/* Modified by Antoine Leca for the 1.3 release, but untested. */
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the 'const' keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/mac/ttmmap.c b/Build/source/libs/freetype/lib/arch/mac/ttmmap.c
new file mode 100644
index 00000000000..8f5ee998636
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/mac/ttmmap.c
@@ -0,0 +1,1072 @@
+/*******************************************************************
+ *
+ * ttmmap.c 2.0
+ *
+ * Memory-Mapped file component ( replaces ttfile.c ).
+ *
+ * Copyright 1996-2001 by David Williss,
+ * 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.
+ *
+ * Changes between 2.0 and 1.3 :
+ *
+ * - adopted new design/separation introduced in ttfile.c 2.0
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include <folders.h>
+#include <resources.h>
+
+
+#include "freetype.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttengine.h"
+#include "ttmutex.h"
+#include "ttmemory.h"
+#include "ttfile.h" /* our prototypes */
+
+ /* This definition is mandatory for each file component! */
+ FT_EXPORT_VAR( const TFileFrame )
+ TT_Null_FileFrame = { NULL, 0, 0 };
+
+ /* It has proven useful to do some bounds checks during */
+ /* development phase. Define DEBUG_FILE when compiling */
+ /* this component to enable them. */
+
+#ifdef DEBUG_FILE
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ if ( frame.cursor+n > frame.address + frame.size ) \
+ Panic( "Frame boundary error!\n" ); \
+ } while ( 0 )
+#else
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ } while( 0 )
+#endif
+
+ struct _TFileMap
+ {
+ String* base; /* base address of mapped file */
+ Int refcount; /* reference count for handle region */
+ Long size; /* stream size in file */
+ Long offset; /* offset in file */
+ Handle handle; /* Macintosh style handle to lock/unlock */
+ short resid; /* Id of resource file to close when done */
+ };
+
+ typedef struct _TFileMap TFileMap;
+
+#define MAP_Address( map ) (Byte*)( (map)->base + (map)->offset )
+
+ /* The stream record structure */
+ typedef struct _TStream_Rec
+ {
+ TFileMap* map; /* mapped file description */
+ Long pos ; /* cursor in mapped file */
+ } TStream_Rec;
+
+ typedef TStream_Rec* PStream_Rec;
+
+#define STREAM2REC( x ) ( (TStream_Rec*)HANDLE_Val( x ) )
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /**** ****/
+ /**** N O N R E E N T R A N T I M P L E M E N T A T I O N ****/
+ /**** ****/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+ /* The TFile_Component structure holds all the data that was */
+ /* previously declared static or global in this component. */
+ /* */
+ /* It is accessible through the 'engine.file_component' */
+ /* variable in re-entrant builds, or directly through the */
+ /* static 'files' variable in other builds. */
+
+ struct _TFile_Component
+ {
+ TMutex lock; /* used by the thread-safe build only */
+ PStream_Rec stream; /* current stream */
+ TFileFrame frame; /* current frame */
+ };
+
+ typedef struct _TFile_Component TFile_Component;
+
+/* The macro CUR_Stream denotes the current input stream */
+/* Note that for the re-entrant version, the 'stream' name has been */
+/* chosen according to the macro STREAM_ARGS. */
+
+/* The macro CUR_Frame denotes the current file frame */
+/* Note that for the re-entrant version, the 'frame' name has been */
+/* chosen according to the macro FRAME_ARGS. */
+
+/* The macro STREAM_VAR is used when calling public functions */
+/* that need an 'optional' stream argument. */
+
+#define CUR_Stream files.stream /* thread-safe macros */
+#define CUR_Frame files.frame
+
+#define STREAM_VARS /* void */
+#define STREAM_VAR /* void */
+
+ /* the 'files' variable is only defined in non-reentrant builds */
+
+ static TFile_Component files;
+
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ MUTEX_Create( files.lock );
+ files.stream = NULL;
+ ZERO_Frame( files.frame );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ MUTEX_Destroy( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Copies or duplicates a given stream.
+ *
+ * Input : org_stream original stream
+ * stream target stream (copy or duplicate)
+ *
+ * Output : Error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream org_stream,
+ TT_Stream* stream )
+ {
+ MUTEX_Lock( files.lock );
+ *stream = org_stream;
+ files.stream = STREAM2REC( org_stream ); /* set current stream */
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream
+ *
+ * Output : Error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ HANDLE_Set( *stream, NULL );
+ MUTEX_Release( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+#else /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /******** ********/
+ /******** R E E N T R A N T I M P L E M E N T A T I O N ********/
+ /******** ********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+#define CUR_Stream STREAM2REC( stream ) /* re-entrant macros */
+#define CUR_Frame (*frame)
+
+#define STREAM_VARS stream,
+#define STREAM_VAR stream
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ engine.file_component = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Copies or duplicates a given stream.
+ *
+ * Input : org_stream original stream
+ * stream target stream (copy or duplicate)
+ *
+ * Output : Error code. The output stream is set to NULL in
+ * case of Failure.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream input_stream,
+ TT_Stream* copy )
+ {
+ TT_Error error;
+ PStream_Rec stream_rec;
+ PStream_Rec copy_rec;
+
+
+ stream_rec = STREAM2REC( input_stream );
+
+ if ( ALLOC( copy_rec, sizeof ( TStream_Rec ) ) )
+ goto Fail;
+
+ HANDLE_Set( *copy, copy_rec );
+
+ copy_rec->map->refcount++;
+ copy_rec->pos = 0;
+
+ return TT_Err_Ok;
+
+ Fail:
+ HANDLE_Set( *copy, NULL );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream
+ *
+ * Output : error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ return TT_Close_Stream( stream );
+ }
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*********** ***********/
+ /*********** C O M M O N I M P L E M E N T A T I O N ***********/
+ /*********** ***********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : AllocateMap
+ *
+ * Description : Allocates a new map from the table.
+ *
+ * Output : Pointer to new stream rec. NULL in case of failure.
+ *
+ ******************************************************************/
+
+ static TFileMap*
+ Allocate_Map( void )
+ {
+ TFileMap* result;
+
+
+ if ( MEM_Alloc( result, sizeof ( TFileMap ) ) )
+ return NULL;
+
+ result->refcount = 1;
+ return result;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : ReleaseMap
+ *
+ * Description : Releases a used map to the table if reference i
+ * counter reaches zero.
+ *
+ * Input : map
+ *
+ * Output : None.
+ *
+ * Note : Called by TT_Close_File()
+ *
+ ******************************************************************/
+
+ static void
+ Release_Map ( TFileMap* map )
+ {
+ map->refcount--;
+ if ( map->refcount <= 0 )
+ {
+ /* MacOS System calls */
+ HUnlock(map->handle);
+ ReleaseResource(map->handle);
+ CloseResFile(map->resid);
+
+ FREE( map );
+ }
+ }
+
+
+/* Whadda ya mean "strdup undefined"? Fine, I'll define my own! */
+ static char *
+ mystrdup( const char *str )
+ {
+ char *ret;
+
+ if ( TT_Alloc(strlen(str) + 1, (void**)&ret) != 0 ) return(NULL);
+ strcpy(ret, str);
+ return(ret);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Open_Stream
+ *
+ * Description : Opens the font file and saves the total file size.
+ *
+ * Input : error address of stream's error variable
+ * (re-entrant build only).
+ * filepathname pathname of the file to open
+ * stream address of target TT_Stream structure
+ *
+ * Output : SUCCESS on success, FAILURE on error.
+ * The target stream is set to -1 in case of failure.
+ *
+ ******************************************************************/
+/*
+** This is not a totally generic implementation. It currently assumes the filename
+** starts with "fonts:" and uses slashes instead of colons like Mac code normally
+** would. Given a filename of the form "fonts:/filename/resname", Load the resource
+** and lock the handle
+**
+** The "fonts:" at the beginning is just a convention I came up with to
+** indicate the Fonts folder inside the current System folder (find via FindFolder())
+*/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Open_Stream( const String* filepathname,
+ TT_Stream* stream )
+ {
+ TT_Error error;
+ Int file;
+ PStream_Rec stream_rec;
+ TFileMap* map;
+
+ int size, err = 0;
+ short vRefNum, res = -1;
+ Str255 FontName;
+ char *cp, *p, *fname, *sep;
+ Str63 myName;
+ long dirID;
+
+
+ if ( ALLOC( *stream, sizeof ( TStream_Rec ) ) )
+ return error;
+
+ map = Allocate_Map();
+ if ( !map )
+ {
+ error = TT_Err_Out_Of_Memory;
+ goto Memory_Fail;
+ }
+
+ stream_rec = STREAM2REC( *stream );
+
+ /* Find the dirID of the Fonts folder in the current System folder */
+ if (FindFolder(kOnSystemDisk, kFontsFolderType, kDontCreateFolder, &vRefNum, &dirID))
+ goto File_Fail;
+
+ /* Break the name apart */
+ fname = mystrdup(filepathname); /* Make a copy so we can muck with it */
+ sep = ":/"; /* Things that can seperate file path componants */
+
+ strtok(fname, sep); /* Skip over "fonts:" */
+
+ if ((p = strtok(NULL, sep)) == NULL) /* Get filename */
+ goto File_Fail;
+ strcpy(myName + 1, p); /* Make this a Pascal string (Yuck!) */
+ myName[0] = strlen(p);
+
+ if ((p = strtok(NULL, sep)) == NULL) /* Get res name */
+ goto File_Fail;
+ strcpy(FontName+1, p); /* Make this a Pascal string (Yuck!) */
+ FontName[0] = strlen(p);
+
+ FREE( fname );
+
+ if ((cp = strchr(FontName, '.')) != NULL) /* Strip off ".ttf" , if any */
+ *cp = 0;
+
+ /* Read the font into a buffer */
+ if ((map->resid = HOpenResFile(vRefNum, dirID, myName, fsRdPerm)) == -1)
+ goto File_Fail;
+
+ if ((map->handle = Get1NamedResource('sfnt', FontName)) == NULL)
+ goto Map_Fail;
+
+ HLock(map->handle);
+ map->base = *map->handle;
+ map->offset = 0;
+ map->size = GetResourceSizeOnDisk(map->handle);
+
+ if ( map->base == NULL )
+ goto Lock_Fail;
+
+ stream_rec->map = map;
+ stream_rec->pos = 0;
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ CUR_Stream = stream_rec;
+#endif
+
+ return TT_Err_Ok;
+
+ Lock_Fail:
+ ReleaseResource(map->handle);
+
+ Map_Fail:
+ CloseResFile(map->resid);
+
+ File_Fail:
+ error = TT_Err_Could_Not_Open_File;
+ FREE( map );
+
+ Memory_Fail:
+ FREE( *stream );
+ FREE( fname );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Close_Stream
+ *
+ * Description : Closes a stream.
+ *
+ * Input : stream
+ *
+ * Output : SUCCESS (always)
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Close_Stream( TT_Stream* stream )
+ {
+ PStream_Rec rec = STREAM2REC( *stream );
+
+
+ Release_Map( rec->map );
+ FREE( rec );
+
+ HANDLE_Set( *stream, NULL );
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Flush_Stream
+ *
+ * Description : Flushes a stream, i.e., closes its file handle.
+ *
+ * Input : stream address of target TT_Stream structure
+ *
+ * Output : Error code
+ *
+ * NOTE : Never flush the current opened stream. This means that
+ * you should _never_ call this function between a
+ * TT_Use_Stream() and a TT_Done_Stream()!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Flush_Stream( TT_Stream* stream )
+ {
+ /* XXX - DUMMY IMPLEMENTATION */
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Stream_Size
+ *
+ * Description : Returns the length of a given stream, even if it
+ * is flushed.
+ *
+ * Input : stream the stream
+ *
+ * Output : Length of stream in bytes.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Stream_Size( TT_Stream stream )
+ {
+ PStream_Rec rec = STREAM2REC( stream );
+
+
+ if ( rec )
+ return rec->map->size;
+ else
+ return 0; /* invalid stream - return 0 */
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Seek_File
+ *
+ * Description : Seeks the file cursor to a different position.
+ *
+ * Input : position new position in file
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Seek_File( STREAM_ARGS Long position )
+ {
+ if ( position > CUR_Stream->map->size )
+ return TT_Err_Invalid_File_Offset;
+
+ CUR_Stream->pos = position;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Skip_File
+ *
+ * Description : Skips forward the file cursor.
+ *
+ * Input : distance number of bytes to skip
+ *
+ * Output : see TT_Seek_File
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Skip_File( STREAM_ARGS Long distance )
+ {
+ return TT_Seek_File( STREAM_VARS CUR_Stream->pos + distance );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_File
+ *
+ * Description : Reads a chunk of the file and copies it to memory.
+ *
+ * Input : buffer target buffer
+ * count length in bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_File( STREAM_ARGS void* buffer, Long count )
+ {
+ if ( CUR_Stream->pos + count > CUR_Stream->map->size )
+ return TT_Err_Invalid_File_Read;
+
+ MEM_Copy( buffer,
+ MAP_Address( CUR_Stream->map ) + CUR_Stream->pos, count );
+ CUR_Stream->pos += count;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_At_File
+ *
+ * Description : Reads file at a specified position.
+ *
+ * Input : position position to seek to before read
+ * buffer target buffer
+ * count number of bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_At_File( STREAM_ARGS Long position,
+ void* buffer,
+ Long count )
+ {
+ TT_Error error;
+
+
+ if ( (error = TT_Seek_File( STREAM_VARS position )) ||
+ (error = TT_Read_File( STREAM_VARS buffer, count )) )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_File_Pos
+ *
+ * Description : Returns current file seek pointer.
+ *
+ * Input : none
+ *
+ * Output : current file position
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_File_Pos( STREAM_ARG )
+ {
+ return CUR_Stream->pos;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : Error code
+ *
+ * Notes: The function fails if the byte range is not within the
+ * the file, or if there is not enough memory to cache
+ * the bytes properly (which usually means that aSize is
+ * too big in both cases).
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( CUR_Stream->pos + size > CUR_Stream->map->size )
+ return TT_Err_Invalid_Frame_Access;
+
+ CUR_Frame.size = size;
+ CUR_Frame.address = MAP_Address( CUR_Stream->map ) + CUR_Stream->pos;
+ CUR_Frame.cursor = CUR_Frame.address;
+
+ CUR_Stream->pos += size;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Check_And_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : Error code
+ *
+ * Notes: The function truncates 'size' if the byte range is not
+ * within the file.
+ *
+ * It will fail if there is not enough memory to cache
+ * the bytes properly (which usually means that aSize is
+ * too big).
+ *
+ * It will fail if you make two consecutive calls
+ * to TT_Access_Frame(), without a TT_Forget_Frame() between
+ * them.
+ *
+ * The only difference with TT_Access_Frame() is that we
+ * check that the frame is within the current file. We
+ * otherwise truncate it. The 'overflow' is set to zero.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+ Long readBytes;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ readBytes = CUR_Stream->map->size - CUR_Stream->pos;
+ if ( size > readBytes )
+ {
+ /* There is overflow, we allocate a new block then */
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+
+ CUR_Frame.size = size;
+
+ /* copy the valid part */
+ MEM_Copy( CUR_Frame.address,
+ MAP_Address( CUR_Stream->map ) + CUR_Stream->pos,
+ readBytes );
+ }
+ else
+ {
+ CUR_Frame.size = size;
+ CUR_Frame.address = MAP_Address( CUR_Stream->map ) + CUR_Stream->pos;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Forget_Frame
+ *
+ * Description : Releases a cached frame after reading.
+ *
+ * Input : None
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Forget_Frame( FRAME_ARG )
+ {
+ if ( CUR_Frame.address == NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ /* If we were using a duplicate in case of overflow, free it now */
+ if ( CUR_Frame.address < (Byte*)CUR_Stream->map->base ||
+ CUR_Frame.address >= (Byte*)CUR_Stream->map->base +
+ CUR_Stream->map->size )
+ FREE( CUR_Frame.address );
+
+ ZERO_Frame( files.frame );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Byte
+ *
+ * Description : Extracts a byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted Byte
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+#if 0
+
+ FT_EXPORT_FUNC( Byte )
+ TT_Get_Byte( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Byte)(*CUR_Frame.cursor++);
+ }
+
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : GET_Char
+ *
+ * Description : Extracts a signed byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted char
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Char )
+ TT_Get_Char( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Char)(*CUR_Frame.cursor++);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Short
+ *
+ * Description : Extracts a short from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted short
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Short )
+ TT_Get_Short( FRAME_ARG )
+ {
+ Short getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = ((Short)CUR_Frame.cursor[0] << 8) |
+ (Short)CUR_Frame.cursor[1];
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_UShort
+ *
+ * Description : Extracts an unsigned short from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted ushort
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+#if 0
+
+ FT_EXPORT_FUNC( UShort )
+ TT_Get_UShort( FRAME_ARG )
+ {
+ UShort getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = ((UShort)CUR_Frame.cursor[0] << 8) |
+ (UShort)CUR_Frame.cursor[1];
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : GET_Long
+ *
+ * Description : Extracts a long from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted long
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Get_Long( FRAME_ARG )
+ {
+ Long getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ((Long)CUR_Frame.cursor[0] << 24) |
+ ((Long)CUR_Frame.cursor[1] << 16) |
+ ((Long)CUR_Frame.cursor[2] << 8 ) |
+ (Long)CUR_Frame.cursor[3];
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_ULong
+ *
+ * Description : Extracts an unsigned long from the frame.
+ *
+ * Input : None
+ *
+ * Output : Extracted ulong
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+#if 0
+
+ FT_EXPORT_FUNC( ULong )
+ TT_Get_ULong( FRAME_ARG )
+ {
+ ULong getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ( ((ULong)CUR_Frame.cursor[0] << 24) |
+ ((ULong)CUR_Frame.cursor[1] << 16) |
+ ((ULong)CUR_Frame.cursor[2] << 8 ) |
+ (ULong)CUR_Frame.cursor[3] );
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.BC b/Build/source/libs/freetype/lib/arch/msdos/Makefile.BC
new file mode 100644
index 00000000000..4ef5f224c1f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.BC
@@ -0,0 +1,171 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Borland C++ for MS-DOS, large model.
+# Due to size constraints, it does not try to pack all modules into one
+# (`single-object mode').
+#
+# You will need Borland MAKE.
+# Tested with Borland C++ v.3.1, 4.02, 4.51, 5.02.
+# See below for a note for Borland C++ 2.0, 3.0 or Turbo C++ 3.0.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# make -farch/msdos/Makefile.BC
+#
+#
+# A debug version can be obtained with
+#
+# make -DDEBUG -farch/msdos/Makefile.BC
+#
+# A special version enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# make -DBIGFONTS -farch/msdos/Makefile.BC
+#
+#
+# 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.
+#
+#
+# Various notes about specific versions...
+#
+# NOTE: Borland C++ v. 2.0, 3.0, or Turbo C++ 3.0
+#
+# There is something that will fail as it stands: the -i40 option
+# passed to CFLAGS was not recognized until v.3.1, so the compiler
+# will complain. So you should remove the -i40 option below.
+#
+# Also, __huge was not introduced before v.3.1, so if you want the
+# BIGFONTS option, you should use _huge instead (and perhaps remove
+# -A in CFLAGS).
+#
+# NOTE 2: Turbo C++ 3.0
+#
+# You should write `CC=tcc' below, as it should be obvious.
+# Alternatively, you can `set CC=tcc', then invoke make with -e.
+#
+# NOTE 3: Borland C++ 2.0
+#
+# Not really very tested; expect problems with make (overflows).
+# Alternatively, use Makefile.TC, replacing there tcc with bcc.
+
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.BC
+
+!if ! $d(CC)
+CC = bcc
+!endif
+
+LIB = tlib /c /e
+
+# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
+# Borland compilers (from BC++ 3.1 on) can increase the limit on
+# the length of identifiers.
+
+!if ! $d(DEBUG)
+CFLAGS = -ml -A -O2 -3 -i40 -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
+!else
+CFLAGS = -v -N -ml -A -i40 -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
+!endif
+
+
+!if $d(BIGFONTS)
+CFLAGS = $(CFLAGS) -DTT_HUGE_PTR=__huge
+
+TTFILE = $(ARCH)\.\hugefile.c
+TTMEMORY = $(ARCH)\.\hugemem.c
+!else
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+!endif
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces before the \ at end of line,
+# otherwise the substitution for TLIB command line will fail.
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c \
+ extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c \
+ extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c \
+ extend\ftxopen.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c ttdebug.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\.\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Borland's make does not handle $($(LIB_FILES)), and using
+# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing TLIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# It is commented out below. See Makefile.TC for an application.
+.c.obj:
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) $<
+|
+# $(LIB) libttf +-$*.obj
+
+
+!if !$d(DEBUG)
+# Skipped if DEBUG build
+# (but it changes nothing, since we always build in multiple parts).
+all: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(OBJS_M: = + )
+|
+
+!endif
+
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(OBJS_M: = + )
+|
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(**: = + )
+|
+
+!if $d(BIGFONTS)
+$(TTMEMORY:.c=.obj): $(TTMEMORY)
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) -A- $*.c
+|
+!endif
+
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del libttf.bak
+ -del response
+
+distclean: clean
+ -del libttf.lib
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.MS b/Build/source/libs/freetype/lib/arch/msdos/Makefile.MS
new file mode 100644
index 00000000000..2e3a9e43cea
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.MS
@@ -0,0 +1,127 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Microsoft C for MS-DOS, large model.
+# It also works for Visual C++ 1.x 16-bits compiler, but you should
+# instead use the Makefile customized for it, Makefile.VC.
+# Due to size constraints, it does not try to pack all modules into one.
+#
+# Tested with Microsoft C v.6.0ax, C/C++ v.7.0, Visual C++ v.1.5.
+# Microsoft C v.5.1 chokes on some (definitively) ANSI constructs,
+# like switch() with an expression of type long. Upgrade your compiler!
+#
+# You will need NMAKE.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# nmake /f arch\msdos\Makefile.MS
+#
+#
+# A debug version can be obtained with
+#
+# nmake DEBUG=1 /f arch\msdos\Makefile.MS
+#
+# A special version enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# nmake BIGFONTS=1 /f arch\msdos\Makefile.MS
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.MS
+
+CC = cl /nologo
+LIB = lib
+
+!ifndef DEBUG
+CFLAGS = /Ox /AL /W0 /G2 /I$(ARCH) /I. /Iextend
+!else
+CFLAGS = /Zi /AL /W0 /G2 /I$(ARCH) /I. /Iextend
+!endif
+
+
+!ifndef BIGFONTS
+CFLAGS = $(CFLAGS) /Za
+
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+!else
+CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=huge /Ze
+
+TTFILE = $(ARCH)\hugefile.c
+TTMEMORY = $(ARCH)\hugemem.c
+!endif
+
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+OBJS_X = extend\ftxgasp.obj extend\ftxkern.obj extend\ftxpost.obj \
+ extend\ftxcmap.obj extend\ftxwidth.obj extend\ftxerr18.obj \
+ extend\ftxsbit.obj extend\ftxopen.obj extend\ftxgsub.obj \
+ extend\ftxgpos.obj extend\ftxgdef.obj
+# the line below does not work with these old versions of nmake...
+# OBJS_X = $(SRC_X:.c=.obj)
+
+OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj \
+ ttgload.obj ttinterp.obj ttload.obj ttobjs.obj \
+ ttraster.obj ttextend.obj $(PORT) $(OBJS_X)
+# OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+# Not used here because the compiler runs out of memory...
+OBJ_S = $(ARCH)\freetype.obj
+#SRC_S = $(ARCH)\freetype.c
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
+# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we include
+# each .obj in the library as soon as it is compiled. Better schemes are
+# used in the other Makefile's, please give them a look.
+.c.obj:
+ $(CC) /c /Fo$@ $(CFLAGS) $*.c
+ $(LIB) libttf -+$*.obj;
+
+
+!ifndef DEBUG
+# Skipped if DEBUG build
+# (but it changes nothing, since we always build in multiple parts).
+all: $(OBJS_M)
+# -del libttf.lib
+# $(LIB) libttf.lib @<<response
+#+ $(OBJS_M: = -+ );
+#<<KEEP
+!endif
+
+debug: $(OBJS_M)
+# -del libttf.lib
+# $(LIB) libttf.lib @<<response
+#+ $(OBJS_M: = -+ );
+#<<KEEP
+
+#$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ $(LIB) $@ +-$(?: =-+);
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del response
+
+distclean: clean
+ -del libttf.lib
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile.MS
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.TC b/Build/source/libs/freetype/lib/arch/msdos/Makefile.TC
new file mode 100644
index 00000000000..fdd042d922f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.TC
@@ -0,0 +1,127 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Turbo C for MS-DOS, large model.
+# Due to size constraints, it does not try to pack all modules into one
+# (`single-object mode').
+#
+# You will need Borland MAKE.
+# Tested with Turbo C v.1.5, v.2.0, Turbo C++ v.1.0, v.3.0.
+# Turbo C v.1.0 (May '87) is too old (lack of structure assignment)
+# to compile FreeType. Update your compiler. ;-)
+# See below for notes regarding the various versions.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# make -farch/msdos/Makefile.TC
+#
+#
+# A debug version can be obtained (except for TC1.5, see below) with
+#
+# make -DDEBUG -farch/msdos/Makefile.TC
+#
+# The main difference is with the compiler options, because due to size
+# constraints, all sources are always compiled separately.
+#
+#
+# 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.
+#
+#
+# Various notes about specific versions...
+#
+# The lack of space in the command line prevents us to turn off the
+# -w-use warning (when TCC.CFG file had enable it).
+#
+# NOTE: Turbo C++ v. 3.0
+#
+# The Makefile.TC for this version is common with the older versions.
+# Alternatively, you can consider using Makefile.BC instead, changing
+# the name of the compiler from BCC to TCC!
+#
+# NOTE 2: Turbo C++ v. 1.0
+#
+# Unlike v.3.0, the version of make shipped with this version is not able
+# to cater with some of the possibilities used in Makefile.BC, for example
+# the inline construction of the `option' file, with the && command.
+# So you should stick with this one.
+#
+# NOTE 3: Turbo C v. 1.5
+#
+# You will need to replace the -v option in CFLAGS by -y.
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.TC
+
+CC = tcc
+LIB = tlib /c
+
+!if ! $d(DEBUG)
+CFLAGS = -ml -A -a -G -w-stu -w-par -w-rch -w-aus -w-stv -w-cln -w-sig -I$(ARCH);.;extend
+!else
+# For Turbo C v.1.5, you'll need to replace the -v option below by -y.
+CFLAGS = -y -N -ml -A -w-stu -w-par -w-rch -w-aus -w-stv -w-cln -w-sig -I$(ARCH);.;extend
+!endif
+# The lack of space in the command line prevents us to turn off the
+# -w-use warning (when the TCC.CFG file had enable it).
+
+
+TTFILE = .\ttfile.obj
+TTMEMORY = .\ttmemory.obj
+TTMUTEX = .\ttmutex.obj
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+OBJS_X = extend\ftxgasp.obj extend\ftxkern.obj extend\ftxpost.obj \
+ extend\ftxcmap.obj extend\ftxwidth.obj extend\ftxerr18.obj \
+ extend\ftxsbit.obj extend\ftxopen.obj extend\ftxgsub.obj \
+ extend\ftxgpos.obj extend\ftxgdef.obj
+# the line below does not work with these old versions of make...
+# OBJS_X = $(SRC_X:.c=.obj)
+
+OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj \
+ ttgload.obj ttinterp.obj ttload.obj ttobjs.obj \
+ ttraster.obj ttextend.obj $(PORT) $(OBJS_X)
+# OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+# Not used here because the compiler runs out of memory...
+OBJ_S = $(ARCH)\freetype.obj
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since these Borland's make are very primitive, we include each .obj
+# in the library as soon as it is compiled. Better schemes are used
+# in the other Makefile's, please give them a look.
+
+.c.obj:
+ $(CC) $(CFLAGS) -c -o$* $<
+ $(LIB) libttf +-$*.obj
+
+
+
+!if !$d(DEBUG)
+# Skipped if DEBUG build (but with the `release' compiler options);
+# it does not change anything, since we always build in multiple parts.
+all: $(OBJS_M)
+
+!endif
+
+debug: $(OBJS_M)
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del libttf.bak
+
+distclean: clean
+ -del libttf.lib
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.VC b/Build/source/libs/freetype/lib/arch/msdos/Makefile.VC
new file mode 100644
index 00000000000..44c6225675b
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.VC
@@ -0,0 +1,129 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Microsoft Visual C++ 1.x for MS-DOS, large model.
+# It also works for Microsoft C/C++ v.7.0 (with a minor edit), but not for
+# previous versions (use Makefile.MS instead).
+#
+# Tested with Microsoft C/C++ v.7.0, Visual C++ v.1.5.
+#
+# You will need NMAKE.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# nmake /f arch\msdos\Makefile.VC
+#
+#
+# A debug version can be obtained with
+#
+# nmake DEBUG=1 /f arch\msdos\Makefile.VC
+#
+# A special version enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# nmake BIGFONTS=1 /f arch\msdos\Makefile.VC
+#
+#
+# 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.
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.VC
+
+CC = cl /nologo
+LIB = lib /noignorecase /nologo
+
+# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
+# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
+!ifndef DEBUG
+CFLAGS = $(CFLAGS) /Ox /AL /W2 /G3 /I$(ARCH) /I. /Iextend
+!else
+CFLAGS = $(CFLAGS) /Zi /Ge /AL /W2 /G3 /I$(ARCH) /I. /Iextend
+!endif
+
+
+!ifndef BIGFONTS
+CFLAGS = $(CFLAGS) /Za
+
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+!else
+CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge /Ze
+
+TTFILE = $(ARCH)\hugefile.c
+TTMEMORY = $(ARCH)\hugemem.c
+!endif
+
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces between the file names or at end of line, otherwise
+# the substitution for LIB command line will fail. Thank you.
+#
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
+extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
+extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
+ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
+# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing LIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# It is commented out below. See Makefile.TC for an application.
+.c.obj:
+ @$(CC) /c /Fo$@ @<<
+ $(CFLAGS) $*.c
+<<
+# $(LIB) libttf +-$*.obj
+
+
+!ifndef DEBUG
+# Skipped if DEBUG build
+all: $(OBJS_S)
+ -del libttf.lib
+ $(LIB) libttf.lib @<<response
++ $(OBJS_S: = + );
+<<KEEP
+!endif
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @<<response
++ $(OBJS_M: = + );
+<<KEEP
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ $(LIB) $@ +-$(?: =-+);
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del response
+
+distclean: clean
+ -del libttf.lib
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile.VC
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.dm b/Build/source/libs/freetype/lib/arch/msdos/Makefile.dm
new file mode 100644
index 00000000000..6e02e7b423c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.dm
@@ -0,0 +1,94 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc or djgpp under MSDOS.
+#
+# You will need dmake.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# dmake -r -f arch/msdos/Makefile.dm
+#
+#
+# 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.
+
+ARCH = arch/msdos
+FT_MAKEFILE = $(ARCH)/Makefile.dm
+FT_MAKE = dmake -r
+
+.IMPORT: COMSPEC
+SHELL := $(COMSPEC)
+SHELLFLAGS := /c
+GROUPSHELL := $(SHELL)
+GROUPFLAGS := $(SHELLFLAGS)
+GROUPSUFFIX := .bat
+SHELLMETAS := *"?<>&|
+
+CC = gcc
+
+CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
+# CFLAGS = -Wall -ansi -O2 -s -I$(ARCH) -I. -Iextend
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
+ extend/ftxgdef.c extend/ftxerr18.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttfile.c ttgload.c ttinterp.c ttload.c \
+ ttmemory.c ttmutex.c ttobjs.c ttraster.c ttextend.c
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+ $(CC) $(CFLAGS) -c -o $@ $(SRC_S)
+
+libttf.a: $($(LIB_FILES))
+ +-del $@
+ ar src $@ @$(mktmp $(<:t"\n")\n)
+
+clean:
+-[
+ del *.o
+ del extend\*.o
+ del $(ARCH)\*.o
+]
+
+distclean: clean
+-[
+ del dep.end
+ del libttf.a
+]
+
+# depend: $(SRC_S) $(SRC_M) $(SRC_X)
+# $(CC) -E -M @$(mktmp $(<:t"\n")\n) > dep.end
+
+# ifeq (dep.end,$(wildcard dep.end))
+# include dep.end
+# endif
+
+# end of Makefile.dm
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.gcc b/Build/source/libs/freetype/lib/arch/msdos/Makefile.gcc
new file mode 100644
index 00000000000..7425f2adabc
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.gcc
@@ -0,0 +1,108 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for emx-gcc or djgpp under MSDOS.
+#
+# You will need GNU make, and sed if you want to make depend
+#
+# Use this file while in the lib directory with the following statements:
+#
+# make -f arch/msdos/Makefile.gcc depend
+# make -f arch/msdos/Makefile.gcc
+#
+# If you have the GNU gettext package installed with DJGPP, you can also try
+#
+# make -f arch/msdos/Makefile.gcc HAVE_GETTEXT
+#
+# You should also modify the path below to reflect where the *.mo
+# files are on your system, and install there the one for freetype.
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/msdos
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+CC = gcc
+
+ifndef GETTEXT
+GETTEXT=NO_GETTEXT
+endif
+
+ifdef DEBUG
+CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend -D$(GETTEXT)
+else
+CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend -D$(GETTEXT)
+endif
+
+
+TTFILE = ./ttfile.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = ./ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
+ extend/ftxopen.c extend/ftxerr18.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M DEBUG=1 libttf.a
+
+HAVE_GETTEXT:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S GETTEXT=HAVE_GETTEXT \
+ libttf.a
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+libttf.a: $($(LIB_FILES))
+ -del $@
+ ar src $@ $^
+
+clean:
+ -del *.o
+ -del extend\*.o
+ -del arch\msdos\*.o
+ -del response
+
+distclean: clean
+ -del dep.end
+ -del libttf.a
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) -E -MM -I$(ARCH) -I. -Iextend $^ | \
+ sed -e "s!^freetype.!$(ARCH)/freetype.!" | \
+ sed -e "s!^ftx!extend/ftx!" > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/lib/arch/msdos/Makefile.wat b/Build/source/libs/freetype/lib/arch/msdos/Makefile.wat
new file mode 100644
index 00000000000..12647edc579
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/Makefile.wat
@@ -0,0 +1,105 @@
+# This file is part of the FreeType project
+#
+# This builds the Watcom library with Watcom's wcc386 under DOS
+#
+# You'll need Watcom's wmake
+#
+#
+# Invoke by "wmake -f arch\msdos\Makefile.wat" while in the "lib" directory
+#
+# This will build "freetype\lib\libttf.lib"
+#
+#
+# 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 compiler did compile early versions of the FreeType package.
+# While we tried our best to maintain the makefiles, the development team
+# does not have currently access to a copy of this compiler, and we did not
+# receive notices of successfull builts since many years. So be prepared
+# to some problems; and if it works for you, or if you can upgrade the
+# package in any way, please notify us!
+
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.wat
+FT_MAKE = wmake -h
+
+
+.EXTENSIONS:
+.EXTENSIONS: .lib .obj .c .h
+.obj:.;.\extend;.\$(ARCH)
+.c:.;.\extend;.\$(ARCH)
+.h:.;.\extend;.\$(ARCH)
+
+CC = wcc386
+
+CCFLAGS = /otexanl+ /s /w4 /zq /d3 -I$(ARCH) -I. -Iextend
+
+
+# FIXME: should use something like OBJ = $(SRC:.c=.obj)
+
+SRC_X = ftxgasp.c ftxkern.c ftxpost.c &
+ ftxcmap.c ftxwidth.c ftxsbit.c ftxerr18.c &
+ ftxgsub.c ftxgpos.c ftxopen.c ftxgdef.c
+OBJS_X = ftxgasp.obj ftxkern.obj ftxpost.obj &
+ ftxcmap.obj ftxwidth.obj ftxsbit.obj ftxerr18.obj &
+ ftxgsub.obj ftxgpos.obj ftxopen.obj ftxgdef.obj
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c &
+ ttfile.c ttgload.c ttinterp.c &
+ ttload.c ttmemory.c ttmutex.c ttobjs.c ttraster.c &
+ ttextend.c
+OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj &
+ ttfile.obj ttgload.obj ttinterp.obj &
+ ttload.obj ttmemory.obj ttmutex.obj ttobjs.obj ttraster.obj &
+ ttextend.obj $(OBJS_X)
+
+SRC_S = freetype.c
+OBJ_S = freetype.obj
+OBJS_S = $(OBJ_S) $(OBJ_X)
+
+
+.c.obj:
+ $(CC) $(CCFLAGS) $[* /fo=$[*.obj
+
+libname = libttf
+libfile = $(libname).lib
+cmdfile = $(libname).lst
+
+
+all: .symbolic
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S $(libfile)
+
+debug: .symbolic
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M $(libfile)
+
+
+$(libfile): $($(LIB_FILES))
+ wlib -q -n $(libfile) @$(cmdfile)
+
+# is this correct? Know nothing about wmake and the Watcom compiler...
+$(OBJ_S): $(SRC_S) $(SRC_M)
+ $(CC) $(CCFLAGS) $(SRC_S) /fo=$(OBJ_S)
+
+$(cmdfile): $($(LIB_FILES))
+ @for %i in ($($(LIB_FILES))) do @%append $(cmdfile) +-%i
+
+clean: .symbolic
+ @-erase $(OBJ_S)
+ @-erase $(OBJS_M)
+ @-erase $(cmdfile)
+
+distclean: .symbolic clean
+ @-erase $(libfile)
+
+new: .symbolic
+ @-wtouch *.c
+
+# end of Makefile.wat
diff --git a/Build/source/libs/freetype/lib/arch/msdos/depend.dos b/Build/source/libs/freetype/lib/arch/msdos/depend.dos
new file mode 100644
index 00000000000..50f2c49fb76
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/depend.dos
@@ -0,0 +1,111 @@
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in `makedep'...
+#
+# This dependency file to be used with various MS-DOS compilers
+# has been generated automatically with the script `makedep' on
+# 2002-11-18.
+
+ttapi.obj: ttapi.c ttconfig.h arch\msdos\ft_conf.h freetype.h fterrid.h \
+ ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
+ ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
+ ttgload.h ttraster.h ttextend.h
+ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
+ arch\msdos\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
+ ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
+ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\msdos\ft_conf.h freetype.h \
+ fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
+ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
+ tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
+ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\msdos\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h ttcmap.h
+ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\msdos\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
+ttfile.obj: ttfile.c ttconfig.h arch\msdos\ft_conf.h freetype.h \
+ fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
+ ttmemory.h ttfile.h
+ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
+ ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
+ ttmemory.h tttags.h ttload.h
+ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
+ ttconfig.h arch\msdos\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
+ ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
+ ttcmap.h
+ttload.obj: ttload.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
+ ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
+ ttmemory.h tttags.h ttload.h
+ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\msdos\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
+ ttmutex.h
+ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\msdos\ft_conf.h
+ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
+ tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
+ ttinterp.h ttextend.h
+ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
+ ttdebug.h ttcalc.h ttmemory.h
+extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
+extend\ftxerr18.obj: extend\ftxerr18.c extend\ftxerr18.h freetype.h fterrid.h \
+ ftnameid.h extend\ftxkern.h extend\ftxpost.h extend\ftxopen.h \
+ extend\ftxgdef.h extend\ftxgsub.h extend\ftxgpos.h ttconfig.h \
+ arch\msdos\ft_conf.h
+extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
+extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
+ ftnameid.h ttextend.h ttconfig.h arch\msdos\ft_conf.h tttypes.h \
+ ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
+ ttload.h ttmemory.h ttfile.h tttags.h
+extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
+ ttdebug.h tttags.h ttmemory.h ttextend.h
+extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
+ ftnameid.h ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
+ tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
+ ttload.h ttmemory.h tttags.h ttextend.h
+extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
+ ftnameid.h ttdebug.h ttconfig.h arch\msdos\ft_conf.h tttypes.h \
+ ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
+ tttags.h ttload.h
+arch\msdos\freetype.obj: arch\msdos\freetype.c ttapi.c ttconfig.h \
+ arch\msdos\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
+ tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
+ ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
+ ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
+ ttinterp.h ttload.c ttobjs.c ttraster.c arch\msdos\hugefile.c \
+ ttfile.c arch\msdos\hugemem.c ttmutex.c ttextend.c
+arch\msdos\hugefile.obj: arch\msdos\hugefile.c ttconfig.h arch\msdos\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttfile.c ttdebug.h \
+ ttengine.h ttmutex.h ttmemory.h ttfile.h
+arch\msdos\hugemem.obj: arch\msdos\hugemem.c ttdebug.h ttconfig.h \
+ arch\msdos\ft_conf.h tttypes.h freetype.h fterrid.h ftnameid.h \
+ ttmemory.h ttengine.h ttmutex.h
diff --git a/Build/source/libs/freetype/lib/arch/msdos/freetype.c b/Build/source/libs/freetype/lib/arch/msdos/freetype.c
new file mode 100644
index 00000000000..943d5f24776
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/freetype.c
@@ -0,0 +1,39 @@
+/* This file is part of the FreeType project */
+
+/* Single object library component for MSDOS. */
+/* Note that low-optimizing 16-bit compilers (such as Borland ones) can't */
+/* successfully compile this file, because it exceeds 64K of code size. */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#ifdef TT_HUGE_PTR
+#include "arch/msdos/hugefile.c"
+#include "arch/msdos/hugemem.c"
+#else
+#include "ttfile.c"
+#include "ttmemory.c"
+#endif
+#include "ttmutex.c"
+
+/* finally, add some extensions */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/msdos/ft_conf.h b/Build/source/libs/freetype/lib/arch/msdos/ft_conf.h
new file mode 100644
index 00000000000..25f16823c3c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/ft_conf.h
@@ -0,0 +1,251 @@
+/*******************************************************************
+ *
+ * ft_conf.h for MSDOS
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <unistd.h> header file. */
+#if defined( __EMX__ ) || defined( __DJGPP__ ) || defined( __GO32__ ) \
+ || defined( __DJGPP ) /*v.1*/
+/* some compilers are known to have <unistd.h>; */
+/* add yours if needed, and report to us the update. */
+#define HAVE_UNISTD_H
+#else
+/* most MS-DOS compilers lack <unistd.h> */
+#undef HAVE_UNISTD_H
+#endif
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+/* #undef HAVE_LOCALE_H */
+
+/* DJGPP v.2 may feature the GNU gettext package, with some subtleties. */
+/* The macro HAVE_LIBINTL has to be set in the makefile. */
+#ifdef HAVE_GETTEXT /* backward compatibility */
+#define HAVE_LIBINTL
+#endif
+
+#ifdef HAVE_LIBINTL
+#define HAVE_LOCALE_H
+#define HAVE_LIBINTL_H
+#ifndef LOCALEDIR
+#define LOCALEDIR "/usr/djgpp/share/locale"
+#endif
+/* Due to a name conflict, gettext is renamed gettext__ in DJGPP */
+#define gettext( str ) gettext__( str )
+#endif
+
+/* command.com can't pipe stderr into a file; any message would be */
+/* written into the graphics screen. */
+#define HAVE_PRINT_FUNCTION 1
+
+#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
+
+/* The number of bytes in a int. We use the ANSI header file limits.h */
+/* for determining it since there is no easy way to guess. */
+#include <limits.h>
+#if UINT_MAX == 0xFFFF
+#define SIZEOF_INT 2
+#elif UINT_MAX == 0xFFFFFFFF
+#define SIZEOF_INT 4
+#else
+#error "Unsupported number of bytes in `int' type!"
+#endif
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/msdos/hugefile.c b/Build/source/libs/freetype/lib/arch/msdos/hugefile.c
new file mode 100644
index 00000000000..695daa69def
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/hugefile.c
@@ -0,0 +1,87 @@
+/*******************************************************************
+ *
+ * hugefile.c
+ *
+ * File I/O Component (body) for dealing with "huge" objects under
+ * MS-DOS. Relies on the "default" version, with a small hook.
+ *
+ * Written by Antoine Leca based on ideas from Dave Hoo.
+ * Copyright 1999-2001 by Dave Hoo, Antoine Leca,
+ * 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.
+ *
+ * NOTE
+ *
+ * This file #includes the normal version, to avoid discrepancies
+ * between versions. It uses only ANSI-mandated "tricks", so
+ * any ANSI-compliant compiler should be able to compile this file.
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+#include "tttypes.h"
+
+/* Here we include <stdio.h>, to have the proper definition of fread */
+#include <stdio.h>
+
+/* Then, we divert the use of fread to our version */
+#undef fread
+#define fread(ptr, size, n, stream) huge_fread(ptr, size, n, stream)
+
+ FT_INTERNAL_FUNC( Long )
+ huge_fread ( void *ptr, size_t size, Long n, FILE *stream );
+
+/* Now, we include the "normal" version of ttfile.c */
+/* The ANSI/ISO standard mandates that the include of <stdio.h> */
+/* there have no bad effects. */
+#include "ttfile.c"
+
+/* Then, we define our implementation of fread that makes use of */
+/* "huge"-allocated memory. */
+
+/*******************************************************************
+ *
+ * Function : huge_fread
+ *
+ * Description : replacement version of fread that handles
+ * "huge"-allocated memory.
+ *
+ * Input : See the reference for the runtime library function fread
+ *
+ * Output : See the reference for the runtime library function fread
+ *
+ * Notes :
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_DEF( Long )
+ huge_fread ( void * ptr,
+ size_t size,
+ Long n,
+ FILE * stream )
+ {
+ char TT_HUGE_PTR * p = (char TT_HUGE_PTR *) ptr;
+ ULong left = (ULong)n * size;
+ size_t toRead;
+
+ while ( left )
+ {
+ toRead = (left > 0x8000) ? 0x8000 : left;
+ if ( (fread)( p, 1, toRead, stream ) != toRead)
+ return -1;
+ else
+ {
+ left -= (ULong) toRead;
+ p += toRead;
+ }
+ }
+ return n * size;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/msdos/hugemem.c b/Build/source/libs/freetype/lib/arch/msdos/hugemem.c
new file mode 100644
index 00000000000..739160d521c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/hugemem.c
@@ -0,0 +1,496 @@
+/*******************************************************************
+ *
+ * hugemem.c
+ *
+ * Memory management component (body)
+ * for dealing with "huge" objects with 16-bit MS-DOS.
+ *
+ * Written by Dave Hoo and Antoine Leca.
+ * Copyright 1999-2001 by Dave Hoo, Antoine Leca,
+ * 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.
+ *
+ ******************************************************************/
+
+#include <limits.h>
+
+#include "ttdebug.h"
+#include "ttmemory.h"
+#include "ttengine.h"
+
+#ifndef TT_HUGE_PTR
+#error "This component needs TT_HUGE_PTR to be #defined."
+#endif
+
+/* ---- Microsoft C compilers support ------------------------------------ */
+
+#if defined( M_I86 ) || defined( _M_I86 )
+
+#include <malloc.h>
+#define huge_alloc( size ) _halloc ( size, 1 )
+#define huge_free( block ) _hfree ( block )
+
+#endif /* Microsoft compilers */
+
+/* ---- Borland C compiler support --------------------------------------- */
+
+#ifdef __TURBOC__
+
+#include <alloc.h>
+#define huge_alloc( size ) farmalloc ( size )
+#define huge_free( block ) farfree ( block )
+
+#endif
+
+#if !defined( huge_alloc ) || !defined( huge_free )
+#error "Your compiler is not (yet) supported. Check the source file!"
+#endif
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+#error "This component needs static allocation and is not re-entrant."
+#endif
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_memory
+
+
+#ifdef DEBUG_MEMORY
+
+#include <stdio.h>
+
+#define MAX_TRACKED_BLOCKS 1024
+
+ struct TMemRec_
+ {
+ void* base;
+ Long size;
+ };
+
+ typedef struct TMemRec_ TMemRec;
+
+ static TMemRec pointers[MAX_TRACKED_BLOCKS + 1];
+
+ static Int num_alloc;
+ static Int num_free;
+ static Int num_realloc; /* counts only `real' reallocations
+ (i.e., an existing buffer will be resized
+ to a value larger than zero */
+
+ static Int fail_alloc;
+ static Int fail_realloc;
+ static Int fail_free;
+
+#else
+
+ /* We need a tracing stack of the calls to big chunks of memory, */
+ /* in order to call the matching version of free(). */
+
+#define MAX_TRACKED_BIGCHUNKS 16
+
+ struct TMemRec_
+ {
+ void* base;
+ Long size;
+ };
+
+ typedef struct TMemRec_ TMemRec;
+
+ static TMemRec pointers[MAX_TRACKED_BIGCHUNKS + 1];
+
+#endif /* DEBUG_MEMORY */
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ Long TTMemory_Allocated;
+ Long TTMemory_MaxAllocated;
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : TT_Alloc
+ *
+ * Description : Allocates memory from the heap buffer.
+ *
+ * Input : Size size of the memory to be allocated
+ * P pointer to a buffer pointer
+ *
+ * Output : Error code.
+ *
+ * NOTE : The newly allocated block should _always_ be zeroed
+ * on return. Many parts of the engine rely on this to
+ * work properly.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Alloc( ULong Size, void** P )
+ {
+ Int i;
+
+
+ if ( !P )
+ return TT_Err_Invalid_Argument;
+ /* Also see below for another case of "invalid argument". */
+
+ if ( Size > 0 )
+ {
+ if ( Size > ( UINT_MAX & ~0xFu ) )
+ *P = (void*)huge_alloc( Size );
+ else
+ *P = (void*)malloc( Size );
+ if ( !*P )
+ return TT_Err_Out_Of_Memory;
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated += Size;
+ TTMemory_MaxAllocated += Size;
+#endif
+
+#ifdef DEBUG_MEMORY
+
+ num_alloc++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != NULL )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_alloc++;
+ else
+ {
+ pointers[i].base = *P;
+ pointers[i].size = Size;
+ }
+
+#else
+
+ if ( Size > ( UINT_MAX & ~0xFu ) )
+ {
+ i = 0;
+ while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
+ i++;
+
+ if ( i >= MAX_TRACKED_BIGCHUNKS )
+ /* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
+ return TT_Err_Invalid_Argument;
+ else
+ {
+ pointers[i].base = *P;
+ pointers[i].size = Size;
+ }
+ }
+
+#endif /* DEBUG_MEMORY */
+
+ if ( Size > ( UINT_MAX & ~0xFu ) )
+ {
+ char TT_HUGE_PTR * p = (char TT_HUGE_PTR *) *P;
+ ULong left = (ULong)Size;
+ size_t toClear;
+
+ while ( left )
+ {
+ toClear = (left > 0xFF00) ? 0xFF00 : left;
+ MEM_Set( p, 0, toClear );
+ left -= (ULong) toClear;
+ p += toClear;
+ }
+ }
+ else
+ MEM_Set( *P, 0, Size );
+ }
+ else
+ *P = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*******************************************************************
+ *
+ * Function : TT_Realloc
+ *
+ * Description : Reallocates memory from the heap buffer.
+ *
+ * Input : Size new size of the memory to be allocated;
+ * if zero, TT_Free() will be called
+ * P pointer to a buffer pointer; if *P == NULL,
+ * TT_Alloc() will be called
+ *
+ * Output : Error code.
+ *
+ * NOTES : It's not necessary to zero the memory in case the
+ * reallocated buffer is larger than before -- the
+ * application has to take care of this.
+ *
+ * If the memory request fails, TT_Free() will be
+ * called on *P, and TT_Err_Out_Of_Memory returned.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Realloc( ULong Size, void** P )
+ {
+ void* Q;
+
+#ifdef DEBUG_MEMORY
+ Int i;
+#endif
+
+
+ if ( !P )
+ return TT_Err_Invalid_Argument;
+
+ if ( !*P )
+ return TT_Alloc( Size, P );
+
+ if ( Size == 0 )
+ return TT_Free( P );
+
+ if ( Size > ( UINT_MAX & ~0xFu ) )
+ Q = NULL; /* Do not even try to deal with big chunks of memory. */
+ else
+ Q = (void*)realloc( *P, Size );
+ if ( !Q )
+ {
+ TT_Free( *P );
+ return TT_Err_Out_Of_Memory;
+ }
+
+#ifdef DEBUG_MEMORY
+
+ num_realloc++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_realloc++;
+ else
+ {
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated += Size - pointers[i].size;
+ if ( Size > pointers[i].size )
+ TTMemory_MaxAllocated += Size - pointers[i].size;
+#endif
+
+ pointers[i].base = Q;
+ pointers[i].size = Size;
+ }
+#endif /* DEBUG_MEMORY */
+
+ *P = Q;
+
+ return TT_Err_Ok;
+ }
+
+
+#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
+
+
+/*******************************************************************
+ *
+ * Function : TT_Free
+ *
+ * Description : Releases a previously allocated block of memory.
+ *
+ * Input : P pointer to memory block
+ *
+ * Output : Always SUCCESS.
+ *
+ * Note : The pointer must _always_ be set to NULL by this function.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Free( void** P )
+ {
+ Int i;
+ Long Size = 0;
+
+
+ if ( !P || !*P )
+ return TT_Err_Ok;
+
+#ifdef DEBUG_MEMORY
+
+ num_free++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_free++;
+ else
+ {
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated -= pointers[i].size;
+#endif
+
+ Size = pointers[i].size;
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+
+#else
+
+ i = 0;
+ while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
+ i++;
+
+ /* If we did not found the pointer, then this is a "small" chunk. */
+
+ if ( i < MAX_TRACKED_BIGCHUNKS )
+ {
+ Size = pointers[i].size;
+ pointers[i].base = NULL;
+ pointers[i].base = NULL;
+ }
+
+#endif /* DEBUG_MEMORY */
+
+ if ( Size > ( UINT_MAX & ~0xFu ) )
+ huge_free( *P );
+ else
+ free( *P );
+
+ *P = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTMemory_Init
+ *
+ * Description : Initializes the memory.
+ *
+ * Output : Always SUCCESS.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTMemory_Init( void )
+ {
+#ifdef DEBUG_MEMORY
+ Int i;
+
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+
+ num_alloc = 0;
+ num_realloc = 0;
+ num_free = 0;
+
+ fail_alloc = 0;
+ fail_realloc = 0;
+ fail_free = 0;
+#else
+ Int i;
+
+ for ( i = 0; i < MAX_TRACKED_BIGCHUNKS; i++ )
+ {
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+#endif
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated = 0;
+ TTMemory_MaxAllocated = 0;
+#endif
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTMemory_Done
+ *
+ * Description : Finalizes memory usage.
+ *
+ * Output : Always SUCCESS.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTMemory_Done( void )
+ {
+#ifdef DEBUG_MEMORY
+ Int i, num_leaked, tot_leaked;
+
+
+ num_leaked = 0;
+ tot_leaked = 0;
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ if ( pointers[i].base )
+ {
+ num_leaked ++;
+ tot_leaked += pointers[i].size;
+ }
+ }
+
+ fprintf( stderr,
+ "%d memory allocations, of which %d failed\n",
+ num_alloc,
+ fail_alloc );
+
+ fprintf( stderr,
+ "%d memory reallocations, of which %d failed\n",
+ num_realloc,
+ fail_realloc );
+
+ fprintf( stderr,
+ "%d memory frees, of which %d failed\n",
+ num_free,
+ fail_free );
+
+ if ( num_leaked > 0 )
+ {
+ fprintf( stderr,
+ "There are %d leaked memory blocks, totalizing %d bytes\n",
+ num_leaked, tot_leaked );
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ if ( pointers[i].base )
+ {
+ fprintf( stderr,
+ "index: %4d (base: $%08lx, size: %08ld)\n",
+ i,
+ (long)pointers[i].base,
+ pointers[i].size );
+ }
+ }
+ }
+ else
+ fprintf( stderr, "No memory leaks !\n" );
+
+#endif /* DEBUG_MEMORY */
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/msdos/makedep b/Build/source/libs/freetype/lib/arch/msdos/makedep
new file mode 100755
index 00000000000..43207cc46b4
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/msdos/makedep
@@ -0,0 +1,39 @@
+# makedep
+#
+# This shell script creates a dependency file necessary for older compilers
+# on the MS-DOS platform.
+#
+# Copyright 1996-2002 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.
+
+echo "\
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in \`makedep'...
+#
+# This dependency file to be used with various MS-DOS compilers
+# has been generated automatically with the script \`makedep' on
+# `date +%Y-%m-%d`.
+" > depend.dos
+
+(cd ../..
+ gcc -MM -Iarch/msdos -I. *.c | \
+ sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.dos
+
+(cd ../..
+ gcc -MM -Iarch/msdos -I. -Iextend extend/*.c | \
+ sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.dos
+
+(cd ../..
+ gcc -MM -Iarch/msdos -I. -Iextend \
+ -DTT_HUGE_PTR -Dhuge_alloc -Dhuge_free arch/msdos/*.c | \
+ sed -e "s/^\(.*\)\.o:/arch\\\\msdos\\\\\1.obj:/" \
+ -e "s:/:\\\\:g") >> depend.dos
+
+# eof
diff --git a/Build/source/libs/freetype/lib/arch/os2/Makefile.dm b/Build/source/libs/freetype/lib/arch/os2/Makefile.dm
new file mode 100644
index 00000000000..67a00249af4
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/Makefile.dm
@@ -0,0 +1,94 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc under OS/2
+#
+# You will need dmake.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# dmake -r -f arch/os2/Makefile.dm
+#
+#
+# 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.
+
+ARCH = arch/os2
+FT_MAKEFILE = $(ARCH)/Makefile.dm
+FT_MAKE = dmake -r
+
+.IMPORT: COMSPEC
+SHELL := $(COMSPEC)
+SHELLFLAGS := /c
+GROUPSHELL := $(SHELL)
+GROUPFLAGS := $(SHELLFLAGS)
+GROUPSUFFIX := .cmd
+SHELLMETAS := *"?<>&|
+
+CC = gcc
+
+CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
+# CFLAGS = -Wall -ansi -O2 -s -I$(ARCH) -I. -Iextend
+
+TTFILE = $(ARCH)/os2file.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = ./ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
+ extend/ftxgdef.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+ $(CC) $(CFLAGS) -c -o $@ $(SRC_S)
+
+
+libttf.a: $($(LIB_FILES))
+ +-del $@
+ ar src $@ @$(mktmp $(<:t"\n")\n)
+
+clean:
+ -+del $(subst,/,\ $($(LIB_FILES)))
+
+distclean: clean
+ -+del dep.end libttf.a
+
+# depend: $(SRC_S) $(SRC_M) $(SRC_X)
+# $(CC) -E -M @$(mktmp $(<:t"\n")\n) > dep.end
+
+# ifeq (dep.end,$(wildcard dep.end))
+# include dep.end
+# endif
+
+# end of Makefile.dm
diff --git a/Build/source/libs/freetype/lib/arch/os2/Makefile.emx b/Build/source/libs/freetype/lib/arch/os2/Makefile.emx
new file mode 100644
index 00000000000..be5b8143444
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/Makefile.emx
@@ -0,0 +1,102 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc under OS/2.
+#
+# You will need GNU make.
+#
+# Use this file while in the lib directory with the following statements:
+#
+# make -f arch/os2/Makefile.emx depend
+# make -f arch/os2/Makefile.emx
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/os2
+FT_MAKEFILE = $(ARCH)/Makefile.emx
+
+CC = gcc
+
+#CFLAGS = -W -Wall -O0 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
+
+CFLAGS = -Wall -O3 -fno-inline -fomit-frame-pointer \
+ -g -ansi -pedantic -I$(ARCH) -I. -Iextend
+
+#CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend
+
+TTFILE = $(ARCH)/os2file.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = ./ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
+ extend/ftxgdef.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+SRCD_S = $(ARCH)/freetypd.c
+OBJD_S = $(SRCD_S:.c=.o)
+OBJDS_S = $(OBJD_S) $(OBJS_X)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
+
+debugger:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJDS_S libttfd.a
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+$(OBJD_S): $(SRCD_S) $(SRC_M)
+
+libttf.a: $($(LIB_FILES))
+ -del $@
+ ar src $@ $^
+
+libttfd.a: $(OBJDS)
+
+libttfd.a: $(OBJDS)
+ -del $@
+ ar src $@ $^
+
+clean:
+ -del $(subst /,\,$(OBJS_S))
+ -del $(subst /,\,$(OBJS_M))
+
+distclean: clean
+ -del dep.end
+ -del libttf.a
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) -E -MM -I$(ARCH) -I. -Iextend $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.emx
diff --git a/Build/source/libs/freetype/lib/arch/os2/Makefile.icc b/Build/source/libs/freetype/lib/arch/os2/Makefile.icc
new file mode 100644
index 00000000000..2c387af3ef9
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/Makefile.icc
@@ -0,0 +1,82 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for IBM VisualAge C++ under OS/2.
+#
+# You will need nmake.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# nmake -f arch\os2\Makefile.icc
+#
+#
+# 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.
+
+ARCH = arch\os2
+FT_MAKEFILE = $(ARCH)\Makefile.icc
+FT_MAKE = $(MAKE) -nologo
+
+CC = icc
+CFLAGS = -O+ -Ti- -Tm- -Sa -W3 -Wpro- -Wcnd- -Q+ -Iarch\os2 -I. -Iextend
+
+# NOTE: Optimizations are discarded, as it seems that Visual Age
+# is buggy when producing ttraster.obj. The resulting code
+# crashes under some circumstances (performing vertical dropout
+# control when rendering smoothed outlines)!
+
+TTFILE = $(ARCH)\os2file.c
+TTMEMORY = .\ttmemory.c
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c \
+ extend\ftxcmap.c extend\ftxwidth.c extend\ftxsbit.c \
+ extend\ftxgsub.c extend\ftxgpos.c extend\ftxopen.c \
+ extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c \
+ ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+all:
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_S)" libttf.lib
+
+debug:
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_M)" libttf.lib
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+ $(CC) -C $(CFLAGS) /Fo$@ $*.c
+
+$(OBJS_X):
+ $(CC) -C $(CFLAGS) /Fo$@ $*.c
+
+$(ARCH)\os2file.obj:
+ $(CC) -C $(CFLAGS) /Fo$@ $*.c
+
+libttf.lib: $(LIB_FILES)
+ !ilib /nologo /noignorecase /nobackup $@ +$?,,
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del arch\os2\*.obj
+
+distclean: clean
+ -del libttf.lib
+
+# end of Makefile.icc
diff --git a/Build/source/libs/freetype/lib/arch/os2/Makefile.wat b/Build/source/libs/freetype/lib/arch/os2/Makefile.wat
new file mode 100644
index 00000000000..6e4e911fe0e
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/Makefile.wat
@@ -0,0 +1,98 @@
+# This file is part of the FreeType project.
+#
+# This builds the Watcom library with Watcom's wcc386 under OS/2.
+#
+# You'll need Watcom's wmake.
+#
+#
+# Invoke by "wmake -f arch\os2\Makefile.wat" when in the "lib" directory
+#
+# This will build "freetype\lib\libttf.lib"
+#
+#
+# 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.
+
+ARCH = arch\os2
+FT_MAKEFILE = $(ARCH)\Makefile.wat
+FT_MAKE = wmake -h
+
+
+.EXTENSIONS:
+.EXTENSIONS: .lib .obj .c .h
+.obj:.;.\extend;.\$(ARCH)
+.c:.;.\extend;.\$(ARCH)
+.h:.;.\extend;.\$(ARCH)
+
+CC = wcc386
+
+CCFLAGS = /otexanl+ /s /w5 /zq -Iarch\os2 -I. -Iextend
+
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+TTMUTEX = .\ttmutex.c
+
+TTFILE_OBJ = ttfile.obj
+TTMEMORY_OBJ = ttmemory.obj
+TTMUTEX_OBJ = ttmutex.obj
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+PORT_OBJS = $(TTFILE_OBJ) $(TTMEMORY_OBJ) $(TTMUTEX_OBJ)
+
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c &
+ extend\ftxcmap.c extend\ftxwidth.c extend\ftxsbit.c &
+ extend\ftxgsub.c extend\ftxgpos.c extend\ftxopen.c &
+ extend\ftxgdef.c
+
+OBJS_X = extend\ftxgasp.obj extend\ftxkern.obj extend\ftxpost.obj &
+ extend\ftxcmap.obj extend\ftxwidth.obj extend\ftxsbit.obj &
+ extend\ftxgsub.obj extend\ftxgpos.obj extend\ftxopen.obj &
+ extend\ftxgdef.obj
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c &
+ ttgload.c ttinterp.c ttload.c ttobjs.c &
+ ttraster.c ttextend.c $(PORT)
+
+OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj &
+ ttgload.obj ttinterp.obj ttload.obj ttobjs.obj &
+ ttraster.obj ttextend.obj $(PORT_OBJS) $(OBJS_X)
+
+SRC_S = freetype.c
+OBJ_S = freetype.obj
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+.c.obj:
+ $(CC) $(CCFLAGS) $[* /fo=$[*.obj
+
+all: .symbolic
+ $(FT_MAKE) -f $(FT_MAKEFILE) libttf.lib
+
+debug: .symbolic
+ $(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_M)" libttf.lib
+
+
+libttf.lib: $(OBJS_M)
+ wlib -q -n libttf.lib $(OBJS_M)
+
+# is this correct? Know nothing about wmake and the Watcom compiler...
+$(OBJ_S): $(SRC_S) $(SRC_M)
+ $(CC) $(CCFLAGS) $(SRC_S) /fo=$(OBJ_S)
+
+clean: .symbolic
+ @-erase $(OBJS_M)
+ @-erase *.err
+
+distclean: .symbolic clean
+ @-erase libttf.lib
+
+new: .symbolic
+ @-wtouch *.c
+
+# end of Makefile.wat
diff --git a/Build/source/libs/freetype/lib/arch/os2/freetype.c b/Build/source/libs/freetype/lib/arch/os2/freetype.c
new file mode 100644
index 00000000000..7a115cff672
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/freetype.c
@@ -0,0 +1,32 @@
+/* This file is part of the FreeType project */
+
+/* Single file library component for OS/2 */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#include "os2file.c"
+#include "ttmemory.c"
+#include "ttmutex.c"
+
+/* the extensions are compiled separately, but we need to */
+/* include the file ttextend.c if we want to support them */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/os2/ft_conf.h b/Build/source/libs/freetype/lib/arch/os2/ft_conf.h
new file mode 100644
index 00000000000..fe3c04ba7a7
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/ft_conf.h
@@ -0,0 +1,229 @@
+/*******************************************************************
+ *
+ * ft_conf.h (OS/2 version)
+ *
+ * High-level interface specification.
+ *
+ * Copyright 1996-2002 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 is used to contain the definition of several
+ * configuration-specific macros.
+ *
+ ******************************************************************/
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+
+/**********************************************************************/
+/* */
+/* We begin by a series of macros that are automatically set by the */
+/* 'configure' script on Unix. They must be set manually on OS/2, */
+/* so here they are : */
+/* */
+/**********************************************************************/
+
+#define OS2
+
+/* Define to empty if the keyword "const" does not work. */
+/* #undef const */
+
+/* The number of bytes in a int. */
+/* OS/2 1.x needs editing here, by the way. ;-) */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+/* #undef HAVE_LOCALE_H */
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/os2/os2file.c b/Build/source/libs/freetype/lib/arch/os2/os2file.c
new file mode 100644
index 00000000000..aebb7c1deea
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/os2/os2file.c
@@ -0,0 +1,1236 @@
+/*******************************************************************
+ *
+ * os2file.c (OS2 version) 2.1
+ *
+ * File I/O Component (body).
+ *
+ * Copyright 1996-2001 by Michal Necasek,
+ * 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.
+ *
+ * NOTES:
+ *
+ * This implementation relies on the OS/2 file API. It was provided
+ * by the PM FreeType DLL author, Michal Necasek.
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+
+#include <os2.h> /* !Mike! */
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "freetype.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttengine.h"
+#include "ttmutex.h"
+#include "ttmemory.h"
+#include "ttfile.h" /* our prototypes */
+
+
+/* For now, we don't define additional error messages in the core library */
+/* to report open-on demand errors. Define these errors as standard ones. */
+
+#define TT_Err_Could_Not_ReOpen_File TT_Err_Could_Not_Open_File
+#define TT_Err_Could_Not_ReSeek_File TT_Err_Could_Not_Open_File
+
+
+ /* This definition is mandatory for each file component! */
+ FT_EXPORT_FUNC( const TFileFrame ) TT_Null_FileFrame = { NULL, 0, 0 };
+
+
+/* It has proven useful to do some bounds checks during development phase. */
+/* They should probably be undefined for speed reasons in a later release. */
+
+#if 0
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ if ( frame.cursor + n > frame.address + frame.size ) \
+ Panic( "Frame boundary error!\n" ); \
+ } while ( 0 )
+#else
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ } while ( 0 )
+#endif
+
+
+ /* Because a stream can be flushed, i.e., its file handle can be */
+ /* closed to save system resources, we must keep the stream's file */
+ /* pathname to be able to re-open it on demand when it is flushed. */
+
+ struct _TStream_Rec
+ {
+ Bool opened; /* is the stream handle opened ? */
+ String* name; /* the file's pathname */
+ Long position; /* current pos. within the file */
+
+ HFILE file; /* file handle !Mike! */
+ Long base; /* stream base in file */
+ Long size; /* stream size in file */
+ };
+
+ typedef struct _TStream_Rec TStream_Rec;
+ typedef TStream_Rec* PStream_Rec;
+
+
+ /* We support embedded TrueType files by allowing them to be */
+ /* inside any file, at any location, hence the 'base' argument. */
+ /* Note, however, that the current implementation does not allow you */
+ /* to specify a 'base' index when opening a file. */
+ /* (will come later) */
+ /* I still don't know if this will turn out useful... - DavidT */
+
+#define STREAM2REC( x ) ( (TStream_Rec*)HANDLE_Val( x ) )
+
+ static TT_Error Stream_Activate ( PStream_Rec stream );
+ static TT_Error Stream_Deactivate( PStream_Rec stream );
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /**** ****/
+ /**** N O N R E E N T R A N T I M P L E M E N T A T I O N ****/
+ /**** ****/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+ /* In non-reentrant builds, we allocate a single block where we'll */
+ /* place all the frames smaller than FRAME_CACHE_SIZE, rather than */
+ /* allocating a new block on each access. Bigger frames will be */
+ /* malloced normally in the heap. */
+ /* */
+ /* See TT_Access_Frame() and TT_Forget_Frame() for details. */
+
+#define FRAME_CACHE_SIZE 2048
+
+ /* The TFile_Component structure holds all the data that was */
+ /* previously declared static or global in this component. */
+ /* */
+ /* It is accessible through the 'engine.file_component' */
+ /* variable in re-entrant builds, or directly through the */
+ /* static 'files' variable in other builds. */
+
+ struct _TFile_Component
+ {
+ TMutex lock; /* used by the thread-safe build only */
+ Byte* frame_cache; /* frame cache */
+ PStream_Rec stream; /* current stream */
+ TFileFrame frame; /* current frame */
+ };
+
+ typedef struct _TFile_Component TFile_Component;
+
+ static TFile_Component files;
+
+#define CUR_Stream files.stream
+#define CUR_Frame files.frame
+
+#define STREAM_VARS /* void */
+#define STREAM_VAR /* void */
+
+/* The macro CUR_Stream denotes the current input stream. */
+/* Note that for the re-entrant version, the 'stream' name has been */
+/* chosen according to the macro STREAM_ARGS. */
+
+/* The macro CUR_Frame denotes the current file frame. */
+/* Note that for the re-entrant version, the 'frame' name has been */
+/* chosen according to the macro FRAME_ARGS. */
+
+/* The macro STREAM_VAR is used when calling public functions */
+/* that need an 'optional' stream argument. */
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ TT_Error error;
+
+ MUTEX_Create( files.lock );
+ files.stream = NULL;
+ ZERO_Frame( files.frame );
+
+ if ( ALLOC( files.frame_cache, FRAME_CACHE_SIZE ) )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ FREE( files.frame_cache );
+ MUTEX_Destroy( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Copies or duplicates a given stream.
+ *
+ * Input : org_stream original stream
+ * stream target stream (copy or duplicate)
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream org_stream,
+ TT_Stream* stream )
+ {
+ MUTEX_Lock( files.lock ); /* lock file mutex */
+
+ *stream = org_stream; /* copy the stream */
+ files.stream = STREAM2REC( org_stream ); /* set current stream */
+
+ Stream_Activate( files.stream );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream target stream
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ HANDLE_Set( *stream, NULL );
+ MUTEX_Release( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function fails if the byte range is not within the
+ * the file, or if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big in both cases).
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( size <= FRAME_CACHE_SIZE )
+ {
+ /* use the cache */
+ CUR_Frame.address = files.frame_cache;
+ CUR_Frame.size = FRAME_CACHE_SIZE;
+ }
+ else
+ {
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+ }
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if ( error )
+ {
+ if ( size > FRAME_CACHE_SIZE )
+ FREE( CUR_Frame.address );
+ CUR_Frame.address = NULL;
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Check_And_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * `size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function truncates `size' if the byte range is not
+ * within the file.
+ *
+ * It will fail if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big).
+ *
+ * It will fail if you make two consecutive calls
+ * to TT_Access_Frame(), without a TT_Forget_Frame() between
+ * them.
+ *
+ * The only difference with TT_Access_Frame() is that we
+ * check that the frame is within the current file. We
+ * otherwise truncate it.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+ Long readBytes, requested;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( size <= FRAME_CACHE_SIZE )
+ {
+ /* use the cache */
+ CUR_Frame.address = files.frame_cache;
+ CUR_Frame.size = FRAME_CACHE_SIZE;
+ }
+ else
+ {
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+ }
+
+ requested = size;
+ readBytes = CUR_Stream->size - TT_File_Pos( STREAM_VAR );
+ if ( size > readBytes )
+ size = readBytes;
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if ( error )
+ {
+ if ( requested > FRAME_CACHE_SIZE )
+ FREE( CUR_Frame.address );
+ CUR_Frame.address = NULL;
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Forget_Frame
+ *
+ * Description : Releases a cached frame after reading.
+ *
+ * Input : None
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Forget_Frame( FRAME_ARG )
+ {
+ if ( CUR_Frame.address == NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( CUR_Frame.size > FRAME_CACHE_SIZE )
+ FREE( CUR_Frame.address );
+
+ ZERO_Frame( CUR_Frame );
+
+ return TT_Err_Ok;
+ }
+
+
+#else /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /******** ********/
+ /******** R E E N T R A N T I M P L E M E N T A T I O N ********/
+ /******** ********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+/* a simple macro to access the file component's data */
+#define files ( *((TFile_Component*)engine.file_component) )
+
+#define CUR_Stream STREAM2REC( stream ) /* re-entrant macros */
+#define CUR_Frame (*frame)
+
+#define STREAM_VARS stream,
+#define STREAM_VAR stream
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Duplicates a stream for a new usage.
+ *
+ * Input : input_stream source stream to duplicate
+ * copy address of target duplicate stream
+ *
+ * Output : error code.
+ * The target stream is set to NULL in case of failure.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream input_stream,
+ TT_Stream* copy )
+ {
+ PStream_Rec rec = STREAM2REC( input_stream );
+
+ return TT_Open_Stream( rec->name, copy );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream target stream
+ *
+ * Output :
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ return TT_Close_Stream( stream );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function fails if the byte range is not within the
+ * the file, or if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big in both cases).
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS int size )
+ {
+ TT_Error error;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if ( error )
+ {
+ FREE( CUR_Frame.address );
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Check_And_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * `size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function truncates `size' if the byte range is not
+ * within the file.
+ *
+ * It will fail if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big).
+ *
+ * It will fail if you make two consecutive calls
+ * to TT_Access_Frame(), without a TT_Forget_Frame() between
+ * them.
+ *
+ * The only difference with TT_Access_Frame() is that we
+ * check that the frame is within the current file. We
+ * otherwise truncate it.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS int size )
+ {
+ TT_Error error;
+ Long readBytes;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+
+ readBytes = CUR_Stream->size - TT_File_Pos( STREAM_VAR );
+ if ( size > readBytes )
+ size = readBytes;
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if ( error )
+ {
+ FREE( CUR_Frame.address );
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Forget_Frame
+ *
+ * Description : Releases a cached frame after reading.
+ *
+ * Input : None
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Forget_Frame( FRAME_ARG )
+ {
+ if ( CUR_Frame.address == NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ FREE( CUR_Frame.address );
+ ZERO_Frame( CUR_Frame );
+
+ return TT_Err_Ok;
+ }
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*********** ***********/
+ /*********** C O M M O N I M P L E M E N T A T I O N ***********/
+ /*********** ***********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : Stream_Activate
+ *
+ * Description : activates a stream, this will either:
+ * - open a new file handle if the stream is closed
+ * - move the stream to the head of the linked list
+ *
+ * Input : stream the stream to activate
+ *
+ * Output : error condition.
+ *
+ * Note : this function is also called with fresh new streams
+ * created by TT_Open_Stream(). They have their 'size'
+ * field set to -1.
+ *
+ ******************************************************************/
+
+ static TT_Error Stream_Activate( PStream_Rec stream )
+ {
+ ULONG ulAction; /* !Mike! */
+
+ if ( !stream->opened )
+ {
+#if 0
+ if ( !(stream->file = fopen( stream->name, "rb" )) ) /* !Mike! */
+#endif
+
+/* XXX : Strange. GCC/EMX wants an (Byte*) for the file name? */
+#ifdef __EMX__
+
+ if ( DosOpen( (Byte*)stream->name, &(stream->file),
+ &ulAction, 0,
+ 0, OPEN_ACTION_OPEN_IF_EXISTS,
+ OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL ) )
+ return TT_Err_Could_Not_ReOpen_File;
+
+#else
+
+ if ( DosOpen( stream->name, &(stream->file),
+ &ulAction, 0,
+ 0, OPEN_ACTION_OPEN_IF_EXISTS,
+ OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL ) )
+ return TT_Err_Could_Not_ReOpen_File;
+
+#endif /* __EMX__ */
+
+ stream->opened = TRUE;
+
+ /* A newly created stream has a size field of -1 */
+ if ( stream->size < 0 )
+ {
+#if 0
+ fseek( stream->file, 0, SEEK_END ); /* !Mike! */
+ stream->size = ftell( stream->file );
+#endif
+
+ DosSetFilePtr( stream->file, 0, FILE_END, (ULONG *)&(stream->size) );
+#if 0
+ fseek( stream->file, 0, SEEK_SET );
+#endif
+
+ DosSetFilePtr( stream->file, 0, FILE_BEGIN, &ulAction );
+ }
+
+ /* Reset cursor in file */
+ if ( stream->position )
+ {
+#if 0 /* !Mike! */
+ if ( fseek( stream->file, stream->position, SEEK_SET ) != 0 )
+#endif
+
+ if ( DosSetFilePtr( stream->file, stream->position,
+ FILE_BEGIN, &ulAction ) )
+ {
+ /* error during seek */
+#if 0
+ fclose( stream->file ); /* !Mike! */
+#endif
+
+ DosClose( stream->file );
+ stream->opened = FALSE;
+ return TT_Err_Could_Not_ReSeek_File;
+ }
+ }
+ }
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Stream_DeActivate
+ *
+ * Description : deactivates a stream, this will:
+ * - close its file handle if it was opened
+ * - remove it from the opened list if necessary
+ *
+ * Input : stream the stream to deactivate
+ *
+ * Output : Error condition
+ *
+ * Note : the function is called whenever a stream is deleted
+ * (_not_ when a stream handle's is closed due to an
+ * activation). However, the stream record isn't
+ * destroyed by it...
+ *
+ ******************************************************************/
+
+ static TT_Error Stream_Deactivate( PStream_Rec stream )
+ {
+ if ( stream->opened )
+ {
+ /* Save its current position within the file */
+#if 0
+ stream->position = ftell( stream->file ); /* !Mike! */
+#endif
+
+ DosSetFilePtr( stream->file, 0, FILE_CURRENT,
+ (ULONG *)&(stream->position) );
+#if 0
+ fclose( stream->file ); /* !Mike! */
+#endif
+
+ DosClose( stream->file );
+ stream->file = 0;
+ stream->opened = FALSE;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Stream_Size
+ *
+ * Description : Returns the length of a given stream, even if it
+ * is flushed.
+ *
+ * Input : stream the stream
+ *
+ * Output : length of stream in bytes.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Stream_Size( TT_Stream stream )
+ {
+ PStream_Rec rec = STREAM2REC( stream );
+
+
+ if ( rec )
+ return rec->size;
+ else
+ return 0; /* invalid stream - return 0 */
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Open_Stream
+ *
+ * Description : Opens the font file and saves the total file size.
+ *
+ * Input : error address of stream's error variable
+ * (re-entrant build only)
+ * filepathname pathname of the file to open
+ * stream address of target TT_Stream structure
+ *
+ * Output : SUCCESS on sucess, FAILURE on error.
+ * The target stream is set to -1 in case of failure.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Open_Stream( const String* filepathname,
+ TT_Stream* stream )
+ {
+ int len;
+ TT_Error error;
+ PStream_Rec stream_rec;
+
+
+ if ( ALLOC( *stream, sizeof ( TStream_Rec ) ) )
+ return error;
+
+ stream_rec = STREAM2REC( *stream );
+
+ stream_rec->file = NULLHANDLE; /* !Mike! */
+ stream_rec->size = -1;
+ stream_rec->base = 0;
+ stream_rec->opened = FALSE;
+ stream_rec->position = 0;
+
+ len = strlen( filepathname ) + 1;
+ if ( ALLOC( stream_rec->name, len ) )
+ goto Fail;
+
+ strncpy( (String*)stream_rec->name, filepathname, len );
+
+ error = Stream_Activate( stream_rec );
+ if ( error )
+ goto Fail_Activate;
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ CUR_Stream = stream_rec;
+#endif
+
+ return TT_Err_Ok;
+
+ Fail_Activate:
+ FREE( stream_rec->name );
+ Fail:
+ FREE( stream_rec );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Close_Stream
+ *
+ * Description : Closes a stream.
+ *
+ * Input : stream address of target TT_Stream structure
+ *
+ * Output : SUCCESS (always).
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Close_Stream( TT_Stream* stream )
+ {
+ PStream_Rec rec = STREAM2REC( *stream );
+
+
+ Stream_Deactivate( rec );
+ FREE( rec->name );
+ FREE( rec );
+
+ HANDLE_Set( *stream, NULL );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Flush_Stream
+ *
+ * Description : Flushes a stream, i.e., closes its file handle.
+ *
+ * Input : stream address of target TT_Stream structure
+ *
+ * Output : Error code
+ *
+ * NOTE : Never flush the current opened stream. This means that
+ * you should _never_ call this function between a
+ * TT_Use_Stream() and a TT_Done_Stream()!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Flush_Stream( TT_Stream* stream )
+ {
+ PStream_Rec rec = STREAM2REC( *stream );
+
+
+ if ( rec )
+ {
+ Stream_Deactivate( rec );
+ return TT_Err_Ok;
+ }
+ else
+ return TT_Err_Invalid_Argument;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Seek_File
+ *
+ * Description : Seeks the file cursor to a different position.
+ *
+ * Input : position new position in file
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Seek_File( STREAM_ARGS long position )
+ {
+ ULONG ibActual; /* !Mike! */
+
+
+ position += CUR_Stream->base;
+
+#if 0
+ if ( fseek( CUR_Stream->file, position, SEEK_SET ) ) /* !Mike! */
+#endif
+
+ if ( DosSetFilePtr( CUR_Stream->file, position, FILE_BEGIN , &ibActual ) )
+ return TT_Err_Invalid_File_Offset;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Skip_File
+ *
+ * Description : Skips forward the file cursor.
+ *
+ * Input : distance number of bytes to skip
+ *
+ * Output : see TT_Seek_File()
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Skip_File( STREAM_ARGS long distance )
+ {
+ ULONG ibActual; /* !Mike! */
+
+
+#if 0
+ return TT_Seek_File( STREAM_VARS ftell( CUR_Stream->file ) -
+ CUR_Stream->base + distance ); /* !Mike! */
+#endif
+
+ DosSetFilePtr( CUR_Stream->file, 0, FILE_CURRENT, &ibActual );
+ return TT_Seek_File( STREAM_VARS ibActual - CUR_Stream->base + distance );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_File
+ *
+ * Description : Reads a chunk of the file and copies it to memory.
+ *
+ * Input : buffer target buffer
+ * count length in bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_File( STREAM_ARGS void* buffer, long count )
+ {
+ ULONG cbActual; /* !Mike! */
+
+#if 0 /* !Mike! */
+ if ( fread( buffer, 1, count, CUR_Stream->file ) != (unsigned long)count )
+#endif
+
+ DosRead( CUR_Stream->file, buffer, count, &cbActual );
+ if ( cbActual != (unsigned long)count )
+ return TT_Err_Invalid_File_Read;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_At_File
+ *
+ * Description : Reads file at a specified position.
+ *
+ * Input : position position to seek to before read
+ * buffer target buffer
+ * count number of bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_At_File( STREAM_ARGS long position,
+ void* buffer,
+ long count )
+ {
+ TT_Error error;
+
+
+ if ( ( error = TT_Seek_File( STREAM_VARS position ) ) ||
+ ( error = TT_Read_File( STREAM_VARS buffer, count ) ) )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_File_Pos
+ *
+ * Description : Returns current file seek pointer.
+ *
+ * Input : none
+ *
+ * Output : current file position
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_File_Pos( STREAM_ARG )
+ {
+ ULONG ibActual; /* !Mike! */
+
+
+#if 0
+ return ftell( CUR_Stream->file ) - CUR_Stream->base; /* !Mike! */
+#endif
+
+ DosSetFilePtr( CUR_Stream->file, 0, FILE_CURRENT, &ibActual );
+ return ibActual - CUR_Stream->base;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Byte
+ *
+ * Description : Extracts a byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted Byte.
+ *
+ ******************************************************************/
+#if 0
+ FT_EXPORT_FUNC( Byte )
+ TT_Get_Byte( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Byte)(*CUR_Frame.cursor++);
+ }
+#endif
+
+/*******************************************************************
+ *
+ * Function : GET_Char
+ *
+ * Description : Extracts a signed byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted char.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Char )
+ TT_Get_Char( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Char)(*CUR_Frame.cursor++);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Short
+ *
+ * Description : Extracts a short from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted short.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( short )
+ TT_Get_Short( FRAME_ARG )
+ {
+ short getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = ((short)CUR_Frame.cursor[0] << 8) |
+ (short)CUR_Frame.cursor[1];
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_UShort
+ *
+ * Description : Extracts an unsigned short from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted ushort.
+ *
+ ******************************************************************/
+#if 0
+ FT_EXPORT_FUNC( unsigned )
+ short TT_Get_UShort( FRAME_ARG )
+ {
+ unsigned short getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = ((unsigned short)CUR_Frame.cursor[0] << 8) |
+ (unsigned short)CUR_Frame.cursor[1];
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+#endif
+
+/*******************************************************************
+ *
+ * Function : GET_Long
+ *
+ * Description : Extracts a long from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted long.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( long )
+ TT_Get_Long( FRAME_ARG )
+ {
+ long getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ((long)CUR_Frame.cursor[0] << 24) |
+ ((long)CUR_Frame.cursor[1] << 16) |
+ ((long)CUR_Frame.cursor[2] << 8 ) |
+ (long)CUR_Frame.cursor[3];
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_ULong
+ *
+ * Description : Extracts an unsigned long from the frame.
+ *
+ * Input : None
+ *
+ * Output : Extracted ulong.
+ *
+ ******************************************************************/
+#if 0
+ FT_EXPORT_FUNC( unsigned )
+ long TT_Get_ULong( FRAME_ARG )
+ {
+ unsigned long getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ( ((unsigned long)CUR_Frame.cursor[0] << 24) |
+ ((unsigned long)CUR_Frame.cursor[1] << 16) |
+ ((unsigned long)CUR_Frame.cursor[2] << 8 ) |
+ (unsigned long)CUR_Frame.cursor[3] );
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/unix/.cvsignore b/Build/source/libs/freetype/lib/arch/unix/.cvsignore
new file mode 100644
index 00000000000..f3c7a7c5da6
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/unix/.cvsignore
@@ -0,0 +1 @@
+Makefile
diff --git a/Build/source/libs/freetype/lib/arch/unix/.cvsignore.delete b/Build/source/libs/freetype/lib/arch/unix/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/unix/.cvsignore.delete
diff --git a/Build/source/libs/freetype/lib/arch/unix/Makefile.in b/Build/source/libs/freetype/lib/arch/unix/Makefile.in
new file mode 100644
index 00000000000..0875a7a8fda
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/unix/Makefile.in
@@ -0,0 +1,256 @@
+# This file is part of the FreeType project.
+#
+# lib/arch/unix/Makefile.in
+#
+#
+# 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.
+
+ARCH = arch/unix
+FT_MAKEFILE = $(ARCH)/Makefile
+
+RM = @RM@
+RMF = @RM@ -f
+RMDIR = @RMDIR@
+LN_S = @LN_S@
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+VPATH = @srcdir@/../..
+srcdir = @srcdir@/../..
+
+top_builddir=..
+
+CC = @CC@
+CPP = @CPP@
+
+LIBTOOL = $(top_builddir)/libtool
+MKINSTALLDIRS = $(srcdir)/../mkinstalldirs
+
+version_info = @version_info@
+
+include $(top_builddir)/MakeSub
+
+############### PORTABILITY COMPONENTS ########################
+
+# location of memory component
+MEMSRC = ttmemory.c
+
+# location of file component
+FILESRC = @TT_FILE_COMPONENT@
+
+# location of mutex component
+MUTEXSRC = ttmutex.c
+
+# location of default extensions
+FTEXTDIR = $(srcdir)/extend
+
+
+# default extensions sources
+EXTSRC = $(FTEXTDIR)/ftxkern.c \
+ $(FTEXTDIR)/ftxgasp.c \
+ $(FTEXTDIR)/ftxpost.c \
+ $(FTEXTDIR)/ftxcmap.c \
+ $(FTEXTDIR)/ftxsbit.c \
+ $(FTEXTDIR)/ftxwidth.c \
+ $(FTEXTDIR)/ftxerr18.c \
+ $(FTEXTDIR)/ftxgsub.c \
+ $(FTEXTDIR)/ftxgpos.c \
+ $(FTEXTDIR)/ftxgdef.c \
+ $(FTEXTDIR)/ftxopen.c
+
+EXTOBJ = ftxkern.lo \
+ ftxgasp.lo \
+ ftxpost.lo \
+ ftxcmap.lo \
+ ftxsbit.lo \
+ ftxwidth.lo \
+ ftxerr18.lo \
+ ftxgsub.lo \
+ ftxgpos.lo \
+ ftxgdef.lo \
+ ftxopen.lo
+
+# all engine sources
+SRC_M = $(srcdir)/ttapi.c \
+ $(srcdir)/ttcache.c \
+ $(srcdir)/ttcalc.c \
+ $(srcdir)/ttcmap.c \
+ $(srcdir)/ttdebug.c \
+ $(srcdir)/ttextend.c \
+ $(srcdir)/ttgload.c \
+ $(srcdir)/ttinterp.c \
+ $(srcdir)/ttload.c \
+ $(srcdir)/ttobjs.c \
+ $(srcdir)/ttraster.c \
+ $(srcdir)/$(FILESRC) \
+ $(srcdir)/$(MEMSRC) \
+ $(srcdir)/$(MUTEXSRC)
+SRC_S = $(srcdir)/$(ARCH)/freetype.c
+
+# all header files
+HEADERS = $(srcdir)/freetype.h \
+ $(srcdir)/fterrid.h \
+ $(srcdir)/ftnameid.h \
+ $(FTEXTDIR)/ftxkern.h \
+ $(FTEXTDIR)/ftxgasp.h \
+ $(FTEXTDIR)/ftxcmap.h \
+ $(FTEXTDIR)/ftxsbit.h \
+ $(FTEXTDIR)/ftxpost.h \
+ $(FTEXTDIR)/ftxwidth.h \
+ $(FTEXTDIR)/ftxerr18.h \
+ $(FTEXTDIR)/ftxgsub.h \
+ $(FTEXTDIR)/ftxgpos.h \
+ $(FTEXTDIR)/ftxgdef.h \
+ $(FTEXTDIR)/ftxopen.h
+
+# all engine objects
+OBJ_M = ttapi.lo \
+ ttcache.lo \
+ ttcalc.lo \
+ ttcmap.lo \
+ ttdebug.lo \
+ ttextend.lo \
+ ttgload.lo \
+ ttinterp.lo \
+ ttload.lo \
+ ttobjs.lo \
+ ttraster.lo \
+ file.lo \
+ memory.lo \
+ mutex.lo \
+ $(EXTOBJ)
+OBJ_S = freetype.lo $(EXTOBJ)
+
+
+# include paths
+INCLUDES = -I. -I$(top_builddir) -I$(srcdir) -I$(FTEXTDIR)
+
+# C flags
+CFLAGS = @CFLAGS@ @XX_CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+FT_CFLAGS = $(CFLAGS) $(INCLUDES)
+
+# linker flags
+FT_LIBS = @LIBS@
+
+# i18n stuff
+LOCALEDIR = @LOCALEDIR@
+
+
+all: do_link
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJ_S)" libttf.la
+
+debug: do_link
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJ_M)" libttf.la
+
+
+do_link:
+ -$(RMF) memory.c file.c mutex.c
+ $(LN_S) $(srcdir)/$(MEMSRC) memory.c
+ $(LN_S) $(srcdir)/$(FILESRC) file.c
+ $(LN_S) $(srcdir)/$(MUTEXSRC) mutex.c
+
+
+.SUFFIXES: .lo
+.c.lo:
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $<
+
+ftxkern.lo: $(FTEXTDIR)/ftxkern.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxkern.c
+
+ftxgasp.lo: $(FTEXTDIR)/ftxgasp.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgasp.c
+
+ftxpost.lo: $(FTEXTDIR)/ftxpost.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxpost.c
+
+ftxcmap.lo: $(FTEXTDIR)/ftxcmap.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxcmap.c
+
+ftxsbit.lo: $(FTEXTDIR)/ftxsbit.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxsbit.c
+
+ftxwidth.lo: $(FTEXTDIR)/ftxwidth.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxwidth.c
+
+ftxerr18.lo: $(FTEXTDIR)/ftxerr18.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) \
+ -DLOCALEDIR='"$(LOCALEDIR)"' \
+ $(FTEXTDIR)/ftxerr18.c
+
+ftxgsub.lo: $(FTEXTDIR)/ftxgsub.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgsub.c
+
+ftxgpos.lo: $(FTEXTDIR)/ftxgpos.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgpos.c
+
+ftxgdef.lo: $(FTEXTDIR)/ftxgdef.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxgdef.c
+
+ftxopen.lo: $(FTEXTDIR)/ftxopen.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) $(FTEXTDIR)/ftxopen.c
+
+freetype.lo: $(SRC_S) $(SRC_M)
+ $(LIBTOOL) --mode=compile $(CC) -c $(FT_CFLAGS) \
+ -DLOCALEDIR='"$(LOCALEDIR)"' \
+ -DTT_MAKE_OPTION_SINGLE_OBJECT \
+ $(SRC_S)
+
+libttf.la: $(LIB_FILES)
+ $(LIBTOOL) --mode=link $(CC) -o libttf.la $(LIB_FILES) \
+ -rpath $(libdir) \
+ -version-info $(version_info) $(FT_LIBS)
+
+install: libttf.la
+ $(MKINSTALLDIRS) $(libdir) $(includedir)/freetype
+ $(LIBTOOL) --mode=install $(INSTALL) libttf.la $(libdir)
+ -for P in $(HEADERS) ; do \
+ $(INSTALL_DATA) $$P $(includedir)/freetype ; \
+ done
+
+uninstall:
+ -$(LIBTOOL) --mode=uninstall $(RM) $(libdir)/libttf.la
+ -$(RMF) $(includedir)/freetype/*
+ -$(RMDIR) $(includedir)/freetype
+
+clean:
+ -$(RMF) $(OBJ_S) $(OBJ_M) *.o
+
+distclean: clean
+ -$(RMF) file.c memory.c mutex.c
+ -$(RMF) libttf.la
+ -$(RMF) *.orig *~ core *.core
+ -$(RMF) $(ARCH)/Makefile
+ -$(RMF) .libs/*
+ -$(RMDIR) .libs
+
+depend: do_link
+ (echo '/^#.* PUT NO STUFF BELOW/,$$d' ; echo w ; echo q) | \
+ ed - $(ARCH)/Makefile
+ echo '# Dependencies generated by make depend: PUT NO STUFF BELOW' \
+ >> $(ARCH)/Makefile
+ for file in $(SRC_S) $(SRC_M) $(EXTSRC) ; do \
+ $(CPP) $(CPPFLAGS) $(INCLUDES) $$file | \
+ sed -n -e 's|^# [1-9][0-9]* "\([^/].*\.h\)".*|\1|p' \
+ -e 's|^# [1-9][0-9]* "\($(srcdir)/.*\.h\)".*|\1|p' | \
+ sed -e 's|/\./|.|g' -e "s/^/`basename $$file .c`.lo: /" ; \
+ done | \
+ sort -u | \
+ awk '{ if (LINE == 1) \
+ { line = last = $$1 } \
+ else if ($$1 != last) \
+ { print line ; line = last = $$1 } \
+ line = line " " $$2 } \
+ END { print line }' >> $(ARCH)/Makefile
+
+.PHONY: all debug do_link install uninstall clean distclean depend
+
+# Dependencies generated by make depend: PUT NO STUFF BELOW
diff --git a/Build/source/libs/freetype/lib/arch/unix/freetype.c b/Build/source/libs/freetype/lib/arch/unix/freetype.c
new file mode 100644
index 00000000000..9a4860dbd2c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/unix/freetype.c
@@ -0,0 +1,27 @@
+/* This file is part of the FreeType project */
+
+/* Single object library component for Unix */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* The Makefile creates proper links to following three files */
+
+#include "file.c"
+#include "memory.c"
+#include "mutex.c"
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/unix/ttmmap.c b/Build/source/libs/freetype/lib/arch/unix/ttmmap.c
new file mode 100644
index 00000000000..38896bd310d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/unix/ttmmap.c
@@ -0,0 +1,1028 @@
+/*******************************************************************
+ *
+ * ttmmap.c 2.0
+ *
+ * Memory-Mapped file component ( replaces ttfile.c ).
+ *
+ * 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.
+ *
+ * Changes between 2.0 and 1.3 :
+ *
+ * - adopted new design/separation introduced in ttfile.c 2.0
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0x00
+#endif
+
+/*
+ * The prototype for munmap() is not provided on SunOS. This needs to
+ * have a check added later to see if the GNU C library is being used.
+ * If so, then this prototype is not needed.
+ */
+#if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)
+ extern int munmap( caddr_t addr, int len );
+#endif
+
+#include <sys/stat.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+
+#include "freetype.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttengine.h"
+#include "ttmutex.h"
+#include "ttmemory.h"
+#include "ttfile.h" /* our prototypes */
+
+ /* This definition is mandatory for each file component! */
+ FT_EXPORT_FUNC( const TFileFrame )
+ TT_Null_FileFrame = { NULL, 0, 0 };
+
+ /* It has proven useful to do some bounds checks during */
+ /* development phase. Define DEBUG_FILE when compiling */
+ /* this component to enable them. */
+
+#ifdef DEBUG_FILE
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ if ( frame.cursor + n > frame.address + frame.size ) \
+ Panic( "Frame boundary error!\n" ); \
+ } while ( 0 )
+#else
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ } while( 0 )
+#endif
+
+ struct _TFileMap
+ {
+ String* base; /* base address of mapped file */
+ Int refcount; /* reference count for mmaped region */
+ Long size; /* stream size in file */
+ Long offset; /* offset in file */
+ };
+
+ typedef struct _TFileMap TFileMap;
+
+#define MAP_Address( map ) (Byte*)( (map)->base + (map)->offset )
+
+ /* The stream record structure */
+ typedef struct _TStream_Rec
+ {
+ TFileMap* map; /* mapped file description */
+ Long pos ; /* cursor in mapped file */
+ } TStream_Rec;
+
+ typedef TStream_Rec* PStream_Rec;
+
+#define STREAM2REC( x ) ( (TStream_Rec*)HANDLE_Val( x ) )
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /**** ****/
+ /**** N O N R E E N T R A N T I M P L E M E N T A T I O N ****/
+ /**** ****/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+ /* The TFile_Component structure holds all the data that was */
+ /* previously declared static or global in this component. */
+ /* */
+ /* It is accessible through the 'engine.file_component' */
+ /* variable in re-entrant builds, or directly through the */
+ /* static 'files' variable in other builds. */
+
+ struct _TFile_Component
+ {
+ TMutex lock; /* used by the thread-safe build only */
+ PStream_Rec stream; /* current stream */
+ TFileFrame frame; /* current frame */
+ };
+
+ typedef struct _TFile_Component TFile_Component;
+
+/* The macro CUR_Stream denotes the current input stream */
+/* Note that for the re-entrant version, the 'stream' name has been */
+/* chosen according to the macro STREAM_ARGS. */
+
+/* The macro CUR_Frame denotes the current file frame */
+/* Note that for the re-entrant version, the 'frame' name has been */
+/* chosen according to the macro FRAME_ARGS. */
+
+/* The macro STREAM_VAR is used when calling public functions */
+/* that need an 'optional' stream argument. */
+
+#define CUR_Stream files.stream /* thread-safe macros */
+#define CUR_Frame files.frame
+
+#define STREAM_VARS /* void */
+#define STREAM_VAR /* void */
+
+ /* the 'files' variable is only defined in non-reentrant builds */
+
+ static TFile_Component files;
+
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ MUTEX_Create( files.lock );
+ files.stream = NULL;
+ ZERO_Frame( files.frame );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ MUTEX_Destroy( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Copies or duplicates a given stream.
+ *
+ * Input : org_stream original stream
+ * stream target stream (copy or duplicate)
+ *
+ * Output : Error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream org_stream,
+ TT_Stream* stream )
+ {
+ MUTEX_Lock( files.lock );
+ *stream = org_stream;
+ files.stream = STREAM2REC( org_stream ); /* set current stream */
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream
+ *
+ * Output : Error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ HANDLE_Set( *stream, NULL );
+ MUTEX_Release( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+#else /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /******** ********/
+ /******** R E E N T R A N T I M P L E M E N T A T I O N ********/
+ /******** ********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+#define CUR_Stream STREAM2REC( stream ) /* re-entrant macros */
+#define CUR_Frame (*frame)
+
+#define STREAM_VARS stream,
+#define STREAM_VAR stream
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ engine->file_component = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Copies or duplicates a given stream.
+ *
+ * Input : org_stream original stream
+ * stream target stream (copy or duplicate)
+ *
+ * Output : Error code. The output stream is set to NULL in
+ * case of Failure.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream input_stream,
+ TT_Stream* copy )
+ {
+ TT_Error error;
+ PStream_Rec stream_rec;
+ PStream_Rec copy_rec;
+
+
+ stream_rec = STREAM2REC( input_stream );
+
+ if ( ALLOC( copy_rec, sizeof ( TStream_Rec ) ) )
+ goto Fail;
+
+ HANDLE_Set( *copy, copy_rec );
+
+ copy_rec->map = stream_rec->map;
+ copy_rec->map->refcount++;
+ copy_rec->pos = 0;
+
+ return TT_Err_Ok;
+
+ Fail:
+ HANDLE_Set( *copy, NULL );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream
+ *
+ * Output : error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ return TT_Close_Stream( stream );
+ }
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*********** ***********/
+ /*********** C O M M O N I M P L E M E N T A T I O N ***********/
+ /*********** ***********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : AllocateMap
+ *
+ * Description : Allocates a new map from the table.
+ *
+ * Output : Pointer to new stream rec. NULL in case of failure.
+ *
+ ******************************************************************/
+
+ static TFileMap*
+ Allocate_Map( void )
+ {
+ TFileMap* result;
+
+
+ if ( MEM_Alloc( result, sizeof ( TFileMap ) ) )
+ return NULL;
+
+ result->refcount = 1;
+ return result;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : ReleaseMap
+ *
+ * Description : Releases a used map to the table if reference i
+ * counter reaches zero.
+ *
+ * Input : map
+ *
+ * Output : None.
+ *
+ * Note : Called by TT_Close_File()
+ *
+ ******************************************************************/
+
+ static void
+ Release_Map ( TFileMap* map )
+ {
+ map->refcount--;
+ if ( map->refcount <= 0 )
+ {
+ munmap ( (void*)map->base, map->size );
+ FREE( map );
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Open_Stream
+ *
+ * Description : Opens the font file and saves the total file size.
+ *
+ * Input : error address of stream's error variable
+ * (re-entrant build only).
+ * filepathname pathname of the file to open
+ * stream address of target TT_Stream structure
+ *
+ * Output : SUCCESS on success, FAILURE on error.
+ * The target stream is set to -1 in case of failure.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Open_Stream( const String* filepathname,
+ TT_Stream* stream )
+ {
+ TT_Error error;
+ Int file;
+ PStream_Rec stream_rec;
+ TFileMap* map;
+ struct stat stat_buf;
+
+
+ if ( ALLOC( *stream, sizeof ( TStream_Rec ) ) )
+ return error;
+
+ map = Allocate_Map();
+ if ( !map )
+ {
+ error = TT_Err_Out_Of_Memory;
+ goto Memory_Fail;
+ }
+
+ stream_rec = STREAM2REC( *stream );
+
+ file = open( (String*)filepathname, O_RDONLY );
+ if ( file < 0 )
+ goto File_Fail;
+
+ if ( fstat( file, &stat_buf ) < 0 )
+ goto Map_Fail;
+
+ map->offset = 0;
+ map->size = stat_buf.st_size + map->offset;
+ map->base = mmap( NULL,
+ map->size,
+ PROT_READ,
+ MAP_FILE | MAP_PRIVATE,
+ file,
+ 0 );
+
+ if ( (long)map->base == -1 )
+ goto Map_Fail;
+
+ close( file );
+
+ stream_rec->map = map;
+ stream_rec->pos = 0;
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ CUR_Stream = stream_rec;
+#endif
+
+ return TT_Err_Ok;
+
+ Map_Fail:
+ close( file );
+
+ File_Fail:
+ error = TT_Err_Could_Not_Open_File;
+ FREE( map );
+
+ Memory_Fail:
+ FREE( *stream );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Close_Stream
+ *
+ * Description : Closes a stream.
+ *
+ * Input : stream
+ *
+ * Output : SUCCESS (always)
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Close_Stream( TT_Stream* stream )
+ {
+ PStream_Rec rec = STREAM2REC( *stream );
+
+
+ Release_Map( rec->map );
+ FREE( rec );
+
+ HANDLE_Set( *stream, NULL );
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Flush_Stream
+ *
+ * Description : Flushes a stream, i.e., closes its file handle.
+ *
+ * Input : stream address of target TT_Stream structure
+ *
+ * Output : Error code
+ *
+ * NOTE : Never flush the current opened stream. This means that
+ * you should _never_ call this function between a
+ * TT_Use_Stream() and a TT_Done_Stream()!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Flush_Stream( TT_Stream* stream )
+ {
+ /* XXX - DUMMY IMPLEMENTATION */
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Stream_Size
+ *
+ * Description : Returns the length of a given stream, even if it
+ * is flushed.
+ *
+ * Input : stream the stream
+ *
+ * Output : Length of stream in bytes.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Stream_Size( TT_Stream stream )
+ {
+ PStream_Rec rec = STREAM2REC( stream );
+
+
+ if ( rec )
+ return rec->map->size;
+ else
+ return 0; /* invalid stream - return 0 */
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Seek_File
+ *
+ * Description : Seeks the file cursor to a different position.
+ *
+ * Input : position new position in file
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Seek_File( STREAM_ARGS Long position )
+ {
+ if ( position > CUR_Stream->map->size )
+ return TT_Err_Invalid_File_Offset;
+
+ CUR_Stream->pos = position;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Skip_File
+ *
+ * Description : Skips forward the file cursor.
+ *
+ * Input : distance number of bytes to skip
+ *
+ * Output : see TT_Seek_File
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Skip_File( STREAM_ARGS Long distance )
+ {
+ return TT_Seek_File( STREAM_VARS CUR_Stream->pos + distance );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_File
+ *
+ * Description : Reads a chunk of the file and copies it to memory.
+ *
+ * Input : buffer target buffer
+ * count length in bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_File( STREAM_ARGS void* buffer, Long count )
+ {
+ if ( CUR_Stream->pos + count > CUR_Stream->map->size )
+ return TT_Err_Invalid_File_Read;
+
+ MEM_Copy( buffer,
+ MAP_Address( CUR_Stream->map ) + CUR_Stream->pos, count );
+ CUR_Stream->pos += count;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_At_File
+ *
+ * Description : Reads file at a specified position.
+ *
+ * Input : position position to seek to before read
+ * buffer target buffer
+ * count number of bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_At_File( STREAM_ARGS Long position,
+ void* buffer,
+ Long count )
+ {
+ TT_Error error;
+
+
+ if ( (error = TT_Seek_File( STREAM_VARS position )) ||
+ (error = TT_Read_File( STREAM_VARS buffer, count )) )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_File_Pos
+ *
+ * Description : Returns current file seek pointer.
+ *
+ * Input : none
+ *
+ * Output : current file position
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_File_Pos( STREAM_ARG )
+ {
+ return CUR_Stream->pos;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : Error code
+ *
+ * Notes: The function fails if the byte range is not within the
+ * the file, or if there is not enough memory to cache
+ * the bytes properly (which usually means that aSize is
+ * too big in both cases).
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( CUR_Stream->pos + size > CUR_Stream->map->size )
+ return TT_Err_Invalid_Frame_Access;
+
+ CUR_Frame.size = size;
+ CUR_Frame.address = MAP_Address( CUR_Stream->map ) + CUR_Stream->pos;
+ CUR_Frame.cursor = CUR_Frame.address;
+
+ CUR_Stream->pos += size;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Check_And_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx()
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : Error code
+ *
+ * Notes: The function truncates 'size' if the byte range is not
+ * within the file.
+ *
+ * It will fail if there is not enough memory to cache
+ * the bytes properly (which usually means that aSize is
+ * too big).
+ *
+ * It will fail if you make two consecutive calls
+ * to TT_Access_Frame(), without a TT_Forget_Frame() between
+ * them.
+ *
+ * The only difference with TT_Access_Frame() is that we
+ * check that the frame is within the current file. We
+ * otherwise truncate it. The 'overflow' is set to zero.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+ Long readBytes;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ readBytes = CUR_Stream->map->size - CUR_Stream->pos;
+ if ( size > readBytes )
+ {
+ /* There is overflow, we allocate a new block then */
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+
+ CUR_Frame.size = size;
+
+ /* copy the valid part */
+ MEM_Copy( CUR_Frame.address,
+ MAP_Address( CUR_Stream->map ) + CUR_Stream->pos,
+ readBytes );
+ }
+ else
+ {
+ CUR_Frame.size = size;
+ CUR_Frame.address = MAP_Address( CUR_Stream->map ) + CUR_Stream->pos;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Forget_Frame
+ *
+ * Description : Releases a cached frame after reading.
+ *
+ * Input : None
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Forget_Frame( STREAM_ARGS FRAME_ARG )
+ {
+ if ( CUR_Frame.address == NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ /* If we were using a duplicate in case of overflow, free it now */
+ if ( CUR_Frame.address < (Byte*)CUR_Stream->map->base ||
+ CUR_Frame.address >= (Byte*)CUR_Stream->map->base +
+ CUR_Stream->map->size )
+ FREE( CUR_Frame.address );
+
+ ZERO_Frame( CUR_Frame );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Byte
+ *
+ * Description : Extracts a byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted Byte
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+#if 0
+
+ FT_EXPORT_FUNC( Byte )
+ TT_Get_Byte( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Byte)(*CUR_Frame.cursor++);
+ }
+
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : GET_Char
+ *
+ * Description : Extracts a signed byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted char
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Char )
+ TT_Get_Char( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Char)(*CUR_Frame.cursor++);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Short
+ *
+ * Description : Extracts a short from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted short
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Short )
+ TT_Get_Short( FRAME_ARG )
+ {
+ Short getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = ((Short)CUR_Frame.cursor[0] << 8) |
+ (Short)CUR_Frame.cursor[1];
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_UShort
+ *
+ * Description : Extracts an unsigned short from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted ushort
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+#if 0
+
+ FT_EXPORT_FUNC( UShort )
+ TT_Get_UShort( FRAME_ARG )
+ {
+ UShort getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = ((UShort)CUR_Frame.cursor[0] << 8) |
+ (UShort)CUR_Frame.cursor[1];
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : GET_Long
+ *
+ * Description : Extracts a long from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted long
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Get_Long( FRAME_ARG )
+ {
+ Long getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ((Long)CUR_Frame.cursor[0] << 24) |
+ ((Long)CUR_Frame.cursor[1] << 16) |
+ ((Long)CUR_Frame.cursor[2] << 8 ) |
+ (Long)CUR_Frame.cursor[3];
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_ULong
+ *
+ * Description : Extracts an unsigned long from the frame.
+ *
+ * Input : None
+ *
+ * Output : Extracted ulong
+ *
+ * NOTES : We consider that the programmer is intelligent enough
+ * not to try to get a byte that is out of the frame. Hence,
+ * we provide no bounds check here. (A misbehaving client
+ * could easily page fault using this call.)
+ *
+ ******************************************************************/
+
+#if 0
+
+ FT_EXPORT_FUNC( ULong )
+ TT_Get_ULong( FRAME_ARG )
+ {
+ ULong getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ( ((ULong)CUR_Frame.cursor[0] << 24) |
+ ((ULong)CUR_Frame.cursor[1] << 16) |
+ ((ULong)CUR_Frame.cursor[2] << 8 ) |
+ (ULong)CUR_Frame.cursor[3] );
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/vms/README b/Build/source/libs/freetype/lib/arch/vms/README
new file mode 100644
index 00000000000..db7f684f73f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/vms/README
@@ -0,0 +1,20 @@
+This directory contains two files for compiling the FreeType library under
+VMS:
+
+ ft_conf.h the configuration file for the FreeType library
+ descrip.mms a makefile to be used with either MMS or MMK
+
+The files are such designed that after unpacking of freetype-1.5 one can
+give the command
+
+ MMS/DESCR=[.LIB.ARCH.VMS]
+
+to build the libraries. (Of course, for MMK use `MMK' on the command line
+instead of `MMS'.) The makefile contains a `clean' target, but no `install'
+target since I'm note sure where to install the library and the include
+files.
+
+I did NOT do the test programs but I tested it with my own programs.
+
+
+ Jouk Jansen <joukj@hrem.stm.tudelft.nl>
diff --git a/Build/source/libs/freetype/lib/arch/vms/descrip.mms b/Build/source/libs/freetype/lib/arch/vms/descrip.mms
new file mode 100644
index 00000000000..14dac2b8907
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/vms/descrip.mms
@@ -0,0 +1,163 @@
+# DESCRIP.MMS: Make file for VMS using MMS or MMK
+#
+#
+# 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.
+# Created by Jouk Jansen (joukj@hrem.stm.tudelft.nl)
+
+ARCH = arch.unix
+
+CC = cc
+
+############### PORTABILITY COMPONENTS ########################
+
+# location of memory component
+MEMSRC = ttmemory.c
+
+# location of file component
+FILESRC = ttfile.c
+
+# location of mutex component
+MUTEXSRC = ttmutex.c
+
+# location of default extensions
+FTEXTDIR = [.lib.extend]
+
+# default extensions sources
+EXTSRC = $(FTEXTDIR)ftxkern.c \
+ $(FTEXTDIR)ftxgasp.c \
+ $(FTEXTDIR)ftxpost.c \
+ $(FTEXTDIR)ftxcmap.c \
+ $(FTEXTDIR)ftxsbit.c \
+ $(FTEXTDIR)ftxwidth.c \
+ $(FTEXTDIR)ftxerr18.c \
+ $(FTEXTDIR)ftxgsub.c \
+ $(FTEXTDIR)ftxgpos.c \
+ $(FTEXTDIR)ftxopen.c \
+ $(FTEXTDIR)ftxgdef.c
+
+EXTOBJ = [.lib]ftxkern.obj, \
+ [.lib]ftxgasp.obj, \
+ [.lib]ftxpost.obj, \
+ [.lib]ftxcmap.obj, \
+ [.lib]ftxsbit.obj, \
+ [.lib]ftxwidth.obj, \
+ [.lib]ftxerr18.obj, \
+ [.lib]ftxgsub.obj, \
+ [.lib]ftxgpos.obj, \
+ [.lib]ftxopen.obj, \
+ [.lib]ftxgdef.obj
+
+# all engine sources
+SRC_M = [.lib]ttapi.c \
+ [.lib]ttcache.c \
+ [.lib]ttcalc.c \
+ [.lib]ttcmap.c \
+ [.lib]ttdebug.c \
+ [.lib]ttextend.c \
+ [.lib]ttgload.c \
+ [.lib]ttinterp.c \
+ [.lib]ttload.c \
+ [.lib]ttobjs.c \
+ [.lib]ttraster.c \
+ [.lib]$(FILESRC) \
+ [.lib]$(MEMSRC) \
+ [.lib]$(MUTEXSRC)
+SRC_S = [.lib.$(ARCH)]freetype.c
+
+# all header files with path
+HEADERS = [.lib]freetype.h \
+ [.lib]fterrid.h \
+ [.lib]ftnameid.h \
+ $(FTEXTDIR)ftxkern.h \
+ $(FTEXTDIR)ftxgasp.h \
+ $(FTEXTDIR)ftxcmap.h \
+ $(FTEXTDIR)ftxsbit.h \
+ $(FTEXTDIR)ftxpost.h \
+ $(FTEXTDIR)ftxwidth.h \
+ $(FTEXTDIR)ftxerr18.h \
+ $(FTEXTDIR)ftxgsub.h \
+ $(FTEXTDIR)ftxgpos.h \
+ $(FTEXTDIR)ftxgdef.h \
+ $(FTEXTDIR)ftxopen.h
+
+# all engine objects
+OBJ_M = [.lib]ttapi.obj, \
+ [.lib]ttcache.obj, \
+ [.lib]ttcalc.obj, \
+ [.lib]ttcmap.obj, \
+ [.lib]ttdebug.obj, \
+ [.lib]ttextend.obj, \
+ [.lib]ttgload.obj, \
+ [.lib]ttinterp.obj, \
+ [.lib]ttload.obj, \
+ [.lib]ttobjs.obj, \
+ [.lib]ttraster.obj, \
+ [.lib]file.obj, \
+ [.lib]memory.obj, \
+ [.lib]mutex.obj, \
+ $(EXTOBJ)
+OBJ_S = [.lib]freetype.obj
+
+
+# include paths
+INCLUDES = /include=([.lib],[],$(FTEXTDIR))
+
+# C flags
+CFLAGS = $(INCLUDES)/obj=[.lib]
+
+all : do_link [.lib]libttf.olb
+ library/compress [.lib]libttf.olb
+
+do_link :
+ if f$search( "[.lib]memory.c" ) .nes. "" then set file/remove [.lib]memory.c;
+ if f$search( "[.lib]file.c" ) .nes. "" then set file/remove [.lib]file.c;
+ if f$search( "[.lib]mutex.c" ) .nes. "" then set file/remove [.lib]mutex.c;
+ if f$search( "[.lib]ft_conf.h" ) .nes. "" then set file/remove [.lib]ft_conf.h;
+ set file/enter=[.lib]memory.c [.lib]$(MEMSRC)
+ set file/enter=[.lib]file.c [.lib]$(FILESRC)
+ set file/enter=[.lib]mutex.c [.lib]$(MUTEXSRC)
+ set file/enter=[.lib]ft_conf.h [.lib.arch.vms]ft_conf.h
+
+[.lib]ftxkern.obj : $(FTEXTDIR)ftxkern.c
+
+[.lib]ftxgasp.obj : $(FTEXTDIR)ftxgasp.c
+
+[.lib]ftxpost.obj : $(FTEXTDIR)ftxpost.c
+
+[.lib]ftxcmap.obj : $(FTEXTDIR)ftxcmap.c
+
+[.lib]ftxsbit.obj : $(FTEXTDIR)ftxsbit.c
+
+[.lib]ftxwidth.obj : $(FTEXTDIR)ftxwidth.c
+
+[.lib]ftxerr18.obj : $(FTEXTDIR)ftxerr18.c
+
+[.lib]ftxgsub.obj : $(FTEXTDIR)ftxgsub.c
+
+[.lib]ftxgpos.obj : $(FTEXTDIR)ftxgpos.c
+
+[.lib]ftxgdef.obj : $(FTEXTDIR)ftxgdef.c
+
+[.lib]ftxopen.obj : $(FTEXTDIR)ftxopen.c
+
+[.lib]freetype.obj : $(SRC_S) $(SRC_M)
+
+
+[.lib]libttf.olb : $(OBJ_M)
+ library/create [.lib]libttf.olb $(OBJ_M)
+
+
+clean :
+ delete [.lib]*.obj;*
+ delete [.lib]*.olb;*
+ if f$search( "[.lib]memory.c" ) .nes. "" then set file/remove [.lib]memory.c;
+ if f$search( "[.lib]file.c" ) .nes. "" then set file/remove [.lib]file.c;
+ if f$search( "[.lib]mutex.c" ) .nes. "" then set file/remove [.lib]mutex.c;
+ if f$search( "[.lib]ft_conf.h" ) .nes. "" then set file/remove [.lib]ft_conf.h;
diff --git a/Build/source/libs/freetype/lib/arch/vms/ft_conf.h b/Build/source/libs/freetype/lib/arch/vms/ft_conf.h
new file mode 100644
index 00000000000..bd4e1255046
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/vms/ft_conf.h
@@ -0,0 +1,212 @@
+/*******************************************************************
+ *
+ * ft_conf.h for VMS using MMS or MMK
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+#define HAVE_LOCALE_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+#endif /* FT_CONF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/win16/Makefile.BC b/Build/source/libs/freetype/lib/arch/win16/Makefile.BC
new file mode 100644
index 00000000000..96633031f8b
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/Makefile.BC
@@ -0,0 +1,190 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Borland C++ for 16-bit Windows, large model.
+# Due to size constraints, it does not try to pack all modules into one.
+#
+# You will need Borland MAKE.
+# Tested with Borland C++ v.4.0 and 5.0.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# make -farch/win16/Makefile.BC
+#
+#
+# A DLL version of the library can be built with
+#
+# make -DDLL -farch/win16/Makefile.BC dll
+#
+# Debug versions can be obtained with
+#
+# make -DDEBUG -farch\win16\Makefile.BC
+#
+# Special versions enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+#
+#
+# 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.
+# make -DBIGFONTS -farch/win16/Makefile.BC
+
+ARCH = arch\win16
+FT_MAKEFILE = $(ARCH)\Makefile.BC
+FT_DLL = ft15_16.dll
+
+CC = bcc
+LIB = tlib /c /e
+IMPLIB = implib -c -o
+
+SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig
+
+# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
+# Borland compilers (from BC++ 3.1 on) can increase the limit on
+# the length of identifiers.
+!if ! $d(DEBUG)
+CFLAGS = -O2 -3 -ml -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
+DLLFLAGS = -ml -WD -lC
+!else
+CFLAGS = -v -N -ml -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
+DLLFLAGS = -v -ml -WD -lC
+!endif
+
+CFLAGS = $(CFLAGS) -W
+
+FT_DEF = $(FT_DLL:.dll=.def)
+!if $d(DLL)
+CFLAGS = $(CFLAGS) -WD
+!endif
+
+
+!if $d(BIGFONTS)
+CFLAGS = $(CFLAGS) -DTT_HUGE_PTR=__huge
+
+TTFILE = $(ARCH)\hugefile.c
+TTMEMORY = $(ARCH)\hugemem.c
+!else
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+!endif
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces before the \ at end of line,
+# otherwise the substitution for TLIB command line will fail.
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
+ extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c\
+ extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c\
+ extend\ftxopen.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c\
+ ttgload.c ttinterp.c ttload.c ttobjs.c\
+ ttraster.c ttextend.c ttdebug.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Borland make does not handle $($(LIB_FILES)), and using
+# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing TLIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# See ../msdos/Makefile.TC for an application.
+.c.obj:
+ @$(CC) -c -o$* @&&|
+ $(CFLAGS) $<
+|
+
+
+!if ! $d(DEBUG)
+# Skipped if DEBUG build
+# (but it changes nothing, since we always build in multiple parts).
+all: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(OBJS_M: = + )
+|
+!endif
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(OBJS_M: = + )
+|
+
+$(FT_DEF): $(ARCH)\ttf.def
+ -copy $(ARCH)\ttf.def $(FT_DEF)
+
+dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
+!if $d(DLL)
+ $(CC) -e$(FT_DLL) @&&|
+ $(DLLFLAGS) $(OBJS_M)
+|
+ $(IMPLIB) libttf $(FT_DEF)
+!else
+# Re-invoke with flag set. Unfortunately, this discards the other flags.
+ make -DDLL -f$(ARCH)/Makefile.BC dll
+!endif
+
+install: $(FT_DLL)
+!if $d(INSTALL_DIR)
+ copy $(FT_DLL) $(INSTALL_DIR)
+!else
+ copy $(FT_DLL) C:\WINDOWS
+!endif
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ -del libttf.lib
+ echo -+$(**: =-+)> response
+ $(LIB) libttf.lib @&&|
++ $(**: = + )
+|
+
+!if $d(BIGFONTS)
+$(TTMEMORY:.c=.obj): $(TTMEMORY)
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) -A- $*.c
+|
+
+$(TTFILE:.c=.obj): $(TTFILE)
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) -A- $*.c
+|
+!endif
+
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del libttf.bak
+ -del response
+ -del *.def
+
+distclean: clean
+ -del libttf.lib
+ -del *.dll
+ -del $(FT_DEF)
+ -del C:\WINDOWS\$(FT_DLL)
+!if $d(INSTALL_DIR)
+ -del $(INSTALL_DIR)\$(FT_DLL)
+!endif
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/lib/arch/win16/Makefile.MS b/Build/source/libs/freetype/lib/arch/win16/Makefile.MS
new file mode 100644
index 00000000000..9f8f03f66f1
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/Makefile.MS
@@ -0,0 +1,116 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Microsoft C for Windows, large model.
+# It also works for Visual C++ 1.x 16-bit compilers, but you should
+# instead use the Makefile customized for it, Makefile.VC.
+# Due to size constraints, it does not try to pack all modules into one.
+#
+# You will need NMAKE.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# nmake /f arch\win16\Makefile.MS
+#
+#
+# A debug version can be obtained with
+#
+#
+#
+# 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.
+# nmake DEBUG=1 /f arch\win16\Makefile.MS
+
+ARCH = arch\win16
+FT_MAKEFILE = $(ARCH)\Makefile.MS
+
+CC = cl /nologo
+LIB = lib /noignorecase /nologo
+
+!ifndef DEBUG
+CFLAGS = /Ox /AL /Za /W2 /G2 -I$(ARCH) -I. -Iextend
+!else
+CFLAGS = /Zi /AL /Za /W2 /G2 -I$(ARCH) -I. -Iextend
+!endif
+
+# Use /Gw instead with Microsoft C version 6
+CFLAGS = $(CFLAGS) /GA
+
+
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces between the file names or at end of line, otherwise
+# the substitution for LIB command line will fail. Thank you.
+#
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
+extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
+extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
+ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
+# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing LIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# See ..\msdos\Makefile.TC for an application.
+.c.obj:
+ $(CC) /c /Fo$@ @<<
+ $(CFLAGS) $*.c
+<<
+
+
+!ifndef DEBUG
+# Skipped if DEBUG build
+# (but it changes nothing, since we always build in multiple parts).
+all: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @<<response
++ $(OBJS_M: = ^ );
+<<KEEP
+!endif
+
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @<<response
++ $(OBJS_M: = ^ );
+<<KEEP
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ $(LIB) $@ +-$(?: =-+);
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del response
+
+distclean: clean
+ -del libttf.lib
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile.MS
diff --git a/Build/source/libs/freetype/lib/arch/win16/Makefile.VC b/Build/source/libs/freetype/lib/arch/win16/Makefile.VC
new file mode 100644
index 00000000000..c24ba4f863a
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/Makefile.VC
@@ -0,0 +1,185 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Microsoft Visual C++ 1.x for 16-bit Windows,
+# large model. It also works for Microsoft C/C++ v.7.0 16-bit compiler,
+# but not for previous versions (see Makefile.MS instead).
+#
+# You will need NMAKE.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# nmake /f arch\win16\Makefile.VC
+#
+#
+# A DLL version of the library can be built with
+#
+# nmake DLL=1 /f arch\win16\Makefile.VC dll
+#
+# Debug versions can be obtained with
+#
+# nmake DEBUG=1 /f arch\win16\Makefile.VC
+#
+# Special versions enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+#
+#
+# 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.
+# nmake BIGFONTS=1 /f arch\win16\Makefile.VC
+
+ARCH = arch\win16
+FT_MAKEFILE = $(ARCH)\Makefile.VC
+FT_DLL = ft15_16.dll
+
+CC = cl /nologo
+LIB = lib /noignorecase /nologo
+IMPLIB = implib /noignorecase /nologo
+
+# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
+# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
+!ifndef DEBUG
+CFLAGS = /Ox /AL /Za /W2 /G3 -I$(ARCH) -I. -Iextend
+DLLFLAGS = /AL /Ld
+!else
+CFLAGS = /Zi /Ge /AL /Za /W2 /G3 -I$(ARCH) -I. -Iextend
+DLLFLAGS = /AL /Lw /Zi
+!endif
+
+FT_DEF = $(FT_DLL:.dll=.def)
+!ifdef DLL
+CFLAGS = $(CFLAGS) /GD /GEf
+!else
+CFLAGS = $(CFLAGS) /GA
+!endif
+
+
+!ifdef BIGFONTS
+CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge
+
+TTFILE = $(ARCH)\hugefile.c
+TTMEMORY = $(ARCH)\hugemem.c
+!else
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+!endif
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces between the file names or at end of line, otherwise
+# the substitution for LIB command line will fail. Thank you.
+#
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
+extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
+extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
+ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
+# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing LIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# See ..\msdos\Makefile.TC for an application.
+.c.obj:
+ @$(CC) /c /Fo$@ @<<
+ $(CFLAGS) $*.c
+<<
+
+
+!ifndef DEBUG
+# Skipped if DEBUG build
+all: $(OBJS_S)
+ -del libttf.lib
+ $(LIB) libttf.lib @<<response
++ $(OBJS_S: = + );
+<<KEEP
+!endif
+
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @<<response
++ $(OBJS_M: = + );
+<<KEEP
+
+$(FT_DEF): $(ARCH)\ttf.def
+ -copy $(ARCH)\ttf.def $(FT_DEF)
+
+dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
+!ifdef DLL
+ $(CC) /Fe$(FT_DLL) @<<
+ $(DLLFLAGS) $**
+<<
+ $(IMPLIB) libttf.lib $(FT_DEF)
+!else
+# Re-invoke with flag set. Unfortunately, this discards the other flags.
+ $(MAKE) DLL=1 /f $(ARCH)/Makefile.VC dll
+!endif
+
+install: $(FT_DLL)
+!ifdef INSTALL_DIR
+ copy $(FT_DLL) $(INSTALL_DIR)
+!else
+ copy $(FT_DLL) C:\WINDOWS
+!endif
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ $(LIB) $@ +-$(?: =-+);
+
+!ifdef BIGFONTS
+$(TTFILE:.c=.obj):
+ $(CC) /c /Fo$@ @<<
+ $(CFLAGS) /Ze $*.c
+
+$(TTMEMORY:.c=.obj):
+ $(CC) /c /Fo$@ @<<
+ $(CFLAGS) /Ze $*.c
+<<
+
+$(OBJ_S):
+ $(CC) /c /Fo$@ @<<
+ $(CFLAGS) /Ze $*.c
+<<
+!endif
+
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del libttf.bak
+ -del response
+
+distclean: clean
+ -del libttf.lib
+ -del *.dll
+ -del $(FT_DLL:.dll=.def)
+ -del C:\WINDOWS\$(FT_DLL)
+!ifdef INSTALL_DIR
+ -del $(INSTALL_DIR)\$(FT_DLL)
+!endif
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile.VC
diff --git a/Build/source/libs/freetype/lib/arch/win16/depend.win b/Build/source/libs/freetype/lib/arch/win16/depend.win
new file mode 100644
index 00000000000..358f642aee0
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/depend.win
@@ -0,0 +1,113 @@
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in `makedep'...
+#
+# This dependency file to be used with various Windows compilers
+# has been generated automatically with the script `makedep' on
+# 2002-11-18.
+
+ttapi.obj: ttapi.c ttconfig.h arch\win16\ft_conf.h freetype.h fterrid.h \
+ ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
+ ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
+ ttgload.h ttraster.h ttextend.h
+ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
+ arch\win16\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
+ ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
+ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\win16\ft_conf.h freetype.h \
+ fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
+ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\win16\ft_conf.h ttengine.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
+ tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
+ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\win16\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h ttcmap.h
+ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\win16\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
+ttfile.obj: ttfile.c ttconfig.h arch\win16\ft_conf.h freetype.h \
+ fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
+ ttmemory.h ttfile.h
+ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
+ ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
+ ttmemory.h tttags.h ttload.h
+ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
+ ttconfig.h arch\win16\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
+ ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
+ ttcmap.h
+ttload.obj: ttload.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
+ ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
+ ttmemory.h tttags.h ttload.h
+ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\win16\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
+ ttmutex.h
+ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\win16\ft_conf.h
+ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\win16\ft_conf.h ttengine.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
+ tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
+ ttinterp.h ttextend.h
+ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
+ ttdebug.h ttcalc.h ttmemory.h
+extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\win16\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
+extend\ftxerr18.obj: extend\ftxerr18.c extend\ftxerr18.h freetype.h fterrid.h \
+ ftnameid.h extend\ftxkern.h extend\ftxpost.h extend\ftxopen.h \
+ extend\ftxgdef.h extend\ftxgsub.h extend\ftxgpos.h ttconfig.h \
+ arch\win16\ft_conf.h
+extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\win16\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
+extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
+ ftnameid.h ttextend.h ttconfig.h arch\win16\ft_conf.h tttypes.h \
+ ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
+ ttload.h ttmemory.h ttfile.h tttags.h
+extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\win16\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\win16\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
+ ttdebug.h tttags.h ttmemory.h ttextend.h
+extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
+ ftnameid.h ttobjs.h ttconfig.h arch\win16\ft_conf.h ttengine.h \
+ tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
+ ttload.h ttmemory.h tttags.h ttextend.h
+extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
+ ftnameid.h ttdebug.h ttconfig.h arch\win16\ft_conf.h tttypes.h \
+ ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
+ tttags.h ttload.h
+!ifndef __MAKE__
+arch\win16\freetype.obj: arch\win16\freetype.c ttapi.c ttconfig.h \
+ arch\win16\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
+ tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
+ ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
+ ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
+ ttinterp.h ttload.c ttobjs.c ttraster.c arch\win16\hugefile.c \
+ ttfile.c arch\win16\hugemem.c ttmutex.c ttextend.c
+arch\win16\hugefile.obj: arch\win16\hugefile.c ttconfig.h arch\win16\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttfile.c ttdebug.h \
+ ttengine.h ttmutex.h ttmemory.h ttfile.h
+arch\win16\hugemem.obj: arch\win16\hugemem.c ttdebug.h ttconfig.h \
+ arch\win16\ft_conf.h tttypes.h freetype.h fterrid.h ftnameid.h \
+ ttmemory.h ttengine.h ttmutex.h
+!endif
diff --git a/Build/source/libs/freetype/lib/arch/win16/freetype.c b/Build/source/libs/freetype/lib/arch/win16/freetype.c
new file mode 100644
index 00000000000..6912a5af04e
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/freetype.c
@@ -0,0 +1,51 @@
+/* This file is part of the FreeType project */
+
+/* Single object library component for 16-bit Windows. */
+/* Note that low-optimizing compilers (such as Borland ones) cannot */
+/* successfully compile this file, because it exceeds 64K of code size. */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* Note, you should define the FT_EXPORT_xxx macros here if you */
+/* want to build a Win16 DLL. If undefined, the macros default to */
+/* "extern"/"" (nothing), which is suitable for static libraries. */
+/* See `ttconfig.h' for details. */
+
+/* The macro FT_EXPORT_DEF is placed before each high-level API */
+/* function declaration, and FT_EXPORT_FUNC before each */
+/* definition (body). Similarly, FT_EXPORT_DECL is placed before */
+/* each variable declaration, and FT_EXPORT_VAR before its */
+/* definition. You can then use it to take any compiler-specific */
+/* pragma for DLL-exported symbols */
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#ifdef TT_HUGE_PTR
+#include "arch/win16/hugefile.c"
+#include "arch/win16/hugemem.c"
+#else
+#include "ttfile.c"
+#include "ttmemory.c"
+#endif
+#include "ttmutex.c"
+
+/* finally, add some extensions */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/win16/ft_conf.h b/Build/source/libs/freetype/lib/arch/win16/ft_conf.h
new file mode 100644
index 00000000000..a4f90b97c7d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/ft_conf.h
@@ -0,0 +1,235 @@
+/*******************************************************************
+ *
+ * ft_conf.h for 16-bit Windows
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+/* #undef HAVE_LOCALE_H */
+
+/* command.com can't pipe stderr into a file; any message would be */
+/* written into the graphics screen. */
+#define HAVE_PRINT_FUNCTION 1
+
+#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 2
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#undef LONG64
+#undef INT64
+
+/**********************************************************************/
+/* */
+/* The following macros does the dusty work of selecting the proper */
+/* of qualifiers in order to build a DLL, exporting only the needed */
+/* functions, using the (in)famous FAR PASCAL EXPORT... */
+/* */
+/* Refer to ttconfig.h for explanations of the machinery. */
+
+#if defined( _WINDLL ) || defined( __DLL__ ) || defined( FT_DLL )
+
+#if defined( _M_I86 ) || ( defined( __TURBOC__ ) && __TURBOC__ > 0x400 )
+#define FAR __far
+#define PASCAL __pascal
+#define EXPORT __export
+#else
+#define FAR _far
+#define PASCAL _pascal
+#define EXPORT _export
+#endif
+
+#define FT_INTERNAL_FUNC( type ) type
+#define FT_INTERNAL_DEF( type ) extern type
+
+#define FT_EXPORT_DEF( type ) extern type FAR PASCAL EXPORT
+#define FT_EXPORT_FUNC( type ) type FAR PASCAL EXPORT
+
+/* This is for variables. */
+#define FT_EXPORT_DECL( type ) extern type PASCAL
+#define FT_EXPORT_VAR( type ) type PASCAL
+
+#endif /* DLL stuff */
+
+#endif /* FT_CONF_H */
+
+/* End of ft_conf.h */
diff --git a/Build/source/libs/freetype/lib/arch/win16/hugefile.c b/Build/source/libs/freetype/lib/arch/win16/hugefile.c
new file mode 100644
index 00000000000..7ffcd28d033
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/hugefile.c
@@ -0,0 +1,51 @@
+/*******************************************************************
+ *
+ * hugefile.c
+ *
+ * File I/O Component (body) for dealing with "huge" objects
+ * under 16-bit Windows. Relies on the "default" version, with
+ * a small hook. Requires Windows 3.1+.
+ *
+ * Written by Antoine Leca based on ideas from Dave Hoo.
+ * Copyright 1999-2000 Dave Hoo, Antoine Leca,
+ * 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.
+ *
+ * NOTE
+ *
+ * This file #includes the normal version, to avoid discrepancies
+ * between versions. It uses only ANSI-mandated "tricks", so
+ * any ANSI-compliant compiler should be able to compile this file.
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+#include "tttypes.h"
+
+#include <windows.h>
+
+ /* Here we include <stdio.h>, to have the proper definition of fread */
+#include <stdio.h>
+
+ /* Some compilers define fileno(), some define _fileno()... */
+#ifndef _fileno
+#define _fileno(stream) fileno(stream)
+#endif
+
+ /* Then, we divert the use of fread to the Windows version */
+#undef fread
+#define fread(ptr, size, n, stream) \
+ _hread( _fileno(stream), (char TT_HUGE_PTR *) ptr, (ULong)n * size )
+
+
+ /* Now, we include the "normal" version of `ttfile.c' */
+ /* The ANSI/ISO standard mandates that the include of <stdio.h> */
+ /* there have no bad effects. */
+#include "ttfile.c"
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/win16/hugemem.c b/Build/source/libs/freetype/lib/arch/win16/hugemem.c
new file mode 100644
index 00000000000..cac6bd7412a
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/hugemem.c
@@ -0,0 +1,539 @@
+/*******************************************************************
+ *
+ * hugemem.c
+ *
+ * Memory management component (body)
+ * for dealing with "huge" objects with 16-bit Windows.
+ *
+ * Written by Antoine Leca based on ideas from Dave Hoo.
+ * Copyright 1999-2000 Dave Hoo, Antoine Leca,
+ * 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.
+ *
+ ******************************************************************/
+
+#include <limits.h>
+#include <windows.h>
+
+#include "ttdebug.h"
+#include "ttmemory.h"
+#include "ttengine.h"
+
+#ifndef TT_HUGE_PTR
+#error "This component needs TT_HUGE_PTR to be #defined."
+#endif
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+#error "This component needs static allocation and is not re-entrant."
+#endif
+
+ /* If the memory reclaimed is abobve this limit, alloc directly from */
+ /* global heap. Else, alloc using malloc (using suballocation). */
+#ifndef MEMORY_MIN_GLOBAL
+#define MEMORY_MIN_GLOBAL 4096
+#endif
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_memory
+
+
+#ifdef DEBUG_MEMORY
+
+#include <stdio.h>
+
+#define MAX_TRACKED_BLOCKS 1024
+
+ struct TMemRec_
+ {
+ void* base;
+ Long size;
+ };
+
+ typedef struct TMemRec_ TMemRec;
+
+ static TMemRec pointers[MAX_TRACKED_BLOCKS + 1];
+
+ static Int num_alloc;
+ static Int num_free;
+ static Int num_realloc; /* counts only `real' reallocations
+ (i.e., an existing buffer will be resized
+ to a value larger than zero */
+
+ static Int fail_alloc;
+ static Int fail_realloc;
+ static Int fail_free;
+
+#else
+
+ /* We need a tracing stack of the calls to big chunks of memory, */
+ /* in order to call the matching version of free(). */
+
+#define MAX_TRACKED_BIGCHUNKS 64
+
+ struct TMemRec_
+ {
+ void* base;
+ };
+
+ typedef struct TMemRec_ TMemRec;
+
+ static TMemRec pointers[MAX_TRACKED_BIGCHUNKS + 1];
+
+#endif /* DEBUG_MEMORY */
+
+
+#ifndef TT_CONFIG_REENTRANT
+ Long TTMemory_Allocated;
+ Long TTMemory_MaxAllocated;
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : TT_Alloc
+ *
+ * Description : Allocates memory from the heap buffer.
+ *
+ * Input : Size size of the memory to be allocated
+ * P pointer to a buffer pointer
+ *
+ * Output : Error code.
+ *
+ * NOTE : The newly allocated block should _always_ be zeroed
+ * on return. Many parts of the engine rely on this to
+ * work properly.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Alloc( ULong Size, void** P )
+ {
+ Int i;
+
+
+ if ( !P )
+ return TT_Err_Invalid_Argument;
+ /* Also see below for another case of "invalid argument". */
+
+ if ( Size > 0 )
+ {
+ if ( Size >= MEMORY_MIN_GLOBAL )
+ {
+ HANDLE hMem;
+
+ hMem = GlobalAlloc( GMEM_ZEROINIT, Size );
+ if ( !hMem )
+ return TT_Err_Out_Of_Memory;
+
+ *P = (void*)GlobalLock( hMem );
+ }
+ else
+ *P = (void*)malloc( Size );
+
+ if ( !*P )
+ return TT_Err_Out_Of_Memory;
+
+#ifndef TT_CONFIG_REENTRANT
+ TTMemory_MaxAllocated += Size;
+ TTMemory_Allocated += Size;
+#endif
+
+#ifdef DEBUG_MEMORY
+
+ num_alloc++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != NULL )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_alloc++;
+ else
+ {
+ pointers[i].base = *P;
+ pointers[i].size = Size;
+ }
+
+#else
+
+ if ( Size >= MEMORY_MIN_GLOBAL )
+ {
+ i = 0;
+ while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
+ i++;
+
+ if ( i >= MAX_TRACKED_BIGCHUNKS )
+ /* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
+ return TT_Err_Invalid_Argument;
+ else
+ pointers[i].base = *P;
+ }
+
+#endif /* DEBUG_MEMORY */
+
+ /* The nice thing about GlobalAlloc is that it zeroes the memory. */
+
+ if ( Size < MEMORY_MIN_GLOBAL )
+ MEM_Set( *P, 0, Size );
+
+ }
+ else
+ *P = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*******************************************************************
+ *
+ * Function : TT_Realloc
+ *
+ * Description : Reallocates memory from the heap buffer.
+ *
+ * Input : Size new size of the memory to be allocated;
+ * if zero, TT_Free() will be called
+ * P pointer to a buffer pointer; if *P == NULL,
+ * TT_Alloc() will be called
+ *
+ * Output : Error code.
+ *
+ * NOTES : It's not necessary to zero the memory in case the
+ * reallocated buffer is larger than before -- the
+ * application has to take care of this.
+ *
+ * If the memory request fails, TT_Free() will be
+ * called on *P, and TT_Err_Out_Of_Memory returned.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Realloc( ULong Size, void** P )
+ {
+ ULong oldSize;
+ void* Q;
+ Int i;
+
+
+ if ( !P )
+ return TT_Err_Invalid_Argument;
+
+ if ( !*P )
+ return TT_Alloc( Size, P );
+
+ if ( Size == 0 )
+ return TT_Free( P );
+
+#ifdef DEBUG_MEMORY
+
+ num_realloc++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_realloc++;
+ else
+ oldSize = pointers[i].size;
+
+#else
+
+ i = 0;
+ while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
+ i++;
+
+ /* If we did not found the pointer, then this is a "small" chunk. */
+
+ if ( i < MAX_TRACKED_BIGCHUNKS )
+ {
+ /* Signal we found a big one. Real size does not matter. */
+ oldSize = MEMORY_MIN_GLOBAL;
+ }
+
+#endif /* DEBUG_MEMORY */
+
+ if ( oldSize >= MEMORY_MIN_GLOBAL )
+ {
+ /* Deal with a big chunk. */
+ HANDLE hMem, hNewMem;
+
+ hMem = GlobalHandle ( (ULong)*P >> 16 ) & 0xFFFF;
+ if ( !hMem ) /* Bad call... */
+ return TT_Err_Invalid_Argument;
+
+ GlobalUnlock( hMem );
+ hNewMem = GlobalReAlloc( hMem, Size, 0 );
+ if ( hNewMem )
+ *P = (void*)GlobalLock( hNewMem );
+ }
+ if ( Size >= MEMORY_MIN_GLOBAL )
+ {
+ /* A small chunk crosses the limit... */
+
+ if( TT_Alloc( Size, &Q ) != TT_Err_Ok )
+ Q = NULL; /* Failed to create the new block. */
+ else
+ MEM_Copy( Q, *P, oldSize );
+
+ /* We need to register the new entry. */
+#ifndef DEBUG_MEMORY
+
+ i = 0;
+ while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
+ i++;
+
+ if ( i >= MAX_TRACKED_BIGCHUNKS )
+ /* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
+ return TT_Err_Invalid_Argument;
+#endif /* DEBUG_MEMORY */
+ }
+ else
+ Q = (void*)realloc( *P, Size );
+
+ if ( !Q )
+ {
+ TT_Free( *P );
+ return TT_Err_Out_Of_Memory;
+ }
+
+#ifdef DEBUG_MEMORY
+
+ if ( i < MAX_TRACKED_BLOCKS )
+ {
+#ifndef TT_CONFIG_REENTRANT
+ TTMemory_Allocated += Size - pointers[i].size;
+ if ( Size > pointers[i].size )
+ TTMemory_MaxAllocated += Size - pointers[i].size;
+#endif
+
+ pointers[i].base = Q;
+ pointers[i].size = Size;
+ }
+#else
+ if ( i < MAX_TRACKED_BIGCHUNKS )
+ {
+ pointers[i].base = Q;
+ }
+#endif /* DEBUG_MEMORY */
+
+ *P = Q;
+
+ return TT_Err_Ok;
+ }
+
+
+#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
+
+
+/*******************************************************************
+ *
+ * Function : TT_Free
+ *
+ * Description : Releases a previously allocated block of memory.
+ *
+ * Input : P pointer to memory block
+ *
+ * Output : Always SUCCESS.
+ *
+ * Note : The pointer must _always_ be set to NULL by this function.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Free( void** P )
+ {
+ Int i;
+ Long Size = 0;
+
+
+ if ( !P || !*P )
+ return TT_Err_Ok;
+
+#ifdef DEBUG_MEMORY
+
+ num_free++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_free++;
+ else
+ {
+#ifndef TT_CONFIG_REENTRANT
+ TTMemory_Allocated -= pointers[i].size;
+#endif
+
+ Size = pointers[i].size;
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+
+#else
+
+ i = 0;
+ while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
+ i++;
+
+ /* If we did not found the pointer, then this is a "small" chunk. */
+
+ if ( i < MAX_TRACKED_BIGCHUNKS )
+ {
+ pointers[i].base = NULL;
+ /* Signal we found a big one. Real size does not matter. */
+ Size = MEMORY_MIN_GLOBAL;
+ }
+
+#endif /* DEBUG_MEMORY */
+
+ if ( Size >= MEMORY_MIN_GLOBAL )
+ {
+ HANDLE hMem;
+
+ hMem = GlobalHandle ( (ULong)*P >> 16 ) & 0xFFFF;
+ if ( !hMem ) /* Bad call... */
+ return TT_Err_Invalid_Argument;
+
+ GlobalUnlock( hMem );
+ GlobalFree ( hMem );
+ }
+ else
+ free( *P );
+
+ *P = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTMemory_Init
+ *
+ * Description : Initializes the memory.
+ *
+ * Output : Always SUCCESS.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTMemory_Init( void )
+ {
+#ifdef DEBUG_MEMORY
+ Int i;
+
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+
+ num_alloc = 0;
+ num_realloc = 0;
+ num_free = 0;
+
+ fail_alloc = 0;
+ fail_realloc = 0;
+ fail_free = 0;
+#else
+ Int i;
+
+ for ( i = 0; i < MAX_TRACKED_BIGCHUNKS; i++ )
+ {
+ pointers[i].base = NULL;
+ }
+#endif
+
+
+#ifndef TT_CONFIG_REENTRANT
+ TTMemory_Allocated = 0;
+ TTMemory_MaxAllocated = 0;
+#endif
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTMemory_Done
+ *
+ * Description : Finalizes memory usage.
+ *
+ * Output : Always SUCCESS.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTMemory_Done( void )
+ {
+#ifdef DEBUG_MEMORY
+ Int i, num_leaked, tot_leaked;
+
+
+ num_leaked = 0;
+ tot_leaked = 0;
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ if ( pointers[i].base )
+ {
+ num_leaked ++;
+ tot_leaked += pointers[i].size;
+ }
+ }
+
+ fprintf( stderr,
+ "%d memory allocations, of which %d failed\n",
+ num_alloc,
+ fail_alloc );
+
+ fprintf( stderr,
+ "%d memory reallocations, of which %d failed\n",
+ num_realloc,
+ fail_realloc );
+
+ fprintf( stderr,
+ "%d memory frees, of which %d failed\n",
+ num_free,
+ fail_free );
+
+ if ( num_leaked > 0 )
+ {
+ fprintf( stderr,
+ "There are %d leaked memory blocks, totalizing %d bytes\n",
+ num_leaked, tot_leaked );
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ if ( pointers[i].base )
+ {
+ fprintf( stderr,
+ "index: %4d (base: $%08lx, size: %08ld)\n",
+ i,
+ (long)pointers[i].base,
+ pointers[i].size );
+ }
+ }
+ }
+ else
+ fprintf( stderr, "No memory leaks !\n" );
+
+#endif /* DEBUG_MEMORY */
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/win16/makedef b/Build/source/libs/freetype/lib/arch/win16/makedef
new file mode 100755
index 00000000000..1c82cfd7400
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/makedef
@@ -0,0 +1,28 @@
+# makedef
+#
+# This shell script creates a .DEF file necessary for building as DLL
+# on the Windows 16-bit platform.
+
+echo "\
+; This file is part of the FreeType project.
+; Automatically generated, but you can customize to fit your needs.
+; However, changes will be erased if not made in \`makedef'...
+;
+; This definition file to be used to built the library as DLL
+; has been generated automatically with the script \`makedef' on
+; `date +%Y-%m-%d`.
+
+LIBRARY ft15_16
+DESCRIPTION 'FreeType 1.5 16-bit DLL © 1996-2002 Turner, Wilhelm, Lemberg'
+EXETYPE WINDOWS
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE SINGLE
+EXPORTS
+" > ttf.def
+
+(cd ../..
+ sed -n -e "/^ *FT_EXPORT_DE/!d ; n ; s/(.*$//" \
+ -e "s/;$//" -e "s/ const / /" -e "s/ *TT_[a-zA-Z_\*]* //" \
+ -e "s/ *//g" -e "s/^\(.*\)/ _\1/" -e "p" *.h extend/*.h) >> ttf.def
+
+# eof
diff --git a/Build/source/libs/freetype/lib/arch/win16/makedep b/Build/source/libs/freetype/lib/arch/win16/makedep
new file mode 100755
index 00000000000..7a0476eda9d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/makedep
@@ -0,0 +1,48 @@
+# makedep
+#
+# This shell script creates a dependency file necessary for older compilers
+# on the Windows 16-bit platform.
+#
+# If you run this script under non-Windows operating systems, expect
+# warnings that `windows.h' can't be found.
+#
+# Copyright 1996-2002 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.
+
+echo "\
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in \`makedep'...
+#
+# This dependency file to be used with various Windows compilers
+# has been generated automatically with the script \`makedep' on
+# `date +%Y-%m-%d`.
+" > depend.win
+
+(cd ../..
+ gcc -MM -Iarch/win16 -I. \
+ *.c | \
+ sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.win
+
+(cd ../..
+ gcc -MM -Iarch/win16 -I. -Iextend \
+ extend/*.c | \
+ sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.win
+
+echo "!ifndef __MAKE__" >> depend.win
+
+(cd ../..
+ gcc -MM -Iarch/win16 -I. -Iextend \
+ -DTT_HUGE_PTR -Dhuge_alloc -Dhuge_free arch/win16/*.c | \
+ sed -e "s/^\(.*\)\.o:/arch\\\\win16\\\\\1.obj:/" \
+ -e "s:/:\\\\:g") >> depend.win
+
+echo "!endif" >> depend.win
+
+# eof
diff --git a/Build/source/libs/freetype/lib/arch/win16/ttf.def b/Build/source/libs/freetype/lib/arch/win16/ttf.def
new file mode 100644
index 00000000000..3e0fd6617ac
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win16/ttf.def
@@ -0,0 +1,134 @@
+; This file is part of the FreeType project.
+; Automatically generated, but you can customize to fit your needs.
+; However, changes will be erased if not made in `makedef'...
+;
+; This definition file to be used to built the library as DLL
+; has been generated automatically with the script `makedef' on
+; 2002-11-18.
+
+LIBRARY ft15_16
+DESCRIPTION 'FreeType 1.5 16-bit DLL © 1996-2002 Turner, Wilhelm, Lemberg'
+EXETYPE WINDOWS
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE SINGLE
+EXPORTS
+
+ _TT_FreeType_Version
+ _TT_Init_FreeType
+ _TT_Done_FreeType
+ _TT_Set_Raster_Gray_Palette
+ _TT_Open_Face
+ _TT_Open_Collection
+ _TT_Get_Face_Properties
+ _TT_Set_Face_Pointer
+ _TT_Get_Face_Pointer
+ _TT_Flush_Face
+ _TT_Get_Face_Metrics
+ _TT_Close_Face
+ _TT_Get_Font_Data
+ _TT_New_Instance
+ _TT_Set_Instance_Resolutions
+ _TT_Set_Instance_CharSize
+ _TT_Set_Instance_CharSizes
+ _TT_Set_Instance_PixelSizes
+ _TT_Set_Instance_Transform_Flags
+ _TT_Get_Instance_Metrics
+ _TT_Set_Instance_Pointer
+ _TT_Get_Instance_Pointer
+ _TT_Done_Instance
+ _TT_New_Glyph
+ _TT_Done_Glyph
+ _TT_Load_Glyph
+ _TT_Get_Glyph_Outline
+ _TT_Get_Glyph_Metrics
+ _TT_Get_Glyph_Big_Metrics
+ _TT_Get_Glyph_Bitmap
+ _TT_Get_Glyph_Pixmap
+ _TT_New_Outline
+ _TT_Done_Outline
+ _TT_Copy_Outline
+ _TT_Get_Outline_Bitmap
+ _TT_Get_Outline_Pixmap
+ _TT_Get_Outline_BBox
+ _TT_Transform_Outline
+ _TT_Translate_Outline
+ _TT_Transform_Vector
+ _TT_MulDiv
+ _TT_MulFix
+ _TT_Get_CharMap_Count
+ _TT_Get_CharMap_ID
+ _TT_Get_CharMap
+ _TT_Char_Index
+ _TT_Get_Name_Count
+ _TT_Get_Name_ID
+ _TT_Get_Name_String
+ _TT_Register_Extension
+ _TT_Extension_Get
+ _TT_Use_Stream
+ _TT_Done_Stream
+ _TT_Flush_Stream
+ _TT_Read_File
+ _TT_Seek_File
+ _TT_Skip_File
+ _TT_Read_At_File
+ _TT_File_Pos
+ _TT_Stream_Size
+ _TT_Null_FileFrame
+ _TT_Access_Frame
+ _TT_Check_And_Access_Frame
+ _TT_Forget_Frame
+ _TT_Get_Char
+ _TT_Get_Short
+ _TT_Get_Long
+ _TT_LookUp_Table
+ _TT_Alloc
+ _TT_Realloc
+ _TT_Free
+ _TT_CharMap_First
+ _TT_CharMap_Next
+ _TT_CharMap_Last
+ _TT_ErrToString18
+ _TT_Get_Face_Gasp_Flags
+ _TT_Init_GDEF_Extension
+ _TT_Load_GDEF_Table
+ _TT_GDEF_Get_Glyph_Property
+ _TT_GDEF_Build_ClassDefinition
+ _TT_Init_GPOS_Extension
+ _TT_Load_GPOS_Table
+ _TT_GPOS_Select_Script
+ _TT_GPOS_Select_Language
+ _TT_GPOS_Select_Feature
+ _TT_GPOS_Query_Scripts
+ _TT_GPOS_Query_Languages
+ _TT_GPOS_Query_Features
+ _TT_GPOS_Add_Feature
+ _TT_GPOS_Clear_Features
+ _TT_GPOS_Register_Glyph_Function
+ _TT_GPOS_Register_MM_Function
+ _TT_GPOS_Apply_String
+ _TT_Init_GSUB_Extension
+ _TT_Load_GSUB_Table
+ _TT_GSUB_Select_Script
+ _TT_GSUB_Select_Language
+ _TT_GSUB_Select_Feature
+ _TT_GSUB_Query_Scripts
+ _TT_GSUB_Query_Languages
+ _TT_GSUB_Query_Features
+ _TT_GSUB_Add_Feature
+ _TT_GSUB_Clear_Features
+ _TT_GSUB_Register_Alternate_Function
+ _TT_GSUB_Apply_String
+ _TT_GSUB_Add_String
+ _TT_Init_Kerning_Extension
+ _TT_Get_Kerning_Directory
+ _TT_Load_Kerning_Table
+ _TT_Init_Post_Extension
+ _TT_Load_PS_Names
+ _TT_Get_PS_Name
+ _TT_Init_SBit_Extension
+ _TT_Get_Face_Bitmaps
+ _TT_New_SBit_Image
+ _TT_Done_SBit_Image
+ _TT_Get_SBit_Strike
+ _TT_Load_Glyph_Bitmap
+ _TT_Get_Face_Widths
diff --git a/Build/source/libs/freetype/lib/arch/win32/.cvsignore.delete b/Build/source/libs/freetype/lib/arch/win32/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/.cvsignore.delete
diff --git a/Build/source/libs/freetype/lib/arch/win32/Makefile.BC b/Build/source/libs/freetype/lib/arch/win32/Makefile.BC
new file mode 100644
index 00000000000..a5ee5808a2d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/Makefile.BC
@@ -0,0 +1,171 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Borland C++ for Win32.
+#
+# You will need Borland MAKE.
+# Tested with Borland C++ v.5.0 and Borland C++ builder 4.0.
+# Does not work with Borland C++ 4.0, since it needs __declspec.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# make -farch/win32/Makefile.BC
+#
+#
+# A DLL version of the library can be built with
+#
+# make -DDLL -farch/win32/Makefile.BC dll
+#
+# A debug version can be obtained with
+#
+# make -DDEBUG -farch/win32/Makefile.BC
+#
+#
+# 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.
+
+ARCH = arch\win32
+FT_MAKEFILE = $(ARCH)\Makefile.BC
+FT_DLL = ft15_32.dll
+
+CC = bcc32
+LIB = tlib /c /e
+IMPLIB = implib -c
+
+SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig
+
+!if ! $d(DEBUG)
+CFLAGS = -O2 -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
+DLLFLAGS = -WD
+!else
+CFLAGS = -v -A -i40 -I$(ARCH);.;extend $(SPURIOUS_WARNINGS)
+DLLFLAGS = -v -WD
+!endif
+
+FT_DEF = $(FT_DLL:.dll=.def)
+!if $d(DLL)
+CFLAGS = $(CFLAGS) \
+ -DEXPORT_DEF=__declspec(dllexport) -DEXPORT_FUNC=__declspec(dllexport)
+!endif
+
+
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces before the \ at end of line,
+# otherwise the substitution for TLIB command line will fail.
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
+ extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c\
+ extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c\
+ extend\ftxopen.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c\
+ ttgload.c ttinterp.c ttload.c ttobjs.c\
+ ttraster.c ttextend.c ttdebug.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Borland make does not handle $($(LIB_FILES)), and using
+# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing TLIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# See ../msdos/Makefile.TC for an application.
+.c.obj:
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) $<
+|
+
+
+!if ! $d(DEBUG)
+# Skipped if DEBUG build
+all: $(OBJS_S)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(OBJS_S: = + )
+|
+
+dll $(FT_DLL): $(OBJS_S) $(FT_DEF)
+!if $d(DLL)
+ $(CC) @&&|
+ $(DLLFLAGS) -e$(FT_DLL) $(OBJS_S)
+|
+ $(IMPLIB) libttf $(FT_DLL)
+!else
+ $(MAKE) -DDLL -f$(FT_MAKEFILE) dll # Re-invoke with flag set.
+!endif
+!endif
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) libttf.lib @&&|
++ $(OBJS_M: = + )
+|
+
+!ifdef DEBUG
+dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
+!if $d(DLL)
+ $(CC) @&&|
+ $(DLLFLAGS) -e$(FT_DLL) $(OBJS_M)
+|
+ $(IMPLIB) libttf $(FT_DLL)
+!else
+ $(MAKE) -DDEBUG -DDLL -f$(FT_MAKEFILE) dll
+!endif
+!endif
+
+install: $(FT_DLL)
+!ifdef INSTALL_DIR
+ copy $(FT_DLL) $(INSTALL_DIR)
+!else
+ copy $(FT_DLL) C:\WINDOWS
+!endif
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ -del libttf.lib
+ echo -+$(**: =-+)> response
+ $(LIB) libttf.lib @&&|
++ $(**: = + )
+|
+
+$(FT_DEF): $(ARCH)\ttf.def
+ -copy $(ARCH)\ttf.def $(FT_DEF)
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del libttf.bak
+ -del response
+ -del *.def
+ -del *.tds
+
+distclean: clean
+ -del libttf.lib
+ -del *.dll
+ -del $(FT_DEF)
+ -del C:\WINDOWS\$(FT_DLL)
+!if $d(INSTALL_DIR)
+ -del $(INSTALL_DIR)\$(FT_DLL)
+!endif
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/lib/arch/win32/Makefile.CL b/Build/source/libs/freetype/lib/arch/win32/Makefile.CL
new file mode 100644
index 00000000000..2e8308d2349
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/Makefile.CL
@@ -0,0 +1,175 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for Microsoft Visual C++ for 32-bit Windows.
+#
+# You will need NMAKE.
+#
+# Use this file while in the lib directory with the following statement:
+#
+# nmake /f arch\win32\Makefile.CL
+#
+#
+# A DLL version of the library can be built with
+#
+# nmake DLL=1 /f arch\win32\Makefile.CL dll
+#
+# Debug versions can be obtained with
+#
+# nmake DEBUG=1 /f arch\win32\Makefile.CL
+#
+#
+# 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.
+
+ARCH = arch\win32
+FT_MAKEFILE = $(ARCH)\Makefile.CL
+FT_DLL = ft15_32.dll
+
+CC = cl /nologo
+LIB = lib /nologo
+LINK = link /nologo
+
+CFLAGS = /Za /W2 -I$(ARCH) -I. -Iextend
+
+!ifndef DEBUG
+CFLAGS = $(CFLAGS) /Ox
+DLLFLAGS = /RELEASE
+!else
+CFLAGS = $(CFLAGS) /Zi /Ge
+DLLFLAGS = /DEBUG
+!endif
+
+!ifdef DLL
+CFLAGS = $(CFLAGS) /GD \
+ /DEXPORT_DEF=__declspec(dllexport) /DEXPORT_FUNC=__declspec(dllexport)
+!else
+CFLAGS = $(CFLAGS) /GA
+!endif
+
+
+TTFILE = .\ttfile.c
+TTMEMORY = .\ttmemory.c
+TTMUTEX = .\ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+# Do not insert spaces between the file names or at end of line, otherwise
+# the substitution for LIB command line will fail. Thank you.
+#
+SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
+extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
+extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
+OBJS_X = $(SRC_X:.c=.obj)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
+ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
+
+SRC_S = $(ARCH)\freetype.c
+OBJ_S = $(SRC_S:.c=.obj)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
+# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
+# by constructing LIB's response file directly in the `all' target.
+#
+# Another solution, useful during debugging of part of the library,
+# would be to include each .obj in the library as soon as it is compiled.
+# See ..\msdos\Makefile.TC for an application.
+.c.obj:
+ @$(CC) /c /Fo$@ @<<
+ $(CFLAGS) $*.c
+<<
+
+
+!ifndef DEBUG
+# Skipped if DEBUG build
+all: $(OBJS_S)
+ -del libttf.lib
+ $(LIB) /OUT:libttf.lib @<<response
+ $(OBJS_S)
+<<KEEP
+
+dll $(FT_DLL): $(OBJS_S)
+!ifdef DLL
+ $(LINK) @<<response
+ $(DLLFLAGS)
+ /DLL
+ /OUT:$(FT_DLL)
+ /IMPLIB:libttf.lib
+ /DEF:$(ARCH)\ttf.def
+ $**
+<<KEEP
+!else
+ $(MAKE) DLL=1 /f $(FT_MAKEFILE) dll # Re-invoke with flag set.
+!endif
+
+!endif
+
+
+debug: $(OBJS_M)
+ -del libttf.lib
+ $(LIB) /OUT:libttf.lib @<<response
+ $(OBJS_M)
+<<KEEP
+
+!ifdef DEBUG
+dll $(FT_DLL): $(OBJS_M)
+!ifdef DLL
+ $(LINK) @<<response
+ $(DLLFLAGS)
+ /DLL
+ /OUT:$(FT_DLL)
+ /IMPLIB:libttf.lib
+ /DEF:$(ARCH)\ttf.def
+ $**
+<<KEEP
+!else
+ $(MAKE) DLL=1 DEBUG=1 /f $(FT_MAKEFILE) dll # Re-invoke with flag set.
+!endif
+!endif
+
+install: $(FT_DLL)
+!ifdef INSTALL_DIR
+ copy $(FT_DLL) $(INSTALL_DIR)
+!else
+ copy $(FT_DLL) C:\WINDOWS
+!endif
+
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+# Not used here because it excesses the capacity of COMMAND.COM...
+libttf.lib: $(LIB_FILES)
+ $(LIB) /OUT:$@ $**
+
+
+clean:
+ -del *.obj
+ -del extend\*.obj
+ -del $(ARCH)\*.obj
+ -del libttf.bak
+ -del response
+ -del *.exp
+ -del *.pch
+ -del *.ilk
+
+distclean: clean
+ -del libttf.lib
+ -del *.dll
+ -del *.pdb
+ -del C:\WINDOWS\$(FT_DLL)
+!ifdef INSTALL_DIR
+ -del $(INSTALL_DIR)\$(FT_DLL)
+!endif
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile.CL
diff --git a/Build/source/libs/freetype/lib/arch/win32/Makefile.Min b/Build/source/libs/freetype/lib/arch/win32/Makefile.Min
new file mode 100644
index 00000000000..2741636e768
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/Makefile.Min
@@ -0,0 +1,109 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for MinGW32 gcc under Win9x.
+#
+# You will need a port of GNU make; the MinGW32 port works.
+#
+# Use this file while in the lib directory with the following statements:
+#
+# make -f arch/win32/Makefile.Min depend
+# make -f arch/win32/Makefile.Min
+#
+#
+# When compared to the other Makefiles for gcc, there is a difference
+# here, because COMMAND.COM on Win 9x is not able to process more than
+# 126 characters. So the command line for ar use the * shell character.
+#
+# This is not as safe as normal, because unnecessary files may be
+# included by mistake in the library.
+# The normal behaviour can be restored by defining NON_LIMITED_SHELL=1
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/win32
+FT_MAKEFILE = $(ARCH)/Makefile.Min
+
+CC = gcc
+
+ifdef DEBUG
+CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
+else
+CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend
+endif
+
+
+TTFILE = ./ttfile.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = ./ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
+ extend/ftxopen.c extend/ftxerr18.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=$(OBJS_S) OBJ_LOC=$(ARCH) libttf.a
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=$(OBJS_M) DEBUG=1 OBJ_LOC=. libttf.a
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+ifdef NOT_LIMITED_SHELL
+libttf.a: $(LIB_FILES)
+ -del $@
+ ar src $@ $^
+else
+# The previous command exceeds the capacity of COMMAND.COM,
+# so we cheat by passing * character to ar
+libttf.a: $(LIB_FILES)
+ -del $@
+ ar src $@ $(OBJ_LOC)/*.o extend/*.o
+endif
+
+
+clean:
+ -del *.o
+ -del extend\*.o
+ -del $(subst /,\,$(ARCH)\*.o)
+ -del response
+
+distclean: clean
+ -del dep.end
+ -del libttf.a
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) -E -MM -I$(ARCH) -I. -Iextend $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.Min
diff --git a/Build/source/libs/freetype/lib/arch/win32/Makefile.VC b/Build/source/libs/freetype/lib/arch/win32/Makefile.VC
new file mode 100644
index 00000000000..5211686ff67
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/Makefile.VC
@@ -0,0 +1,205 @@
+# Visual C++ 2.x, 4.x, 5.0 and 6.0 makefile for freetype
+# adapted from suns example makefile (related to the TCL script language)
+
+# Does not depend on the presence of any environment variables in
+# order to compile freetype; all needed information is derived from
+# location of the compiler directories.
+
+#
+# Project directories
+#
+# ROOT = top of source tree
+#
+# TMPDIR = location where .obj files should be stored during build
+#
+# TOOLS32 = location of VC++ 32-bit development tools. Note that the
+# VC++ 2.0 header files are broken, so you need to use the
+# ones that come with the developer network CD's, or later
+# versions of VC++.
+#
+#
+#
+# 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.
+
+ROOT = ..\..
+TMPDIR = .
+#TOOLS32 = c:\msdev # VC++ 2.x,4.x
+#TOOLS32 = c:\Program Files\devstudio\vc # VC++ 5.x
+TOOLS32 = c:\Program Files\Microsoft Visual Studio\Vc98 # VC++ 6.x
+INSTALLDIR = c:\WINNT\SYSTEM32
+
+# Set this to the appropriate value of /MACHINE: for your platform
+MACHINE = IX86
+
+# Comment the following line to compile with symbols
+NODEBUG=1
+
+
+######################################################################
+# Do not modify below this line
+######################################################################
+
+TTF = ft15_32
+TTFLIB = $(TTF).lib
+TTFDLL = $(TTF).dll
+
+TTFOBJS = \
+ $(TMPDIR)\ttapi.obj \
+ $(TMPDIR)\ttcache.obj \
+ $(TMPDIR)\ttcalc.obj \
+ $(TMPDIR)\ttcmap.obj \
+ $(TMPDIR)\ttdebug.obj \
+ $(TMPDIR)\ttfile.obj \
+ $(TMPDIR)\ttgload.obj \
+ $(TMPDIR)\ttinterp.obj \
+ $(TMPDIR)\ttload.obj \
+ $(TMPDIR)\ttmemory.obj \
+ $(TMPDIR)\ttmutex.obj \
+ $(TMPDIR)\ttobjs.obj \
+ $(TMPDIR)\ttraster.obj \
+ $(TMPDIR)\ttextend.obj \
+ $(TMPDIR)\ftxcmap.obj \
+ $(TMPDIR)\ftxgasp.obj \
+ $(TMPDIR)\ftxkern.obj \
+ $(TMPDIR)\ftxpost.obj \
+ $(TMPDIR)\ftxwidth.obj \
+ $(TMPDIR)\ftxerr18.obj
+
+
+PATH=$(TOOLS32)\bin;$(PATH)
+
+cc32 = "$(TOOLS32)\bin\cl.exe"
+link32 = "$(TOOLS32)\bin\link.exe"
+include32 = "-I$(TOOLS32)\include" -I$(ROOT)\arch\win32
+CP = copy
+RM = del
+
+TTF_INCLUDES = -I$(ROOT)
+TTF_DEFINES = -nologo -D__WIN32__ -D__WIN32DLL__
+
+TTF_CFLAGS = $(cdebug) $(cflags) $(cvarsdll) $(include32) \
+ $(TTF_INCLUDES) $(TTF_DEFINES)
+CON_CFLAGS = $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE
+DOS_CFLAGS = $(cdebug) $(cflags) $(include16) -AL
+
+######################################################################
+# Link flags
+######################################################################
+
+!IFDEF NODEBUG
+ldebug = /RELEASE
+!ELSE
+ldebug = -debug:full -debugtype:cv
+!ENDIF
+
+# declarations common to all linker options
+lcommon = /NODEFAULTLIB /RELEASE /NOLOGO
+
+# declarations for use on Intel i386, i486, and Pentium systems
+!IF "$(MACHINE)" == "IX86"
+DLLENTRY = @12
+lflags = $(lcommon) /MACHINE:$(MACHINE)
+!ELSE
+lflags = $(lcommon) /MACHINE:$(MACHINE)
+!ENDIF
+
+conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
+guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup
+dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
+
+!IF "$(MACHINE)" == "PPC"
+libc = libc.lib
+libcdll = crtdll.lib
+!ELSE
+libc = libc.lib oldnames.lib
+libcdll = msvcrt.lib oldnames.lib
+!ENDIF
+
+baselibs = kernel32.lib $(optlibs) advapi32.lib
+winlibs = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib
+
+guilibs = $(libc) $(winlibs)
+conlibs = $(libc) $(baselibs)
+guilibsdll = $(libcdll) $(winlibs)
+conlibsdll = $(libcdll) $(baselibs)
+
+######################################################################
+# Compile flags
+######################################################################
+
+!IFDEF NODEBUG
+cdebug = -O2 -Gs -GD
+!ELSE
+cdebug = -Z7 -Od -WX
+!ENDIF
+
+# declarations common to all compiler options
+ccommon = -c -W3 -nologo -YX -Dtry=__try -Dexcept=__except
+
+# NEED BYTEORDER INFORMATION HERE !!
+!IF "$(MACHINE)" == "IX86"
+cflags = $(ccommon) -D_X86_=1
+!ELSE
+!IF "$(MACHINE)" == "MIPS"
+cflags = $(ccommon) -D_MIPS_=1
+!ELSE
+!IF "$(MACHINE)" == "PPC"
+cflags = $(ccommon) -D_PPC_=1
+!ELSE
+!IF "$(MACHINE)" == "ALPHA"
+cflags = $(ccommon) -D_ALPHA_=1
+!ENDIF
+!ENDIF
+!ENDIF
+!ENDIF
+
+cvars = -DWIN32 -D_WIN32
+cvarsmt = $(cvars) -D_MT
+cvarsdll = $(cvarsmt) -D_DLL
+
+######################################################################
+# Project specific targets
+######################################################################
+
+release: $(TTFDLL)
+all: $(TTFDLL)
+
+install: $(TTFDLL)
+ -@md $(INSTALLDIR)
+ -@$(CP) $(TTFDLL) $(INSTALLDIR)
+
+
+
+$(TTFDLL): $(TTFOBJS) ttf.def
+ $(link32) $(ldebug) $(dlllflags) \
+ $(guilibsdll) -out:$(TTFDLL) -def:ttf.def $(TTFOBJS)
+
+#ttf.def: $(TTFOBJS)
+# ..\..\tcl8.0.4\win\release\dumpexts -o $@ ttf.dll $(TTFOBJS)
+
+
+#
+# Implicit rules
+#
+
+{$(ROOT)\extend}.c{$(TMPDIR)}.obj:
+ $(cc32) $(TTF_CFLAGS) -Fo$(TMPDIR)\ $<
+
+{$(ROOT)}.c{$(TMPDIR)}.obj:
+ $(cc32) $(TTF_CFLAGS) -Fo$(TMPDIR)\ $<
+
+
+clean:
+ -@del *.exp
+ -@del *.lib
+ -@del *.dll
+ -@del $(TMPDIR)\*.obj
+ -@del *.pch
+ -@del *.pdb
diff --git a/Build/source/libs/freetype/lib/arch/win32/Makefile.gcc b/Build/source/libs/freetype/lib/arch/win32/Makefile.gcc
new file mode 100644
index 00000000000..8cbf0737f45
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/Makefile.gcc
@@ -0,0 +1,107 @@
+# This file is part of the FreeType project.
+#
+# It builds the library for gcc under Win32.
+# This Makefile will fail with MinGW32 ports of gcc and make under
+# bare-bones Windows 9X, because of the limitations of command.com.
+# Use Makefile.min instead.
+#
+# You will need GNU make.
+#
+# Use this file while in the lib directory with the following statements:
+#
+# make -f arch/win32/Makefile.gcc depend
+# make -f arch/win32/Makefile.gcc
+#
+#
+# If you have the GNU gettext package installed, you can also try
+#
+# make -f arch/win32/Makefile.gcc HAVE_GETTEXT
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/win32
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+CC = gcc
+
+ifndef GETTEXT
+GETTEXT=NO_GETTEXT
+endif
+
+ifndef DEBUG
+CFLAGS = -Wall -O0 -g -ansi -pedantic -I$(ARCH) -I. -Iextend -D$(GETTEXT)
+else
+CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend -D$(GETTEXT)
+endif
+
+
+TTFILE = ./ttfile.c
+TTMEMORY = ./ttmemory.c
+TTMUTEX = ./ttmutex.c
+
+PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
+
+SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
+ extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
+ extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
+ extend/ftxopen.c extend/ftxerr18.c
+OBJS_X = $(SRC_X:.c=.o)
+
+SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
+ ttgload.c ttinterp.c ttload.c ttobjs.c \
+ ttraster.c ttextend.c $(PORT)
+OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
+
+SRC_S = $(ARCH)/freetype.c
+OBJ_S = $(SRC_S:.c=.o)
+OBJS_S = $(OBJ_S) $(OBJS_X)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PHONY: all debug clean distclean depend
+
+
+all:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
+
+debug:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M DEBUG=1 libttf.a
+
+HAVE_GETTEXT:
+ $(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S GETTEXT=HAVE_GETTEXT \
+ libttf.a
+
+$(OBJ_S): $(SRC_S) $(SRC_M)
+
+libttf.a: $($(LIB_FILES))
+ -del $@
+ ar src $@ $^
+
+clean:
+ -del *.o
+ -del extend\*.o
+ -del $(subst /,\,$(ARCH)/*.o)
+ -del response
+
+distclean: clean
+ -del dep.end
+ -del libttf.a
+
+depend: $(SRC_S) $(SRC_M) $(SRC_X)
+ $(CC) -E -MM -I$(ARCH) -I. -Iextend $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/lib/arch/win32/depend.win b/Build/source/libs/freetype/lib/arch/win32/depend.win
new file mode 100644
index 00000000000..439b28fb6a9
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/depend.win
@@ -0,0 +1,107 @@
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in `makedep'...
+#
+# This dependency file to be used with various Win32 compilers
+# has been generated automatically with the script `makedep' on
+# 2002-11-18.
+
+ttapi.obj: ttapi.c ttconfig.h arch\win32\ft_conf.h freetype.h fterrid.h \
+ ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
+ ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
+ ttgload.h ttraster.h ttextend.h
+ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
+ arch\win32\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
+ ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
+ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\win32\ft_conf.h freetype.h \
+ fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
+ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\win32\ft_conf.h ttengine.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
+ tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
+ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\win32\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h ttcmap.h
+ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\win32\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
+ttfile.obj: ttfile.c ttconfig.h arch\win32\ft_conf.h freetype.h \
+ fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
+ ttmemory.h ttfile.h
+ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
+ ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
+ ttmemory.h tttags.h ttload.h
+ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
+ ttconfig.h arch\win32\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
+ ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
+ ttcmap.h
+ttload.obj: ttload.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
+ ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
+ ttmemory.h tttags.h ttload.h
+ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\win32\ft_conf.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
+ ttmutex.h
+ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\win32\ft_conf.h
+ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\win32\ft_conf.h ttengine.h \
+ tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
+ tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
+ ttinterp.h ttextend.h
+ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
+ ttdebug.h ttcalc.h ttmemory.h
+extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\win32\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
+extend\ftxerr18.obj: extend\ftxerr18.c extend\ftxerr18.h freetype.h fterrid.h \
+ ftnameid.h extend\ftxkern.h extend\ftxpost.h extend\ftxopen.h \
+ extend\ftxgdef.h extend\ftxgsub.h extend\ftxgpos.h ttconfig.h \
+ arch\win32\ft_conf.h
+extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\win32\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
+extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
+ ftnameid.h ttextend.h ttconfig.h arch\win32\ft_conf.h tttypes.h \
+ ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
+ ttload.h ttmemory.h ttfile.h tttags.h
+extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\win32\ft_conf.h \
+ freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
+ ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
+ ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
+ extend\ftxgpos.h extend\ftxopenf.h
+extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
+ ftnameid.h tttypes.h ttconfig.h arch\win32\ft_conf.h ttobjs.h \
+ ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
+ ttdebug.h tttags.h ttmemory.h ttextend.h
+extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
+ ftnameid.h ttobjs.h ttconfig.h arch\win32\ft_conf.h ttengine.h \
+ tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
+ ttload.h ttmemory.h tttags.h ttextend.h
+extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
+ ftnameid.h ttdebug.h ttconfig.h arch\win32\ft_conf.h tttypes.h \
+ ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
+ tttags.h ttload.h
+!ifndef __MAKE__
+arch\win32\freetype.obj: arch\win32\freetype.c ttapi.c ttconfig.h \
+ arch\win32\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
+ tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
+ ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
+ ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
+ ttinterp.h ttload.c ttobjs.c ttraster.c ttfile.c ttmemory.c ttmutex.c \
+ ttextend.c
+!endif
diff --git a/Build/source/libs/freetype/lib/arch/win32/freetype.c b/Build/source/libs/freetype/lib/arch/win32/freetype.c
new file mode 100644
index 00000000000..ba976dea220
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/freetype.c
@@ -0,0 +1,44 @@
+/* This file is part of the FreeType project */
+
+/* single object library component for Win32 */
+#define TT_MAKE_OPTION_SINGLE_OBJECT
+
+/* Note, you should define the FT_EXPORT_xxx macros here if you */
+/* want to build a Win32 DLL. If undefined, the macros default to */
+/* "extern"/"" (nothing), which is suitable for static libraries. */
+/* See `ttconfig.h' for details. */
+
+/* The macro FT_EXPORT_DEF is placed before each high-level API */
+/* function declaration, and FT_EXPORT_FUNC before each */
+/* definition (body). Similarly, FT_EXPORT_DECL is placed before */
+/* each variable declaration, and FT_EXPORT_VAR before its */
+/* definition. You can then use it to take any compiler-specific */
+/* pragma for DLL-exported symbols */
+
+/* first include common core components */
+
+#include "ttapi.c"
+#include "ttcache.c"
+#include "ttcalc.c"
+#include "ttcmap.c"
+#include "ttdebug.c"
+#include "ttgload.c"
+#include "ttinterp.c"
+#include "ttload.c"
+#include "ttobjs.c"
+#include "ttraster.c"
+
+/* then system-specific (or ANSI) components */
+
+#include "ttfile.c"
+#include "ttmemory.c"
+#include "ttmutex.c"
+
+/* finally, add some extensions */
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.c"
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/win32/freetype.dsp b/Build/source/libs/freetype/lib/arch/win32/freetype.dsp
new file mode 100644
index 00000000000..cd1d64a0f36
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/freetype.dsp
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="freetype" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+#
+#
+# Copyright 1996-2002 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.
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=freetype - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "freetype.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "freetype.mak" CFG="freetype - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "freetype - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "freetype - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "freetype - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "."
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MT /Za /W3 /GX /O1 /I "." /I "../.." /I "../../extend" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"./libttf.lib"
+
+!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /Za /W3 /GX /Zi /Od /I "." /I "../.." /I "../../extend" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /YX
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"Debug/libttf.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "freetype - Win32 Release"
+# Name "freetype - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\freetype.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxcmap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxerr18.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxgasp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxkern.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxpost.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxsbit.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxwidth.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxopen.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxgdef.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxgsub.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\extend\ftxgpos.c
+# End Source File
+# End Target
+# End Project
diff --git a/Build/source/libs/freetype/lib/arch/win32/freetype.dsw b/Build/source/libs/freetype/lib/arch/win32/freetype.dsw
new file mode 100644
index 00000000000..f52de6a19fc
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/freetype.dsw
@@ -0,0 +1,54 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+#
+#
+# Copyright 1996-2002 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.
+
+###############################################################################
+
+Project: "Freetype"=".\freetype.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "FT_DLL"=".\ft_dll.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name Freetype
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Build/source/libs/freetype/lib/arch/win32/freetype.ide b/Build/source/libs/freetype/lib/arch/win32/freetype.ide
new file mode 100644
index 00000000000..f5c4043e572
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/freetype.ide
Binary files differ
diff --git a/Build/source/libs/freetype/lib/arch/win32/freetype.mak b/Build/source/libs/freetype/lib/arch/win32/freetype.mak
new file mode 100644
index 00000000000..e76d1d075da
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/freetype.mak
@@ -0,0 +1,363 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00
+# ** DO NOT EDIT **
+#
+#
+# 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.
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+!IF "$(CFG)" == ""
+CFG=freetype - Win32 Debug
+!MESSAGE No configuration specified. Defaulting to freetype - Win32 Debug.
+!ENDIF
+
+!IF "$(CFG)" != "freetype - Win32 Release" && "$(CFG)" !=\
+ "freetype - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "freetype.mak" CFG="freetype - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "freetype - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "freetype - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+# PROP Target_Last_Scanned "freetype - Win32 Debug"
+CPP=cl.exe
+
+!IF "$(CFG)" == "freetype - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+OUTDIR=.\Release
+INTDIR=.\Release
+
+ALL : "$(OUTDIR)\freetype.lib"
+
+CLEAN :
+ -@erase ".\Release\freetype.lib"
+ -@erase ".\Release\Ftxkern.obj"
+ -@erase ".\Release\ftxpost.obj"
+ -@erase ".\Release\ftxerr18.obj"
+ -@erase ".\Release\Ftxcmap.obj"
+ -@erase ".\Release\Freetype.obj"
+ -@erase ".\Release\Ftxgasp.obj"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\.." /I "..\..\extend" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "." /I "..\.." /I "..\..\extend" /D "WIN32"\
+ /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/freetype.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Release/
+CPP_SBRS=
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/freetype.bsc"
+BSC32_SBRS=
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+LIB32_FLAGS=/nologo /out:"$(OUTDIR)/freetype.lib"
+LIB32_OBJS= \
+ "$(INTDIR)/Ftxkern.obj" \
+ "$(INTDIR)/ftxpost.obj" \
+ "$(INTDIR)/ftxerr18.obj" \
+ "$(INTDIR)/Ftxcmap.obj" \
+ "$(INTDIR)/Freetype.obj" \
+ "$(INTDIR)/Ftxgasp.obj"
+
+"$(OUTDIR)\freetype.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
+ $(LIB32) @<<
+ $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+OUTDIR=.\Debug
+INTDIR=.\Debug
+
+ALL : "$(OUTDIR)\freetype.lib"
+
+CLEAN :
+ -@erase ".\Debug\freetype.lib"
+ -@erase ".\Debug\Freetype.obj"
+ -@erase ".\Debug\Ftxkern.obj"
+ -@erase ".\Debug\ftxpost.obj"
+ -@erase ".\Debug\Ftxcmap.obj"
+ -@erase ".\Debug\Ftxgasp.obj"
+ -@erase ".\Debug\ftxerr18.obj"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "." /I "..\.." /I "..\..\extend" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+CPP_PROJ=/nologo /MLd /W3 /GX /Z7 /Od /I "." /I "..\.." /I "..\..\extend" /D\
+ "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/freetype.pch" /YX\
+ /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/freetype.bsc"
+BSC32_SBRS=
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+LIB32_FLAGS=/nologo /out:"$(OUTDIR)/freetype.lib"
+LIB32_OBJS= \
+ "$(INTDIR)/Freetype.obj" \
+ "$(INTDIR)/Ftxkern.obj" \
+ "$(INTDIR)/ftxpost.obj" \
+ "$(INTDIR)/Ftxcmap.obj" \
+ "$(INTDIR)/Ftxgasp.obj" \
+ "$(INTDIR)/ftxerr18.obj"
+
+"$(OUTDIR)\freetype.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
+ $(LIB32) @<<
+ $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ENDIF
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+################################################################################
+# Begin Target
+
+# Name "freetype - Win32 Release"
+# Name "freetype - Win32 Debug"
+
+!IF "$(CFG)" == "freetype - Win32 Release"
+
+!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
+
+!ENDIF
+
+################################################################################
+# Begin Source File
+
+SOURCE=\Freetype\Lib\Extend\ftxpost.c
+DEP_CPP_FTXPO=\
+ ".\..\..\Extend\ftxpost.h"\
+ ".\..\..\tttypes.h"\
+ ".\..\..\ttobjs.h"\
+ ".\..\..\tttables.h"\
+ ".\..\..\ttload.h"\
+ ".\..\..\ttfile.h"\
+ ".\..\..\tttags.h"\
+ ".\..\..\ttmemory.h"\
+ ".\..\..\ttextend.h"\
+ ".\..\..\freetype.h"\
+ "..\..\ttconfig.h"\
+ ".\ft_conf.h"\
+ "..\..\ttengine.h"\
+ "..\..\ttmutex.h"\
+ "..\..\ttcache.h"\
+ "..\..\ttcmap.h"\
+ ".\..\..\ttdebug.h"\
+
+
+"$(INTDIR)\ftxpost.obj" : $(SOURCE) $(DEP_CPP_FTXPO) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=\Freetype\Lib\Extend\ftxerr18.c
+DEP_CPP_FTXER=\
+ ".\..\..\Extend\ftxerr18.h"\
+ ".\..\..\Extend\ftxkern.h"\
+ ".\..\..\Extend\ftxpost.h"\
+ ".\..\..\freetype.h"\
+ "..\..\ttconfig.h"\
+ ".\ft_conf.h"\
+
+
+"$(INTDIR)\ftxerr18.obj" : $(SOURCE) $(DEP_CPP_FTXER) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=\Freetype\Lib\Extend\Ftxgasp.c
+DEP_CPP_FTXGA=\
+ ".\..\..\Extend\ftxgasp.h"\
+ ".\..\..\tttypes.h"\
+ ".\..\..\ttobjs.h"\
+ ".\..\..\tttables.h"\
+ ".\..\..\freetype.h"\
+ "..\..\ttconfig.h"\
+ ".\ft_conf.h"\
+ "..\..\ttengine.h"\
+ "..\..\ttmutex.h"\
+ "..\..\ttcache.h"\
+ "..\..\ttcmap.h"\
+
+
+"$(INTDIR)\Ftxgasp.obj" : $(SOURCE) $(DEP_CPP_FTXGA) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=\Freetype\Lib\Extend\Ftxkern.c
+DEP_CPP_FTXKE=\
+ ".\..\..\Extend\ftxkern.h"\
+ ".\..\..\ttextend.h"\
+ ".\..\..\tttypes.h"\
+ ".\..\..\ttdebug.h"\
+ ".\..\..\ttmemory.h"\
+ ".\..\..\ttfile.h"\
+ ".\..\..\ttobjs.h"\
+ ".\..\..\ttload.h"\
+ ".\..\..\tttags.h"\
+ ".\..\..\freetype.h"\
+ "..\..\ttconfig.h"\
+ ".\ft_conf.h"\
+ "..\..\ttengine.h"\
+ "..\..\ttmutex.h"\
+ "..\..\ttcache.h"\
+ ".\..\..\tttables.h"\
+ "..\..\ttcmap.h"\
+
+
+"$(INTDIR)\Ftxkern.obj" : $(SOURCE) $(DEP_CPP_FTXKE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=\Freetype\Lib\Extend\Ftxcmap.c
+DEP_CPP_FTXCM=\
+ ".\..\..\Extend\ftxcmap.h"\
+ ".\..\..\tttypes.h"\
+ ".\..\..\ttobjs.h"\
+ ".\..\..\tttables.h"\
+ ".\..\..\freetype.h"\
+ "..\..\ttconfig.h"\
+ ".\ft_conf.h"\
+ "..\..\ttengine.h"\
+ "..\..\ttmutex.h"\
+ "..\..\ttcache.h"\
+ "..\..\ttcmap.h"\
+
+
+"$(INTDIR)\Ftxcmap.obj" : $(SOURCE) $(DEP_CPP_FTXCM) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\Freetype.c
+DEP_CPP_FREET=\
+ ".\..\..\ttapi.c"\
+ ".\..\..\ttcache.c"\
+ ".\..\..\ttcalc.c"\
+ ".\..\..\ttcmap.c"\
+ ".\..\..\ttgload.c"\
+ ".\..\..\ttinterp.c"\
+ ".\..\..\ttload.c"\
+ ".\..\..\ttobjs.c"\
+ ".\..\..\ttraster.c"\
+ ".\..\..\ttfile.c"\
+ ".\..\..\ttmemory.c"\
+ ".\..\..\ttmutex.c"\
+ ".\..\..\ttextend.c"\
+ ".\..\..\freetype.h"\
+ "..\..\ttengine.h"\
+ "..\..\ttcalc.h"\
+ ".\..\..\ttmemory.h"\
+ "..\..\ttcache.h"\
+ ".\..\..\ttfile.h"\
+ ".\..\..\ttobjs.h"\
+ ".\..\..\ttload.h"\
+ "..\..\ttgload.h"\
+ "..\..\ttraster.h"\
+ ".\..\..\ttextend.h"\
+ "..\..\ttconfig.h"\
+ ".\ft_conf.h"\
+ "..\..\ttmutex.h"\
+ ".\..\..\tttypes.h"\
+ ".\..\..\ttdebug.h"\
+ ".\..\..\tttables.h"\
+ "..\..\ttcmap.h"\
+ ".\..\..\tttags.h"\
+ "..\..\ttinterp.h"\
+ {$(INCLUDE)}"\unistd.h"\
+
+
+"$(INTDIR)\Freetype.obj" : $(SOURCE) $(DEP_CPP_FREET) "$(INTDIR)"
+
+
+# End Source File
+# End Target
+# End Project
+################################################################################
diff --git a/Build/source/libs/freetype/lib/arch/win32/freetype.mdp b/Build/source/libs/freetype/lib/arch/win32/freetype.mdp
new file mode 100644
index 00000000000..9082b5a70a9
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/freetype.mdp
Binary files differ
diff --git a/Build/source/libs/freetype/lib/arch/win32/ft_conf.h b/Build/source/libs/freetype/lib/arch/win32/ft_conf.h
new file mode 100644
index 00000000000..ba066d8a553
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/ft_conf.h
@@ -0,0 +1,243 @@
+/*******************************************************************
+ *
+ * ft_conf.h for Win32
+ *
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+
+/* we need the following because there are some typedefs in this file */
+
+#ifndef FT_CONF_H
+#define FT_CONF_H
+
+#ifndef WIN32
+#define WIN32
+#endif
+
+/* Define to empty if the 'const' keyword does not work. */
+/* #undef const */
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* The number of bytes in a int. */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long. */
+#define SIZEOF_LONG 4
+
+/* Define if you have the <libintl.h> header file. */
+/* #undef HAVE_LIBINTL_H */
+
+/* Command-line selection. */
+#ifdef HAVE_LIBINTL
+#define HAVE_LIBINTL_H
+#ifndef LOCALEDIR
+#define LOCALEDIR "C:/Program Files/gettext/share/locale"
+#endif
+#endif
+/* Backward compatibility. */
+#ifdef HAVE_GETTEXT
+#define HAVE_LIBINTL_H
+#endif
+
+/* Define if you have the <locale.h> header file. */
+/* Only meaningful if you have <libintl.h>. */
+#define HAVE_LOCALE_H
+
+/**********************************************************************/
+/* */
+/* The following configuration macros can be tweaked manually by */
+/* a developer to turn on or off certain features or options in the */
+/* TrueType engine. This may be useful to tune it for specific */
+/* purposes.. */
+/* */
+/**********************************************************************/
+
+
+/*************************************************************************/
+/* Define this if the underlying operating system uses a different */
+/* character width than 8bit for file names. You must then also supply */
+/* a typedef declaration for defining 'TT_Text'. Default is off. */
+
+/* #define HAVE_TT_TEXT */
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support engine extensions */
+/* Default is on, but if you're satisfied by the basic services provided */
+/* by the engine and need no extensions, undefine this configuration */
+/* macro to save a few more bytes. */
+
+#define TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*************************************************************************/
+/* Define this if you want to generate code to support gray-scaling, */
+/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
+/* disable it if you don't need it. */
+
+#define TT_CONFIG_OPTION_GRAY_SCALING
+
+
+/*************************************************************************/
+/* Define this if you want to compile a bytecode interpreter in the */
+/* TrueType driver. Note that there are important patent issues related */
+/* to the use of the interpreter. */
+/* */
+/* By undefining this, you will only compile the code necessary to load */
+/* TrueType glyphs without hinting. */
+
+#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to use a big 'switch' statement within the */
+/* bytecode interpreter. Because some non-optimizing compilers are not */
+/* able to produce jump tables from such statements, undefining this */
+/* configuration macro will generate the appropriate C jump table in */
+/* ttinterp.c. If you use an optimizing compiler, you should leave it */
+/* defined for better performance and code compactness.. */
+
+#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the TrueType */
+/* bytecode interpreter. This will produce much bigger code, which */
+/* _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to build a 'static' version of the scan-line */
+/* converter (the component which in charge of converting outlines into */
+/* bitmaps). This will produce a bigger object file for "ttraster.c", */
+/* which _may_ be faster on some architectures.. */
+/* */
+/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
+
+#undef TT_CONFIG_OPTION_STATIC_RASTER
+
+
+/*************************************************************************/
+/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
+/* version of the library. */
+
+#undef TT_CONFIG_OPTION_THREAD_SAFE
+
+
+/**********************************************************************/
+/* */
+/* The following macros are used to define the debug level, as well */
+/* as individual tracing levels for each component. There are */
+/* currently three modes of operation : */
+/* */
+/* - trace mode (define DEBUG_LEVEL_TRACE) */
+/* */
+/* The engine prints all error messages, as well as tracing */
+/* ones, filtered by each component's level */
+/* */
+/* - debug mode (define DEBUG_LEVEL_ERROR) */
+/* */
+/* Disable tracing, but keeps error output and assertion */
+/* checks. */
+/* */
+/* - release mode (don't define anything) */
+/* */
+/* Don't include error-checking or tracing code in the */
+/* engine's code. Ideal for releases. */
+/* */
+/* NOTE : */
+/* */
+/* Each component's tracing level is defined in its own source. */
+/* */
+/**********************************************************************/
+
+/* Define if you want to use the tracing debug mode */
+#undef DEBUG_LEVEL_TRACE
+
+/* Define if you want to use the error debug mode - ignored if */
+/* DEBUG_LEVEL_TRACE is defined */
+#undef DEBUG_LEVEL_ERROR
+
+
+/**************************************************************************/
+/* Definition of various integer sizes. These types are used by ttcalc */
+/* and ttinterp (for the 64-bit integers) only.. */
+
+#if SIZEOF_INT == 4
+
+ typedef signed int TT_Int32;
+ typedef unsigned int TT_Word32;
+
+#elif SIZEOF_LONG == 4
+
+ typedef signed long TT_Int32;
+ typedef unsigned long TT_Word32;
+
+#else
+#error "no 32bit type found"
+#endif
+
+#if SIZEOF_LONG == 8
+
+/* LONG64 must be defined when a 64-bit type is available */
+/* INT64 must then be defined to this type.. */
+#define LONG64
+#define INT64 long
+
+#else
+
+/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
+/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
+/* will produce many -ansi warnings during library compilation. */
+#ifdef TT_USE_LONG_LONG
+
+#define LONG64
+#define INT64 long long
+
+#endif /* TT_USE_LONG_LONG */
+#endif
+
+
+#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
+
+ /* We disable some warnings in order to compile cleanly with the maximum */
+ /* level of warnings. But do not worry: all these warnings have been */
+ /* checked, and resulted harmless. */
+#pragma warning( disable : 4244 )
+#pragma warning( disable : 4761 )
+
+#define FT_EXPORT_DEF( type ) extern FREETYPEDLL type
+#define FT_EXPORT_FUNC( type ) type
+#define FT_EXPORT_DECL( type ) FT_EXPORT_DEF( type )
+#define FT_EXPORT_VAR( type ) FT_EXPORT_DECL( type )
+
+#endif /* _MSC_VER */
+
+#endif /* FT_CONF_H */
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/arch/win32/ft_dll.dsp b/Build/source/libs/freetype/lib/arch/win32/ft_dll.dsp
new file mode 100644
index 00000000000..607f22bed9a
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/ft_dll.dsp
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="ft_dll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+#
+#
+# Copyright 1996-2002 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.
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ft_dll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ft_dll.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ft_dll.mak" CFG="ft_dll - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ft_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ft_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ft_dll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD MTL /nologo /D "NDEBUG" /o NUL /win32
+# SUBTRACT MTL /mktyplib203
+# ADD BASE RSC /l 0x0 /d "NDEBUG"
+# ADD RSC /l 0x0 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"./ft15_32.dll"
+
+!ELSEIF "$(CFG)" == "ft_dll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD MTL /nologo /D "_DEBUG" /o NUL /win32
+# SUBTRACT MTL /mktyplib203
+# ADD BASE RSC /l 0x0 /d "_DEBUG"
+# ADD RSC /l 0x0 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/ft15_32.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "ft_dll - Win32 Release"
+# Name "ft_dll - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ttf.def
+# End Source File
+# End Target
+# End Project
diff --git a/Build/source/libs/freetype/lib/arch/win32/makedef b/Build/source/libs/freetype/lib/arch/win32/makedef
new file mode 100755
index 00000000000..222495d42d6
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/makedef
@@ -0,0 +1,28 @@
+# makedef
+#
+# This shell script creates a .DEF file necessary for building as DLL
+# on the Windows 32-bit platform.
+
+echo "\
+; This file is part of the FreeType project.
+; Automatically generated, but you can customize to fit your needs.
+; However, changes will be erased if not made in \`makedef'...
+;
+; This definition file to be used to built the library as DLL
+; has been generated automatically with the script \`makedef' on
+; `date +%Y-%m-%d`.
+
+LIBRARY ft15_32
+DESCRIPTION 'FreeType 1.5 32-bit DLL © 1996-2002 Turner, Wilhelm, Lemberg'
+EXETYPE WINDOWS
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE MULTIPLE
+EXPORTS
+" > ttf.def
+
+(cd ../..
+ sed -n -e "/^ *FT_EXPORT_DE/!d ; n ; s/(.*$//" \
+ -e "s/;$//" -e "s/ const / /" -e "s/ *TT_[a-zA-Z_\*]* //" \
+ -e "s/ *//g" -e "s/^/ /" -e "p" *.h extend/*.h) >> ttf.def
+
+# eof
diff --git a/Build/source/libs/freetype/lib/arch/win32/makedep b/Build/source/libs/freetype/lib/arch/win32/makedep
new file mode 100755
index 00000000000..81f0de2c1b3
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/makedep
@@ -0,0 +1,45 @@
+# makedep
+#
+# This shell script creates a dependency file necessary for some compilers
+# on the Win32 platform.
+#
+# If you run this script under non-Windows operating systems, expect
+# warnings that `windows.h' can't be found.
+#
+# Copyright 1996-2002 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.
+
+echo "\
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in \`makedep'...
+#
+# This dependency file to be used with various Win32 compilers
+# has been generated automatically with the script \`makedep' on
+# `date +%Y-%m-%d`.
+" > depend.win
+
+(cd ../..
+ gcc -MM -Iarch/win32 -I. *.c | \
+ sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.win
+
+(cd ../..
+ gcc -MM -Iarch/win32 -I. -Iextend extend/*.c | \
+ sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.win
+
+echo "!ifndef __MAKE__" >> depend.win
+
+(cd ../..
+ gcc -MM -Iarch/win32 -I. -Iextend arch/win32/*.c | \
+ sed -e "s/^\(.*\)\.o:/arch\\\\win32\\\\\1.obj:/" \
+ -e "s:/:\\\\:g") >> depend.win
+
+echo "!endif" >> depend.win
+
+# eof
diff --git a/Build/source/libs/freetype/lib/arch/win32/ttf.def b/Build/source/libs/freetype/lib/arch/win32/ttf.def
new file mode 100644
index 00000000000..d93a2e400e6
--- /dev/null
+++ b/Build/source/libs/freetype/lib/arch/win32/ttf.def
@@ -0,0 +1,134 @@
+; This file is part of the FreeType project.
+; Automatically generated, but you can customize to fit your needs.
+; However, changes will be erased if not made in `makedef'...
+;
+; This definition file to be used to built the library as DLL
+; has been generated automatically with the script `makedef' on
+; 2002-11-18.
+
+LIBRARY ft15_32
+DESCRIPTION 'FreeType 1.5 32-bit DLL © 1996-2002 Turner, Wilhelm, Lemberg'
+EXETYPE WINDOWS
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE MULTIPLE
+EXPORTS
+
+ TT_FreeType_Version
+ TT_Init_FreeType
+ TT_Done_FreeType
+ TT_Set_Raster_Gray_Palette
+ TT_Open_Face
+ TT_Open_Collection
+ TT_Get_Face_Properties
+ TT_Set_Face_Pointer
+ TT_Get_Face_Pointer
+ TT_Flush_Face
+ TT_Get_Face_Metrics
+ TT_Close_Face
+ TT_Get_Font_Data
+ TT_New_Instance
+ TT_Set_Instance_Resolutions
+ TT_Set_Instance_CharSize
+ TT_Set_Instance_CharSizes
+ TT_Set_Instance_PixelSizes
+ TT_Set_Instance_Transform_Flags
+ TT_Get_Instance_Metrics
+ TT_Set_Instance_Pointer
+ TT_Get_Instance_Pointer
+ TT_Done_Instance
+ TT_New_Glyph
+ TT_Done_Glyph
+ TT_Load_Glyph
+ TT_Get_Glyph_Outline
+ TT_Get_Glyph_Metrics
+ TT_Get_Glyph_Big_Metrics
+ TT_Get_Glyph_Bitmap
+ TT_Get_Glyph_Pixmap
+ TT_New_Outline
+ TT_Done_Outline
+ TT_Copy_Outline
+ TT_Get_Outline_Bitmap
+ TT_Get_Outline_Pixmap
+ TT_Get_Outline_BBox
+ TT_Transform_Outline
+ TT_Translate_Outline
+ TT_Transform_Vector
+ TT_MulDiv
+ TT_MulFix
+ TT_Get_CharMap_Count
+ TT_Get_CharMap_ID
+ TT_Get_CharMap
+ TT_Char_Index
+ TT_Get_Name_Count
+ TT_Get_Name_ID
+ TT_Get_Name_String
+ TT_Register_Extension
+ TT_Extension_Get
+ TT_Use_Stream
+ TT_Done_Stream
+ TT_Flush_Stream
+ TT_Read_File
+ TT_Seek_File
+ TT_Skip_File
+ TT_Read_At_File
+ TT_File_Pos
+ TT_Stream_Size
+ TT_Null_FileFrame
+ TT_Access_Frame
+ TT_Check_And_Access_Frame
+ TT_Forget_Frame
+ TT_Get_Char
+ TT_Get_Short
+ TT_Get_Long
+ TT_LookUp_Table
+ TT_Alloc
+ TT_Realloc
+ TT_Free
+ TT_CharMap_First
+ TT_CharMap_Next
+ TT_CharMap_Last
+ TT_ErrToString18
+ TT_Get_Face_Gasp_Flags
+ TT_Init_GDEF_Extension
+ TT_Load_GDEF_Table
+ TT_GDEF_Get_Glyph_Property
+ TT_GDEF_Build_ClassDefinition
+ TT_Init_GPOS_Extension
+ TT_Load_GPOS_Table
+ TT_GPOS_Select_Script
+ TT_GPOS_Select_Language
+ TT_GPOS_Select_Feature
+ TT_GPOS_Query_Scripts
+ TT_GPOS_Query_Languages
+ TT_GPOS_Query_Features
+ TT_GPOS_Add_Feature
+ TT_GPOS_Clear_Features
+ TT_GPOS_Register_Glyph_Function
+ TT_GPOS_Register_MM_Function
+ TT_GPOS_Apply_String
+ TT_Init_GSUB_Extension
+ TT_Load_GSUB_Table
+ TT_GSUB_Select_Script
+ TT_GSUB_Select_Language
+ TT_GSUB_Select_Feature
+ TT_GSUB_Query_Scripts
+ TT_GSUB_Query_Languages
+ TT_GSUB_Query_Features
+ TT_GSUB_Add_Feature
+ TT_GSUB_Clear_Features
+ TT_GSUB_Register_Alternate_Function
+ TT_GSUB_Apply_String
+ TT_GSUB_Add_String
+ TT_Init_Kerning_Extension
+ TT_Get_Kerning_Directory
+ TT_Load_Kerning_Table
+ TT_Init_Post_Extension
+ TT_Load_PS_Names
+ TT_Get_PS_Name
+ TT_Init_SBit_Extension
+ TT_Get_Face_Bitmaps
+ TT_New_SBit_Image
+ TT_Done_SBit_Image
+ TT_Get_SBit_Strike
+ TT_Load_Glyph_Bitmap
+ TT_Get_Face_Widths
diff --git a/Build/source/libs/freetype/lib/depend.mak b/Build/source/libs/freetype/lib/depend.mak
new file mode 100644
index 00000000000..8800a5e3c36
--- /dev/null
+++ b/Build/source/libs/freetype/lib/depend.mak
@@ -0,0 +1,222 @@
+$(objdir)/ttfile.obj: \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ tttypes.h \
+ ttdebug.h \
+ ttengine.h \
+ ttmutex.h \
+ ttmemory.h \
+ ttfile.h
+
+$(objdir)/ttmutex.obj: \
+ ttmutex.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h
+
+$(objdir)/ttdebug.obj: \
+ ttdebug.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ tttypes.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ tttables.h \
+ ttobjs.h \
+ ttengine.h \
+ ttmutex.h \
+ ttcache.h \
+ ttcmap.h
+
+$(objdir)/ttapi.obj: \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttengine.h \
+ tttypes.h \
+ ttmutex.h \
+ ttcalc.h \
+ ttmemory.h \
+ ttcache.h \
+ ttfile.h \
+ ttdebug.h \
+ ttobjs.h \
+ tttables.h \
+ ttcmap.h \
+ ttload.h \
+ ttgload.h \
+ ttraster.h \
+ ttextend.h
+
+$(objdir)/ttload.obj: \
+ tttypes.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttdebug.h \
+ ttcalc.h \
+ ttfile.h \
+ ttengine.h \
+ ttmutex.h \
+ tttables.h \
+ ttobjs.h \
+ ttcache.h \
+ ttcmap.h \
+ ttmemory.h \
+ tttags.h \
+ ttload.h
+
+$(objdir)/ttcmap.obj: \
+ ttobjs.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ ttengine.h \
+ tttypes.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttmutex.h \
+ ttcache.h \
+ tttables.h \
+ ttcmap.h \
+ ttdebug.h \
+ ttfile.h \
+ ttmemory.h \
+ ttload.h
+
+$(objdir)/ttraster.obj: \
+ ttraster.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttengine.h \
+ tttypes.h \
+ ttmutex.h \
+ ttdebug.h \
+ ttcalc.h \
+ ttmemory.h
+
+$(objdir)/ttobjs.obj: \
+ ttobjs.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ ttengine.h \
+ tttypes.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttmutex.h \
+ ttcache.h \
+ tttables.h \
+ ttcmap.h \
+ ttfile.h \
+ ttdebug.h \
+ ttcalc.h \
+ ttmemory.h \
+ ttload.h \
+ ttinterp.h \
+ ttextend.h
+
+$(objdir)/ttcalc.obj: \
+ ttcalc.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttdebug.h \
+ tttypes.h \
+ tttables.h
+
+$(objdir)/ttmemory.obj: \
+ ttdebug.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ tttypes.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttmemory.h \
+ ttengine.h \
+ ttmutex.h
+
+$(objdir)/ttgload.obj: \
+ tttypes.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttdebug.h \
+ ttcalc.h \
+ ttfile.h \
+ ttengine.h \
+ ttmutex.h \
+ tttables.h \
+ ttobjs.h \
+ ttcache.h \
+ ttcmap.h \
+ ttgload.h \
+ ttmemory.h \
+ tttags.h \
+ ttload.h
+
+$(objdir)/ttextend.obj: \
+ ttextend.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ tttypes.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttobjs.h \
+ ttengine.h \
+ ttmutex.h \
+ ttcache.h \
+ tttables.h \
+ ttcmap.h \
+ ttmemory.h
+
+$(objdir)/ttcache.obj: \
+ ttengine.h \
+ tttypes.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ ttmutex.h \
+ ttmemory.h \
+ ttcache.h \
+ ttobjs.h \
+ tttables.h \
+ ttcmap.h \
+ ttdebug.h
+
+$(objdir)/ttinterp.obj: \
+ freetype.h \
+ fterrid.h \
+ ftnameid.h \
+ tttypes.h \
+ ttconfig.h \
+ ./arch/win32/ft_conf.h \
+ ttdebug.h \
+ ttcalc.h \
+ ttmemory.h \
+ ttinterp.h \
+ ttobjs.h \
+ ttengine.h \
+ ttmutex.h \
+ ttcache.h \
+ tttables.h \
+ ttcmap.h
+
diff --git a/Build/source/libs/freetype/lib/extend/ftxcmap.c b/Build/source/libs/freetype/lib/extend/ftxcmap.c
new file mode 100644
index 00000000000..5d860456ca0
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxcmap.c
@@ -0,0 +1,404 @@
+/*******************************************************************
+ *
+ * ftxcmap.c
+ *
+ * API extension for iterating over Cmaps
+ *
+ * Copyright 1996-2002 by Juliusz Chroboczek,
+ * 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.
+ *
+ *
+ ******************************************************************/
+
+#include "ftxcmap.h"
+
+#include "tttypes.h"
+#include "ttobjs.h"
+#include "tttables.h"
+
+static Long charmap_first4 ( PCMap4, UShort* );
+static Long charmap_next4 ( PCMap4, UShort, UShort* );
+static Long charmap_last4 ( PCMap4, UShort* );
+static UShort charmap_find_id4( PCMap4, UShort, TCMap4Segment*, UShort );
+
+
+/*******************************************************************
+ *
+ * Function : TT_CharMap_First
+ *
+ * Description : Returns the first valid character code in a
+ * given character map. Also returns the corresponding
+ * glyph index.
+ *
+ * Input : charMap handle to the target character map
+ * id address where the glyph index will be
+ * be returned in case of success
+ *
+ * Output : First valid character code. -1 in case of failure.
+ *
+ ******************************************************************/
+
+FT_EXPORT_FUNC( TT_Long )
+TT_CharMap_First( TT_CharMap charMap,
+ TT_UShort* id )
+{
+ PCMapTable cmap;
+ UShort i, c;
+
+
+ if ( ( cmap = HANDLE_CharMap( charMap ) ) == 0 )
+ return -1;
+
+ switch ( cmap->format )
+ {
+ case 0:
+ if ( id )
+ *id = cmap->c.cmap0.glyphIdArray[0];
+ return 0;
+
+ case 4:
+ return charmap_first4( &cmap->c.cmap4, id );
+
+ case 6:
+ if ( cmap->c.cmap6.entryCount < 1 )
+ return -1;
+
+ if ( id )
+ *id = cmap->c.cmap6.glyphIdArray[0];
+ return cmap->c.cmap6.firstCode;
+
+ case 8:
+ case 12:
+ if ( id )
+ *id = (TT_UShort)cmap->c.cmap8_12.groups[0].startGlyphID;
+ return (TT_Long)cmap->c.cmap8_12.groups[0].startCharCode;
+
+ default:
+ /* Now loop from 0 to 65535. We can't use a simple "for' on */
+ /* 16-bits systems, hence the "strange" loop here.. */
+ i = 0;
+ do
+ {
+ c = TT_Char_Index( charMap, i );
+ if ( c > 0 )
+ {
+ if ( id )
+ *id = c;
+ return i;
+ }
+ i++;
+ } while ( i != 0 ); /* because i is UShort! */
+
+ return -1;
+ }
+}
+
+
+static Long charmap_first4( PCMap4 cmap4,
+ UShort* id )
+{
+ UShort firstCode;
+
+
+ if ( cmap4->segCountX2 / 2 < 1 )
+ return -1;
+
+ firstCode = cmap4->segments[0].startCount;
+
+ if ( id )
+ *id = charmap_find_id4( cmap4, firstCode, &(cmap4->segments[0]), 0 );
+
+ return firstCode;
+}
+
+
+/*******************************************************************
+ *
+ * Function : TT_CharMap_Next
+ *
+ * Description : Returns the next valid character code in a given
+ * charMap.
+ *
+ * Input : charMap handle to the target char. map
+ * index starting character code
+ * id address where the glyph index of the next
+ * character will be returned
+ *
+ * Output : Next valid character code after 'index'. -1 in case
+ * of failure.
+ *
+ ******************************************************************/
+
+FT_EXPORT_FUNC( TT_Long )
+TT_CharMap_Next( TT_CharMap charMap,
+ TT_ULong index,
+ TT_UShort* id )
+{
+ PCMapTable cmap;
+ UShort i, c;
+
+
+ cmap = HANDLE_CharMap( charMap );
+ if ( !cmap )
+ return -1;
+
+ switch ( cmap->format )
+ {
+ case 0:
+ if ( index < 255 )
+ {
+ if ( id )
+ *id = cmap->c.cmap0.glyphIdArray[index + 1];
+ return index + 1;
+ }
+ else
+ return -1;
+
+ case 4:
+ return charmap_next4( &cmap->c.cmap4, index, id );
+
+ case 6:
+ {
+ UInt firstCode = cmap->c.cmap6.firstCode;
+
+
+ if ( index + 1 < firstCode + cmap->c.cmap6.entryCount )
+ {
+ if ( id )
+ *id = cmap->c.cmap6.glyphIdArray[index + 1 - firstCode];
+ return index + 1;
+ }
+ else
+ return -1;
+ }
+
+ case 8:
+ case 12:
+ {
+ PCMapGroup group, limit;
+
+
+ limit = cmap->c.cmap8_12.groups + cmap->c.cmap8_12.nGroups;
+ group = cmap->c.cmap8_12.last_group;
+
+ if ( (ULong)( index - group->startCharCode ) <
+ (ULong)( group->endCharCode - group->startCharCode ) )
+ goto Found;
+
+ for ( group = cmap->c.cmap8_12.groups; group < limit; group++ )
+ {
+ if ( index > group->endCharCode )
+ continue;
+
+ if ( index >= group->startCharCode )
+ goto Found;
+ }
+
+ return -1;
+
+ Found:
+ if ( index < group->endCharCode )
+ {
+ cmap->c.cmap8_12.last_group = group;
+ *id = (UShort)( group->startGlyphID +
+ ( index - group->startCharCode ) + 1 );
+ return index + 1;
+ }
+
+ group++;
+
+ if ( group == limit )
+ return -1;
+
+ cmap->c.cmap8_12.last_group = group;
+ *id = (UShort)group->startGlyphID;
+ return group->startCharCode;
+ }
+
+ default:
+ /* Now loop from 0 to 65535. We can't use a simple "for" on */
+ /* 16-bits systems, hence the "strange" loop here.. */
+ i = 0;
+ do
+ {
+ c = TT_Char_Index( charMap, i );
+ if ( c > 0 )
+ {
+ if ( id )
+ *id = c;
+ return i;
+ }
+ i++;
+ } while ( i != 0 ); /* because i is UShort! */
+
+ return -1;
+ }
+}
+
+
+static Long charmap_next4( PCMap4 cmap4,
+ UShort charCode,
+ UShort* id)
+{
+ UShort segCount, nextCode;
+ UShort i;
+ TCMap4Segment seg4;
+
+
+ if ( charCode == 0xFFFF )
+ return -1; /* get it out of the way now */
+
+ segCount = cmap4->segCountX2 / 2;
+
+ for ( i = 0; i < segCount; i++ )
+ if ( charCode < cmap4->segments[i].endCount )
+ break;
+
+ /* Safety check - even though the last endCount should be 0xFFFF */
+ if ( i >= segCount )
+ return -1;
+
+ seg4 = cmap4->segments[i];
+
+ if ( charCode < seg4.startCount )
+ nextCode = seg4.startCount;
+ else
+ nextCode = charCode + 1;
+
+ if ( id )
+ *id = charmap_find_id4( cmap4, nextCode, &seg4, i );
+
+ return nextCode;
+}
+
+
+static UShort
+charmap_find_id4( PCMap4 cmap4,
+ UShort charCode,
+ TCMap4Segment* seg4,
+ UShort i )
+{
+ UShort index1;
+
+
+ if ( seg4->idRangeOffset == 0 )
+ return (charCode + seg4->idDelta) & 0xFFFF;
+ else
+ {
+ index1 = seg4->idRangeOffset / 2 + charCode-seg4->startCount -
+ ( cmap4->segCountX2 / 2 - i );
+
+ if ( index1 >= cmap4->numGlyphId || cmap4->glyphIdArray[index1] == 0 )
+ return 0;
+ else
+ return (cmap4->glyphIdArray[index1] + seg4->idDelta) & 0xFFFF;
+ }
+}
+
+
+/*******************************************************************
+ *
+ * Function : TT_CharMap_Last
+ *
+ * Description : Returns the last valid character code in a
+ * given character map. Also returns the corresponding
+ * glyph index.
+ *
+ * Input : charMap handle to the target character map
+ * id address where the glyph index will be
+ * be returned in case of success
+ *
+ * Output : Last valid character code. -1 in case of failure.
+ *
+ ******************************************************************/
+
+FT_EXPORT_FUNC( TT_Long )
+TT_CharMap_Last( TT_CharMap charMap,
+ TT_UShort* id )
+{
+ PCMapTable cmap;
+ UShort i, c;
+
+
+ if ( ( cmap = HANDLE_CharMap( charMap ) ) == 0 )
+ return -1;
+
+ switch ( cmap->format )
+ {
+ case 0:
+ if ( id )
+ *id = cmap->c.cmap0.glyphIdArray[255];
+ return 255;
+
+ case 4:
+ return charmap_last4( &cmap->c.cmap4, id );
+
+ case 6:
+ if ( cmap->c.cmap6.entryCount < 1 )
+ return -1;
+
+ if ( id )
+ *id = cmap->c.cmap6.glyphIdArray[cmap->c.cmap6.entryCount - 1];
+ return cmap->c.cmap6.firstCode + cmap->c.cmap6.entryCount - 1;
+
+ case 8:
+ case 12:
+ {
+ PCMapGroup group;
+
+
+ group = cmap->c.cmap8_12.groups + cmap->c.cmap8_12.nGroups - 1;
+
+ if ( id )
+ *id = (UShort)( group->startGlyphID +
+ ( group->endCharCode - group->startCharCode ) );
+ return group->endCharCode;
+ }
+
+ default:
+ i = 65535;
+ do
+ {
+ c = TT_Char_Index( charMap, i );
+ if ( c > 0 )
+ {
+ if ( id )
+ *id = c;
+ return i;
+ }
+ i--;
+ } while ( i != 0 );
+
+ return -1;
+ }
+}
+
+
+static Long charmap_last4( PCMap4 cmap4,
+ UShort* id )
+{
+ UShort lastCode;
+
+
+ if ( cmap4->segCountX2 / 2 < 1 )
+ return -1;
+
+ lastCode = cmap4->segments[cmap4->segCountX2 / 2 - 1].endCount;
+
+ if ( id )
+ *id = charmap_find_id4( cmap4,
+ lastCode,
+ &(cmap4->segments[cmap4->segCountX2 / 2 - 1]),
+ 0 );
+
+ return lastCode;
+}
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxcmap.h b/Build/source/libs/freetype/lib/extend/ftxcmap.h
new file mode 100644
index 00000000000..d8ce5e0ed95
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxcmap.h
@@ -0,0 +1,60 @@
+/*******************************************************************
+ *
+ * ftxcmap.h 1.0
+ *
+ * API extension for iterating over Cmaps
+ *
+ * Copyright 1996-2001 by Juliusz Chroboczek,
+ * 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.
+ *
+ *
+ ******************************************************************/
+
+#ifndef FTXCMAP_H
+#define FTXCMAP_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Find the first entry of a Cmap. Its glyph index is returned */
+ /* in the "id" field, while the function returns the first valid */
+ /* character code in the Cmap. It returns -1 in case of failure. */
+
+ FT_EXPORT_DEF( TT_Long )
+ TT_CharMap_First( TT_CharMap charMap,
+ TT_UShort* id );
+
+
+ /* Find the next entry of Cmap. Same return conventions. */
+
+ FT_EXPORT_DEF( TT_Long )
+ TT_CharMap_Next( TT_CharMap charMap,
+ TT_ULong startId,
+ TT_UShort* id );
+
+ /* Find the last entry of a Cmap. Its glyph index is returned */
+ /* in the "id" field, while the function returns the last valid */
+ /* character code in the Cmap. It returns -1 in case of failure. */
+
+ FT_EXPORT_DEF( TT_Long )
+ TT_CharMap_Last( TT_CharMap charMap,
+ TT_UShort* id );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXCMAP_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxerr18.c b/Build/source/libs/freetype/lib/extend/ftxerr18.c
new file mode 100644
index 00000000000..8f874857559
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxerr18.c
@@ -0,0 +1,281 @@
+/****************************************************************************/
+/* */
+/* Erwin Dieterich, 15. 10. 1997 */
+/* - 15. 08. 1999 */
+/* */
+/* TT_ErrToString: translate error codes to character strings */
+/* */
+/* This extension provides internationalized error strings from the */
+/* various error messages. It uses the "gettext" package if available */
+/* or returns English/American message strings if not. */
+/* */
+/* If you do not want to use it, or if you encounter some problems */
+/* compiling this file, try to disable nls support when invoking */
+/* */
+/* ./configure --disable-nls (on Unix). */
+/* */
+/* */
+/****************************************************************************/
+
+#include "ftxerr18.h"
+#include "ftxkern.h"
+#include "ftxpost.h"
+#include "ftxopen.h"
+
+#include "ttconfig.h" /* will pull up "ft_conf.h" */
+
+#ifdef HAVE_LIBINTL_H
+
+#include <libintl.h>
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#undef _
+#define _( String ) dgettext( "freetype", String )
+
+#if 0
+char documentation[] = _(
+ "Welcome to the translation of the Freetype v.1 library!\n"
+ "\n"
+ "This message is not really part of the library (it is bracketed by\n"
+ " #if 0 / #endif), but is really intended to be the first one in the .po\n"
+ "file, and the first one that a new translator should see, to give hints.\n"
+ "\n"
+ "First, while this .po might seems big, the real interesting part of it\n"
+ "is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+ "messages are part of the demonstration programs, and are more intended\n"
+ "to help grasping how to use i18n with the Freetype library. So the real\n"
+ "work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+ "\n"
+ "A difficulty is that there are some specialized vocabulary, about\n"
+ "``faces'', ``glyph'' and similar things. These are typographical things,\n"
+ "and this should be researched before attempting to translate the whole\n"
+ "thing. A quick look across the TrueType documentation might help to\n"
+ "understand many things, too.\n"
+ "\n"
+ "Best wiches for your translation!\n"
+ "Antoine Leca - 2002-11-08" );
+#endif /* 0 */
+
+#else /* ! HAVE_LIBINTL_H */
+
+#define _( String ) ( String )
+
+#endif /* HAVE_LIBINTL_H */
+
+
+FT_EXPORT_FUNC( TT_String* )
+TT_ErrToString18( TT_Error error )
+{
+
+ switch ( error )
+ {
+ /* ----- high-level API error codes ----- */
+ case TT_Err_Ok:
+ return _( "Successful function call, no error." );
+
+ case TT_Err_Invalid_Face_Handle:
+ return _( "Invalid face handle." );
+ case TT_Err_Invalid_Instance_Handle:
+ return _( "Invalid instance handle." );
+ case TT_Err_Invalid_Glyph_Handle:
+ return _( "Invalid glyph handle." );
+ case TT_Err_Invalid_CharMap_Handle:
+ return _( "Invalid charmap handle." );
+ case TT_Err_Invalid_Result_Address:
+ return _( "Invalid result address." );
+ case TT_Err_Invalid_Glyph_Index:
+ return _( "Invalid glyph index." );
+ case TT_Err_Invalid_Argument:
+ return _( "Invalid argument." );
+ case TT_Err_Could_Not_Open_File:
+ return _( "Could not open file." );
+ case TT_Err_File_Is_Not_Collection:
+ return _( "File is not a TrueType collection." );
+ case TT_Err_Table_Missing:
+ return _( "Mandatory table missing." );
+ case TT_Err_Invalid_Horiz_Metrics:
+ return _( "Invalid horizontal metrics (hmtx table broken)." );
+ case TT_Err_Invalid_CharMap_Format:
+ return _( "Invalid charmap format." );
+ case TT_Err_Invalid_PPem:
+ return _( "Invalid ppem value." );
+ case TT_Err_Invalid_Vert_Metrics:
+ return _( "Invalid vertical metrics (vmtx table broken)." );
+
+ case TT_Err_Invalid_File_Format:
+ return _( "Invalid file format." );
+
+ case TT_Err_Invalid_Engine:
+ return _( "Invalid engine." );
+ case TT_Err_Too_Many_Extensions:
+ return _( "Too many extensions." );
+ case TT_Err_Extensions_Unsupported:
+ return _( "Extensions unsupported." );
+ case TT_Err_Invalid_Extension_Id:
+ return _( "Invalid extension id." );
+
+ case TT_Err_No_Vertical_Data:
+ return _( "No vertical data in font." );
+
+ case TT_Err_Max_Profile_Missing:
+ return _( "Maximum Profile (maxp) table missing." );
+ case TT_Err_Header_Table_Missing:
+ return _( "Font Header (head) table missing." );
+ case TT_Err_Horiz_Header_Missing:
+ return _( "Horizontal Header (hhea) table missing." );
+ case TT_Err_Locations_Missing:
+ return _( "Index to Location (loca) table missing." );
+ case TT_Err_Name_Table_Missing:
+ return _( "Naming (name) table missing." );
+ case TT_Err_CMap_Table_Missing:
+ return _( "Character to Glyph Index Mapping (cmap) tables missing." );
+ case TT_Err_Hmtx_Table_Missing:
+ return _( "Horizontal Metrics (hmtx) table missing." );
+ case TT_Err_OS2_Table_Missing:
+ return _( "OS/2 table missing." );
+ case TT_Err_Post_Table_Missing:
+ return _( "PostScript (post) table missing." );
+ case TT_Err_Glyf_Table_Missing:
+ return _( "Glyph (glyf) table missing." );
+
+
+ /* ----- memory component error codes ----- */
+ case TT_Err_Out_Of_Memory:
+ return _( "Out of memory." );
+
+
+ /* ----- file component error codes ----- */
+ case TT_Err_Invalid_File_Offset:
+ return _( "Invalid file offset." );
+ case TT_Err_Invalid_File_Read:
+ return _( "Invalid file read." );
+ case TT_Err_Invalid_Frame_Access:
+ return _( "Invalid frame access." );
+
+
+ /* ----- glyph loader error codes ----- */
+ case TT_Err_Too_Many_Points:
+ return _( "Too many points." );
+ case TT_Err_Too_Many_Contours:
+ return _( "Too many contours." );
+ case TT_Err_Invalid_Composite:
+ return _( "Invalid composite glyph." );
+ case TT_Err_Too_Many_Ins:
+ return _( "Too many instructions." );
+ case TT_Err_Too_Many_FDefs:
+ return _( "Too many function definitions (FDEF)." );
+
+
+ /* ----- byte-code interpreter error codes ----- */
+ case TT_Err_Invalid_Opcode:
+ return _( "Invalid opcode." );
+ case TT_Err_Too_Few_Arguments:
+ return _( "Too few arguments." );
+ case TT_Err_Stack_Overflow:
+ return _( "Stack overflow." );
+ case TT_Err_Code_Overflow:
+ return _( "Code overflow." );
+ case TT_Err_Bad_Argument:
+ return _( "Bad argument." );
+ case TT_Err_Divide_By_Zero:
+ return _( "Divide by zero." );
+ case TT_Err_Storage_Overflow:
+ return _( "Storage overflow." );
+ case TT_Err_Cvt_Overflow:
+ return _( "Control Value (cvt) table overflow." );
+ case TT_Err_Invalid_Reference:
+ return _( "Invalid reference." );
+ case TT_Err_Invalid_Distance:
+ return _( "Invalid distance." );
+ case TT_Err_Interpolate_Twilight:
+ return _( "Interpolate twilight points." );
+ case TT_Err_Debug_OpCode:
+ return _( "`DEBUG' opcode found." );
+ case TT_Err_ENDF_In_Exec_Stream:
+ return _( "`ENDF' in byte-code stream." );
+ case TT_Err_Out_Of_CodeRanges:
+ return _( "Out of code ranges." );
+ case TT_Err_Nested_DEFS:
+ return _( "Nested function definitions." );
+ case TT_Err_Invalid_CodeRange:
+ return _( "Invalid code range." );
+ case TT_Err_Invalid_Displacement:
+ return _( "Invalid displacement." );
+ case TT_Err_Execution_Too_Long:
+ return _( "Endless loop encountered while executing instructions." );
+
+
+ /* ----- internal failure error codes ----- */
+ case TT_Err_Nested_Frame_Access:
+ return _( "Nested frame access." );
+ case TT_Err_Invalid_Cache_List:
+ return _( "Invalid cache list." );
+ case TT_Err_Could_Not_Find_Context:
+ return _( "Could not find context." );
+ case TT_Err_Unlisted_Object:
+ return _( "Unlisted object." );
+
+
+ /* ----- scan-line converter error codes ----- */
+ case TT_Err_Raster_Pool_Overflow:
+ return _( "Raster pool overflow." );
+ case TT_Err_Raster_Negative_Height:
+ return _( "Raster: negative height encountered." );
+ case TT_Err_Raster_Invalid_Value:
+ return _( "Raster: invalid value." );
+ case TT_Err_Raster_Not_Initialized:
+ return _( "Raster not initialized." );
+
+
+ /* ----- engine extensions error codes ----- */
+ case TT_Err_Invalid_Kerning_Table_Format:
+ return _( "Invalid kerning (kern) table format." );
+ case TT_Err_Invalid_Kerning_Table:
+ return _( "Invalid kerning (kern) table." );
+
+ case TT_Err_Invalid_Post_Table_Format:
+ return _( "Invalid PostScript (post) table format." );
+ case TT_Err_Invalid_Post_Table:
+ return _( "Invalid PostScript (post) table." );
+
+
+ /* ----- TrueType Open extension error codes ----- */
+ case TTO_Err_Invalid_SubTable_Format:
+ return _( "Invalid TrueType Open subtable format." );
+ case TTO_Err_Invalid_SubTable:
+ return _( "Invalid TrueType Open subtable." );
+ case TTO_Err_Not_Covered:
+ return _( "Glyph(s) not covered by lookup." );
+ case TTO_Err_Too_Many_Nested_Contexts:
+ return _( "Too many nested context substitutions." );
+ case TTO_Err_No_MM_Interpreter:
+ return _( "No MM (Adobe MultipleMaster) interpreter available." );
+
+ case TTO_Err_Invalid_GSUB_SubTable_Format:
+ return _( "Invalid glyph substitution (GSUB) table format." );
+ case TTO_Err_Invalid_GSUB_SubTable:
+ return _( "Invalid glyph substitution (GSUB) table." );
+
+ case TTO_Err_Invalid_GPOS_SubTable_Format:
+ return _( "Invalid glyph positioning (GPOS) table format." );
+ case TTO_Err_Invalid_GPOS_SubTable:
+ return _( "Invalid glyph positioning (GPOS) table." );
+
+ case TTO_Err_Invalid_GDEF_SubTable_Format:
+ return _( "Invalid glyph definition (GDEF) table format." );
+ case TTO_Err_Invalid_GDEF_SubTable:
+ return _( "Invalid glyph definition (GDEF) table." );
+
+
+ default:
+ ;
+ }
+
+ return _( "Invalid Error Number." );
+}
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxerr18.h b/Build/source/libs/freetype/lib/extend/ftxerr18.h
new file mode 100644
index 00000000000..34e3d5e7636
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxerr18.h
@@ -0,0 +1,38 @@
+/****************************************************************************/
+/* */
+/* Erwin Dieterich, 15. 10. 1997 */
+/* - 15. 08. 1999 */
+/* */
+/* TT_ErrToString: translate error codes to character strings */
+/* */
+/* This extension provides internationalized error strings from the */
+/* various error messages. It uses the "gettext" package where available */
+/* or returns english/american message strings if not. */
+/* */
+/* If you do not want to use it, or if you encounter some problems */
+/* compiling this file, try to disable nls support by configuring */
+/* FreeType with ./configure --disable-nls */
+/* */
+/* */
+/****************************************************************************/
+
+#ifndef FTXERR18_H
+#define FTXERR18_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ FT_EXPORT_DEF( TT_String* )
+ TT_ErrToString18( TT_Error i );
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* FTXERR18_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgasp.c b/Build/source/libs/freetype/lib/extend/ftxgasp.c
new file mode 100644
index 00000000000..5d4b7acd67f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgasp.c
@@ -0,0 +1,69 @@
+/*******************************************************************
+ *
+ * ftxgasp.c 1.0
+ *
+ * Gasp table support API extension 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.
+ *
+ *
+ * The gasp table is currently loaded by the core engine, but the
+ * standard API doesn't give access to it. This file is used to
+ * demonstrate the use of a simple API extension.
+ *
+ ******************************************************************/
+
+#include "ftxgasp.h"
+
+#include "tttypes.h"
+#include "ttobjs.h"
+#include "tttables.h"
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Face_Gasp_Flags( TT_Face face,
+ TT_UShort point_size,
+ TT_Bool* grid_fit,
+ TT_Bool* smooth_font )
+ {
+ PFace faze = HANDLE_Face( face );
+ UShort i, flag;
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( faze->gasp.numRanges == 0 || !faze->gasp.gaspRanges )
+ return TT_Err_Table_Missing;
+
+ for ( i = 0; i < faze->gasp.numRanges; i++ )
+ {
+ if ( point_size <= faze->gasp.gaspRanges[i].maxPPEM )
+ {
+ flag = faze->gasp.gaspRanges[i].gaspFlag;
+
+ *grid_fit = ( (flag & GASP_GRIDFIT) != 0 );
+ *smooth_font = ( (flag & GASP_DOGRAY ) != 0 );
+
+ return TT_Err_Ok;
+ }
+ }
+
+ /* for very large fonts we enable font smoothing and discard */
+ /* grid fitting */
+
+ *grid_fit = 0;
+ *smooth_font = 1;
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgasp.h b/Build/source/libs/freetype/lib/extend/ftxgasp.h
new file mode 100644
index 00000000000..36b92521fbc
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgasp.h
@@ -0,0 +1,53 @@
+/*******************************************************************
+ *
+ * ftxgasp.h 1.0
+ *
+ * Gasp table support API extension
+ *
+ * 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.
+ *
+ *
+ * The gasp table is currently loaded by the core engine, but the
+ * standard API doesn't give access to it. This file is used to
+ * demonstrate the use of a simple API extension.
+ *
+ ******************************************************************/
+
+#ifndef FTXGASP_H
+#define FTXGASP_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /* This function returns for a given 'point_size' the values of the */
+ /* gasp flags 'grid_fit' and 'smooth_font'. The returned values */
+ /* are booleans (where 0 = NO, and 1 = YES). */
+
+ /* Note that this function will return TT_Err_Table_Missing if */
+ /* the font file doesn't contain any gasp table. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Face_Gasp_Flags( TT_Face face,
+ TT_UShort point_size,
+ TT_Bool* grid_fit,
+ TT_Bool* smooth_font );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXGASP_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgdef.c b/Build/source/libs/freetype/lib/extend/ftxgdef.c
new file mode 100644
index 00000000000..1dcff28a5fb
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgdef.c
@@ -0,0 +1,1126 @@
+/*******************************************************************
+ *
+ * ftxgdef.c
+ *
+ * TrueType Open GDEF table support.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include "tttypes.h"
+#include "tttags.h"
+#include "ttload.h"
+#include "ttextend.h"
+#include "ttmemory.h"
+#include "ttfile.h"
+
+#include "ftxopen.h"
+#include "ftxopenf.h"
+
+
+ static TT_Error Load_AttachList( TTO_AttachList* al,
+ PFace input );
+ static TT_Error Load_LigCaretList( TTO_LigCaretList* lcl,
+ PFace input );
+
+ static void Free_AttachList( TTO_AttachList* al );
+ static void Free_LigCaretList( TTO_LigCaretList* lcl );
+
+ static void Free_NewGlyphClasses( TTO_GDEFHeader* gdef );
+
+
+
+ /**********************
+ * Extension Functions
+ **********************/
+
+
+ static TT_Error GDEF_Create( void* ext,
+ PFace face )
+ {
+ DEFINE_LOAD_LOCALS( face->stream );
+
+ TTO_GDEFHeader* gdef = (TTO_GDEFHeader*)ext;
+ Long table;
+
+
+ /* by convention */
+
+ if ( !gdef )
+ return TT_Err_Ok;
+
+ /* a null offset indicates that there is no GDEF table */
+
+ gdef->offset = 0;
+
+ /* we store the start offset and the size of the subtable */
+
+ table = TT_LookUp_Table( face, TTAG_GDEF );
+ if ( table < 0 )
+ return TT_Err_Ok; /* The table is optional */
+
+ if ( FILE_Seek( face->dirTables[table].Offset ) ||
+ ACCESS_Frame( 4L ) )
+ return error;
+
+ gdef->offset = FILE_Pos() - 4L; /* undo ACCESS_Frame() */
+ gdef->Version = GET_ULong();
+
+ FORGET_Frame();
+
+ gdef->loaded = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error GDEF_Destroy( void* ext,
+ PFace face )
+ {
+ TTO_GDEFHeader* gdef = (TTO_GDEFHeader*)ext;
+
+
+ /* by convention */
+
+ if ( !gdef )
+ return TT_Err_Ok;
+
+ if ( gdef->loaded )
+ {
+ Free_LigCaretList( &gdef->LigCaretList );
+ Free_AttachList( &gdef->AttachList );
+ Free_ClassDefinition( &gdef->GlyphClassDef );
+ Free_ClassDefinition( &gdef->MarkAttachClassDef );
+
+ Free_NewGlyphClasses( gdef );
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_GDEF_Extension( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ return TT_Register_Extension( _engine,
+ GDEF_ID,
+ sizeof ( TTO_GDEFHeader ),
+ GDEF_Create,
+ GDEF_Destroy );
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_GDEF_Table( TT_Face face,
+ TTO_GDEFHeader* retptr )
+ {
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_GDEFHeader* gdef;
+
+ PFace faze = HANDLE_Face( face );
+ DEFINE_ALL_LOCALS;
+
+
+ if ( !retptr )
+ return TT_Err_Invalid_Argument;
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ error = TT_Extension_Get( faze, GDEF_ID, (void**)&gdef );
+ if ( error )
+ return error;
+
+ if ( gdef->offset == 0 )
+ return TT_Err_Table_Missing; /* no GDEF table; nothing to do */
+
+ /* now access stream */
+
+ if ( USE_Stream( faze->stream, stream ) )
+ return error;
+
+ base_offset = gdef->offset;
+
+ /* skip version */
+
+ if ( FILE_Seek( base_offset + 4L ) ||
+ ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ /* all GDEF subtables are optional */
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ /* only classes 1-4 are allowed here */
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ClassDefinition( &gdef->GlyphClassDef, 5,
+ faze ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ gdef->GlyphClassDef.loaded = FALSE;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_AttachList( &gdef->AttachList,
+ faze ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ gdef->AttachList.loaded = FALSE;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LigCaretList( &gdef->LigCaretList,
+ faze ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ gdef->LigCaretList.loaded = FALSE;
+
+ /* OpenType 1.2 has introduced the `MarkAttachClassDef' field. We
+ first have to scan the LookupFlag values to find out whether we
+ must load it or not. Here we only store the current file offset. */
+
+ gdef->MarkAttachClassDef_offset = FILE_Pos();
+ gdef->MarkAttachClassDef.loaded = FALSE;
+
+ gdef->LastGlyph = 0;
+ gdef->NewGlyphClasses = NULL;
+ gdef->loaded = TRUE;
+
+ *retptr = *gdef;
+ DONE_Stream( stream );
+
+ return TT_Err_Ok;
+
+ Fail2:
+ Free_AttachList( &gdef->AttachList );
+
+ Fail1:
+ Free_ClassDefinition( &gdef->GlyphClassDef );
+
+ /* release stream */
+
+ DONE_Stream( stream );
+
+ return error;
+ }
+
+
+
+ /*******************************
+ * AttachList related functions
+ *******************************/
+
+
+ /* AttachPoint */
+
+ static TT_Error Load_AttachPoint( TTO_AttachPoint* ap,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* pi;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ap->PointCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ap->PointIndex = NULL;
+
+ if ( count )
+ {
+ if ( ALLOC_ARRAY( ap->PointIndex, count, UShort ) )
+ return error;
+
+ pi = ap->PointIndex;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( pi );
+ return error;
+ }
+
+ for ( n = 0; n < count; n++ )
+ pi[n] = GET_UShort();
+
+ FORGET_Frame();
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_AttachPoint( TTO_AttachPoint* ap )
+ {
+ FREE( ap->PointIndex );
+ }
+
+
+ /* AttachList */
+
+ static TT_Error Load_AttachList( TTO_AttachList* al,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_AttachPoint* ap;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &al->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = al->GlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ al->AttachPoint = NULL;
+
+ if ( ALLOC_ARRAY( al->AttachPoint, count, TTO_AttachPoint ) )
+ goto Fail2;
+
+ ap = al->AttachPoint;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_AttachPoint( &ap[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ al->loaded = TRUE;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_AttachPoint( &ap[n] );
+
+ FREE( ap );
+
+ Fail2:
+ Free_Coverage( &al->Coverage );
+ return error;
+ }
+
+
+ static void Free_AttachList( TTO_AttachList* al )
+ {
+ UShort n, count;
+
+ TTO_AttachPoint* ap;
+
+
+ if ( !al->loaded )
+ return;
+
+ if ( al->AttachPoint )
+ {
+ count = al->GlyphCount;
+ ap = al->AttachPoint;
+
+ for ( n = 0; n < count; n++ )
+ Free_AttachPoint( &ap[n] );
+
+ FREE( ap );
+ }
+
+ Free_Coverage( &al->Coverage );
+ }
+
+
+
+ /*********************************
+ * LigCaretList related functions
+ *********************************/
+
+
+ /* CaretValueFormat1 */
+ /* CaretValueFormat2 */
+ /* CaretValueFormat3 */
+ /* CaretValueFormat4 */
+
+ static TT_Error Load_CaretValue( TTO_CaretValue* cv,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ ULong cur_offset, new_offset, base_offset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cv->CaretValueFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( cv->CaretValueFormat )
+ {
+ case 1:
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cv->cvf.cvf1.Coordinate = GET_Short();
+
+ FORGET_Frame();
+
+ break;
+
+ case 2:
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cv->cvf.cvf2.CaretValuePoint = GET_UShort();
+
+ FORGET_Frame();
+
+ break;
+
+ case 3:
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ cv->cvf.cvf3.Coordinate = GET_Short();
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &cv->cvf.cvf3.Device,
+ input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ break;
+
+ case 4:
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cv->cvf.cvf4.IdCaretValue = GET_UShort();
+
+ FORGET_Frame();
+ break;
+
+ default:
+ return TTO_Err_Invalid_GDEF_SubTable_Format;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_CaretValue( TTO_CaretValue* cv )
+ {
+ if ( cv->CaretValueFormat == 3 )
+ Free_Device( &cv->cvf.cvf3.Device );
+ }
+
+
+ /* LigGlyph */
+
+ static TT_Error Load_LigGlyph( TTO_LigGlyph* lg,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_CaretValue* cv;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = lg->CaretCount = GET_UShort();
+
+ FORGET_Frame();
+
+ lg->CaretValue = NULL;
+
+ if ( ALLOC_ARRAY( lg->CaretValue, count, TTO_CaretValue ) )
+ return error;
+
+ cv = lg->CaretValue;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_CaretValue( &cv[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_CaretValue( &cv[n] );
+
+ FREE( cv );
+ return error;
+ }
+
+
+ static void Free_LigGlyph( TTO_LigGlyph* lg )
+ {
+ UShort n, count;
+
+ TTO_CaretValue* cv;
+
+
+ if ( lg->CaretValue )
+ {
+ count = lg->CaretCount;
+ cv = lg->CaretValue;
+
+ for ( n = 0; n < count; n++ )
+ Free_CaretValue( &cv[n] );
+
+ FREE( cv );
+ }
+ }
+
+
+ /* LigCaretList */
+
+ static TT_Error Load_LigCaretList( TTO_LigCaretList* lcl,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_LigGlyph* lg;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &lcl->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = lcl->LigGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ lcl->LigGlyph = NULL;
+
+ if ( ALLOC_ARRAY( lcl->LigGlyph, count, TTO_LigGlyph ) )
+ goto Fail2;
+
+ lg = lcl->LigGlyph;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LigGlyph( &lg[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ lcl->loaded = TRUE;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_LigGlyph( &lg[n] );
+
+ FREE( lg );
+
+ Fail2:
+ Free_Coverage( &lcl->Coverage );
+ return error;
+ }
+
+
+ static void Free_LigCaretList( TTO_LigCaretList* lcl )
+ {
+ UShort n, count;
+
+ TTO_LigGlyph* lg;
+
+
+ if ( !lcl->loaded )
+ return;
+
+ if ( lcl->LigGlyph )
+ {
+ count = lcl->LigGlyphCount;
+ lg = lcl->LigGlyph;
+
+ for ( n = 0; n < count; n++ )
+ Free_LigGlyph( &lg[n] );
+
+ FREE( lg );
+ }
+
+ Free_Coverage( &lcl->Coverage );
+ }
+
+
+
+ /***********
+ * GDEF API
+ ***********/
+
+
+ static UShort Get_New_Class( TTO_GDEFHeader* gdef,
+ UShort glyphID,
+ UShort index )
+ {
+ UShort glyph_index, array_index;
+ UShort byte, bits;
+
+ TTO_ClassRangeRecord* gcrr;
+ UShort** ngc;
+
+
+ if ( glyphID >= gdef->LastGlyph )
+ return 0;
+
+ gcrr = gdef->GlyphClassDef.cd.cd2.ClassRangeRecord;
+ ngc = gdef->NewGlyphClasses;
+
+ if ( glyphID < gcrr[index].Start )
+ {
+ array_index = 0;
+ if ( index == 0 )
+ glyph_index = glyphID;
+ else
+ glyph_index = glyphID - gcrr[index - 1].End - 1;
+ }
+ else
+ {
+ array_index = index + 1;
+ glyph_index = glyphID - gcrr[index].End - 1;
+ }
+
+ byte = ngc[array_index][glyph_index / 4 + 1];
+ bits = byte >> ( 16 - ( glyph_index % 4 + 1 ) * 4 );
+
+ return bits & 0x000F;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef,
+ TT_UShort glyphID,
+ TT_UShort* property )
+ {
+ UShort class, index;
+
+ TT_Error error;
+
+
+ if ( !gdef || !property )
+ return TT_Err_Invalid_Argument;
+
+ /* first, we check for mark attach classes */
+
+ if ( gdef->MarkAttachClassDef.loaded )
+ {
+ error = Get_Class( &gdef->MarkAttachClassDef, glyphID, &class, &index );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ if ( !error )
+ {
+ *property = class << 8;
+ return TT_Err_Ok;
+ }
+ }
+
+ error = Get_Class( &gdef->GlyphClassDef, glyphID, &class, &index );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ /* if we have a constructed class table, check whether additional
+ values have been assigned */
+
+ if ( error == TTO_Err_Not_Covered && gdef->NewGlyphClasses )
+ class = Get_New_Class( gdef, glyphID, index );
+
+ switch ( class )
+ {
+ case UNCLASSIFIED_GLYPH:
+ *property = 0;
+ break;
+
+ case SIMPLE_GLYPH:
+ *property = TTO_BASE_GLYPH;
+ break;
+
+ case LIGATURE_GLYPH:
+ *property = TTO_LIGATURE;
+ break;
+
+ case MARK_GLYPH:
+ *property = TTO_MARK;
+ break;
+
+ case COMPONENT_GLYPH:
+ *property = TTO_COMPONENT;
+ break;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error Make_ClassRange( TTO_ClassDefinition* cd,
+ UShort start,
+ UShort end,
+ UShort class )
+ {
+ TT_Error error;
+ UShort index;
+
+ TTO_ClassDefFormat2* cdf2;
+ TTO_ClassRangeRecord* crr;
+
+
+ cdf2 = &cd->cd.cd2;
+
+ cdf2->ClassRangeCount++;
+
+ if ( REALLOC_ARRAY( cdf2->ClassRangeRecord, cdf2->ClassRangeCount,
+ TTO_ClassRangeRecord ) )
+ return error;
+
+ crr = cdf2->ClassRangeRecord;
+ index = cdf2->ClassRangeCount - 1;
+
+ crr[index].Start = start;
+ crr[index].End = end;
+ crr[index].Class = class;
+
+ cd->Defined[class] = TRUE;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef,
+ TT_UShort num_glyphs,
+ TT_UShort glyph_count,
+ TT_UShort* glyph_array,
+ TT_UShort* class_array )
+ {
+ UShort start, curr_glyph, curr_class;
+ UShort n, count;
+ TT_Error error;
+
+ TTO_ClassDefinition* gcd;
+ TTO_ClassRangeRecord* gcrr;
+ UShort** ngc;
+
+
+ if ( !gdef || !glyph_array || !class_array )
+ return TT_Err_Invalid_Argument;
+
+ gcd = &gdef->GlyphClassDef;
+
+ /* We build a format 2 table */
+
+ gcd->ClassFormat = 2;
+
+ /* A GlyphClassDef table contains at most 5 different class values */
+
+ if ( ALLOC_ARRAY( gcd->Defined, 5, Bool ) )
+ return error;
+
+ gcd->cd.cd2.ClassRangeCount = 0;
+ gcd->cd.cd2.ClassRangeRecord = NULL;
+
+ start = glyph_array[0];
+ curr_class = class_array[0];
+ curr_glyph = start;
+
+ if ( curr_class >= 5 )
+ {
+ error = TT_Err_Invalid_Argument;
+ goto Fail4;
+ }
+
+ glyph_count--;
+
+ for ( n = 0; n <= glyph_count; n++ )
+ {
+ if ( curr_glyph == glyph_array[n] && curr_class == class_array[n] )
+ {
+ if ( n == glyph_count )
+ {
+ if ( ( error = Make_ClassRange( gcd, start,
+ curr_glyph,
+ curr_class ) ) != TT_Err_Ok )
+ goto Fail3;
+ }
+ else
+ {
+ if ( curr_glyph == 0xFFFF )
+ {
+ error = TT_Err_Invalid_Argument;
+ goto Fail3;
+ }
+ else
+ curr_glyph++;
+ }
+ }
+ else
+ {
+ if ( ( error = Make_ClassRange( gcd, start,
+ curr_glyph - 1,
+ curr_class ) ) != TT_Err_Ok )
+ goto Fail3;
+
+ if ( curr_glyph > glyph_array[n] )
+ {
+ error = TT_Err_Invalid_Argument;
+ goto Fail3;
+ }
+
+ start = glyph_array[n];
+ curr_class = class_array[n];
+ curr_glyph = start;
+
+ if ( curr_class >= 5 )
+ {
+ error = TT_Err_Invalid_Argument;
+ goto Fail3;
+ }
+
+ if ( n == glyph_count )
+ {
+ if ( ( error = Make_ClassRange( gcd, start,
+ curr_glyph,
+ curr_class ) ) != TT_Err_Ok )
+ goto Fail3;
+ }
+ else
+ {
+ if ( curr_glyph == 0xFFFF )
+ {
+ error = TT_Err_Invalid_Argument;
+ goto Fail3;
+ }
+ else
+ curr_glyph++;
+ }
+ }
+ }
+
+ /* now prepare the arrays for class values assigned during the lookup
+ process */
+
+ if ( ALLOC_ARRAY( gdef->NewGlyphClasses,
+ gcd->cd.cd2.ClassRangeCount + 1, UShort* ) )
+ goto Fail2;
+
+ count = gcd->cd.cd2.ClassRangeCount;
+ gcrr = gcd->cd.cd2.ClassRangeRecord;
+ ngc = gdef->NewGlyphClasses;
+
+ /* We allocate arrays for all glyphs not covered by the class range
+ records. Each element holds four class values. */
+
+ if ( gcrr[0].Start )
+ {
+ if ( ALLOC_ARRAY( ngc[0], gcrr[0].Start / 4 + 1, UShort ) )
+ goto Fail1;
+ }
+
+ for ( n = 1; n < count; n++ )
+ {
+ if ( gcrr[n].Start - gcrr[n - 1].End > 1 )
+ if ( ALLOC_ARRAY( ngc[n],
+ ( gcrr[n].Start - gcrr[n - 1].End - 1 ) / 4 + 1,
+ UShort ) )
+ goto Fail1;
+ }
+
+ if ( gcrr[count - 1].End != num_glyphs - 1 )
+ {
+ if ( ALLOC_ARRAY( ngc[count],
+ ( num_glyphs - gcrr[count - 1].End - 1 ) / 4 + 1,
+ UShort ) )
+ goto Fail1;
+ }
+
+ gdef->LastGlyph = num_glyphs - 1;
+
+ gdef->MarkAttachClassDef_offset = 0L;
+ gdef->MarkAttachClassDef.loaded = FALSE;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ FREE( ngc[n] );
+
+ Fail2:
+ FREE( gdef->NewGlyphClasses );
+
+ Fail3:
+ FREE( gcd->cd.cd2.ClassRangeRecord );
+
+ Fail4:
+ FREE( gcd->Defined );
+ return error;
+ }
+
+
+ static void Free_NewGlyphClasses( TTO_GDEFHeader* gdef )
+ {
+ UShort** ngc;
+ UShort n, count;
+
+
+ if ( gdef->NewGlyphClasses )
+ {
+ count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount + 1;
+ ngc = gdef->NewGlyphClasses;
+
+ for ( n = 0; n < count; n++ )
+ FREE( ngc[n] );
+
+ FREE( ngc );
+ }
+ }
+
+
+ TT_Error Add_Glyph_Property( TTO_GDEFHeader* gdef,
+ UShort glyphID,
+ UShort property )
+ {
+ TT_Error error;
+ UShort class, new_class, index;
+ UShort byte, bits, mask;
+ UShort array_index, glyph_index;
+
+ TTO_ClassRangeRecord* gcrr;
+ UShort** ngc;
+
+
+ error = Get_Class( &gdef->GlyphClassDef, glyphID, &class, &index );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ /* we don't accept glyphs covered in `GlyphClassDef' */
+
+ if ( !error )
+ return TTO_Err_Not_Covered;
+
+ switch ( property )
+ {
+ case 0:
+ new_class = UNCLASSIFIED_GLYPH;
+ break;
+
+ case TTO_BASE_GLYPH:
+ new_class = SIMPLE_GLYPH;
+ break;
+
+ case TTO_LIGATURE:
+ new_class = LIGATURE_GLYPH;
+ break;
+
+ case TTO_MARK:
+ new_class = MARK_GLYPH;
+ break;
+
+ case TTO_COMPONENT:
+ new_class = COMPONENT_GLYPH;
+ break;
+
+ default:
+ return TT_Err_Invalid_Argument;
+ }
+
+ gcrr = gdef->GlyphClassDef.cd.cd2.ClassRangeRecord;
+ ngc = gdef->NewGlyphClasses;
+
+ if ( glyphID < gcrr[index].Start )
+ {
+ array_index = 0;
+ if ( index == 0 )
+ glyph_index = glyphID;
+ else
+ glyph_index = glyphID - gcrr[index - 1].End - 1;
+ }
+ else
+ {
+ array_index = index + 1;
+ glyph_index = glyphID - gcrr[index].End - 1;
+ }
+
+ byte = ngc[array_index][glyph_index / 4 + 1];
+ bits = byte >> ( 16 - ( glyph_index % 4 + 1 ) * 4 );
+ class = bits & 0x000F;
+
+ /* we don't overwrite existing entries */
+
+ if ( !class )
+ {
+ bits = new_class << ( 16 - ( glyph_index % 4 + 1 ) * 4 );
+ mask = ~( 0x000F << ( 16 - ( glyph_index % 4 + 1 ) * 4 ) );
+
+ ngc[array_index][glyph_index / 4 + 1] &= mask;
+ ngc[array_index][glyph_index / 4 + 1] |= bits;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ TT_Error Check_Property( TTO_GDEFHeader* gdef,
+ UShort index,
+ UShort flags,
+ UShort* property )
+ {
+ TT_Error error;
+
+
+ if ( gdef )
+ {
+ error = TT_GDEF_Get_Glyph_Property( gdef, index, property );
+ if ( error )
+ return error;
+
+ if ( flags & IGNORE_SPECIAL_MARKS )
+ {
+ /* This is OpenType 1.2 */
+
+ if ( (flags & 0xFF00) != *property )
+ return TTO_Err_Not_Covered;
+ }
+ else {
+ if ( flags & *property )
+ return TTO_Err_Not_Covered;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgdef.h b/Build/source/libs/freetype/lib/extend/ftxgdef.h
new file mode 100644
index 00000000000..927d0a1bdbe
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgdef.h
@@ -0,0 +1,218 @@
+/*******************************************************************
+ *
+ * ftxgdef.h
+ *
+ * TrueType Open GDEF table support
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef FTXOPEN_H
+#error "Don't include this file! Use ftxopen.h instead."
+#endif
+
+#ifndef FTXGDEF_H
+#define FTXGDEF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TTO_Err_Invalid_GDEF_SubTable_Format 0x1030
+#define TTO_Err_Invalid_GDEF_SubTable 0x1031
+
+#define GDEF_ID Build_Extension_ID( 'G', 'D', 'E', 'F' )
+
+
+/* GDEF glyph classes */
+
+#define UNCLASSIFIED_GLYPH 0
+#define SIMPLE_GLYPH 1
+#define LIGATURE_GLYPH 2
+#define MARK_GLYPH 3
+#define COMPONENT_GLYPH 4
+
+/* GDEF glyph properties, corresponding to class values 1-4. Note that
+ TTO_COMPONENT has no corresponding flag in the LookupFlag field. */
+
+#define TTO_BASE_GLYPH 0x0002
+#define TTO_LIGATURE 0x0004
+#define TTO_MARK 0x0008
+#define TTO_COMPONENT 0x0010
+
+
+ /* Attachment related structures */
+
+ struct TTO_AttachPoint_
+ {
+ TT_UShort PointCount; /* size of the PointIndex array */
+ TT_UShort* PointIndex; /* array of contour points */
+ };
+
+ typedef struct TTO_AttachPoint_ TTO_AttachPoint;
+
+
+ struct TTO_AttachList_
+ {
+ TT_Bool loaded;
+
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort GlyphCount; /* number of glyphs with
+ attachments */
+ TTO_AttachPoint* AttachPoint; /* array of AttachPoint tables */
+ };
+
+ typedef struct TTO_AttachList_ TTO_AttachList;
+
+
+ /* Ligature Caret related structures */
+
+ struct TTO_CaretValueFormat1_
+ {
+ TT_Short Coordinate; /* x or y value (in design units) */
+ };
+
+ typedef struct TTO_CaretValueFormat1_ TTO_CaretValueFormat1;
+
+
+ struct TTO_CaretValueFormat2_
+ {
+ TT_UShort CaretValuePoint; /* contour point index on glyph */
+ };
+
+ typedef struct TTO_CaretValueFormat2_ TTO_CaretValueFormat2;
+
+
+ struct TTO_CaretValueFormat3_
+ {
+ TT_Short Coordinate; /* x or y value (in design units) */
+ TTO_Device Device; /* Device table for x or y value */
+ };
+
+ typedef struct TTO_CaretValueFormat3_ TTO_CaretValueFormat3;
+
+
+ struct TTO_CaretValueFormat4_
+ {
+ TT_UShort IdCaretValue; /* metric ID */
+ };
+
+ typedef struct TTO_CaretValueFormat4_ TTO_CaretValueFormat4;
+
+
+ struct TTO_CaretValue_
+ {
+ TT_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
+
+ union
+ {
+ TTO_CaretValueFormat1 cvf1;
+ TTO_CaretValueFormat2 cvf2;
+ TTO_CaretValueFormat3 cvf3;
+ TTO_CaretValueFormat4 cvf4;
+ } cvf;
+ };
+
+ typedef struct TTO_CaretValue_ TTO_CaretValue;
+
+
+ struct TTO_LigGlyph_
+ {
+ TT_Bool loaded;
+
+ TT_UShort CaretCount; /* number of caret values */
+ TTO_CaretValue* CaretValue; /* array of caret values */
+ };
+
+ typedef struct TTO_LigGlyph_ TTO_LigGlyph;
+
+
+ struct TTO_LigCaretList_
+ {
+ TT_Bool loaded;
+
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort LigGlyphCount; /* number of ligature glyphs */
+ TTO_LigGlyph* LigGlyph; /* array of LigGlyph tables */
+ };
+
+ typedef struct TTO_LigCaretList_ TTO_LigCaretList;
+
+
+ /* The `NewGlyphClasses' field is not defined in the TTO specification.
+ We use it for fonts with a constructed `GlyphClassDef' structure
+ (i.e., which don't have a GDEF table) to collect glyph classes
+ assigned during the lookup process. The number of arrays in this
+ pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
+ array then contains the glyph class values of the glyphs not covered
+ by the ClassRangeRecords structures with index n-1 and n. We store
+ glyph class values for four glyphs in a single array element.
+
+ `LastGlyph' is identical to the number of glyphs minus one in the
+ font; we need it only if `NewGlyphClasses' is not NULL (to have an
+ upper bound for the last array).
+
+ Note that we first store the file offset to the `MarkAttachClassDef'
+ field (which has been introduced in OpenType 1.2) -- since the
+ `Version' field value hasn't been increased to indicate that we have
+ one more field for some obscure reason, we must parse the GSUB table
+ to find out whether class values refer to this table. Only then we
+ can finally load the MarkAttachClassDef structure if necessary. */
+
+ struct TTO_GDEFHeader_
+ {
+ TT_Bool loaded;
+ TT_ULong offset;
+
+ TT_Fixed Version;
+
+ TTO_ClassDefinition GlyphClassDef;
+ TTO_AttachList AttachList;
+ TTO_LigCaretList LigCaretList;
+ TT_ULong MarkAttachClassDef_offset;
+ TTO_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
+
+ TT_UShort LastGlyph;
+ TT_UShort** NewGlyphClasses;
+ };
+
+ typedef struct TTO_GDEFHeader_ TTO_GDEFHeader;
+
+
+ /* finally, the GDEF API */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_GDEF_Extension( TT_Engine engine );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_GDEF_Table( TT_Face face,
+ TTO_GDEFHeader* gdef );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef,
+ TT_UShort glyphID,
+ TT_UShort* property );
+ FT_EXPORT_DEF( TT_Error )
+ TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef,
+ TT_UShort num_glyphs,
+ TT_UShort glyph_count,
+ TT_UShort* glyph_array,
+ TT_UShort* class_array );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXGDEF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgpos.c b/Build/source/libs/freetype/lib/extend/ftxgpos.c
new file mode 100644
index 00000000000..534fda0f4ae
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgpos.c
@@ -0,0 +1,6224 @@
+/*******************************************************************
+ *
+ * ftxgpos.c
+ *
+ * TrueType Open GPOS table support.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+/* XXX There is *a lot* of duplicated code (cf. formats 7 and 8), but
+ I don't care currently. I believe that it would be possible to
+ save about 50% of TTO code by carefully designing the structures,
+ sharing as much as possible with extensive use of macros. This
+ is something for a volunteer :-) */
+
+#include "tttypes.h"
+#include "tttags.h"
+#include "ttload.h"
+#include "ttextend.h"
+#include "ttmemory.h"
+#include "ttfile.h"
+
+#include "ftxopen.h"
+#include "ftxopenf.h"
+
+
+ struct GPOS_Instance_
+ {
+ TTO_GPOSHeader* gpos;
+ TT_Instance instance;
+ TT_Glyph glyph;
+ UShort load_flags; /* how the glyph should be loaded */
+ TT_Bool r2l;
+
+ UShort first; /* the first glyph in a chain of
+ cursive connections */
+ UShort last; /* the last valid glyph -- used
+ with cursive positioning */
+ TT_Pos anchor_x; /* the coordinates of the anchor point */
+ TT_Pos anchor_y; /* of the last valid glyph */
+ };
+
+ typedef struct GPOS_Instance_ GPOS_Instance;
+
+
+ static TT_Error Do_Glyph_Lookup( GPOS_Instance* gpi,
+ UShort lookup_index,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort context_length,
+ int nesting_level );
+
+
+
+ /**********************
+ * Extension Functions
+ **********************/
+
+ /* the client application must replace this with something more
+ meaningful if multiple master fonts are to be supported. */
+
+ static TT_Error default_mmfunc( TT_Instance instance,
+ TT_UShort metric_id,
+ TT_Pos* metric_value,
+ void* data )
+ {
+ return TTO_Err_No_MM_Interpreter;
+ }
+
+
+ static TT_Error GPOS_Create( void* ext,
+ PFace face )
+ {
+ DEFINE_LOAD_LOCALS( face->stream );
+
+ TTO_GPOSHeader* gpos = (TTO_GPOSHeader*)ext;
+ Long table;
+
+
+ /* by convention */
+
+ if ( !gpos )
+ return TT_Err_Ok;
+
+ /* a null offset indicates that there is no GPOS table */
+
+ gpos->offset = 0;
+
+ /* we store the start offset and the size of the subtable */
+
+ table = TT_LookUp_Table( face, TTAG_GPOS );
+ if ( table < 0 )
+ return TT_Err_Ok; /* The table is optional */
+
+ if ( FILE_Seek( face->dirTables[table].Offset ) ||
+ ACCESS_Frame( 4L ) )
+ return error;
+
+ gpos->offset = FILE_Pos() - 4L; /* undo ACCESS_Frame() */
+ gpos->Version = GET_ULong();
+
+ FORGET_Frame();
+
+ /* a default mmfunc() handler which just returns an error */
+
+ gpos->mmfunc = default_mmfunc;
+
+ /* the default glyph function is TT_Load_Glyph() */
+
+ gpos->gfunc = TT_Load_Glyph;
+
+ gpos->loaded = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error GPOS_Destroy( void* ext,
+ PFace face )
+ {
+ TTO_GPOSHeader* gpos = (TTO_GPOSHeader*)ext;
+
+
+ /* by convention */
+
+ if ( !gpos )
+ return TT_Err_Ok;
+
+ if ( gpos->loaded )
+ {
+ Free_LookupList( &gpos->LookupList, GPOS );
+ Free_FeatureList( &gpos->FeatureList );
+ Free_ScriptList( &gpos->ScriptList );
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_GPOS_Extension( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ return TT_Register_Extension( _engine,
+ GPOS_ID,
+ sizeof ( TTO_GPOSHeader ),
+ GPOS_Create,
+ GPOS_Destroy );
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_GPOS_Table( TT_Face face,
+ TTO_GPOSHeader* retptr,
+ TTO_GDEFHeader* gdef )
+ {
+ ULong cur_offset, new_offset, base_offset;
+
+ UShort i, num_lookups;
+ TTO_GPOSHeader* gpos;
+ TTO_GDEFHeader* gdef_reg;
+ TTO_Lookup* lo;
+
+ PFace faze = HANDLE_Face( face );
+ DEFINE_ALL_LOCALS;
+
+
+ if ( !retptr )
+ return TT_Err_Invalid_Argument;
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ error = TT_Extension_Get( faze, GPOS_ID, (void**)&gpos );
+ if ( error )
+ return error;
+
+ if ( gpos->offset == 0 )
+ return TT_Err_Table_Missing; /* no GPOS table; nothing to do */
+
+ /* now access stream */
+
+ if ( USE_Stream( faze->stream, stream ) )
+ return error;
+
+ base_offset = gpos->offset;
+
+ /* skip version */
+
+ if ( FILE_Seek( base_offset + 4L ) ||
+ ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ScriptList( &gpos->ScriptList,
+ faze ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_FeatureList( &gpos->FeatureList,
+ faze ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LookupList( &gpos->LookupList,
+ faze, GPOS ) ) != TT_Err_Ok )
+ goto Fail2;
+
+ gpos->gdef = gdef; /* can be NULL */
+
+ /* We now check the LookupFlags for values larger than 0xFF to find
+ out whether we need to load the `MarkAttachClassDef' field of the
+ GDEF table -- this hack is necessary for OpenType 1.2 tables since
+ the version field of the GDEF table hasn't been incremented.
+
+ For constructed GDEF tables, we only load it if
+ `MarkAttachClassDef_offset' is not zero (nevertheless, a build of
+ a constructed mark attach table is not supported currently). */
+
+ if ( gdef &&
+ gdef->MarkAttachClassDef_offset && !gdef->MarkAttachClassDef.loaded )
+ {
+ lo = gpos->LookupList.Lookup;
+ num_lookups = gpos->LookupList.LookupCount;
+
+ for ( i = 0; i < num_lookups; i++ )
+ {
+ if ( lo[i].LookupFlag & IGNORE_SPECIAL_MARKS )
+ {
+ if ( FILE_Seek( gdef->MarkAttachClassDef_offset ) ||
+ ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( !new_offset )
+ return TTO_Err_Invalid_GDEF_SubTable;
+
+ new_offset += gdef->offset;
+
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ClassDefinition( &gdef->MarkAttachClassDef,
+ 256, faze ) ) != TT_Err_Ok )
+ goto Fail1;
+
+ /* copy the class definition pointer into the extension structure */
+
+ error = TT_Extension_Get( faze, GDEF_ID, (void**)&gdef_reg );
+ if ( error )
+ return error;
+
+ *gdef_reg = *gdef;
+
+ break;
+ }
+ }
+ }
+
+ gpos->loaded = TRUE;
+ *retptr = *gpos;
+ DONE_Stream( stream );
+
+ return TT_Err_Ok;
+
+ Fail1:
+ Free_LookupList( &gpos->LookupList, GPOS );
+
+ Fail2:
+ Free_FeatureList( &gpos->FeatureList );
+
+ Fail3:
+ Free_ScriptList( &gpos->ScriptList );
+
+ /* release stream */
+
+ DONE_Stream( stream );
+
+ return error;
+ }
+
+
+
+ /*****************************
+ * SubTable related functions
+ *****************************/
+
+ /* shared tables */
+
+ /* ValueRecord */
+
+ /* There is a subtle difference in the specs between a `table' and a
+ `record' -- offsets for device tables in ValueRecords are taken from
+ the parent table and not the parent record. */
+
+ static TT_Error Load_ValueRecord( TTO_ValueRecord* vr,
+ UShort format,
+ ULong base_offset,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ ULong cur_offset, new_offset;
+
+
+ if ( format & HAVE_X_PLACEMENT )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ vr->XPlacement = GET_Short();
+
+ FORGET_Frame();
+ }
+ else
+ vr->XPlacement = 0;
+
+ if ( format & HAVE_Y_PLACEMENT )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ vr->YPlacement = GET_Short();
+
+ FORGET_Frame();
+ }
+ else
+ vr->YPlacement = 0;
+
+ if ( format & HAVE_X_ADVANCE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ vr->XAdvance = GET_Short();
+
+ FORGET_Frame();
+ }
+ else
+ vr->XAdvance = 0;
+
+ if ( format & HAVE_Y_ADVANCE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ vr->YAdvance = GET_Short();
+
+ FORGET_Frame();
+ }
+ else
+ vr->YAdvance = 0;
+
+ if ( format & HAVE_X_PLACEMENT_DEVICE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &vr->XPlacementDevice,
+ input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ goto empty1;
+ }
+ else
+ {
+ empty1:
+ vr->XPlacementDevice.StartSize = 0;
+ vr->XPlacementDevice.EndSize = 0;
+ vr->XPlacementDevice.DeltaValue = NULL;
+ }
+
+ if ( format & HAVE_Y_PLACEMENT_DEVICE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &vr->YPlacementDevice,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ goto empty2;
+ }
+ else
+ {
+ empty2:
+ vr->YPlacementDevice.StartSize = 0;
+ vr->YPlacementDevice.EndSize = 0;
+ vr->YPlacementDevice.DeltaValue = NULL;
+ }
+
+ if ( format & HAVE_X_ADVANCE_DEVICE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &vr->XAdvanceDevice,
+ input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ goto empty3;
+ }
+ else
+ {
+ empty3:
+ vr->XAdvanceDevice.StartSize = 0;
+ vr->XAdvanceDevice.EndSize = 0;
+ vr->XAdvanceDevice.DeltaValue = NULL;
+ }
+
+ if ( format & HAVE_Y_ADVANCE_DEVICE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &vr->YAdvanceDevice,
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ goto empty4;
+ }
+ else
+ {
+ empty4:
+ vr->YAdvanceDevice.StartSize = 0;
+ vr->YAdvanceDevice.EndSize = 0;
+ vr->YAdvanceDevice.DeltaValue = NULL;
+ }
+
+ if ( format & HAVE_X_ID_PLACEMENT )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ vr->XIdPlacement = GET_UShort();
+
+ FORGET_Frame();
+ }
+ else
+ vr->XIdPlacement = 0;
+
+ if ( format & HAVE_Y_ID_PLACEMENT )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ vr->YIdPlacement = GET_UShort();
+
+ FORGET_Frame();
+ }
+ else
+ vr->YIdPlacement = 0;
+
+ if ( format & HAVE_X_ID_ADVANCE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ vr->XIdAdvance = GET_UShort();
+
+ FORGET_Frame();
+ }
+ else
+ vr->XIdAdvance = 0;
+
+ if ( format & HAVE_Y_ID_ADVANCE )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ vr->YIdAdvance = GET_UShort();
+
+ FORGET_Frame();
+ }
+ else
+ vr->YIdAdvance = 0;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ Free_Device( &vr->YAdvanceDevice );
+
+ Fail2:
+ Free_Device( &vr->XAdvanceDevice );
+
+ Fail3:
+ Free_Device( &vr->YPlacementDevice );
+ return error;
+ }
+
+
+ static void Free_ValueRecord( TTO_ValueRecord* vr,
+ UShort format )
+ {
+ if ( format & HAVE_Y_ADVANCE_DEVICE )
+ Free_Device( &vr->YAdvanceDevice );
+ if ( format & HAVE_X_ADVANCE_DEVICE )
+ Free_Device( &vr->XAdvanceDevice );
+ if ( format & HAVE_Y_PLACEMENT_DEVICE )
+ Free_Device( &vr->YPlacementDevice );
+ if ( format & HAVE_X_PLACEMENT_DEVICE )
+ Free_Device( &vr->XPlacementDevice );
+ }
+
+
+ static TT_Error Get_ValueRecord( GPOS_Instance* gpi,
+ TTO_ValueRecord* vr,
+ UShort format,
+ TTO_GPOS_Data* gd )
+ {
+ TT_Pos value;
+ Short pixel_value;
+ TT_Error error = TT_Err_Ok;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+ PInstance ins;
+
+ UShort x_ppem, y_ppem;
+ Fixed x_scale, y_scale;
+
+
+ if ( !format )
+ return TT_Err_Ok;
+
+ ins = HANDLE_Instance( gpi->instance );
+
+ x_ppem = ins->metrics.x_ppem;
+ y_ppem = ins->metrics.y_ppem;
+ x_scale = TT_MulDiv( 0x10000,
+ ins->metrics.x_scale1,
+ ins->metrics.x_scale2 );
+ y_scale = TT_MulDiv( 0x10000,
+ ins->metrics.y_scale1,
+ ins->metrics.y_scale2 );
+
+ /* design units -> fractional pixel */
+
+ if ( format & HAVE_X_PLACEMENT )
+ gd->x_pos += x_scale * vr->XPlacement / 0x10000;
+ if ( format & HAVE_Y_PLACEMENT )
+ gd->y_pos += y_scale * vr->YPlacement / 0x10000;
+ if ( format & HAVE_X_ADVANCE )
+ gd->x_advance += x_scale * vr->XAdvance / 0x10000;
+ if ( format & HAVE_Y_ADVANCE )
+ gd->y_advance += y_scale * vr->YAdvance / 0x10000;
+
+ /* we use the device tables only if gpi->glyph.z is not NULL */
+
+ if ( gpi->glyph.z )
+ {
+ /* pixel -> fractional pixel */
+
+ if ( format & HAVE_X_PLACEMENT_DEVICE )
+ {
+ Get_Device( &vr->XPlacementDevice, x_ppem, &pixel_value );
+ gd->x_pos += pixel_value << 6;
+ }
+ if ( format & HAVE_Y_PLACEMENT_DEVICE )
+ {
+ Get_Device( &vr->YPlacementDevice, y_ppem, &pixel_value );
+ gd->y_pos += pixel_value << 6;
+ }
+ if ( format & HAVE_X_ADVANCE_DEVICE )
+ {
+ Get_Device( &vr->XAdvanceDevice, x_ppem, &pixel_value );
+ gd->x_advance += pixel_value << 6;
+ }
+ if ( format & HAVE_Y_ADVANCE_DEVICE )
+ {
+ Get_Device( &vr->YAdvanceDevice, y_ppem, &pixel_value );
+ gd->y_advance += pixel_value << 6;
+ }
+ }
+
+ /* values returned from mmfunc() are already in fractional pixels */
+
+ if ( format & HAVE_X_ID_PLACEMENT )
+ {
+ error = (gpos->mmfunc)( gpi->instance, vr->XIdPlacement,
+ &value, gpos->data );
+ if ( error )
+ return error;
+ gd->x_pos += value;
+ }
+ if ( format & HAVE_Y_ID_PLACEMENT )
+ {
+ error = (gpos->mmfunc)( gpi->instance, vr->YIdPlacement,
+ &value, gpos->data );
+ if ( error )
+ return error;
+ gd->y_pos += value;
+ }
+ if ( format & HAVE_X_ID_ADVANCE )
+ {
+ error = (gpos->mmfunc)( gpi->instance, vr->XIdAdvance,
+ &value, gpos->data );
+ if ( error )
+ return error;
+ gd->x_advance += value;
+ }
+ if ( format & HAVE_Y_ID_ADVANCE )
+ {
+ error = (gpos->mmfunc)( gpi->instance, vr->YIdAdvance,
+ &value, gpos->data );
+ if ( error )
+ return error;
+ gd->y_advance += value;
+ }
+
+ return error;
+ }
+
+
+ /* AnchorFormat1 */
+ /* AnchorFormat2 */
+ /* AnchorFormat3 */
+ /* AnchorFormat4 */
+
+ static TT_Error Load_Anchor( TTO_Anchor* an,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ ULong cur_offset, new_offset, base_offset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ an->PosFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( an->PosFormat )
+ {
+ case 1:
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ an->af.af1.XCoordinate = GET_Short();
+ an->af.af1.YCoordinate = GET_Short();
+
+ FORGET_Frame();
+ break;
+
+ case 2:
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ an->af.af2.XCoordinate = GET_Short();
+ an->af.af2.YCoordinate = GET_Short();
+ an->af.af2.AnchorPoint = GET_UShort();
+
+ FORGET_Frame();
+ break;
+
+ case 3:
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ an->af.af3.XCoordinate = GET_Short();
+ an->af.af3.YCoordinate = GET_Short();
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &an->af.af3.XDeviceTable,
+ input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ an->af.af3.XDeviceTable.StartSize = 0;
+ an->af.af3.XDeviceTable.EndSize = 0;
+ an->af.af3.XDeviceTable.DeltaValue = 0;
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Device( &an->af.af3.YDeviceTable,
+ input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ an->af.af3.YDeviceTable.StartSize = 0;
+ an->af.af3.YDeviceTable.EndSize = 0;
+ an->af.af3.YDeviceTable.DeltaValue = 0;
+ }
+ break;
+
+ case 4:
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ an->af.af4.XIdAnchor = GET_UShort();
+ an->af.af4.YIdAnchor = GET_UShort();
+
+ FORGET_Frame();
+ break;
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ Free_Device( &an->af.af3.XDeviceTable );
+ return error;
+ }
+
+
+ static void Free_Anchor( TTO_Anchor* an )
+ {
+ if ( an->PosFormat == 3 )
+ {
+ Free_Device( &an->af.af3.YDeviceTable );
+ Free_Device( &an->af.af3.XDeviceTable );
+ }
+ }
+
+
+ static TT_Error Get_Anchor( GPOS_Instance* gpi,
+ TTO_Anchor* an,
+ TT_UShort glyph_index,
+ TT_Pos* x_value,
+ TT_Pos* y_value )
+ {
+ TT_Error error = TT_Err_Ok;
+
+ PInstance ins;
+ PGlyph glyph;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+ UShort ap;
+
+ Short pixel_value;
+ UShort load_flags;
+
+ UShort x_ppem, y_ppem;
+ Fixed x_scale, y_scale;
+
+
+ ins = HANDLE_Instance( gpi->instance );
+
+ x_ppem = ins->metrics.x_ppem;
+ y_ppem = ins->metrics.y_ppem;
+ x_scale = TT_MulDiv( 0x10000,
+ ins->metrics.x_scale1,
+ ins->metrics.x_scale2 );
+ y_scale = TT_MulDiv( 0x10000,
+ ins->metrics.y_scale1,
+ ins->metrics.y_scale2 );
+
+ switch ( an->PosFormat )
+ {
+ case 0:
+ /* The special case of an empty AnchorTable */
+
+ return TTO_Err_Not_Covered;
+
+ case 1:
+ *x_value = x_scale * an->af.af1.XCoordinate / 0x10000;
+ *y_value = y_scale * an->af.af1.YCoordinate / 0x10000;
+ break;
+
+ case 2:
+ /* glyphs must be scaled */
+
+ load_flags = gpi->load_flags | TTLOAD_SCALE_GLYPH;
+
+ /* we use the glyph contour point only if gpi->glyph.z is not NULL */
+
+ if ( gpi->glyph.z )
+ {
+ error = (gpos->gfunc)( gpi->instance, gpi->glyph,
+ glyph_index, load_flags );
+ if ( error )
+ return error;
+
+ glyph = HANDLE_Glyph( gpi->glyph );
+ ap = an->af.af2.AnchorPoint;
+
+ /* if outline.n_points is set to zero by gfunc(), we use the
+ design coordinate value pair. This can happen e.g. for
+ sbit glyphs */
+
+ if ( !glyph->outline.n_points )
+ goto no_contour_point;
+
+ if ( ap >= glyph->outline.n_points )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ *x_value = glyph->outline.points[ap].x;
+ *y_value = glyph->outline.points[ap].y;
+ }
+ else
+ {
+ no_contour_point:
+ *x_value = x_scale * an->af.af3.XCoordinate / 0x10000;
+ *y_value = y_scale * an->af.af3.YCoordinate / 0x10000;
+ }
+ break;
+
+ case 3:
+ /* we use the device tables only if gpi->glyph.z is not NULL */
+
+ if ( gpi->glyph.z )
+ {
+ Get_Device( &an->af.af3.XDeviceTable, x_ppem, &pixel_value );
+ *x_value = pixel_value << 6;
+ Get_Device( &an->af.af3.YDeviceTable, y_ppem, &pixel_value );
+ *y_value = pixel_value << 6;
+ }
+ else
+ *x_value = *y_value = 0;
+
+ *x_value += x_scale * an->af.af3.XCoordinate / 0x10000;
+ *y_value += y_scale * an->af.af3.YCoordinate / 0x10000;
+ break;
+
+ case 4:
+ error = (gpos->mmfunc)( gpi->instance, an->af.af4.XIdAnchor,
+ x_value, gpos->data );
+ if ( error )
+ return error;
+
+ error = (gpos->mmfunc)( gpi->instance, an->af.af4.YIdAnchor,
+ y_value, gpos->data );
+ if ( error )
+ return error;
+ break;
+ }
+
+ return error;
+ }
+
+
+ /* MarkArray */
+
+ static TT_Error Load_MarkArray ( TTO_MarkArray* ma,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_MarkRecord* mr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ma->MarkCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ma->MarkRecord = NULL;
+
+ if ( ALLOC_ARRAY( ma->MarkRecord, count, TTO_MarkRecord ) )
+ return error;
+
+ mr = ma->MarkRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail;
+
+ mr[n].Class = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Anchor( &mr[n].MarkAnchor, input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_Anchor( &mr[n].MarkAnchor );
+
+ FREE( mr );
+ return error;
+ }
+
+
+ static void Free_MarkArray( TTO_MarkArray* ma )
+ {
+ UShort n, count;
+
+ TTO_MarkRecord* mr;
+
+
+ if ( ma->MarkRecord )
+ {
+ count = ma->MarkCount;
+ mr = ma->MarkRecord;
+
+ for ( n = 0; n < count; n++ )
+ Free_Anchor( &mr[n].MarkAnchor );
+
+ FREE( mr );
+ }
+ }
+
+
+ /* LookupType 1 */
+
+ /* SinglePosFormat1 */
+ /* SinglePosFormat2 */
+
+ TT_Error Load_SinglePos( TTO_SinglePos* sp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count, format;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ValueRecord* vr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ sp->PosFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ format = sp->ValueFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( !format )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &sp->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ switch ( sp->PosFormat )
+ {
+ case 1:
+ error = Load_ValueRecord( &sp->spf.spf1.Value, format,
+ base_offset, input );
+ if ( error )
+ goto Fail2;
+ break;
+
+ case 2:
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = sp->spf.spf2.ValueCount = GET_UShort();
+
+ FORGET_Frame();
+
+ sp->spf.spf2.Value = NULL;
+
+ if ( ALLOC_ARRAY( sp->spf.spf2.Value, count, TTO_ValueRecord ) )
+ goto Fail2;
+
+ vr = sp->spf.spf2.Value;
+
+ for ( n = 0; n < count; n++ )
+ {
+ error = Load_ValueRecord( &vr[n], format, base_offset, input );
+ if ( error )
+ goto Fail1;
+ }
+ break;
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_ValueRecord( &vr[n], format );
+
+ FREE( vr );
+
+ Fail2:
+ Free_Coverage( &sp->Coverage );
+ return error;
+ }
+
+
+ void Free_SinglePos( TTO_SinglePos* sp )
+ {
+ UShort n, count, format;
+
+ TTO_ValueRecord* v;
+
+
+ format = sp->ValueFormat;
+
+ switch ( sp->PosFormat )
+ {
+ case 1:
+ Free_ValueRecord( &sp->spf.spf1.Value, format );
+ break;
+
+ case 2:
+ if ( sp->spf.spf2.Value )
+ {
+ count = sp->spf.spf2.ValueCount;
+ v = sp->spf.spf2.Value;
+
+ for ( n = 0; n < count; n++ )
+ Free_ValueRecord( &v[n], format );
+
+ FREE( v );
+ }
+ break;
+ }
+
+ Free_Coverage( &sp->Coverage );
+ }
+
+
+ static TT_Error Lookup_SinglePos( GPOS_Instance* gpi,
+ TTO_SinglePos* sp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length )
+ {
+ UShort index, property;
+ TT_Error error;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gpos->gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &sp->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ switch ( sp->PosFormat )
+ {
+ case 1:
+ error = Get_ValueRecord( gpi, &sp->spf.spf1.Value,
+ sp->ValueFormat, &out[in->pos] );
+ if ( error )
+ return error;
+ break;
+
+ case 2:
+ if ( index >= sp->spf.spf2.ValueCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+ error = Get_ValueRecord( gpi, &sp->spf.spf2.Value[index],
+ sp->ValueFormat, &out[in->pos] );
+ if ( error )
+ return error;
+ break;
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable;
+ }
+
+ (in->pos)++;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 2 */
+
+ /* PairSet */
+
+ static TT_Error Load_PairSet ( TTO_PairSet* ps,
+ UShort format1,
+ UShort format2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong base_offset;
+
+ TTO_PairValueRecord* pvr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ps->PairValueCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ps->PairValueRecord = NULL;
+
+ if ( ALLOC_ARRAY( ps->PairValueRecord, count, TTO_PairValueRecord ) )
+ return error;
+
+ pvr = ps->PairValueRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ pvr[n].SecondGlyph = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( format1 )
+ {
+ error = Load_ValueRecord( &pvr[n].Value1, format1,
+ base_offset, input );
+ if ( error )
+ goto Fail;
+ }
+ if ( format2 )
+ {
+ error = Load_ValueRecord( &pvr[n].Value2, format2,
+ base_offset, input );
+ if ( error )
+ goto Fail;
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ {
+ if ( format1 )
+ Free_ValueRecord( &pvr[n].Value1, format1 );
+ if ( format2 )
+ Free_ValueRecord( &pvr[n].Value2, format2 );
+ }
+
+ FREE( pvr );
+ return error;
+ }
+
+
+ static void Free_PairSet( TTO_PairSet* ps,
+ UShort format1,
+ UShort format2 )
+ {
+ UShort n, count;
+
+ TTO_PairValueRecord* pvr;
+
+
+ if ( ps->PairValueRecord )
+ {
+ count = ps->PairValueCount;
+ pvr = ps->PairValueRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( format1 )
+ Free_ValueRecord( &pvr[n].Value1, format1 );
+ if ( format2 )
+ Free_ValueRecord( &pvr[n].Value2, format2 );
+ }
+
+ FREE( pvr );
+ }
+ }
+
+
+ /* PairPosFormat1 */
+
+ static TT_Error Load_PairPos1( TTO_PairPosFormat1* ppf1,
+ UShort format1,
+ UShort format2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_PairSet* ps;
+
+
+ base_offset = FILE_Pos() - 8L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ppf1->PairSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ppf1->PairSet = NULL;
+
+ if ( ALLOC_ARRAY( ppf1->PairSet, count, TTO_PairSet ) )
+ goto Fail;
+
+ ps = ppf1->PairSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_PairSet( &ps[n], format1,
+ format2, input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_PairSet( &ps[n], format1, format2 );
+
+ FREE( ps );
+ return error;
+ }
+
+
+ static void Free_PairPos1( TTO_PairPosFormat1* ppf1,
+ UShort format1,
+ UShort format2 )
+ {
+ UShort n, count;
+
+ TTO_PairSet* ps;
+
+
+ if ( ppf1->PairSet )
+ {
+ count = ppf1->PairSetCount;
+ ps = ppf1->PairSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_PairSet( &ps[n], format1, format2 );
+
+ FREE( ps );
+ }
+ }
+
+
+ /* PairPosFormat2 */
+
+ static TT_Error Load_PairPos2( TTO_PairPosFormat2* ppf2,
+ UShort format1,
+ UShort format2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort m, n, count1, count2;
+ ULong cur_offset, new_offset1, new_offset2, base_offset;
+
+ TTO_Class1Record* c1r;
+ TTO_Class2Record* c2r;
+
+
+ base_offset = FILE_Pos() - 8L;
+
+ if ( ACCESS_Frame( 8L ) )
+ return error;
+
+ new_offset1 = GET_UShort() + base_offset;
+ new_offset2 = GET_UShort() + base_offset;
+
+ /* `Class1Count' and `Class2Count' are the upper limits for class
+ values, thus we read it now to make additional safety checks. */
+
+ count1 = ppf2->Class1Count = GET_UShort();
+ count2 = ppf2->Class2Count = GET_UShort();
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset1 ) ||
+ ( error = Load_ClassDefinition( &ppf2->ClassDef1, count1,
+ input ) ) != TT_Err_Ok )
+ return error;
+ if ( FILE_Seek( new_offset2 ) ||
+ ( error = Load_ClassDefinition( &ppf2->ClassDef2, count2,
+ input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+
+ ppf2->Class1Record = NULL;
+
+ if ( ALLOC_ARRAY( ppf2->Class1Record, count1, TTO_Class1Record ) )
+ goto Fail1;
+
+ c1r = ppf2->Class1Record;
+
+ for ( m = 0; m < count1; m++ )
+ {
+ c1r[m].Class2Record = NULL;
+
+ if ( ALLOC_ARRAY( c1r[m].Class2Record, count2, TTO_Class2Record ) )
+ goto Fail1;
+
+ c2r = c1r[m].Class2Record;
+
+ for ( n = 0; n < count2; n++ )
+ {
+ if ( format1 )
+ {
+ error = Load_ValueRecord( &c2r[n].Value1, format1,
+ base_offset, input );
+ if ( error )
+ goto Fail1;
+ }
+ if ( format2 )
+ {
+ error = Load_ValueRecord( &c2r[n].Value2, format2,
+ base_offset, input );
+ if ( error )
+ goto Fail1;
+ }
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( m = 0; m < count1; m++ )
+ {
+ c2r = c1r[m].Class2Record;
+
+ for ( n = 0; n < count2; n++ )
+ {
+ if ( format1 )
+ Free_ValueRecord( &c2r[n].Value1, format1 );
+ if ( format2 )
+ Free_ValueRecord( &c2r[n].Value2, format2 );
+ }
+
+ FREE( c2r );
+ }
+
+ FREE( c1r );
+
+ Free_ClassDefinition( &ppf2->ClassDef2 );
+
+ Fail2:
+ Free_ClassDefinition( &ppf2->ClassDef1 );
+ return error;
+ }
+
+
+ static void Free_PairPos2( TTO_PairPosFormat2* ppf2,
+ UShort format1,
+ UShort format2 )
+ {
+ UShort m, n, count1, count2;
+
+ TTO_Class1Record* c1r;
+ TTO_Class2Record* c2r;
+
+
+ if ( ppf2->Class1Record )
+ {
+ c1r = ppf2->Class1Record;
+ count1 = ppf2->Class1Count;
+ count2 = ppf2->Class2Count;
+
+ for ( m = 0; m < count1; m++ )
+ {
+ c2r = c1r[m].Class2Record;
+
+ for ( n = 0; n < count2; n++ )
+ {
+ if ( format1 )
+ Free_ValueRecord( &c2r[n].Value1, format1 );
+ if ( format2 )
+ Free_ValueRecord( &c2r[n].Value2, format2 );
+ }
+
+ FREE( c2r );
+ }
+
+ FREE( c1r );
+
+ Free_ClassDefinition( &ppf2->ClassDef2 );
+ Free_ClassDefinition( &ppf2->ClassDef1 );
+ }
+ }
+
+
+ TT_Error Load_PairPos( TTO_PairPos* pp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort format1, format2;
+ ULong cur_offset, new_offset, base_offset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 8L ) )
+ return error;
+
+ pp->PosFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ format1 = pp->ValueFormat1 = GET_UShort();
+ format2 = pp->ValueFormat2 = GET_UShort();
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &pp->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ switch ( pp->PosFormat )
+ {
+ case 1:
+ error = Load_PairPos1( &pp->ppf.ppf1, format1, format2, input );
+ if ( error )
+ goto Fail;
+ break;
+
+ case 2:
+ error = Load_PairPos2( &pp->ppf.ppf2, format1, format2, input );
+ if ( error )
+ goto Fail;
+ break;
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ Free_Coverage( &pp->Coverage );
+ return error;
+ }
+
+
+ void Free_PairPos( TTO_PairPos* pp )
+ {
+ UShort format1, format2;
+
+
+ format1 = pp->ValueFormat1;
+ format2 = pp->ValueFormat2;
+
+ switch ( pp->PosFormat )
+ {
+ case 1:
+ Free_PairPos1( &pp->ppf.ppf1, format1, format2 );
+ break;
+
+ case 2:
+ Free_PairPos2( &pp->ppf.ppf2, format1, format2 );
+ break;
+ }
+
+ Free_Coverage( &pp->Coverage );
+ }
+
+
+ static TT_Error Lookup_PairPos1( GPOS_Instance* gpi,
+ TTO_PairPosFormat1* ppf1,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort first_pos,
+ UShort index,
+ UShort format1,
+ UShort format2 )
+ {
+ TT_Error error;
+ UShort numpvr, glyph2;
+
+ TTO_PairValueRecord* pvr;
+
+
+ if ( index >= ppf1->PairSetCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ pvr = ppf1->PairSet[index].PairValueRecord;
+ if ( !pvr )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ glyph2 = in->string[in->pos];
+
+ for ( numpvr = ppf1->PairSet[index].PairValueCount;
+ numpvr;
+ numpvr--, pvr++ )
+ {
+ if ( glyph2 == pvr->SecondGlyph )
+ {
+ error = Get_ValueRecord( gpi, &pvr->Value1, format1,
+ &out[first_pos] );
+ if ( error )
+ return error;
+ return Get_ValueRecord( gpi, &pvr->Value2, format2,
+ &out[in->pos] );
+ }
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ static TT_Error Lookup_PairPos2( GPOS_Instance* gpi,
+ TTO_PairPosFormat2* ppf2,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort first_pos,
+ UShort format1,
+ UShort format2 )
+ {
+ TT_Error error;
+ UShort cl1, cl2;
+
+ TTO_Class1Record* c1r;
+ TTO_Class2Record* c2r;
+
+
+ error = Get_Class( &ppf2->ClassDef1, in->string[first_pos],
+ &cl1, NULL );
+ if ( error )
+ return error;
+ error = Get_Class( &ppf2->ClassDef2, in->string[in->pos],
+ &cl2, NULL );
+ if ( error )
+ return error;
+
+ c1r = &ppf2->Class1Record[cl1];
+ if ( !c1r )
+ return TTO_Err_Invalid_GPOS_SubTable;
+ c2r = &c1r->Class2Record[cl2];
+
+ error = Get_ValueRecord( gpi, &c2r->Value1, format1, &out[first_pos] );
+ if ( error )
+ return error;
+ return Get_ValueRecord( gpi, &c2r->Value2, format2, &out[in->pos] );
+ }
+
+
+ static TT_Error Lookup_PairPos( GPOS_Instance* gpi,
+ TTO_PairPos* pp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length )
+ {
+ TT_Error error;
+ UShort index, property, first_pos;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+
+ if ( in->pos >= in->length - 1 )
+ return TTO_Err_Not_Covered; /* Not enough glyphs in input */
+
+ if ( context_length != 0xFFFF && context_length < 2 )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gpos->gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &pp->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ /* second glyph */
+
+ first_pos = in->pos;
+ (in->pos)++;
+
+ while ( CHECK_Property( gpos->gdef, in->string[in->pos],
+ flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos < in->length )
+ (in->pos)++;
+ else
+ break;
+ }
+
+ switch ( pp->PosFormat )
+ {
+ case 1:
+ error = Lookup_PairPos1( gpi, &pp->ppf.ppf1, in, out,
+ first_pos, index,
+ pp->ValueFormat1, pp->ValueFormat2 );
+ break;
+
+ case 2:
+ error = Lookup_PairPos2( gpi, &pp->ppf.ppf2, in, out, first_pos,
+ pp->ValueFormat1, pp->ValueFormat2 );
+ break;
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ /* adjusting the `next' glyph */
+
+ if ( pp->ValueFormat2 )
+ (in->pos)++;
+
+ return error;
+ }
+
+
+ /* LookupType 3 */
+
+ /* CursivePosFormat1 */
+
+ TT_Error Load_CursivePos( TTO_CursivePos* cp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_EntryExitRecord* eer;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ cp->PosFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &cp->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = cp->EntryExitCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cp->EntryExitRecord = NULL;
+
+ if ( ALLOC_ARRAY( cp->EntryExitRecord, count, TTO_EntryExitRecord ) )
+ goto Fail2;
+
+ eer = cp->EntryExitRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Anchor( &eer[n].EntryAnchor,
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ eer[n].EntryAnchor.PosFormat = 0;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Anchor( &eer[n].ExitAnchor,
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ eer[n].ExitAnchor.PosFormat = 0;
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ {
+ Free_Anchor( &eer[n].EntryAnchor );
+ Free_Anchor( &eer[n].ExitAnchor );
+ }
+
+ FREE( eer );
+
+ Fail2:
+ Free_Coverage( &cp->Coverage );
+ return error;
+ }
+
+
+ void Free_CursivePos( TTO_CursivePos* cp )
+ {
+ UShort n, count;
+
+ TTO_EntryExitRecord* eer;
+
+
+ if ( cp->EntryExitRecord )
+ {
+ count = cp->EntryExitCount;
+ eer = cp->EntryExitRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ Free_Anchor( &eer[n].EntryAnchor );
+ Free_Anchor( &eer[n].ExitAnchor );
+ }
+
+ FREE( eer );
+ }
+
+ Free_Coverage( &cp->Coverage );
+ }
+
+
+ static TT_Error Lookup_CursivePos( GPOS_Instance* gpi,
+ TTO_CursivePos* cp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length )
+ {
+ UShort index, property;
+ TT_Error error;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_EntryExitRecord* eer;
+ TT_Pos entry_x, entry_y;
+ TT_Pos exit_x, exit_y;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ {
+ gpi->last = 0xFFFF;
+ return TTO_Err_Not_Covered;
+ }
+
+ /* Glyphs not having the right GDEF properties will be ignored, i.e.,
+ gpi->last won't be reset (contrary to user defined properties). */
+
+ if ( CHECK_Property( gpos->gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ /* We don't handle mark glyphs here. According to Andrei, this isn't
+ possible, but who knows... */
+
+ if ( property == MARK_GLYPH )
+ {
+ gpi->last = 0xFFFF;
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &cp->Coverage, in->string[in->pos], &index );
+ if ( error )
+ {
+ gpi->last = 0xFFFF;
+ return error;
+ }
+
+ if ( index >= cp->EntryExitCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ eer = &cp->EntryExitRecord[index];
+
+ /* Now comes the messiest part of the whole OpenType
+ specification. At first glance, cursive connections seem easy
+ to understand, but there are pitfalls! The reason is that
+ the specs don't mention how to compute the advance values
+ resp. glyph offsets. I was told it would be an omission, to
+ be fixed in the next OpenType version... Again many thanks to
+ Andrei Burago <andreib@microsoft.com> for clarifications.
+
+ Consider the following example:
+
+ | xadv1 |
+ +---------+
+ | |
+ +-----+--+ 1 |
+ | | .| |
+ | 0+--+------+
+ | 2 |
+ | |
+ 0+--------+
+ | xadv2 |
+
+ glyph1: advance width = 12
+ anchor point = (3,1)
+
+ glyph2: advance width = 11
+ anchor point = (9,4)
+
+ LSB is 1 for both glyphs (so the boxes drawn above are glyph
+ bboxes). Writing direction is R2L; `0' denotes the glyph's
+ coordinate origin.
+
+ Now the surprising part: The advance width of the *left* glyph
+ (resp. of the *bottom* glyph) will be modified, no matter
+ whether the writing direction is L2R or R2L (resp. T2B or
+ B2T)! This assymetry is caused by the fact that the glyph's
+ coordinate origin is always the lower left corner for all
+ writing directions.
+
+ Continuing the above example, we can compute the new
+ (horizontal) advance width of glyph2 as
+
+ 9 - 3 = 6 ,
+
+ and the new vertical offset of glyph2 as
+
+ 1 - 4 = -3 .
+
+
+ Vertical writing direction is far more complicated:
+
+ a) Assuming that we recompute the advance height of the lower glyph:
+
+ --
+ +---------+
+ -- | |
+ +-----+--+ 1 | yadv1
+ | | .| |
+ yadv2 | 0+--+------+ -- BSB1 --
+ | 2 | -- -- y_offset
+ | |
+ BSB2 -- 0+--------+ --
+ -- --
+
+ glyph1: advance height = 6
+ anchor point = (3,1)
+
+ glyph2: advance height = 7
+ anchor point = (9,4)
+
+ TSB is 1 for both glyphs; writing direction is T2B.
+
+
+ BSB1 = yadv1 - (TSB1 + ymax1)
+ BSB2 = yadv2 - (TSB2 + ymax2)
+ y_offset = y2 - y1
+
+ vertical advance width of glyph2
+ = y_offset + BSB2 - BSB1
+ = (y2 - y1) + (yadv2 - (TSB2 + ymax2)) - (yadv1 - (TSB1 + ymax1))
+ = y2 - y1 + yadv2 - TSB2 - ymax2 - (yadv1 - TSB1 - ymax1)
+ = y2 - y1 + yadv2 - TSB2 - ymax2 - yadv1 + TSB1 + ymax1
+
+
+ b) Assuming that we recompute the advance height of the upper glyph:
+
+ -- --
+ +---------+ -- TSB1
+ -- -- | |
+ TSB2 -- +-----+--+ 1 | yadv1 ymax1
+ | | .| |
+ yadv2 | 0+--+------+ -- --
+ ymax2 | 2 | -- y_offset
+ | |
+ -- 0+--------+ --
+ --
+
+ glyph1: advance height = 6
+ anchor point = (3,1)
+
+ glyph2: advance height = 7
+ anchor point = (9,4)
+
+ TSB is 1 for both glyphs; writing direction is T2B.
+
+ y_offset = y2 - y1
+
+ vertical advance width of glyph2
+ = TSB1 + ymax1 + y_offset - (TSB2 + ymax2)
+ = TSB1 + ymax1 + y2 - y1 - TSB2 - ymax2
+
+
+ Comparing a) with b) shows that b) is easier to compute. I'll wait
+ for a reply from Andrei to see what should really be implemented...
+
+ Since horizontal advance widths or vertical advance heights
+ can be used alone but not together, no ambiguity occurs. */
+
+ if ( gpi->last == 0xFFFF )
+ goto end;
+
+ /* Get_Anchor() returns TTO_Err_Not_Covered if there is no anchor
+ table. */
+
+ error = Get_Anchor( gpi, &eer->EntryAnchor, in->string[in->pos],
+ &entry_x, &entry_y );
+ if ( error == TTO_Err_Not_Covered )
+ goto end;
+ if ( error )
+ return error;
+
+ if ( gpi->r2l )
+ {
+ out[in->pos].x_advance = entry_x - gpi->anchor_x;
+ out[in->pos].new_advance = TRUE;
+ }
+ else
+ {
+ out[gpi->last].x_advance = gpi->anchor_x - entry_x;
+ out[gpi->last].new_advance = TRUE;
+ }
+
+ out[in->pos].y_pos = gpi->anchor_y - entry_y + out[gpi->last].y_pos;
+
+ end:
+ error = Get_Anchor( gpi, &eer->ExitAnchor, in->string[in->pos],
+ &exit_x, &exit_y );
+ if ( error == TTO_Err_Not_Covered )
+ gpi->last = 0xFFFF;
+ else
+ {
+ if ( gpi->first == 0xFFFF )
+ gpi->first = in->pos;
+ gpi->last = in->pos;
+ gpi->anchor_x = exit_x;
+ gpi->anchor_y = exit_y;
+ }
+ if ( error )
+ return error;
+
+ (in->pos)++;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 4 */
+
+ /* BaseArray */
+
+ static TT_Error Load_BaseArray( TTO_BaseArray* ba,
+ UShort num_classes,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort m, n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_BaseRecord* br;
+ TTO_Anchor* ban;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ba->BaseCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ba->BaseRecord = NULL;
+
+ if ( ALLOC_ARRAY( ba->BaseRecord, count, TTO_BaseRecord ) )
+ return error;
+
+ br = ba->BaseRecord;
+
+ for ( m = 0; m < count; m++ )
+ {
+ br[m].BaseAnchor = NULL;
+
+ if ( ALLOC_ARRAY( br[m].BaseAnchor, num_classes, TTO_Anchor ) )
+ goto Fail;
+
+ ban = br[m].BaseAnchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Anchor( &ban[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( m = 0; m < count; m++ )
+ {
+ ban = br[m].BaseAnchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ Free_Anchor( &ban[n] );
+
+ FREE( ban );
+ }
+
+ FREE( br );
+ return error;
+ }
+
+
+ static void Free_BaseArray( TTO_BaseArray* ba,
+ UShort num_classes )
+ {
+ UShort m, n, count;
+
+ TTO_BaseRecord* br;
+ TTO_Anchor* ban;
+
+
+ if ( ba->BaseRecord )
+ {
+ count = ba->BaseCount;
+ br = ba->BaseRecord;
+
+ for ( m = 0; m < count; m++ )
+ {
+ ban = br[m].BaseAnchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ Free_Anchor( &ban[n] );
+
+ FREE( ban );
+ }
+
+ FREE( br );
+ }
+ }
+
+
+ /* MarkBasePosFormat1 */
+
+ TT_Error Load_MarkBasePos( TTO_MarkBasePos* mbp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ ULong cur_offset, new_offset, base_offset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ mbp->PosFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &mbp->MarkCoverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &mbp->BaseCoverage, input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail2;
+
+ mbp->ClassCount = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_MarkArray( &mbp->MarkArray, input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_BaseArray( &mbp->BaseArray, mbp->ClassCount,
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ Free_MarkArray( &mbp->MarkArray );
+
+ Fail2:
+ Free_Coverage( &mbp->BaseCoverage );
+
+ Fail3:
+ Free_Coverage( &mbp->MarkCoverage );
+ return error;
+ }
+
+
+ void Free_MarkBasePos( TTO_MarkBasePos* mbp )
+ {
+ Free_BaseArray( &mbp->BaseArray, mbp->ClassCount );
+ Free_MarkArray( &mbp->MarkArray );
+ Free_Coverage( &mbp->BaseCoverage );
+ Free_Coverage( &mbp->MarkCoverage );
+ }
+
+
+ static TT_Error Lookup_MarkBasePos( GPOS_Instance* gpi,
+ TTO_MarkBasePos* mbp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length )
+ {
+ TT_UInt i, j;
+ UShort mark_index, base_index, property, class;
+ TT_Pos x_mark_value, y_mark_value, x_base_value, y_base_value;
+ TT_Error error;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_MarkArray* ma;
+ TTO_BaseArray* ba;
+ TTO_BaseRecord* br;
+ TTO_Anchor* mark_anchor;
+ TTO_Anchor* base_anchor;
+
+ TTO_GPOS_Data* o;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( flags & IGNORE_BASE_GLYPHS )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gpos->gdef, in->string[in->pos],
+ flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &mbp->MarkCoverage, in->string[in->pos],
+ &mark_index );
+ if ( error )
+ return error;
+
+ /* now we search backwards for a non-mark glyph */
+
+ i = 1;
+ j = in->pos - 1;
+
+ while ( i <= in->pos )
+ {
+ error = TT_GDEF_Get_Glyph_Property( gpos->gdef, in->string[j],
+ &property );
+ if ( error )
+ return error;
+
+ if ( !( property == TTO_MARK || property & IGNORE_SPECIAL_MARKS ) )
+ break;
+
+ i++;
+ j--;
+ }
+
+ /* The following assertion is too strong -- at least for mangal.ttf. */
+#if 0
+ if ( property != TTO_BASE_GLYPH )
+ return TTO_Err_Not_Covered;
+#endif
+
+ if ( i > in->pos )
+ return TTO_Err_Not_Covered;
+
+ error = Coverage_Index( &mbp->BaseCoverage, in->string[j],
+ &base_index );
+ if ( error )
+ return error;
+
+ ma = &mbp->MarkArray;
+
+ if ( mark_index >= ma->MarkCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ class = ma->MarkRecord[mark_index].Class;
+ mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor;
+
+ if ( class >= mbp->ClassCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ ba = &mbp->BaseArray;
+
+ if ( base_index >= ba->BaseCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ br = &ba->BaseRecord[base_index];
+ base_anchor = &br->BaseAnchor[class];
+
+ error = Get_Anchor( gpi, mark_anchor, in->string[in->pos],
+ &x_mark_value, &y_mark_value );
+ if ( error )
+ return error;
+ error = Get_Anchor( gpi, base_anchor, in->string[j],
+ &x_base_value, &y_base_value );
+ if ( error )
+ return error;
+
+ /* anchor points are not cumulative */
+
+ o = &out[in->pos];
+
+ o->x_pos = x_base_value - x_mark_value;
+ o->y_pos = y_base_value - y_mark_value;
+ o->x_advance = 0;
+ o->y_advance = 0;
+ o->back = i;
+
+ (in->pos)++;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 5 */
+
+ /* LigatureAttach */
+
+ static TT_Error Load_LigatureAttach( TTO_LigatureAttach* lat,
+ UShort num_classes,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort m, n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ComponentRecord* cr;
+ TTO_Anchor* lan;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = lat->ComponentCount = GET_UShort();
+
+ FORGET_Frame();
+
+ lat->ComponentRecord = NULL;
+
+ if ( ALLOC_ARRAY( lat->ComponentRecord, count, TTO_ComponentRecord ) )
+ return error;
+
+ cr = lat->ComponentRecord;
+
+ for ( m = 0; m < count; m++ )
+ {
+ cr[m].LigatureAnchor = NULL;
+
+ if ( ALLOC_ARRAY( cr[m].LigatureAnchor, num_classes, TTO_Anchor ) )
+ goto Fail;
+
+ lan = cr[m].LigatureAnchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( new_offset )
+ {
+ new_offset += base_offset;
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Anchor( &lan[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ lan[n].PosFormat = 0;
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( m = 0; m < count; m++ )
+ {
+ lan = cr[m].LigatureAnchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ Free_Anchor( &lan[n] );
+
+ FREE( lan );
+ }
+
+ FREE( cr );
+ return error;
+ }
+
+
+ static void Free_LigatureAttach( TTO_LigatureAttach* lat,
+ UShort num_classes )
+ {
+ UShort m, n, count;
+
+ TTO_ComponentRecord* cr;
+ TTO_Anchor* lan;
+
+
+ if ( lat->ComponentRecord )
+ {
+ count = lat->ComponentCount;
+ cr = lat->ComponentRecord;
+
+ for ( m = 0; m < count; m++ )
+ {
+ lan = cr[m].LigatureAnchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ Free_Anchor( &lan[n] );
+
+ FREE( lan );
+ }
+
+ FREE( cr );
+ }
+ }
+
+
+ /* LigatureArray */
+
+ static TT_Error Load_LigatureArray( TTO_LigatureArray* la,
+ UShort num_classes,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_LigatureAttach* lat;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = la->LigatureCount = GET_UShort();
+
+ FORGET_Frame();
+
+ la->LigatureAttach = NULL;
+
+ if ( ALLOC_ARRAY( la->LigatureAttach, count, TTO_LigatureAttach ) )
+ return error;
+
+ lat = la->LigatureAttach;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LigatureAttach( &lat[n], num_classes,
+ input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_LigatureAttach( &lat[n], num_classes );
+
+ FREE( lat );
+ return error;
+ }
+
+
+ static void Free_LigatureArray( TTO_LigatureArray* la,
+ UShort num_classes )
+ {
+ UShort n, count;
+
+ TTO_LigatureAttach* lat;
+
+
+ if ( la->LigatureAttach )
+ {
+ count = la->LigatureCount;
+ lat = la->LigatureAttach;
+
+ for ( n = 0; n < count; n++ )
+ Free_LigatureAttach( &lat[n], num_classes );
+
+ FREE( lat );
+ }
+ }
+
+
+ /* MarkLigPosFormat1 */
+
+ TT_Error Load_MarkLigPos( TTO_MarkLigPos* mlp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ ULong cur_offset, new_offset, base_offset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ mlp->PosFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &mlp->MarkCoverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &mlp->LigatureCoverage,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail2;
+
+ mlp->ClassCount = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_MarkArray( &mlp->MarkArray, input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LigatureArray( &mlp->LigatureArray, mlp->ClassCount,
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ Free_MarkArray( &mlp->MarkArray );
+
+ Fail2:
+ Free_Coverage( &mlp->LigatureCoverage );
+
+ Fail3:
+ Free_Coverage( &mlp->MarkCoverage );
+ return error;
+ }
+
+
+ void Free_MarkLigPos( TTO_MarkLigPos* mlp )
+ {
+ Free_LigatureArray( &mlp->LigatureArray, mlp->ClassCount );
+ Free_MarkArray( &mlp->MarkArray );
+ Free_Coverage( &mlp->LigatureCoverage );
+ Free_Coverage( &mlp->MarkCoverage );
+ }
+
+
+ static TT_Error Lookup_MarkLigPos( GPOS_Instance* gpi,
+ TTO_MarkLigPos* mlp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length )
+ {
+ TT_UInt i, j;
+ UShort mark_index, lig_index, property, class;
+ UShort mark_glyph;
+ TT_Pos x_mark_value, y_mark_value, x_lig_value, y_lig_value;
+ TT_Error error;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_MarkArray* ma;
+ TTO_LigatureArray* la;
+ TTO_LigatureAttach* lat;
+ TTO_ComponentRecord* cr;
+ UShort comp_index;
+ TTO_Anchor* mark_anchor;
+ TTO_Anchor* lig_anchor;
+
+ TTO_GPOS_Data* o;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( flags & IGNORE_LIGATURES )
+ return TTO_Err_Not_Covered;
+
+ mark_glyph = in->string[in->pos];
+
+ if ( CHECK_Property( gpos->gdef, mark_glyph, flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &mlp->MarkCoverage, mark_glyph, &mark_index );
+ if ( error )
+ return error;
+
+ /* now we search backwards for a non-mark glyph */
+
+ i = 1;
+ j = in->pos - 1;
+
+ while ( i <= in->pos )
+ {
+ error = TT_GDEF_Get_Glyph_Property( gpos->gdef, in->string[j],
+ &property );
+ if ( error )
+ return error;
+
+ if ( !( property == TTO_MARK || property & IGNORE_SPECIAL_MARKS ) )
+ break;
+
+ i++;
+ j--;
+ }
+
+ /* Similar to Lookup_MarkBasePos(), I suspect that this assertion is
+ too strong, thus it is commented out. */
+#if 0
+ if ( property != TTO_LIGATURE )
+ return TTO_Err_Not_Covered;
+#endif
+
+ if ( i > in->pos )
+ return TTO_Err_Not_Covered;
+
+ error = Coverage_Index( &mlp->LigatureCoverage, in->string[j],
+ &lig_index );
+ if ( error )
+ return error;
+
+ ma = &mlp->MarkArray;
+
+ if ( mark_index >= ma->MarkCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ class = ma->MarkRecord[mark_index].Class;
+ mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor;
+
+ if ( class >= mlp->ClassCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ la = &mlp->LigatureArray;
+
+ if ( lig_index >= la->LigatureCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ lat = &la->LigatureAttach[lig_index];
+
+ /* We must now check whether the ligature ID of the current mark glyph
+ is identical to the ligature ID of the found ligature. If yes, we
+ can directly use the component index. If not, we attach the mark
+ glyph to the last component of the ligature. */
+
+ if ( in->ligIDs && in->components &&
+ in->ligIDs[j] == in->ligIDs[in->pos] )
+ {
+ comp_index = in->components[in->pos];
+ if ( comp_index >= lat->ComponentCount )
+ return TTO_Err_Not_Covered;
+ }
+ else
+ comp_index = lat->ComponentCount - 1;
+
+ cr = &lat->ComponentRecord[comp_index];
+ lig_anchor = &cr->LigatureAnchor[class];
+
+ error = Get_Anchor( gpi, mark_anchor, in->string[in->pos],
+ &x_mark_value, &y_mark_value );
+ if ( error )
+ return error;
+ error = Get_Anchor( gpi, lig_anchor, in->string[j],
+ &x_lig_value, &y_lig_value );
+ if ( error )
+ return error;
+
+ /* anchor points are not cumulative */
+
+ o = &out[in->pos];
+
+ o->x_pos = x_lig_value - x_mark_value;
+ o->y_pos = y_lig_value - y_mark_value;
+ o->x_advance = 0;
+ o->y_advance = 0;
+ o->back = i;
+
+ (in->pos)++;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 6 */
+
+ /* Mark2Array */
+
+ static TT_Error Load_Mark2Array( TTO_Mark2Array* m2a,
+ UShort num_classes,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort m, n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Mark2Record* m2r;
+ TTO_Anchor* m2an;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = m2a->Mark2Count = GET_UShort();
+
+ FORGET_Frame();
+
+ m2a->Mark2Record = NULL;
+
+ if ( ALLOC_ARRAY( m2a->Mark2Record, count, TTO_Mark2Record ) )
+ return error;
+
+ m2r = m2a->Mark2Record;
+
+ for ( m = 0; m < count; m++ )
+ {
+ m2r[m].Mark2Anchor = NULL;
+
+ if ( ALLOC_ARRAY( m2r[m].Mark2Anchor, num_classes, TTO_Anchor ) )
+ goto Fail;
+
+ m2an = m2r[m].Mark2Anchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Anchor( &m2an[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( m = 0; m < count; m++ )
+ {
+ m2an = m2r[m].Mark2Anchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ Free_Anchor( &m2an[n] );
+
+ FREE( m2an );
+ }
+
+ FREE( m2r );
+ return error;
+ }
+
+
+ static void Free_Mark2Array( TTO_Mark2Array* m2a,
+ UShort num_classes )
+ {
+ UShort m, n, count;
+
+ TTO_Mark2Record* m2r;
+ TTO_Anchor* m2an;
+
+
+ if ( m2a->Mark2Record )
+ {
+ count = m2a->Mark2Count;
+ m2r = m2a->Mark2Record;
+
+ for ( m = 0; m < count; m++ )
+ {
+ m2an = m2r[m].Mark2Anchor;
+
+ for ( n = 0; n < num_classes; n++ )
+ Free_Anchor( &m2an[n] );
+
+ FREE( m2an );
+ }
+
+ FREE( m2r );
+ }
+ }
+
+
+ /* MarkMarkPosFormat1 */
+
+ TT_Error Load_MarkMarkPos( TTO_MarkMarkPos* mmp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ ULong cur_offset, new_offset, base_offset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ mmp->PosFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &mmp->Mark1Coverage,
+ input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &mmp->Mark2Coverage,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail2;
+
+ mmp->ClassCount = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_MarkArray( &mmp->Mark1Array, input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Mark2Array( &mmp->Mark2Array, mmp->ClassCount,
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+
+ return TT_Err_Ok;
+
+ Fail1:
+ Free_MarkArray( &mmp->Mark1Array );
+
+ Fail2:
+ Free_Coverage( &mmp->Mark2Coverage );
+
+ Fail3:
+ Free_Coverage( &mmp->Mark1Coverage );
+ return error;
+ }
+
+
+ void Free_MarkMarkPos( TTO_MarkMarkPos* mmp )
+ {
+ Free_Mark2Array( &mmp->Mark2Array, mmp->ClassCount );
+ Free_MarkArray( &mmp->Mark1Array );
+ Free_Coverage( &mmp->Mark2Coverage );
+ Free_Coverage( &mmp->Mark1Coverage );
+ }
+
+
+ static TT_Error Lookup_MarkMarkPos( GPOS_Instance* gpi,
+ TTO_MarkMarkPos* mmp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length )
+ {
+ UShort j, mark1_index, mark2_index, property, class;
+ TT_Pos x_mark1_value, y_mark1_value,
+ x_mark2_value, y_mark2_value;
+ TT_Error error;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_MarkArray* ma1;
+ TTO_Mark2Array* ma2;
+ TTO_Mark2Record* m2r;
+ TTO_Anchor* mark1_anchor;
+ TTO_Anchor* mark2_anchor;
+
+ TTO_GPOS_Data* o;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( flags & IGNORE_MARKS )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gpos->gdef, in->string[in->pos],
+ flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &mmp->Mark1Coverage, in->string[in->pos],
+ &mark1_index );
+ if ( error )
+ return error;
+
+ /* now we check the preceding glyph whether it is a suitable
+ mark glyph */
+
+ if ( in->pos == 0 )
+ return TTO_Err_Not_Covered;
+
+ j = in->pos - 1;
+ error = TT_GDEF_Get_Glyph_Property( gpos->gdef, in->string[j],
+ &property );
+ if ( error )
+ return error;
+
+ if ( flags & IGNORE_SPECIAL_MARKS )
+ {
+ if ( property != (flags & 0xFF00) )
+ return TTO_Err_Not_Covered;
+ }
+ else
+ {
+ if ( property != TTO_MARK )
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &mmp->Mark2Coverage, in->string[j],
+ &mark2_index );
+ if ( error )
+ return error;
+
+ ma1 = &mmp->Mark1Array;
+
+ if ( mark1_index >= ma1->MarkCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ class = ma1->MarkRecord[mark1_index].Class;
+ mark1_anchor = &ma1->MarkRecord[mark1_index].MarkAnchor;
+
+ if ( class >= mmp->ClassCount )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ ma2 = &mmp->Mark2Array;
+
+ if ( mark2_index >= ma2->Mark2Count )
+ return TTO_Err_Invalid_GPOS_SubTable;
+
+ m2r = &ma2->Mark2Record[mark2_index];
+ mark2_anchor = &m2r->Mark2Anchor[class];
+
+ error = Get_Anchor( gpi, mark1_anchor, in->string[in->pos],
+ &x_mark1_value, &y_mark1_value );
+ if ( error )
+ return error;
+ error = Get_Anchor( gpi, mark2_anchor, in->string[j],
+ &x_mark2_value, &y_mark2_value );
+ if ( error )
+ return error;
+
+ /* anchor points are not cumulative */
+
+ o = &out[in->pos];
+
+ o->x_pos = x_mark2_value - x_mark1_value;
+ o->y_pos = y_mark2_value - y_mark1_value;
+ o->x_advance = 0;
+ o->y_advance = 0;
+ o->back = 1;
+
+ (in->pos)++;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* Do the actual positioning for a context positioning (either format
+ 7 or 8). This is only called after we've determined that the input
+ matches the subrule. */
+
+ static TT_Error Do_ContextPos( GPOS_Instance* gpi,
+ UShort GlyphCount,
+ UShort PosCount,
+ TTO_PosLookupRecord* pos,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ int nesting_level )
+ {
+ TT_Error error;
+ UShort i, old_pos;
+
+
+ i = 0;
+
+ while ( i < GlyphCount )
+ {
+ if ( PosCount && i == pos->SequenceIndex )
+ {
+ old_pos = in->pos;
+
+ /* Do a positioning */
+
+ error = Do_Glyph_Lookup( gpi, pos->LookupListIndex, in, out,
+ GlyphCount, nesting_level );
+
+ if ( error )
+ return error;
+
+ pos++;
+ PosCount--;
+ i += in->pos - old_pos;
+ }
+ else
+ {
+ i++;
+ (in->pos)++;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 7 */
+
+ /* PosRule */
+
+ static TT_Error Load_PosRule( TTO_PosRule* pr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* i;
+
+ TTO_PosLookupRecord* plr;
+
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ pr->GlyphCount = GET_UShort();
+ pr->PosCount = GET_UShort();
+
+ FORGET_Frame();
+
+ pr->Input = NULL;
+
+ count = pr->GlyphCount - 1; /* only GlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( pr->Input, count, UShort ) )
+ return error;
+
+ i = pr->Input;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ i[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ pr->PosLookupRecord = NULL;
+
+ count = pr->PosCount;
+
+ if ( ALLOC_ARRAY( pr->PosLookupRecord, count, TTO_PosLookupRecord ) )
+ goto Fail2;
+
+ plr = pr->PosLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ plr[n].SequenceIndex = GET_UShort();
+ plr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( plr );
+
+ Fail2:
+ FREE( i );
+ return error;
+ }
+
+
+ static void Free_PosRule( TTO_PosRule* pr )
+ {
+ FREE( pr->PosLookupRecord );
+ FREE( pr->Input );
+ }
+
+
+ /* PosRuleSet */
+
+ static TT_Error Load_PosRuleSet( TTO_PosRuleSet* prs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_PosRule* pr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = prs->PosRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ prs->PosRule = NULL;
+
+ if ( ALLOC_ARRAY( prs->PosRule, count, TTO_PosRule ) )
+ return error;
+
+ pr = prs->PosRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_PosRule( &pr[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_PosRule( &pr[n] );
+
+ FREE( pr );
+ return error;
+ }
+
+
+ static void Free_PosRuleSet( TTO_PosRuleSet* prs )
+ {
+ UShort n, count;
+
+ TTO_PosRule* pr;
+
+
+ if ( prs->PosRule )
+ {
+ count = prs->PosRuleCount;
+ pr = prs->PosRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_PosRule( &pr[n] );
+
+ FREE( pr );
+ }
+ }
+
+
+ /* ContextPosFormat1 */
+
+ static TT_Error Load_ContextPos1( TTO_ContextPosFormat1* cpf1,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_PosRuleSet* prs;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &cpf1->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = cpf1->PosRuleSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpf1->PosRuleSet = NULL;
+
+ if ( ALLOC_ARRAY( cpf1->PosRuleSet, count, TTO_PosRuleSet ) )
+ goto Fail2;
+
+ prs = cpf1->PosRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_PosRuleSet( &prs[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_PosRuleSet( &prs[n] );
+
+ FREE( prs );
+
+ Fail2:
+ Free_Coverage( &cpf1->Coverage );
+ return error;
+ }
+
+
+ static void Free_Context1( TTO_ContextPosFormat1* cpf1 )
+ {
+ UShort n, count;
+
+ TTO_PosRuleSet* prs;
+
+
+ if ( cpf1->PosRuleSet )
+ {
+ count = cpf1->PosRuleSetCount;
+ prs = cpf1->PosRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_PosRuleSet( &prs[n] );
+
+ FREE( prs );
+ }
+
+ Free_Coverage( &cpf1->Coverage );
+ }
+
+
+ /* PosClassRule */
+
+ static TT_Error Load_PosClassRule( TTO_ContextPosFormat2* cpf2,
+ TTO_PosClassRule* pcr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* c;
+ TTO_PosLookupRecord* plr;
+ Bool* d;
+
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ pcr->GlyphCount = GET_UShort();
+ pcr->PosCount = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( pcr->GlyphCount > cpf2->MaxContextLength )
+ cpf2->MaxContextLength = pcr->GlyphCount;
+
+ pcr->Class = NULL;
+
+ count = pcr->GlyphCount - 1; /* only GlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( pcr->Class, count, UShort ) )
+ return error;
+
+ c = pcr->Class;
+ d = cpf2->ClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ {
+ c[n] = GET_UShort();
+
+ /* We check whether the specific class is used at all. If not,
+ class 0 is used instead. */
+
+ if ( !d[c[n]] )
+ c[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ pcr->PosLookupRecord = NULL;
+
+ count = pcr->PosCount;
+
+ if ( ALLOC_ARRAY( pcr->PosLookupRecord, count, TTO_PosLookupRecord ) )
+ goto Fail2;
+
+ plr = pcr->PosLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ plr[n].SequenceIndex = GET_UShort();
+ plr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( plr );
+
+ Fail2:
+ FREE( c );
+ return error;
+ }
+
+
+ static void Free_PosClassRule( TTO_PosClassRule* pcr )
+ {
+ FREE( pcr->PosLookupRecord );
+ FREE( pcr->Class );
+ }
+
+
+ /* PosClassSet */
+
+ static TT_Error Load_PosClassSet( TTO_ContextPosFormat2* cpf2,
+ TTO_PosClassSet* pcs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_PosClassRule* pcr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = pcs->PosClassRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ pcs->PosClassRule = NULL;
+
+ if ( ALLOC_ARRAY( pcs->PosClassRule, count, TTO_PosClassRule ) )
+ return error;
+
+ pcr = pcs->PosClassRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_PosClassRule( cpf2, &pcr[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_PosClassRule( &pcr[n] );
+
+ FREE( pcr );
+ return error;
+ }
+
+
+ static void Free_PosClassSet( TTO_PosClassSet* pcs )
+ {
+ UShort n, count;
+
+ TTO_PosClassRule* pcr;
+
+
+ if ( pcs->PosClassRule )
+ {
+ count = pcs->PosClassRuleCount;
+ pcr = pcs->PosClassRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_PosClassRule( &pcr[n] );
+
+ FREE( pcr );
+ }
+ }
+
+
+ /* ContextPosFormat2 */
+
+ static TT_Error Load_ContextPos2( TTO_ContextPosFormat2* cpf2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_PosClassSet* pcs;
+
+
+ base_offset = FILE_Pos() - 2;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &cpf2->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ /* `PosClassSetCount' is the upper limit for class values, thus we
+ read it now to make an additional safety check. */
+
+ count = cpf2->PosClassSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ClassDefinition( &cpf2->ClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ cpf2->PosClassSet = NULL;
+ cpf2->MaxContextLength = 0;
+
+ if ( ALLOC_ARRAY( cpf2->PosClassSet, count, TTO_PosClassSet ) )
+ goto Fail2;
+
+ pcs = cpf2->PosClassSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ if ( new_offset != base_offset ) /* not a NULL offset */
+ {
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_PosClassSet( cpf2, &pcs[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ /* we create a PosClassSet table with no entries */
+
+ cpf2->PosClassSet[n].PosClassRuleCount = 0;
+ cpf2->PosClassSet[n].PosClassRule = NULL;
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_PosClassSet( &pcs[n] );
+
+ FREE( pcs );
+
+ Fail2:
+ Free_ClassDefinition( &cpf2->ClassDef );
+
+ Fail3:
+ Free_Coverage( &cpf2->Coverage );
+ return error;
+ }
+
+
+ static void Free_Context2( TTO_ContextPosFormat2* cpf2 )
+ {
+ UShort n, count;
+
+ TTO_PosClassSet* pcs;
+
+
+ if ( cpf2->PosClassSet )
+ {
+ count = cpf2->PosClassSetCount;
+ pcs = cpf2->PosClassSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_PosClassSet( &pcs[n] );
+
+ FREE( pcs );
+ }
+
+ Free_ClassDefinition( &cpf2->ClassDef );
+ Free_Coverage( &cpf2->Coverage );
+ }
+
+
+ /* ContextPosFormat3 */
+
+ static TT_Error Load_ContextPos3( TTO_ContextPosFormat3* cpf3,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Coverage* c;
+ TTO_PosLookupRecord* plr;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ cpf3->GlyphCount = GET_UShort();
+ cpf3->PosCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpf3->Coverage = NULL;
+
+ count = cpf3->GlyphCount;
+
+ if ( ALLOC_ARRAY( cpf3->Coverage, count, TTO_Coverage ) )
+ return error;
+
+ c = cpf3->Coverage;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &c[n], input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ cpf3->PosLookupRecord = NULL;
+
+ count = cpf3->PosCount;
+
+ if ( ALLOC_ARRAY( cpf3->PosLookupRecord, count, TTO_PosLookupRecord ) )
+ goto Fail2;
+
+ plr = cpf3->PosLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ plr[n].SequenceIndex = GET_UShort();
+ plr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( plr );
+
+ Fail2:
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ return error;
+ }
+
+
+ static void Free_Context3( TTO_ContextPosFormat3* cpf3 )
+ {
+ UShort n, count;
+
+ TTO_Coverage* c;
+
+
+ FREE( cpf3->PosLookupRecord );
+
+ if ( cpf3->Coverage )
+ {
+ count = cpf3->GlyphCount;
+ c = cpf3->Coverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+ }
+
+
+ /* ContextPos */
+
+ TT_Error Load_ContextPos( TTO_ContextPos* cp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cp->PosFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( cp->PosFormat )
+ {
+ case 1:
+ return Load_ContextPos1( &cp->cpf.cpf1, input );
+
+ case 2:
+ return Load_ContextPos2( &cp->cpf.cpf2, input );
+
+ case 3:
+ return Load_ContextPos3( &cp->cpf.cpf3, input );
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ void Free_ContextPos( TTO_ContextPos* cp )
+ {
+ switch ( cp->PosFormat )
+ {
+ case 1:
+ Free_Context1( &cp->cpf.cpf1 );
+ break;
+
+ case 2:
+ Free_Context2( &cp->cpf.cpf2 );
+ break;
+
+ case 3:
+ Free_Context3( &cp->cpf.cpf3 );
+ break;
+ }
+ }
+
+
+ static TT_Error Lookup_ContextPos1( GPOS_Instance* gpi,
+ TTO_ContextPosFormat1* cpf1,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ UShort i, j, k, numpr;
+ TT_Error error;
+ UShort* s_in;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_PosRule* pr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gpos->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &cpf1->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ pr = cpf1->PosRuleSet[index].PosRule;
+ numpr = cpf1->PosRuleSet[index].PosRuleCount;
+
+ for ( k = 0; k < numpr; k++ )
+ {
+ if ( context_length != 0xFFFF && context_length < pr[k].GlyphCount )
+ continue;
+
+ if ( in->pos + pr[k].GlyphCount > in->length )
+ continue; /* context is too long */
+
+ s_in = &in->string[in->pos];
+
+ for ( i = 1, j = 1; i < pr[k].GlyphCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( s_in[j] != pr[k].Input[i - 1] )
+ break;
+ }
+
+ if ( i == pr[k].GlyphCount )
+ return Do_ContextPos( gpi, pr[k].GlyphCount,
+ pr[k].PosCount, pr[k].PosLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ static TT_Error Lookup_ContextPos2( GPOS_Instance* gpi,
+ TTO_ContextPosFormat2* cpf2,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_Error error;
+ UShort i, j, k, known_classes;
+
+ UShort* classes;
+ UShort* s_in;
+ UShort* cl;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_PosClassSet* pcs;
+ TTO_PosClassRule* pr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gpos->gdef;
+
+ if ( ALLOC_ARRAY( classes, cpf2->MaxContextLength, UShort ) )
+ return error;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ /* Note: The coverage table in format 2 doesn't give an index into
+ anything. It just lets us know whether or not we need to
+ do any lookup at all. */
+
+ error = Coverage_Index( &cpf2->Coverage, in->string[in->pos], &index );
+ if ( error )
+ goto End;
+
+ error = Get_Class( &cpf2->ClassDef, in->string[in->pos],
+ &classes[0], NULL );
+ if ( error )
+ goto End;
+ known_classes = 0;
+
+ pcs = &cpf2->PosClassSet[classes[0]];
+ if ( !pcs )
+ {
+ error = TTO_Err_Invalid_GPOS_SubTable;
+ goto End;
+ }
+
+ for ( k = 0; k < pcs->PosClassRuleCount; k++ )
+ {
+ pr = &pcs->PosClassRule[k];
+
+ if ( context_length != 0xFFFF && context_length < pr->GlyphCount )
+ continue;
+
+ if ( in->pos + pr->GlyphCount > in->length )
+ continue; /* context is too long */
+
+ s_in = &in->string[in->pos];
+ cl = pr->Class;
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < pr->GlyphCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( i > known_classes )
+ {
+ /* Keeps us from having to do this for each rule */
+
+ error = Get_Class( &cpf2->ClassDef, s_in[j], &classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ known_classes = i;
+ }
+
+ if ( cl[i - 1] != classes[i] )
+ break;
+ }
+
+ if ( i == pr->GlyphCount )
+ {
+ error = Do_ContextPos( gpi, pr->GlyphCount,
+ pr->PosCount, pr->PosLookupRecord,
+ in, out,
+ nesting_level );
+ goto End;
+ }
+ }
+
+ error = TTO_Err_Not_Covered;
+
+ End:
+ FREE( classes );
+ return error;
+ }
+
+
+ static TT_Error Lookup_ContextPos3( GPOS_Instance* gpi,
+ TTO_ContextPosFormat3* cpf3,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ TT_Error error;
+ UShort index, i, j, property;
+ UShort* s_in;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_Coverage* c;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gpos->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ if ( context_length != 0xFFFF && context_length < cpf3->GlyphCount )
+ return TTO_Err_Not_Covered;
+
+ if ( in->pos + cpf3->GlyphCount > in->length )
+ return TTO_Err_Not_Covered; /* context is too long */
+
+ s_in = &in->string[in->pos];
+ c = cpf3->Coverage;
+
+ for ( i = 1, j = 1; i < cpf3->GlyphCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &c[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+
+ return Do_ContextPos( gpi, cpf3->GlyphCount,
+ cpf3->PosCount, cpf3->PosLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+
+ static TT_Error Lookup_ContextPos( GPOS_Instance* gpi,
+ TTO_ContextPos* cp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ switch ( cp->PosFormat )
+ {
+ case 1:
+ return Lookup_ContextPos1( gpi, &cp->cpf.cpf1, in, out,
+ flags, context_length, nesting_level );
+
+ case 2:
+ return Lookup_ContextPos2( gpi, &cp->cpf.cpf2, in, out,
+ flags, context_length, nesting_level );
+
+ case 3:
+ return Lookup_ContextPos3( gpi, &cp->cpf.cpf3, in, out,
+ flags, context_length, nesting_level );
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ /* LookupType 8 */
+
+ /* ChainPosRule */
+
+ static TT_Error Load_ChainPosRule( TTO_ChainPosRule* cpr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* b;
+ UShort* i;
+ UShort* l;
+
+ TTO_PosLookupRecord* plr;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cpr->BacktrackGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpr->Backtrack = NULL;
+
+ count = cpr->BacktrackGlyphCount;
+
+ if ( ALLOC_ARRAY( cpr->Backtrack, count, UShort ) )
+ return error;
+
+ b = cpr->Backtrack;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail4;
+
+ for ( n = 0; n < count; n++ )
+ b[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ cpr->InputGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpr->Input = NULL;
+
+ count = cpr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( cpr->Input, count, UShort ) )
+ goto Fail4;
+
+ i = cpr->Input;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail3;
+
+ for ( n = 0; n < count; n++ )
+ i[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ cpr->LookaheadGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpr->Lookahead = NULL;
+
+ count = cpr->LookaheadGlyphCount;
+
+ if ( ALLOC_ARRAY( cpr->Lookahead, count, UShort ) )
+ goto Fail3;
+
+ l = cpr->Lookahead;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ l[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ cpr->PosCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpr->PosLookupRecord = NULL;
+
+ count = cpr->PosCount;
+
+ if ( ALLOC_ARRAY( cpr->PosLookupRecord, count, TTO_PosLookupRecord ) )
+ goto Fail2;
+
+ plr = cpr->PosLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ plr[n].SequenceIndex = GET_UShort();
+ plr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( plr );
+
+ Fail2:
+ FREE( l );
+
+ Fail3:
+ FREE( i );
+
+ Fail4:
+ FREE( b );
+ return error;
+ }
+
+
+ static void Free_ChainPosRule( TTO_ChainPosRule* cpr )
+ {
+ FREE( cpr->PosLookupRecord );
+ FREE( cpr->Lookahead );
+ FREE( cpr->Input );
+ FREE( cpr->Backtrack );
+ }
+
+
+ /* ChainPosRuleSet */
+
+ static TT_Error Load_ChainPosRuleSet( TTO_ChainPosRuleSet* cprs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ChainPosRule* cpr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = cprs->ChainPosRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cprs->ChainPosRule = NULL;
+
+ if ( ALLOC_ARRAY( cprs->ChainPosRule, count, TTO_ChainPosRule ) )
+ return error;
+
+ cpr = cprs->ChainPosRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainPosRule( &cpr[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosRule( &cpr[n] );
+
+ FREE( cpr );
+ return error;
+ }
+
+
+ static void Free_ChainPosRuleSet( TTO_ChainPosRuleSet* cprs )
+ {
+ UShort n, count;
+
+ TTO_ChainPosRule* cpr;
+
+
+ if ( cprs->ChainPosRule )
+ {
+ count = cprs->ChainPosRuleCount;
+ cpr = cprs->ChainPosRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosRule( &cpr[n] );
+
+ FREE( cpr );
+ }
+ }
+
+
+ /* ChainContextPosFormat1 */
+
+ static TT_Error Load_ChainContextPos1( TTO_ChainContextPosFormat1* ccpf1,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ChainPosRuleSet* cprs;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ccpf1->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = ccpf1->ChainPosRuleSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccpf1->ChainPosRuleSet = NULL;
+
+ if ( ALLOC_ARRAY( ccpf1->ChainPosRuleSet, count, TTO_ChainPosRuleSet ) )
+ goto Fail2;
+
+ cprs = ccpf1->ChainPosRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainPosRuleSet( &cprs[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosRuleSet( &cprs[n] );
+
+ FREE( cprs );
+
+ Fail2:
+ Free_Coverage( &ccpf1->Coverage );
+ return error;
+ }
+
+
+ static void Free_ChainContext1( TTO_ChainContextPosFormat1* ccpf1 )
+ {
+ UShort n, count;
+
+ TTO_ChainPosRuleSet* cprs;
+
+
+ if ( ccpf1->ChainPosRuleSet )
+ {
+ count = ccpf1->ChainPosRuleSetCount;
+ cprs = ccpf1->ChainPosRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosRuleSet( &cprs[n] );
+
+ FREE( cprs );
+ }
+
+ Free_Coverage( &ccpf1->Coverage );
+ }
+
+
+ /* ChainPosClassRule */
+
+ static TT_Error Load_ChainPosClassRule(
+ TTO_ChainContextPosFormat2* ccpf2,
+ TTO_ChainPosClassRule* cpcr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* b;
+ UShort* i;
+ UShort* l;
+ TTO_PosLookupRecord* plr;
+ Bool* d;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cpcr->BacktrackGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( cpcr->BacktrackGlyphCount > ccpf2->MaxBacktrackLength )
+ ccpf2->MaxBacktrackLength = cpcr->BacktrackGlyphCount;
+
+ cpcr->Backtrack = NULL;
+
+ count = cpcr->BacktrackGlyphCount;
+
+ if ( ALLOC_ARRAY( cpcr->Backtrack, count, UShort ) )
+ return error;
+
+ b = cpcr->Backtrack;
+ d = ccpf2->BacktrackClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail4;
+
+ for ( n = 0; n < count; n++ )
+ {
+ b[n] = GET_UShort();
+
+ /* We check whether the specific class is used at all. If not,
+ class 0 is used instead. */
+
+ if ( !d[b[n]] )
+ b[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ cpcr->InputGlyphCount = GET_UShort();
+
+ if ( cpcr->InputGlyphCount > ccpf2->MaxInputLength )
+ ccpf2->MaxInputLength = cpcr->InputGlyphCount;
+
+ FORGET_Frame();
+
+ cpcr->Input = NULL;
+
+ count = cpcr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( cpcr->Input, count, UShort ) )
+ goto Fail4;
+
+ i = cpcr->Input;
+ d = ccpf2->InputClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail3;
+
+ for ( n = 0; n < count; n++ )
+ {
+ i[n] = GET_UShort();
+
+ if ( !d[i[n]] )
+ i[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ cpcr->LookaheadGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( cpcr->LookaheadGlyphCount > ccpf2->MaxLookaheadLength )
+ ccpf2->MaxLookaheadLength = cpcr->LookaheadGlyphCount;
+
+ cpcr->Lookahead = NULL;
+
+ count = cpcr->LookaheadGlyphCount;
+
+ if ( ALLOC_ARRAY( cpcr->Lookahead, count, UShort ) )
+ goto Fail3;
+
+ l = cpcr->Lookahead;
+ d = ccpf2->LookaheadClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ {
+ l[n] = GET_UShort();
+
+ if ( !d[l[n]] )
+ l[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ cpcr->PosCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpcr->PosLookupRecord = NULL;
+
+ count = cpcr->PosCount;
+
+ if ( ALLOC_ARRAY( cpcr->PosLookupRecord, count, TTO_PosLookupRecord ) )
+ goto Fail2;
+
+ plr = cpcr->PosLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ plr[n].SequenceIndex = GET_UShort();
+ plr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( plr );
+
+ Fail2:
+ FREE( l );
+
+ Fail3:
+ FREE( i );
+
+ Fail4:
+ FREE( b );
+ return error;
+ }
+
+
+ static void Free_ChainPosClassRule( TTO_ChainPosClassRule* cpcr )
+ {
+ FREE( cpcr->PosLookupRecord );
+ FREE( cpcr->Lookahead );
+ FREE( cpcr->Input );
+ FREE( cpcr->Backtrack );
+ }
+
+
+ /* PosClassSet */
+
+ static TT_Error Load_ChainPosClassSet(
+ TTO_ChainContextPosFormat2* ccpf2,
+ TTO_ChainPosClassSet* cpcs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ChainPosClassRule* cpcr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = cpcs->ChainPosClassRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cpcs->ChainPosClassRule = NULL;
+
+ if ( ALLOC_ARRAY( cpcs->ChainPosClassRule, count,
+ TTO_ChainPosClassRule ) )
+ return error;
+
+ cpcr = cpcs->ChainPosClassRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainPosClassRule( ccpf2, &cpcr[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosClassRule( &cpcr[n] );
+
+ FREE( cpcr );
+ return error;
+ }
+
+
+ static void Free_ChainPosClassSet( TTO_ChainPosClassSet* cpcs )
+ {
+ UShort n, count;
+
+ TTO_ChainPosClassRule* cpcr;
+
+
+ if ( cpcs->ChainPosClassRule )
+ {
+ count = cpcs->ChainPosClassRuleCount;
+ cpcr = cpcs->ChainPosClassRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosClassRule( &cpcr[n] );
+
+ FREE( cpcr );
+ }
+ }
+
+
+ /* ChainContextPosFormat2 */
+
+ static TT_Error Load_ChainContextPos2( TTO_ChainContextPosFormat2* ccpf2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+ ULong backtrack_offset, input_offset, lookahead_offset;
+
+ TTO_ChainPosClassSet* cpcs;
+
+
+ base_offset = FILE_Pos() - 2;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ccpf2->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 8L ) )
+ goto Fail5;
+
+ backtrack_offset = GET_UShort() + base_offset;
+ input_offset = GET_UShort() + base_offset;
+ lookahead_offset = GET_UShort() + base_offset;
+
+ /* `ChainPosClassSetCount' is the upper limit for input class values,
+ thus we read it now to make an additional safety check. */
+
+ count = ccpf2->ChainPosClassSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ /* backtrack and lookahead data can be optional */
+
+ cur_offset = FILE_Pos();
+ if ( backtrack_offset != base_offset )
+ {
+ if ( FILE_Seek( backtrack_offset ) ||
+ ( error = Load_ClassDefinition( &ccpf2->BacktrackClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail5;
+ }
+ if ( FILE_Seek( input_offset ) ||
+ ( error = Load_ClassDefinition( &ccpf2->InputClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail4;
+ if ( lookahead_offset != base_offset )
+ {
+ if ( FILE_Seek( lookahead_offset ) ||
+ ( error = Load_ClassDefinition( &ccpf2->LookaheadClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ }
+ (void)FILE_Seek( cur_offset );
+
+ ccpf2->ChainPosClassSet = NULL;
+ ccpf2->MaxBacktrackLength = 0;
+ ccpf2->MaxInputLength = 0;
+ ccpf2->MaxLookaheadLength = 0;
+
+ if ( ALLOC_ARRAY( ccpf2->ChainPosClassSet, count, TTO_ChainPosClassSet ) )
+ goto Fail2;
+
+ cpcs = ccpf2->ChainPosClassSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ if ( new_offset != base_offset ) /* not a NULL offset */
+ {
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainPosClassSet( ccpf2, &cpcs[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ /* we create a ChainPosClassSet table with no entries */
+
+ ccpf2->ChainPosClassSet[n].ChainPosClassRuleCount = 0;
+ ccpf2->ChainPosClassSet[n].ChainPosClassRule = NULL;
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosClassSet( &cpcs[n] );
+
+ FREE( cpcs );
+
+ Fail2:
+ Free_ClassDefinition( &ccpf2->LookaheadClassDef );
+
+ Fail3:
+ Free_ClassDefinition( &ccpf2->InputClassDef );
+
+ Fail4:
+ Free_ClassDefinition( &ccpf2->BacktrackClassDef );
+
+ Fail5:
+ Free_Coverage( &ccpf2->Coverage );
+ return error;
+ }
+
+
+ static void Free_ChainContext2( TTO_ChainContextPosFormat2* ccpf2 )
+ {
+ UShort n, count;
+
+ TTO_ChainPosClassSet* cpcs;
+
+
+ if ( ccpf2->ChainPosClassSet )
+ {
+ count = ccpf2->ChainPosClassSetCount;
+ cpcs = ccpf2->ChainPosClassSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainPosClassSet( &cpcs[n] );
+
+ FREE( cpcs );
+ }
+
+ Free_ClassDefinition( &ccpf2->LookaheadClassDef );
+ Free_ClassDefinition( &ccpf2->InputClassDef );
+ Free_ClassDefinition( &ccpf2->BacktrackClassDef );
+
+ Free_Coverage( &ccpf2->Coverage );
+ }
+
+
+ /* ChainContextPosFormat3 */
+
+ static TT_Error Load_ChainContextPos3( TTO_ChainContextPosFormat3* ccpf3,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort backtrack_count, input_count, lookahead_count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Coverage* b;
+ TTO_Coverage* i;
+ TTO_Coverage* l;
+ TTO_PosLookupRecord* plr;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ ccpf3->BacktrackGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccpf3->BacktrackCoverage = NULL;
+
+ backtrack_count = ccpf3->BacktrackGlyphCount;
+
+ if ( ALLOC_ARRAY( ccpf3->BacktrackCoverage, backtrack_count,
+ TTO_Coverage ) )
+ return error;
+
+ b = ccpf3->BacktrackCoverage;
+
+ for ( n = 0; n < backtrack_count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &b[n], input ) ) != TT_Err_Ok )
+ goto Fail4;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ ccpf3->InputGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccpf3->InputCoverage = NULL;
+
+ input_count = ccpf3->InputGlyphCount;
+
+ if ( ALLOC_ARRAY( ccpf3->InputCoverage, input_count, TTO_Coverage ) )
+ goto Fail4;
+
+ i = ccpf3->InputCoverage;
+
+ for ( n = 0; n < input_count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &i[n], input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ ccpf3->LookaheadGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccpf3->LookaheadCoverage = NULL;
+
+ lookahead_count = ccpf3->LookaheadGlyphCount;
+
+ if ( ALLOC_ARRAY( ccpf3->LookaheadCoverage, lookahead_count,
+ TTO_Coverage ) )
+ goto Fail3;
+
+ l = ccpf3->LookaheadCoverage;
+
+ for ( n = 0; n < lookahead_count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &l[n], input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ ccpf3->PosCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccpf3->PosLookupRecord = NULL;
+
+ count = ccpf3->PosCount;
+
+ if ( ALLOC_ARRAY( ccpf3->PosLookupRecord, count, TTO_PosLookupRecord ) )
+ goto Fail2;
+
+ plr = ccpf3->PosLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ plr[n].SequenceIndex = GET_UShort();
+ plr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( plr );
+
+ Fail2:
+ for ( n = 0; n < lookahead_count; n++ )
+ Free_Coverage( &l[n] );
+
+ FREE( l );
+
+ Fail3:
+ for ( n = 0; n < input_count; n++ )
+ Free_Coverage( &i[n] );
+
+ FREE( i );
+
+ Fail4:
+ for ( n = 0; n < backtrack_count; n++ )
+ Free_Coverage( &b[n] );
+
+ FREE( b );
+ return error;
+ }
+
+
+ static void Free_ChainContext3( TTO_ChainContextPosFormat3* ccpf3 )
+ {
+ UShort n, count;
+
+ TTO_Coverage* c;
+
+
+ FREE( ccpf3->PosLookupRecord );
+
+ if ( ccpf3->LookaheadCoverage )
+ {
+ count = ccpf3->LookaheadGlyphCount;
+ c = ccpf3->LookaheadCoverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+
+ if ( ccpf3->InputCoverage )
+ {
+ count = ccpf3->InputGlyphCount;
+ c = ccpf3->InputCoverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+
+ if ( ccpf3->BacktrackCoverage )
+ {
+ count = ccpf3->BacktrackGlyphCount;
+ c = ccpf3->BacktrackCoverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+ }
+
+
+ /* ChainContextPos */
+
+ TT_Error Load_ChainContextPos( TTO_ChainContextPos* ccp,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ ccp->PosFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( ccp->PosFormat )
+ {
+ case 1:
+ return Load_ChainContextPos1( &ccp->ccpf.ccpf1, input );
+
+ case 2:
+ return Load_ChainContextPos2( &ccp->ccpf.ccpf2, input );
+
+ case 3:
+ return Load_ChainContextPos3( &ccp->ccpf.ccpf3, input );
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ void Free_ChainContextPos( TTO_ChainContextPos* ccp )
+ {
+ switch ( ccp->PosFormat )
+ {
+ case 1:
+ Free_ChainContext1( &ccp->ccpf.ccpf1 );
+ break;
+
+ case 2:
+ Free_ChainContext2( &ccp->ccpf.ccpf2 );
+ break;
+
+ case 3:
+ Free_ChainContext3( &ccp->ccpf.ccpf3 );
+ break;
+ }
+ }
+
+
+ static TT_Error Lookup_ChainContextPos1(
+ GPOS_Instance* gpi,
+ TTO_ChainContextPosFormat1* ccpf1,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ TT_UInt flags,
+ TT_UInt context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_UInt i, j, k, num_cpr, curr_pos;
+ TT_UInt bgc, igc, lgc;
+ TT_Error error;
+ UShort* s_in;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_ChainPosRule* cpr;
+ TTO_ChainPosRule curr_cpr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gpos->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &ccpf1->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ cpr = ccpf1->ChainPosRuleSet[index].ChainPosRule;
+ num_cpr = ccpf1->ChainPosRuleSet[index].ChainPosRuleCount;
+
+ for ( k = 0; k < num_cpr; k++ )
+ {
+ curr_cpr = cpr[k];
+ bgc = curr_cpr.BacktrackGlyphCount;
+ igc = curr_cpr.InputGlyphCount;
+ lgc = curr_cpr.LookaheadGlyphCount;
+
+ if ( context_length != 0xFFFF && context_length < igc )
+ continue;
+
+ /* check whether context is too long; it is a first guess only */
+
+ if ( bgc > in->pos || in->pos + igc + lgc > in->length )
+ continue;
+
+ if ( bgc )
+ {
+ /* Since we don't know in advance the number of glyphs to inspect,
+ we search backwards for matches in the backtrack glyph array */
+
+ curr_pos = 0;
+ s_in = &in->string[curr_pos];
+
+ for ( i = 0, j = in->pos - 1; i < bgc; i++, j-- )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( j > curr_pos )
+ j--;
+ else
+ break;
+ }
+
+ /* In OpenType 1.3, it is undefined whether the offsets of
+ backtrack glyphs is in logical order or not. Version 1.4
+ will clarify this:
+
+ Logical order - a b c d e f g h i j
+ i
+ Input offsets - 0 1
+ Backtrack offsets - 3 2 1 0
+ Lookahead offsets - 0 1 2 3 */
+
+ if ( s_in[j] != curr_cpr.Backtrack[i] )
+ break;
+ }
+
+ if ( i != bgc )
+ continue;
+ }
+
+ curr_pos = in->pos;
+ s_in = &in->string[curr_pos];
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < igc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( s_in[j] != curr_cpr.Input[i - 1] )
+ break;
+ }
+
+ if ( i != igc )
+ continue;
+
+ /* we are starting to check for lookahead glyphs right after the
+ last context glyph */
+
+ curr_pos = j;
+ s_in = &in->string[curr_pos];
+
+ for ( i = 0, j = 0; i < lgc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( s_in[j] != curr_cpr.Lookahead[i] )
+ break;
+ }
+
+ if ( i == lgc )
+ return Do_ContextPos( gpi, igc,
+ curr_cpr.PosCount,
+ curr_cpr.PosLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ static TT_Error Lookup_ChainContextPos2(
+ GPOS_Instance* gpi,
+ TTO_ChainContextPosFormat2* ccpf2,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ TT_UInt flags,
+ TT_UInt context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_Error error;
+ TT_UInt i, j, k, curr_pos;
+ TT_UInt bgc, igc, lgc;
+ UShort known_backtrack_classes,
+ known_input_classes,
+ known_lookahead_classes;
+
+ UShort* backtrack_classes;
+ UShort* input_classes;
+ UShort* lookahead_classes;
+
+ UShort* s_in;
+
+ UShort* bc;
+ UShort* ic;
+ UShort* lc;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_ChainPosClassSet* cpcs;
+ TTO_ChainPosClassRule cpcr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gpos->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ /* Note: The coverage table in format 2 doesn't give an index into
+ anything. It just lets us know whether or not we need to
+ do any lookup at all. */
+
+ error = Coverage_Index( &ccpf2->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ if ( ALLOC_ARRAY( backtrack_classes, ccpf2->MaxBacktrackLength, UShort ) )
+ return error;
+ known_backtrack_classes = 0;
+
+ if ( ALLOC_ARRAY( input_classes, ccpf2->MaxInputLength, UShort ) )
+ goto End3;
+ known_input_classes = 1;
+
+ if ( ALLOC_ARRAY( lookahead_classes, ccpf2->MaxLookaheadLength, UShort ) )
+ goto End2;
+ known_lookahead_classes = 0;
+
+ error = Get_Class( &ccpf2->InputClassDef, in->string[in->pos],
+ &input_classes[0], NULL );
+ if ( error )
+ goto End1;
+
+ cpcs = &ccpf2->ChainPosClassSet[input_classes[0]];
+ if ( !cpcs )
+ {
+ error = TTO_Err_Invalid_GPOS_SubTable;
+ goto End1;
+ }
+
+ for ( k = 0; k < (TT_UInt)cpcs->ChainPosClassRuleCount; k++ )
+ {
+ cpcr = cpcs->ChainPosClassRule[k];
+ bgc = cpcr.BacktrackGlyphCount;
+ igc = cpcr.InputGlyphCount;
+ lgc = cpcr.LookaheadGlyphCount;
+
+ if ( context_length != 0xFFFF && context_length < igc )
+ continue;
+
+ /* check whether context is too long; it is a first guess only */
+
+ if ( bgc > in->pos || in->pos + igc + lgc > in->length )
+ continue;
+
+ if ( bgc )
+ {
+ /* Since we don't know in advance the number of glyphs to inspect,
+ we search backwards for matches in the backtrack glyph array.
+ Note that `known_backtrack_classes' starts at index 0. */
+
+ curr_pos = 0;
+ s_in = &in->string[curr_pos];
+ bc = cpcr.Backtrack;
+
+ for ( i = 0, j = in->pos - 1; i < bgc; i++, j-- )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( j > curr_pos )
+ j--;
+ else
+ break;
+ }
+
+ if ( i >= (TT_UInt)known_backtrack_classes )
+ {
+ /* Keeps us from having to do this for each rule */
+
+ error = Get_Class( &ccpf2->BacktrackClassDef, s_in[j],
+ &backtrack_classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+ known_backtrack_classes = i;
+ }
+
+ if ( bc[i] != backtrack_classes[i] )
+ break;
+ }
+
+ if ( i != bgc )
+ continue;
+ }
+
+ curr_pos = in->pos;
+ s_in = &in->string[curr_pos];
+ ic = cpcr.Input;
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < igc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( i >= (TT_UInt)known_input_classes )
+ {
+ error = Get_Class( &ccpf2->InputClassDef, s_in[j],
+ &input_classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+ known_input_classes = i;
+ }
+
+ if ( ic[i - 1] != input_classes[i] )
+ break;
+ }
+
+ if ( i != igc )
+ continue;
+
+ /* we are starting to check for lookahead glyphs right after the
+ last context glyph */
+
+ curr_pos = j;
+ s_in = &in->string[curr_pos];
+ lc = cpcr.Lookahead;
+
+ for ( i = 0, j = 0; i < lgc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( i >= (TT_UInt)known_lookahead_classes )
+ {
+ error = Get_Class( &ccpf2->LookaheadClassDef, s_in[j],
+ &lookahead_classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+ known_lookahead_classes = i;
+ }
+
+ if ( lc[i] != lookahead_classes[i] )
+ break;
+ }
+
+ if ( i == lgc )
+ {
+ error = Do_ContextPos( gpi, igc,
+ cpcr.PosCount,
+ cpcr.PosLookupRecord,
+ in, out,
+ nesting_level );
+ goto End1;
+ }
+ }
+
+ error = TTO_Err_Not_Covered;
+
+ End1:
+ FREE( lookahead_classes );
+
+ End2:
+ FREE( input_classes );
+
+ End3:
+ FREE( backtrack_classes );
+ return error;
+ }
+
+
+ static TT_Error Lookup_ChainContextPos3(
+ GPOS_Instance* gpi,
+ TTO_ChainContextPosFormat3* ccpf3,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ TT_UInt flags,
+ TT_UInt context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_UInt i, j, curr_pos, bgc, igc, lgc;
+ TT_Error error;
+ UShort* s_in;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ TTO_Coverage* bc;
+ TTO_Coverage* ic;
+ TTO_Coverage* lc;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gpos->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ bgc = ccpf3->BacktrackGlyphCount;
+ igc = ccpf3->InputGlyphCount;
+ lgc = ccpf3->LookaheadGlyphCount;
+
+ if ( context_length != 0xFFFF && context_length < igc )
+ return TTO_Err_Not_Covered;
+
+ /* check whether context is too long; it is a first guess only */
+
+ if ( bgc > in->pos || in->pos + igc + lgc > in->length )
+ return TTO_Err_Not_Covered;
+
+ if ( bgc )
+ {
+ /* Since we don't know in advance the number of glyphs to inspect,
+ we search backwards for matches in the backtrack glyph array */
+
+ curr_pos = 0;
+ s_in = &in->string[curr_pos];
+ bc = ccpf3->BacktrackCoverage;
+
+ for ( i = 0, j = in->pos - 1; i < bgc; i++, j-- )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( j > curr_pos )
+ j--;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &bc[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+ }
+
+ curr_pos = in->pos;
+ s_in = &in->string[curr_pos];
+ ic = ccpf3->InputCoverage;
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < igc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &ic[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+
+ /* we are starting to check for lookahead glyphs right after the
+ last context glyph */
+
+ curr_pos = j;
+ s_in = &in->string[curr_pos];
+ lc = ccpf3->LookaheadCoverage;
+
+ for ( i = 0, j = 0; i < lgc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &lc[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+
+ return Do_ContextPos( gpi, igc,
+ ccpf3->PosCount,
+ ccpf3->PosLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+
+ static TT_Error Lookup_ChainContextPos(
+ GPOS_Instance* gpi,
+ TTO_ChainContextPos* ccp,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ switch ( ccp->PosFormat )
+ {
+ case 1:
+ return Lookup_ChainContextPos1( gpi, &ccp->ccpf.ccpf1, in, out,
+ flags, context_length,
+ nesting_level );
+
+ case 2:
+ return Lookup_ChainContextPos2( gpi, &ccp->ccpf.ccpf2, in, out,
+ flags, context_length,
+ nesting_level );
+
+ case 3:
+ return Lookup_ChainContextPos3( gpi, &ccp->ccpf.ccpf3, in, out,
+ flags, context_length,
+ nesting_level );
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+
+ /***********
+ * GPOS API
+ ***********/
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Select_Script( TTO_GPOSHeader* gpos,
+ TT_ULong script_tag,
+ TT_UShort* script_index )
+ {
+ UShort n;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+
+
+ if ( !gpos || !script_index )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gpos->ScriptList;
+ sr = sl->ScriptRecord;
+
+ for ( n = 0; n < sl->ScriptCount; n++ )
+ if ( script_tag == sr[n].ScriptTag )
+ {
+ *script_index = n;
+
+ return TT_Err_Ok;
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Select_Language( TTO_GPOSHeader* gpos,
+ TT_ULong language_tag,
+ TT_UShort script_index,
+ TT_UShort* language_index,
+ TT_UShort* req_feature_index )
+ {
+ UShort n;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+
+
+ if ( !gpos || !language_index || !req_feature_index )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gpos->ScriptList;
+ sr = sl->ScriptRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ for ( n = 0; n < s->LangSysCount; n++ )
+ if ( language_tag == lsr[n].LangSysTag )
+ {
+ *language_index = n;
+ *req_feature_index = lsr[n].LangSys.ReqFeatureIndex;
+
+ return TT_Err_Ok;
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* selecting 0xFFFF for language_index asks for the values of the
+ default language (DefaultLangSys) */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Select_Feature( TTO_GPOSHeader* gpos,
+ TT_ULong feature_tag,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_UShort* feature_index )
+ {
+ UShort n;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+ TTO_LangSys* ls;
+ UShort* fi;
+
+ TTO_FeatureList* fl;
+ TTO_FeatureRecord* fr;
+
+
+ if ( !gpos || !feature_index )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gpos->ScriptList;
+ sr = sl->ScriptRecord;
+
+ fl = &gpos->FeatureList;
+ fr = fl->FeatureRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ if ( language_index == 0xFFFF )
+ ls = &s->DefaultLangSys;
+ else
+ {
+ if ( language_index >= s->LangSysCount )
+ return TT_Err_Invalid_Argument;
+
+ ls = &lsr[language_index].LangSys;
+ }
+
+ fi = ls->FeatureIndex;
+
+ for ( n = 0; n < ls->FeatureCount; n++ )
+ {
+ if ( fi[n] >= fl->FeatureCount )
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+
+ if ( feature_tag == fr[fi[n]].FeatureTag )
+ {
+ *feature_index = fi[n];
+
+ return TT_Err_Ok;
+ }
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* The next three functions return a null-terminated list */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Query_Scripts( TTO_GPOSHeader* gpos,
+ TT_ULong** script_tag_list )
+ {
+ UShort n;
+ TT_Error error;
+ ULong* stl;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+
+
+ if ( !gpos || !script_tag_list )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gpos->ScriptList;
+ sr = sl->ScriptRecord;
+
+ if ( ALLOC_ARRAY( stl, sl->ScriptCount + 1, ULong ) )
+ return error;
+
+ for ( n = 0; n < sl->ScriptCount; n++ )
+ stl[n] = sr[n].ScriptTag;
+ stl[n] = 0;
+
+ *script_tag_list = stl;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Query_Languages( TTO_GPOSHeader* gpos,
+ TT_UShort script_index,
+ TT_ULong** language_tag_list )
+ {
+ UShort n;
+ TT_Error error;
+ ULong* ltl;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+
+
+ if ( !gpos || !language_tag_list )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gpos->ScriptList;
+ sr = sl->ScriptRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ if ( ALLOC_ARRAY( ltl, s->LangSysCount + 1, ULong ) )
+ return error;
+
+ for ( n = 0; n < s->LangSysCount; n++ )
+ ltl[n] = lsr[n].LangSysTag;
+ ltl[n] = 0;
+
+ *language_tag_list = ltl;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* selecting 0xFFFF for language_index asks for the values of the
+ default language (DefaultLangSys) */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Query_Features( TTO_GPOSHeader* gpos,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_ULong** feature_tag_list )
+ {
+ UShort n;
+ TT_Error error;
+ ULong* ftl;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+ TTO_LangSys* ls;
+ UShort* fi;
+
+ TTO_FeatureList* fl;
+ TTO_FeatureRecord* fr;
+
+
+ if ( !gpos || !feature_tag_list )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gpos->ScriptList;
+ sr = sl->ScriptRecord;
+
+ fl = &gpos->FeatureList;
+ fr = fl->FeatureRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ if ( language_index == 0xFFFF )
+ ls = &s->DefaultLangSys;
+ else
+ {
+ if ( language_index >= s->LangSysCount )
+ return TT_Err_Invalid_Argument;
+
+ ls = &lsr[language_index].LangSys;
+ }
+
+ fi = ls->FeatureIndex;
+
+ if ( ALLOC_ARRAY( ftl, ls->FeatureCount + 1, ULong ) )
+ return error;
+
+ for ( n = 0; n < ls->FeatureCount; n++ )
+ {
+ if ( fi[n] >= fl->FeatureCount )
+ {
+ FREE( ftl );
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+ ftl[n] = fr[fi[n]].FeatureTag;
+ }
+ ftl[n] = 0;
+
+ *feature_tag_list = ftl;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* Do an individual subtable lookup. Returns TT_Err_Ok if positioning
+ has been done, or TTO_Err_Not_Covered if not. */
+
+ static TT_Error Do_Glyph_Lookup( GPOS_Instance* gpi,
+ UShort lookup_index,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out,
+ UShort context_length,
+ int nesting_level )
+ {
+ TT_Error error = TT_Err_Ok;
+ UShort i, flags;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+ TTO_Lookup* lo;
+
+
+ nesting_level++;
+
+ if ( nesting_level > TTO_MAX_NESTING_LEVEL )
+ return TTO_Err_Too_Many_Nested_Contexts;
+
+ lo = &gpos->LookupList.Lookup[lookup_index];
+ flags = lo->LookupFlag;
+
+ for ( i = 0; i < lo->SubTableCount; i++ )
+ {
+ switch ( lo->LookupType )
+ {
+ case GPOS_LOOKUP_SINGLE:
+ error = Lookup_SinglePos( gpi,
+ &lo->SubTable[i].st.gpos.single,
+ in, out,
+ flags, context_length );
+ break;
+
+ case GPOS_LOOKUP_PAIR:
+ error = Lookup_PairPos( gpi,
+ &lo->SubTable[i].st.gpos.pair,
+ in, out,
+ flags, context_length );
+ break;
+
+ case GPOS_LOOKUP_CURSIVE:
+ error = Lookup_CursivePos( gpi,
+ &lo->SubTable[i].st.gpos.cursive,
+ in, out,
+ flags, context_length );
+ break;
+
+ case GPOS_LOOKUP_MARKBASE:
+ error = Lookup_MarkBasePos( gpi,
+ &lo->SubTable[i].st.gpos.markbase,
+ in, out,
+ flags, context_length );
+ break;
+
+ case GPOS_LOOKUP_MARKLIG:
+ error = Lookup_MarkLigPos( gpi,
+ &lo->SubTable[i].st.gpos.marklig,
+ in, out,
+ flags, context_length );
+ break;
+
+ case GPOS_LOOKUP_MARKMARK:
+ error = Lookup_MarkMarkPos( gpi,
+ &lo->SubTable[i].st.gpos.markmark,
+ in, out,
+ flags, context_length );
+ break;
+
+ case GPOS_LOOKUP_CONTEXT:
+ error = Lookup_ContextPos( gpi,
+ &lo->SubTable[i].st.gpos.context,
+ in, out,
+ flags, context_length,
+ nesting_level );
+ break;
+
+ case GPOS_LOOKUP_CHAIN:
+ error = Lookup_ChainContextPos( gpi,
+ &lo->SubTable[i].st.gpos.chain,
+ in, out,
+ flags, context_length,
+ nesting_level );
+ break;
+ }
+
+ /* Check whether we have a successful positioning or an error other
+ than TTO_Err_Not_Covered */
+
+ if ( error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* apply one lookup to the input string object */
+
+ static TT_Error Do_String_Lookup( GPOS_Instance* gpi,
+ UShort lookup_index,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data* out )
+ {
+ TT_Error error = TTO_Err_Not_Covered;
+ TTO_GPOSHeader* gpos = gpi->gpos;
+
+ UShort* properties = gpos->LookupList.Properties;
+ UShort* p_in = in->properties;
+
+ int nesting_level = 0;
+ TT_UInt i;
+ TT_Pos offset;
+
+
+ gpi->first = 0xFFFF;
+ gpi->last = 0xFFFF; /* no last valid glyph for cursive pos. */
+
+ in->pos = 0;
+
+ while ( in->pos < in->length )
+ {
+ if ( ~p_in[in->pos] & properties[lookup_index] )
+ {
+ /* 0xFFFF indicates that we don't have a context length yet. */
+
+ /* Note that the connection between mark and base glyphs hold
+ exactly one (string) lookup. For example, it would be possible
+ that in the first lookup, mark glyph X is attached to base
+ glyph A, and in the next lookup it is attached to base glyph B.
+ It is up to the font designer to provide meaningful lookups and
+ lookup order. */
+
+ error = Do_Glyph_Lookup( gpi, lookup_index, in, out,
+ 0xFFFF, nesting_level );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+ else
+ {
+ /* Contrary to properties defined in GDEF, user-defined properties
+ will always stop a possible cursive positioning. */
+ gpi->last = 0xFFFF;
+
+ error = TTO_Err_Not_Covered;
+ }
+
+ /* test whether we have to adjust the offsets for cursive connections */
+
+ if ( gpi->first != 0xFFFF && gpi->last == 0xFFFF &&
+ gpos->LookupList.Lookup[lookup_index].LookupFlag & RIGHT_TO_LEFT )
+ {
+ offset = out[in->pos].y_pos;
+
+ /* no horizontal offsets (for vertical writing direction)
+ supported yet */
+
+ for ( i = gpi->first; i <= (TT_UInt)in->pos; i++ )
+ out[i].y_pos -= offset;
+
+ gpi->first = 0xFFFF;
+ }
+
+ if ( error == TTO_Err_Not_Covered )
+ (in->pos)++;
+ }
+
+ return error;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Add_Feature( TTO_GPOSHeader* gpos,
+ TT_UShort feature_index,
+ TT_UShort property )
+ {
+ UShort i;
+
+ TTO_Feature feature;
+ UShort* properties;
+ UShort* index;
+
+
+ if ( !gpos ||
+ feature_index >= gpos->FeatureList.FeatureCount )
+ return TT_Err_Invalid_Argument;
+
+ properties = gpos->LookupList.Properties;
+
+ feature = gpos->FeatureList.FeatureRecord[feature_index].Feature;
+ index = feature.LookupListIndex;
+
+ for ( i = 0; i < feature.LookupListCount; i++ )
+ properties[index[i]] |= property;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Clear_Features( TTO_GPOSHeader* gpos )
+ {
+ UShort i;
+
+ UShort* properties;
+
+
+ if ( !gpos )
+ return TT_Err_Invalid_Argument;
+
+ properties = gpos->LookupList.Properties;
+
+ for ( i = 0; i < gpos->LookupList.LookupCount; i++ )
+ properties[i] = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Register_Glyph_Function( TTO_GPOSHeader* gpos,
+ TTO_GlyphFunction gfunc )
+ {
+ if ( !gpos )
+ return TT_Err_Invalid_Argument;
+
+ gpos->gfunc = gfunc;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Register_MM_Function( TTO_GPOSHeader* gpos,
+ TTO_MMFunction mmfunc,
+ void* data )
+ {
+ if ( !gpos )
+ return TT_Err_Invalid_Argument;
+
+ gpos->mmfunc = mmfunc;
+ gpos->data = data;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* If `dvi' is TRUE, glyph contour points for anchor points and device
+ tables are ignored -- you will get device independent values. */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GPOS_Apply_String( TT_Instance instance,
+ TT_Glyph glyph,
+ TTO_GPOSHeader* gpos,
+ TT_UShort load_flags,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data** out,
+ TT_Bool dvi,
+ TT_Bool r2l )
+ {
+ TT_Error error = TTO_Err_Not_Covered;
+ GPOS_Instance gpi;
+
+ UShort j;
+
+ UShort* properties;
+
+
+ if ( !instance.z || !gpos ||
+ !in || in->length == 0 || in->pos >= in->length )
+ return TT_Err_Invalid_Argument;
+
+ properties = gpos->LookupList.Properties;
+
+ gpi.instance = instance;
+ if ( dvi )
+ gpi.glyph.z = NULL;
+ else
+ gpi.glyph = glyph;
+ gpi.gpos = gpos;
+ gpi.load_flags = load_flags;
+ gpi.r2l = r2l;
+
+ if ( *out )
+ FREE( *out );
+ if ( ALLOC_ARRAY( *out, in->length, TTO_GPOS_Data ) )
+ return error;
+
+ for ( j = 0; j < gpos->LookupList.LookupCount; j++ )
+ if ( !properties || properties[j] )
+ {
+ error = Do_String_Lookup( &gpi, j, in, *out );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgpos.h b/Build/source/libs/freetype/lib/extend/ftxgpos.h
new file mode 100644
index 00000000000..1ba80b13b8a
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgpos.h
@@ -0,0 +1,865 @@
+/*******************************************************************
+ *
+ * ftxgpos.h
+ *
+ * TrueType Open GPOS table support
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef FTXOPEN_H
+#error "Don't include this file! Use ftxopen.h instead."
+#endif
+
+#ifndef FTXGPOS_H
+#define FTXGPOS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TTO_Err_Invalid_GPOS_SubTable_Format 0x1020
+#define TTO_Err_Invalid_GPOS_SubTable 0x1021
+
+#define GPOS_ID Build_Extension_ID( 'G', 'P', 'O', 'S' )
+
+
+/* Lookup types for glyph positioning */
+
+#define GPOS_LOOKUP_SINGLE 1
+#define GPOS_LOOKUP_PAIR 2
+#define GPOS_LOOKUP_CURSIVE 3
+#define GPOS_LOOKUP_MARKBASE 4
+#define GPOS_LOOKUP_MARKLIG 5
+#define GPOS_LOOKUP_MARKMARK 6
+#define GPOS_LOOKUP_CONTEXT 7
+#define GPOS_LOOKUP_CHAIN 8
+#define GPOS_LOOKUP_EXTENSION 9
+
+
+ /* A pointer to a function which loads a glyph. Its parameters are
+ the same as in a call to TT_Load_Glyph() -- if no glyph loading
+ function will be registered with TTO_GPOS_Register_Glyph_Function(),
+ TT_Load_Glyph() will be called indeed. The purpose of this function
+ pointer is to provide a hook for caching glyph outlines and sbits
+ (using the instance's generic pointer to hold the data).
+
+ If for some reason no outline data is available (e.g. for an
+ embedded bitmap glyph), _glyph->outline.n_points should be set to
+ zero. _glyph can be computed with
+
+ _glyph = HANDLE_Glyph( glyph ) */
+
+ typedef TT_Error (*TTO_GlyphFunction)(TT_Instance instance,
+ TT_Glyph glyph,
+ TT_UShort glyphIndex,
+ TT_UShort loadFlags );
+
+
+ /* A pointer to a function which accesses the PostScript interpreter.
+ Multiple Master fonts need this interface to convert a metric ID
+ (as stored in an OpenType font version 1.2 or higher) `metric_id'
+ into a metric value (returned in `metric_value').
+
+ `data' points to the user-defined structure specified during a
+ call to TT_GPOS_Register_MM_Function().
+
+ `metric_value' must be returned as a scaled value (but shouldn't
+ be rounded). */
+
+ typedef TT_Error (*TTO_MMFunction)(TT_Instance instance,
+ TT_UShort metric_id,
+ TT_Pos* metric_value,
+ void* data );
+
+
+ struct TTO_GPOSHeader_
+ {
+ TT_Bool loaded;
+ TT_ULong offset;
+
+ TT_Fixed Version;
+
+ TTO_ScriptList ScriptList;
+ TTO_FeatureList FeatureList;
+ TTO_LookupList LookupList;
+
+ TTO_GDEFHeader* gdef;
+
+ /* the next field is used for a callback function to get the
+ glyph outline. */
+
+ TTO_GlyphFunction gfunc;
+
+ /* this is OpenType 1.2 -- Multiple Master fonts need this
+ callback function to get various metric values from the
+ PostScript interpreter. */
+
+ TTO_MMFunction mmfunc;
+ void* data;
+ };
+
+ typedef struct TTO_GPOSHeader_ TTO_GPOSHeader;
+
+
+ /* shared tables */
+
+ struct TTO_ValueRecord_
+ {
+ TT_Short XPlacement; /* horizontal adjustment for
+ placement */
+ TT_Short YPlacement; /* vertical adjustment for
+ placement */
+ TT_Short XAdvance; /* horizontal adjustment for
+ advance */
+ TT_Short YAdvance; /* vertical adjustment for
+ advance */
+ TTO_Device XPlacementDevice; /* device table for horizontal
+ placement */
+ TTO_Device YPlacementDevice; /* device table for vertical
+ placement */
+ TTO_Device XAdvanceDevice; /* device table for horizontal
+ advance */
+ TTO_Device YAdvanceDevice; /* device table for vertical
+ advance */
+ TT_UShort XIdPlacement; /* horizontal placement metric ID */
+ TT_UShort YIdPlacement; /* vertical placement metric ID */
+ TT_UShort XIdAdvance; /* horizontal advance metric ID */
+ TT_UShort YIdAdvance; /* vertical advance metric ID */
+ };
+
+ typedef struct TTO_ValueRecord_ TTO_ValueRecord;
+
+
+/* Mask values to scan the value format of the ValueRecord structure.
+ We always expand compressed ValueRecords of the font. */
+
+#define HAVE_X_PLACEMENT 0x0001
+#define HAVE_Y_PLACEMENT 0x0002
+#define HAVE_X_ADVANCE 0x0004
+#define HAVE_Y_ADVANCE 0x0008
+#define HAVE_X_PLACEMENT_DEVICE 0x0010
+#define HAVE_Y_PLACEMENT_DEVICE 0x0020
+#define HAVE_X_ADVANCE_DEVICE 0x0040
+#define HAVE_Y_ADVANCE_DEVICE 0x0080
+#define HAVE_X_ID_PLACEMENT 0x0100
+#define HAVE_Y_ID_PLACEMENT 0x0200
+#define HAVE_X_ID_ADVANCE 0x0400
+#define HAVE_Y_ID_ADVANCE 0x0800
+
+
+ struct TTO_AnchorFormat1_
+ {
+ TT_Short XCoordinate; /* horizontal value */
+ TT_Short YCoordinate; /* vertical value */
+ };
+
+ typedef struct TTO_AnchorFormat1_ TTO_AnchorFormat1;
+
+
+ struct TTO_AnchorFormat2_
+ {
+ TT_Short XCoordinate; /* horizontal value */
+ TT_Short YCoordinate; /* vertical value */
+ TT_UShort AnchorPoint; /* index to glyph contour point */
+ };
+
+ typedef struct TTO_AnchorFormat2_ TTO_AnchorFormat2;
+
+
+ struct TTO_AnchorFormat3_
+ {
+ TT_Short XCoordinate; /* horizontal value */
+ TT_Short YCoordinate; /* vertical value */
+ TTO_Device XDeviceTable; /* device table for X coordinate */
+ TTO_Device YDeviceTable; /* device table for Y coordinate */
+ };
+
+ typedef struct TTO_AnchorFormat3_ TTO_AnchorFormat3;
+
+
+ struct TTO_AnchorFormat4_
+ {
+ TT_UShort XIdAnchor; /* horizontal metric ID */
+ TT_UShort YIdAnchor; /* vertical metric ID */
+ };
+
+ typedef struct TTO_AnchorFormat4_ TTO_AnchorFormat4;
+
+
+ struct TTO_Anchor_
+ {
+ TT_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
+ that there is no Anchor table */
+
+ union
+ {
+ TTO_AnchorFormat1 af1;
+ TTO_AnchorFormat2 af2;
+ TTO_AnchorFormat3 af3;
+ TTO_AnchorFormat4 af4;
+ } af;
+ };
+
+ typedef struct TTO_Anchor_ TTO_Anchor;
+
+
+ struct TTO_MarkRecord_
+ {
+ TT_UShort Class; /* mark class */
+ TTO_Anchor MarkAnchor; /* anchor table */
+ };
+
+ typedef struct TTO_MarkRecord_ TTO_MarkRecord;
+
+
+ struct TTO_MarkArray_
+ {
+ TT_UShort MarkCount; /* number of MarkRecord tables */
+ TTO_MarkRecord* MarkRecord; /* array of MarkRecord tables */
+ };
+
+ typedef struct TTO_MarkArray_ TTO_MarkArray;
+
+
+ /* LookupType 1 */
+
+ struct TTO_SinglePosFormat1_
+ {
+ TTO_ValueRecord Value; /* ValueRecord for all covered
+ glyphs */
+ };
+
+ typedef struct TTO_SinglePosFormat1_ TTO_SinglePosFormat1;
+
+
+ struct TTO_SinglePosFormat2_
+ {
+ TT_UShort ValueCount; /* number of ValueRecord tables */
+ TTO_ValueRecord* Value; /* array of ValueRecord tables */
+ };
+
+ typedef struct TTO_SinglePosFormat2_ TTO_SinglePosFormat2;
+
+
+ struct TTO_SinglePos_
+ {
+ TT_UShort PosFormat; /* 1 or 2 */
+ TTO_Coverage Coverage; /* Coverage table */
+
+ TT_UShort ValueFormat; /* format of ValueRecord table */
+
+ union
+ {
+ TTO_SinglePosFormat1 spf1;
+ TTO_SinglePosFormat2 spf2;
+ } spf;
+ };
+
+ typedef struct TTO_SinglePos_ TTO_SinglePos;
+
+
+ /* LookupType 2 */
+
+ struct TTO_PairValueRecord_
+ {
+ TT_UShort SecondGlyph; /* glyph ID for second glyph */
+ TTO_ValueRecord Value1; /* pos. data for first glyph */
+ TTO_ValueRecord Value2; /* pos. data for second glyph */
+ };
+
+ typedef struct TTO_PairValueRecord_ TTO_PairValueRecord;
+
+
+ struct TTO_PairSet_
+ {
+ TT_UShort PairValueCount;
+ /* number of PairValueRecord tables */
+ TTO_PairValueRecord* PairValueRecord;
+ /* array of PairValueRecord tables */
+ };
+
+ typedef struct TTO_PairSet_ TTO_PairSet;
+
+
+ struct TTO_PairPosFormat1_
+ {
+ TT_UShort PairSetCount; /* number of PairSet tables */
+ TTO_PairSet* PairSet; /* array of PairSet tables */
+ };
+
+ typedef struct TTO_PairPosFormat1_ TTO_PairPosFormat1;
+
+
+ struct TTO_Class2Record_
+ {
+ TTO_ValueRecord Value1; /* pos. data for first glyph */
+ TTO_ValueRecord Value2; /* pos. data for second glyph */
+ };
+
+ typedef struct TTO_Class2Record_ TTO_Class2Record;
+
+
+ struct TTO_Class1Record_
+ {
+ TTO_Class2Record* Class2Record; /* array of Class2Record tables */
+ };
+
+ typedef struct TTO_Class1Record_ TTO_Class1Record;
+
+
+ struct TTO_PairPosFormat2_
+ {
+ TTO_ClassDefinition ClassDef1; /* class def. for first glyph */
+ TTO_ClassDefinition ClassDef2; /* class def. for second glyph */
+ TT_UShort Class1Count; /* number of classes in ClassDef1
+ table */
+ TT_UShort Class2Count; /* number of classes in ClassDef2
+ table */
+ TTO_Class1Record* Class1Record; /* array of Class1Record tables */
+ };
+
+ typedef struct TTO_PairPosFormat2_ TTO_PairPosFormat2;
+
+
+ struct TTO_PairPos_
+ {
+ TT_UShort PosFormat; /* 1 or 2 */
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort ValueFormat1; /* format of ValueRecord table
+ for first glyph */
+ TT_UShort ValueFormat2; /* format of ValueRecord table
+ for second glyph */
+
+ union
+ {
+ TTO_PairPosFormat1 ppf1;
+ TTO_PairPosFormat2 ppf2;
+ } ppf;
+ };
+
+ typedef struct TTO_PairPos_ TTO_PairPos;
+
+
+ /* LookupType 3 */
+
+ struct TTO_EntryExitRecord_
+ {
+ TTO_Anchor EntryAnchor; /* entry Anchor table */
+ TTO_Anchor ExitAnchor; /* exit Anchor table */
+ };
+
+
+ typedef struct TTO_EntryExitRecord_ TTO_EntryExitRecord;
+
+ struct TTO_CursivePos_
+ {
+ TT_UShort PosFormat; /* always 1 */
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort EntryExitCount;
+ /* number of EntryExitRecord tables */
+ TTO_EntryExitRecord* EntryExitRecord;
+ /* array of EntryExitRecord tables */
+ };
+
+ typedef struct TTO_CursivePos_ TTO_CursivePos;
+
+
+ /* LookupType 4 */
+
+ struct TTO_BaseRecord_
+ {
+ TTO_Anchor* BaseAnchor; /* array of base glyph anchor
+ tables */
+ };
+
+ typedef struct TTO_BaseRecord_ TTO_BaseRecord;
+
+
+ struct TTO_BaseArray_
+ {
+ TT_UShort BaseCount; /* number of BaseRecord tables */
+ TTO_BaseRecord* BaseRecord; /* array of BaseRecord tables */
+ };
+
+ typedef struct TTO_BaseArray_ TTO_BaseArray;
+
+
+ struct TTO_MarkBasePos_
+ {
+ TT_UShort PosFormat; /* always 1 */
+ TTO_Coverage MarkCoverage; /* mark glyph coverage table */
+ TTO_Coverage BaseCoverage; /* base glyph coverage table */
+ TT_UShort ClassCount; /* number of mark classes */
+ TTO_MarkArray MarkArray; /* mark array table */
+ TTO_BaseArray BaseArray; /* base array table */
+ };
+
+ typedef struct TTO_MarkBasePos_ TTO_MarkBasePos;
+
+
+ /* LookupType 5 */
+
+ struct TTO_ComponentRecord_
+ {
+ TTO_Anchor* LigatureAnchor; /* array of ligature glyph anchor
+ tables */
+ };
+
+ typedef struct TTO_ComponentRecord_ TTO_ComponentRecord;
+
+
+ struct TTO_LigatureAttach_
+ {
+ TT_UShort ComponentCount;
+ /* number of ComponentRecord tables */
+ TTO_ComponentRecord* ComponentRecord;
+ /* array of ComponentRecord tables */
+ };
+
+ typedef struct TTO_LigatureAttach_ TTO_LigatureAttach;
+
+
+ struct TTO_LigatureArray_
+ {
+ TT_UShort LigatureCount; /* number of LigatureAttach tables */
+ TTO_LigatureAttach* LigatureAttach;
+ /* array of LigatureAttach tables */
+ };
+
+ typedef struct TTO_LigatureArray_ TTO_LigatureArray;
+
+
+ struct TTO_MarkLigPos_
+ {
+ TT_UShort PosFormat; /* always 1 */
+ TTO_Coverage MarkCoverage; /* mark glyph coverage table */
+ TTO_Coverage LigatureCoverage;
+ /* ligature glyph coverage table */
+ TT_UShort ClassCount; /* number of mark classes */
+ TTO_MarkArray MarkArray; /* mark array table */
+ TTO_LigatureArray LigatureArray; /* ligature array table */
+ };
+
+ typedef struct TTO_MarkLigPos_ TTO_MarkLigPos;
+
+
+ /* LookupType 6 */
+
+ struct TTO_Mark2Record_
+ {
+ TTO_Anchor* Mark2Anchor; /* array of mark glyph anchor
+ tables */
+ };
+
+ typedef struct TTO_Mark2Record_ TTO_Mark2Record;
+
+
+ struct TTO_Mark2Array_
+ {
+ TT_UShort Mark2Count; /* number of Mark2Record tables */
+ TTO_Mark2Record* Mark2Record; /* array of Mark2Record tables */
+ };
+
+ typedef struct TTO_Mark2Array_ TTO_Mark2Array;
+
+
+ struct TTO_MarkMarkPos_
+ {
+ TT_UShort PosFormat; /* always 1 */
+ TTO_Coverage Mark1Coverage; /* first mark glyph coverage table */
+ TTO_Coverage Mark2Coverage; /* second mark glyph coverave table */
+ TT_UShort ClassCount; /* number of combining mark classes */
+ TTO_MarkArray Mark1Array; /* MarkArray table for first mark */
+ TTO_Mark2Array Mark2Array; /* MarkArray table for second mark */
+ };
+
+ typedef struct TTO_MarkMarkPos_ TTO_MarkMarkPos;
+
+
+ /* needed by both lookup type 7 and 8 */
+
+ struct TTO_PosLookupRecord_
+ {
+ TT_UShort SequenceIndex; /* index into current
+ glyph sequence */
+ TT_UShort LookupListIndex; /* Lookup to apply to that pos. */
+ };
+
+ typedef struct TTO_PosLookupRecord_ TTO_PosLookupRecord;
+
+
+ /* LookupType 7 */
+
+ struct TTO_PosRule_
+ {
+ TT_UShort GlyphCount; /* total number of input glyphs */
+ TT_UShort PosCount; /* number of PosLookupRecord tables */
+ TT_UShort* Input; /* array of input glyph IDs */
+ TTO_PosLookupRecord* PosLookupRecord;
+ /* array of PosLookupRecord tables */
+ };
+
+ typedef struct TTO_PosRule_ TTO_PosRule;
+
+
+ struct TTO_PosRuleSet_
+ {
+ TT_UShort PosRuleCount; /* number of PosRule tables */
+ TTO_PosRule* PosRule; /* array of PosRule tables */
+ };
+
+ typedef struct TTO_PosRuleSet_ TTO_PosRuleSet;
+
+
+ struct TTO_ContextPosFormat1_
+ {
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort PosRuleSetCount; /* number of PosRuleSet tables */
+ TTO_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
+ };
+
+ typedef struct TTO_ContextPosFormat1_ TTO_ContextPosFormat1;
+
+
+ struct TTO_PosClassRule_
+ {
+ TT_UShort GlyphCount; /* total number of context classes */
+ TT_UShort PosCount; /* number of PosLookupRecord tables */
+ TT_UShort* Class; /* array of classes */
+ TTO_PosLookupRecord* PosLookupRecord;
+ /* array of PosLookupRecord tables */
+ };
+
+ typedef struct TTO_PosClassRule_ TTO_PosClassRule;
+
+
+ struct TTO_PosClassSet_
+ {
+ TT_UShort PosClassRuleCount;
+ /* number of PosClassRule tables */
+ TTO_PosClassRule* PosClassRule; /* array of PosClassRule tables */
+ };
+
+ typedef struct TTO_PosClassSet_ TTO_PosClassSet;
+
+
+ /* The `MaxContextLength' field is not defined in the TTO specification
+ but simplifies the implementation of this format. It holds the
+ maximal context length used in the context rules. */
+
+ struct TTO_ContextPosFormat2_
+ {
+ TT_UShort MaxContextLength;
+ /* maximal context length */
+ TTO_Coverage Coverage; /* Coverage table */
+ TTO_ClassDefinition ClassDef; /* ClassDef table */
+ TT_UShort PosClassSetCount;
+ /* number of PosClassSet tables */
+ TTO_PosClassSet* PosClassSet; /* array of PosClassSet tables */
+ };
+
+ typedef struct TTO_ContextPosFormat2_ TTO_ContextPosFormat2;
+
+
+ struct TTO_ContextPosFormat3_
+ {
+ TT_UShort GlyphCount; /* number of input glyphs */
+ TT_UShort PosCount; /* number of PosLookupRecord tables */
+ TTO_Coverage* Coverage; /* array of Coverage tables */
+ TTO_PosLookupRecord* PosLookupRecord;
+ /* array of PosLookupRecord tables */
+ };
+
+ typedef struct TTO_ContextPosFormat3_ TTO_ContextPosFormat3;
+
+
+ struct TTO_ContextPos_
+ {
+ TT_UShort PosFormat; /* 1, 2, or 3 */
+
+ union
+ {
+ TTO_ContextPosFormat1 cpf1;
+ TTO_ContextPosFormat2 cpf2;
+ TTO_ContextPosFormat3 cpf3;
+ } cpf;
+ };
+
+ typedef struct TTO_ContextPos_ TTO_ContextPos;
+
+
+ /* LookupType 8 */
+
+ struct TTO_ChainPosRule_
+ {
+ TT_UShort BacktrackGlyphCount;
+ /* total number of backtrack glyphs */
+ TT_UShort* Backtrack; /* array of backtrack glyph IDs */
+ TT_UShort InputGlyphCount;
+ /* total number of input glyphs */
+ TT_UShort* Input; /* array of input glyph IDs */
+ TT_UShort LookaheadGlyphCount;
+ /* total number of lookahead glyphs */
+ TT_UShort* Lookahead; /* array of lookahead glyph IDs */
+ TT_UShort PosCount; /* number of PosLookupRecords */
+ TTO_PosLookupRecord* PosLookupRecord;
+ /* array of PosLookupRecords */
+ };
+
+ typedef struct TTO_ChainPosRule_ TTO_ChainPosRule;
+
+
+ struct TTO_ChainPosRuleSet_
+ {
+ TT_UShort ChainPosRuleCount;
+ /* number of ChainPosRule tables */
+ TTO_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
+ };
+
+ typedef struct TTO_ChainPosRuleSet_ TTO_ChainPosRuleSet;
+
+
+ struct TTO_ChainContextPosFormat1_
+ {
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort ChainPosRuleSetCount;
+ /* number of ChainPosRuleSet tables */
+ TTO_ChainPosRuleSet* ChainPosRuleSet;
+ /* array of ChainPosRuleSet tables */
+ };
+
+ typedef struct TTO_ChainContextPosFormat1_ TTO_ChainContextPosFormat1;
+
+
+ struct TTO_ChainPosClassRule_
+ {
+ TT_UShort BacktrackGlyphCount;
+ /* total number of backtrack
+ classes */
+ TT_UShort* Backtrack; /* array of backtrack classes */
+ TT_UShort InputGlyphCount;
+ /* total number of context classes */
+ TT_UShort* Input; /* array of context classes */
+ TT_UShort LookaheadGlyphCount;
+ /* total number of lookahead
+ classes */
+ TT_UShort* Lookahead; /* array of lookahead classes */
+ TT_UShort PosCount; /* number of PosLookupRecords */
+ TTO_PosLookupRecord* PosLookupRecord;
+ /* array of substitution lookups */
+ };
+
+ typedef struct TTO_ChainPosClassRule_ TTO_ChainPosClassRule;
+
+
+ struct TTO_ChainPosClassSet_
+ {
+ TT_UShort ChainPosClassRuleCount;
+ /* number of ChainPosClassRule
+ tables */
+ TTO_ChainPosClassRule* ChainPosClassRule;
+ /* array of ChainPosClassRule
+ tables */
+ };
+
+ typedef struct TTO_ChainPosClassSet_ TTO_ChainPosClassSet;
+
+
+ /* The `MaxXXXLength' fields are not defined in the TTO specification
+ but simplifies the implementation of this format. It holds the
+ maximal context length used in the specific context rules. */
+
+ struct TTO_ChainContextPosFormat2_
+ {
+ TTO_Coverage Coverage; /* Coverage table */
+
+ TT_UShort MaxBacktrackLength;
+ /* maximal backtrack length */
+ TTO_ClassDefinition BacktrackClassDef;
+ /* BacktrackClassDef table */
+ TT_UShort MaxInputLength;
+ /* maximal input length */
+ TTO_ClassDefinition InputClassDef;
+ /* InputClassDef table */
+ TT_UShort MaxLookaheadLength;
+ /* maximal lookahead length */
+ TTO_ClassDefinition LookaheadClassDef;
+ /* LookaheadClassDef table */
+
+ TT_UShort ChainPosClassSetCount;
+ /* number of ChainPosClassSet
+ tables */
+ TTO_ChainPosClassSet* ChainPosClassSet;
+ /* array of ChainPosClassSet
+ tables */
+ };
+
+ typedef struct TTO_ChainContextPosFormat2_ TTO_ChainContextPosFormat2;
+
+
+ struct TTO_ChainContextPosFormat3_
+ {
+ TT_UShort BacktrackGlyphCount;
+ /* number of backtrack glyphs */
+ TTO_Coverage* BacktrackCoverage;
+ /* array of backtrack Coverage
+ tables */
+ TT_UShort InputGlyphCount;
+ /* number of input glyphs */
+ TTO_Coverage* InputCoverage;
+ /* array of input coverage
+ tables */
+ TT_UShort LookaheadGlyphCount;
+ /* number of lookahead glyphs */
+ TTO_Coverage* LookaheadCoverage;
+ /* array of lookahead coverage
+ tables */
+ TT_UShort PosCount; /* number of PosLookupRecords */
+ TTO_PosLookupRecord* PosLookupRecord;
+ /* array of substitution lookups */
+ };
+
+ typedef struct TTO_ChainContextPosFormat3_ TTO_ChainContextPosFormat3;
+
+
+ struct TTO_ChainContextPos_
+ {
+ TT_UShort PosFormat; /* 1, 2, or 3 */
+
+ union
+ {
+ TTO_ChainContextPosFormat1 ccpf1;
+ TTO_ChainContextPosFormat2 ccpf2;
+ TTO_ChainContextPosFormat3 ccpf3;
+ } ccpf;
+ };
+
+ typedef struct TTO_ChainContextPos_ TTO_ChainContextPos;
+
+
+ union TTO_GPOS_SubTable_
+ {
+ TTO_SinglePos single;
+ TTO_PairPos pair;
+ TTO_CursivePos cursive;
+ TTO_MarkBasePos markbase;
+ TTO_MarkLigPos marklig;
+ TTO_MarkMarkPos markmark;
+ TTO_ContextPos context;
+ TTO_ChainContextPos chain;
+ };
+
+ typedef union TTO_GPOS_SubTable_ TTO_GPOS_SubTable;
+
+
+ /* This `string object' is much simpler compared to TTO_GSUB_String.
+ A call to TTO_GPOS_Apply_String() will allocate it. */
+
+ struct TTO_GPOS_Data_
+ {
+ TT_Pos x_pos;
+ TT_Pos y_pos;
+ TT_Pos x_advance;
+ TT_Pos y_advance;
+ TT_UShort back; /* number of glyphs to go back
+ for drawing current glyph */
+ TT_Bool new_advance; /* if set, the advance width values are
+ absolute, i.e., they won't be
+ added to the original glyph's value
+ but rather replace them. */
+ };
+
+ typedef struct TTO_GPOS_Data_ TTO_GPOS_Data;
+
+
+ /* finally, the GPOS API */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_GPOS_Extension( TT_Engine engine );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_GPOS_Table( TT_Face face,
+ TTO_GPOSHeader* gpos,
+ TTO_GDEFHeader* gdef );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Select_Script( TTO_GPOSHeader* gpos,
+ TT_ULong script_tag,
+ TT_UShort* script_index );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Select_Language( TTO_GPOSHeader* gpos,
+ TT_ULong language_tag,
+ TT_UShort script_index,
+ TT_UShort* language_index,
+ TT_UShort* req_feature_index );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Select_Feature( TTO_GPOSHeader* gpos,
+ TT_ULong feature_tag,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_UShort* feature_index );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Query_Scripts( TTO_GPOSHeader* gpos,
+ TT_ULong** script_tag_list );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Query_Languages( TTO_GPOSHeader* gpos,
+ TT_UShort script_index,
+ TT_ULong** language_tag_list );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Query_Features( TTO_GPOSHeader* gpos,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_ULong** feature_tag_list );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Add_Feature( TTO_GPOSHeader* gpos,
+ TT_UShort feature_index,
+ TT_UShort property );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Clear_Features( TTO_GPOSHeader* gpos );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Register_Glyph_Function( TTO_GPOSHeader* gpos,
+ TTO_GlyphFunction gfunc );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Register_MM_Function( TTO_GPOSHeader* gpos,
+ TTO_MMFunction mmfunc,
+ void* data );
+
+ /* If `dvi' is TRUE, glyph contour points for anchor points and device
+ tables are ignored -- you will get device independent values. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GPOS_Apply_String( TT_Instance instance,
+ TT_Glyph glyph,
+ TTO_GPOSHeader* gpos,
+ TT_UShort load_flags,
+ TTO_GSUB_String* in,
+ TTO_GPOS_Data** out,
+ TT_Bool dvi,
+ TT_Bool r2l );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXGPOS_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgsub.c b/Build/source/libs/freetype/lib/extend/ftxgsub.c
new file mode 100644
index 00000000000..5fce59e59ca
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgsub.c
@@ -0,0 +1,4425 @@
+/*******************************************************************
+ *
+ * ftxgsub.c
+ *
+ * TrueType Open GSUB table support.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+/* XXX There is *a lot* of duplicated code (cf. formats 5 and 6), but
+ I don't care currently. I believe that it would be possible to
+ save about 50% of TTO code by carefully designing the structures,
+ sharing as much as possible with extensive use of macros. This
+ is something for a volunteer :-) */
+
+#include "tttypes.h"
+#include "tttags.h"
+#include "ttload.h"
+#include "ttextend.h"
+#include "ttmemory.h"
+#include "ttfile.h"
+
+#include "ftxopen.h"
+#include "ftxopenf.h"
+
+
+#define ADD_String( in, num_in, out, num_out, glyph_data, component, ligID ) \
+ ( ( error = TT_GSUB_Add_String( (in), (num_in), \
+ (out), (num_out), \
+ (glyph_data), (component), (ligID) \
+ ) ) != TT_Err_Ok )
+
+
+ static TT_Error Do_Glyph_Lookup( TTO_GSUBHeader* gsub,
+ UShort lookup_index,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort context_length,
+ int nesting_level );
+
+
+
+ /**********************
+ * Auxiliary functions
+ **********************/
+
+
+ /* The following function copies `num_out' elements from `glyph_data'
+ to `out', advancing the array pointer in the `in' structure by
+ `num_in' elements, and in `out' by `num_out' elements. If the
+ string (resp. the properties) array in `out' is empty or too
+ small, it allocates resp. reallocates the string (and properties)
+ array. Finally, it sets the `length' field of `out' equal to
+ `pos' of the `out' structure.
+
+ If `component' is 0xFFFF, the value `in->component[in->pos]'
+ will be copied `num_out' times, otherwise `component' itself will
+ be used to fill `out->component'.
+
+ If `ligID' is 0xFFFF, the value `in->lig_IDs[in->pos]' will be
+ copied `num_out' times, otherwise `ligID' itself will be used to
+ fill `out->ligIDs'.
+
+ The properties (if defined) for all replaced glyphs are taken
+ from the glyph at position `in->pos'. */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Add_String( TTO_GSUB_String* in,
+ UShort num_in,
+ TTO_GSUB_String* out,
+ UShort num_out,
+ UShort* glyph_data,
+ UShort component,
+ UShort ligID )
+ {
+ TT_Error error;
+ TT_UInt i;
+ UShort p_in;
+ UShort* p_out;
+
+
+ /* sanity check */
+
+ if ( !in || !out ||
+ in->length == 0 || in->pos >= in->length ||
+ in->length < in->pos + num_in )
+ return TT_Err_Invalid_Argument;
+
+ if ( out->pos + num_out >= out->allocated )
+ {
+ ULong size = out->pos + num_out + 256L;
+
+
+ /* The following works because all fields in `out' must be
+ initialized to zero (including the `string' field) for the
+ first use. */
+
+ if ( REALLOC_ARRAY( out->string, size, UShort ) )
+ return error;
+ if ( REALLOC_ARRAY( out->components, size, UShort ) )
+ return error;
+ if ( REALLOC_ARRAY( out->ligIDs, size, UShort ) )
+ return error;
+ if ( in->properties )
+ if ( REALLOC_ARRAY( out->properties, size, UShort ) )
+ return error;
+
+ out->allocated = size;
+ }
+
+ if ( num_out )
+ {
+ MEM_Copy( &out->string[out->pos], glyph_data,
+ num_out * sizeof ( UShort ) );
+
+ if ( component == 0xFFFF )
+ component = in->components[in->pos];
+
+ p_out = out->components;
+
+ for ( i = out->pos; i < out->pos + num_out; i++ )
+ p_out[i] = component;
+
+ p_out = out->ligIDs;
+
+ if ( ligID == 0xFFFF )
+ ligID = in->ligIDs[in->pos];
+
+ for ( i = out->pos; i < out->pos + num_out; i++ )
+ p_out[i] = ligID;
+
+ if ( in->properties )
+ {
+ p_in = in->properties[in->pos];
+ p_out = out->properties;
+
+ for ( i = out->pos; i < out->pos + num_out; i++ )
+ p_out[i] = p_in;
+ }
+ }
+
+ in->pos += num_in;
+ out->pos += num_out;
+
+ out->length = out->pos;
+
+ return TT_Err_Ok;
+ }
+
+
+
+ /**********************
+ * Extension Functions
+ **********************/
+
+
+ static TT_Error
+ GSUB_Create( void* ext,
+ PFace face )
+ {
+ DEFINE_LOAD_LOCALS( face->stream );
+
+ TTO_GSUBHeader* gsub = (TTO_GSUBHeader*)ext;
+ Long table;
+
+
+ /* by convention */
+
+ if ( !gsub )
+ return TT_Err_Ok;
+
+ /* a null offset indicates that there is no GSUB table */
+
+ gsub->offset = 0;
+
+ /* we store the start offset and the size of the subtable */
+
+ table = TT_LookUp_Table( face, TTAG_GSUB );
+ if ( table < 0 )
+ return TT_Err_Ok; /* The table is optional */
+
+ if ( FILE_Seek( face->dirTables[table].Offset ) ||
+ ACCESS_Frame( 4L ) )
+ return error;
+
+ gsub->offset = FILE_Pos() - 4L; /* undo ACCESS_Frame() */
+ gsub->Version = GET_ULong();
+
+ FORGET_Frame();
+
+ gsub->loaded = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error
+ GSUB_Destroy( void* ext,
+ PFace face )
+ {
+ TTO_GSUBHeader* gsub = (TTO_GSUBHeader*)ext;
+
+
+ /* by convention */
+
+ if ( !gsub )
+ return TT_Err_Ok;
+
+ if ( gsub->loaded )
+ {
+ Free_LookupList( &gsub->LookupList, GSUB );
+ Free_FeatureList( &gsub->FeatureList );
+ Free_ScriptList( &gsub->ScriptList );
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_GSUB_Extension( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ return TT_Register_Extension( _engine,
+ GSUB_ID,
+ sizeof ( TTO_GSUBHeader ),
+ GSUB_Create,
+ GSUB_Destroy );
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_GSUB_Table( TT_Face face,
+ TTO_GSUBHeader* retptr,
+ TTO_GDEFHeader* gdef )
+ {
+ ULong cur_offset, new_offset, base_offset;
+
+ UShort i, num_lookups;
+ TTO_GSUBHeader* gsub;
+ TTO_GDEFHeader* gdef_reg;
+ TTO_Lookup* lo;
+
+ PFace faze = HANDLE_Face( face );
+ DEFINE_ALL_LOCALS;
+
+
+ if ( !retptr )
+ return TT_Err_Invalid_Argument;
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ error = TT_Extension_Get( faze, GSUB_ID, (void**)&gsub );
+ if ( error )
+ return error;
+
+ if ( gsub->offset == 0 )
+ return TT_Err_Table_Missing; /* no GSUB table; nothing to do */
+
+ /* now access stream */
+
+ if ( USE_Stream( faze->stream, stream ) )
+ return error;
+
+ base_offset = gsub->offset;
+
+ /* skip version */
+
+ if ( FILE_Seek( base_offset + 4L ) ||
+ ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ScriptList( &gsub->ScriptList,
+ faze ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_FeatureList( &gsub->FeatureList,
+ faze ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LookupList( &gsub->LookupList,
+ faze, GSUB ) ) != TT_Err_Ok )
+ goto Fail2;
+
+ gsub->gdef = gdef; /* can be NULL */
+
+ /* We now check the LookupFlags for values larger than 0xFF to find
+ out whether we need to load the `MarkAttachClassDef' field of the
+ GDEF table -- this hack is necessary for OpenType 1.2 tables since
+ the version field of the GDEF table hasn't been incremented.
+
+ For constructed GDEF tables, we only load it if
+ `MarkAttachClassDef_offset' is not zero (nevertheless, a build of
+ a constructed mark attach table is not supported currently). */
+
+ if ( gdef &&
+ gdef->MarkAttachClassDef_offset && !gdef->MarkAttachClassDef.loaded )
+ {
+ lo = gsub->LookupList.Lookup;
+ num_lookups = gsub->LookupList.LookupCount;
+
+ for ( i = 0; i < num_lookups; i++ )
+ {
+ if ( lo[i].LookupFlag & IGNORE_SPECIAL_MARKS )
+ {
+ if ( FILE_Seek( gdef->MarkAttachClassDef_offset ) ||
+ ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( !new_offset )
+ return TTO_Err_Invalid_GDEF_SubTable;
+
+ new_offset += gdef->offset;
+
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ClassDefinition( &gdef->MarkAttachClassDef,
+ 256, faze ) ) != TT_Err_Ok )
+ goto Fail1;
+
+ /* copy the class definition pointer into the extension structure */
+
+ error = TT_Extension_Get( faze, GDEF_ID, (void**)&gdef_reg );
+ if ( error )
+ return error;
+
+ *gdef_reg = *gdef;
+
+ break;
+ }
+ }
+ }
+
+ gsub->loaded = TRUE;
+ *retptr = *gsub;
+ DONE_Stream( stream );
+
+ return TT_Err_Ok;
+
+ Fail1:
+ Free_LookupList( &gsub->LookupList, GSUB );
+
+ Fail2:
+ Free_FeatureList( &gsub->FeatureList );
+
+ Fail3:
+ Free_ScriptList( &gsub->ScriptList );
+
+ /* release stream */
+
+ DONE_Stream( stream );
+
+ return error;
+ }
+
+
+
+ /*****************************
+ * SubTable related functions
+ *****************************/
+
+
+ /* LookupType 1 */
+
+ /* SingleSubstFormat1 */
+ /* SingleSubstFormat2 */
+
+ TT_Error Load_SingleSubst( TTO_SingleSubst* ss,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ UShort* s;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ ss->SubstFormat = GET_UShort();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ss->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ switch ( ss->SubstFormat )
+ {
+ case 1:
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ ss->ssf.ssf1.DeltaGlyphID = GET_UShort();
+
+ FORGET_Frame();
+
+ break;
+
+ case 2:
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = ss->ssf.ssf2.GlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ss->ssf.ssf2.Substitute = NULL;
+
+ if ( ALLOC_ARRAY( ss->ssf.ssf2.Substitute, count, UShort ) )
+ goto Fail2;
+
+ s = ss->ssf.ssf2.Substitute;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ s[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ break;
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( s );
+
+ Fail2:
+ Free_Coverage( &ss->Coverage );
+ return error;
+ }
+
+
+ void Free_SingleSubst( TTO_SingleSubst* ss )
+ {
+ switch ( ss->SubstFormat )
+ {
+ case 1:
+ break;
+
+ case 2:
+ FREE( ss->ssf.ssf2.Substitute );
+ break;
+ }
+
+ Free_Coverage( &ss->Coverage );
+ }
+
+
+ static TT_Error Lookup_SingleSubst( TTO_SingleSubst* ss,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ TTO_GDEFHeader* gdef )
+ {
+ UShort index, value[1], property;
+ TT_Error error;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &ss->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ switch ( ss->SubstFormat )
+ {
+ case 1:
+ value[0] = ( in->string[in->pos] + ss->ssf.ssf1.DeltaGlyphID ) & 0xFFFF;
+ if ( ADD_String( in, 1, out, 1, value, 0xFFFF, 0xFFFF ) )
+ return error;
+ break;
+
+ case 2:
+ if ( index >= ss->ssf.ssf2.GlyphCount )
+ return TTO_Err_Invalid_GSUB_SubTable;
+ value[0] = ss->ssf.ssf2.Substitute[index];
+ if ( ADD_String( in, 1, out, 1, value, 0xFFFF, 0xFFFF ) )
+ return error;
+ break;
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable;
+ }
+
+ if ( gdef && gdef->NewGlyphClasses )
+ {
+ /* we inherit the old glyph class to the substituted glyph */
+
+ error = Add_Glyph_Property( gdef, value[0], property );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 2 */
+
+ /* Sequence */
+
+ static TT_Error Load_Sequence( TTO_Sequence* s,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* sub;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = s->GlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ s->Substitute = NULL;
+
+ if ( count )
+ {
+ if ( ALLOC_ARRAY( s->Substitute, count, UShort ) )
+ return error;
+
+ sub = s->Substitute;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( sub );
+ return error;
+ }
+
+ for ( n = 0; n < count; n++ )
+ sub[n] = GET_UShort();
+
+ FORGET_Frame();
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_Sequence( TTO_Sequence* s )
+ {
+ FREE( s->Substitute );
+ }
+
+
+ /* MultipleSubstFormat1 */
+
+ TT_Error Load_MultipleSubst( TTO_MultipleSubst* ms,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Sequence* s;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ ms->SubstFormat = GET_UShort(); /* should be 1 */
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ms->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = ms->SequenceCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ms->Sequence = NULL;
+
+ if ( ALLOC_ARRAY( ms->Sequence, count, TTO_Sequence ) )
+ goto Fail2;
+
+ s = ms->Sequence;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Sequence( &s[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_Sequence( &s[n] );
+
+ FREE( s );
+
+ Fail2:
+ Free_Coverage( &ms->Coverage );
+ return error;
+ }
+
+
+ void Free_MultipleSubst( TTO_MultipleSubst* ms )
+ {
+ UShort n, count;
+
+ TTO_Sequence* s;
+
+
+ if ( ms->Sequence )
+ {
+ count = ms->SequenceCount;
+ s = ms->Sequence;
+
+ for ( n = 0; n < count; n++ )
+ Free_Sequence( &s[n] );
+
+ FREE( s );
+ }
+
+ Free_Coverage( &ms->Coverage );
+ }
+
+
+ static TT_Error Lookup_MultipleSubst( TTO_MultipleSubst* ms,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ TTO_GDEFHeader* gdef )
+ {
+ TT_Error error;
+ UShort index, property, n, count;
+ UShort* s;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &ms->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ if ( index >= ms->SequenceCount )
+ return TTO_Err_Invalid_GSUB_SubTable;
+
+ count = ms->Sequence[index].GlyphCount;
+ s = ms->Sequence[index].Substitute;
+
+ if ( ADD_String( in, 1, out, count, s, 0xFFFF, 0xFFFF ) )
+ return error;
+
+ if ( gdef && gdef->NewGlyphClasses )
+ {
+ /* this is a guess only ... */
+
+ if ( property == TTO_LIGATURE )
+ property = TTO_BASE_GLYPH;
+
+ for ( n = 0; n < count; n++ )
+ {
+ error = Add_Glyph_Property( gdef, s[n], property );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 3 */
+
+ /* AlternateSet */
+
+ static TT_Error Load_AlternateSet( TTO_AlternateSet* as,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* a;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = as->GlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ as->Alternate = NULL;
+
+ if ( ALLOC_ARRAY( as->Alternate, count, UShort ) )
+ return error;
+
+ a = as->Alternate;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( a );
+ return error;
+ }
+
+ for ( n = 0; n < count; n++ )
+ a[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_AlternateSet( TTO_AlternateSet* as )
+ {
+ FREE( as->Alternate );
+ }
+
+
+ /* AlternateSubstFormat1 */
+
+ TT_Error Load_AlternateSubst( TTO_AlternateSubst* as,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_AlternateSet* aset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ as->SubstFormat = GET_UShort(); /* should be 1 */
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &as->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = as->AlternateSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ as->AlternateSet = NULL;
+
+ if ( ALLOC_ARRAY( as->AlternateSet, count, TTO_AlternateSet ) )
+ goto Fail2;
+
+ aset = as->AlternateSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_AlternateSet( &aset[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_AlternateSet( &aset[n] );
+
+ FREE( aset );
+
+ Fail2:
+ Free_Coverage( &as->Coverage );
+ return error;
+ }
+
+
+ void Free_AlternateSubst( TTO_AlternateSubst* as )
+ {
+ UShort n, count;
+
+ TTO_AlternateSet* aset;
+
+
+ if ( as->AlternateSet )
+ {
+ count = as->AlternateSetCount;
+ aset = as->AlternateSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_AlternateSet( &aset[n] );
+
+ FREE( aset );
+ }
+
+ Free_Coverage( &as->Coverage );
+ }
+
+
+ static TT_Error Lookup_AlternateSubst( TTO_GSUBHeader* gsub,
+ TTO_AlternateSubst* as,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ TTO_GDEFHeader* gdef )
+ {
+ TT_Error error;
+ UShort index, alt_index, property;
+
+ TTO_AlternateSet aset;
+
+
+ if ( context_length != 0xFFFF && context_length < 1 )
+ return TTO_Err_Not_Covered;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &as->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ aset = as->AlternateSet[index];
+
+ /* we use a user-defined callback function to get the alternate index */
+
+ if ( gsub->altfunc )
+ alt_index = (gsub->altfunc)( out->pos, in->string[in->pos],
+ aset.GlyphCount, aset.Alternate,
+ gsub->data );
+ else
+ alt_index = 0;
+
+ if ( ADD_String( in, 1, out, 1, &aset.Alternate[alt_index],
+ 0xFFFF, 0xFFFF ) )
+ return error;
+
+ if ( gdef && gdef->NewGlyphClasses )
+ {
+ /* we inherit the old glyph class to the substituted glyph */
+
+ error = Add_Glyph_Property( gdef, aset.Alternate[alt_index],
+ property );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 4 */
+
+ /* Ligature */
+
+ static TT_Error Load_Ligature( TTO_Ligature* l,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* c;
+
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ l->LigGlyph = GET_UShort();
+ l->ComponentCount = GET_UShort();
+
+ FORGET_Frame();
+
+ l->Component = NULL;
+
+ count = l->ComponentCount - 1; /* only ComponentCount - 1 elements */
+
+ if ( ALLOC_ARRAY( l->Component, count, UShort ) )
+ return error;
+
+ c = l->Component;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( c );
+ return error;
+ }
+
+ for ( n = 0; n < count; n++ )
+ c[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_Ligature( TTO_Ligature* l )
+ {
+ FREE( l->Component );
+ }
+
+
+ /* LigatureSet */
+
+ static TT_Error Load_LigatureSet( TTO_LigatureSet* ls,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Ligature* l;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ls->LigatureCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ls->Ligature = NULL;
+
+ if ( ALLOC_ARRAY( ls->Ligature, count, TTO_Ligature ) )
+ return error;
+
+ l = ls->Ligature;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Ligature( &l[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_Ligature( &l[n] );
+
+ FREE( l );
+ return error;
+ }
+
+
+ static void Free_LigatureSet( TTO_LigatureSet* ls )
+ {
+ UShort n, count;
+
+ TTO_Ligature* l;
+
+
+ if ( ls->Ligature )
+ {
+ count = ls->LigatureCount;
+ l = ls->Ligature;
+
+ for ( n = 0; n < count; n++ )
+ Free_Ligature( &l[n] );
+
+ FREE( l );
+ }
+ }
+
+
+ /* LigatureSubstFormat1 */
+
+ TT_Error Load_LigatureSubst( TTO_LigatureSubst* ls,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_LigatureSet* lset;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ ls->SubstFormat = GET_UShort(); /* should be 1 */
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ls->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = ls->LigatureSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ls->LigatureSet = NULL;
+
+ if ( ALLOC_ARRAY( ls->LigatureSet, count, TTO_LigatureSet ) )
+ goto Fail2;
+
+ lset = ls->LigatureSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LigatureSet( &lset[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_LigatureSet( &lset[n] );
+
+ FREE( lset );
+
+ Fail2:
+ Free_Coverage( &ls->Coverage );
+ return error;
+ }
+
+
+ void Free_LigatureSubst( TTO_LigatureSubst* ls )
+ {
+ UShort n, count;
+
+ TTO_LigatureSet* lset;
+
+
+ if ( ls->LigatureSet )
+ {
+ count = ls->LigatureSetCount;
+ lset = ls->LigatureSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_LigatureSet( &lset[n] );
+
+ FREE( lset );
+ }
+
+ Free_Coverage( &ls->Coverage );
+ }
+
+
+ static TT_Error Lookup_LigatureSubst( TTO_LigatureSubst* ls,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ TTO_GDEFHeader* gdef )
+ {
+ UShort index, property;
+ TT_Error error;
+ UShort numlig, i, j, is_mark, first_is_mark = FALSE;
+ UShort first_ligID, first_comp;
+ UShort *s_in, *lig_in, *comp_in;
+ UShort* c;
+
+ TTO_Ligature* lig;
+
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ if ( property == TTO_MARK || property & IGNORE_SPECIAL_MARKS )
+ first_is_mark = TRUE;
+
+ error = Coverage_Index( &ls->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ if ( index >= ls->LigatureSetCount )
+ return TTO_Err_Invalid_GSUB_SubTable;
+
+ lig = ls->LigatureSet[index].Ligature;
+
+ for ( numlig = ls->LigatureSet[index].LigatureCount;
+ numlig;
+ numlig--, lig++ )
+ {
+ if ( in->pos + lig->ComponentCount > in->length )
+ continue; /* Not enough glyphs in input */
+
+ s_in = &in->string[in->pos];
+ lig_in = &in->ligIDs[in->pos];
+ comp_in = &in->components[in->pos];
+ first_ligID = *lig_in;
+ first_comp = *comp_in;
+ c = lig->Component;
+
+ is_mark = first_is_mark;
+
+ if ( context_length != 0xFFFF && context_length < lig->ComponentCount )
+ break;
+
+ for ( i = 1, j = 1; i < lig->ComponentCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ /* don't apply a ligature lookup to glyphs with different
+ ligature IDs. Example:
+
+ '
+ ^' ' ^
+ f ^ l ' -> fl ^ ' -> fl but not fl ^ -> fl */
+
+ if ( first_ligID != lig_in[j] )
+ break;
+
+ /* don't apply a ligature lookup to glyphs with different
+ component values. Example:
+
+ '
+ ^' ' ^
+ f ^ f ' l -> ffl ^ ' -> ffl but not ffl ^ -> ffl */
+
+ if ( first_comp != comp_in[j] )
+ break;
+
+ if ( !( property == TTO_MARK || property & IGNORE_SPECIAL_MARKS ) )
+ is_mark = FALSE;
+
+ if ( s_in[j] != c[i - 1] )
+ break;
+ }
+
+ if ( i == lig->ComponentCount )
+ {
+ if ( gdef && gdef->NewGlyphClasses )
+ {
+ /* this is just a guess ... */
+
+ error = Add_Glyph_Property( gdef, lig->LigGlyph,
+ is_mark ? TTO_MARK : TTO_LIGATURE );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ if ( i == j )
+ {
+ /* We don't use a new ligature ID if there are no skipped
+ glyphs and the ligature already has an ID. */
+
+ if ( in->ligIDs[in->pos] )
+ {
+ if ( ADD_String( in, i, out, 1, &lig->LigGlyph,
+ 0xFFFF, 0xFFFF ) )
+ return error;
+ }
+ else
+ {
+ if ( ADD_String( in, i, out, 1, &lig->LigGlyph,
+ 0xFFFF, in->max_ligID ) )
+ return error;
+
+ (in->max_ligID)++;
+ }
+ }
+ else
+ {
+ if ( ADD_String( in, 1, out, 1, &lig->LigGlyph,
+ 0xFFFF, in->max_ligID ) )
+ return error;
+
+ /* Now we must do a second loop to copy the skipped glyphs to
+ `out' and assign component values to it. We start with the
+ glyph after the first component. Glyphs between component
+ i and i+1 belong to component i. Together with the ligID
+ value it is later possible to check whether a specific
+ component value really belongs to a given ligature. */
+
+ for ( i = 0; i < lig->ComponentCount - 1; i++ )
+ {
+ while ( CHECK_Property( gdef, in->string[in->pos],
+ flags, &property ) )
+ if ( ADD_String( in, 1, out, 1, &in->string[in->pos],
+ i, in->max_ligID ) )
+ return error;
+
+ (in->pos)++;
+ }
+
+ (in->max_ligID)++;
+ }
+
+ return TT_Err_Ok;
+ }
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* Do the actual substitution for a context substitution (either format
+ 5 or 6). This is only called after we've determined that the input
+ matches the subrule. */
+
+ static TT_Error Do_ContextSubst( TTO_GSUBHeader* gsub,
+ UShort GlyphCount,
+ UShort SubstCount,
+ TTO_SubstLookupRecord* subst,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ int nesting_level )
+ {
+ TT_Error error;
+ UShort i, old_pos;
+
+
+ i = 0;
+
+ while ( i < GlyphCount )
+ {
+ if ( SubstCount && i == subst->SequenceIndex )
+ {
+ old_pos = in->pos;
+
+ /* Do a substitution */
+
+ error = Do_Glyph_Lookup( gsub, subst->LookupListIndex, in, out,
+ GlyphCount, nesting_level );
+
+ subst++;
+ SubstCount--;
+ i += in->pos - old_pos;
+
+ if ( error == TTO_Err_Not_Covered )
+ {
+ /* XXX "can't happen" -- but don't count on it */
+
+ if ( ADD_String( in, 1, out, 1, &in->string[in->pos],
+ 0xFFFF, 0xFFFF ) )
+ return error;
+ i++;
+ }
+ else if ( error )
+ return error;
+ }
+ else
+ {
+ /* No substitution for this index */
+
+ if ( ADD_String( in, 1, out, 1, &in->string[in->pos],
+ 0xFFFF, 0xFFFF ) )
+ return error;
+ i++;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ /* LookupType 5 */
+
+ /* SubRule */
+
+ static TT_Error Load_SubRule( TTO_SubRule* sr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* i;
+
+ TTO_SubstLookupRecord* slr;
+
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ sr->GlyphCount = GET_UShort();
+ sr->SubstCount = GET_UShort();
+
+ FORGET_Frame();
+
+ sr->Input = NULL;
+
+ count = sr->GlyphCount - 1; /* only GlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( sr->Input, count, UShort ) )
+ return error;
+
+ i = sr->Input;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ i[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ sr->SubstLookupRecord = NULL;
+
+ count = sr->SubstCount;
+
+ if ( ALLOC_ARRAY( sr->SubstLookupRecord, count, TTO_SubstLookupRecord ) )
+ goto Fail2;
+
+ slr = sr->SubstLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ slr[n].SequenceIndex = GET_UShort();
+ slr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( slr );
+
+ Fail2:
+ FREE( i );
+ return error;
+ }
+
+
+ static void Free_SubRule( TTO_SubRule* sr )
+ {
+ FREE( sr->SubstLookupRecord );
+ FREE( sr->Input );
+ }
+
+
+ /* SubRuleSet */
+
+ static TT_Error Load_SubRuleSet( TTO_SubRuleSet* srs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_SubRule* sr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = srs->SubRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ srs->SubRule = NULL;
+
+ if ( ALLOC_ARRAY( srs->SubRule, count, TTO_SubRule ) )
+ return error;
+
+ sr = srs->SubRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_SubRule( &sr[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_SubRule( &sr[n] );
+
+ FREE( sr );
+ return error;
+ }
+
+
+ static void Free_SubRuleSet( TTO_SubRuleSet* srs )
+ {
+ UShort n, count;
+
+ TTO_SubRule* sr;
+
+
+ if ( srs->SubRule )
+ {
+ count = srs->SubRuleCount;
+ sr = srs->SubRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_SubRule( &sr[n] );
+
+ FREE( sr );
+ }
+ }
+
+
+ /* ContextSubstFormat1 */
+
+ static TT_Error Load_ContextSubst1( TTO_ContextSubstFormat1* csf1,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_SubRuleSet* srs;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &csf1->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = csf1->SubRuleSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csf1->SubRuleSet = NULL;
+
+ if ( ALLOC_ARRAY( csf1->SubRuleSet, count, TTO_SubRuleSet ) )
+ goto Fail2;
+
+ srs = csf1->SubRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_SubRuleSet( &srs[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_SubRuleSet( &srs[n] );
+
+ FREE( srs );
+
+ Fail2:
+ Free_Coverage( &csf1->Coverage );
+ return error;
+ }
+
+
+ static void Free_Context1( TTO_ContextSubstFormat1* csf1 )
+ {
+ UShort n, count;
+
+ TTO_SubRuleSet* srs;
+
+
+ if ( csf1->SubRuleSet )
+ {
+ count = csf1->SubRuleSetCount;
+ srs = csf1->SubRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_SubRuleSet( &srs[n] );
+
+ FREE( srs );
+ }
+
+ Free_Coverage( &csf1->Coverage );
+ }
+
+
+ /* SubClassRule */
+
+ static TT_Error Load_SubClassRule( TTO_ContextSubstFormat2* csf2,
+ TTO_SubClassRule* scr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* c;
+ TTO_SubstLookupRecord* slr;
+ Bool* d;
+
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ scr->GlyphCount = GET_UShort();
+ scr->SubstCount = GET_UShort();
+
+ if ( scr->GlyphCount > csf2->MaxContextLength )
+ csf2->MaxContextLength = scr->GlyphCount;
+
+ FORGET_Frame();
+
+ scr->Class = NULL;
+
+ count = scr->GlyphCount - 1; /* only GlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( scr->Class, count, UShort ) )
+ return error;
+
+ c = scr->Class;
+ d = csf2->ClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ {
+ c[n] = GET_UShort();
+
+ /* We check whether the specific class is used at all. If not,
+ class 0 is used instead. */
+
+ if ( !d[c[n]] )
+ c[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ scr->SubstLookupRecord = NULL;
+
+ count = scr->SubstCount;
+
+ if ( ALLOC_ARRAY( scr->SubstLookupRecord, count, TTO_SubstLookupRecord ) )
+ goto Fail2;
+
+ slr = scr->SubstLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ slr[n].SequenceIndex = GET_UShort();
+ slr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( slr );
+
+ Fail2:
+ FREE( c );
+ return error;
+ }
+
+
+ static void Free_SubClassRule( TTO_SubClassRule* scr )
+ {
+ FREE( scr->SubstLookupRecord );
+ FREE( scr->Class );
+ }
+
+
+ /* SubClassSet */
+
+ static TT_Error Load_SubClassSet( TTO_ContextSubstFormat2* csf2,
+ TTO_SubClassSet* scs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_SubClassRule* scr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = scs->SubClassRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ scs->SubClassRule = NULL;
+
+ if ( ALLOC_ARRAY( scs->SubClassRule, count, TTO_SubClassRule ) )
+ return error;
+
+ scr = scs->SubClassRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_SubClassRule( csf2, &scr[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_SubClassRule( &scr[n] );
+
+ FREE( scr );
+ return error;
+ }
+
+
+ static void Free_SubClassSet( TTO_SubClassSet* scs )
+ {
+ UShort n, count;
+
+ TTO_SubClassRule* scr;
+
+
+ if ( scs->SubClassRule )
+ {
+ count = scs->SubClassRuleCount;
+ scr = scs->SubClassRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_SubClassRule( &scr[n] );
+
+ FREE( scr );
+ }
+ }
+
+
+ /* ContextSubstFormat2 */
+
+ static TT_Error Load_ContextSubst2( TTO_ContextSubstFormat2* csf2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_SubClassSet* scs;
+
+
+ base_offset = FILE_Pos() - 2;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &csf2->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ /* `SubClassSetCount' is the upper limit for class values, thus we
+ read it now to make an additional safety check. */
+
+ count = csf2->SubClassSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ClassDefinition( &csf2->ClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+
+ csf2->SubClassSet = NULL;
+ csf2->MaxContextLength = 0;
+
+ if ( ALLOC_ARRAY( csf2->SubClassSet, count, TTO_SubClassSet ) )
+ goto Fail2;
+
+ scs = csf2->SubClassSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ if ( new_offset != base_offset ) /* not a NULL offset */
+ {
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_SubClassSet( csf2, &scs[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ /* we create a SubClassSet table with no entries */
+
+ csf2->SubClassSet[n].SubClassRuleCount = 0;
+ csf2->SubClassSet[n].SubClassRule = NULL;
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_SubClassSet( &scs[n] );
+
+ FREE( scs );
+
+ Fail2:
+ Free_ClassDefinition( &csf2->ClassDef );
+
+ Fail3:
+ Free_Coverage( &csf2->Coverage );
+ return error;
+ }
+
+
+ static void Free_Context2( TTO_ContextSubstFormat2* csf2 )
+ {
+ UShort n, count;
+
+ TTO_SubClassSet* scs;
+
+
+ if ( csf2->SubClassSet )
+ {
+ count = csf2->SubClassSetCount;
+ scs = csf2->SubClassSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_SubClassSet( &scs[n] );
+
+ FREE( scs );
+ }
+
+ Free_ClassDefinition( &csf2->ClassDef );
+ Free_Coverage( &csf2->Coverage );
+ }
+
+
+ /* ContextSubstFormat3 */
+
+ static TT_Error Load_ContextSubst3( TTO_ContextSubstFormat3* csf3,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Coverage* c;
+ TTO_SubstLookupRecord* slr;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ csf3->GlyphCount = GET_UShort();
+ csf3->SubstCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csf3->Coverage = NULL;
+
+ count = csf3->GlyphCount;
+
+ if ( ALLOC_ARRAY( csf3->Coverage, count, TTO_Coverage ) )
+ return error;
+
+ c = csf3->Coverage;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &c[n], input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ csf3->SubstLookupRecord = NULL;
+
+ count = csf3->SubstCount;
+
+ if ( ALLOC_ARRAY( csf3->SubstLookupRecord, count,
+ TTO_SubstLookupRecord ) )
+ goto Fail2;
+
+ slr = csf3->SubstLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ slr[n].SequenceIndex = GET_UShort();
+ slr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( slr );
+
+ Fail2:
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ return error;
+ }
+
+
+ static void Free_Context3( TTO_ContextSubstFormat3* csf3 )
+ {
+ UShort n, count;
+
+ TTO_Coverage* c;
+
+
+ FREE( csf3->SubstLookupRecord );
+
+ if ( csf3->Coverage )
+ {
+ count = csf3->GlyphCount;
+ c = csf3->Coverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+ }
+
+
+ /* ContextSubst */
+
+ TT_Error Load_ContextSubst( TTO_ContextSubst* cs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cs->SubstFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( cs->SubstFormat )
+ {
+ case 1:
+ return Load_ContextSubst1( &cs->csf.csf1, input );
+
+ case 2:
+ return Load_ContextSubst2( &cs->csf.csf2, input );
+
+ case 3:
+ return Load_ContextSubst3( &cs->csf.csf3, input );
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ void Free_ContextSubst( TTO_ContextSubst* cs )
+ {
+ switch ( cs->SubstFormat )
+ {
+ case 1:
+ Free_Context1( &cs->csf.csf1 );
+ break;
+
+ case 2:
+ Free_Context2( &cs->csf.csf2 );
+ break;
+
+ case 3:
+ Free_Context3( &cs->csf.csf3 );
+ break;
+ }
+ }
+
+
+ static TT_Error Lookup_ContextSubst1(
+ TTO_GSUBHeader* gsub,
+ TTO_ContextSubstFormat1* csf1,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ UShort i, j, k, numsr;
+ TT_Error error;
+ UShort* s_in;
+
+ TTO_SubRule* sr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gsub->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &csf1->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ sr = csf1->SubRuleSet[index].SubRule;
+ numsr = csf1->SubRuleSet[index].SubRuleCount;
+
+ for ( k = 0; k < numsr; k++ )
+ {
+ if ( context_length != 0xFFFF && context_length < sr[k].GlyphCount )
+ continue;
+
+ if ( in->pos + sr[k].GlyphCount > in->length )
+ continue; /* context is too long */
+
+ s_in = &in->string[in->pos];
+
+ for ( i = 1, j = 1; i < sr[k].GlyphCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( s_in[j] != sr[k].Input[i - 1] )
+ break;
+ }
+
+ if ( i == sr[k].GlyphCount )
+ return Do_ContextSubst( gsub, sr[k].GlyphCount,
+ sr[k].SubstCount, sr[k].SubstLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ static TT_Error Lookup_ContextSubst2(
+ TTO_GSUBHeader* gsub,
+ TTO_ContextSubstFormat2* csf2,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_Error error;
+ UShort i, j, k, known_classes;
+
+ UShort* classes;
+ UShort* s_in;
+ UShort* cl;
+
+ TTO_SubClassSet* scs;
+ TTO_SubClassRule* sr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gsub->gdef;
+
+ if ( ALLOC_ARRAY( classes, csf2->MaxContextLength, UShort ) )
+ return error;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ /* Note: The coverage table in format 2 doesn't give an index into
+ anything. It just lets us know whether or not we need to
+ do any lookup at all. */
+
+ error = Coverage_Index( &csf2->Coverage, in->string[in->pos], &index );
+ if ( error )
+ goto End;
+
+ error = Get_Class( &csf2->ClassDef, in->string[in->pos],
+ &classes[0], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End;
+ known_classes = 0;
+
+ scs = &csf2->SubClassSet[classes[0]];
+ if ( !scs )
+ {
+ error = TTO_Err_Invalid_GSUB_SubTable;
+ goto End;
+ }
+
+ for ( k = 0; k < scs->SubClassRuleCount; k++ )
+ {
+ sr = &scs->SubClassRule[k];
+
+ if ( context_length != 0xFFFF && context_length < sr->GlyphCount )
+ continue;
+
+ if ( in->pos + sr->GlyphCount > in->length )
+ continue; /* context is too long */
+
+ s_in = &in->string[in->pos];
+ cl = sr->Class;
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < sr->GlyphCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( i > known_classes )
+ {
+ /* Keeps us from having to do this for each rule */
+
+ error = Get_Class( &csf2->ClassDef, s_in[j], &classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ known_classes = i;
+ }
+
+ if ( cl[i - 1] != classes[i] )
+ break;
+ }
+
+ if ( i == sr->GlyphCount )
+ {
+ error = Do_ContextSubst( gsub, sr->GlyphCount,
+ sr->SubstCount, sr->SubstLookupRecord,
+ in, out,
+ nesting_level );
+ goto End;
+ }
+ }
+
+ error = TTO_Err_Not_Covered;
+
+ End:
+ FREE( classes );
+ return error;
+ }
+
+
+ static TT_Error Lookup_ContextSubst3(
+ TTO_GSUBHeader* gsub,
+ TTO_ContextSubstFormat3* csf3,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ TT_Error error;
+ UShort index, i, j, property;
+ UShort* s_in;
+
+ TTO_Coverage* c;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gsub->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ if ( context_length != 0xFFFF && context_length < csf3->GlyphCount )
+ return TTO_Err_Not_Covered;
+
+ if ( in->pos + csf3->GlyphCount > in->length )
+ return TTO_Err_Not_Covered; /* context is too long */
+
+ s_in = &in->string[in->pos];
+ c = csf3->Coverage;
+
+ for ( i = 1, j = 1; i < csf3->GlyphCount; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( in->pos + j < in->length )
+ j++;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &c[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+
+ return Do_ContextSubst( gsub, csf3->GlyphCount,
+ csf3->SubstCount, csf3->SubstLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+
+ static TT_Error Lookup_ContextSubst( TTO_GSUBHeader* gsub,
+ TTO_ContextSubst* cs,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ switch ( cs->SubstFormat )
+ {
+ case 1:
+ return Lookup_ContextSubst1( gsub, &cs->csf.csf1, in, out,
+ flags, context_length, nesting_level );
+
+ case 2:
+ return Lookup_ContextSubst2( gsub, &cs->csf.csf2, in, out,
+ flags, context_length, nesting_level );
+
+ case 3:
+ return Lookup_ContextSubst3( gsub, &cs->csf.csf3, in, out,
+ flags, context_length, nesting_level );
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ /* LookupType 6 */
+
+ /* ChainSubRule */
+
+ static TT_Error Load_ChainSubRule( TTO_ChainSubRule* csr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort* b;
+ UShort* i;
+ UShort* l;
+
+ TTO_SubstLookupRecord* slr;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ csr->BacktrackGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csr->Backtrack = NULL;
+
+ count = csr->BacktrackGlyphCount;
+
+ if ( ALLOC_ARRAY( csr->Backtrack, count, UShort ) )
+ return error;
+
+ b = csr->Backtrack;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail4;
+
+ for ( n = 0; n < count; n++ )
+ b[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ csr->InputGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csr->Input = NULL;
+
+ count = csr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( csr->Input, count, UShort ) )
+ goto Fail4;
+
+ i = csr->Input;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail3;
+
+ for ( n = 0; n < count; n++ )
+ i[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ csr->LookaheadGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csr->Lookahead = NULL;
+
+ count = csr->LookaheadGlyphCount;
+
+ if ( ALLOC_ARRAY( csr->Lookahead, count, UShort ) )
+ goto Fail3;
+
+ l = csr->Lookahead;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ l[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ csr->SubstCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csr->SubstLookupRecord = NULL;
+
+ count = csr->SubstCount;
+
+ if ( ALLOC_ARRAY( csr->SubstLookupRecord, count, TTO_SubstLookupRecord ) )
+ goto Fail2;
+
+ slr = csr->SubstLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ slr[n].SequenceIndex = GET_UShort();
+ slr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( slr );
+
+ Fail2:
+ FREE( l );
+
+ Fail3:
+ FREE( i );
+
+ Fail4:
+ FREE( b );
+ return error;
+ }
+
+
+ static void Free_ChainSubRule( TTO_ChainSubRule* csr )
+ {
+ FREE( csr->SubstLookupRecord );
+ FREE( csr->Lookahead );
+ FREE( csr->Input );
+ FREE( csr->Backtrack );
+ }
+
+
+ /* ChainSubRuleSet */
+
+ static TT_Error Load_ChainSubRuleSet( TTO_ChainSubRuleSet* csrs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ChainSubRule* csr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = csrs->ChainSubRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ csrs->ChainSubRule = NULL;
+
+ if ( ALLOC_ARRAY( csrs->ChainSubRule, count, TTO_ChainSubRule ) )
+ return error;
+
+ csr = csrs->ChainSubRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainSubRule( &csr[n], input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubRule( &csr[n] );
+
+ FREE( csr );
+ return error;
+ }
+
+
+ static void Free_ChainSubRuleSet( TTO_ChainSubRuleSet* csrs )
+ {
+ UShort n, count;
+
+ TTO_ChainSubRule* csr;
+
+
+ if ( csrs->ChainSubRule )
+ {
+ count = csrs->ChainSubRuleCount;
+ csr = csrs->ChainSubRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubRule( &csr[n] );
+
+ FREE( csr );
+ }
+ }
+
+
+ /* ChainContextSubstFormat1 */
+
+ static TT_Error Load_ChainContextSubst1(
+ TTO_ChainContextSubstFormat1* ccsf1,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ChainSubRuleSet* csrs;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ccsf1->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = ccsf1->ChainSubRuleSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccsf1->ChainSubRuleSet = NULL;
+
+ if ( ALLOC_ARRAY( ccsf1->ChainSubRuleSet, count, TTO_ChainSubRuleSet ) )
+ goto Fail2;
+
+ csrs = ccsf1->ChainSubRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainSubRuleSet( &csrs[n], input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubRuleSet( &csrs[n] );
+
+ FREE( csrs );
+
+ Fail2:
+ Free_Coverage( &ccsf1->Coverage );
+ return error;
+ }
+
+
+ static void Free_ChainContext1( TTO_ChainContextSubstFormat1* ccsf1 )
+ {
+ UShort n, count;
+
+ TTO_ChainSubRuleSet* csrs;
+
+
+ if ( ccsf1->ChainSubRuleSet )
+ {
+ count = ccsf1->ChainSubRuleSetCount;
+ csrs = ccsf1->ChainSubRuleSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubRuleSet( &csrs[n] );
+
+ FREE( csrs );
+ }
+
+ Free_Coverage( &ccsf1->Coverage );
+ }
+
+
+ /* ChainSubClassRule */
+
+ static TT_Error Load_ChainSubClassRule(
+ TTO_ChainContextSubstFormat2* ccsf2,
+ TTO_ChainSubClassRule* cscr,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* b;
+ UShort* i;
+ UShort* l;
+ TTO_SubstLookupRecord* slr;
+ Bool* d;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ cscr->BacktrackGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( cscr->BacktrackGlyphCount > ccsf2->MaxBacktrackLength )
+ ccsf2->MaxBacktrackLength = cscr->BacktrackGlyphCount;
+
+ cscr->Backtrack = NULL;
+
+ count = cscr->BacktrackGlyphCount;
+
+ if ( ALLOC_ARRAY( cscr->Backtrack, count, UShort ) )
+ return error;
+
+ b = cscr->Backtrack;
+ d = ccsf2->BacktrackClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail4;
+
+ for ( n = 0; n < count; n++ )
+ {
+ b[n] = GET_UShort();
+
+ /* We check whether the specific class is used at all. If not,
+ class 0 is used instead. */
+
+ if ( !d[b[n]] )
+ b[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ cscr->InputGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( cscr->InputGlyphCount > ccsf2->MaxInputLength )
+ ccsf2->MaxInputLength = cscr->InputGlyphCount;
+
+ cscr->Input = NULL;
+
+ count = cscr->InputGlyphCount - 1; /* only InputGlyphCount - 1 elements */
+
+ if ( ALLOC_ARRAY( cscr->Input, count, UShort ) )
+ goto Fail4;
+
+ i = cscr->Input;
+ d = ccsf2->InputClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail3;
+
+ for ( n = 0; n < count; n++ )
+ {
+ i[n] = GET_UShort();
+
+ if ( !d[i[n]] )
+ i[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ cscr->LookaheadGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( cscr->LookaheadGlyphCount > ccsf2->MaxLookaheadLength )
+ ccsf2->MaxLookaheadLength = cscr->LookaheadGlyphCount;
+
+ cscr->Lookahead = NULL;
+
+ count = cscr->LookaheadGlyphCount;
+
+ if ( ALLOC_ARRAY( cscr->Lookahead, count, UShort ) )
+ goto Fail3;
+
+ l = cscr->Lookahead;
+ d = ccsf2->LookaheadClassDef.Defined;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail2;
+
+ for ( n = 0; n < count; n++ )
+ {
+ l[n] = GET_UShort();
+
+ if ( !d[l[n]] )
+ l[n] = 0;
+ }
+
+ FORGET_Frame();
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ cscr->SubstCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cscr->SubstLookupRecord = NULL;
+
+ count = cscr->SubstCount;
+
+ if ( ALLOC_ARRAY( cscr->SubstLookupRecord, count,
+ TTO_SubstLookupRecord ) )
+ goto Fail2;
+
+ slr = cscr->SubstLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ slr[n].SequenceIndex = GET_UShort();
+ slr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( slr );
+
+ Fail2:
+ FREE( l );
+
+ Fail3:
+ FREE( i );
+
+ Fail4:
+ FREE( b );
+ return error;
+ }
+
+
+ static void Free_ChainSubClassRule( TTO_ChainSubClassRule* cscr )
+ {
+ FREE( cscr->SubstLookupRecord );
+ FREE( cscr->Lookahead );
+ FREE( cscr->Input );
+ FREE( cscr->Backtrack );
+ }
+
+
+ /* SubClassSet */
+
+ static TT_Error Load_ChainSubClassSet(
+ TTO_ChainContextSubstFormat2* ccsf2,
+ TTO_ChainSubClassSet* cscs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ChainSubClassRule* cscr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = cscs->ChainSubClassRuleCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cscs->ChainSubClassRule = NULL;
+
+ if ( ALLOC_ARRAY( cscs->ChainSubClassRule, count,
+ TTO_ChainSubClassRule ) )
+ return error;
+
+ cscr = cscs->ChainSubClassRule;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainSubClassRule( ccsf2, &cscr[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubClassRule( &cscr[n] );
+
+ FREE( cscr );
+ return error;
+ }
+
+
+ static void Free_ChainSubClassSet( TTO_ChainSubClassSet* cscs )
+ {
+ UShort n, count;
+
+ TTO_ChainSubClassRule* cscr;
+
+
+ if ( cscs->ChainSubClassRule )
+ {
+ count = cscs->ChainSubClassRuleCount;
+ cscr = cscs->ChainSubClassRule;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubClassRule( &cscr[n] );
+
+ FREE( cscr );
+ }
+ }
+
+
+ /* ChainContextSubstFormat2 */
+
+ static TT_Error Load_ChainContextSubst2(
+ TTO_ChainContextSubstFormat2* ccsf2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+ ULong backtrack_offset, input_offset, lookahead_offset;
+
+ TTO_ChainSubClassSet* cscs;
+
+
+ base_offset = FILE_Pos() - 2;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &ccsf2->Coverage, input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+
+ if ( ACCESS_Frame( 8L ) )
+ goto Fail5;
+
+ backtrack_offset = GET_UShort() + base_offset;
+ input_offset = GET_UShort() + base_offset;
+ lookahead_offset = GET_UShort() + base_offset;
+
+ /* `ChainSubClassSetCount' is the upper limit for input class values,
+ thus we read it now to make an additional safety check. */
+
+ count = ccsf2->ChainSubClassSetCount = GET_UShort();
+
+ FORGET_Frame();
+
+ /* backtrack and lookahead data can be optional */
+
+ cur_offset = FILE_Pos();
+ if ( backtrack_offset != base_offset ) {
+ if ( FILE_Seek( backtrack_offset ) ||
+ ( error = Load_ClassDefinition( &ccsf2->BacktrackClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail5;
+ }
+ if ( FILE_Seek( input_offset ) ||
+ ( error = Load_ClassDefinition( &ccsf2->InputClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail4;
+ if ( lookahead_offset != base_offset ) {
+ if ( FILE_Seek( lookahead_offset ) ||
+ ( error = Load_ClassDefinition( &ccsf2->LookaheadClassDef, count,
+ input ) ) != TT_Err_Ok )
+ goto Fail3;
+ }
+ (void)FILE_Seek( cur_offset );
+
+ ccsf2->ChainSubClassSet = NULL;
+ ccsf2->MaxBacktrackLength = 0;
+ ccsf2->MaxInputLength = 0;
+ ccsf2->MaxLookaheadLength = 0;
+
+ if ( ALLOC_ARRAY( ccsf2->ChainSubClassSet, count, TTO_ChainSubClassSet ) )
+ goto Fail2;
+
+ cscs = ccsf2->ChainSubClassSet;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ if ( new_offset != base_offset ) /* not a NULL offset */
+ {
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_ChainSubClassSet( ccsf2, &cscs[n],
+ input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ /* we create a ChainSubClassSet table with no entries */
+
+ ccsf2->ChainSubClassSet[n].ChainSubClassRuleCount = 0;
+ ccsf2->ChainSubClassSet[n].ChainSubClassRule = NULL;
+ }
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubClassSet( &cscs[n] );
+
+ FREE( cscs );
+
+ Fail2:
+ Free_ClassDefinition( &ccsf2->LookaheadClassDef );
+
+ Fail3:
+ Free_ClassDefinition( &ccsf2->InputClassDef );
+
+ Fail4:
+ Free_ClassDefinition( &ccsf2->BacktrackClassDef );
+
+ Fail5:
+ Free_Coverage( &ccsf2->Coverage );
+ return error;
+ }
+
+
+ static void Free_ChainContext2( TTO_ChainContextSubstFormat2* ccsf2 )
+ {
+ UShort n, count;
+
+ TTO_ChainSubClassSet* cscs;
+
+
+ if ( ccsf2->ChainSubClassSet )
+ {
+ count = ccsf2->ChainSubClassSetCount;
+ cscs = ccsf2->ChainSubClassSet;
+
+ for ( n = 0; n < count; n++ )
+ Free_ChainSubClassSet( &cscs[n] );
+
+ FREE( cscs );
+ }
+
+ Free_ClassDefinition( &ccsf2->LookaheadClassDef );
+ Free_ClassDefinition( &ccsf2->InputClassDef );
+ Free_ClassDefinition( &ccsf2->BacktrackClassDef );
+
+ Free_Coverage( &ccsf2->Coverage );
+ }
+
+
+ /* ChainContextSubstFormat3 */
+
+ static TT_Error Load_ChainContextSubst3(
+ TTO_ChainContextSubstFormat3* ccsf3,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ UShort backtrack_count, input_count, lookahead_count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Coverage* b;
+ TTO_Coverage* i;
+ TTO_Coverage* l;
+ TTO_SubstLookupRecord* slr;
+
+
+ base_offset = FILE_Pos() - 2L;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ ccsf3->BacktrackGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccsf3->BacktrackCoverage = NULL;
+
+ backtrack_count = ccsf3->BacktrackGlyphCount;
+
+ if ( ALLOC_ARRAY( ccsf3->BacktrackCoverage, backtrack_count,
+ TTO_Coverage ) )
+ return error;
+
+ b = ccsf3->BacktrackCoverage;
+
+ for ( n = 0; n < backtrack_count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &b[n], input ) ) != TT_Err_Ok )
+ goto Fail4;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail4;
+
+ ccsf3->InputGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccsf3->InputCoverage = NULL;
+
+ input_count = ccsf3->InputGlyphCount;
+
+ if ( ALLOC_ARRAY( ccsf3->InputCoverage, input_count, TTO_Coverage ) )
+ goto Fail4;
+
+ i = ccsf3->InputCoverage;
+
+ for ( n = 0; n < input_count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &i[n], input ) ) != TT_Err_Ok )
+ goto Fail3;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail3;
+
+ ccsf3->LookaheadGlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccsf3->LookaheadCoverage = NULL;
+
+ lookahead_count = ccsf3->LookaheadGlyphCount;
+
+ if ( ALLOC_ARRAY( ccsf3->LookaheadCoverage, lookahead_count,
+ TTO_Coverage ) )
+ goto Fail3;
+
+ l = ccsf3->LookaheadCoverage;
+
+ for ( n = 0; n < lookahead_count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Coverage( &l[n], input ) ) != TT_Err_Ok )
+ goto Fail2;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ ccsf3->SubstCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ccsf3->SubstLookupRecord = NULL;
+
+ count = ccsf3->SubstCount;
+
+ if ( ALLOC_ARRAY( ccsf3->SubstLookupRecord, count,
+ TTO_SubstLookupRecord ) )
+ goto Fail2;
+
+ slr = ccsf3->SubstLookupRecord;
+
+ if ( ACCESS_Frame( count * 4L ) )
+ goto Fail1;
+
+ for ( n = 0; n < count; n++ )
+ {
+ slr[n].SequenceIndex = GET_UShort();
+ slr[n].LookupListIndex = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( slr );
+
+ Fail2:
+ for ( n = 0; n < lookahead_count; n++ )
+ Free_Coverage( &l[n] );
+
+ FREE( l );
+
+ Fail3:
+ for ( n = 0; n < input_count; n++ )
+ Free_Coverage( &i[n] );
+
+ FREE( i );
+
+ Fail4:
+ for ( n = 0; n < backtrack_count; n++ )
+ Free_Coverage( &b[n] );
+
+ FREE( b );
+ return error;
+ }
+
+
+ static void Free_ChainContext3( TTO_ChainContextSubstFormat3* ccsf3 )
+ {
+ UShort n, count;
+
+ TTO_Coverage* c;
+
+
+ FREE( ccsf3->SubstLookupRecord );
+
+ if ( ccsf3->LookaheadCoverage )
+ {
+ count = ccsf3->LookaheadGlyphCount;
+ c = ccsf3->LookaheadCoverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+
+ if ( ccsf3->InputCoverage )
+ {
+ count = ccsf3->InputGlyphCount;
+ c = ccsf3->InputCoverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+
+ if ( ccsf3->BacktrackCoverage )
+ {
+ count = ccsf3->BacktrackGlyphCount;
+ c = ccsf3->BacktrackCoverage;
+
+ for ( n = 0; n < count; n++ )
+ Free_Coverage( &c[n] );
+
+ FREE( c );
+ }
+ }
+
+
+ /* ChainContextSubst */
+
+ TT_Error Load_ChainContextSubst( TTO_ChainContextSubst* ccs,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ ccs->SubstFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( ccs->SubstFormat )
+ {
+ case 1:
+ return Load_ChainContextSubst1( &ccs->ccsf.ccsf1, input );
+
+ case 2:
+ return Load_ChainContextSubst2( &ccs->ccsf.ccsf2, input );
+
+ case 3:
+ return Load_ChainContextSubst3( &ccs->ccsf.ccsf3, input );
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ void Free_ChainContextSubst( TTO_ChainContextSubst* ccs )
+ {
+ switch ( ccs->SubstFormat )
+ {
+ case 1:
+ Free_ChainContext1( &ccs->ccsf.ccsf1 );
+ break;
+
+ case 2:
+ Free_ChainContext2( &ccs->ccsf.ccsf2 );
+ break;
+
+ case 3:
+ Free_ChainContext3( &ccs->ccsf.ccsf3 );
+ break;
+ }
+ }
+
+
+ static TT_Error Lookup_ChainContextSubst1(
+ TTO_GSUBHeader* gsub,
+ TTO_ChainContextSubstFormat1* ccsf1,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ TT_UInt flags,
+ TT_UInt context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_UInt i, j, k, num_csr, curr_pos;
+ TT_UInt bgc, igc, lgc;
+ TT_Error error;
+ UShort* s_in;
+
+ TTO_ChainSubRule* csr;
+ TTO_ChainSubRule curr_csr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gsub->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ error = Coverage_Index( &ccsf1->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ csr = ccsf1->ChainSubRuleSet[index].ChainSubRule;
+ num_csr = ccsf1->ChainSubRuleSet[index].ChainSubRuleCount;
+
+ for ( k = 0; k < num_csr; k++ )
+ {
+ curr_csr = csr[k];
+ bgc = curr_csr.BacktrackGlyphCount;
+ igc = curr_csr.InputGlyphCount;
+ lgc = curr_csr.LookaheadGlyphCount;
+
+ if ( context_length != 0xFFFF && context_length < igc )
+ continue;
+
+ /* check whether context is too long; it is a first guess only */
+
+ if ( bgc > in->pos || in->pos + igc + lgc > in->length )
+ continue;
+
+ if ( bgc )
+ {
+ /* since we don't know in advance the number of glyphs to inspect,
+ we search backwards for matches in the backtrack glyph array */
+
+ curr_pos = 0;
+ s_in = &in->string[curr_pos];
+
+ for ( i = 0, j = in->pos - 1; i < bgc; i++, j-- )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( j > curr_pos )
+ j--;
+ else
+ break;
+ }
+
+ /* In OpenType 1.3, it is undefined whether the offsets of
+ backtrack glyphs is in logical order or not. Version 1.4
+ will clarify this:
+
+ Logical order - a b c d e f g h i j
+ i
+ Input offsets - 0 1
+ Backtrack offsets - 3 2 1 0
+ Lookahead offsets - 0 1 2 3 */
+
+ if ( s_in[j] != curr_csr.Backtrack[i] )
+ break;
+ }
+
+ if ( i != bgc )
+ continue;
+ }
+
+ curr_pos = in->pos;
+ s_in = &in->string[curr_pos];
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < igc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( s_in[j] != curr_csr.Input[i - 1] )
+ break;
+ }
+
+ if ( i != igc )
+ continue;
+
+ /* we are starting to check for lookahead glyphs right after the
+ last context glyph */
+
+ curr_pos = j;
+ s_in = &in->string[curr_pos];
+
+ for ( i = 0, j = 0; i < lgc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( s_in[j] != curr_csr.Lookahead[i] )
+ break;
+ }
+
+ if ( i == lgc )
+ return Do_ContextSubst( gsub, igc,
+ curr_csr.SubstCount,
+ curr_csr.SubstLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ static TT_Error Lookup_ChainContextSubst2(
+ TTO_GSUBHeader* gsub,
+ TTO_ChainContextSubstFormat2* ccsf2,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UInt flags,
+ UInt context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ TT_Error error;
+ UInt i, j, k, curr_pos;
+ UInt bgc, igc, lgc;
+ UShort known_backtrack_classes,
+ known_input_classes,
+ known_lookahead_classes;
+
+ UShort* backtrack_classes;
+ UShort* input_classes;
+ UShort* lookahead_classes;
+
+ UShort* s_in;
+
+ UShort* bc;
+ UShort* ic;
+ UShort* lc;
+
+ TTO_ChainSubClassSet* cscs;
+ TTO_ChainSubClassRule ccsr;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gsub->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ /* Note: The coverage table in format 2 doesn't give an index into
+ anything. It just lets us know whether or not we need to
+ do any lookup at all. */
+
+ error = Coverage_Index( &ccsf2->Coverage, in->string[in->pos], &index );
+ if ( error )
+ return error;
+
+ if ( ALLOC_ARRAY( backtrack_classes, ccsf2->MaxBacktrackLength, UShort ) )
+ return error;
+ known_backtrack_classes = 0;
+
+ if ( ALLOC_ARRAY( input_classes, ccsf2->MaxInputLength, UShort ) )
+ goto End3;
+ known_input_classes = 1;
+
+ if ( ALLOC_ARRAY( lookahead_classes, ccsf2->MaxLookaheadLength, UShort ) )
+ goto End2;
+ known_lookahead_classes = 0;
+
+ error = Get_Class( &ccsf2->InputClassDef, in->string[in->pos],
+ &input_classes[0], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+
+ cscs = &ccsf2->ChainSubClassSet[input_classes[0]];
+ if ( !cscs )
+ {
+ error = TTO_Err_Invalid_GSUB_SubTable;
+ goto End1;
+ }
+
+ for ( k = 0; k < (UInt)cscs->ChainSubClassRuleCount; k++ )
+ {
+ ccsr = cscs->ChainSubClassRule[k];
+ bgc = ccsr.BacktrackGlyphCount;
+ igc = ccsr.InputGlyphCount;
+ lgc = ccsr.LookaheadGlyphCount;
+
+ if ( context_length != 0xFFFF && context_length < igc )
+ continue;
+
+ /* check whether context is too long; it is a first guess only */
+
+ if ( bgc > in->pos || in->pos + igc + lgc > in->length )
+ continue;
+
+ if ( bgc )
+ {
+ /* Since we don't know in advance the number of glyphs to inspect,
+ we search backwards for matches in the backtrack glyph array.
+ Note that `known_backtrack_classes' starts at index 0. */
+
+ curr_pos = 0;
+ s_in = &in->string[curr_pos];
+ bc = ccsr.Backtrack;
+
+ for ( i = 0, j = in->pos - 1; i < bgc; i++, j-- )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( j > curr_pos )
+ j--;
+ else
+ break;
+ }
+
+ if ( i >= (UInt)known_backtrack_classes )
+ {
+ /* Keeps us from having to do this for each rule */
+
+ error = Get_Class( &ccsf2->BacktrackClassDef, s_in[j],
+ &backtrack_classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+ known_backtrack_classes = i;
+ }
+
+ if ( bc[i] != backtrack_classes[i] )
+ break;
+ }
+
+ if ( i != bgc )
+ continue;
+ }
+
+ curr_pos = in->pos;
+ s_in = &in->string[curr_pos];
+ ic = ccsr.Input;
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < igc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( i >= (UInt)known_input_classes )
+ {
+ error = Get_Class( &ccsf2->InputClassDef, s_in[j],
+ &input_classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+ known_input_classes = i;
+ }
+
+ if ( ic[i - 1] != input_classes[i] )
+ break;
+ }
+
+ if ( i != igc )
+ continue;
+
+ /* we are starting to check for lookahead glyphs right after the
+ last context glyph */
+
+ curr_pos = j;
+ s_in = &in->string[curr_pos];
+ lc = ccsr.Lookahead;
+
+ for ( i = 0, j = 0; i < lgc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ break;
+ }
+
+ if ( i >= (UInt)known_lookahead_classes )
+ {
+ error = Get_Class( &ccsf2->LookaheadClassDef, s_in[j],
+ &lookahead_classes[i], NULL );
+ if ( error && error != TTO_Err_Not_Covered )
+ goto End1;
+ known_lookahead_classes = i;
+ }
+
+ if ( lc[i] != lookahead_classes[i] )
+ break;
+ }
+
+ if ( i == lgc )
+ {
+ error = Do_ContextSubst( gsub, igc,
+ ccsr.SubstCount,
+ ccsr.SubstLookupRecord,
+ in, out,
+ nesting_level );
+ goto End1;
+ }
+ }
+
+ error = TTO_Err_Not_Covered;
+
+ End1:
+ FREE( lookahead_classes );
+
+ End2:
+ FREE( input_classes );
+
+ End3:
+ FREE( backtrack_classes );
+ return error;
+ }
+
+
+ static TT_Error Lookup_ChainContextSubst3(
+ TTO_GSUBHeader* gsub,
+ TTO_ChainContextSubstFormat3* ccsf3,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UInt flags,
+ UInt context_length,
+ int nesting_level )
+ {
+ UShort index, property;
+ UInt i, j, curr_pos, bgc, igc, lgc;
+ TT_Error error;
+ UShort* s_in;
+
+ TTO_Coverage* bc;
+ TTO_Coverage* ic;
+ TTO_Coverage* lc;
+ TTO_GDEFHeader* gdef;
+
+
+ gdef = gsub->gdef;
+
+ if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
+ return error;
+
+ bgc = ccsf3->BacktrackGlyphCount;
+ igc = ccsf3->InputGlyphCount;
+ lgc = ccsf3->LookaheadGlyphCount;
+
+ if ( context_length != 0xFFFF && context_length < igc )
+ return TTO_Err_Not_Covered;
+
+ /* check whether context is too long; it is a first guess only */
+
+ if ( bgc > in->pos || in->pos + igc + lgc > in->length )
+ return TTO_Err_Not_Covered;
+
+ if ( bgc )
+ {
+ /* Since we don't know in advance the number of glyphs to inspect,
+ we search backwards for matches in the backtrack glyph array */
+
+ curr_pos = 0;
+ s_in = &in->string[curr_pos];
+ bc = ccsf3->BacktrackCoverage;
+
+ for ( i = 0, j = in->pos - 1; i < bgc; i++, j-- )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( j > curr_pos )
+ j--;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &bc[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+ }
+
+ curr_pos = in->pos;
+ s_in = &in->string[curr_pos];
+ ic = ccsf3->InputCoverage;
+
+ /* Start at 1 because [0] is implied */
+
+ for ( i = 1, j = 1; i < igc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &ic[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+
+ /* we are starting for lookahead glyphs right after the last context
+ glyph */
+
+ curr_pos = j;
+ s_in = &in->string[curr_pos];
+ lc = ccsf3->LookaheadCoverage;
+
+ for ( i = 0, j = 0; i < lgc; i++, j++ )
+ {
+ while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
+ {
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ if ( curr_pos + j < in->length )
+ j++;
+ else
+ return TTO_Err_Not_Covered;
+ }
+
+ error = Coverage_Index( &lc[i], s_in[j], &index );
+ if ( error )
+ return error;
+ }
+
+ return Do_ContextSubst( gsub, igc,
+ ccsf3->SubstCount,
+ ccsf3->SubstLookupRecord,
+ in, out,
+ nesting_level );
+ }
+
+
+ static TT_Error Lookup_ChainContextSubst(
+ TTO_GSUBHeader* gsub,
+ TTO_ChainContextSubst* ccs,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort flags,
+ UShort context_length,
+ int nesting_level )
+ {
+ switch ( ccs->SubstFormat )
+ {
+ case 1:
+ return Lookup_ChainContextSubst1( gsub, &ccs->ccsf.ccsf1, in, out,
+ flags, context_length,
+ nesting_level );
+
+ case 2:
+ return Lookup_ChainContextSubst2( gsub, &ccs->ccsf.ccsf2, in, out,
+ flags, context_length,
+ nesting_level );
+
+ case 3:
+ return Lookup_ChainContextSubst3( gsub, &ccs->ccsf.ccsf3, in, out,
+ flags, context_length,
+ nesting_level );
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+
+ /***********
+ * GSUB API
+ ***********/
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Select_Script( TTO_GSUBHeader* gsub,
+ TT_ULong script_tag,
+ TT_UShort* script_index )
+ {
+ UShort n;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+
+
+ if ( !gsub || !script_index )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gsub->ScriptList;
+ sr = sl->ScriptRecord;
+
+ for ( n = 0; n < sl->ScriptCount; n++ )
+ if ( script_tag == sr[n].ScriptTag )
+ {
+ *script_index = n;
+
+ return TT_Err_Ok;
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Select_Language( TTO_GSUBHeader* gsub,
+ TT_ULong language_tag,
+ TT_UShort script_index,
+ TT_UShort* language_index,
+ TT_UShort* req_feature_index )
+ {
+ UShort n;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+
+
+ if ( !gsub || !language_index || !req_feature_index )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gsub->ScriptList;
+ sr = sl->ScriptRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ for ( n = 0; n < s->LangSysCount; n++ )
+ if ( language_tag == lsr[n].LangSysTag )
+ {
+ *language_index = n;
+ *req_feature_index = lsr[n].LangSys.ReqFeatureIndex;
+
+ return TT_Err_Ok;
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* selecting 0xFFFF for language_index asks for the values of the
+ default language (DefaultLangSys) */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Select_Feature( TTO_GSUBHeader* gsub,
+ TT_ULong feature_tag,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_UShort* feature_index )
+ {
+ UShort n;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+ TTO_LangSys* ls;
+ UShort* fi;
+
+ TTO_FeatureList* fl;
+ TTO_FeatureRecord* fr;
+
+
+ if ( !gsub || !feature_index )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gsub->ScriptList;
+ sr = sl->ScriptRecord;
+
+ fl = &gsub->FeatureList;
+ fr = fl->FeatureRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ if ( language_index == 0xFFFF )
+ ls = &s->DefaultLangSys;
+ else
+ {
+ if ( language_index >= s->LangSysCount )
+ return TT_Err_Invalid_Argument;
+
+ ls = &lsr[language_index].LangSys;
+ }
+
+ fi = ls->FeatureIndex;
+
+ for ( n = 0; n < ls->FeatureCount; n++ )
+ {
+ if ( fi[n] >= fl->FeatureCount )
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+
+ if ( feature_tag == fr[fi[n]].FeatureTag )
+ {
+ *feature_index = fi[n];
+
+ return TT_Err_Ok;
+ }
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* The next three functions return a null-terminated list */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Query_Scripts( TTO_GSUBHeader* gsub,
+ TT_ULong** script_tag_list )
+ {
+ UShort n;
+ TT_Error error;
+ ULong* stl;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+
+
+ if ( !gsub || !script_tag_list )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gsub->ScriptList;
+ sr = sl->ScriptRecord;
+
+ if ( ALLOC_ARRAY( stl, sl->ScriptCount + 1, ULong ) )
+ return error;
+
+ for ( n = 0; n < sl->ScriptCount; n++ )
+ stl[n] = sr[n].ScriptTag;
+ stl[n] = 0;
+
+ *script_tag_list = stl;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Query_Languages( TTO_GSUBHeader* gsub,
+ TT_UShort script_index,
+ TT_ULong** language_tag_list )
+ {
+ UShort n;
+ TT_Error error;
+ ULong* ltl;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+
+
+ if ( !gsub || !language_tag_list )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gsub->ScriptList;
+ sr = sl->ScriptRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ if ( ALLOC_ARRAY( ltl, s->LangSysCount + 1, ULong ) )
+ return error;
+
+ for ( n = 0; n < s->LangSysCount; n++ )
+ ltl[n] = lsr[n].LangSysTag;
+ ltl[n] = 0;
+
+ *language_tag_list = ltl;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* selecting 0xFFFF for language_index asks for the values of the
+ default language (DefaultLangSys) */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Query_Features( TTO_GSUBHeader* gsub,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_ULong** feature_tag_list )
+ {
+ UShort n;
+ TT_Error error;
+ ULong* ftl;
+
+ TTO_ScriptList* sl;
+ TTO_ScriptRecord* sr;
+ TTO_Script* s;
+ TTO_LangSysRecord* lsr;
+ TTO_LangSys* ls;
+ UShort* fi;
+
+ TTO_FeatureList* fl;
+ TTO_FeatureRecord* fr;
+
+
+ if ( !gsub || !feature_tag_list )
+ return TT_Err_Invalid_Argument;
+
+ sl = &gsub->ScriptList;
+ sr = sl->ScriptRecord;
+
+ fl = &gsub->FeatureList;
+ fr = fl->FeatureRecord;
+
+ if ( script_index >= sl->ScriptCount )
+ return TT_Err_Invalid_Argument;
+
+ s = &sr[script_index].Script;
+ lsr = s->LangSysRecord;
+
+ if ( language_index == 0xFFFF )
+ ls = &s->DefaultLangSys;
+ else
+ {
+ if ( language_index >= s->LangSysCount )
+ return TT_Err_Invalid_Argument;
+
+ ls = &lsr[language_index].LangSys;
+ }
+
+ fi = ls->FeatureIndex;
+
+ if ( ALLOC_ARRAY( ftl, ls->FeatureCount + 1, ULong ) )
+ return error;
+
+ for ( n = 0; n < ls->FeatureCount; n++ )
+ {
+ if ( fi[n] >= fl->FeatureCount )
+ {
+ FREE( ftl );
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+ ftl[n] = fr[fi[n]].FeatureTag;
+ }
+ ftl[n] = 0;
+
+ *feature_tag_list = ftl;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* Do an individual subtable lookup. Returns TT_Err_Ok if substitution
+ has been done, or TTO_Err_Not_Covered if not. */
+
+ static TT_Error Do_Glyph_Lookup( TTO_GSUBHeader* gsub,
+ UShort lookup_index,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out,
+ UShort context_length,
+ int nesting_level )
+ {
+ TT_Error error = TT_Err_Ok;
+ UShort i, flags;
+ TTO_Lookup* lo;
+
+
+ nesting_level++;
+
+ if ( nesting_level > TTO_MAX_NESTING_LEVEL )
+ return TTO_Err_Too_Many_Nested_Contexts;
+
+ lo = &gsub->LookupList.Lookup[lookup_index];
+ flags = lo->LookupFlag;
+
+ for ( i = 0; i < lo->SubTableCount; i++ )
+ {
+ switch ( lo->LookupType )
+ {
+ case GSUB_LOOKUP_SINGLE:
+ error = Lookup_SingleSubst( &lo->SubTable[i].st.gsub.single,
+ in, out,
+ flags, context_length, gsub->gdef );
+ break;
+
+ case GSUB_LOOKUP_MULTIPLE:
+ error = Lookup_MultipleSubst( &lo->SubTable[i].st.gsub.multiple,
+ in, out,
+ flags, context_length, gsub->gdef );
+ break;
+
+ case GSUB_LOOKUP_ALTERNATE:
+ error = Lookup_AlternateSubst( gsub,
+ &lo->SubTable[i].st.gsub.alternate,
+ in, out,
+ flags, context_length, gsub->gdef );
+ break;
+
+ case GSUB_LOOKUP_LIGATURE:
+ error = Lookup_LigatureSubst( &lo->SubTable[i].st.gsub.ligature,
+ in, out,
+ flags, context_length, gsub->gdef );
+ break;
+
+ case GSUB_LOOKUP_CONTEXT:
+ error = Lookup_ContextSubst( gsub, &lo->SubTable[i].st.gsub.context,
+ in, out,
+ flags, context_length, nesting_level );
+ break;
+
+ case GSUB_LOOKUP_CHAIN:
+ error = Lookup_ChainContextSubst( gsub,
+ &lo->SubTable[i].st.gsub.chain,
+ in, out,
+ flags, context_length,
+ nesting_level );
+ break;
+ }
+
+ /* Check whether we have a successful substitution or an error other
+ than TTO_Err_Not_Covered */
+
+ if ( error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ /* apply one lookup to the input string object */
+
+ static TT_Error Do_String_Lookup( TTO_GSUBHeader* gsub,
+ UShort lookup_index,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out )
+ {
+ TT_Error error = TTO_Err_Not_Covered;
+
+ UShort* properties = gsub->LookupList.Properties;
+ UShort* p_in = in->properties;
+ UShort* s_in = in->string;
+
+ int nesting_level = 0;
+
+
+ while ( in->pos < in->length )
+ {
+ if ( ~p_in[in->pos] & properties[lookup_index] )
+ {
+ /* 0xFFFF indicates that we don't have a context length yet */
+ error = Do_Glyph_Lookup( gsub, lookup_index, in, out,
+ 0xFFFF, nesting_level );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+ else
+ error = TTO_Err_Not_Covered;
+
+ if ( error == TTO_Err_Not_Covered )
+ if ( ADD_String( in, 1, out, 1, &s_in[in->pos], 0xFFFF, 0xFFFF ) )
+ return error;
+ }
+
+ return error;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Add_Feature( TTO_GSUBHeader* gsub,
+ TT_UShort feature_index,
+ TT_UShort property )
+ {
+ UShort i;
+
+ TTO_Feature feature;
+ UShort* properties;
+ UShort* index;
+
+
+ if ( !gsub ||
+ feature_index >= gsub->FeatureList.FeatureCount )
+ return TT_Err_Invalid_Argument;
+
+ properties = gsub->LookupList.Properties;
+
+ feature = gsub->FeatureList.FeatureRecord[feature_index].Feature;
+ index = feature.LookupListIndex;
+
+ for ( i = 0; i < feature.LookupListCount; i++ )
+ properties[index[i]] |= property;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Clear_Features( TTO_GSUBHeader* gsub )
+ {
+ UShort i;
+
+ UShort* properties;
+
+
+ if ( !gsub )
+ return TT_Err_Invalid_Argument;
+
+ properties = gsub->LookupList.Properties;
+
+ for ( i = 0; i < gsub->LookupList.LookupCount; i++ )
+ properties[i] = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Register_Alternate_Function( TTO_GSUBHeader* gsub,
+ TTO_AltFunction altfunc,
+ void* data )
+ {
+ if ( !gsub )
+ return TT_Err_Invalid_Argument;
+
+ gsub->altfunc = altfunc;
+ gsub->data = data;
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_GSUB_Apply_String( TTO_GSUBHeader* gsub,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out )
+ {
+ TT_Error error = TTO_Err_Not_Covered;
+ UShort j;
+
+ TTO_GSUB_String tmp1;
+ TTO_GSUB_String* ptmp1;
+ TTO_GSUB_String tmp2;
+ TTO_GSUB_String* ptmp2;
+ TTO_GSUB_String* t;
+
+ UShort* properties;
+
+
+ if ( !gsub ||
+ !in || !out || in->length == 0 || in->pos >= in->length )
+ return TT_Err_Invalid_Argument;
+
+ properties = gsub->LookupList.Properties;
+
+ tmp1.length = in->length;
+ tmp1.allocated = in->length;
+ tmp1.pos = in->pos;
+ tmp1.max_ligID = 1;
+
+ if ( ALLOC_ARRAY( tmp1.string, tmp1.length, UShort ) )
+ return error;
+ MEM_Copy( tmp1.string, in->string, in->length * sizeof ( UShort ) );
+
+ /* make sure that we always have a `properties', `components', and
+ `ligIDs' array in the string object */
+
+ if ( ALLOC_ARRAY( tmp1.components, tmp1.length, UShort ) )
+ return error;
+ if ( ALLOC_ARRAY( tmp1.ligIDs, tmp1.length, UShort ) )
+ return error;
+ if ( ALLOC_ARRAY( tmp1.properties, tmp1.length, UShort ) )
+ return error;
+ if ( in->properties )
+ MEM_Copy( tmp1.properties, in->properties,
+ in->length * sizeof( UShort ) );
+
+ tmp2.allocated = 0;
+ tmp2.pos = 0;
+ tmp2.string = NULL;
+ tmp2.properties = NULL;
+ tmp2.components = NULL;
+ tmp2.ligIDs = NULL;
+
+ ptmp1 = &tmp1;
+ ptmp2 = &tmp2;
+
+ for ( j = 0; j < gsub->LookupList.LookupCount; j++ )
+ if ( properties[j] )
+ {
+ error = Do_String_Lookup( gsub, j, ptmp1, ptmp2 );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+
+ /* flipping `in' and `out', preparing the next loop */
+
+ ptmp1->pos = in->pos;
+ ptmp2->length = ptmp2->pos;
+ ptmp2->pos = in->pos;
+ ptmp2->max_ligID = ptmp1->max_ligID;
+
+ t = ptmp2;
+ ptmp2 = ptmp1;
+ ptmp1 = t;
+ }
+
+ out->length = ptmp1->length;
+ out->pos = 0;
+ out->allocated = ptmp1->allocated;
+ out->string = ptmp1->string;
+ out->components = ptmp1->components;
+ out->ligIDs = ptmp1->ligIDs;
+
+ if ( in->properties )
+ out->properties = ptmp1->properties;
+ else
+ {
+ FREE( ptmp1->properties );
+ out->properties = NULL;
+ }
+
+ FREE( ptmp2->string );
+ FREE( ptmp2->properties );
+ FREE( ptmp2->components );
+ FREE( ptmp2->ligIDs );
+
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxgsub.h b/Build/source/libs/freetype/lib/extend/ftxgsub.h
new file mode 100644
index 00000000000..91614ae527b
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxgsub.h
@@ -0,0 +1,600 @@
+/*******************************************************************
+ *
+ * ftxgsub.h
+ *
+ * TrueType Open GSUB table support
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef FTXOPEN_H
+#error "Don't include this file! Use ftxopen.h instead."
+#endif
+
+#ifndef FTXGSUB_H
+#define FTXGSUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TTO_Err_Invalid_GSUB_SubTable_Format 0x1010
+#define TTO_Err_Invalid_GSUB_SubTable 0x1011
+
+#define GSUB_ID Build_Extension_ID( 'G', 'S', 'U', 'B' )
+
+
+/* Lookup types for glyph substitution */
+
+#define GSUB_LOOKUP_SINGLE 1
+#define GSUB_LOOKUP_MULTIPLE 2
+#define GSUB_LOOKUP_ALTERNATE 3
+#define GSUB_LOOKUP_LIGATURE 4
+#define GSUB_LOOKUP_CONTEXT 5
+#define GSUB_LOOKUP_CHAIN 6
+#define GSUB_LOOKUP_EXTENSION 7
+
+
+/* Use this if a feature applies to all glyphs */
+
+#define ALL_GLYPHS 0xFFFF
+
+
+ /* A pointer to a function which selects the alternate glyph. `pos' is
+ the position of the glyph with index `glyphID', `num_alternates'
+ gives the number of alternates in the `alternates' array. `data'
+ points to the user-defined structure specified during a call to
+ TT_GSUB_Register_Alternate_Function(). The function must return an
+ index into the `alternates' array. */
+
+ typedef TT_UShort (*TTO_AltFunction)(TT_ULong pos,
+ TT_UShort glyphID,
+ TT_UShort num_alternates,
+ TT_UShort* alternates,
+ void* data );
+
+
+ struct TTO_GSUBHeader_
+ {
+ TT_Bool loaded;
+ TT_ULong offset;
+
+ TT_Fixed Version;
+
+ TTO_ScriptList ScriptList;
+ TTO_FeatureList FeatureList;
+ TTO_LookupList LookupList;
+
+ TTO_GDEFHeader* gdef;
+
+ /* the next two fields are used for an alternate substitution callback
+ function to select the proper alternate glyph. */
+
+ TTO_AltFunction altfunc;
+ void* data;
+ };
+
+ typedef struct TTO_GSUBHeader_ TTO_GSUBHeader;
+
+
+ /* LookupType 1 */
+
+ struct TTO_SingleSubstFormat1_
+ {
+ TT_Short DeltaGlyphID; /* constant added to get
+ substitution glyph index */
+ };
+
+ typedef struct TTO_SingleSubstFormat1_ TTO_SingleSubstFormat1;
+
+
+ struct TTO_SingleSubstFormat2_
+ {
+ TT_UShort GlyphCount; /* number of glyph IDs in
+ Substitute array */
+ TT_UShort* Substitute; /* array of substitute glyph IDs */
+ };
+
+ typedef struct TTO_SingleSubstFormat2_ TTO_SingleSubstFormat2;
+
+
+ struct TTO_SingleSubst_
+ {
+ TT_UShort SubstFormat; /* 1 or 2 */
+ TTO_Coverage Coverage; /* Coverage table */
+
+ union
+ {
+ TTO_SingleSubstFormat1 ssf1;
+ TTO_SingleSubstFormat2 ssf2;
+ } ssf;
+ };
+
+ typedef struct TTO_SingleSubst_ TTO_SingleSubst;
+
+
+ /* LookupType 2 */
+
+ struct TTO_Sequence_
+ {
+ TT_UShort GlyphCount; /* number of glyph IDs in the
+ Substitute array */
+ TT_UShort* Substitute; /* string of glyph IDs to
+ substitute */
+ };
+
+ typedef struct TTO_Sequence_ TTO_Sequence;
+
+
+ struct TTO_MultipleSubst_
+ {
+ TT_UShort SubstFormat; /* always 1 */
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort SequenceCount; /* number of Sequence tables */
+ TTO_Sequence* Sequence; /* array of Sequence tables */
+ };
+
+ typedef struct TTO_MultipleSubst_ TTO_MultipleSubst;
+
+
+ /* LookupType 3 */
+
+ struct TTO_AlternateSet_
+ {
+ TT_UShort GlyphCount; /* number of glyph IDs in the
+ Alternate array */
+ TT_UShort* Alternate; /* array of alternate glyph IDs */
+ };
+
+ typedef struct TTO_AlternateSet_ TTO_AlternateSet;
+
+
+ struct TTO_AlternateSubst_
+ {
+ TT_UShort SubstFormat; /* always 1 */
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort AlternateSetCount;
+ /* number of AlternateSet tables */
+ TTO_AlternateSet* AlternateSet; /* array of AlternateSet tables */
+ };
+
+ typedef struct TTO_AlternateSubst_ TTO_AlternateSubst;
+
+
+ /* LookupType 4 */
+
+ struct TTO_Ligature_
+ {
+ TT_UShort LigGlyph; /* glyphID of ligature
+ to substitute */
+ TT_UShort ComponentCount; /* number of components in ligature */
+ TT_UShort* Component; /* array of component glyph IDs */
+ };
+
+ typedef struct TTO_Ligature_ TTO_Ligature;
+
+
+ struct TTO_LigatureSet_
+ {
+ TT_UShort LigatureCount; /* number of Ligature tables */
+ TTO_Ligature* Ligature; /* array of Ligature tables */
+ };
+
+ typedef struct TTO_LigatureSet_ TTO_LigatureSet;
+
+
+ struct TTO_LigatureSubst_
+ {
+ TT_UShort SubstFormat; /* always 1 */
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort LigatureSetCount; /* number of LigatureSet tables */
+ TTO_LigatureSet* LigatureSet; /* array of LigatureSet tables */
+ };
+
+ typedef struct TTO_LigatureSubst_ TTO_LigatureSubst;
+
+
+ /* needed by both lookup type 5 and 6 */
+
+ struct TTO_SubstLookupRecord_
+ {
+ TT_UShort SequenceIndex; /* index into current
+ glyph sequence */
+ TT_UShort LookupListIndex; /* Lookup to apply to that pos. */
+ };
+
+ typedef struct TTO_SubstLookupRecord_ TTO_SubstLookupRecord;
+
+
+ /* LookupType 5 */
+
+ struct TTO_SubRule_
+ {
+ TT_UShort GlyphCount; /* total number of input glyphs */
+ TT_UShort SubstCount; /* number of SubstLookupRecord
+ tables */
+ TT_UShort* Input; /* array of input glyph IDs */
+ TTO_SubstLookupRecord* SubstLookupRecord;
+ /* array of SubstLookupRecord
+ tables */
+ };
+
+ typedef struct TTO_SubRule_ TTO_SubRule;
+
+
+ struct TTO_SubRuleSet_
+ {
+ TT_UShort SubRuleCount; /* number of SubRule tables */
+ TTO_SubRule* SubRule; /* array of SubRule tables */
+ };
+
+ typedef struct TTO_SubRuleSet_ TTO_SubRuleSet;
+
+
+ struct TTO_ContextSubstFormat1_
+ {
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort SubRuleSetCount; /* number of SubRuleSet tables */
+ TTO_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
+ };
+
+ typedef struct TTO_ContextSubstFormat1_ TTO_ContextSubstFormat1;
+
+
+ struct TTO_SubClassRule_
+ {
+ TT_UShort GlyphCount; /* total number of context classes */
+ TT_UShort SubstCount; /* number of SubstLookupRecord
+ tables */
+ TT_UShort* Class; /* array of classes */
+ TTO_SubstLookupRecord* SubstLookupRecord;
+ /* array of SubstLookupRecord
+ tables */
+ };
+
+ typedef struct TTO_SubClassRule_ TTO_SubClassRule;
+
+
+ struct TTO_SubClassSet_
+ {
+ TT_UShort SubClassRuleCount;
+ /* number of SubClassRule tables */
+ TTO_SubClassRule* SubClassRule; /* array of SubClassRule tables */
+ };
+
+ typedef struct TTO_SubClassSet_ TTO_SubClassSet;
+
+
+ /* The `MaxContextLength' field is not defined in the TTO specification
+ but simplifies the implementation of this format. It holds the
+ maximal context length used in the context rules. */
+
+ struct TTO_ContextSubstFormat2_
+ {
+ TT_UShort MaxContextLength;
+ /* maximal context length */
+ TTO_Coverage Coverage; /* Coverage table */
+ TTO_ClassDefinition ClassDef; /* ClassDef table */
+ TT_UShort SubClassSetCount;
+ /* number of SubClassSet tables */
+ TTO_SubClassSet* SubClassSet; /* array of SubClassSet tables */
+ };
+
+ typedef struct TTO_ContextSubstFormat2_ TTO_ContextSubstFormat2;
+
+
+ struct TTO_ContextSubstFormat3_
+ {
+ TT_UShort GlyphCount; /* number of input glyphs */
+ TT_UShort SubstCount; /* number of SubstLookupRecords */
+ TTO_Coverage* Coverage; /* array of Coverage tables */
+ TTO_SubstLookupRecord* SubstLookupRecord;
+ /* array of substitution lookups */
+ };
+
+ typedef struct TTO_ContextSubstFormat3_ TTO_ContextSubstFormat3;
+
+
+ struct TTO_ContextSubst_
+ {
+ TT_UShort SubstFormat; /* 1, 2, or 3 */
+
+ union
+ {
+ TTO_ContextSubstFormat1 csf1;
+ TTO_ContextSubstFormat2 csf2;
+ TTO_ContextSubstFormat3 csf3;
+ } csf;
+ };
+
+ typedef struct TTO_ContextSubst_ TTO_ContextSubst;
+
+
+ /* LookupType 6 */
+
+ struct TTO_ChainSubRule_
+ {
+ TT_UShort BacktrackGlyphCount;
+ /* total number of backtrack glyphs */
+ TT_UShort* Backtrack; /* array of backtrack glyph IDs */
+ TT_UShort InputGlyphCount;
+ /* total number of input glyphs */
+ TT_UShort* Input; /* array of input glyph IDs */
+ TT_UShort LookaheadGlyphCount;
+ /* total number of lookahead glyphs */
+ TT_UShort* Lookahead; /* array of lookahead glyph IDs */
+ TT_UShort SubstCount; /* number of SubstLookupRecords */
+ TTO_SubstLookupRecord* SubstLookupRecord;
+ /* array of SubstLookupRecords */
+ };
+
+ typedef struct TTO_ChainSubRule_ TTO_ChainSubRule;
+
+
+ struct TTO_ChainSubRuleSet_
+ {
+ TT_UShort ChainSubRuleCount;
+ /* number of ChainSubRule tables */
+ TTO_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
+ };
+
+ typedef struct TTO_ChainSubRuleSet_ TTO_ChainSubRuleSet;
+
+
+ struct TTO_ChainContextSubstFormat1_
+ {
+ TTO_Coverage Coverage; /* Coverage table */
+ TT_UShort ChainSubRuleSetCount;
+ /* number of ChainSubRuleSet tables */
+ TTO_ChainSubRuleSet* ChainSubRuleSet;
+ /* array of ChainSubRuleSet tables */
+ };
+
+ typedef struct TTO_ChainContextSubstFormat1_ TTO_ChainContextSubstFormat1;
+
+
+ struct TTO_ChainSubClassRule_
+ {
+ TT_UShort BacktrackGlyphCount;
+ /* total number of backtrack
+ classes */
+ TT_UShort* Backtrack; /* array of backtrack classes */
+ TT_UShort InputGlyphCount;
+ /* total number of context classes */
+ TT_UShort* Input; /* array of context classes */
+ TT_UShort LookaheadGlyphCount;
+ /* total number of lookahead
+ classes */
+ TT_UShort* Lookahead; /* array of lookahead classes */
+ TT_UShort SubstCount; /* number of SubstLookupRecords */
+ TTO_SubstLookupRecord* SubstLookupRecord;
+ /* array of substitution lookups */
+ };
+
+ typedef struct TTO_ChainSubClassRule_ TTO_ChainSubClassRule;
+
+
+ struct TTO_ChainSubClassSet_
+ {
+ TT_UShort ChainSubClassRuleCount;
+ /* number of ChainSubClassRule
+ tables */
+ TTO_ChainSubClassRule* ChainSubClassRule;
+ /* array of ChainSubClassRule
+ tables */
+ };
+
+ typedef struct TTO_ChainSubClassSet_ TTO_ChainSubClassSet;
+
+
+ /* The `MaxXXXLength' fields are not defined in the TTO specification
+ but simplifies the implementation of this format. It holds the
+ maximal context length used in the specific context rules. */
+
+ struct TTO_ChainContextSubstFormat2_
+ {
+ TTO_Coverage Coverage; /* Coverage table */
+
+ TT_UShort MaxBacktrackLength;
+ /* maximal backtrack length */
+ TTO_ClassDefinition BacktrackClassDef;
+ /* BacktrackClassDef table */
+ TT_UShort MaxInputLength;
+ /* maximal input length */
+ TTO_ClassDefinition InputClassDef;
+ /* InputClassDef table */
+ TT_UShort MaxLookaheadLength;
+ /* maximal lookahead length */
+ TTO_ClassDefinition LookaheadClassDef;
+ /* LookaheadClassDef table */
+
+ TT_UShort ChainSubClassSetCount;
+ /* number of ChainSubClassSet
+ tables */
+ TTO_ChainSubClassSet* ChainSubClassSet;
+ /* array of ChainSubClassSet
+ tables */
+ };
+
+ typedef struct TTO_ChainContextSubstFormat2_ TTO_ChainContextSubstFormat2;
+
+
+ struct TTO_ChainContextSubstFormat3_
+ {
+ TT_UShort BacktrackGlyphCount;
+ /* number of backtrack glyphs */
+ TTO_Coverage* BacktrackCoverage;
+ /* array of backtrack Coverage
+ tables */
+ TT_UShort InputGlyphCount;
+ /* number of input glyphs */
+ TTO_Coverage* InputCoverage;
+ /* array of input coverage
+ tables */
+ TT_UShort LookaheadGlyphCount;
+ /* number of lookahead glyphs */
+ TTO_Coverage* LookaheadCoverage;
+ /* array of lookahead coverage
+ tables */
+ TT_UShort SubstCount; /* number of SubstLookupRecords */
+ TTO_SubstLookupRecord* SubstLookupRecord;
+ /* array of substitution lookups */
+ };
+
+ typedef struct TTO_ChainContextSubstFormat3_ TTO_ChainContextSubstFormat3;
+
+
+ struct TTO_ChainContextSubst_
+ {
+ TT_UShort SubstFormat; /* 1, 2, or 3 */
+
+ union
+ {
+ TTO_ChainContextSubstFormat1 ccsf1;
+ TTO_ChainContextSubstFormat2 ccsf2;
+ TTO_ChainContextSubstFormat3 ccsf3;
+ } ccsf;
+ };
+
+ typedef struct TTO_ChainContextSubst_ TTO_ChainContextSubst;
+
+
+ union TTO_GSUB_SubTable_
+ {
+ TTO_SingleSubst single;
+ TTO_MultipleSubst multiple;
+ TTO_AlternateSubst alternate;
+ TTO_LigatureSubst ligature;
+ TTO_ContextSubst context;
+ TTO_ChainContextSubst chain;
+ };
+
+ typedef union TTO_GSUB_SubTable_ TTO_GSUB_SubTable;
+
+
+ /* A simple string object. It can both `send' and `receive' data.
+ In case of sending, `length' and `pos' will be used. In case of
+ receiving, `pos' points to the first free slot, and `allocated'
+ specifies the amount of allocated memory (and the `length' field
+ will be ignored). The routine TT_Add_String() will increase the
+ amount of memory if necessary. After end of receive, `length'
+ should be set to the value of `pos', and `pos' will be set to zero.
+
+ `properties' (which is treated as a bit field) gives the glyph's
+ properties: If a certain bit is set for a glyph, the feature which
+ has the same bit set in its property value is applied.
+
+ `components' is an internal array which tracks components of
+ ligatures. We need this for MarkToLigature Attachment Positioning
+ Subtables (in GPOS) together with `ligIDs' (which is used to mark
+ ligatures and the skipped glyphs during a ligature lookup).
+ `max_ligID' is increased after a successful ligature lookup.
+
+ NEVER modify any elements of the structure! You should rather copy
+ its contents if necessary.
+
+ TT_Add_String() will also handle allocation; you should use
+ free() in case you want to destroy the arrays in the object. */
+
+ struct TTO_GSUB_String_
+ {
+ TT_ULong length;
+ TT_ULong pos;
+ TT_ULong allocated;
+ TT_UShort* string;
+ TT_UShort* properties;
+ TT_UShort* components;
+ TT_UShort max_ligID;
+ TT_UShort* ligIDs;
+ };
+
+ typedef struct TTO_GSUB_String_ TTO_GSUB_String;
+
+
+ /* finally, the GSUB API */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_GSUB_Extension( TT_Engine engine );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_GSUB_Table( TT_Face face,
+ TTO_GSUBHeader* gsub,
+ TTO_GDEFHeader* gdef );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Select_Script( TTO_GSUBHeader* gsub,
+ TT_ULong script_tag,
+ TT_UShort* script_index );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Select_Language( TTO_GSUBHeader* gsub,
+ TT_ULong language_tag,
+ TT_UShort script_index,
+ TT_UShort* language_index,
+ TT_UShort* req_feature_index );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Select_Feature( TTO_GSUBHeader* gsub,
+ TT_ULong feature_tag,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_UShort* feature_index );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Query_Scripts( TTO_GSUBHeader* gsub,
+ TT_ULong** script_tag_list );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Query_Languages( TTO_GSUBHeader* gsub,
+ TT_UShort script_index,
+ TT_ULong** language_tag_list );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Query_Features( TTO_GSUBHeader* gsub,
+ TT_UShort script_index,
+ TT_UShort language_index,
+ TT_ULong** feature_tag_list );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Add_Feature( TTO_GSUBHeader* gsub,
+ TT_UShort feature_index,
+ TT_UShort property );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Clear_Features( TTO_GSUBHeader* gsub );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Register_Alternate_Function( TTO_GSUBHeader* gsub,
+ TTO_AltFunction altfunc,
+ void* data );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Apply_String( TTO_GSUBHeader* gsub,
+ TTO_GSUB_String* in,
+ TTO_GSUB_String* out );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_GSUB_Add_String( TTO_GSUB_String* in,
+ TT_UShort num_in,
+ TTO_GSUB_String* out,
+ TT_UShort num_out,
+ TT_UShort* glyph_data,
+ TT_UShort component,
+ TT_UShort ligID );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXGSUB_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxkern.c b/Build/source/libs/freetype/lib/extend/ftxkern.c
new file mode 100644
index 00000000000..40649d93e81
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxkern.c
@@ -0,0 +1,645 @@
+/*******************************************************************
+ *
+ * ftxkern.c 1.0
+ *
+ * Kerning support extension.
+ *
+ * Copyright 1996-2002 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.
+ *
+ *
+ * The kerning support is currently part of the engine extensions.
+ *
+ ******************************************************************/
+
+#include "ftxkern.h"
+
+#include "ttextend.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttload.h"
+#include "ttmemory.h"
+#include "ttfile.h"
+#include "ttobjs.h"
+#include "tttags.h"
+
+
+/* Required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_any
+
+#define KERNING_ID Build_Extension_ID( 'k', 'e', 'r', 'n' )
+
+#undef KERN_INDEX
+#define KERN_INDEX(g1,g2) (((TT_ULong)g1 << 16) | g2)
+
+ /* compare two kerning pairs, for sorting */
+ static int compare_kern_pairs( const void* a, const void* b )
+ {
+ TT_Kern_0_Pair* pair1 = (TT_Kern_0_Pair*)a;
+ TT_Kern_0_Pair* pair2 = (TT_Kern_0_Pair*)b;
+
+ TT_ULong index1 = KERN_INDEX( pair1->left, pair1->right );
+ TT_ULong index2 = KERN_INDEX( pair2->left, pair2->right );
+
+ return ( index1 < index2 ? -1 :
+ ( index1 > index2 ? 1 : 0 ));
+ }
+
+
+ /* a simple shell sort algorithm to avoid calling qsort */
+ /* (since this creates problems on 16-bit machines) */
+ static void
+ sort_kern_pairs( TT_Kern_0_Pair* pairs,
+ int count )
+ {
+ TT_Kern_0_Pair *i, *j, *limit = pairs + count;
+ TT_Kern_0_Pair temp;
+ int gap;
+
+
+ /* compute initial gap */
+ for ( gap = 0; ++gap < count; gap *= 3 )
+ ;
+
+ while ( gap /= 3 )
+ {
+ for ( i = pairs + gap; i < limit; i++ )
+ {
+ for ( j = i - gap; ; j -= gap )
+ {
+ TT_Kern_0_Pair* k = j + gap;
+
+
+ if ( compare_kern_pairs( j, k ) < 0 )
+ break;
+
+ temp = *j;
+ *j = *k;
+ *k = temp;
+
+ if ( j < pairs + gap )
+ break;
+ }
+ }
+ }
+ }
+
+
+
+ /* check whether the kern table is sorted */
+ static int
+ is_sorted( TT_Kern_0_Pair* table, TT_ULong num_pairs )
+ {
+ TT_ULong i;
+
+ for ( i=1; i<num_pairs; i++ )
+ {
+ if ( compare_kern_pairs(&table[i-1], &table[i]) != -1 )
+ return 0;
+ }
+ return 1;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : SubTable_Load_0
+ *
+ * Description : Loads a format 0 kerning subtable data.
+ *
+ * Input : kern0 pointer to the kerning subtable
+ *
+ * Output : error code
+ *
+ * Notes : - Assumes that the stream is already `used'
+ *
+ * - the file cursor must be set by the caller
+ *
+ * - in case of error, the function _must_ destroy
+ * the data it allocates!
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Subtable_Load_0( TT_Kern_0* kern0,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort num_pairs, n;
+
+
+ if ( ACCESS_Frame( 8L ) )
+ return error;
+
+ num_pairs = GET_UShort();
+ kern0->nPairs = 0;
+ kern0->searchRange = GET_UShort();
+ kern0->entrySelector = GET_UShort();
+ kern0->rangeShift = GET_UShort();
+
+ /* we only set kern0->nPairs if the subtable has been loaded */
+
+ FORGET_Frame();
+
+ if ( ALLOC_ARRAY( kern0->pairs, num_pairs, TT_Kern_0_Pair ) )
+ return error;
+
+ if ( ACCESS_Frame( num_pairs * 6L ) )
+ goto Fail;
+
+ for ( n = 0; n < num_pairs; n++ )
+ {
+ kern0->pairs[n].left = GET_UShort();
+ kern0->pairs[n].right = GET_UShort();
+ kern0->pairs[n].value = GET_UShort();
+
+ if ( kern0->pairs[n].left >= input->numGlyphs ||
+ kern0->pairs[n].right >= input->numGlyphs )
+ {
+ FORGET_Frame();
+ error = TT_Err_Invalid_Kerning_Table;
+ goto Fail;
+ }
+ }
+
+ FORGET_Frame();
+
+ /* we're ok, set the pairs count */
+ kern0->nPairs = num_pairs;
+
+ /* the spec says that the kerning pairs must be sorted,
+ but some brain damaged font producers don't do that correctly.. (JvR 3/4/2000) */
+ if ( !is_sorted( kern0->pairs, num_pairs ) )
+ sort_kern_pairs( kern0->pairs, num_pairs );
+
+ return TT_Err_Ok;
+
+ Fail:
+ FREE( kern0->pairs );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : SubTable_Load_2
+ *
+ * Description : Loads a format 2 kerning subtable data.
+ *
+ * Input : kern2 pointer to the kerning subtable
+ * length subtable length. This is required as
+ * the subheader doesn't give any indication
+ * of the size of the `array' table.
+ *
+ * Output : error code
+ *
+ * Notes : - Assumes that the stream is already `used'
+ *
+ * - the file cursor must be set by the caller
+ *
+ * - in case of error, the function _must_ destroy
+ * the data it allocates!
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Subtable_Load_2( TT_Kern_2* kern2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ Long table_base;
+
+ UShort left_offset, right_offset, array_offset;
+ ULong array_size;
+ UShort left_max, right_max, n;
+
+
+ /* record the table offset */
+ table_base = FILE_Pos();
+
+ if ( ACCESS_Frame( 8L ) )
+ return error;
+
+ kern2->rowWidth = GET_UShort();
+ left_offset = GET_UShort();
+ right_offset = GET_UShort();
+ array_offset = GET_UShort();
+
+ FORGET_Frame();
+
+ /* first load left and right glyph classes */
+
+ if ( FILE_Seek( table_base + left_offset ) ||
+ ACCESS_Frame( 4L ) )
+ return error;
+
+ kern2->leftClass.firstGlyph = GET_UShort();
+ kern2->leftClass.nGlyphs = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ALLOC_ARRAY( kern2->leftClass.classes,
+ kern2->leftClass.nGlyphs,
+ UShort ) )
+ return error;
+
+ /* load left offsets */
+
+ if ( ACCESS_Frame( kern2->leftClass.nGlyphs * 2L ) )
+ goto Fail_Left;
+
+ for ( n = 0; n < kern2->leftClass.nGlyphs; n++ )
+ kern2->leftClass.classes[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ /* right class */
+
+ if ( FILE_Seek( table_base + right_offset ) ||
+ ACCESS_Frame( 4L ) )
+ goto Fail_Left;
+
+ kern2->rightClass.firstGlyph = GET_UShort();
+ kern2->rightClass.nGlyphs = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( ALLOC_ARRAY( kern2->rightClass.classes,
+ kern2->rightClass.nGlyphs,
+ UShort ) )
+ goto Fail_Left;
+
+ /* load right offsets */
+
+ if ( ACCESS_Frame( kern2->rightClass.nGlyphs * 2L ) )
+ goto Fail_Right;
+
+ for ( n = 0; n < kern2->rightClass.nGlyphs; n++ )
+ kern2->rightClass.classes[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ /* Now load the kerning array. We don't have its size, we */
+ /* must compute it from what we know. */
+
+ /* We thus compute the maximum left and right offsets and */
+ /* add them to get the array size. */
+
+ left_max = right_max = 0;
+
+ for ( n = 0; n < kern2->leftClass.nGlyphs; n++ )
+ left_max = MAX( left_max, kern2->leftClass.classes[n] );
+
+ for ( n = 0; n < kern2->rightClass.nGlyphs; n++ )
+ right_max = MAX( right_max, kern2->leftClass.classes[n] );
+
+ array_size = left_max + right_max + 2;
+
+ if ( ALLOC( kern2->array, array_size ) )
+ goto Fail_Right;
+
+ if ( ACCESS_Frame( array_size ) )
+ goto Fail_Array;
+
+ for ( n = 0; (UInt)n < array_size/2; n++ )
+ kern2->array[n] = GET_Short();
+
+ FORGET_Frame();
+
+ /* we're good now */
+
+ return TT_Err_Ok;
+
+ Fail_Array:
+ FREE( kern2->array );
+
+ Fail_Right:
+ FREE( kern2->rightClass.classes );
+ kern2->rightClass.nGlyphs = 0;
+
+ Fail_Left:
+ FREE( kern2->leftClass.classes );
+ kern2->leftClass.nGlyphs = 0;
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Kerning_Create
+ *
+ * Description : Creates the kerning directory if a face is
+ * loaded. The tables however are loaded on
+ * demand to save space.
+ *
+ * Input : face pointer to the parent face object
+ * kern pointer to the extension's kerning field
+ *
+ * Output : error code
+ *
+ * Notes : as in all constructors, the memory allocated isn't
+ * released in case of failure. Rather, the task is left
+ * to the destructor (which is called if an error
+ * occurs during the loading of a face).
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Kerning_Create( void* ext,
+ PFace face )
+ {
+ DEFINE_LOAD_LOCALS( face->stream );
+
+ TT_Kerning* kern = (TT_Kerning*)ext;
+ UShort num_tables;
+ Long table;
+
+ TT_Kern_Subtable* sub;
+
+
+ /* by convention */
+ if ( !kern )
+ return TT_Err_Ok;
+
+ /* Now load the kerning directory. We're called from the face */
+ /* constructor. We thus need not use the stream. */
+
+ kern->version = 0;
+ kern->nTables = 0;
+ kern->tables = NULL;
+
+ table = TT_LookUp_Table( face, TTAG_kern );
+ if ( table < 0 )
+ return TT_Err_Ok; /* The table is optional */
+
+ if ( FILE_Seek( face->dirTables[table].Offset ) ||
+ ACCESS_Frame( 4L ) )
+ return error;
+
+ kern->version = GET_UShort();
+ num_tables = GET_UShort();
+
+ FORGET_Frame();
+
+ /* we don't set kern->nTables until we have allocated the array */
+
+ if ( ALLOC_ARRAY( kern->tables, num_tables, TT_Kern_Subtable ) )
+ return error;
+
+ kern->nTables = num_tables;
+
+ /* now load the directory entries, but do _not_ load the tables ! */
+
+ sub = kern->tables;
+
+ for ( table = 0; table < num_tables; table++ )
+ {
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ sub->loaded = FALSE; /* redundant, but good to see */
+ sub->version = GET_UShort();
+ sub->length = GET_UShort() - 6; /* substract header length */
+ sub->format = GET_Byte();
+ sub->coverage = GET_Byte();
+
+ FORGET_Frame();
+
+ sub->offset = FILE_Pos();
+
+ /* now skip to the next table */
+
+ if ( FILE_Skip( sub->length ) )
+ return error;
+
+ sub++;
+ }
+
+ /* that's fine, leave now */
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Kerning_Destroy
+ *
+ * Description : Destroys all kerning information.
+ *
+ * Input : kern pointer to the extension's kerning field
+ *
+ * Output : error code
+ *
+ * Notes : This function is a destructor; it must be able
+ * to destroy partially built tables.
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Kerning_Destroy( void* ext,
+ PFace face )
+ {
+ TT_Kerning* kern = (TT_Kerning*)ext;
+ TT_Kern_Subtable* sub;
+ UShort n;
+
+
+ /* by convention */
+ if ( !kern )
+ return TT_Err_Ok;
+
+ if ( kern->nTables == 0 )
+ return TT_Err_Ok; /* no tables to release */
+
+ /* scan the table directory and release loaded entries */
+
+ sub = kern->tables;
+ for ( n = 0; n < kern->nTables; n++ )
+ {
+ if ( sub->loaded )
+ {
+ switch ( sub->format )
+ {
+ case 0:
+ FREE( sub->t.kern0.pairs );
+ sub->t.kern0.nPairs = 0;
+ sub->t.kern0.searchRange = 0;
+ sub->t.kern0.entrySelector = 0;
+ sub->t.kern0.rangeShift = 0;
+ break;
+
+ case 2:
+ FREE( sub->t.kern2.leftClass.classes );
+ sub->t.kern2.leftClass.firstGlyph = 0;
+ sub->t.kern2.leftClass.nGlyphs = 0;
+
+ FREE( sub->t.kern2.rightClass.classes );
+ sub->t.kern2.rightClass.firstGlyph = 0;
+ sub->t.kern2.rightClass.nGlyphs = 0;
+
+ FREE( sub->t.kern2.array );
+ sub->t.kern2.rowWidth = 0;
+ break;
+
+ default:
+ ; /* invalid subtable format - do nothing */
+ }
+
+ sub->loaded = FALSE;
+ sub->version = 0;
+ sub->offset = 0;
+ sub->length = 0;
+ sub->coverage = 0;
+ sub->format = 0;
+ }
+ sub++;
+ }
+
+ FREE( kern->tables );
+ kern->nTables = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Kerning_Directory
+ *
+ * Description : Returns a given face's kerning directory.
+ *
+ * Input : face handle to the face object
+ * directory pointer to client's target directory
+ *
+ * Output : error code
+ *
+ * Notes : The kerning table directory is loaded with the face
+ * through the extension constructor. However, the kerning
+ * tables themselves are only loaded on demand, as they
+ * may represent a lot of data, unneeded by most uses of
+ * the engine.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Kerning_Directory( TT_Face face,
+ TT_Kerning* directory )
+ {
+ PFace faze = HANDLE_Face( face );
+ TT_Error error;
+ TT_Kerning* kerning;
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ /* copy directory header */
+ error = TT_Extension_Get( faze, KERNING_ID, (void**)&kerning );
+ if ( !error )
+ *directory = *kerning;
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Load_Kerning_Table
+ *
+ * Description : Loads a kerning table intro memory.
+ *
+ * Input : face face handle
+ * kern_index index in the face's kerning directory
+ *
+ * Output : error code
+ *
+ * Notes :
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_Kerning_Table( TT_Face face,
+ TT_UShort kern_index )
+ {
+ TT_Error error;
+ TT_Stream stream;
+
+ TT_Kerning* kern;
+ TT_Kern_Subtable* sub;
+
+
+ PFace faze = HANDLE_Face( face );
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ error = TT_Extension_Get( faze, KERNING_ID, (void**)&kern );
+ if ( error )
+ return error;
+
+ if ( kern->nTables == 0 )
+ return TT_Err_Table_Missing;
+
+ if ( kern_index >= kern->nTables )
+ return TT_Err_Invalid_Argument;
+
+ sub = kern->tables + kern_index;
+
+ if ( sub->format != 0 && sub->format != 2 )
+ return TT_Err_Invalid_Kerning_Table_Format;
+
+ /* now access stream */
+ if ( USE_Stream( faze->stream, stream ) )
+ return error;
+
+ if ( FILE_Seek( sub->offset ) )
+ goto Fail;
+
+ if ( sub->format == 0 )
+ error = Subtable_Load_0( &sub->t.kern0, faze );
+ else if ( sub->format == 2 )
+ error = Subtable_Load_2( &sub->t.kern2, faze );
+
+ if ( !error )
+ sub->loaded = TRUE;
+
+ Fail:
+ /* release stream */
+ DONE_Stream( stream );
+
+ return error;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_Kerning_Extension( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+ TT_Error error;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ error = TT_Register_Extension( _engine,
+ KERNING_ID,
+ sizeof ( TT_Kerning ),
+ Kerning_Create,
+ Kerning_Destroy );
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxkern.h b/Build/source/libs/freetype/lib/extend/ftxkern.h
new file mode 100644
index 00000000000..4f981ec8737
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxkern.h
@@ -0,0 +1,181 @@
+/*******************************************************************
+ *
+ * ftxkern.h 1.0
+ *
+ * High-Level API Kerning extension
+ *
+ * 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.
+ *
+ *
+ * The kerning support is currently part of the engine extensions.
+ *
+ * This file should _not_ depend on engine internal types.
+ *
+ ******************************************************************/
+
+#ifndef FTXKERN_H
+#define FTXKERN_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* The kerning support in FreeType is minimal. This means that */
+ /* we do not try to interpret the kerning data in any way to */
+ /* `cook' it for a user application. This API lets you access */
+ /* directly the kerning tables found in the TrueType file; it's */
+ /* up to the client application to apply its own processing on */
+ /* these. */
+
+ /* The reason for this is that we generally do not encourage */
+ /* feature-bloat of the core engine. Moreover, not all */
+ /* libraries or font servers really need kerning data, or all */
+ /* formats of this data. */
+
+ /************** kerning error codes *****************************/
+
+ /* we choose the class 0x0A for our errors, this should not */
+ /* match with any error code class used in any other extension */
+
+#define TT_Err_Invalid_Kerning_Table_Format 0x0A00
+#define TT_Err_Invalid_Kerning_Table 0x0A01
+
+
+ /********** structures definitions ******************************/
+
+ /* Remember that all types and function are accessible by client */
+ /* applications in this section, and thus should have the `TT_' */
+ /* prefix. */
+
+ /* format 0 kerning pair */
+
+ struct TT_Kern_0_Pair_
+ {
+ TT_UShort left; /* index of left glyph in pair */
+ TT_UShort right; /* index of right glyph in pair */
+ TT_FWord value; /* kerning value */
+ };
+
+ typedef struct TT_Kern_0_Pair_ TT_Kern_0_Pair;
+
+
+ /* format 0 kerning subtable */
+
+ struct TT_Kern_0_
+ {
+ TT_UShort nPairs; /* number of kerning pairs */
+
+ TT_UShort searchRange; /* these values are defined by the TT spec */
+ TT_UShort entrySelector; /* for table searchs. */
+ TT_UShort rangeShift;
+
+ TT_Kern_0_Pair* pairs; /* a table of nPairs `pairs' */
+ };
+
+ typedef struct TT_Kern_0_ TT_Kern_0;
+
+
+ /* format 2 kerning glyph class */
+
+ struct TT_Kern_2_Class_
+ {
+ TT_UShort firstGlyph; /* first glyph in range */
+ TT_UShort nGlyphs; /* number of glyphs in range */
+ TT_UShort* classes; /* a table giving for each ranged glyph */
+ /* its class offset in the subtable pairs */
+ /* two-dimensional array */
+ };
+
+ typedef struct TT_Kern_2_Class_ TT_Kern_2_Class;
+
+
+ /* format 2 kerning subtable */
+
+ struct TT_Kern_2_
+ {
+ TT_UShort rowWidth; /* length of one row in bytes */
+ TT_Kern_2_Class leftClass; /* left class table */
+ TT_Kern_2_Class rightClass; /* right class table */
+ TT_FWord* array; /* 2-dimensional kerning values array */
+ };
+
+ typedef struct TT_Kern_2_ TT_Kern_2;
+
+
+ /* kerning subtable */
+
+ struct TT_Kern_Subtable_
+ {
+ TT_Bool loaded; /* boolean; indicates whether the table is */
+ /* loaded */
+ TT_UShort version; /* table version number */
+ TT_Long offset; /* file offset of table */
+ TT_UShort length; /* length of table, _excluding_ header */
+ TT_Byte coverage; /* lower 8 bit of the coverage table entry */
+ TT_Byte format; /* the subtable format, as found in the */
+ /* higher 8 bits of the coverage table entry */
+ union
+ {
+ TT_Kern_0 kern0;
+ TT_Kern_2 kern2;
+ } t;
+ };
+
+ typedef struct TT_Kern_Subtable_ TT_Kern_Subtable;
+
+
+ struct TT_Kerning_
+ {
+ TT_UShort version; /* kern table version number. starts at 0 */
+ TT_UShort nTables; /* number of tables */
+
+ TT_Kern_Subtable* tables; /* the kerning sub-tables */
+ };
+
+ typedef struct TT_Kerning_ TT_Kerning;
+
+
+
+ /***************** high-level API extension **************************/
+
+ /* Initialize Kerning extension, must be called after */
+ /* TT_Init_FreeType(). There is no need for a finalizer */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_Kerning_Extension( TT_Engine engine );
+
+ /* Note on the implemented mechanism: */
+
+ /* The kerning table directory is loaded with the face through the */
+ /* extension constructor. However, the tables will only be loaded */
+ /* on demand, as they may represent a lot of data, unnecessary to */
+ /* most applications. */
+
+ /* Queries a pointer to the kerning directory for the face object */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Kerning_Directory( TT_Face face,
+ TT_Kerning* directory );
+
+ /* Load the kerning table number `kern_index' in the kerning */
+ /* directory. The table will stay in memory until the `face' */
+ /* face is destroyed. */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_Kerning_Table( TT_Face face,
+ TT_UShort kern_index );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXKERN_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxopen.c b/Build/source/libs/freetype/lib/extend/ftxopen.c
new file mode 100644
index 00000000000..26b9501ff43
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxopen.c
@@ -0,0 +1,1458 @@
+/*******************************************************************
+ *
+ * ftxopen.c
+ *
+ * TrueType Open common table support.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include "tttypes.h"
+#include "ttload.h"
+#include "ttextend.h"
+#include "ttmemory.h"
+#include "ttfile.h"
+
+#include "ftxopen.h"
+#include "ftxopenf.h"
+
+
+ /***************************
+ * Script related functions
+ ***************************/
+
+
+ /* LangSys */
+
+ static TT_Error Load_LangSys( TTO_LangSys* ls,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* fi;
+
+
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ ls->LookupOrderOffset = GET_UShort(); /* should be 0 */
+ ls->ReqFeatureIndex = GET_UShort();
+ count = ls->FeatureCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ls->FeatureIndex = NULL;
+
+ if ( ALLOC_ARRAY( ls->FeatureIndex, count, UShort ) )
+ return error;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( ls->FeatureIndex );
+ return error;
+ }
+
+ fi = ls->FeatureIndex;
+
+ for ( n = 0; n < count; n++ )
+ fi[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_LangSys( TTO_LangSys* ls )
+ {
+ FREE( ls->FeatureIndex );
+ }
+
+
+ /* Script */
+
+ static TT_Error Load_Script( TTO_Script* s,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_LangSysRecord* lsr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ if ( new_offset != base_offset ) /* not a NULL offset */
+ {
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LangSys( &s->DefaultLangSys,
+ input ) ) != TT_Err_Ok )
+ return error;
+ (void)FILE_Seek( cur_offset );
+ }
+ else
+ {
+ /* we create a DefaultLangSys table with no entries */
+
+ s->DefaultLangSys.LookupOrderOffset = 0;
+ s->DefaultLangSys.ReqFeatureIndex = 0xFFFF;
+ s->DefaultLangSys.FeatureCount = 0;
+ s->DefaultLangSys.FeatureIndex = NULL;
+ }
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail2;
+
+ count = s->LangSysCount = GET_UShort();
+
+ /* safety check; otherwise the official handling of TrueType Open
+ fonts won't work */
+
+ if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 )
+ {
+ error = TTO_Err_Invalid_SubTable;
+ goto Fail2;
+ }
+
+ FORGET_Frame();
+
+ s->LangSysRecord = NULL;
+
+ if ( ALLOC_ARRAY( s->LangSysRecord, count, TTO_LangSysRecord ) )
+ goto Fail2;
+
+ lsr = s->LangSysRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 6L ) )
+ goto Fail1;
+
+ lsr[n].LangSysTag = GET_ULong();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_LangSys( &lsr[n].LangSys, input ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ for ( n = 0; n < count; n++ )
+ Free_LangSys( &lsr[n].LangSys );
+
+ FREE( s->LangSysRecord );
+
+ Fail2:
+ Free_LangSys( &s->DefaultLangSys );
+ return error;
+ }
+
+
+ static void Free_Script( TTO_Script* s )
+ {
+ UShort n, count;
+
+ TTO_LangSysRecord* lsr;
+
+
+ Free_LangSys( &s->DefaultLangSys );
+
+ if ( s->LangSysRecord )
+ {
+ count = s->LangSysCount;
+ lsr = s->LangSysRecord;
+
+ for ( n = 0; n < count; n++ )
+ Free_LangSys( &lsr[n].LangSys );
+
+ FREE( lsr );
+ }
+ }
+
+
+ /* ScriptList */
+
+ TT_Error Load_ScriptList( TTO_ScriptList* sl,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_ScriptRecord* sr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = sl->ScriptCount = GET_UShort();
+
+ FORGET_Frame();
+
+ sl->ScriptRecord = NULL;
+
+ if ( ALLOC_ARRAY( sl->ScriptRecord, count, TTO_ScriptRecord ) )
+ return error;
+
+ sr = sl->ScriptRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 6L ) )
+ goto Fail;
+
+ sr[n].ScriptTag = GET_ULong();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Script( &sr[n].Script, input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_Script( &sr[n].Script );
+
+ FREE( sl->ScriptRecord );
+ return error;
+ }
+
+
+ void Free_ScriptList( TTO_ScriptList* sl )
+ {
+ UShort n, count;
+
+ TTO_ScriptRecord* sr;
+
+
+ if ( sl->ScriptRecord )
+ {
+ count = sl->ScriptCount;
+ sr = sl->ScriptRecord;
+
+ for ( n = 0; n < count; n++ )
+ Free_Script( &sr[n].Script );
+
+ FREE( sr );
+ }
+ }
+
+
+
+ /*********************************
+ * Feature List related functions
+ *********************************/
+
+
+ /* Feature */
+
+ static TT_Error Load_Feature( TTO_Feature* f,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* lli;
+
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ f->FeatureParams = GET_UShort(); /* should be 0 */
+ count = f->LookupListCount = GET_UShort();
+
+ FORGET_Frame();
+
+ f->LookupListIndex = NULL;
+
+ if ( ALLOC_ARRAY( f->LookupListIndex, count, UShort ) )
+ return error;
+
+ lli = f->LookupListIndex;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( f->LookupListIndex );
+ return error;
+ }
+
+ for ( n = 0; n < count; n++ )
+ lli[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_Feature( TTO_Feature* f )
+ {
+ FREE( f->LookupListIndex );
+ }
+
+
+ /* FeatureList */
+
+ TT_Error Load_FeatureList( TTO_FeatureList* fl,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_FeatureRecord* fr;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = fl->FeatureCount = GET_UShort();
+
+ FORGET_Frame();
+
+ fl->FeatureRecord = NULL;
+
+ if ( ALLOC_ARRAY( fl->FeatureRecord, count, TTO_FeatureRecord ) )
+ return error;
+
+ fr = fl->FeatureRecord;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 6L ) )
+ goto Fail;
+
+ fr[n].FeatureTag = GET_ULong();
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Feature( &fr[n].Feature, input ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_Feature( &fr[n].Feature );
+
+ FREE( fl->FeatureRecord );
+ return error;
+ }
+
+
+ void Free_FeatureList( TTO_FeatureList* fl )
+ {
+ UShort n, count;
+
+ TTO_FeatureRecord* fr;
+
+
+ if ( fl->FeatureRecord )
+ {
+ count = fl->FeatureCount;
+ fr = fl->FeatureRecord;
+
+ for ( n = 0; n < count; n++ )
+ Free_Feature( &fr[n].Feature );
+
+ FREE( fr );
+ }
+ }
+
+
+
+ /********************************
+ * Lookup List related functions
+ ********************************/
+
+ /* the subroutines of the following two functions are defined in
+ ftxgsub.c and ftxgpos.c respectively */
+
+
+ /* SubTable */
+
+ static TT_Error Load_SubTable( TTO_SubTable* st,
+ PFace input,
+ TTO_Type table_type,
+ UShort lookup_type )
+ {
+ if ( table_type == GSUB )
+ switch ( lookup_type )
+ {
+ case GSUB_LOOKUP_SINGLE:
+ return Load_SingleSubst( &st->st.gsub.single, input );
+
+ case GSUB_LOOKUP_MULTIPLE:
+ return Load_MultipleSubst( &st->st.gsub.multiple, input );
+
+ case GSUB_LOOKUP_ALTERNATE:
+ return Load_AlternateSubst( &st->st.gsub.alternate, input );
+
+ case GSUB_LOOKUP_LIGATURE:
+ return Load_LigatureSubst( &st->st.gsub.ligature, input );
+
+ case GSUB_LOOKUP_CONTEXT:
+ return Load_ContextSubst( &st->st.gsub.context, input );
+
+ case GSUB_LOOKUP_CHAIN:
+ return Load_ChainContextSubst( &st->st.gsub.chain, input );
+
+ default:
+ return TTO_Err_Invalid_GSUB_SubTable_Format;
+ }
+ else
+ switch ( lookup_type )
+ {
+ case GPOS_LOOKUP_SINGLE:
+ return Load_SinglePos( &st->st.gpos.single, input );
+
+ case GPOS_LOOKUP_PAIR:
+ return Load_PairPos( &st->st.gpos.pair, input );
+
+ case GPOS_LOOKUP_CURSIVE:
+ return Load_CursivePos( &st->st.gpos.cursive, input );
+
+ case GPOS_LOOKUP_MARKBASE:
+ return Load_MarkBasePos( &st->st.gpos.markbase, input );
+
+ case GPOS_LOOKUP_MARKLIG:
+ return Load_MarkLigPos( &st->st.gpos.marklig, input );
+
+ case GPOS_LOOKUP_MARKMARK:
+ return Load_MarkMarkPos( &st->st.gpos.markmark, input );
+
+ case GPOS_LOOKUP_CONTEXT:
+ return Load_ContextPos( &st->st.gpos.context, input );
+
+ case GPOS_LOOKUP_CHAIN:
+ return Load_ChainContextPos( &st->st.gpos.chain, input );
+
+ default:
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ static void Free_SubTable( TTO_SubTable* st,
+ TTO_Type table_type,
+ UShort lookup_type )
+ {
+ if ( table_type == GSUB )
+ switch ( lookup_type )
+ {
+ case GSUB_LOOKUP_SINGLE:
+ Free_SingleSubst( &st->st.gsub.single );
+ break;
+
+ case GSUB_LOOKUP_MULTIPLE:
+ Free_MultipleSubst( &st->st.gsub.multiple );
+ break;
+
+ case GSUB_LOOKUP_ALTERNATE:
+ Free_AlternateSubst( &st->st.gsub.alternate );
+ break;
+
+ case GSUB_LOOKUP_LIGATURE:
+ Free_LigatureSubst( &st->st.gsub.ligature );
+ break;
+
+ case GSUB_LOOKUP_CONTEXT:
+ Free_ContextSubst( &st->st.gsub.context );
+ break;
+
+ case GSUB_LOOKUP_CHAIN:
+ Free_ChainContextSubst( &st->st.gsub.chain );
+ break;
+ }
+ else
+ switch ( lookup_type )
+ {
+ case GPOS_LOOKUP_SINGLE:
+ Free_SinglePos( &st->st.gpos.single );
+ break;
+
+ case GPOS_LOOKUP_PAIR:
+ Free_PairPos( &st->st.gpos.pair );
+ break;
+
+ case GPOS_LOOKUP_CURSIVE:
+ Free_CursivePos( &st->st.gpos.cursive );
+ break;
+
+ case GPOS_LOOKUP_MARKBASE:
+ Free_MarkBasePos( &st->st.gpos.markbase );
+ break;
+
+ case GPOS_LOOKUP_MARKLIG:
+ Free_MarkLigPos( &st->st.gpos.marklig );
+ break;
+
+ case GPOS_LOOKUP_MARKMARK:
+ Free_MarkMarkPos( &st->st.gpos.markmark );
+ break;
+
+ case GPOS_LOOKUP_CONTEXT:
+ Free_ContextPos( &st->st.gpos.context );
+ break;
+
+ case GPOS_LOOKUP_CHAIN:
+ Free_ChainContextPos ( &st->st.gpos.chain );
+ break;
+ }
+ }
+
+
+ /* Lookup */
+
+ static TT_Error Load_Lookup( TTO_Lookup* l,
+ PFace input,
+ TTO_Type type )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_SubTable* st;
+
+ Bool is_extension = FALSE;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ l->LookupType = GET_UShort();
+ l->LookupFlag = GET_UShort();
+ count = l->SubTableCount = GET_UShort();
+
+ FORGET_Frame();
+
+ l->SubTable = NULL;
+
+ if ( ALLOC_ARRAY( l->SubTable, count, TTO_SubTable ) )
+ return error;
+
+ st = l->SubTable;
+
+ if ( ( type == GSUB && l->LookupType == GSUB_LOOKUP_EXTENSION ) ||
+ ( type == GPOS && l->LookupType == GPOS_LOOKUP_EXTENSION ) )
+ is_extension = TRUE;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+
+ if ( is_extension )
+ {
+ if ( FILE_Seek( new_offset ) || ACCESS_Frame( 8L ) )
+ goto Fail;
+
+ (void)GET_UShort(); /* format should be 1 */
+ l->LookupType = GET_UShort();
+ new_offset = GET_ULong() + base_offset;
+
+ FORGET_Frame();
+ }
+
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_SubTable( &st[n], input,
+ type, l->LookupType ) ) != TT_Err_Ok )
+ goto Fail;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < count; n++ )
+ Free_SubTable( &st[n], type, l->LookupType );
+
+ FREE( l->SubTable );
+ return error;
+ }
+
+
+ static void Free_Lookup( TTO_Lookup* l,
+ TTO_Type type )
+ {
+ UShort n, count;
+
+ TTO_SubTable* st;
+
+
+ if ( l->SubTable )
+ {
+ count = l->SubTableCount;
+ st = l->SubTable;
+
+ for ( n = 0; n < count; n++ )
+ Free_SubTable( &st[n], type, l->LookupType );
+
+ FREE( st );
+ }
+ }
+
+
+ /* LookupList */
+
+ TT_Error Load_LookupList( TTO_LookupList* ll,
+ PFace input,
+ TTO_Type type )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+ ULong cur_offset, new_offset, base_offset;
+
+ TTO_Lookup* l;
+
+
+ base_offset = FILE_Pos();
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = ll->LookupCount = GET_UShort();
+
+ FORGET_Frame();
+
+ ll->Lookup = NULL;
+
+ if ( ALLOC_ARRAY( ll->Lookup, count, TTO_Lookup ) )
+ return error;
+ if ( ALLOC_ARRAY( ll->Properties, count, UShort ) )
+ goto Fail2;
+
+ l = ll->Lookup;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail1;
+
+ new_offset = GET_UShort() + base_offset;
+
+ FORGET_Frame();
+
+ cur_offset = FILE_Pos();
+ if ( FILE_Seek( new_offset ) ||
+ ( error = Load_Lookup( &l[n], input, type ) ) != TT_Err_Ok )
+ goto Fail1;
+ (void)FILE_Seek( cur_offset );
+ }
+
+ return TT_Err_Ok;
+
+ Fail1:
+ FREE( ll->Properties );
+
+ for ( n = 0; n < count; n++ )
+ Free_Lookup( &l[n], type );
+
+ Fail2:
+ FREE( ll->Lookup );
+ return error;
+ }
+
+
+ void Free_LookupList( TTO_LookupList* ll,
+ TTO_Type type )
+ {
+ UShort n, count;
+
+ TTO_Lookup* l;
+
+
+ FREE( ll->Properties );
+
+ if ( ll->Lookup )
+ {
+ count = ll->LookupCount;
+ l = ll->Lookup;
+
+ for ( n = 0; n < count; n++ )
+ Free_Lookup( &l[n], type );
+
+ FREE( l );
+ }
+ }
+
+
+
+ /*****************************
+ * Coverage related functions
+ *****************************/
+
+
+ /* CoverageFormat1 */
+
+ static TT_Error Load_Coverage1( TTO_CoverageFormat1* cf1,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* ga;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = cf1->GlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cf1->GlyphArray = NULL;
+
+ if ( ALLOC_ARRAY( cf1->GlyphArray, count, UShort ) )
+ return error;
+
+ ga = cf1->GlyphArray;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( cf1->GlyphArray );
+ return error;
+ }
+
+ for ( n = 0; n < count; n++ )
+ ga[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_Coverage1( TTO_CoverageFormat1* cf1 )
+ {
+ FREE( cf1->GlyphArray );
+ }
+
+
+ /* CoverageFormat2 */
+
+ static TT_Error Load_Coverage2( TTO_CoverageFormat2* cf2,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ TTO_RangeRecord* rr;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = cf2->RangeCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cf2->RangeRecord = NULL;
+
+ if ( ALLOC_ARRAY( cf2->RangeRecord, count, TTO_RangeRecord ) )
+ return error;
+
+ rr = cf2->RangeRecord;
+
+ if ( ACCESS_Frame( count * 6L ) )
+ goto Fail;
+
+ for ( n = 0; n < count; n++ )
+ {
+ rr[n].Start = GET_UShort();
+ rr[n].End = GET_UShort();
+ rr[n].StartCoverageIndex = GET_UShort();
+
+ /* sanity check; we are limited to 16bit integers */
+ if ( rr[n].Start > rr[n].End ||
+ ( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >=
+ 0x10000L )
+ {
+ error = TTO_Err_Invalid_SubTable;
+ goto Fail;
+ }
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail:
+ FREE( cf2->RangeRecord );
+ return error;
+ }
+
+
+ static void Free_Coverage2( TTO_CoverageFormat2* cf2 )
+ {
+ FREE( cf2->RangeRecord );
+ }
+
+
+ TT_Error Load_Coverage( TTO_Coverage* c,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ c->CoverageFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( c->CoverageFormat )
+ {
+ case 1:
+ return Load_Coverage1( &c->cf.cf1, input );
+
+ case 2:
+ return Load_Coverage2( &c->cf.cf2, input );
+
+ default:
+ return TTO_Err_Invalid_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+ void Free_Coverage( TTO_Coverage* c )
+ {
+ switch ( c->CoverageFormat )
+ {
+ case 1:
+ Free_Coverage1( &c->cf.cf1 );
+ break;
+
+ case 2:
+ Free_Coverage2( &c->cf.cf2 );
+ break;
+ }
+ }
+
+
+ static TT_Error Coverage_Index1( TTO_CoverageFormat1* cf1,
+ UShort glyphID,
+ UShort* index )
+ {
+ UShort min, max, new_min, new_max, middle;
+
+ UShort* array = cf1->GlyphArray;
+
+
+ /* binary search */
+
+ new_min = 0;
+ new_max = cf1->GlyphCount - 1;
+
+ do
+ {
+ min = new_min;
+ max = new_max;
+
+ /* we use (min + max) / 2 = max - (max - min) / 2 to avoid
+ overflow and rounding errors */
+
+ middle = max - ( ( max - min ) >> 1 );
+
+ if ( glyphID == array[middle] )
+ {
+ *index = middle;
+ return TT_Err_Ok;
+ }
+ else if ( glyphID < array[middle] )
+ {
+ if ( middle == min )
+ break;
+ new_max = middle - 1;
+ }
+ else
+ {
+ if ( middle == max )
+ break;
+ new_min = middle + 1;
+ }
+ } while ( min < max );
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ static TT_Error Coverage_Index2( TTO_CoverageFormat2* cf2,
+ UShort glyphID,
+ UShort* index )
+ {
+ UShort min, max, new_min, new_max, middle;
+
+ TTO_RangeRecord* rr = cf2->RangeRecord;
+
+
+ /* binary search */
+
+ new_min = 0;
+ new_max = cf2->RangeCount - 1;
+
+ do
+ {
+ min = new_min;
+ max = new_max;
+
+ /* we use (min + max) / 2 = max - (max - min) / 2 to avoid
+ overflow and rounding errors */
+
+ middle = max - ( ( max - min ) >> 1 );
+
+ if ( glyphID >= rr[middle].Start && glyphID <= rr[middle].End )
+ {
+ *index = rr[middle].StartCoverageIndex + glyphID - rr[middle].Start;
+ return TT_Err_Ok;
+ }
+ else if ( glyphID < rr[middle].Start )
+ {
+ if ( middle == min )
+ break;
+ new_max = middle - 1;
+ }
+ else
+ {
+ if ( middle == max )
+ break;
+ new_min = middle + 1;
+ }
+ } while ( min < max );
+
+ return TTO_Err_Not_Covered;
+ }
+
+
+ TT_Error Coverage_Index( TTO_Coverage* c,
+ UShort glyphID,
+ UShort* index )
+ {
+ switch ( c->CoverageFormat )
+ {
+ case 1:
+ return Coverage_Index1( &c->cf.cf1, glyphID, index );
+
+ case 2:
+ return Coverage_Index2( &c->cf.cf2, glyphID, index );
+
+ default:
+ return TTO_Err_Invalid_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+
+ /*************************************
+ * Class Definition related functions
+ *************************************/
+
+
+ /* ClassDefFormat1 */
+
+ static TT_Error Load_ClassDef1( TTO_ClassDefinition* cd,
+ UShort limit,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* cva;
+ Bool* d;
+
+ TTO_ClassDefFormat1* cdf1;
+
+
+ cdf1 = &cd->cd.cd1;
+
+ if ( ACCESS_Frame( 4L ) )
+ return error;
+
+ cdf1->StartGlyph = GET_UShort();
+ count = cdf1->GlyphCount = GET_UShort();
+
+ FORGET_Frame();
+
+ /* sanity check; we are limited to 16bit integers */
+
+ if ( cdf1->StartGlyph + (long)count >= 0x10000L )
+ return TTO_Err_Invalid_SubTable;
+
+ cdf1->ClassValueArray = NULL;
+
+ if ( ALLOC_ARRAY( cdf1->ClassValueArray, count, UShort ) )
+ return error;
+
+ d = cd->Defined;
+ cva = cdf1->ClassValueArray;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ goto Fail;
+
+ for ( n = 0; n < count; n++ )
+ {
+ cva[n] = GET_UShort();
+ if ( cva[n] >= limit )
+ {
+ error = TTO_Err_Invalid_SubTable;
+ goto Fail;
+ }
+ d[cva[n]] = TRUE;
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail:
+ FREE( cva );
+
+ return error;
+ }
+
+
+ static void Free_ClassDef1( TTO_ClassDefFormat1* cdf1 )
+ {
+ FREE( cdf1->ClassValueArray );
+ }
+
+
+ /* ClassDefFormat2 */
+
+ static TT_Error Load_ClassDef2( TTO_ClassDefinition* cd,
+ UShort limit,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ TTO_ClassRangeRecord* crr;
+ Bool* d;
+
+ TTO_ClassDefFormat2* cdf2;
+
+
+ cdf2 = &cd->cd.cd2;
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ count = cdf2->ClassRangeCount = GET_UShort();
+
+ FORGET_Frame();
+
+ cdf2->ClassRangeRecord = NULL;
+
+ if ( ALLOC_ARRAY( cdf2->ClassRangeRecord, count, TTO_ClassRangeRecord ) )
+ return error;
+
+ d = cd->Defined;
+ crr = cdf2->ClassRangeRecord;
+
+ if ( ACCESS_Frame( count * 6L ) )
+ goto Fail;
+
+ for ( n = 0; n < count; n++ )
+ {
+ crr[n].Start = GET_UShort();
+ crr[n].End = GET_UShort();
+ crr[n].Class = GET_UShort();
+
+ /* sanity check */
+
+ if ( crr[n].Start > crr[n].End ||
+ crr[n].Class >= limit )
+ {
+ error = TTO_Err_Invalid_SubTable;
+ goto Fail;
+ }
+ d[crr[n].Class] = TRUE;
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+ Fail:
+ FREE( crr );
+
+ return error;
+ }
+
+
+ static void Free_ClassDef2( TTO_ClassDefFormat2* cdf2 )
+ {
+ FREE( cdf2->ClassRangeRecord );
+ }
+
+
+ /* ClassDefinition */
+
+ TT_Error Load_ClassDefinition( TTO_ClassDefinition* cd,
+ UShort limit,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+
+ if ( ALLOC_ARRAY( cd->Defined, limit, Bool ) )
+ return error;
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ cd->ClassFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ switch ( cd->ClassFormat )
+ {
+ case 1:
+ error = Load_ClassDef1( cd, limit, input );
+ break;
+
+ case 2:
+ error = Load_ClassDef2( cd, limit, input );
+ break;
+
+ default:
+ error = TTO_Err_Invalid_SubTable_Format;
+ break;
+ }
+
+ if ( error )
+ goto Fail;
+
+ cd->loaded = TRUE;
+
+ return TT_Err_Ok;
+
+ Fail:
+ FREE( cd->Defined );
+ return error;
+ }
+
+
+ void Free_ClassDefinition( TTO_ClassDefinition* cd )
+ {
+ if ( !cd->loaded )
+ return;
+
+ FREE( cd->Defined );
+
+ switch ( cd->ClassFormat )
+ {
+ case 1:
+ Free_ClassDef1( &cd->cd.cd1 );
+ break;
+
+ case 2:
+ Free_ClassDef2( &cd->cd.cd2 );
+ break;
+ }
+ }
+
+
+ static TT_Error Get_Class1( TTO_ClassDefFormat1* cdf1,
+ UShort glyphID,
+ UShort* class,
+ UShort* index )
+ {
+ UShort* cva = cdf1->ClassValueArray;
+
+
+ *index = 0;
+
+ if ( glyphID >= cdf1->StartGlyph &&
+ glyphID <= cdf1->StartGlyph + cdf1->GlyphCount )
+ {
+ *class = cva[glyphID - cdf1->StartGlyph];
+ return TT_Err_Ok;
+ }
+ else
+ {
+ *class = 0;
+ return TTO_Err_Not_Covered;
+ }
+ }
+
+
+ /* we need the index value of the last searched class range record
+ in case of failure for constructed GDEF tables */
+
+ static TT_Error Get_Class2( TTO_ClassDefFormat2* cdf2,
+ UShort glyphID,
+ UShort* class,
+ UShort* index )
+ {
+ TT_Error error = TT_Err_Ok;
+ UShort min, max, new_min, new_max, middle;
+
+ TTO_ClassRangeRecord* crr = cdf2->ClassRangeRecord;
+
+
+ /* binary search */
+
+ new_min = 0;
+ new_max = cdf2->ClassRangeCount - 1;
+
+ do
+ {
+ min = new_min;
+ max = new_max;
+
+ /* we use (min + max) / 2 = max - (max - min) / 2 to avoid
+ overflow and rounding errors */
+
+ middle = max - ( ( max - min ) >> 1 );
+
+ if ( glyphID >= crr[middle].Start && glyphID <= crr[middle].End )
+ {
+ *class = crr[middle].Class;
+ error = TT_Err_Ok;
+ break;
+ }
+ else if ( glyphID < crr[middle].Start )
+ {
+ if ( middle == min )
+ {
+ *class = 0;
+ error = TTO_Err_Not_Covered;
+ break;
+ }
+ new_max = middle - 1;
+ }
+ else
+ {
+ if ( middle == max )
+ {
+ *class = 0;
+ error = TTO_Err_Not_Covered;
+ break;
+ }
+ new_min = middle + 1;
+ }
+ } while ( min < max );
+
+ if ( index )
+ *index = middle;
+
+ return error;
+ }
+
+
+ TT_Error Get_Class( TTO_ClassDefinition* cd,
+ UShort glyphID,
+ UShort* class,
+ UShort* index )
+ {
+ switch ( cd->ClassFormat )
+ {
+ case 1:
+ return Get_Class1( &cd->cd.cd1, glyphID, class, index );
+
+ case 2:
+ return Get_Class2( &cd->cd.cd2, glyphID, class, index );
+
+ default:
+ return TTO_Err_Invalid_SubTable_Format;
+ }
+
+ return TT_Err_Ok; /* never reached */
+ }
+
+
+
+ /***************************
+ * Device related functions
+ ***************************/
+
+
+ TT_Error Load_Device( TTO_Device* d,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, count;
+
+ UShort* dv;
+
+
+ if ( ACCESS_Frame( 6L ) )
+ return error;
+
+ d->StartSize = GET_UShort();
+ d->EndSize = GET_UShort();
+ d->DeltaFormat = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( d->StartSize > d->EndSize ||
+ d->DeltaFormat == 0 || d->DeltaFormat > 3 )
+ return TTO_Err_Invalid_SubTable;
+
+ d->DeltaValue = NULL;
+
+ count = ( ( d->EndSize - d->StartSize + 1 ) >>
+ ( 4 - d->DeltaFormat ) ) + 1;
+
+ if ( ALLOC_ARRAY( d->DeltaValue, count, UShort ) )
+ return error;
+
+ if ( ACCESS_Frame( count * 2L ) )
+ {
+ FREE( d->DeltaValue );
+ return error;
+ }
+
+ dv = d->DeltaValue;
+
+ for ( n = 0; n < count; n++ )
+ dv[n] = GET_UShort();
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+ }
+
+
+ void Free_Device( TTO_Device* d )
+ {
+ FREE( d->DeltaValue );
+ }
+
+
+ /* Since we have the delta values stored in compressed form, we must
+ uncompress it now. To simplify the interface, the function always
+ returns a meaningful value in `value'; the error is just for
+ information.
+ | |
+ format = 1: 0011223344556677|8899101112131415|...
+ | |
+ byte 1 byte 2
+
+ 00: (byte >> 14) & mask
+ 11: (byte >> 12) & mask
+ ...
+
+ mask = 0x0003
+ | |
+ format = 2: 0000111122223333|4444555566667777|...
+ | |
+ byte 1 byte 2
+
+ 0000: (byte >> 12) & mask
+ 1111: (byte >> 8) & mask
+ ...
+
+ mask = 0x000F
+ | |
+ format = 3: 0000000011111111|2222222233333333|...
+ | |
+ byte 1 byte 2
+
+ 00000000: (byte >> 8) & mask
+ 11111111: (byte >> 0) & mask
+ ....
+
+ mask = 0x00FF */
+
+ TT_Error Get_Device( TTO_Device* d,
+ UShort size,
+ Short* value )
+ {
+ UShort byte, bits, mask, f, s;
+
+
+ f = d->DeltaFormat;
+
+ if ( size >= d->StartSize && size <= d->EndSize )
+ {
+ s = size - d->StartSize;
+ byte = d->DeltaValue[s >> ( 4 - f )];
+ bits = byte >> ( 16 - ( ( s % ( 1 << ( 4 - f ) ) + 1 ) << f ) );
+ mask = 0xFFFF >> ( 16 - ( 1 << f ) );
+
+ *value = (Short)( bits & mask );
+
+ /* conversion to a signed value */
+
+ if ( *value >= ( ( mask + 1 ) >> 1 ) )
+ *value -= mask + 1;
+
+ return TT_Err_Ok;
+ }
+ else
+ {
+ *value = 0;
+ return TTO_Err_Not_Covered;
+ }
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxopen.h b/Build/source/libs/freetype/lib/extend/ftxopen.h
new file mode 100644
index 00000000000..9725231dcfb
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxopen.h
@@ -0,0 +1,290 @@
+/*******************************************************************
+ *
+ * ftxopen.h
+ *
+ * TrueType Open support.
+ *
+ * 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 should be included by the application. Nevertheless,
+ * the table specific APIs (and structures) are located in files like
+ * ftxgsub.h or ftxgpos.h; these header files are read by ftxopen.h .
+ *
+ ******************************************************************/
+
+#ifndef FTXOPEN_H
+#define FTXOPEN_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TTO_MAX_NESTING_LEVEL 100
+
+#define TTO_Err_Invalid_SubTable_Format 0x1000
+#define TTO_Err_Invalid_SubTable 0x1001
+#define TTO_Err_Not_Covered 0x1002
+#define TTO_Err_Too_Many_Nested_Contexts 0x1003
+#define TTO_Err_No_MM_Interpreter 0x1004
+
+
+ /* Script list related structures */
+
+ typedef struct TTO_LangSys_
+ {
+ TT_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
+ TT_UShort ReqFeatureIndex; /* required FeatureIndex */
+ TT_UShort FeatureCount; /* number of Feature indices */
+ TT_UShort* FeatureIndex; /* array of Feature indices */
+
+ } TTO_LangSys;
+
+
+
+ typedef struct TTO_LangSysRecord_
+ {
+ TT_ULong LangSysTag; /* LangSysTag identifier */
+ TTO_LangSys LangSys; /* LangSys table */
+
+ } TTO_LangSysRecord;
+
+
+
+ typedef struct TTO_Script_
+ {
+ TTO_LangSys DefaultLangSys; /* DefaultLangSys table */
+ TT_UShort LangSysCount; /* number of LangSysRecords */
+ TTO_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
+
+ } TTO_Script;
+
+
+ typedef struct TTO_ScriptRecord_
+ {
+ TT_ULong ScriptTag; /* ScriptTag identifier */
+ TTO_Script Script; /* Script table */
+
+ } TTO_ScriptRecord;
+
+
+ typedef struct TTO_ScriptList_
+ {
+ TT_UShort ScriptCount; /* number of ScriptRecords */
+ TTO_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
+
+ } TTO_ScriptList;
+
+
+
+ /* Feature list related structures */
+
+ typedef struct TTO_Feature_
+ {
+ TT_UShort FeatureParams; /* always 0 for TT Open 1.0 */
+ TT_UShort LookupListCount; /* number of LookupList indices */
+ TT_UShort* LookupListIndex; /* array of LookupList indices */
+
+ } TTO_Feature;
+
+
+ typedef struct TTO_FeatureRecord_
+ {
+ TT_ULong FeatureTag; /* FeatureTag identifier */
+ TTO_Feature Feature; /* Feature table */
+
+ } TTO_FeatureRecord;
+
+
+ typedef struct TTO_FeatureList_
+ {
+ TT_UShort FeatureCount; /* number of FeatureRecords */
+ TTO_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
+
+ } TTO_FeatureList;
+
+
+ /* Lookup list related structures */
+
+ struct TTO_SubTable_;
+ typedef struct TTO_SubTable_ TTO_SubTable;
+
+
+ typedef struct TTO_Lookup_
+ {
+ TT_UShort LookupType; /* Lookup type */
+ TT_UShort LookupFlag; /* Lookup qualifiers */
+ TT_UShort SubTableCount; /* number of SubTables */
+ TTO_SubTable* SubTable; /* array of SubTables */
+
+ } TTO_Lookup;
+
+
+ /* The `Properties' field is not defined in the TTO specification but
+ is needed for processing lookups. If properties[n] is > 0, the
+ functions TT_GSUB_Apply_String() resp. TT_GPOS_Apply_String() will
+ process Lookup[n] for glyphs which have the specific bit not set in
+ the `properties' field of the input string object. */
+
+ typedef struct TTO_LookupList_
+ {
+ TT_UShort LookupCount; /* number of Lookups */
+ TTO_Lookup* Lookup; /* array of Lookup records */
+ TT_UShort* Properties; /* array of flags */
+
+ } TTO_LookupList;
+
+
+ /* Possible LookupFlag bit masks. `IGNORE_SPECIAL_MARKS' comes from the
+ OpenType 1.2 specification; RIGHT_TO_LEFT has been (re)introduced in
+ OpenType 1.3 -- if set, the last glyph in a cursive attachment
+ sequence has to be positioned on the baseline -- regardless of the
+ writing direction. */
+
+#define RIGHT_TO_LEFT 0x0001
+#define IGNORE_BASE_GLYPHS 0x0002
+#define IGNORE_LIGATURES 0x0004
+#define IGNORE_MARKS 0x0008
+#define IGNORE_SPECIAL_MARKS 0xFF00
+
+
+ typedef struct TTO_CoverageFormat1_
+ {
+ TT_UShort GlyphCount; /* number of glyphs in GlyphArray */
+ TT_UShort* GlyphArray; /* array of glyph IDs */
+
+ } TTO_CoverageFormat1;
+
+
+ typedef struct TTO_RangeRecord_
+ {
+ TT_UShort Start; /* first glyph ID in the range */
+ TT_UShort End; /* last glyph ID in the range */
+ TT_UShort StartCoverageIndex; /* coverage index of first
+ glyph ID in the range */
+ } TTO_RangeRecord;
+
+
+ typedef struct TTO_CoverageFormat2_
+ {
+ TT_UShort RangeCount; /* number of RangeRecords */
+ TTO_RangeRecord* RangeRecord; /* array of RangeRecords */
+
+ } TTO_CoverageFormat2;
+
+
+ typedef struct TTO_Coverage_
+ {
+ TT_UShort CoverageFormat; /* 1 or 2 */
+
+ union
+ {
+ TTO_CoverageFormat1 cf1;
+ TTO_CoverageFormat2 cf2;
+ } cf;
+
+ } TTO_Coverage;
+
+
+ typedef struct TTO_ClassDefFormat1_
+ {
+ TT_UShort StartGlyph; /* first glyph ID of the
+ ClassValueArray */
+ TT_UShort GlyphCount; /* size of the ClassValueArray */
+ TT_UShort* ClassValueArray; /* array of class values */
+
+ } TTO_ClassDefFormat1;
+
+
+ typedef struct TTO_ClassRangeRecord_
+ {
+ TT_UShort Start; /* first glyph ID in the range */
+ TT_UShort End; /* last glyph ID in the range */
+ TT_UShort Class; /* applied to all glyphs in range */
+
+ } TTO_ClassRangeRecord;
+
+
+ typedef struct TTO_ClassDefFormat2_
+ {
+ TT_UShort ClassRangeCount;
+ /* number of ClassRangeRecords */
+ TTO_ClassRangeRecord* ClassRangeRecord;
+ /* array of ClassRangeRecords */
+ } TTO_ClassDefFormat2;
+
+
+ /* The `Defined' field is not defined in the TTO specification but
+ apparently needed for processing fonts like trado.ttf: This font
+ refers to a class which contains not a single element. We map such
+ classes to class 0. */
+
+ typedef struct TTO_ClassDefinition_
+ {
+ TT_Bool loaded;
+
+ TT_Bool* Defined; /* array of Booleans.
+ If Defined[n] is FALSE,
+ class n contains no glyphs. */
+ TT_UShort ClassFormat; /* 1 or 2 */
+
+ union
+ {
+ TTO_ClassDefFormat1 cd1;
+ TTO_ClassDefFormat2 cd2;
+ } cd;
+
+ } TTO_ClassDefinition;
+
+
+ typedef struct TTO_Device_
+ {
+ TT_UShort StartSize; /* smallest size to correct */
+ TT_UShort EndSize; /* largest size to correct */
+ TT_UShort DeltaFormat; /* DeltaValue array data format:
+ 1, 2, or 3 */
+ TT_UShort* DeltaValue; /* array of compressed data */
+
+ } TTO_Device;
+
+
+#include "ftxgdef.h"
+#include "ftxgsub.h"
+#include "ftxgpos.h"
+
+
+ struct TTO_SubTable_
+ {
+ union
+ {
+ TTO_GSUB_SubTable gsub;
+ TTO_GPOS_SubTable gpos;
+ } st;
+ };
+
+
+ enum TTO_Type_
+ {
+ GSUB,
+ GPOS
+ };
+
+ typedef enum TTO_Type_ TTO_Type;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXOPEN_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxopenf.h b/Build/source/libs/freetype/lib/extend/ftxopenf.h
new file mode 100644
index 00000000000..81c671a1d2e
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxopenf.h
@@ -0,0 +1,143 @@
+/*******************************************************************
+ *
+ * ftxopenf.h
+ *
+ * internal TrueType Open functions
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef FTXOPENF_H
+#define FTXOPENF_H
+
+#include "ftxopen.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* functions from ftxopen.c */
+
+ TT_Error Load_ScriptList( TTO_ScriptList* sl,
+ PFace input );
+ TT_Error Load_FeatureList( TTO_FeatureList* fl,
+ PFace input );
+ TT_Error Load_LookupList( TTO_LookupList* ll,
+ PFace input,
+ TTO_Type type );
+
+ TT_Error Load_Coverage( TTO_Coverage* c,
+ PFace input );
+ TT_Error Load_ClassDefinition( TTO_ClassDefinition* cd,
+ UShort limit,
+ PFace input );
+ TT_Error Load_Device( TTO_Device* d,
+ PFace input );
+
+ void Free_ScriptList( TTO_ScriptList* sl );
+ void Free_FeatureList( TTO_FeatureList* fl );
+ void Free_LookupList( TTO_LookupList* ll,
+ TTO_Type type );
+
+ void Free_Coverage( TTO_Coverage* c );
+ void Free_ClassDefinition( TTO_ClassDefinition* cd );
+ void Free_Device( TTO_Device* d );
+
+
+ /* functions from ftxgsub.c */
+
+ TT_Error Load_SingleSubst( TTO_SingleSubst* ss,
+ PFace input );
+ TT_Error Load_MultipleSubst( TTO_MultipleSubst* ms,
+ PFace input );
+ TT_Error Load_AlternateSubst( TTO_AlternateSubst* as,
+ PFace input );
+ TT_Error Load_LigatureSubst( TTO_LigatureSubst* ls,
+ PFace input );
+ TT_Error Load_ContextSubst( TTO_ContextSubst* cs,
+ PFace input );
+ TT_Error Load_ChainContextSubst( TTO_ChainContextSubst* ccs,
+ PFace input );
+
+ void Free_SingleSubst( TTO_SingleSubst* ss );
+ void Free_MultipleSubst( TTO_MultipleSubst* ms );
+ void Free_AlternateSubst( TTO_AlternateSubst* as );
+ void Free_LigatureSubst( TTO_LigatureSubst* ls );
+ void Free_ContextSubst( TTO_ContextSubst* cs );
+ void Free_ChainContextSubst( TTO_ChainContextSubst* ccs );
+
+
+ /* functions from ftxgpos.c */
+
+ TT_Error Load_SinglePos( TTO_SinglePos* sp,
+ PFace input );
+ TT_Error Load_PairPos( TTO_PairPos* pp,
+ PFace input );
+ TT_Error Load_CursivePos( TTO_CursivePos* cp,
+ PFace input );
+ TT_Error Load_MarkBasePos( TTO_MarkBasePos* mbp,
+ PFace input );
+ TT_Error Load_MarkLigPos( TTO_MarkLigPos* mlp,
+ PFace input );
+ TT_Error Load_MarkMarkPos( TTO_MarkMarkPos* mmp,
+ PFace input );
+ TT_Error Load_ContextPos( TTO_ContextPos* cp,
+ PFace input );
+ TT_Error Load_ChainContextPos( TTO_ChainContextPos* ccp,
+ PFace input );
+
+ void Free_SinglePos( TTO_SinglePos* sp );
+ void Free_PairPos( TTO_PairPos* pp );
+ void Free_CursivePos( TTO_CursivePos* cp );
+ void Free_MarkBasePos( TTO_MarkBasePos* mbp );
+ void Free_MarkLigPos( TTO_MarkLigPos* mlp );
+ void Free_MarkMarkPos( TTO_MarkMarkPos* mmp );
+ void Free_ContextPos( TTO_ContextPos* cp );
+ void Free_ChainContextPos( TTO_ChainContextPos* ccp );
+
+
+ /* query functions */
+
+ TT_Error Coverage_Index( TTO_Coverage* c,
+ UShort glyphID,
+ UShort* index );
+ TT_Error Get_Class( TTO_ClassDefinition* cd,
+ UShort glyphID,
+ UShort* class,
+ UShort* index );
+ TT_Error Get_Device( TTO_Device* d,
+ UShort size,
+ Short* value );
+
+
+ /* functions from ftxgdef.c */
+
+ TT_Error Add_Glyph_Property( TTO_GDEFHeader* gdef,
+ UShort glyphID,
+ UShort property );
+
+ TT_Error Check_Property( TTO_GDEFHeader* gdef,
+ UShort index,
+ UShort flags,
+ UShort* property );
+
+#define CHECK_Property( gdef, index, flags, property ) \
+ ( ( error = Check_Property( (gdef), (index), (flags), \
+ (property) ) ) != TT_Err_Ok )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXOPENF_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxpost.c b/Build/source/libs/freetype/lib/extend/ftxpost.c
new file mode 100644
index 00000000000..e871277854f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxpost.c
@@ -0,0 +1,544 @@
+/*******************************************************************
+ *
+ * ftxpost.c
+ *
+ * post table support API extension body
+ *
+ * Copyright 1996-2002 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.
+ *
+ *
+ * The post table is not completely loaded by the core engine. This
+ * file loads the missing PS glyph names and implements an API to
+ * access them.
+ *
+ ******************************************************************/
+
+#include "ftxpost.h"
+
+#include "tttypes.h"
+#include "ttobjs.h"
+#include "tttables.h"
+#include "ttload.h" /* for the macros */
+#include "ttfile.h"
+#include "tttags.h"
+#include "ttmemory.h"
+#include "ttextend.h"
+
+
+#define POST_ID Build_Extension_ID( 'p', 'o', 's', 't' )
+
+
+ /* the 258 default Mac PS glyph names */
+
+ String* TT_Post_Default_Names[258] =
+ {
+ /* 0 */
+ ".notdef", ".null", "CR", "space", "exclam",
+ "quotedbl", "numbersign", "dollar", "percent", "ampersand",
+ /* 10 */
+ "quotesingle", "parenleft", "parenright", "asterisk", "plus",
+ "comma", "hyphen", "period", "slash", "zero",
+ /* 20 */
+ "one", "two", "three", "four", "five",
+ "six", "seven", "eight", "nine", "colon",
+ /* 30 */
+ "semicolon", "less", "equal", "greater", "question",
+ "at", "A", "B", "C", "D",
+ /* 40 */
+ "E", "F", "G", "H", "I",
+ "J", "K", "L", "M", "N",
+ /* 50 */
+ "O", "P", "Q", "R", "S",
+ "T", "U", "V", "W", "X",
+ /* 60 */
+ "Y", "Z", "bracketleft", "backslash", "bracketright",
+ "asciicircum", "underscore", "grave", "a", "b",
+ /* 70 */
+ "c", "d", "e", "f", "g",
+ "h", "i", "j", "k", "l",
+ /* 80 */
+ "m", "n", "o", "p", "q",
+ "r", "s", "t", "u", "v",
+ /* 90 */
+ "w", "x", "y", "z", "braceleft",
+ "bar", "braceright", "asciitilde", "Adieresis", "Aring",
+ /* 100 */
+ "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis",
+ "aacute", "agrave", "acircumflex", "adieresis", "atilde",
+ /* 110 */
+ "aring", "ccedilla", "eacute", "egrave", "ecircumflex",
+ "edieresis", "iacute", "igrave", "icircumflex", "idieresis",
+ /* 120 */
+ "ntilde", "oacute", "ograve", "ocircumflex", "odieresis",
+ "otilde", "uacute", "ugrave", "ucircumflex", "udieresis",
+ /* 130 */
+ "dagger", "degree", "cent", "sterling", "section",
+ "bullet", "paragraph", "germandbls", "registered", "copyright",
+ /* 140 */
+ "trademark", "acute", "dieresis", "notequal", "AE",
+ "Oslash", "infinity", "plusminus", "lessequal", "greaterequal",
+ /* 150 */
+ "yen", "mu", "partialdiff", "summation", "product",
+ "pi", "integral", "ordfeminine", "ordmasculine", "Omega",
+ /* 160 */
+ "ae", "oslash", "questiondown", "exclamdown", "logicalnot",
+ "radical", "florin", "approxequal", "Delta", "guillemotleft",
+ /* 170 */
+ "guillemotright", "ellipsis", "nbspace", "Agrave", "Atilde",
+ "Otilde", "OE", "oe", "endash", "emdash",
+ /* 180 */
+ "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide",
+ "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
+ /* 190 */
+ "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl",
+ "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",
+ /* 200 */
+ "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute",
+ "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex",
+ /* 210 */
+ "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave",
+ "dotlessi", "circumflex", "tilde", "macron", "breve",
+ /* 220 */
+ "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek",
+ "caron", "Lslash", "lslash", "Scaron", "scaron",
+ /* 230 */
+ "Zcaron", "zcaron", "brokenbar", "Eth", "eth",
+ "Yacute", "yacute", "Thorn", "thorn", "minus",
+ /* 240 */
+ "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf",
+ "onequarter", "threequarters", "franc", "Gbreve", "gbreve",
+ /* 250 */
+ "Idot", "Scedilla", "scedilla", "Cacute", "cacute",
+ "Ccaron", "ccaron", "dmacron",
+ };
+
+
+
+ static TT_Error Load_Format_20( TT_Post_20* post20,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, num_glyphs, num_names;
+ Byte len;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ num_glyphs = GET_UShort();
+
+ FORGET_Frame();
+
+ /* UNDOCUMENTED! The number of glyphs in this table can be smaller */
+ /* than the value in the maxp table (cf. cyberbit.ttf). */
+
+ /* There already exist fonts which have more than 32768 glyph names */
+ /* in this table, so the test for this threshold has been dropped. */
+
+ if ( num_glyphs > input->numGlyphs )
+ return TT_Err_Invalid_Post_Table;
+
+ post20->numGlyphs = num_glyphs;
+
+ /* load the indices */
+
+ if ( ALLOC_ARRAY( post20->glyphNameIndex, num_glyphs, TT_UShort ) )
+ return error;
+
+ if ( ACCESS_Frame( num_glyphs * 2L ) )
+ goto Fail;
+
+ for ( n = 0; n < num_glyphs; n++ )
+ {
+ post20->glyphNameIndex[n] = GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ /* compute number of names stored in table */
+ num_names = 0;
+
+ for ( n = 0; n < num_glyphs; n++ )
+ {
+ UShort idx;
+
+
+ idx = post20->glyphNameIndex[n];
+ if ( idx >= 258 )
+ {
+ idx -= 257;
+#if 0 /* FIXME This test has been dropped in Freetype 2. Why? */
+ if ( idx > num_glyphs )
+ {
+ error = TT_Err_Invalid_Post_Table;
+ goto Fail;
+ }
+#endif
+ if ( idx > num_names )
+ num_names = idx;
+ }
+ }
+
+ post20->numNames = num_names;
+
+ if ( num_names == 0 ) /* nothing more to do */
+ return TT_Err_Ok;
+
+ /* now load the name strings */
+ if ( ALLOC_ARRAY( post20->glyphNames, num_names, Char* ) )
+ goto Fail;
+
+ /* We must initialize the glyphNames array for proper */
+ /* deallocation. */
+ /* FIXME is it still really needed? */
+ for ( n = 0; n < num_names; n++ )
+ post20->glyphNames[n] = NULL;
+
+ /* Now we can read the glyph names which are stored in */
+ /* Pascal string format. */
+ for ( n = 0; n < num_names; n++ )
+ {
+ if ( ACCESS_Frame( 1L ) )
+ goto Fail1;
+
+ len = GET_Byte();
+
+ FORGET_Frame();
+
+ if ( ALLOC_ARRAY( post20->glyphNames[n], len + 1, Char ) ||
+ FILE_Read( post20->glyphNames[n], len ) )
+ goto Fail1;
+
+ /* we make a C string */
+ post20->glyphNames[n][len] = '\0';
+ }
+
+ return TT_Err_Ok;
+
+
+ Fail1:
+ for ( n = 0; n < num_names; n++ )
+ if ( post20->glyphNames[n] )
+ FREE( post20->glyphNames[n] );
+
+ FREE( post20->glyphNames );
+
+ Fail:
+ FREE( post20->glyphNameIndex );
+ return error;
+ }
+
+
+ static TT_Error Load_Format_25( TT_Post_25* post25,
+ PFace input )
+ {
+ DEFINE_LOAD_LOCALS( input->stream );
+
+ UShort n, num;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ /* UNDOCUMENTED! This value appears only in the Apple TT specs. */
+ num = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( num > input->numGlyphs || num > 258 )
+ return TT_Err_Invalid_Post_Table;
+
+ post25->numGlyphs = num;
+
+ if ( ALLOC_ARRAY( post25->offset, num, Char ) )
+ return error;
+
+ if ( ACCESS_Frame( num ) )
+ goto Fail;
+
+ for ( n = 0; n < num; n++ )
+ {
+ post25->offset[n] = GET_Char();
+
+ /* We add 128 to the tests to avoid problems with negative */
+ /* values for comparison. */
+ if ( n + ( post25->offset[n] + 128 ) > num + 128 ||
+ n + ( post25->offset[n] + 128 ) < 128 )
+ {
+ FORGET_Frame();
+ error = TT_Err_Invalid_Post_Table;
+ goto Fail;
+ }
+ }
+
+ FORGET_Frame();
+
+ return TT_Err_Ok;
+
+
+ Fail:
+ FREE( post25->offset );
+ return error;
+ }
+
+
+ static TT_Error Post_Create( void* ext,
+ PFace face )
+ {
+ TT_Post* post = (TT_Post*)ext;
+ Long table;
+
+
+ /* by convention */
+ if ( !post )
+ return TT_Err_Ok;
+
+ /* we store the start offset and the size of the subtable */
+ table = TT_LookUp_Table( face, TTAG_post );
+ post->offset = face->dirTables[table].Offset + 32L;
+ post->length = face->dirTables[table].Length - 32L;
+ post->loaded = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error Post_Destroy( void* ext,
+ PFace face )
+ {
+ TT_Post* post = (TT_Post*)ext;
+ UShort n;
+
+
+ /* by convention */
+ if ( !post )
+ return TT_Err_Ok;
+
+ if ( post->loaded )
+ {
+ switch ( face->postscript.FormatType )
+ {
+ case 0x00010000: /* nothing to do */
+ break;
+
+ case 0x00020000:
+ if ( post->p.post20.numNames )
+ {
+ for ( n = 0; n < post->p.post20.numNames; n++ )
+ if ( post->p.post20.glyphNames[n] )
+ FREE( post->p.post20.glyphNames[n] );
+ FREE( post->p.post20.glyphNames );
+ }
+ FREE( post->p.post20.glyphNameIndex );
+ break;
+
+ case 0x00028000:
+ FREE( post->p.post25.offset );
+ break;
+
+ case 0x00030000: /* nothing to do */
+ break;
+
+#if 0
+ case 0x00040000:
+ break;
+#endif
+
+ default:
+ ; /* invalid format, do nothing */
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_Post_Extension( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+ TT_Error error;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ error = TT_Register_Extension( _engine,
+ POST_ID,
+ sizeof ( TT_Post ),
+ Post_Create,
+ Post_Destroy );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Load_PS_Names
+ *
+ * Description : Loads the PostScript Glyph Name subtable (if any).
+ *
+ * Output : error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_PS_Names( TT_Face face,
+ TT_Post* ppost )
+ {
+ PFace faze = HANDLE_Face( face );
+ TT_Error error;
+ TT_Stream stream;
+ TT_Post* post;
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ error = TT_Extension_Get( faze, POST_ID, (void**)&post );
+ if ( error )
+ return error;
+
+ if ( USE_Stream( faze->stream, stream ) )
+ return error;
+
+
+ switch ( faze->postscript.FormatType )
+ {
+ case 0x00010000:
+ error = TT_Err_Ok; /* nothing to do */
+ break;
+
+ case 0x00020000:
+ if ( FILE_Seek( post->offset ) )
+ goto Fail;
+
+ error = Load_Format_20( &post->p.post20, faze );
+ break;
+
+ case 0x00028000: /* 2.5 in 16.16 format */
+ if ( FILE_Seek( post->offset ) )
+ goto Fail;
+
+ error = Load_Format_25( &post->p.post25, faze );
+ break;
+
+ case 0x00030000:
+ error = TT_Err_Ok; /* nothing to do */
+ break;
+
+#if 0
+ case 0x00040000:
+ break;
+#endif
+
+ default:
+ error = TT_Err_Invalid_Post_Table_Format;
+ break;
+ }
+
+ if ( !error )
+ {
+ post->loaded = TRUE;
+ *ppost = *post;
+ }
+
+
+ Fail:
+ DONE_Stream( stream );
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_PS_Name
+ *
+ * Description : Gets the PostScript Glyph Name of a glyph.
+ *
+ * Input : index glyph index
+ * PSname address of a string pointer.
+ * Will be NULL in case of error; otherwise it
+ * contains a pointer to the glyph name.
+ *
+ * You must not modify the returned string!
+ *
+ * Output : error code
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_PS_Name( TT_Face face,
+ TT_UShort index,
+ TT_String** PSname )
+ {
+ PFace faze = HANDLE_Face( face );
+ TT_Error error;
+ TT_Post* post;
+ UShort nameindex;
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( index >= faze->numGlyphs )
+ return TT_Err_Invalid_Glyph_Index;
+
+ error = TT_Extension_Get( faze, POST_ID, (void**)&post );
+ if ( error )
+ return error;
+
+
+ *PSname = TT_Post_Default_Names[0]; /* default value */
+
+ switch ( faze->postscript.FormatType )
+ {
+ case 0x00010000:
+ if ( index < 258 ) /* paranoid checking */
+ *PSname = TT_Post_Default_Names[index];
+ break;
+
+ case 0x00020000:
+ if ( index < post->p.post20.numGlyphs )
+ nameindex = post->p.post20.glyphNameIndex[index];
+ else
+ break;
+
+ if ( nameindex < 258 )
+ *PSname = TT_Post_Default_Names[nameindex];
+ else
+ *PSname = (String*)post->p.post20.glyphNames[nameindex - 258];
+ break;
+
+ case 0x00028000:
+ if ( index < post->p.post25.numGlyphs ) /* paranoid checking */
+ *PSname = TT_Post_Default_Names[index + post->p.post25.offset[index]];
+ break;
+
+ case 0x00030000:
+ break; /* nothing to do */
+
+#if 0
+ case 0x00040000:
+ break;
+#endif
+
+ default:
+ ; /* should never happen */
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxpost.h b/Build/source/libs/freetype/lib/extend/ftxpost.h
new file mode 100644
index 00000000000..942d967ed6b
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxpost.h
@@ -0,0 +1,109 @@
+/*******************************************************************
+ *
+ * ftxpost.h
+ *
+ * post table support API extension
+ *
+ * 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.
+ *
+ *
+ * The post table is not completely loaded by the core engine. This
+ * file loads the missing PS glyph names and implements an API to
+ * access them.
+ *
+ ******************************************************************/
+
+#ifndef FTXPOST_H
+#define FTXPOST_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TT_Err_Invalid_Post_Table_Format 0x0B00
+#define TT_Err_Invalid_Post_Table 0x0B01
+
+ /* the 258 standard Mac glyph names, used for format 1.0 and 2.5 */
+
+ extern TT_String* TT_Post_Default_Names[];
+
+
+ /* format 2.0 table */
+
+ struct TT_Post_20_
+ {
+ TT_UShort numGlyphs;
+ TT_UShort numNames;
+ TT_UShort* glyphNameIndex;
+ TT_Char** glyphNames;
+ };
+
+ typedef struct TT_Post_20_ TT_Post_20;
+
+ struct TT_Post_25_
+ {
+ TT_UShort numGlyphs;
+ TT_Char* offset;
+ };
+
+ typedef struct TT_Post_25_ TT_Post_25;
+
+#if 0
+ /* format 4.0 table -- not implemented yet */
+
+ struct TT_Post_40_
+ {
+ };
+
+ typedef struct TT_Post_40_ TT_Post_40;
+#endif
+
+
+ struct TT_Post_
+ {
+ TT_Long offset;
+ TT_Long length;
+ TT_Bool loaded;
+
+ union
+ {
+ TT_Post_20 post20;
+ TT_Post_25 post25;
+#if 0
+ TT_Post_40 post40;
+#endif
+ } p;
+ };
+
+ typedef struct TT_Post_ TT_Post;
+
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_Post_Extension( TT_Engine engine );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_PS_Names( TT_Face face,
+ TT_Post* post );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_PS_Name( TT_Face face,
+ TT_UShort index,
+ TT_String** PSname );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXPOST_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxsbit.c b/Build/source/libs/freetype/lib/extend/ftxsbit.c
new file mode 100644
index 00000000000..d692f7fd51c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxsbit.c
@@ -0,0 +1,1393 @@
+/*******************************************************************
+ *
+ * ftxsbit.c
+ *
+ * Embedded bitmap API extension
+ *
+ * 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 extension is used to load the embedded bitmaps present
+ * in certain TrueType files.
+ *
+ ******************************************************************/
+
+#include "ftxsbit.h"
+#include "ttobjs.h"
+#include "ttfile.h"
+#include "ttload.h"
+#include "ttmemory.h"
+#include "tttags.h"
+#include "ttextend.h"
+#include "ttdebug.h"
+
+
+#define SBIT_ID Build_Extension_ID( 's', 'b', 'i', 't' )
+
+
+/* Required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_bitmap
+
+/* In all functions, the stream is taken from the 'face' object */
+#define DEFINE_LOCALS DEFINE_LOAD_LOCALS( face->stream )
+#define DEFINE_LOCALS_WO_FRAME DEFINE_LOAD_LOCALS_WO_FRAME( face->stream )
+
+
+/***************************
+ *
+ * miscellaneous functions
+ *
+ ***************************/
+
+/*******************************************************************
+ *
+ * Function: Load_BitmapData
+ *
+ * Bit-aligned bitmap data -> Byte-aligned bitmap data when pad is 0
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Load_BitmapData( TT_SBit_Image* image,
+ Int image_size,
+ Byte x_offset,
+ Byte y_offset,
+ UShort source_width,
+ UShort source_height,
+ Bool byte_padded,
+ PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Int count; /* number of bits left in rows */
+ Int loaded; /* number of bits loaded in the accumulator */
+ UShort buff; /* accumulator */
+
+ PByte line; /* target write cursor */
+ PByte limit;
+
+
+ if ( ( y_offset + source_height > image->map.rows ) ||
+ ( x_offset + source_width > image->map.width ) )
+ return TT_Err_Invalid_Argument;
+
+ if ( ACCESS_Frame( image_size ) )
+ return error;
+
+ buff = 0;
+ loaded = 0;
+ line = (PByte)image->map.bitmap +
+ y_offset * image->map.cols;
+ limit = (PByte)image->map.bitmap +
+ ( y_offset + source_height ) * image->map.cols;
+
+ for ( ; line < limit; line += image->map.cols )
+ {
+ PByte ptr;
+
+
+ ptr = line + x_offset / 8;
+ count = source_width;
+
+ /* We may assume that `loaded' is less than 8 */
+ buff >>= x_offset % 8;
+ loaded += x_offset % 8;
+
+ /* first of all, read all consecutive bytes */
+ while ( count >= 8 )
+ {
+ if ( loaded < 8 )
+ {
+ buff |= ((UShort)GET_Byte()) << (8 - loaded);
+ loaded += 8;
+ }
+
+ *ptr++ |= (Byte)(buff >> 8);
+ buff <<= 8;
+ loaded -= 8;
+ count -= 8;
+ }
+
+ /* now write remaining bits (i.e. end of line with count < 8) */
+ if ( count > 0 )
+ {
+ if ( loaded < count )
+ {
+ buff |= ((UShort)GET_Byte()) << (8 - loaded);
+ loaded += 8;
+ }
+
+ *ptr |= ((Byte)(buff >> 8)) & ~(0xFF >> count);
+ buff <<= count;
+ loaded -= count;
+ }
+
+ if ( byte_padded )
+ {
+ buff = 0;
+ loaded = 0;
+ }
+ }
+
+ FORGET_Frame();
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function: Crop_Bitmap
+ *
+ ******************************************************************/
+
+ static void Crop_Bitmap( TT_SBit_Image* image )
+ {
+ /*******************************************************/
+ /* In the following situation, some bounding boxes of */
+ /* embedded bitmaps are too large. We need to crop it */
+ /* to a reasonable size. */
+ /* */
+ /* --------- */
+ /* | | ----- */
+ /* | *** | |***| */
+ /* | * | -----> | * | */
+ /* | * | | * | */
+ /* | * | | * | */
+ /* | * | | * | */
+ /* | *** | |***| */
+ /* --------- ----- */
+ /* */
+ /*******************************************************/
+
+ Int rows, count;
+ Long line_len;
+ PByte line;
+
+
+ /********************************************************************/
+ /* */
+ /* first of all, check the top-most lines of the bitmap and remove */
+ /* them if they're empty. */
+ /* */
+ {
+ line = (PByte)image->map.bitmap;
+ rows = image->map.rows;
+ line_len = image->map.cols;
+
+ for ( count = 0; count < rows; count++ )
+ {
+ PByte cur = line;
+ PByte limit = line + line_len;
+
+
+ for ( ; cur < limit; cur++ )
+ if ( cur[0] )
+ goto Found_Top;
+
+ /* the current line was empty -- skip to next one */
+ line = limit;
+ }
+
+ Found_Top:
+ /* check that we have at least one filled line */
+ if ( count >= rows )
+ goto Empty_Bitmap;
+
+ /* now, crop the empty upper lines */
+ if ( count > 0 )
+ {
+ line = (PByte)image->map.bitmap;
+
+ MEM_Move( line, line + count*line_len, (rows-count) * line_len );
+
+ image->metrics.bbox.yMax -= count;
+ image->metrics.vertBearingY -= count;
+ image->metrics.horiBearingY -= count;
+ image->map.rows -= count;
+ rows -= count;
+ }
+ }
+
+ /*******************************************************************/
+ /* */
+ /* second, crop the lower lines */
+ /* */
+ {
+ line = (PByte)image->map.bitmap + (rows-1) * line_len;
+
+ for ( count = 0; count < rows; count++ )
+ {
+ PByte cur = line;
+ PByte limit = line + line_len;
+
+
+ for ( ; cur < limit; cur++ )
+ if ( cur[0] )
+ goto Found_Bottom;
+
+ /* the current line was empty -- skip to previous one */
+ line -= line_len;
+ }
+
+ Found_Bottom:
+ if ( count > 0 )
+ {
+ image->metrics.bbox.yMin += count;
+ image->map.rows -= count;
+ rows -= count;
+ }
+ }
+
+ /*******************************************************************/
+ /* */
+ /* third, get rid of the space on the left side of the glyph */
+ /* */
+ do
+ {
+ PByte limit;
+
+
+ line = (PByte)image->map.bitmap;
+ limit = line + rows * line_len;
+
+ for ( ; line < limit; line += line_len )
+ if ( line[0] & 0x80 )
+ goto Found_Left;
+
+ /* shift the whole glyph one pixel to the left */
+ line = (PByte)image->map.bitmap;
+ limit = line + rows * line_len;
+
+ for ( ; line < limit; line += line_len )
+ {
+ Int n, width = image->map.width;
+ Byte old;
+ PByte cur = line;
+
+
+ old = cur[0] << 1;
+
+ for ( n = 8; n < width; n += 8 )
+ {
+ Byte val;
+
+
+ val = cur[1];
+ cur[0] = old | (val >> 7);
+ old = val << 1;
+ cur++;
+ }
+ cur[0] = old;
+ }
+
+ image->map.width--;
+ image->metrics.horiBearingX++;
+ image->metrics.vertBearingX++;
+ image->metrics.bbox.xMin++;
+
+ } while ( image->map.width > 0 );
+
+ Found_Left:
+
+ /*********************************************************************/
+ /* */
+ /* finally, crop the bitmap width to get rid of the space on the */
+ /* right side of the glyph. */
+ /* */
+ do
+ {
+ Int right = image->map.width-1;
+ PByte limit;
+ Byte mask;
+
+
+ line = (PByte)image->map.bitmap + (right >> 3);
+ limit = line + rows*line_len;
+ mask = 0x80 >> (right & 7);
+
+ for ( ; line < limit; line += line_len )
+ if ( line[0] & mask )
+ goto Found_Right;
+
+ /* crop the whole glyph on the right */
+ image->map.width--;
+ image->metrics.bbox.xMax--;
+
+ } while ( image->map.width > 0 );
+
+ Found_Right:
+ /* all right, the bitmap was cropped */
+ return;
+
+ Empty_Bitmap:
+ image->map.width = 0;
+ image->map.rows = 0;
+ image->map.cols = 0;
+ image->map.size = 0;
+ }
+
+/*************
+ *
+ * Main body
+ *
+ *************/
+
+
+ static TT_Error
+ Load_Range_Codes( TT_SBit_Range* range,
+ PFace face,
+ Bool load_offsets )
+ {
+ DEFINE_LOCALS;
+
+ ULong count, n, size;
+
+
+ (void)face;
+
+ /* read glyph count */
+ if ( ACCESS_Frame( 4L ) )
+ goto Exit;
+ count = GET_ULong();
+ FORGET_Frame();
+
+ range->num_glyphs = count;
+
+ /* Allocate glyph offsets table if needed */
+ if ( load_offsets )
+ {
+ if ( ALLOC_ARRAY( range->glyph_offsets, count, ULong ) )
+ goto Exit;
+
+ size = count * 4L;
+ }
+ else
+ size = count * 2L;
+
+ /* Allocate glyph codes table and access frame */
+ if ( ALLOC_ARRAY ( range->glyph_codes, count, UShort ) ||
+ ACCESS_Frame( size ) )
+ goto Exit;
+
+ for ( n = 0; n < count; n++ )
+ {
+ range->glyph_codes[n] = GET_UShort();
+
+ if ( load_offsets )
+ range->glyph_offsets[n] = (ULong)range->image_offset + GET_UShort();
+ }
+
+ FORGET_Frame();
+
+ Exit:
+ return error;
+ }
+
+
+ static TT_Error
+ Load_SBit_Range( TT_SBit_Strike* strike,
+ TT_SBit_Range* range,
+ PFace face )
+ {
+ DEFINE_LOCALS;
+
+ UShort format;
+
+
+ (void)face;
+ (void)strike;
+
+ format = range->index_format;
+ PTRACE6(( "Index Format: %d\n", format ));
+
+ switch( format )
+ {
+ case 1: /* variable metrics with 4-byte offsets */
+ case 3: /* variable metrics with 2-byte offsets */
+ {
+ UShort num_glyphs, size_elem;
+ Bool large = (format == 1);
+ ULong* cur;
+
+ num_glyphs = range->last_glyph - range->first_glyph + 1;
+ PTRACE5(( " num glyphs: %hu\n", num_glyphs ));
+
+ range->num_glyphs = num_glyphs;
+
+ num_glyphs++; /* BEWARE */
+
+ size_elem = large ? 4 : 2;
+
+ if ( ALLOC_ARRAY( range->glyph_offsets, num_glyphs, ULong ) ||
+ ACCESS_Frame( num_glyphs * size_elem ) )
+ return error;
+
+ cur = range->glyph_offsets;
+
+ while ( num_glyphs > 0 )
+ {
+ cur[0] = (TT_ULong)( range->image_offset +
+ (large ? GET_ULong() : GET_UShort()) );
+ PTRACE7(( " offset: %d\n", cur[0] ));
+ cur++;
+ num_glyphs--;
+ }
+
+ FORGET_Frame();
+ }
+ break;
+
+ case 2: /* all glyphs have identical metrics */
+ case 4:
+ case 5:
+ {
+ error = 0;
+
+ if ( format != 4 ) /* read constant metrics, formats 2 and 5 */
+ {
+ TT_SBit_Metrics* metrics;
+
+
+ if ( ACCESS_Frame( 12L ) )
+ return error;
+
+ range->image_size = GET_ULong();
+ metrics = &range->metrics;
+
+ metrics->height = GET_Byte();
+ metrics->width = GET_Byte();
+
+ metrics->horiBearingX = GET_Char();
+ metrics->horiBearingY = GET_Char();
+ metrics->horiAdvance = GET_Byte();
+
+ metrics->vertBearingX = GET_Char();
+ metrics->vertBearingY = GET_Char();
+ metrics->vertAdvance = GET_Byte();
+
+ FORGET_Frame();
+ }
+
+ if ( format != 2 ) /* load range codes, formats 4 and 5 */
+ error = Load_Range_Codes( range, face, (format == 4) );
+ }
+ break;
+
+ default:
+ error = TT_Err_Invalid_File_Format;
+ }
+
+ PTRACE3(( "Embedded Bitmap Location Tables loaded.\n" ));
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Eblc
+ *
+ * Description : Loads the Eblc table directory into face table.
+ *
+ * Input : face face record to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Load_TrueType_Eblc( PFace face,
+ TT_EBLC* eblc )
+ {
+ DEFINE_LOCALS;
+
+ ULong eblc_offset;
+ UInt i;
+ Long table;
+
+ TT_SBit_Strike* strike;
+
+
+ PTRACE2(( "Load_EBLC_Table( %08lx )\n", (long)face ));
+
+ eblc->version = 0;
+
+ /* Try to find the `EBLC' or `bloc' table in the font files. */
+ /* Both tags describe the same table; `EBLC' is for OpenType */
+ /* fonts while `bloc' is for TrueType GX fonts. Many fonts */
+ /* contain both tags pointing to the same table. */
+
+ table = TT_LookUp_Table( face, TTAG_EBLC );
+ if ( table < 0 )
+ table = TT_LookUp_Table( face, TTAG_bloc );
+
+ if ( table < 0 )
+ /* This table is optional */
+ return TT_Err_Ok;
+
+ eblc_offset = face->dirTables[table].Offset;
+
+ if ( FILE_Seek( eblc_offset ) ||
+ ACCESS_Frame( 8L ) )
+ return error;
+
+ eblc->version = GET_ULong();
+ eblc->num_strikes = GET_ULong();
+
+ FORGET_Frame();
+
+ PTRACE2(( "-- Tables count: %12u\n", eblc->num_strikes ));
+ PTRACE2(( "-- Format version: %08lx\n", eblc->version ));
+
+ if ( eblc->version != 0x00020000 )
+ {
+ PERROR(( "Invalid file format!\n" ));
+ return TT_Err_Invalid_File_Format;
+ }
+
+ if ( ALLOC_ARRAY( eblc->strikes, eblc->num_strikes, TT_SBit_Strike ) ||
+ ACCESS_Frame( 48L * eblc->num_strikes ) )
+ return error;
+
+ strike = eblc->strikes;
+
+ for ( i = 0; i < (UInt)eblc->num_strikes; i++, strike++ )
+ { /* loop through the tables and get all entries */
+ ULong indexTablesSize;
+ TT_SBit_Line_Metrics* metrics;
+ Int count;
+
+
+ strike->ranges_offset = GET_ULong();
+ indexTablesSize = GET_ULong(); /* dont' save */
+
+ strike->num_ranges = GET_ULong();
+ strike->color_ref = GET_ULong();
+
+ /* load horizontal and vertical metrics */
+ metrics = &strike->hori;
+ for ( count = 2; count > 0; count-- )
+ {
+ metrics->ascender = GET_Char();
+ metrics->descender = GET_Char();
+ metrics->max_width = GET_Byte();
+
+ metrics->caret_slope_numerator = GET_Char();
+ metrics->caret_slope_denominator = GET_Char();
+ metrics->caret_offset = GET_Char();
+
+ metrics->min_origin_SB = GET_Char();
+ metrics->min_advance_SB = GET_Char();
+ metrics->max_before_BL = GET_Char();
+ metrics->min_after_BL = GET_Char();
+ metrics->pads[0] = GET_Char();
+ metrics->pads[1] = GET_Char();
+
+ metrics = &strike->vert;
+ }
+
+ strike->start_glyph = GET_UShort();
+ strike->end_glyph = GET_UShort();
+ strike->x_ppem = GET_Byte();
+ strike->y_ppem = GET_Byte();
+ strike->bit_depth = GET_Byte();
+ strike->flags = GET_Char();
+
+ PTRACE4(( " start - end - ppemX - ppemY\n" ));
+ PTRACE4(( " %04d - %04d - %3u - %3u\n",
+ strike->start_glyph,
+ strike->end_glyph,
+ strike->x_ppem,
+ strike->y_ppem ));
+ }
+
+ FORGET_Frame();
+
+ /* Load EBLC index ranges */
+ strike = eblc->strikes;
+
+ for ( i = 0; i < eblc->num_strikes; i++, strike++ )
+ {
+ TT_SBit_Range* range;
+ UShort count = strike->num_ranges;
+
+
+ /* loop through the tables and get all entries */
+ if ( ALLOC_ARRAY( strike->sbit_ranges,
+ strike->num_ranges,
+ TT_SBit_Range ) ||
+ FILE_Seek( eblc_offset + strike->ranges_offset ) ||
+ ACCESS_Frame( strike->num_ranges * 8L ) )
+ return error;
+
+ for ( range = strike->sbit_ranges; count > 0; count--, range++ )
+ {
+ range->first_glyph = GET_UShort();
+ range->last_glyph = GET_UShort();
+ range->table_offset = eblc_offset + strike->ranges_offset +
+ GET_ULong();
+ }
+ FORGET_Frame();
+
+ /* Now, read each index table */
+ range = strike->sbit_ranges;
+ for ( count = strike->num_ranges; count > 0; count--, range++ )
+ {
+ /* Read the header */
+ if ( FILE_Seek( range->table_offset ) ||
+ ACCESS_Frame( 8L ) )
+ return error;;
+
+ range->index_format = GET_UShort();
+ range->image_format = GET_UShort();
+ range->image_offset = GET_ULong();
+
+ FORGET_Frame();
+
+ error = Load_SBit_Range( strike, range, face );
+ if (error) return error;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static void Free_TrueType_Eblc( TT_EBLC* eblc )
+ {
+ if ( eblc )
+ {
+ ULong i;
+ TT_SBit_Strike* strike = eblc->strikes;
+
+
+ strike = eblc->strikes;
+
+ for ( i = eblc->num_strikes; i > 0; i--, strike++ )
+ {
+ /* for each strike, release all glyph ranges */
+ TT_SBit_Range* range = strike->sbit_ranges;
+ Int n;
+
+
+ for ( n = strike->num_ranges; n > 0; n--, range++ )
+ {
+ /* release a range */
+ FREE( range->glyph_offsets );
+ FREE( range->glyph_codes );
+ }
+ FREE( strike->sbit_ranges );
+ strike->num_ranges = 0;
+ }
+ FREE( eblc->strikes );
+ eblc->num_strikes = 0;
+ eblc->version = 0;
+ }
+ }
+
+
+ static TT_Error
+ Load_SBit_Metrics( TT_Big_Glyph_Metrics* metrics,
+ TT_SBit_Range* range,
+ ULong ebdt_offset,
+ PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Byte height, width;
+
+
+ /* copy bitmap metrics for formats 2 and 5 */
+ if ( ( ( range->index_format == 2 ) || ( range->index_format == 5 ) ) &&
+ ( range->image_format == 5 ) )
+ /* metrics are taken from current image bitmap */
+ /* i.e. from `image.metrics' */
+ {
+ TT_SBit_Metrics* rmetrics = &range->metrics;
+
+
+ metrics->bbox.xMin = rmetrics->horiBearingX;
+ metrics->bbox.xMax = metrics->bbox.xMin + rmetrics->width;
+
+ metrics->bbox.yMax = rmetrics->horiBearingY;
+ metrics->bbox.yMin = metrics->bbox.yMax - rmetrics->height;
+
+ metrics->horiBearingX = rmetrics->horiBearingX;
+ metrics->horiBearingY = metrics->bbox.yMax;
+ metrics->horiAdvance = rmetrics->horiAdvance;
+
+ metrics->vertBearingX = rmetrics->vertBearingX;
+ metrics->vertBearingY = rmetrics->vertBearingY;
+ metrics->vertAdvance = rmetrics->vertAdvance;
+
+ return TT_Err_Ok;
+ }
+
+ switch ( range->image_format )
+ {
+ case 1:
+ case 2:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ {
+ Long length = 5L;
+
+
+ if ( range->image_format == 8 )
+ length++;
+
+ /* read the small metrics */
+ if ( ACCESS_Frame( length ) )
+ return error;
+
+ height = GET_Byte();
+ width = GET_Byte();
+
+ metrics->horiBearingX = GET_Char();
+ metrics->horiBearingY = GET_Char();
+ metrics->horiAdvance = GET_Byte();
+
+ FORGET_Frame();
+
+ metrics->bbox.xMin = metrics->horiBearingX;
+ metrics->bbox.yMax = metrics->horiBearingY;
+ metrics->bbox.xMax = metrics->bbox.xMin + width;
+ metrics->bbox.yMin = metrics->bbox.yMax - height;
+
+ /* read the rest of the big metrics for the formats */
+ /* that support it. */
+ if ( ( range->image_format >= 6 ) && ( range->image_format != 8 ) )
+ {
+ if ( ACCESS_Frame( 3L ) )
+ return error;
+
+ metrics->vertBearingX = (Int)GET_Char();
+ metrics->vertBearingY = (Int)GET_Char();
+ metrics->vertAdvance = (Int)GET_Char();
+
+ FORGET_Frame();
+ }
+ else
+ {
+ /* XXX: How can we fill these when the information isn't */
+ /* available? */
+ metrics->vertBearingX = 0;
+ metrics->vertBearingY = 0;
+ metrics->vertAdvance = 0;
+ }
+ }
+ break;
+
+ case 5: /* metrics are taken from current image bitmap */
+ /* i.e. from 'image.metrics' */
+ break;
+
+ default:
+ PERROR(( "Unsupported embedded bitmap format!\n" ));
+ return TT_Err_Invalid_File_Format;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error
+ Load_SBit_Image( TT_SBit_Strike strike,
+ UShort glyph_index,
+ Byte x_offset,
+ Byte y_offset,
+ ULong ebdt_offset,
+ TT_SBit_Image* image,
+ UShort component_depth,
+ PFace face )
+ {
+ DEFINE_LOCALS;
+ Byte height, width;
+
+ ULong bitmap_offset;
+
+ TT_SBit_Range* range = 0;
+
+ TT_Big_Glyph_Metrics metrics;
+
+ /********************************************************************/
+ /* */
+ /* Scan the strike's range for the position/metrics of the source */
+ /* glyph. */
+ {
+ UShort count = strike.num_ranges;
+ TT_SBit_Range* cur = strike.sbit_ranges;
+
+ for ( ; count > 0; count--, cur++ )
+ {
+ /* look for the glyph in the current range */
+ switch ( cur->index_format )
+ {
+ case 1:
+ case 2:
+ case 3:
+ if ( glyph_index >= cur->first_glyph &&
+ glyph_index <= cur->last_glyph )
+ {
+ UShort delta = glyph_index - cur->first_glyph;
+
+
+ range = cur;
+ bitmap_offset = cur->index_format == 2
+ ? cur->image_offset + cur->image_size * delta
+ : cur->glyph_offsets[delta];
+ goto Found;
+ }
+ break;
+
+ case 4:
+ case 5:
+ {
+ UShort n;
+
+
+ for ( n = 0; (UInt)n < cur->num_glyphs; n++ )
+ if ( cur->glyph_codes[n] == glyph_index )
+ {
+ range = cur;
+ bitmap_offset = cur->index_format == 4
+ ? cur->glyph_offsets[n]
+ : cur->image_offset + cur->image_size * n;
+ goto Found;
+ }
+ }
+ break;
+
+ default:
+ return TT_Err_Invalid_Glyph_Index;
+ }
+ }
+ /* Not found */
+ return TT_Err_Invalid_Glyph_Index;
+ }
+
+ Found:
+ if ( FILE_Seek( ebdt_offset + bitmap_offset ) )
+ return error;
+
+ /* First of all, load the metrics if needed */
+ error = Load_SBit_Metrics( &metrics, range, ebdt_offset, face );
+ if ( error )
+ return error;
+
+ width = metrics.bbox.xMax - metrics.bbox.xMin;
+ height = metrics.bbox.yMax - metrics.bbox.yMin;
+
+ if ( !component_depth )
+ {
+ image->metrics = metrics;
+
+ image->map.width = width;
+ image->map.rows = height;
+
+ image->map.cols = (width + 7) >> 3;
+ image->map.size = height * image->map.cols;
+
+ if ( REALLOC( image->map.bitmap, image->map.size ) )
+ return error;
+
+ MEM_Set( image->map.bitmap, 0, image->map.size );
+ }
+
+ /* Now, load the data as needed */
+ switch ( range->image_format )
+ {
+ case 1:
+ case 6: /* byte-aligned data */
+ error = Load_BitmapData( image,
+ height * (( width + 7 ) >> 3),
+ x_offset, y_offset,
+ width, height,
+ 1, face );
+ if ( error )
+ return error;
+ break;
+
+ case 2:
+ case 5:
+ case 7:
+ error = Load_BitmapData( image,
+ (width * height + 7) >> 3,
+ x_offset, y_offset,
+ width, height, 0, face );
+ if ( error )
+ return error;
+ break;
+
+ case 8:
+ case 9:
+ {
+ /* Now, load composite sbit glyphs */
+ /* This code is not sophisticated */
+
+ TT_SBit_Component* component_array;
+ UShort num_components;
+
+ Int i = 0;
+
+
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+ num_components = GET_UShort();
+ FORGET_Frame();
+
+ MEM_Alloc( component_array,
+ sizeof ( TT_SBit_Component ) * num_components );
+
+ if ( ACCESS_Frame( 4L * num_components ) )
+ return error;
+
+ for ( i = 0; i < num_components; i++ )
+ {
+ component_array[i].glyph_code = GET_UShort();
+ component_array[i].x_offset = GET_Char();
+ component_array[i].y_offset = GET_Char();
+ }
+
+ FORGET_Frame();
+
+ component_depth++;
+
+ for ( i = 0; i < num_components; i++ )
+ {
+ error = Load_SBit_Image( strike, component_array[i].glyph_code,
+ component_array[i].x_offset,
+ component_array[i].y_offset,
+ ebdt_offset,
+ image,
+ component_depth, face );
+ if ( error )
+ return error;
+ }
+ FREE( component_array );
+ break;
+
+ default:
+ return TT_Err_Invalid_File_Format;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function: Load_TrueType_Ebdt
+ *
+ ******************************************************************/
+
+ static TT_Error
+ Load_TrueType_Ebdt( PFace face,
+ TT_SBit_Strike strike,
+ ULong glyph_index,
+ TT_SBit_Image* image )
+ {
+ DEFINE_LOCALS;
+
+ ULong ebdt_offset;
+ ULong version;
+ Long i;
+
+
+ /* Try to find the `EBDT' or `bdat' table in the font files. */
+ /* Both tags describe the same table, `EBDT' is for OpenType */
+ /* fonts, while `bdat' is for TrueType GX fonts. Many fonts */
+ /* contain both tags pointing to the same table */
+
+ i = TT_LookUp_Table( face, TTAG_EBDT );
+ if ( i < 0 )
+ i = TT_LookUp_Table( face, TTAG_bdat );
+
+ if ( i < 0 )
+ return TT_Err_Table_Missing;
+
+ ebdt_offset = face->dirTables[i].Offset;
+
+ if ( FILE_Seek( ebdt_offset ) ||
+ ACCESS_Frame( 4L ) ) /* read into frame */
+ return error;
+
+ version = GET_ULong();
+ FORGET_Frame();
+
+ PTRACE2(( "-- Format version : %08lx\n", version ));
+ if ( version != 0x00020000 )
+ {
+ PERROR(( "Invalid file format!\n" ));
+ return TT_Err_Invalid_File_Format;
+ }
+
+ /* This doesn't compile, I simply commented it out ?? - David */
+ /* PTRACE4(( "-- Format: %d\n", range->image_format )); */
+
+ error = Load_SBit_Image( strike,
+ glyph_index,
+ 0, 0,
+ ebdt_offset,
+ image,
+ 0, face );
+ if ( error )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error EBLC_Create( void* ext,
+ PFace face )
+ {
+ TT_EBLC* eblc = (TT_EBLC*)ext;
+
+
+ /* by convention */
+ if ( !eblc )
+ return TT_Err_Ok;
+
+ return Load_TrueType_Eblc( face, eblc );
+ }
+
+
+ static TT_Error EBLC_Destroy( void* ext,
+ PFace face )
+ {
+ TT_EBLC* eblc = (TT_EBLC*)ext;
+
+
+ (void)face;
+
+ if ( eblc )
+ Free_TrueType_Eblc( eblc );
+
+ return TT_Err_Ok;
+ }
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Init_SBit_Extension */
+ /* */
+ /* <Description> */
+ /* Initialize the embedded bitmaps extension for the */
+ /* FreeType engine. */
+ /* */
+ /* <Input> */
+ /* engine :: handle to current FreeType library instance */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_SBit_Extension( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+ TT_Error error;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ error = TT_Register_Extension( _engine,
+ SBIT_ID,
+ sizeof ( TT_EBLC ),
+ EBLC_Create,
+ EBLC_Destroy );
+
+ return error;
+ }
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Get_Face_Bitmaps */
+ /* */
+ /* <Description> */
+ /* Loads the `EBLC' table from a font file, if any. */
+ /* */
+ /* <Input> */
+ /* face :: handle to the source TrueType font/face */
+ /* */
+ /* <Output> */
+ /* eblc_table :: a descriptor for the EBLC table */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* This function returns TT_Err_Table_Missing if the */
+ /* font contains no embedded bitmaps. All fields in */
+ /* `eblc_table' will then be set to 0. */
+ /* */
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Face_Bitmaps( TT_Face face,
+ TT_EBLC* eblc_table )
+ {
+ PFace faze = HANDLE_Face( face );
+ TT_EBLC* eblc;
+ TT_Error error;
+
+
+ error = TT_Extension_Get( faze, SBIT_ID, (void**)&eblc );
+ if ( !error )
+ {
+ if ( eblc->version )
+ {
+ *eblc_table = *eblc;
+ return TT_Err_Ok;
+ }
+ error = TT_Err_Table_Missing;
+ }
+
+ eblc_table->version = 0;
+ eblc_table->num_strikes = 0;
+ eblc_table->strikes = 0;
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * <Function> TT_Get_SBit_Strike
+ *
+ * <Description>
+ * Loads suitable strike (bitmap sizetable) for given instance.
+ * This strike includes sbitLineMetrics.
+ *
+ * <Input>
+ * face :: the source face
+ * instance :: the current size instance
+ *
+ * <Output>
+ * strike :: the bitmap strike descriptor
+ *
+ * <Return>
+ * TrueType error code. 0 means success.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_SBit_Strike( TT_Face face,
+ TT_Instance instance,
+ TT_SBit_Strike* strike )
+ {
+ TT_Error error;
+ PFace faze = HANDLE_Face( face );
+ PInstance ins = HANDLE_Instance( instance );
+
+ TT_EBLC* eblc;
+ TT_Int x_ppem, y_ppem;
+
+
+ if ( !strike || !ins || ins->owner != faze )
+ return TT_Err_Invalid_Argument;
+
+ error = TT_Extension_Get( faze, SBIT_ID, (void**)&eblc );
+ if ( error )
+ goto Exit;
+
+ /********************************************************************/
+ /* */
+ /* Look for an sbit strike that matches the current x and y ppms */
+ /* */
+ {
+ UShort count = eblc->num_strikes;
+ TT_SBit_Strike* cur = eblc->strikes;
+
+
+ x_ppem = ins->metrics.x_ppem;
+ y_ppem = ins->metrics.y_ppem;
+
+ MEM_Set( strike, 0, sizeof ( TT_SBit_Strike ) );
+
+ for ( ; count > 0; count--, cur++ )
+ if ( cur->x_ppem == x_ppem &&
+ cur->y_ppem == y_ppem )
+ {
+ *strike = *cur;
+ break;
+ }
+
+ /* return immediately if we didn't find an appropriate strike */
+ if ( !strike->num_ranges )
+ error = TT_Err_Invalid_PPem;
+ }
+
+ Exit:
+ return error;
+ }
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Load_Glyph_Bitmap */
+ /* */
+ /* <Description> */
+ /* Loads a given glyph embedded bitmap. */
+ /* */
+ /* <Input> */
+ /* face :: handle to the source TrueType font/face */
+ /* instance :: current size/transform instance */
+ /* glyph_index :: index of source glyph */
+ /* bitmap :: target embedded bitmap descriptor */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* This function returns an error if there is no */
+ /* embedded bitmap for the glyph at the given */
+ /* instance. */
+ /* */
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_Glyph_Bitmap( TT_Face face,
+ TT_Instance instance,
+ TT_UShort glyph_index,
+ TT_SBit_Image* image )
+ {
+ TT_Stream stream;
+ TT_Error error;
+
+ PFace faze = HANDLE_Face( face );
+ PInstance ins = HANDLE_Instance( instance );
+
+ TT_SBit_Strike strike;
+
+
+ if ( ins->owner != faze )
+ {
+ error = TT_Err_Invalid_Argument;
+ goto Fail;
+ }
+
+ /********************************************************************/
+ /* */
+ /* Look for an sbit strike that matches the current x and y ppms */
+ /* */
+ error = TT_Get_SBit_Strike( face, instance, &strike );
+ if ( error )
+ goto Fail;
+
+ /* return immediately if the glyph index isn't in the strike extent */
+ if ( glyph_index < strike.start_glyph ||
+ glyph_index > strike.end_glyph )
+ {
+ error = TT_Err_Invalid_Glyph_Index;
+ goto Fail;
+ }
+
+ {
+ image->bit_depth = 1;
+
+ if ( !USE_Stream( faze->stream, stream ) )
+ {
+ error = Load_TrueType_Ebdt( faze, strike, glyph_index, image );
+
+ DONE_Stream( stream );
+
+ /* exit successfully if we can */
+ if ( !error )
+ {
+ image->map.flow = TT_Flow_Down;
+
+ Crop_Bitmap( image );
+
+ /* correct sbit metrics */
+ {
+ TT_Big_Glyph_Metrics* metrics = &image->metrics;
+
+
+ metrics->bbox.xMin *= 64;
+ metrics->bbox.xMax *= 64;
+
+ metrics->bbox.yMax *= 64;
+ metrics->bbox.yMin *= 64;
+
+ metrics->horiBearingX *= 64;
+ metrics->horiBearingY *= 64;
+ metrics->horiAdvance *= 64;
+
+ metrics->vertBearingX *= 64;
+ metrics->vertBearingY *= 64;
+ metrics->vertAdvance *= 64;
+ }
+
+ goto Exit;
+ }
+ }
+ }
+
+ Fail:
+ image->map.width = 0;
+ image->map.rows = 0;
+ image->map.cols = 0;
+ image->map.size = 0;
+ image->map.bitmap = 0;
+ image->map.flow = 0;
+ image->bit_depth = 0;
+
+ Exit:
+ return error;
+ }
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_New_SBit_Image */
+ /* */
+ /* <Description> */
+ /* Allocates a new embedded bitmap container. */
+ /* */
+ /* <Output> */
+ /* image :: sbit image */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ FT_EXPORT_FUNC( TT_Error )
+ TT_New_SBit_Image( TT_SBit_Image** image )
+ {
+ return MEM_Alloc( *image, sizeof ( **image ) );
+ }
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Done_SBit_Image */
+ /* */
+ /* <Description> */
+ /* Releases an embedded bitmap container. */
+ /* */
+ /* <Input> */
+ /* image :: sbit image */
+ /* */
+ FT_EXPORT_FUNC( void )
+ TT_Done_SBit_Image( TT_SBit_Image* image )
+ {
+ FREE( image->map.bitmap );
+ FREE( image );
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxsbit.h b/Build/source/libs/freetype/lib/extend/ftxsbit.h
new file mode 100644
index 00000000000..1df6280b54a
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxsbit.h
@@ -0,0 +1,490 @@
+/*******************************************************************
+ *
+ * ftxsbit.h
+ *
+ * embedded bitmap support API extension
+ *
+ * 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 extension is used to load the embedded bitmaps present
+ * in certain TrueType files.
+ *
+ ******************************************************************/
+
+#ifndef FTXSBIT_H
+#define FTXSBIT_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Metrics */
+ /* */
+ /* <Description> */
+ /* A structure used to hold the big metrics of a given */
+ /* glyph bitmap in a TrueType or OpenType font. These */
+ /* are usually found in the `EBDT' table. */
+ /* */
+ /* <Fields> */
+ /* height :: glyph height in pixels */
+ /* width :: glyph width in pixels */
+ /* */
+ /* horiBearingX :: horizontal left bearing */
+ /* horiBearingY :: horizontal top bearing */
+ /* horiAdvance :: horizontal advance */
+ /* */
+ /* vertBearingX :: vertical left bearing */
+ /* vertBearingY :: vertical top bearing */
+ /* vertAdvance :: vertical advance */
+ /* */
+ typedef struct TT_SBit_Metrics_
+ {
+ TT_Byte height;
+ TT_Byte width;
+
+ TT_Char horiBearingX;
+ TT_Char horiBearingY;
+ TT_Byte horiAdvance;
+
+ TT_Char vertBearingX;
+ TT_Char vertBearingY;
+ TT_Byte vertAdvance;
+
+ } TT_SBit_Metrics;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Small_Metrics */
+ /* */
+ /* <Description> */
+ /* A structure used to hold the small metrics of a given */
+ /* glyph bitmap in a TrueType or OpenType font. These */
+ /* are usually found in the `EBDT' table. */
+ /* */
+ /* <Fields> */
+ /* height :: glyph height in pixels */
+ /* width :: glyph width in pixels */
+ /* */
+ /* bearingX :: left-side bearing */
+ /* bearingY :: top-side bearing */
+ /* advance :: advance width or height */
+ /* */
+ typedef struct TT_SBit_Small_Metrics_
+ {
+ TT_Byte height;
+ TT_Byte width;
+
+ TT_Char bearingX;
+ TT_Char bearingY;
+ TT_Byte advance;
+
+ } TT_SBit_Small_Metrics;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Line_Metrics */
+ /* */
+ /* <Description> */
+ /* A structure used to describe the text line metrics of */
+ /* a given bitmap strike, for either horizontal or */
+ /* vertical layout. */
+ /* */
+ /* <Fields> */
+ /* ascender :: ascender in pixels */
+ /* descender :: descender in pixels */
+ /* max_width :: maximum glyph width in pixels */
+ /* */
+ /* caret_slope_enumerator :: Rise of the caret slope, */
+ /* typically set to 1 for non-italic fonts. */
+ /* caret_slope_denominator :: Rise of the caret slope, */
+ /* typically set to 0 for non-italic fonts. */
+ /* caret_offset :: Offset in pixels */
+ /* to move the caret for proper positioning. */
+ /* */
+ /* min_origin_SB :: Minimum of horiBearingX */
+ /* (resp. vertBearingY) */
+ /* min_advance_SB :: Minimum of */
+ /* (hori. advance - ( horiBearingX + width )) */
+ /* (resp. vert. advance - ( vertBearingY + height )) */
+ /* max_before_BL :: Maximum of horiBearingY */
+ /* (resp. Maximum of vertBearingY) */
+ /* min_after_BL :: Minimum of ( horiBearingY - height ) */
+ /* (resp. vertBearingX - width ) */
+ /* */
+ typedef struct TT_SBit_Line_Metrics_
+ {
+ TT_Char ascender;
+ TT_Char descender;
+ TT_Byte max_width;
+ TT_Char caret_slope_numerator;
+ TT_Char caret_slope_denominator;
+ TT_Char caret_offset;
+ TT_Char min_origin_SB;
+ TT_Char min_advance_SB;
+ TT_Char max_before_BL;
+ TT_Char min_after_BL;
+ TT_Char pads[2];
+
+ } TT_SBit_Line_Metrics;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Range */
+ /* */
+ /* <Description> */
+ /* A TrueType/OpenType subIndexTable as defined in the */
+ /* `EBLC' or `bloc' tables. */
+ /* */
+ /* <Fields> */
+ /* */
+ /* first_glyph :: first glyph index in range */
+ /* last_glyph :: last glyph index in range */
+ /* */
+ /* index_format :: format of index table. valid */
+ /* values are 1 to 5. */
+ /* */
+ /* image_format :: format of `EBDT' image data */
+ /* image_offset :: offset to image data in `EBDT' */
+ /* */
+ /* image_size :: for index formats 2 and 5. This is */
+ /* the size in bytes of each glyph bitmap */
+ /* glyph bitmap */
+ /* */
+ /* big_metrics :: for index formats 2 and 5. This is */
+ /* the big metrics for each glyph bitmap */
+ /* */
+ /* num_glyphs :: for index formats 4 and 5. This is */
+ /* the number of glyphs in the code */
+ /* array. */
+ /* */
+ /* glyph_offsets :: for index formats 1 and 3. */
+ /* glyph_codes :: for index formats 4 and 5. */
+ /* */
+ /* table_offset :: offset of index table in `EBLC' table */
+ /* -- only used during strike loading. */
+ /* */
+ typedef struct TT_SBit_Range
+ {
+ TT_UShort first_glyph;
+ TT_UShort last_glyph;
+
+ TT_UShort index_format;
+ TT_UShort image_format;
+ TT_ULong image_offset;
+
+ TT_ULong image_size;
+ TT_SBit_Metrics metrics;
+ TT_ULong num_glyphs;
+
+ TT_ULong* glyph_offsets;
+ TT_UShort* glyph_codes;
+
+ TT_ULong table_offset;
+
+ } TT_SBit_Range;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Strike */
+ /* */
+ /* <Description> */
+ /* A structure used describe a given bitmap strike in the */
+ /* `EBLC' or `bloc' tables. */
+ /* */
+ /* <Fields> */
+ /* */
+ /* num_index_ranges :: number of index ranges */
+ /* index_ranges :: array of glyph index ranges */
+ /* */
+ /* color_ref :: unused. color reference? */
+ /* hori :: line metrics for horizontal layouts. */
+ /* vert :: line metrics for vertical layouts. */
+ /* */
+ /* start_glyph :: lowest glyph index for this strike. */
+ /* end_glyph :: higher glyph index for this strike. */
+ /* */
+ /* x_ppem :: horizontal pixels per EM */
+ /* y_ppem :: vertical pixels per EM */
+ /* bit_depth :: bit depth. valid values are 1, 2, 4 & 8 */
+ /* flags :: vertical or horizontal? */
+ /* */
+ typedef struct TT_SBit_Strike_
+ {
+ TT_Int num_ranges;
+ TT_SBit_Range* sbit_ranges;
+ TT_ULong ranges_offset;
+
+ TT_ULong color_ref;
+
+ TT_SBit_Line_Metrics hori;
+ TT_SBit_Line_Metrics vert;
+
+ TT_UShort start_glyph;
+ TT_UShort end_glyph;
+
+ TT_Byte x_ppem;
+ TT_Byte y_ppem;
+ TT_Byte bit_depth;
+ TT_Char flags;
+
+ } TT_SBit_Strike;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Component */
+ /* */
+ /* <Description> */
+ /* A simple structure to describe a compound sbit element */
+ /* */
+ /* <Fields> */
+ /* glyph_code :: element's glyph index */
+ /* x_offset :: element's left bearing */
+ /* y_offset :: element's top bearing */
+ /* */
+ typedef struct TT_SBit_Component_
+ {
+ TT_UShort glyph_code;
+ TT_Char x_offset;
+ TT_Char y_offset;
+
+ } TT_SBit_Component;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Scale */
+ /* */
+ /* <Description> */
+ /* A structure used describe a given bitmap scaling */
+ /* table, as defined for the `EBSC' table. */
+ /* */
+ /* <Fields> */
+ /* hori :: horizontal line metrics */
+ /* vert :: vertical line metrics */
+ /* */
+ /* x_ppem :: horizontal pixels per EM */
+ /* y_ppem :: vertical pixels per EM */
+ /* */
+ /* x_ppem_substitute :: substitution x_ppem */
+ /* y_ppem_substitute :: substitution y_ppem */
+ /* */
+ typedef struct TT_SBit_Scale_
+ {
+ TT_SBit_Line_Metrics hori;
+ TT_SBit_Line_Metrics vert;
+
+ TT_Byte x_ppem;
+ TT_Byte y_ppem;
+
+ TT_Byte x_ppem_substitute;
+ TT_Byte y_ppem_substitute;
+
+ } TT_SBit_Scale;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_SBit_Image */
+ /* */
+ /* <Description> */
+ /* A structure used to describe a given embedded bitmap */
+ /* image. */
+ /* */
+ /* <Fields> */
+ /* map :: bitmap descriptor */
+ /* bit_depth :: pixel bit depth */
+ /* metrics :: glyph metrics for the bitmap */
+ /* */
+ typedef struct TT_SBit_Image_
+ {
+ TT_Raster_Map map;
+ int bit_depth;
+ TT_Big_Glyph_Metrics metrics;
+
+ } TT_SBit_Image;
+
+
+ /*************************************************************/
+ /* */
+ /* <Struct> TT_EBLC */
+ /* */
+ /* <Description> */
+ /* A structure used to describe the `EBLC' table from */
+ /* a TrueType font. */
+ /* */
+ /* <Fields> */
+ /* version :: version number of the EBLC table */
+ /* */
+ /* num_strikes :: the number of strikes, i.e. bitmap */
+ /* sizes, present in this font */
+ /* */
+ /* strikes :: array of strikes */
+ /* */
+ typedef struct TT_EBLC_
+ {
+ TT_ULong version;
+ TT_ULong num_strikes;
+ TT_SBit_Strike* strikes;
+
+ } TT_EBLC;
+
+
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Init_SBit_Extension */
+ /* */
+ /* <Description> */
+ /* Initializes the embedded bitmap extension for the */
+ /* FreeType engine. */
+ /* */
+ /* <Input> */
+ /* engine :: handle to current FreeType library instance */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_SBit_Extension( TT_Engine engine );
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Get_Face_Bitmaps */
+ /* */
+ /* <Description> */
+ /* Loads the `EBLC' table from a font file, if any. */
+ /* */
+ /* <Input> */
+ /* face :: handle to the source TrueType font/face */
+ /* */
+ /* <Output> */
+ /* eblc_table :: a descriptor for the EBLC table */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* This function returns TT_Err_Table_Missing if the */
+ /* font contains no embedded bitmaps. All fields in */
+ /* `eblc_table' will then be set to 0. */
+ /* */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Face_Bitmaps( TT_Face face,
+ TT_EBLC* eblc_table );
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_New_SBit_Image */
+ /* */
+ /* <Description> */
+ /* Allocates a new embedded bitmap container. */
+ /* */
+ /* <Output> */
+ /* image :: sbit image */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ FT_EXPORT_DEF( TT_Error )
+ TT_New_SBit_Image( TT_SBit_Image** image );
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Done_SBit_Image */
+ /* */
+ /* <Description> */
+ /* Releases an embedded bitmap container. */
+ /* */
+ /* <Input> */
+ /* image :: sbit image */
+ /* */
+ FT_EXPORT_DEF( void )
+ TT_Done_SBit_Image( TT_SBit_Image* image );
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> TT_Get_SBit_Strike */
+ /* */
+ /* <Description> */
+ /* Loads a suitable strike (bitmap sizetable) for the */
+ /* given instance. This strike includes */
+ /* sbitLineMetrics. */
+ /* */
+ /* <Input> */
+ /* face :: the source face */
+ /* instance :: the current size instance */
+ /* */
+ /* <Output> */
+ /* strike :: the bitmap strike descriptor */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_SBit_Strike( TT_Face face,
+ TT_Instance instance,
+ TT_SBit_Strike* strike );
+
+
+ /*************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Load_Glyph_Bitmap */
+ /* */
+ /* <Description> */
+ /* Loads a given glyph embedded bitmap. */
+ /* */
+ /* <Input> */
+ /* face :: handle to the source TrueType font/face */
+ /* instance :: current size/transform instance */
+ /* glyph_index :: index of source glyph */
+ /* bitmap :: target embedded bitmap descriptor */
+ /* */
+ /* <Return> */
+ /* Error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* This function returns an error if there is no */
+ /* embedded bitmap for the glyph at the given */
+ /* instance. */
+ /* */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_Glyph_Bitmap( TT_Face face,
+ TT_Instance instance,
+ TT_UShort glyph_index,
+ TT_SBit_Image* bitmap );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXSBIT_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxwidth.c b/Build/source/libs/freetype/lib/extend/ftxwidth.c
new file mode 100644
index 00000000000..f7879ed36a1
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxwidth.c
@@ -0,0 +1,185 @@
+/*******************************************************************
+ *
+ * ftxwidth.c 1.0
+ *
+ * Glyph Widths (and Heights) fast retrieval extension
+ *
+ * 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 extension is used to parse the "glyf" table of a TrueType
+ * file in order to extract the bbox of a given range of glyphs.
+ *
+ * The bbox is then used to build font unit widths and height
+ * that are returned in two parallel arrays.
+ *
+ * This extension is needed by the FreeType/2 OS/2 Font Driver.
+ *
+ ******************************************************************/
+
+
+#include "ftxwidth.h"
+#include "ttdebug.h"
+#include "ttobjs.h"
+#include "ttfile.h"
+#include "tttags.h"
+#include "ttload.h"
+
+/* Required by the tracing mode */
+
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_any
+
+
+ /******************************************************************/
+ /* */
+ /* Function: TT_Get_Face_Widths */
+ /* */
+ /* Description: Returns the widths and/or heights of a given */
+ /* range of glyphs for a face. */
+ /* */
+ /* Input: */
+ /* face :: face handle */
+ /* */
+ /* first_glyph :: first glyph in range */
+ /* */
+ /* last_glyph :: last glyph in range */
+ /* */
+ /* widths :: address of table receiving the widths */
+ /* expressed in font units (ushorts). Set */
+ /* this parameter to NULL if you're not */
+ /* interested by these values. */
+ /* */
+ /* heights :: address of table receiving the heights */
+ /* expressed in font units (ushorts). Set */
+ /* this parameter to NULL if you're not */
+ /* interested by these values. */
+ /* */
+ /* Returns: */
+ /* Error code */
+ /* */
+ /* */
+ /******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Face_Widths( TT_Face face,
+ TT_UShort first_glyph,
+ TT_UShort last_glyph,
+ TT_UShort* widths,
+ TT_UShort* heights )
+ {
+ DEFINE_ALL_LOCALS;
+
+ PFace faze = HANDLE_Face(face);
+ UShort n;
+ Long table;
+
+ ULong glyf_offset; /* offset of glyph table in file */
+ UShort zero_width = 0; /* width of glyph 0 */
+ UShort zero_height = 0; /* height of glyph 0 */
+
+ Bool zero_loaded = 0;
+
+#ifndef TT_HUGE_PTR
+ PStorage locations;
+#else
+ Storage TT_HUGE_PTR * locations;
+#endif
+ TT_BBox bbox;
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( last_glyph >= faze->numGlyphs ||
+ first_glyph > last_glyph )
+ return TT_Err_Invalid_Argument;
+
+ /* find "glyf" table */
+ table = TT_LookUp_Table( faze, TTAG_glyf );
+ if ( table < 0 )
+ {
+ PERROR(( "ERROR: there is no glyph table in this font file!\n" ));
+ return TT_Err_Glyf_Table_Missing;
+ }
+ glyf_offset = faze->dirTables[table].Offset;
+
+ /* now access stream */
+ if ( USE_Stream( faze->stream, stream ) )
+ return error;
+
+ locations = faze->glyphLocations + first_glyph;
+
+ /* loop to load each glyph in the range */
+ for ( n = first_glyph; n <= last_glyph; n++ )
+ {
+ if ( n + 1 < faze->numGlyphs &&
+ locations[0] == locations[1] )
+ {
+ /* Note : Glyph 0 is always used to indicate a missing glyph */
+ /* in a range. We must thus return its width and height */
+ /* where appropriate when we find an undefined glyph. */
+ if ( zero_loaded == 0 )
+ {
+ if ( FILE_Seek( glyf_offset + faze->glyphLocations[0] ) ||
+ ACCESS_Frame( 10L ) )
+ goto Fail;
+
+ (void)GET_Short(); /* skip number of contours */
+
+ bbox.xMin = GET_Short();
+ bbox.yMin = GET_Short();
+ bbox.xMax = GET_Short();
+ bbox.yMax = GET_Short();
+
+ FORGET_Frame();
+
+ zero_width = (UShort)(bbox.xMax - bbox.xMin);
+ zero_height = (UShort)(bbox.yMax - bbox.yMin);
+ zero_loaded = 1;
+ }
+
+ if ( widths )
+ *widths++ = zero_width;
+
+ if ( heights )
+ *heights++ = zero_height;
+ }
+ else
+ {
+ /* normal glyph, read header */
+ if ( FILE_Seek( glyf_offset + locations[0] ) ||
+ ACCESS_Frame( 10L ) )
+ goto Fail;
+
+ (void)GET_Short(); /* skip number of contours */
+
+ bbox.xMin = GET_Short();
+ bbox.yMin = GET_Short();
+ bbox.xMax = GET_Short();
+ bbox.yMax = GET_Short();
+
+ FORGET_Frame();
+
+ if ( widths )
+ *widths++ = (UShort)(bbox.xMax - bbox.xMin);
+
+ if ( heights )
+ *heights++ = (UShort)(bbox.yMax - bbox.yMin);
+ }
+ }
+
+ Fail:
+ DONE_Stream( stream );
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/ftxwidth.h b/Build/source/libs/freetype/lib/extend/ftxwidth.h
new file mode 100644
index 00000000000..c7ebc3acb81
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/ftxwidth.h
@@ -0,0 +1,80 @@
+/*******************************************************************
+ *
+ * ftxwidth.h
+ *
+ * Glyph Widths (and Heights) fast retrieval extension.
+ *
+ * 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 extension is used to parse the `glyf' table of a TrueType
+ * file in order to extract the bounding box of a given range of glyphs.
+ *
+ * The bounding box is then used to build font unit widths and heights
+ * that are returned in two parallel arrays.
+ *
+ * This extension is needed by the FreeType/2 OS/2 Font Driver.
+ *
+ ******************************************************************/
+
+#ifndef FTXWIDTH_H
+#define FTXWIDTH_H
+
+#include "freetype.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /******************************************************************/
+ /* */
+ /* Function: TT_Get_Face_Widths */
+ /* */
+ /* Description: Returns the widths and/or heights of a given */
+ /* range of glyphs for a face. */
+ /* */
+ /* Input: */
+ /* face :: face handle */
+ /* */
+ /* first_glyph :: first glyph in range */
+ /* */
+ /* last_glyph :: last glyph in range */
+ /* */
+ /* widths :: address of table receiving the widths */
+ /* expressed in font units (ushorts). Set */
+ /* this parameter to NULL if you're not */
+ /* interested by these values. */
+ /* */
+ /* heights :: address of table receiving the heights */
+ /* expressed in font units (ushorts). Set */
+ /* this parameter to NULL if you're not */
+ /* interested by these values */
+ /* */
+ /* Returns: */
+ /* Error code */
+ /* */
+ /* */
+ /******************************************************************/
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Face_Widths( TT_Face face,
+ TT_UShort first_glyph,
+ TT_UShort last_glyph,
+ TT_UShort* widths,
+ TT_UShort* heights );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FTXWIDTH_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/extend/readme.1st b/Build/source/libs/freetype/lib/extend/readme.1st
new file mode 100644
index 00000000000..cce94cdfad1
--- /dev/null
+++ b/Build/source/libs/freetype/lib/extend/readme.1st
@@ -0,0 +1,61 @@
+This directory contains several extensions to the core engine.
+
+An extension is a separately compilable unit which can be linked by
+a client application to add new functionalities to the engine.
+
+There are two kinds of extensions: an `API extension' provides
+clients with new APIs to access internal engine structures or data,
+while an `engine extension' implements new TrueType data or table
+management.
+
+This directory contains the following:
+
+ ftxcmap: An API extension to iterate over cmaps.
+
+ ftxgasp: A simple API extension which returns the TrueType `gasp'
+ table to client applications, when found in a font file.
+ Though this table is always loaded by the engine, there
+ is no function in the core API to access it. The reason
+ is simple: to demonstrate a simple API extension with
+ `ftxgasp'!
+
+ ftxkern: This engine extension is used to access kerning data,
+ when available in a font file. Note that it implements
+ on-the-fly loading and retrieving of kerning tables.
+ However, it doesn't interpret or process the data, and
+ client applications should use it according to the
+ TrueType specification.
+
+ ftxpost: An engine extension to load the PostScript glyph names
+ of the `post' table. See the `ftzoom' program for an
+ example how to use it.
+
+ ftxwidth: A simple extension used to load the widths and heights
+ of a given range of glyphs in a face. Results are
+ expressed in unscaled font units. This is required by
+ the latest version of the FreeType/2 DLL to speed up
+ font loading in the GRE (the OS/2 GRaphics Engine). It
+ can be used by other applications though...
+
+ ftxerr18: This extension simply converts a TrueType engine error
+ code into a corresponding string describing the error.
+ It is useful if you intend to write a package for end
+ users and want to give them not `Error code 135' but
+ `OS/2 table missing'. See docs/errstr.txt for a
+ description how to use it (really simple!). ftxerr18
+ supports localization of error strings (that is: error
+ strings are automatically translated into supported
+ languages) using gettext(). See docs/i18n.txt about
+ using gettext.
+
+ ftxsbit: Embedded bitmap support. This is an engine extension.
+ See e.g. the `ftstrtto' program for its usage.
+
+ ftxopen,
+ ftxgsub,
+ ftxgpos,
+ ftxgdef: This is experimental stuff for TrueType Open support!
+ Please ignore it or help debugging :-)
+
+
+--- END ---
diff --git a/Build/source/libs/freetype/lib/freetype.h b/Build/source/libs/freetype/lib/freetype.h
new file mode 100644
index 00000000000..ad6e434893c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/freetype.h
@@ -0,0 +1,1184 @@
+/*******************************************************************
+ *
+ * freetype.h
+ *
+ * High-level interface specification.
+ *
+ * Copyright 1996-2001, 2002 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.
+ *
+ * Note:
+ *
+ * This is the only file that should be included by client
+ * application sources. All other types and functions defined
+ * in the `tt*.h' files are library internals and should not be
+ * included.
+ *
+ ******************************************************************/
+
+#ifndef FREETYPE_H
+#define FREETYPE_H
+
+
+#define TT_FREETYPE_MAJOR 1
+#define TT_FREETYPE_MINOR 5
+
+
+#include "fterrid.h"
+#include "ftnameid.h"
+
+#if defined(WIN32)
+#ifdef FREETYPE_DLL
+#ifdef MAKE_FREETYPE_DLL
+#define FREETYPEDLL __declspec( dllexport)
+#else
+#define FREETYPEDLL __declspec( dllimport)
+#endif
+#else
+#define FREETYPEDLL
+#endif
+#else /* ! WIN32 */
+#define FREETYPEDLL
+#endif
+
+/*************************************************************************/
+/* Define FT_EXPORT_DEF as needed to use e.g. a DLL. */
+/* All variables and functions visible from outside have these prefixes. */
+/* */
+/* To make freetype.h independent from configuration files we check */
+/* whether FT_EXPORT_DEF has been defined already. */
+
+/* Backward compatibility only. Don't use for new code. */
+#ifdef EXPORT_DEF
+#define FT_EXPORT_DEF( type ) EXPORT_DEF type
+#endif
+/* End of backward compatibility section. */
+
+#ifndef FT_EXPORT_DEF
+#define FT_EXPORT_DEF( type ) extern type
+#endif
+
+/* This is for variables; default is using the same as functions. */
+#ifndef FT_EXPORT_DECL
+#define FT_EXPORT_DECL( type ) FT_EXPORT_DEF( type )
+#endif
+
+/* The same for TT_Text. If you define the HAVE_TT_TEXT macro, you have */
+/* to provide a typedef declaration for TT_Text before including this */
+/* file. */
+
+#ifndef HAVE_TT_TEXT
+#define HAVE_TT_TEXT
+ typedef char TT_Text; /* The data type to represent */
+ /* file name string elements. */
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+ /*******************************************************************/
+ /* */
+ /* FreeType types definitions. */
+ /* */
+ /* All these begin with a 'TT_' prefix. */
+ /* */
+ /*******************************************************************/
+
+ typedef int TT_Bool;
+
+ typedef signed long TT_Fixed; /* signed fixed 16.16 float */
+
+ typedef signed short TT_FWord; /* distance in FUnits */
+ typedef unsigned short TT_UFWord; /* unsigned distance */
+
+ typedef char TT_String;
+ typedef signed char TT_Char;
+ typedef unsigned char TT_Byte;
+ typedef signed short TT_Short;
+ typedef unsigned short TT_UShort;
+ typedef int TT_Int;
+ typedef unsigned int TT_UInt;
+ typedef signed long TT_Long;
+ typedef unsigned long TT_ULong;
+
+ typedef signed short TT_F2Dot14; /* Signed fixed float 2.14 used for */
+ /* unit vectors, with layout */
+ /* */
+ /* s : 1 -- sign bit */
+ /* m : 1 -- integer bit */
+ /* f : 14 -- unsigned fractional */
+ /* */
+ /* `s:m' is the 2-bit signed int */
+ /* value to which the positive */
+ /* fractional part should be added. */
+
+ typedef signed long TT_F26Dot6; /* 26.6 fixed float, used for */
+ /* glyph points pixel coordinates. */
+
+ typedef signed long TT_Pos; /* Point position, expressed either */
+ /* in fractional pixels or notional */
+ /* units, depending on context. */
+ /* For example, glyph coordinates */
+ /* returned by TT_Load_Glyph() are */
+ /* expressed in font units if */
+ /* scaling wasn't requested, and */
+ /* in 26.6 fractional pixels if it */
+ /* was. */
+
+
+ struct TT_UnitVector_ /* guess what... */
+ {
+ TT_F2Dot14 x;
+ TT_F2Dot14 y;
+ };
+
+ typedef struct TT_UnitVector_ TT_UnitVector;
+
+
+ struct TT_Vector_ /* simple vector type */
+ {
+ TT_F26Dot6 x;
+ TT_F26Dot6 y;
+ };
+
+ typedef struct TT_Vector_ TT_Vector;
+
+
+ /* A simple 2x2 matrix used for transformations. */
+ /* You should use 16.16 fixed floats. */
+ /* */
+ /* x' = xx*x + xy*y */
+ /* y' = yx*x + yy*y */
+ /* */
+
+ struct TT_Matrix_
+ {
+ TT_Fixed xx, xy;
+ TT_Fixed yx, yy;
+ };
+
+ typedef struct TT_Matrix_ TT_Matrix;
+
+
+ /* A structure used to describe the source glyph to the renderer. */
+
+ struct TT_Outline_
+ {
+ TT_Short n_contours; /* number of contours in glyph */
+ TT_UShort n_points; /* number of points in the glyph */
+
+ TT_Vector* points; /* the outline's points */
+ TT_Byte* flags; /* the points flags */
+ TT_UShort* contours; /* the contour end points */
+
+ /* The following flag indicates that the outline owns the arrays it */
+ /* refers to. Typically, this is true of outlines created from the */
+ /* TT_New_Outline() API, while it isn't for those returned by */
+ /* TT_Get_Glyph_Outline(). */
+
+ TT_Bool owner; /* The outline owns the coordinates, */
+ /* flags and contours array it uses. */
+
+ /* The following flags are set automatically by */
+ /* TT_Get_Glyph_Outline(). Their meaning is the following: */
+ /* */
+ /* high_precision If true, the scan-line converter will use a */
+ /* higher precision to render bitmaps (i.e., a */
+ /* 1/1024 pixel precision). This is important for */
+ /* small ppem sizes. */
+ /* */
+ /* second_pass If true, the scan-line converter performs a */
+ /* second sweep phase dedicated to find vertical */
+ /* drop-outs. If false, only horizontal drop-outs */
+ /* will be checked during the first vertical */
+ /* sweep (yes, this is a bit confusing but it is */
+ /* really the way it should work). This is */
+ /* important for small ppems too. */
+ /* */
+ /* dropout_mode Specifies the TrueType drop-out mode to use for */
+ /* continuity checking. Valid values are 0 (no */
+ /* check), 1, 2, 4, and 5. */
+ /* */
+ /* Most of the engine's users will safely ignore these fields... */
+
+ TT_Bool high_precision; /* high precision rendering */
+ TT_Bool second_pass; /* two sweeps rendering */
+ TT_Char dropout_mode; /* dropout mode */
+ };
+
+ typedef struct TT_Outline_ TT_Outline;
+
+
+ /* A structure used to describe a simple bounding box. */
+
+ struct TT_BBox_
+ {
+ TT_Pos xMin;
+ TT_Pos yMin;
+ TT_Pos xMax;
+ TT_Pos yMax;
+ };
+
+ typedef struct TT_BBox_ TT_BBox;
+
+
+ /* A structure used to return glyph metrics. */
+ /* */
+ /* The `bearingX' isn't called `left-side bearing' anymore because */
+ /* it has different meanings depending on the glyph's orientation. */
+ /* */
+ /* The same is true for `bearingY', which is the top-side bearing */
+ /* defined by the TT_Spec, i.e., the distance from the baseline to */
+ /* the top of the glyph's bbox. According to our current convention, */
+ /* this is always the same as `bbox.yMax' but we make it appear for */
+ /* consistency in its proper field. */
+ /* */
+ /* The `advance' field is the advance width for horizontal layout, */
+ /* and advance height for vertical layouts. */
+
+ struct TT_Glyph_Metrics_
+ {
+ TT_BBox bbox; /* glyph bounding box */
+
+ TT_Pos bearingX; /* left-side bearing */
+ TT_Pos bearingY; /* top-side bearing, per se the TT spec */
+
+ TT_Pos advance; /* advance width (or height) */
+ };
+
+ typedef struct TT_Glyph_Metrics_ TT_Glyph_Metrics;
+
+
+ /* A structure used to return horizontal _and_ vertical glyph */
+ /* metrics. */
+ /* */
+ /* A glyph can be used either in a horizontal or vertical layout. */
+ /* Its glyph metrics vary with orientation. The TT_Big_Glyph_Metrics */
+ /* structure is used to return _all_ metrics in one call. */
+
+ struct TT_Big_Glyph_Metrics_
+ {
+ TT_BBox bbox; /* glyph bounding box */
+
+ TT_Pos horiBearingX; /* left side bearing in horizontal layouts */
+ TT_Pos horiBearingY; /* top side bearing in horizontal layouts */
+
+ TT_Pos vertBearingX; /* left side bearing in vertical layouts */
+ TT_Pos vertBearingY; /* top side bearing in vertical layouts */
+
+ TT_Pos horiAdvance; /* advance width for horizontal layout */
+ TT_Pos vertAdvance; /* advance height for vertical layout */
+
+ /* The following fields represent unhinted scaled metrics values. */
+ /* They can be useful for applications needing to do some device */
+ /* independent placement of glyphs. */
+ /* */
+ /* Applying these metrics to hinted glyphs will most surely ruin */
+ /* the grid fitting performed by the bytecode interpreter. These */
+ /* values are better used to compute accumulated positioning */
+ /* distances. */
+
+ TT_Pos linearHoriBearingX; /* linearly scaled horizontal lsb */
+ TT_Pos linearHoriAdvance; /* linearly scaled horizontal advance */
+
+ TT_Pos linearVertBearingY; /* linearly scaled vertical tsb */
+ TT_Pos linearVertAdvance; /* linearly scaled vertical advance */
+ };
+
+ typedef struct TT_Big_Glyph_Metrics_ TT_Big_Glyph_Metrics;
+
+
+ /* A structure used to return instance metrics. */
+
+ struct TT_Instance_Metrics_
+ {
+ TT_F26Dot6 pointSize; /* char. size in points (1pt = 1/72 inch) */
+
+ TT_UShort x_ppem; /* horizontal pixels per EM square */
+ TT_UShort y_ppem; /* vertical pixels per EM square */
+
+ TT_Fixed x_scale; /* 16.16 to convert from EM units to 26.6 pix */
+ TT_Fixed y_scale; /* 16.16 to convert from EM units to 26.6 pix */
+
+ TT_UShort x_resolution; /* device horizontal resolution in dpi */
+ TT_UShort y_resolution; /* device vertical resolution in dpi */
+ };
+
+ typedef struct TT_Instance_Metrics_ TT_Instance_Metrics;
+
+
+ /* Flow constants: */
+ /* */
+ /* The flow of a bitmap refers to the way lines are oriented */
+ /* within the bitmap data, i.e., the orientation of the Y */
+ /* coordinate axis. */
+ /* */
+ /* For example, if the first bytes of the bitmap pertain to */
+ /* its top-most line, then the flow is `down'. If these bytes */
+ /* pertain to its lowest line, the the flow is `up'. */
+
+#define TT_Flow_Down -1 /* bitmap is oriented from top to bottom */
+#define TT_Flow_Up 1 /* bitmap is oriented from bottom to top */
+#define TT_Flow_Error 0 /* an error occurred during rendering */
+
+
+ /* A structure used to describe the target bitmap or pixmap to the */
+ /* renderer. Note that there is nothing in this structure that */
+ /* gives the nature of the buffer. */
+ /* */
+ /* IMPORTANT NOTE: */
+ /* */
+ /* In the case of a pixmap, the `width' and `cols' fields must */
+ /* have the _same_ values, and _must_ be padded to 32-bits, i.e., */
+ /* be a multiple of 4. Clipping problems will arise otherwise, */
+ /* if not even page faults! */
+ /* */
+ /* The typical settings are: */
+ /* */
+ /* - for a WxH bitmap: */
+ /* */
+ /* rows = H */
+ /* cols = (W+7) / 8 */
+ /* width = W */
+ /* flow = your_choice */
+ /* */
+ /* - for a WxH pixmap: */
+ /* */
+ /* rows = H */
+ /* cols = (W+3) & ~3 */
+ /* width = cols */
+ /* flow = your_choice */
+
+ struct TT_Raster_Map_
+ {
+ int rows; /* number of rows */
+ int cols; /* number of columns (bytes) per row */
+ int width; /* number of pixels per line */
+ int flow; /* bitmap orientation */
+
+ void* bitmap; /* bit/pixmap buffer */
+ long size; /* bit/pixmap size in bytes */
+ };
+
+ typedef struct TT_Raster_Map_ TT_Raster_Map;
+
+
+ /* ------ The font header TrueType table structure ------ */
+
+ struct TT_Header_
+ {
+ TT_Fixed Table_Version;
+ TT_Fixed Font_Revision;
+
+ TT_Long CheckSum_Adjust;
+ TT_Long Magic_Number;
+
+ TT_UShort Flags;
+ TT_UShort Units_Per_EM;
+
+ TT_Long Created [2];
+ TT_Long Modified[2];
+
+ TT_FWord xMin;
+ TT_FWord yMin;
+ TT_FWord xMax;
+ TT_FWord yMax;
+
+ TT_UShort Mac_Style;
+ TT_UShort Lowest_Rec_PPEM;
+
+ TT_Short Font_Direction;
+ TT_Short Index_To_Loc_Format;
+ TT_Short Glyph_Data_Format;
+ };
+
+ typedef struct TT_Header_ TT_Header;
+
+
+ /* ------ The horizontal header TrueType table structure ------ */
+
+ /*******************************************************/
+ /* This structure is the one defined by the TrueType */
+ /* specification, plus two fields used to link the */
+ /* font-units metrics to the header. */
+
+ struct TT_Horizontal_Header_
+ {
+ TT_Fixed Version;
+ TT_FWord Ascender;
+ TT_FWord Descender;
+ TT_FWord Line_Gap;
+
+ TT_UFWord advance_Width_Max; /* advance width maximum */
+
+ TT_FWord min_Left_Side_Bearing; /* minimum left-sb */
+ TT_FWord min_Right_Side_Bearing; /* minimum right-sb */
+ TT_FWord xMax_Extent; /* xmax extents */
+ TT_FWord caret_Slope_Rise;
+ TT_FWord caret_Slope_Run;
+
+ TT_Short Reserved0,
+ Reserved1,
+ Reserved2,
+ Reserved3,
+ Reserved4;
+
+ TT_Short metric_Data_Format;
+ TT_UShort number_Of_HMetrics;
+
+ /* The following fields are not defined by the TrueType specification */
+ /* but they're used to connect the metrics header to the relevant */
+ /* `HMTX' or `VMTX' table. */
+
+ void* long_metrics;
+ void* short_metrics;
+ };
+
+ typedef struct TT_Horizontal_Header_ TT_Horizontal_Header;
+
+
+ /*******************************************************/
+ /* This structure is the one defined by the TrueType */
+ /* specification. Note that it has exactly the same */
+ /* layout as the horizontal header (both are loaded */
+ /* by the same function). */
+
+ struct TT_Vertical_Header_
+ {
+ TT_Fixed Version;
+ TT_FWord Ascender;
+ TT_FWord Descender;
+ TT_FWord Line_Gap;
+
+ TT_UFWord advance_Height_Max; /* advance height maximum */
+
+ TT_FWord min_Top_Side_Bearing; /* minimum left-sb or top-sb */
+ TT_FWord min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */
+ TT_FWord yMax_Extent; /* xmax or ymax extents */
+ TT_FWord caret_Slope_Rise;
+ TT_FWord caret_Slope_Run;
+ TT_FWord caret_Offset;
+
+ TT_Short Reserved1,
+ Reserved2,
+ Reserved3,
+ Reserved4;
+
+ TT_Short metric_Data_Format;
+ TT_UShort number_Of_VMetrics;
+
+ /* The following fields are not defined by the TrueType specification */
+ /* but they're used to connect the metrics header to the relevant */
+ /* `HMTX' or `VMTX' table. */
+
+ void* long_metrics;
+ void* short_metrics;
+ };
+
+ typedef struct TT_Vertical_Header_ TT_Vertical_Header;
+
+
+ /* ------ The OS/2 table ------ */
+
+ /************************************************************************/
+ /* Note that since FreeType 1.3, we support Mac fonts which do not have */
+ /* an OS/2 table. In this case the `version' field will be set to */
+ /* 0xFFFF by the table loader; all other fields should be 0. */
+
+ struct TT_OS2_
+ {
+ TT_UShort version; /* 0x0001 */
+ TT_FWord xAvgCharWidth;
+ TT_UShort usWeightClass;
+ TT_UShort usWidthClass;
+ TT_Short fsType;
+ TT_FWord ySubscriptXSize;
+ TT_FWord ySubscriptYSize;
+ TT_FWord ySubscriptXOffset;
+ TT_FWord ySubscriptYOffset;
+ TT_FWord ySuperscriptXSize;
+ TT_FWord ySuperscriptYSize;
+ TT_FWord ySuperscriptXOffset;
+ TT_FWord ySuperscriptYOffset;
+ TT_FWord yStrikeoutSize;
+ TT_FWord yStrikeoutPosition;
+ TT_Short sFamilyClass;
+
+ TT_Byte panose[10];
+
+ TT_ULong ulUnicodeRange1; /* Bits 0-31 */
+ TT_ULong ulUnicodeRange2; /* Bits 32-63 */
+ TT_ULong ulUnicodeRange3; /* Bits 64-95 */
+ TT_ULong ulUnicodeRange4; /* Bits 96-127 */
+
+ TT_Char achVendID[4];
+
+ TT_UShort fsSelection;
+ TT_UShort usFirstCharIndex;
+ TT_UShort usLastCharIndex;
+ TT_Short sTypoAscender;
+ TT_Short sTypoDescender;
+ TT_Short sTypoLineGap;
+ TT_UShort usWinAscent;
+ TT_UShort usWinDescent;
+
+ /* only version 1 tables: */
+
+ TT_ULong ulCodePageRange1; /* Bits 0-31 */
+ TT_ULong ulCodePageRange2; /* Bits 32-63 */
+
+ /* only version 2 tables: */
+
+ TT_Short sxHeight;
+ TT_Short sCapHeight;
+ TT_UShort usDefaultChar;
+ TT_UShort usBreakChar;
+ TT_UShort usMaxContext;
+ };
+
+ typedef struct TT_OS2_ TT_OS2;
+
+
+ /* ------ The PostScript table ------ */
+
+ struct TT_Postscript_
+ {
+ TT_Fixed FormatType;
+ TT_Fixed italicAngle;
+ TT_FWord underlinePosition;
+ TT_FWord underlineThickness;
+ TT_ULong isFixedPitch;
+ TT_ULong minMemType42;
+ TT_ULong maxMemType42;
+ TT_ULong minMemType1;
+ TT_ULong maxMemType1;
+
+ /* Glyph names follow in the file, but we don't */
+ /* load them by default. See the ftxpost.c extension. */
+ };
+
+ typedef struct TT_Postscript_ TT_Postscript;
+
+
+ /* ------ The horizontal device metrics table (`hdmx') ------ */
+
+ struct TT_Hdmx_Record_
+ {
+ TT_Byte ppem;
+ TT_Byte max_width;
+ TT_Byte* widths;
+ };
+
+ typedef struct TT_Hdmx_Record_ TT_Hdmx_Record;
+
+
+ struct TT_Hdmx_
+ {
+ TT_UShort version;
+ TT_Short num_records;
+ TT_Hdmx_Record* records;
+ };
+
+ typedef struct TT_Hdmx_ TT_Hdmx;
+
+
+ /* A structure used to describe face properties. */
+
+ struct TT_Face_Properties_
+ {
+ TT_UShort num_Glyphs; /* number of glyphs in face */
+ TT_UShort max_Points; /* maximum number of points in a glyph */
+ TT_UShort max_Contours; /* maximum number of contours in a glyph */
+
+ TT_UShort num_CharMaps; /* number of charmaps in the face */
+ TT_UShort num_Names; /* number of name records in the face */
+
+ TT_ULong num_Faces; /* 1 for normal TrueType files, and the */
+ /* number of embedded faces for TrueType */
+ /* collections */
+
+ TT_Header* header; /* TrueType header table */
+ TT_Horizontal_Header* horizontal; /* TrueType horizontal header */
+ TT_OS2* os2; /* TrueType OS/2 table */
+ TT_Postscript* postscript; /* TrueType Postscript table */
+ TT_Hdmx* hdmx; /* TrueType hor. dev. metr. table */
+ TT_Vertical_Header* vertical; /* TT Vertical header, if present */
+ };
+
+ typedef struct TT_Face_Properties_ TT_Face_Properties;
+
+
+ /* Here are the definitions of the handle types used for FreeType's */
+ /* most common objects accessed by the client application. We use */
+ /* a simple trick: */
+ /* */
+ /* Each handle type is a structure that only contains one */
+ /* pointer. The advantage of structures is that they are */
+ /* mutually exclusive types. We could have defined the */
+ /* following types: */
+ /* */
+ /* typedef void* TT_Stream; */
+ /* typedef void* TT_Face; */
+ /* typedef void* TT_Instance; */
+ /* typedef void* TT_Glyph; */
+ /* typedef void* TT_CharMap; */
+ /* */
+ /* but these would have allowed lines like: */
+ /* */
+ /* stream = instance; */
+ /* */
+ /* in the client code this would be a severe bug, unnoticed */
+ /* by the compiler! */
+ /* */
+ /* Thus, we enforce type checking with a simple language */
+ /* trick... */
+ /* */
+ /* NOTE: Some macros are defined in tttypes.h to perform */
+ /* automatic type conversions for library hackers... */
+
+ struct TT_Engine_ { void* z; };
+ struct TT_Stream_ { void* z; };
+ struct TT_Face_ { void* z; };
+ struct TT_Instance_ { void* z; };
+ struct TT_Glyph_ { void* z; };
+ struct TT_CharMap_ { void* z; };
+
+ typedef struct TT_Engine_ TT_Engine; /* engine instance */
+ typedef struct TT_Stream_ TT_Stream; /* stream handle type */
+ typedef struct TT_Face_ TT_Face; /* face handle type */
+ typedef struct TT_Instance_ TT_Instance; /* instance handle type */
+ typedef struct TT_Glyph_ TT_Glyph; /* glyph handle type */
+ typedef struct TT_CharMap_ TT_CharMap; /* character map handle type */
+
+
+ /* Almost all functions return an error code of this type. */
+
+ typedef long TT_Error;
+
+
+ /*******************************************************************/
+ /* */
+ /* FreeType API */
+ /* */
+ /* All these begin with a `TT_' prefix. */
+ /* */
+ /* Most of them are implemented in the `ttapi.c' source file. */
+ /* */
+ /*******************************************************************/
+
+ /* Get version information. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_FreeType_Version( int *major,
+ int *minor );
+
+
+ /* Initialize the engine. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Init_FreeType( TT_Engine* engine );
+
+
+ /* Finalize the engine, and release all allocated objects. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Done_FreeType( TT_Engine engine );
+
+
+ /* Set the gray level palette. This is an array of 5 bytes used */
+ /* to produce the font smoothed pixmaps. By convention: */
+ /* */
+ /* palette[0] = background (white) */
+ /* palette[1] = light */
+ /* palette[2] = medium */
+ /* palette[3] = dark */
+ /* palette[4] = foreground (black) */
+ /* */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Raster_Gray_Palette( TT_Engine engine,
+ TT_Byte* palette );
+
+
+ /* ----------------------- face management ----------------------- */
+
+ /* Open a new TrueType font file, and returns a handle for */
+ /* it in variable '*face'. */
+ /* */
+ /* Note: The file can be either a TrueType file (*.ttf) or */
+ /* a TrueType collection (*.ttc, in this case, only */
+ /* the first face is opened). The number of faces in */
+ /* the same collection can be obtained in the face's */
+ /* properties, using TT_Get_Face_Properties() and the */
+ /* `max_Faces' field. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Open_Face( TT_Engine engine,
+ const TT_Text* fontPathName,
+ TT_Face* face );
+
+
+ /* Open a TrueType font file located inside a collection. */
+ /* The font is assigned by its index in `fontIndex'. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Open_Collection( TT_Engine engine,
+ const TT_Text* collectionPathName,
+ TT_ULong fontIndex,
+ TT_Face* face );
+
+
+ /* Return face properties in the `properties' structure. */
+ /* */
+ /* Note that since version 1.3, we support font files with no */
+ /* OS/2 table (mainly old Mac fonts). In this case, the OS/2 */
+ /* `version' field will be set to 0xFFFF, and all other fields */
+ /* will be zeroed. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Face_Properties( TT_Face face,
+ TT_Face_Properties* properties );
+
+
+ /* Set a face object's generic pointer */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Face_Pointer( TT_Face face,
+ void* data );
+
+
+ /* Get a face object's generic pointer */
+
+ FT_EXPORT_DEF( void* )
+ TT_Get_Face_Pointer( TT_Face face );
+
+
+ /* Close a face's file handle to save system resources. The file */
+ /* will be re-opened automatically on the next disk access. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Flush_Face( TT_Face face );
+
+ /* Get a face's glyph metrics expressed in font units. Returns any */
+ /* number of arrays. Set the fields to NULL if you are not interested */
+ /* by a given array. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Face_Metrics( TT_Face face,
+ TT_UShort firstGlyph,
+ TT_UShort lastGlyph,
+ TT_Short* leftBearings,
+ TT_UShort* widths,
+ TT_Short* topBearings,
+ TT_UShort* heights );
+
+
+ /* Close a given font object, destroying all associated */
+ /* instances. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Close_Face( TT_Face face );
+
+
+ /* Get font or table data. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Font_Data( TT_Face face,
+ TT_ULong tag,
+ TT_Long offset,
+ void* buffer,
+ TT_Long* length );
+
+
+/* A simple macro to build table tags from ASCII chars */
+
+#define MAKE_TT_TAG( _x1, _x2, _x3, _x4 ) \
+ (((TT_ULong)_x1 << 24) | \
+ ((TT_ULong)_x2 << 16) | \
+ ((TT_ULong)_x3 << 8) | \
+ (TT_ULong)_x4)
+
+
+
+ /* ----------------------- instance management -------------------- */
+
+ /* Open a new font instance and returns an instance handle */
+ /* for it in `*instance'. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_New_Instance( TT_Face face,
+ TT_Instance* instance );
+
+
+ /* Set device resolution for a given instance. The values are */
+ /* given in dpi (Dots Per Inch). Default is 96 in both directions. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Instance_Resolutions( TT_Instance instance,
+ TT_UShort xResolution,
+ TT_UShort yResolution );
+
+
+ /* Set the pointsize for a given instance. Default is 10pt. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Instance_CharSize( TT_Instance instance,
+ TT_F26Dot6 charSize );
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Instance_CharSizes( TT_Instance instance,
+ TT_F26Dot6 charWidth,
+ TT_F26Dot6 charHeight );
+
+#define TT_Set_Instance_PointSize( ins, ptsize ) \
+ TT_Set_Instance_CharSize( ins, ptsize*64L )
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Instance_PixelSizes( TT_Instance instance,
+ TT_UShort pixelWidth,
+ TT_UShort pixelHeight,
+ TT_F26Dot6 pointSize );
+
+
+ /* This function has been deprecated! Do not use it, as it */
+ /* doesn't work reliably. You can perfectly control hinting */
+ /* yourself when loading glyphs, then apply transforms as usual. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Instance_Transform_Flags( TT_Instance instance,
+ TT_Bool rotated,
+ TT_Bool stretched );
+
+
+ /* Return instance metrics in `metrics'. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Instance_Metrics( TT_Instance instance,
+ TT_Instance_Metrics* metrics );
+
+
+ /* Set an instance's generic pointer. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Set_Instance_Pointer( TT_Instance instance,
+ void* data );
+
+
+ /* Get an instance's generic pointer. */
+
+ FT_EXPORT_DEF( void* )
+ TT_Get_Instance_Pointer( TT_Instance instance );
+
+
+ /* Close a given instance object, destroying all associated data. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Done_Instance( TT_Instance instance );
+
+
+
+ /* ----------------------- glyph management ----------------------- */
+
+ /* Create a new glyph object related to the given `face'. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_New_Glyph( TT_Face face,
+ TT_Glyph* glyph );
+
+
+ /* Discard (and destroy) a given glyph object. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Done_Glyph( TT_Glyph glyph );
+
+
+#define TTLOAD_SCALE_GLYPH 1
+#define TTLOAD_HINT_GLYPH 2
+#define TTLOAD_PEDANTIC 128
+#define TTLOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 256
+
+#define TTLOAD_DEFAULT (TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH)
+
+
+ /* Load and process (scale/transform and hint) a glyph from the */
+ /* given `instance'. The glyph and instance handles must be */
+ /* related to the same face object. The glyph index can be */
+ /* computed with a call to TT_Char_Index(). */
+ /* */
+ /* The 'load_flags' argument is a combination of the macros */
+ /* TTLOAD_SCALE_GLYPH and TTLOAD_HINT_GLYPH. Hinting will be */
+ /* applied only if the scaling is selected. */
+ /* */
+ /* If scaling is off (i.e., load_flags = 0), the returned */
+ /* outlines are in EM square coordinates (also called FUnits), */
+ /* extracted directly from the font with no hinting. Other */
+ /* glyph metrics are also in FUnits. */
+ /* */
+ /* If scaling is on, the returned outlines are in fractional */
+ /* pixel units (i.e. TT_F26Dot6 = 26.6 fixed floats). */
+ /* */
+ /* NOTE: The glyph index must be in the range 0..num_glyphs-1, */
+ /* where `num_glyphs' is the total number of glyphs in */
+ /* the font file (given in the face properties). */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Load_Glyph( TT_Instance instance,
+ TT_Glyph glyph,
+ TT_UShort glyphIndex,
+ TT_UShort loadFlags );
+
+
+ /* Return glyph outline pointers in `outline'. Note that the returned */
+ /* pointers are owned by the glyph object, and will be destroyed with */
+ /* it. The client application should _not_ change the pointers. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Glyph_Outline( TT_Glyph glyph,
+ TT_Outline* outline );
+
+
+ /* Copy the glyph metrics into `metrics'. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Glyph_Metrics( TT_Glyph glyph,
+ TT_Glyph_Metrics* metrics );
+
+
+ /* Copy the glyph's big metrics into `metrics'. */
+ /* Necessary to obtain vertical metrics. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Glyph_Big_Metrics( TT_Glyph glyph,
+ TT_Big_Glyph_Metrics* metrics );
+
+
+ /* Render the glyph into a bitmap, with given position offsets. */
+ /* */
+ /* Note: Only use integer pixel offsets to preserve the fine */
+ /* hinting of the glyph and the `correct' anti-aliasing */
+ /* (where vertical and horizontal stems aren't grayed). This */
+ /* means that `xOffset' and `yOffset' must be multiples */
+ /* of 64! */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Glyph_Bitmap( TT_Glyph glyph,
+ TT_Raster_Map* bitmap,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset );
+
+
+ /* Render the glyph into a pixmap, with given position offsets. */
+ /* */
+ /* Note: Only use integer pixel offsets to preserve the fine */
+ /* hinting of the glyph and the `correct' anti-aliasing */
+ /* (where vertical and horizontal stems aren't grayed). This */
+ /* means that `xOffset' and `yOffset' must be multiples */
+ /* of 64! */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Glyph_Pixmap( TT_Glyph glyph,
+ TT_Raster_Map* pixmap,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset );
+
+
+
+ /* ----------------------- outline support ------------------------ */
+
+ /* Allocate a new outline. Reserve space for `numPoints' and */
+ /* `numContours'. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_New_Outline( TT_UShort numPoints,
+ TT_Short numContours,
+ TT_Outline* outline );
+
+
+ /* Release an outline. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Done_Outline( TT_Outline* outline );
+
+
+ /* Copy an outline into another one. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Copy_Outline( TT_Outline* source,
+ TT_Outline* target );
+
+
+ /* Render an outline into a bitmap. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Outline_Bitmap( TT_Engine engine,
+ TT_Outline* outline,
+ TT_Raster_Map* bitmap );
+
+
+ /* Render an outline into a pixmap. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Outline_Pixmap( TT_Engine engine,
+ TT_Outline* outline,
+ TT_Raster_Map* pixmap );
+
+
+ /* Return an outline's bounding box -- this function is slow as it */
+ /* performs a complete scan-line process, without drawing, to get */
+ /* the most accurate values. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Outline_BBox( TT_Outline* outline,
+ TT_BBox* bbox );
+
+
+ /* Apply a transformation to a glyph outline. */
+
+ FT_EXPORT_DEF( void )
+ TT_Transform_Outline( TT_Outline* outline,
+ TT_Matrix* matrix );
+
+
+ /* Apply a translation to a glyph outline. */
+
+ FT_EXPORT_DEF( void )
+ TT_Translate_Outline( TT_Outline* outline,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset );
+
+
+ /* Apply a transformation to a vector. */
+
+ FT_EXPORT_DEF( void )
+ TT_Transform_Vector( TT_F26Dot6* x,
+ TT_F26Dot6* y,
+ TT_Matrix* matrix );
+
+
+ /* Compute A*B/C with 64 bits intermediate precision. */
+
+ FT_EXPORT_DEF( TT_Long )
+ TT_MulDiv( TT_Long A,
+ TT_Long B,
+ TT_Long C );
+
+
+ /* Compute A*B/0x10000 with 64 bits intermediate precision. */
+ /* Useful to multiply by a 16.16 fixed float value. */
+
+ FT_EXPORT_DEF( TT_Long )
+ TT_MulFix( TT_Long A,
+ TT_Long B );
+
+
+ /* ----------------- character mapping support --------------- */
+
+ /* Return the number of character mappings found in this file. */
+ /* Returns -1 in case of failure (invalid face handle). */
+ /* */
+ /* DON'T USE THIS FUNCTION! IT HAS BEEN DEPRECATED! */
+ /* */
+ /* It is retained for backwards compatibility only and will */
+ /* fail on 16bit systems. */
+ /* */
+ /* You can now get the charmap count in the `num_CharMaps' */
+ /* field of a face's properties. */
+ /* */
+
+ FT_EXPORT_DEF( int )
+ TT_Get_CharMap_Count( TT_Face face );
+
+
+ /* Return the ID of charmap number `charmapIndex' of a given face */
+ /* used to enumerate the charmaps present in a TrueType file. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_CharMap_ID( TT_Face face,
+ TT_UShort charmapIndex,
+ TT_UShort* platformID,
+ TT_UShort* encodingID );
+
+
+ /* Look up the character maps found in `face' and return a handle */
+ /* for the one matching `platformID' and `platformEncodingID' */
+ /* (see the TrueType specs relating to the `cmap' table for */
+ /* information on these ID numbers). Returns an error code. */
+ /* In case of failure, the handle is set to NULL and is invalid. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_CharMap( TT_Face face,
+ TT_UShort charmapIndex,
+ TT_CharMap* charMap );
+
+
+ /* Translate a character code through a given character map */
+ /* and return the corresponding glyph index to be used in */
+ /* a TT_Load_Glyph() call. This function returns 0 in case */
+ /* of failure. */
+
+ FT_EXPORT_DEF( TT_UShort )
+ TT_Char_Index( TT_CharMap charMap,
+ TT_ULong charCode );
+
+
+
+ /* --------------------- names table support ------------------- */
+
+ /* Return the number of name strings found in the name table. */
+ /* Returns -1 in case of failure (invalid face handle). */
+ /* */
+ /* DON'T USE THIS FUNCTION! IT HAS BEEN DEPRECATED! */
+ /* */
+ /* It is retained for backwards compatibility only and will */
+ /* fail on 16bit systems. */
+ /* */
+ /* You can now get the number of name strings in a face with */
+ /* the `num_Names' field of its properties. */
+
+ FT_EXPORT_DEF( int )
+ TT_Get_Name_Count( TT_Face face );
+
+
+ /* Return the ID of the name number `nameIndex' of a given face */
+ /* used to enumerate the charmaps present in a TrueType file. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Name_ID( TT_Face face,
+ TT_UShort nameIndex,
+ TT_UShort* platformID,
+ TT_UShort* encodingID,
+ TT_UShort* languageID,
+ TT_UShort* nameID );
+
+
+ /* Return the address and length of the name number `nameIndex' */
+ /* of a given face in the variables `stringPtr' resp. `length'. */
+ /* The string is part of the face object and shouldn't be */
+ /* written to or released. */
+ /* */
+ /* Note that for an invalid platform ID a null pointer will be */
+ /* returned. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Get_Name_String( TT_Face face,
+ TT_UShort nameIndex,
+ TT_String** stringPtr,
+ TT_UShort* length );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* FREETYPE_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/freetype.rc b/Build/source/libs/freetype/lib/freetype.rc
new file mode 100644
index 00000000000..8a1fc02a1e3
--- /dev/null
+++ b/Build/source/libs/freetype/lib/freetype.rc
@@ -0,0 +1,36 @@
+/* freetype.rc: freetype resources -*- C++ -*-
+
+ Copyright (C) 1996-2003 Fabrice Popineau <fabrice.popineau@supelec.fr>
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; if not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include <texlive-version.h>
+
+#define VER_FILEVERSION TEXLIVE_MAJOR_VERSION,TEXLIVE_MINOR_VERSION,TEXLIVE_BETA_NUMBER,TEXLIVE_ALPHA_NUMBER
+#define VER_FILEVERSION_STR TEXLIVE_PRODUCTVERSION_STR " freetype 1.5"
+
+#define VER_INTERNALNAME_STR TEXLIVE_LIBRARYPREFIX_STR "ft"
+#define VER_ORIGINALFILENAME_STR TEXLIVE_LIBRARYPREFIX_STR "ft.dll"
+
+#define VER_LEGALCOPYRIGHT_STR "Copyright 1996-2001, 2002 by David Turner, Robert Wilhelm, and Werner Lemberg"
+
+#define VER_FILEDESCRIPTION_STR "FreeType DLL"
+
+#define VER_FILETYPE VFT_DLL
+
+#include <texlive.version>
+
+/* freetype.rc ends here */
diff --git a/Build/source/libs/freetype/lib/fterrid.h b/Build/source/libs/freetype/lib/fterrid.h
new file mode 100644
index 00000000000..54cd150d8cf
--- /dev/null
+++ b/Build/source/libs/freetype/lib/fterrid.h
@@ -0,0 +1,162 @@
+/*******************************************************************
+ *
+ * fterrid.h
+ *
+ * TrueType Error ID definitions
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef FREETYPE_H
+#error "Don't include this file! Use freetype.h instead."
+#endif
+
+#ifndef FTERRID_H
+#define FTERRID_H
+
+ /************************ error codes declaration **************/
+
+ /* The error codes are grouped in 'classes' used to indicate the */
+ /* 'level' at which the error happened. */
+ /* The class is given by an error code's high byte. */
+
+
+ /* ------------- Success is always 0 -------- */
+
+#define TT_Err_Ok 0
+
+
+ /* -------- High-level API error codes ------ */
+
+#define TT_Err_Invalid_Face_Handle 0x001
+#define TT_Err_Invalid_Instance_Handle 0x002
+#define TT_Err_Invalid_Glyph_Handle 0x003
+#define TT_Err_Invalid_CharMap_Handle 0x004
+#define TT_Err_Invalid_Result_Address 0x005
+#define TT_Err_Invalid_Glyph_Index 0x006
+#define TT_Err_Invalid_Argument 0x007
+#define TT_Err_Could_Not_Open_File 0x008
+#define TT_Err_File_Is_Not_Collection 0x009
+
+#define TT_Err_Table_Missing 0x00A
+#define TT_Err_Invalid_Horiz_Metrics 0x00B
+#define TT_Err_Invalid_CharMap_Format 0x00C
+#define TT_Err_Invalid_PPem 0x00D
+#define TT_Err_Invalid_Vert_Metrics 0x00E
+
+#define TT_Err_Invalid_File_Format 0x010
+
+#define TT_Err_Invalid_Engine 0x020
+#define TT_Err_Too_Many_Extensions 0x021
+#define TT_Err_Extensions_Unsupported 0x022
+#define TT_Err_Invalid_Extension_Id 0x023
+
+#define TT_Err_No_Vertical_Data 0x030
+
+#define TT_Err_Max_Profile_Missing 0x080
+#define TT_Err_Header_Table_Missing 0x081
+#define TT_Err_Horiz_Header_Missing 0x082
+#define TT_Err_Locations_Missing 0x083
+#define TT_Err_Name_Table_Missing 0x084
+#define TT_Err_CMap_Table_Missing 0x085
+#define TT_Err_Hmtx_Table_Missing 0x086
+#define TT_Err_OS2_Table_Missing 0x087
+#define TT_Err_Post_Table_Missing 0x088
+#define TT_Err_Glyf_Table_Missing 0x089
+
+
+ /* -------- Memory component error codes ---- */
+
+ /* this error indicates that an operation cannot */
+ /* be performed due to memory exhaustion. */
+
+#define TT_Err_Out_Of_Memory 0x100
+
+
+ /* -------- File component error codes ------ */
+
+ /* these error codes indicate that the file could */
+ /* not be accessed properly. Usually, this means */
+ /* a broken font file! */
+
+#define TT_Err_Invalid_File_Offset 0x200
+#define TT_Err_Invalid_File_Read 0x201
+#define TT_Err_Invalid_Frame_Access 0x202
+
+
+ /* -------- Glyph loader error codes -------- */
+
+ /* Produced only by the glyph loader, these error */
+ /* codes indicate a broken glyph in a font file. */
+
+#define TT_Err_Too_Many_Points 0x300
+#define TT_Err_Too_Many_Contours 0x301
+#define TT_Err_Invalid_Composite 0x302
+#define TT_Err_Too_Many_Ins 0x303
+#define TT_Err_Too_Many_FDefs 0x304
+
+
+ /* --- bytecode interpreter error codes ----- */
+
+ /* These error codes are produced by the TrueType */
+ /* bytecode interpreter. They usually indicate a */
+ /* broken font file, a broken glyph within a font */
+ /* file, or a bug in the interpreter! */
+
+#define TT_Err_Invalid_Opcode 0x400
+#define TT_Err_Too_Few_Arguments 0x401
+#define TT_Err_Stack_Overflow 0x402
+#define TT_Err_Code_Overflow 0x403
+#define TT_Err_Bad_Argument 0x404
+#define TT_Err_Divide_By_Zero 0x405
+#define TT_Err_Storage_Overflow 0x406
+#define TT_Err_Cvt_Overflow 0x407
+#define TT_Err_Invalid_Reference 0x408
+#define TT_Err_Invalid_Distance 0x409
+#define TT_Err_Interpolate_Twilight 0x40A
+#define TT_Err_Debug_OpCode 0x40B
+#define TT_Err_ENDF_In_Exec_Stream 0x40C
+#define TT_Err_Out_Of_CodeRanges 0x40D
+#define TT_Err_Nested_DEFS 0x40E
+#define TT_Err_Invalid_CodeRange 0x40F
+#define TT_Err_Invalid_Displacement 0x410
+#define TT_Err_Execution_Too_Long 0x411
+
+
+ /* ------ internal failure error codes ----- */
+
+ /* These error codes are produced when an incoherent */
+ /* library state has been detected. These reflect a */
+ /* severe bug in the engine! (Or a major overwrite */
+ /* of your application into the library's data.) */
+
+#define TT_Err_Nested_Frame_Access 0x500
+#define TT_Err_Invalid_Cache_List 0x501
+#define TT_Err_Could_Not_Find_Context 0x502
+#define TT_Err_Unlisted_Object 0x503
+
+
+ /* ---- scan-line converter error codes ----- */
+
+ /* These error codes are produced by the raster component. */
+ /* They indicate that an outline structure was incoherently */
+ /* setup, or that you're trying to render an horribly */
+ /* complex glyph! */
+
+#define TT_Err_Raster_Pool_Overflow 0x600
+#define TT_Err_Raster_Negative_Height 0x601
+#define TT_Err_Raster_Invalid_Value 0x602
+#define TT_Err_Raster_Not_Initialized 0x603
+
+#endif /* FTERRID_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ftnameid.h b/Build/source/libs/freetype/lib/ftnameid.h
new file mode 100644
index 00000000000..eb804211b9d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ftnameid.h
@@ -0,0 +1,877 @@
+/*******************************************************************
+ *
+ * ftnameid.h
+ *
+ * TrueType Name ID definitions
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef FREETYPE_H
+#error "Don't include this file! Use freetype.h instead."
+#endif
+
+#ifndef FTNAMEID_H
+#define FTNAMEID_H
+
+/*
+ * possible values for the 'Platform' identifier code in the name
+ * records of the TTF "name" table
+ */
+
+#define TT_PLATFORM_APPLE_UNICODE 0
+#define TT_PLATFORM_MACINTOSH 1
+#define TT_PLATFORM_ISO 2 /* deprecated */
+#define TT_PLATFORM_MICROSOFT 3
+#define TT_PLATFORM_CUSTOM 4
+
+
+/*
+ * possible values of the platform specific encoding identifier field in
+ * the name records of the TTF "name" table when the 'Platform' identifier
+ * code is TT_PLATFORM_APPLE_UNICODE
+ */
+
+#define TT_APPLE_ID_DEFAULT 0
+#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */
+#define TT_APPLE_ID_ISO_10646 2 /* deprecated */
+#define TT_APPLE_ID_UNICODE_2_0 3 /* or later, BMP characters */
+#define TT_APPLE_ID_UNICODE_32 4 /* 3.1 or later, full repertoire */
+
+
+/*
+ * possible values of the platform specific encoding identifier field in
+ * the name records of the TTF "name" table when the 'Platform' identifier
+ * code is TT_PLATFORM_MACINTOSH
+ */
+
+#define TT_MAC_ID_ROMAN 0
+#define TT_MAC_ID_JAPANESE 1
+#define TT_MAC_ID_TRADITIONAL_CHINESE 2
+#define TT_MAC_ID_KOREAN 3
+#define TT_MAC_ID_ARABIC 4
+#define TT_MAC_ID_HEBREW 5
+#define TT_MAC_ID_GREEK 6
+#define TT_MAC_ID_RUSSIAN 7
+#define TT_MAC_ID_RSYMBOL 8
+#define TT_MAC_ID_DEVANAGARI 9
+#define TT_MAC_ID_GURMUKHI 10
+#define TT_MAC_ID_GUJARATI 11
+#define TT_MAC_ID_ORIYA 12
+#define TT_MAC_ID_BENGALI 13
+#define TT_MAC_ID_TAMIL 14
+#define TT_MAC_ID_TELUGU 15
+#define TT_MAC_ID_KANNADA 16
+#define TT_MAC_ID_MALAYALAM 17
+#define TT_MAC_ID_SINHALESE 18
+#define TT_MAC_ID_BURMESE 19
+#define TT_MAC_ID_KHMER 20
+#define TT_MAC_ID_THAI 21
+#define TT_MAC_ID_LAOTIAN 22
+#define TT_MAC_ID_GEORGIAN 23
+#define TT_MAC_ID_ARMENIAN 24
+#define TT_MAC_ID_MALDIVIAN 25
+#define TT_MAC_ID_SIMPLIFIED_CHINESE 25
+#define TT_MAC_ID_TIBETAN 26
+#define TT_MAC_ID_MONGOLIAN 27
+#define TT_MAC_ID_GEEZ 28
+#define TT_MAC_ID_SLAVIC 29
+#define TT_MAC_ID_VIETNAMESE 30
+#define TT_MAC_ID_SINDHI 31
+#define TT_MAC_ID_UNINTERP 32
+
+
+/*
+ * possible values of the platform specific encoding identifier field in
+ * the name records of the TTF "name" table when the 'Platform' identifier
+ * code is TT_PLATFORM_ISO
+ *
+ * This use is now deprecated
+ */
+
+#define TT_ISO_ID_7BIT_ASCII 0
+#define TT_ISO_ID_10646 1
+#define TT_ISO_ID_8859_1 2
+
+
+/*
+ * possible values of the platform specific encoding identifier field in
+ * the name records of the TTF "name" table when the 'Platform' identifier
+ * code is TT_PLATFORM_MICROSOFT
+ */
+
+#define TT_MS_ID_SYMBOL_CS 0
+#define TT_MS_ID_UNICODE_CS 1
+#define TT_MS_ID_SJIS 2
+#define TT_MS_ID_GB2312 3
+#define TT_MS_ID_BIG_5 4
+#define TT_MS_ID_WANSUNG 5
+#define TT_MS_ID_JOHAB 6
+#define TT_MS_ID_UCS_4 10 /* full repertoire, UTF-32 */
+
+
+
+/*
+ * possible values of the language identifier field in the name records of
+ * the TTF "name" table when the 'Platform' identifier code is
+ * TT_PLATFORM_MACINTOSH
+ *
+ * the canonical source for the Apple assigned Language ID's is at
+ * http://fonts.apple.com/TTRefMan/RM06/Chap6name.html
+ */
+
+#define TT_MAC_LANGID_ENGLISH 0
+#define TT_MAC_LANGID_FRENCH 1
+#define TT_MAC_LANGID_GERMAN 2
+#define TT_MAC_LANGID_ITALIAN 3
+#define TT_MAC_LANGID_DUTCH 4
+#define TT_MAC_LANGID_SWEDISH 5
+#define TT_MAC_LANGID_SPANISH 6
+#define TT_MAC_LANGID_DANISH 7
+#define TT_MAC_LANGID_PORTUGUESE 8
+#define TT_MAC_LANGID_NORWEGIAN 9
+#define TT_MAC_LANGID_HEBREW 10
+#define TT_MAC_LANGID_JAPANESE 11
+#define TT_MAC_LANGID_ARABIC 12
+#define TT_MAC_LANGID_FINNISH 13
+#define TT_MAC_LANGID_GREEK 14
+#define TT_MAC_LANGID_ICELANDIC 15
+#define TT_MAC_LANGID_MALTESE 16
+#define TT_MAC_LANGID_TURKISH 17
+#define TT_MAC_LANGID_CROATIAN 18
+#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19
+#define TT_MAC_LANGID_URDU 20
+#define TT_MAC_LANGID_HINDI 21
+#define TT_MAC_LANGID_THAI 22
+#define TT_MAC_LANGID_KOREAN 23
+#define TT_MAC_LANGID_LITHUANIAN 24
+#define TT_MAC_LANGID_POLISH 25
+#define TT_MAC_LANGID_HUNGARIAN 26
+#define TT_MAC_LANGID_ESTONIAN 27
+#define TT_MAC_LANGID_LETTISH 28
+#define TT_MAC_LANGID_SAAMISK 29
+#define TT_MAC_LANGID_FAEROESE 30
+#define TT_MAC_LANGID_FARSI 31
+#define TT_MAC_LANGID_RUSSIAN 32
+#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33
+#define TT_MAC_LANGID_FLEMISH 34
+#define TT_MAC_LANGID_IRISH 35
+#define TT_MAC_LANGID_ALBANIAN 36
+#define TT_MAC_LANGID_ROMANIAN 37
+#define TT_MAC_LANGID_CZECH 38
+#define TT_MAC_LANGID_SLOVAK 39
+#define TT_MAC_LANGID_SLOVENIAN 40
+#define TT_MAC_LANGID_YIDDISH 41
+#define TT_MAC_LANGID_SERBIAN 42
+#define TT_MAC_LANGID_MACEDONIAN 43
+#define TT_MAC_LANGID_BULGARIAN 44
+#define TT_MAC_LANGID_UKRAINIAN 45
+#define TT_MAC_LANGID_BYELORUSSIAN 46
+#define TT_MAC_LANGID_UZBEK 47
+#define TT_MAC_LANGID_KAZAKH 48
+#define TT_MAC_LANGID_AZERBAIJANI 49
+#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49
+#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50
+#define TT_MAC_LANGID_ARMENIAN 51
+#define TT_MAC_LANGID_GEORGIAN 52
+#define TT_MAC_LANGID_MOLDAVIAN 53
+#define TT_MAC_LANGID_KIRGHIZ 54
+#define TT_MAC_LANGID_TAJIKI 55
+#define TT_MAC_LANGID_TURKMEN 56
+#define TT_MAC_LANGID_MONGOLIAN 57
+#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57
+#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58
+#define TT_MAC_LANGID_PASHTO 59
+#define TT_MAC_LANGID_KURDISH 60
+#define TT_MAC_LANGID_KASHMIRI 61
+#define TT_MAC_LANGID_SINDHI 62
+#define TT_MAC_LANGID_TIBETAN 63
+#define TT_MAC_LANGID_NEPALI 64
+#define TT_MAC_LANGID_SANSKRIT 65
+#define TT_MAC_LANGID_MARATHI 66
+#define TT_MAC_LANGID_BENGALI 67
+#define TT_MAC_LANGID_ASSAMESE 68
+#define TT_MAC_LANGID_GUJARATI 69
+#define TT_MAC_LANGID_PUNJABI 70
+#define TT_MAC_LANGID_ORIYA 71
+#define TT_MAC_LANGID_MALAYALAM 72
+#define TT_MAC_LANGID_KANNADA 73
+#define TT_MAC_LANGID_TAMIL 74
+#define TT_MAC_LANGID_TELUGU 75
+#define TT_MAC_LANGID_SINHALESE 76
+#define TT_MAC_LANGID_BURMESE 77
+#define TT_MAC_LANGID_KHMER 78
+#define TT_MAC_LANGID_LAO 79
+#define TT_MAC_LANGID_VIETNAMESE 80
+#define TT_MAC_LANGID_INDONESIAN 81
+#define TT_MAC_LANGID_TAGALOG 82
+#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83
+#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84
+#define TT_MAC_LANGID_AMHARIC 85
+#define TT_MAC_LANGID_TIGRINYA 86
+#define TT_MAC_LANGID_GALLA 87
+#define TT_MAC_LANGID_SOMALI 88
+#define TT_MAC_LANGID_SWAHILI 89
+#define TT_MAC_LANGID_RUANDA 90
+#define TT_MAC_LANGID_RUNDI 91
+#define TT_MAC_LANGID_CHEWA 92
+#define TT_MAC_LANGID_MALAGASY 93
+#define TT_MAC_LANGID_ESPERANTO 94
+#define TT_MAC_LANGID_WELSH 128
+#define TT_MAC_LANGID_BASQUE 129
+#define TT_MAC_LANGID_CATALAN 130
+#define TT_MAC_LANGID_LATIN 131
+#define TT_MAC_LANGID_QUECHUA 132
+#define TT_MAC_LANGID_GUARANI 133
+#define TT_MAC_LANGID_AYMARA 134
+#define TT_MAC_LANGID_TATAR 135
+#define TT_MAC_LANGID_UIGHUR 136
+#define TT_MAC_LANGID_DZONGKHA 137
+#define TT_MAC_LANGID_JAVANESE 138
+#define TT_MAC_LANGID_SUNDANESE 139
+
+#if 0 /* these seem to be errors that have been dropped */
+#define TT_MAC_LANGID_SCOTTISH_GAELIC 140
+#define TT_MAC_LANGID_IRISH_GAELIC 141
+#endif
+
+/* The following codes are new as of 2000-03-10 */
+#define TT_MAC_LANGID_GALICIAN 140
+#define TT_MAC_LANGID_AFRIKAANS 141
+#define TT_MAC_LANGID_BRETON 142
+#define TT_MAC_LANGID_INUKTITUT 143
+#define TT_MAC_LANGID_SCOTTISH_GAELIC 144
+#define TT_MAC_LANGID_MANX_GAELIC 145
+#define TT_MAC_LANGID_IRISH_GAELIC 146
+#define TT_MAC_LANGID_TONGAN 147
+#define TT_MAC_LANGID_GREEK_POLYTONIC 148
+#define TT_MAC_LANGID_GREELANDIC 149
+#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150
+
+
+/*
+ * possible values of the language identifier field in the name records of
+ * the TTF "name" table when the 'Platform' identifier code is
+ * TT_PLATFORM_MICROSOFT
+ *
+ * the canonical source for the MS assigned LCID's used to be at
+ * http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt
+ * now (2002-11-15), the Microsoft site directs to
+ * http://www.microsoft.com/globaldev/reference/loclanghome.asp
+ * http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP
+ */
+
+#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401
+#define TT_MS_LANGID_ARABIC_IRAQ 0x0801
+#define TT_MS_LANGID_ARABIC_EGYPT 0x0c01
+#define TT_MS_LANGID_ARABIC_LIBYA 0x1001
+#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401
+#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801
+#define TT_MS_LANGID_ARABIC_TUNISIA 0x1c01
+#define TT_MS_LANGID_ARABIC_OMAN 0x2001
+#define TT_MS_LANGID_ARABIC_YEMEN 0x2401
+#define TT_MS_LANGID_ARABIC_SYRIA 0x2801
+#define TT_MS_LANGID_ARABIC_JORDAN 0x2c01
+#define TT_MS_LANGID_ARABIC_LEBANON 0x3001
+#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401
+#define TT_MS_LANGID_ARABIC_UAE 0x3801
+#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3c01
+#define TT_MS_LANGID_ARABIC_QATAR 0x4001
+#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402
+#define TT_MS_LANGID_CATALAN_SPAIN 0x0403
+#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404
+#define TT_MS_LANGID_CHINESE_PRC 0x0804
+#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04
+#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004
+
+#if 1 /* this used to be this value (and it still is in many places) */
+#define TT_MS_LANGID_CHINESE_MACAU 0x1404
+#else /* but beware, Microsoft may change its mind...
+ the most recent Word reference has the following: :-( */
+#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG
+#endif
+
+#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405
+#define TT_MS_LANGID_DANISH_DENMARK 0x0406
+#define TT_MS_LANGID_GERMAN_GERMANY 0x0407
+#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807
+#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0c07
+#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007
+#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407
+#define TT_MS_LANGID_GREEK_GREECE 0x0408
+#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409
+#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809
+#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09
+#define TT_MS_LANGID_ENGLISH_CANADA 0x1009
+#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409
+#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809
+#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1c09
+#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009
+#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409
+#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809
+#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09
+#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009
+#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409
+#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a
+#define TT_MS_LANGID_SPANISH_MEXICO 0x080a
+#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a
+#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100a
+#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140a
+#define TT_MS_LANGID_SPANISH_PANAMA 0x180a
+#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1c0a
+#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200a
+#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240a
+#define TT_MS_LANGID_SPANISH_PERU 0x280a
+#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2c0a
+#define TT_MS_LANGID_SPANISH_ECUADOR 0x300a
+#define TT_MS_LANGID_SPANISH_CHILE 0x340a
+#define TT_MS_LANGID_SPANISH_URUGUAY 0x380a
+#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3c0a
+#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400a
+#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440a
+#define TT_MS_LANGID_SPANISH_HONDURAS 0x480a
+#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a
+#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a
+#define TT_MS_LANGID_FINNISH_FINLAND 0x040b
+#define TT_MS_LANGID_FRENCH_FRANCE 0x040c
+#define TT_MS_LANGID_FRENCH_BELGIUM 0x080c
+#define TT_MS_LANGID_FRENCH_CANADA 0x0c0c
+#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c
+#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c
+#define TT_MS_LANGID_FRENCH_MONACO 0x180c
+#define TT_MS_LANGID_HEBREW_ISRAEL 0x040d
+#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e
+#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f
+#define TT_MS_LANGID_ITALIAN_ITALY 0x0410
+#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810
+#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411
+#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412
+#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812
+#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413
+#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813
+#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414
+#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814
+#define TT_MS_LANGID_POLISH_POLAND 0x0415
+#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416
+#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816
+#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417
+#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418
+#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818
+#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419
+#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819
+#define TT_MS_LANGID_CROATIAN_CROATIA 0x041a
+#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a
+#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a
+#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b
+#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c
+#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d
+#define TT_MS_LANGID_SWEDISH_FINLAND 0x081d
+#define TT_MS_LANGID_THAI_THAILAND 0x041e
+#define TT_MS_LANGID_TURKISH_TURKEY 0x041f
+#define TT_MS_LANGID_URDU_PAKISTAN 0x0420
+#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421
+#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422
+#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423
+#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424
+#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425
+#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426
+#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427
+#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827
+
+#if 0 /* this seems to be an error that have been dropped */
+#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0428
+#endif
+
+#define TT_MS_LANGID_FARSI_IRAN 0x0429
+#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a
+#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b
+#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042c
+#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082c
+#define TT_MS_LANGID_BASQUE_SPAIN 0x042d
+#define TT_MS_LANGID_SORBIAN_GERMANY 0x042e
+#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042f
+#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430
+#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431
+#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432
+#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433
+#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434
+#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435
+#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436
+#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437
+#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438
+#define TT_MS_LANGID_HINDI_INDIA 0x0439
+#define TT_MS_LANGID_MALTESE_MALTA 0x043a
+#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b
+
+#if 0 /* this seems to be a previous invertion */
+#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c
+#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c
+#else
+#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c
+#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c
+#endif
+
+#define TT_MS_LANGID_MALAY_MALAYSIA 0x043e
+#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e
+#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f
+#define TT_MS_LANGID_SWAHILI_KENYA 0x0441
+#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443
+#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843
+#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444
+#define TT_MS_LANGID_BENGALI_INDIA 0x0445
+#define TT_MS_LANGID_PUNJABI_INDIA 0x0446
+#define TT_MS_LANGID_GUJARATI_INDIA 0x0447
+#define TT_MS_LANGID_ORIYA_INDIA 0x0448
+#define TT_MS_LANGID_TAMIL_INDIA 0x0449
+#define TT_MS_LANGID_TELUGU_INDIA 0x044a
+#define TT_MS_LANGID_KANNADA_INDIA 0x044b
+#define TT_MS_LANGID_MALAYALAM_INDIA 0x044c
+#define TT_MS_LANGID_ASSAMESE_INDIA 0x044d
+#define TT_MS_LANGID_MARATHI_INDIA 0x044e
+#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f
+#define TT_MS_LANGID_KONKANI_INDIA 0x0457
+
+/* new as of 2001-01-01 */
+#define TT_MS_LANGID_ARABIC_GENERAL 0x0001
+#define TT_MS_LANGID_CHINESE_GENERAL 0x0004
+#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009
+#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c
+#define TT_MS_LANGID_FRENCH_REUNION 0x200c
+#define TT_MS_LANGID_FRENCH_CONGO 0x240c
+ /* which was formerly: */
+#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO
+
+#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c
+#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c
+#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300c
+#define TT_MS_LANGID_FRENCH_MALI 0x340c
+#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101a
+#define TT_MS_LANGID_URDU_INDIA 0x0820
+#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428
+#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d
+#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN 0x0440
+ /* alias declared in Windows 2000 */
+#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \
+ TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN
+
+#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442
+#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450
+
+ /* this seems to be inconsistant... :-(
+ * here is the current "official" way: */
+#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451
+ /* and now here is what is used by Passport SDK */
+#define TT_MS_LANGID_TIBETAN_CHINA 0x0451
+#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851
+ /* end of inconsistency */
+
+#define TT_MS_LANGID_WELSH_WALES 0x0452
+#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453
+#define TT_MS_LANGID_LAO_LAOS 0x0454
+#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455
+#define TT_MS_LANGID_GALICIAN_SPAIN 0x0456
+#define TT_MS_LANGID_MANIPURI_INDIA 0x0458
+#define TT_MS_LANGID_SINDHI_INDIA 0x0459
+ /* the following one is only encountered in Microsoft RTF specification */
+#define TT_MS_LANGID_KASHMIRI_PAKISTAN 0x0460
+ /* the following one is not in the Passport list, looks like an omission */
+#define TT_MS_LANGID_KASHMIRI_INDIA 0x0860
+#define TT_MS_LANGID_NEPALI_NEPAL 0x0461
+#define TT_MS_LANGID_NEPALI_INDIA 0x0861
+#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462
+
+
+ /* new as of 2001-03-01 (from Office Xp) */
+#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09
+#define TT_MS_LANGID_ENGLISH_INDIA 0x4009
+#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409
+#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809
+#define TT_MS_LANGID_SYRIAC_SYRIA 0x045a
+#define TT_MS_LANGID_SINHALESE_SRI_LANKA 0x045b
+#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045c
+#define TT_MS_LANGID_INUKTITUT_CANADA 0x045d
+#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045e
+#define TT_MS_LANGID_TAMAZIGHT_MOROCCO 0x045f
+#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN 0x085f
+#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463
+#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464
+#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465
+ /* alias declared in Windows 2000 */
+#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES
+ /* for language codes from 0x0466 to 0x0471, see below */
+#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472
+#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473
+#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873
+ /* also spelled in the `Passport SDK' list as: */
+#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA
+
+ /* New additions from Windows Xp/Passport SDK. AL 2001-11-10. */
+
+ /* don't ask me what this one means... :-(
+ * note it is currently commented out
+#define TT_MS_LANGID_GREEK_GREECE2 0x2008
+ * end of comment to avoid strange code */
+
+#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a
+ /* these following two blatently violate MS specs, by using a sublang>0x1F */
+#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40a
+#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40c
+
+#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c
+#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c
+#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845
+#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846
+#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850
+#define TT_MS_LANGID_EDO_NIGERIA 0x0466
+#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467
+#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468
+#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469
+#define TT_MS_LANGID_YORUBA_NIGERIA 0x046a
+ /* language codes from 0x046b to 0x046f are (still) unknown. */
+#define TT_MS_LANGID_IGBO_NIGERIA 0x0470
+#define TT_MS_LANGID_KANURI_NIGERIA 0x0471
+#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474
+#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475
+#define TT_MS_LANGID_LATIN 0x0476
+#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477
+ /* Note Yi does not have a (proper) ISO639-2 code, since it is mostly not
+ * written (but OTOH the peculiar writing system is worth studying). */
+#define TT_MS_LANGID_YI_CHINA 0x0478
+#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479
+
+/*
+ * possible values of the 'Name' identifier field in the name records of
+ * the TTF "name" table. These values are platform independent.
+ */
+
+#define TT_NAME_ID_COPYRIGHT 0
+#define TT_NAME_ID_FONT_FAMILY 1
+#define TT_NAME_ID_FONT_SUBFAMILY 2
+#define TT_NAME_ID_UNIQUE_ID 3
+#define TT_NAME_ID_FULL_NAME 4
+#define TT_NAME_ID_VERSION_STRING 5
+#define TT_NAME_ID_PS_NAME 6
+#define TT_NAME_ID_TRADEMARK 7
+/* the following values are from the OpenType spec */
+#define TT_NAME_ID_MANUFACTURER 8
+#define TT_NAME_ID_DESIGNER 9
+#define TT_NAME_ID_DESCRIPTION 10
+#define TT_NAME_ID_VENDOR_URL 11
+#define TT_NAME_ID_DESIGNER_URL 12
+#define TT_NAME_ID_LICENSE 13
+#define TT_NAME_ID_LICENSE_URL 14
+/* number 15 is reserved */
+#define TT_NAME_ID_PREFERRED_FAMILY 16
+#define TT_NAME_ID_PREFERRED_SUBFAMILY 17
+#define TT_NAME_ID_MAC_FULL_NAME 18
+/* The following code is new as of 2000-01-21 */
+#define TT_NAME_ID_SAMPLE_TEXT 19
+/* This is new in OpenType 1.3 */
+#define TT_NAME_ID_CID_FINDFONT_NAME 20
+
+
+/*
+ * Bit Mask values for the Unicode Ranges from the TTF "OS2 " table.
+ */
+
+/* General Scripts Area */
+
+/* Bit 0 Basic Latin */
+#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */
+/* Bit 1 C1 Controls and Latin-1 Supplement */
+#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */
+/* Bit 2 Latin Extended-A */
+#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */
+/* Bit 3 Latin Extended-B */
+#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */
+/* Bit 4 IPA Extensions */
+#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */
+/* Bit 5 Spacing Modifier Letters */
+#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */
+/* Bit 6 Combining Diacritical Marks */
+#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */
+/* Bit 7 Greek and Coptic */
+#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */
+/* Bit 8 is reserved (was: Greek Symbols and Coptic) */
+/* Bit 9 Cyrillic + */
+/* Cyrillic Supplementary */
+#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */
+ /* U+0500-U+052F */
+/* Bit 10 Armenian */
+#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */
+/* Bit 11 Hebrew */
+#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */
+/* Bit 12 is reserved (was: Hebrew Extended) */
+/* Bit 13 Arabic */
+#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */
+/* Bit 14 is reserved (was: Arabic Extended) */
+/* Bit 15 Devanagari */
+#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */
+/* Bit 16 Bengali */
+#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */
+/* Bit 17 Gurmukhi */
+#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */
+/* Bit 18 Gujarati */
+#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */
+/* Bit 19 Oriya */
+#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */
+/* Bit 20 Tamil */
+#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */
+/* Bit 21 Telugu */
+#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */
+/* Bit 22 Kannada */
+#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */
+/* Bit 23 Malayalam */
+#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */
+/* Bit 24 Thai */
+#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */
+/* Bit 25 Lao */
+#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */
+/* Bit 26 Georgian */
+#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */
+/* Bit 27 is reserved (was Georgian Extended) */
+/* Bit 28 Hangul Jamo */
+#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */
+/* Bit 29 Latin Extended Additional */
+#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */
+/* Bit 30 Greek Extended */
+#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */
+
+/* Symbols Area */
+
+/* Bit 31 General Punctuation */
+#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */
+/* Bit 32 Superscripts And Subscripts */
+#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */
+/* Bit 33 Currency Symbols */
+#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */
+/* Bit 34 Combining Diacritical Marks For Symbols */
+#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */
+/* Bit 35 Letterlike Symbols */
+#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */
+/* Bit 36 Number Forms */
+#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */
+/* Bit 37 Arrows + */
+/* Supplemental Arrows-A + */
+/* Supplemental Arrows-B */
+#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */
+ /* U+27F0-U+27FF */
+ /* U+2900-U+297F */
+/* Bit 38 Mathematical Operators + */
+/* Supplemental Mathematical Operators + */
+/* Miscellaneous Mathematical Symbols-A + */
+/* Miscellaneous Mathematical Symbols-B */
+#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */
+ /* U+2A00-U+2AFF */
+ /* U+27C0-U+27EF */
+ /* U+2980-U+29FF */
+/* Bit 39 Miscellaneous Technical */
+#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */
+/* Bit 40 Control Pictures */
+#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */
+/* Bit 41 Optical Character Recognition */
+#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */
+/* Bit 42 Enclosed Alphanumerics */
+#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */
+/* Bit 43 Box Drawing */
+#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */
+/* Bit 44 Block Elements */
+#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */
+/* Bit 45 Geometric Shapes */
+#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */
+/* Bit 46 Miscellaneous Symbols */
+#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */
+/* Bit 47 Dingbats */
+#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */
+
+/* CJK Phonetics and Symbols Area */
+
+/* Bit 48 CJK Symbols And Punctuation */
+#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */
+/* Bit 49 Hiragana */
+#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */
+/* Bit 50 Katakana + */
+/* Katakana Phonetic Extensions */
+#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */
+ /* U+31F0-U+31FF */
+/* Bit 51 Bopomofo + */
+/* Bopomofo Extended */
+#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */
+ /* U+31A0-U+31BF */
+/* Bit 52 Hangul Compatibility Jamo */
+#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */
+/* Bit 53 Kanbun (also named `CJK Miscellaneous') */
+#define TT_UCR_CJK_MISC (1L << 21) /* U+3190-U+319F */
+#define TT_UCR_KANBUN TT_UCR_CJK_MISC
+/* Bit 54 Enclosed CJK Letters And Months */
+#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */
+/* Bit 55 CJK Compatibility */
+#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */
+
+/* Hangul Syllables Area */
+
+/* Bit 56 Hangul */
+#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */
+
+/* Surrogates Area */
+
+/* Bit 57 High Surrogates + */
+/* High Private Use Surrogates + */
+/* Low Surrogates */
+#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */
+ /* U+DB80-U+DBFF */
+ /* U+DC00-U+DFFF */
+ /* According to OpenType specs v.1.3+, setting bit 57 implies that there */
+ /* is at least one codepoint beyond the Basic Multilingual Plane that is */
+ /* supported by this font. So really means: U+10000-U+10FFFD */
+
+/* Bit 58 is reserved for Unicode SubRanges */
+
+/* CJK Ideographs Area */
+
+/* Bit 59 CJK Unified Ideographs + */
+/* CJK Radicals Supplement + */
+/* Kangxi Radicals + */
+/* Ideographic Description Characters + */
+/* CJK Unified Ideographs Extension A + */
+/* CJK Unified Ideographs Extension B + */
+/* Kanbun */
+#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */
+ /* U+2E80-U+2EFF */
+ /* U+2F00-U+2FDF */
+ /* U+2FF0-U+2FFF */
+ /* U+3400-U+4DB5 */
+ /*U+20000-U+2A6DF*/
+ /* U+3190-U+319F */
+
+/* Private Use Area */
+
+/* Bit 60 Private Use */
+#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */
+
+/* Compatibility Area and Specials */
+
+/* Bit 61 CJK Compatibility Ideographs + */
+/* CJK Compatibility Ideographs Supplement */
+#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+F900-U+FAFF */
+ /*U+2F800-U+2FA1F*/
+/* Bit 62 Alphabetic Presentation Forms */
+#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */
+/* Bit 63 Arabic Presentation Forms-A */
+#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FDFF */
+/* Bit 64 Combining Half Marks */
+#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */
+/* Bit 65 CJK Compatibility Forms */
+#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE30-U+FE4F */
+/* Bit 66 Small Form Variants */
+#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */
+/* Bit 67 Arabic Presentation Forms-B */
+#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFE */
+/* Bit 68 Halfwidth And Fullwidth Forms */
+#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */
+/* Bit 69 Specials */
+#define TT_UCR_SPECIALS (1L << 5) /* U+FEFF,
+ U+FFF0-U+FFFF */
+/* Bit 70 Tibetan */
+#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */
+/* Bit 71 Syriac */
+#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */
+/* Bit 72 Thaana */
+#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */
+/* Bit 73 Sinhala */
+#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */
+/* Bit 74 Myanmar */
+#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */
+/* Bit 75 Ethiopic */
+#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */
+/* Bit 76 Cherokee */
+#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */
+/* Bit 77 Unified Canadian Aboriginal Syllabics */
+#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */
+/* Bit 78 Ogham */
+#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */
+/* Bit 79 Runic */
+#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */
+/* Bit 80 Khmer */
+#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */
+/* Bit 81 Mongolian */
+#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */
+/* Bit 82 Braille Patterns */
+#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */
+/* Bit 83 Yi Syllables + */
+/* Yi Radicals */
+#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */
+ /* U+A490-U+A4CF */
+/* Bit 84 Tagalog + */
+/* Hanunoo + */
+/* Buhid + */
+/* Tagbanwa */
+#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */
+ /* U+1720-U+173F */
+ /* U+1740-U+175F */
+ /* U+1760-U+177F */
+/* Bit 85 Old Italic */
+#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/
+/* Bit 86 Gothic */
+#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/
+/* Bit 87 Deseret */
+#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/
+/* Bit 88 Byzantine Musical Symbols + */
+/* Musical Symbols */
+#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/
+ /*U+1D100-U+1D1FF*/
+/* Bit 89 Mathematical Alphanumeric Symbols */
+#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/
+/* Bit 90 Private Use (plane 15) + */
+/* Private Use (plane 16) */
+#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/
+ /*U+100000-U+10FFFD*/
+/* Bit 91 Variation Selectors */
+#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */
+/* Bit 92 Tags */
+#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/
+
+
+/* Some compilers have a very limited length of identifiers. */
+#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ ) \
+ || defined( M_I86 ) && !defined( _M_I86 )
+#define HAVE_LIMIT_ON_IDENTS
+#endif
+
+#ifndef HAVE_LIMIT_ON_IDENTS
+
+/*
+ * Here some alias #defines in order to be clearer.
+ *
+ * These are not always #defined to stay within the 31 character limit
+ * which some compilers have.
+ *
+ * Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
+ * Borland compilers (read: from BC++ 3.1 on) can increase this limit.
+ * If you get a warning with such a compiler, use the -i40 switch.
+ */
+
+#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \
+ TT_UCR_ARABIC_PRESENTATIONS_A
+#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \
+ TT_UCR_ARABIC_PRESENTATIONS_B
+
+#define TT_UCR_COMBINING_DIACRITICAL_MARKS \
+ TT_UCR_COMBINING_DIACRITICS
+#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \
+ TT_UCR_COMBINING_DIACRITICS_SYMB
+
+#endif /* ndef HAVE_LIMIT_ON_IDENTS */
+
+#endif /* FTNAMEID_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttapi.c b/Build/source/libs/freetype/lib/ttapi.c
new file mode 100644
index 00000000000..a2d86c99434
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttapi.c
@@ -0,0 +1,2220 @@
+/*******************************************************************
+ *
+ * ttapi.c
+ *
+ * High-level interface implementation
+ *
+ * Copyright 1996-2000 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.
+ *
+ * Notes:
+ *
+ * This file is used to implement most of the functions that are
+ * defined in the file "freetype.h". However, two functions are
+ * implemented elsewhere :
+ *
+ * TT_MulDiv and TT_MulFix are in ttcalc.h/ttcalc.c
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+
+#include "freetype.h"
+#include "ttengine.h"
+#include "ttcalc.h"
+#include "ttmemory.h"
+#include "ttcache.h"
+#include "ttfile.h"
+#include "ttobjs.h"
+#include "ttload.h"
+#include "ttgload.h"
+#include "ttraster.h"
+#include "ttextend.h"
+
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_api
+
+
+#ifdef TT_STATIC_RASTER
+#define RAS_OPS /* void */
+#define RAS_OP /* void */
+#else
+#define RAS_OPS ((TRaster_Instance*)_engine->raster_component),
+#define RAS_OP ((TRaster_Instance*)_engine->raster_component)
+#endif /* TT_STATIC_RASTER */
+
+
+#define RENDER_Glyph( glyph, target ) \
+ Render_Glyph( RAS_OPS glyph, target )
+
+#define RENDER_Gray_Glyph( glyph, target, palette ) \
+ Render_Gray_Glyph( RAS_OPS glyph, target, palette )
+
+
+
+/*******************************************************************
+ *
+ * Function : TT_FreeType_Version
+ *
+ * Description : Returns the major and minor version of the library.
+ *
+ * Input : major, minor addresses
+ *
+ * Output : Error code.
+ *
+ * MT-Note : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_FreeType_Version( int *major,
+ int *minor )
+ {
+ if ( !major || !minor )
+ return TT_Err_Invalid_Argument;
+
+ *major = TT_FREETYPE_MAJOR;
+ *minor = TT_FREETYPE_MINOR;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Init_FreeType
+ *
+ * Description : The library's engine initializer. This function
+ * must be called prior to any call.
+ *
+ * Input : engine pointer to a FreeType engine instance
+ *
+ * Output : Error code.
+ *
+ * MT-Note : This function should be called each time you want
+ * to create a TT_Engine. It is not necessarily thread
+ * safe depending on the implementations of ttmemory,
+ * ttfile and ttmutex, so take care. Their default
+ * implementations are safe, however.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Init_FreeType( TT_Engine* engine )
+ {
+ PEngine_Instance _engine;
+
+ TT_Error error;
+ int n;
+
+
+ /* first of all, initialize memory sub-system */
+ error = TTMemory_Init();
+ if ( error )
+ return error;
+
+ /* Allocate engine instance */
+ if ( ALLOC( _engine, sizeof ( TEngine_Instance ) ) )
+ return error;
+
+#undef TT_FAIL
+#define TT_FAIL( x ) ( error = x (_engine) ) != TT_Err_Ok
+
+ /* Initalize components */
+ if ( TT_FAIL( TTFile_Init ) ||
+ TT_FAIL( TTCache_Init ) ||
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+ TT_FAIL( TTExtend_Init ) ||
+#endif
+ TT_FAIL( TTObjs_Init ) ||
+ TT_FAIL( TTRaster_Init ) )
+ goto Fail;
+
+#undef TT_FAIL
+
+ /* set the gray palette defaults: 0 to 4 */
+ for ( n = 0; n < 5; n++ )
+ _engine->raster_palette[n] = (Byte)n; /* Conversion ok, some warn */
+
+ /* create the engine lock */
+ MUTEX_Create( _engine->lock );
+
+ HANDLE_Set( *engine, _engine );
+ return TT_Err_Ok;
+
+ Fail:
+ TT_Done_FreeType( *engine );
+ HANDLE_Set( *engine, NULL );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_FreeType
+ *
+ * Description : The library's engine finalizer. This function
+ * will discard all active face and glyph objects
+ * from the heap.
+ *
+ * Input : engine FreeType engine instance
+ *
+ * Output : Error code.
+ *
+ * MT-Note : Destroys an engine. Not necessarily thread-safe
+ * depending on the implementations of ttmemory,
+ * ttfile and ttmutex. The default implementations
+ * are safe, however.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_FreeType( TT_Engine engine )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+
+ if ( !_engine )
+ return TT_Err_Ok;
+
+ MUTEX_Destroy( _engine->lock );
+
+ TTRaster_Done( _engine );
+ TTObjs_Done ( _engine );
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+ TTExtend_Done( _engine );
+#endif
+ TTCache_Done ( _engine );
+ TTFile_Done ( _engine );
+ FREE( _engine );
+
+ TTMemory_Done();
+
+ return TT_Err_Ok;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_GRAY_SCALING
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Raster_Gray_Palette
+ *
+ * Description : Sets the gray-levels palette used for font
+ * smoothing.
+ *
+ * Input : engine FreeType engine instance
+ * palette address of palette (a 5 byte array)
+ *
+ * Output : Invalid argument if 'palette' is NULL.
+ *
+ * MT-Note: NO! Unprotected modification of an engine's palette.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Raster_Gray_Palette( TT_Engine engine,
+ Byte* palette )
+ {
+ int i;
+
+
+ if ( !palette )
+ return TT_Err_Invalid_Argument;
+
+ for ( i = 0; i < 5; i++ )
+ HANDLE_Engine( engine )->raster_palette[i] = (Byte)palette[i];
+
+ return TT_Err_Ok;
+ }
+
+#endif /* TT_CONFIG_OPTION_GRAY_SCALING */
+
+
+/*******************************************************************
+ *
+ * Function : TT_Open_Face
+ *
+ * Description : Creates a new face object from a given font file.
+ *
+ * Input : engine FreeType engine instance
+ * fontPathName the font file's pathname
+ * face adress of returned face handle
+ *
+ * Output : Error code.
+ *
+ * Note : The face handle is set to NULL in case of failure.
+ *
+ * MT-Note : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Open_Face( TT_Engine engine,
+ const TT_Text* fontPathName,
+ TT_Face* face )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+ TFont_Input input;
+ TT_Error error;
+ TT_Stream stream;
+ PFace _face;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ /* open the file */
+ error = TT_Open_Stream( fontPathName, &stream );
+ if ( error )
+ return error;
+
+ input.stream = stream;
+ input.fontIndex = 0;
+ input.engine = _engine;
+
+ /* Create and load the new face object - this is thread-safe */
+ error = CACHE_New( _engine->objs_face_cache,
+ _face,
+ &input );
+
+ /* Set the handle */
+ HANDLE_Set( *face, _face );
+
+ if ( error )
+ goto Fail;
+
+ return TT_Err_Ok;
+
+ Fail:
+ TT_Close_Stream( &stream );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Open_Collection
+ *
+ * Description : Creates a new face object from a given font file.
+ *
+ * Input : engine FreeType engine instance
+ * collectionPathName the font file's pathname
+ * fontIndex index of font in TrueType collection
+ * face adress of returned face handle
+ *
+ * Output : Error code.
+ *
+ * Note : The face handle is set to NULL in case of failure.
+ *
+ * MT-Note : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Open_Collection( TT_Engine engine,
+ const TT_Text* collectionPathName,
+ TT_ULong fontIndex,
+ TT_Face* face )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+
+ TFont_Input input;
+ TT_Error error;
+ TT_Stream stream;
+ PFace _face;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ /* open the file */
+ error = TT_Open_Stream( collectionPathName, &stream );
+ if ( error )
+ return error;
+
+ input.stream = stream;
+ input.fontIndex = fontIndex;
+ input.engine = _engine;
+
+ /* Create and load the new face object - this is thread-safe */
+ error = CACHE_New( _engine->objs_face_cache,
+ _face,
+ &input );
+
+ /* Set the handle */
+ HANDLE_Set( *face, _face );
+
+ if ( error )
+ goto Fail;
+
+ return TT_Err_Ok;
+
+ Fail:
+ TT_Close_Stream( &stream );
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Face_Properties
+ *
+ * Description : Returns face properties.
+ *
+ * Input : face the face handle
+ * properties address of target properties record
+ *
+ * Output : Error code.
+ *
+ * Note : Currently, max_Faces is always set to 0.
+ *
+ * MT-Note : YES! Reads only permanent data.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Face_Properties( TT_Face face,
+ TT_Face_Properties* properties )
+ {
+ PFace _face = HANDLE_Face( face );
+
+
+ if ( !_face )
+ return TT_Err_Invalid_Face_Handle;
+
+ properties->num_Glyphs = _face->numGlyphs;
+ properties->max_Points = _face->maxPoints;
+ properties->max_Contours = _face->maxContours;
+ properties->num_CharMaps = _face->numCMaps;
+ properties->num_Names = _face->nameTable.numNameRecords;
+
+ if ( _face->ttcHeader.DirCount == 0 )
+ properties->num_Faces = 1;
+ else
+ properties->num_Faces = _face->ttcHeader.DirCount;
+
+ properties->header = &_face->fontHeader;
+ properties->horizontal = &_face->horizontalHeader;
+
+ if ( _face->verticalInfo )
+ properties->vertical = &_face->verticalHeader;
+ else
+ properties->vertical = NULL;
+
+ properties->os2 = &_face->os2;
+ properties->postscript = &_face->postscript;
+ properties->hdmx = &_face->hdmx;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Face_Pointer
+ *
+ * Description : Each face object has one pointer, which use is
+ * reserved to client applications. The TrueType
+ * engine never accesses or uses this field.
+ *
+ * This function is used to set the pointer.
+ *
+ * Input : face the given face handle
+ * data the generic pointer value
+ *
+ * Output : Error code.
+ *
+ * MT-Note : NO! But this function is reserved to "enlightened"
+ * developers, so it shouldn't be a problem.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Face_Pointer( TT_Face face,
+ void* data )
+ {
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+ else
+ faze->generic = data;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Face_Pointer
+ *
+ * Description : Each face object has one pointer, which use is
+ * reserved to client applications. The TrueType
+ * engine never access or use this field.
+ *
+ * This function is used to read the pointer.
+ *
+ * Input : face the given face handle
+ * data the generic pointer value
+ *
+ * Output : Error code.
+ *
+ * MT-Note : NO! But this function is reserved to "enlightened"
+ * developers, so it shouldn't be a problem.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( void* )
+ TT_Get_Face_Pointer( TT_Face face )
+ {
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return NULL;
+ else
+ return faze->generic;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Face_Metrics
+ *
+ * Description : This function returns the original horizontal AND
+ * vertical metrics as found in the "hmtx" and "vmtx"
+ * tables. These are the glyphs' left-side-bearings
+ * and advance widths (horizontal), as well as top
+ * side bearings and advance heights (vertical).
+ *
+ * All are expressed in FONT UNITS, a.k.a. EM
+ * units.
+ *
+ * Input : face The given face handle.
+ * first Index of first glyph in table.
+ * last Index of last glyph in table.
+ *
+ * leftBearings A pointer to an array of TT_Shorts where the
+ * left side bearings for the glyphs 'first'
+ * to 'last' will be returned. If these metrics
+ * don't interest you, simply set it to NULL.
+ *
+ * widths A pointer to an array of TT_UShorts
+ * where the advance widths for the glyphs
+ * 'first' to 'last' will be returned. If these
+ * metrics don't interest you, simply set it
+ * to NULL.
+ *
+ * topBearings A pointer to an array of TT_Shorts where the
+ * top side bearings for the glyphs 'first'
+ * to 'last' will be returned. If these metrics
+ * don't interest you, simply set it to NULL.
+ *
+ * heights A pointer to an array of TT_UShorts
+ * where the advance heights for the glyphs
+ * 'first' to 'last' will be returned. If these
+ * metrics don't interest you, simply set it
+ * to NULL.
+ *
+ * Output : Error code.
+ *
+ * IMPORTANT NOTE :
+ *
+ * As vertical metrics are optional in a TrueType font, this
+ * function will return an error ( TT_Err_No_Vertical_Data )
+ * whenever this function is called on such a face with non-NULL
+ * 'topBearings' or 'heights' arguments.
+ *
+ * When a font has no vertical data, the 'vertical' field in its
+ * properties structure is set to NULL.
+ *
+ * MT-Note : YES! Reads only permanent data.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Face_Metrics( TT_Face face,
+ TT_UShort firstGlyph,
+ TT_UShort lastGlyph,
+ TT_Short* leftBearings,
+ TT_UShort* widths,
+ TT_Short* topBearings,
+ TT_UShort* heights )
+ {
+ PFace _face = HANDLE_Face( face );
+ UInt num;
+
+
+ if ( !_face )
+ return TT_Err_Invalid_Face_Handle;
+
+ /* Check the glyph range */
+ if ( lastGlyph >= _face->numGlyphs || firstGlyph > lastGlyph )
+ return TT_Err_Invalid_Argument;
+
+ num = lastGlyph - firstGlyph; /* number of elements-1 in each array */
+
+ /* store the left side bearings and advance widths first */
+ {
+ UShort n;
+ Short left_bearing;
+ UShort advance_width;
+
+
+ for ( n = 0; n <= num; n++ )
+ {
+ TT_Get_Metrics( &_face->horizontalHeader,
+ firstGlyph + n, &left_bearing, &advance_width );
+
+ if ( leftBearings ) leftBearings[n] = left_bearing;
+ if ( widths ) widths[n] = advance_width;
+ }
+ }
+
+ /* check for vertical data if topBearings or heights is non-NULL */
+ if ( !topBearings && !heights )
+ return TT_Err_Ok;
+
+ if ( !_face->verticalInfo )
+ return TT_Err_No_Vertical_Data;
+
+ /* store the top side bearings */
+ {
+ UShort n;
+ Short top_bearing;
+ UShort advance_height;
+
+ for ( n = 0; n <= num; n++ )
+ {
+ TT_Get_Metrics( (TT_Horizontal_Header*)&_face->verticalHeader,
+ firstGlyph + n, &top_bearing, &advance_height );
+
+ if ( topBearings ) topBearings[n] = top_bearing;
+ if ( heights ) heights[n] = advance_height;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Flush_Face
+ *
+ * Description : This function is used to close an active face's
+ * file handle or descriptor. This is useful to save
+ * system resources, if your application uses tons
+ * of fonts.
+ *
+ * Input : face the given face handle
+ *
+ * Output : Error code.
+ *
+ * MT-Note : YES! (If ttfile is.)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Flush_Face( TT_Face face )
+ {
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+ else
+ return TT_Flush_Stream( &faze->stream );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Close_Face
+ *
+ * Description : Closes an opened face object. This function
+ * will destroy all objects associated to the
+ * face, except the glyphs.
+ *
+ * Input : face the given face handle
+ *
+ * Output : Error code.
+ *
+ * NOTE : The handle is set to NULL on exit.
+ *
+ * MT-Note : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Close_Face( TT_Face face )
+ {
+ PFace _face = HANDLE_Face( face );
+
+
+ if ( !_face )
+ return TT_Err_Invalid_Face_Handle;
+
+ TT_Close_Stream( &_face->stream );
+
+ /* delete the face object -- this is thread-safe */
+ return CACHE_Done( _face->engine->objs_face_cache, _face );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_New_Instance
+ *
+ * Description : Creates a new instance from a given face.
+ *
+ * Input : face parent face handle
+ * instance address of instance handle
+ *
+ * Output : Error code.
+ *
+ * Note : The handle is set to NULL in case of failure.
+ *
+ * MT-Note : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_New_Instance( TT_Face face,
+ TT_Instance* instance )
+ {
+ TT_Error error;
+ PFace _face = HANDLE_Face( face );
+ PInstance _ins;
+
+
+ if ( !_face )
+ return TT_Err_Invalid_Face_Handle;
+
+ /* get a new instance from the face's cache -- this is thread-safe */
+ error = CACHE_New( &_face->instances, _ins, _face );
+
+ HANDLE_Set( *instance, _ins );
+
+ if ( !error )
+ {
+ error = Instance_Init( _ins );
+ if ( error )
+ {
+ HANDLE_Set( *instance, NULL );
+ CACHE_Done( &_face->instances, _ins );
+ }
+ }
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Instance_Resolutions
+ *
+ * Description : Resets an instance to a new device resolution.
+ *
+ * Input : instance the instance handle
+ * xResolution new horizontal device resolution in dpi
+ * yResolution new vertical device resolution in dpi
+ *
+ * Output : Error code.
+ *
+ * Note : There is no check for overflow; with other words,
+ * the product of glyph dimensions times the device
+ * resolutions must have reasonable values.
+ *
+ * MT-Note : You should set the charsize or pixel size immediately
+ * after this call in multi-threaded programs. This will
+ * force the instance data to be resetted. Otherwise, you
+ * may encounter corruption when loading two glyphs from
+ * the same instance concurrently!
+ *
+ * Happily, 99.99% will do just that :-)
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Instance_Resolutions( TT_Instance instance,
+ TT_UShort xResolution,
+ TT_UShort yResolution )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ ins->metrics.x_resolution = xResolution;
+ ins->metrics.y_resolution = yResolution;
+ ins->valid = FALSE;
+
+ /* In the case of a thread-safe implementation, we immediately */
+ /* call Instance_Reset in order to change the instance's variable */
+
+ /* In the case of a non-threaded build, we simply set the 'valid' */
+ /* flag to FALSE, which will force the instance's resetting at */
+ /* the next glyph loading */
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Instance_CharSizes
+ *
+ * Description : Resets an instance to new point size.
+ *
+ * Input : instance the instance handle
+ * charWidth the new width in 26.6 char points
+ * charHeight the new height in 26.6 char points
+ *
+ * Output : Error code.
+ *
+ * Note : There is no check for overflow; with other words,
+ * the product of glyph dimensions times the device
+ * resolution must have reasonable values.
+ *
+ * MT-Note : NO! This should be called only when setting/resetting
+ * instances, so there is no need to protect.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Instance_CharSizes( TT_Instance instance,
+ TT_F26Dot6 charWidth,
+ TT_F26Dot6 charHeight )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ if ( charWidth < 1 * 64 )
+ charWidth = 1 * 64;
+
+ if ( charHeight < 1 * 64 )
+ charHeight = 1 * 64;
+
+ ins->metrics.x_scale1 = ( charWidth * ins->metrics.x_resolution ) / 72;
+ ins->metrics.x_scale2 = ins->owner->fontHeader.Units_Per_EM;
+
+ ins->metrics.y_scale1 = ( charHeight * ins->metrics.y_resolution ) / 72;
+ ins->metrics.y_scale2 = ins->owner->fontHeader.Units_Per_EM;
+
+ if ( ins->owner->fontHeader.Flags & 8 )
+ {
+ ins->metrics.x_scale1 = (ins->metrics.x_scale1+32) & -64;
+ ins->metrics.y_scale1 = (ins->metrics.y_scale1+32) & -64;
+ }
+
+ ins->metrics.x_ppem = ins->metrics.x_scale1 / 64;
+ ins->metrics.y_ppem = ins->metrics.y_scale1 / 64;
+
+ if ( charWidth > charHeight )
+ ins->metrics.pointSize = charWidth;
+ else
+ ins->metrics.pointSize = charHeight;
+
+ ins->valid = FALSE;
+
+ return Instance_Reset( ins );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Instance_CharSize
+ *
+ * Description : Resets an instance to new point size.
+ *
+ * Input : instance the instance handle
+ * charSize the new character size in 26.6 char points
+ *
+ * Output : Error code.
+ *
+ * Note : There is no check for overflow; with other words,
+ * the product of glyph dimensions times the device
+ * resolution must have reasonable values.
+ *
+ * MT-Note : NO! This should be called only when setting/resetting
+ * instances, so there is no need to protect.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Instance_CharSize( TT_Instance instance,
+ TT_F26Dot6 charSize )
+ {
+ return TT_Set_Instance_CharSizes( instance, charSize, charSize );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Instance_PixelSizes
+ *
+ * Description : Resets an instance to new pixel sizes
+ *
+ * Input : instance the instance handle
+ * pixelWidth the new width in pixels
+ * pixelHeight the new height in pixels
+ *
+ * Output : Error code.
+ *
+ * Note : There is no check for overflow; with other words,
+ * the product of glyph dimensions times the device
+ * resolution must have reasonable values.
+ *
+ * MT-Note : NO! This should be called only when setting/resetting
+ * instances, so there is no need to protect.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Instance_PixelSizes( TT_Instance instance,
+ TT_UShort pixelWidth,
+ TT_UShort pixelHeight,
+ TT_F26Dot6 pointSize )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ if ( pixelWidth < 1 ) pixelWidth = 1;
+ if ( pixelHeight < 1 ) pixelHeight = 1;
+
+ ins->metrics.x_ppem = pixelWidth;
+ ins->metrics.y_ppem = pixelHeight;
+ ins->metrics.pointSize = pointSize;
+
+ ins->metrics.x_scale1 = ins->metrics.x_ppem * 64L;
+ ins->metrics.x_scale2 = ins->owner->fontHeader.Units_Per_EM;
+ ins->metrics.y_scale1 = ins->metrics.y_ppem * 64L;
+ ins->metrics.y_scale2 = ins->owner->fontHeader.Units_Per_EM;
+
+ ins->valid = FALSE;
+
+ return Instance_Reset( ins );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Instance_Transform_Flags
+ *
+ * Description : Informs the interpreter about the transformations
+ * that will be applied to the rendered glyphs.
+ *
+ * Input : instance the instance handle
+ * rotated set to TRUE if the glyph are rotated
+ * stretched set to TRUE if the glyph are stretched
+ *
+ * Output : Error code.
+ *
+ * Note : This function is deprecated! It's much better to
+ * control hinting manually when calling TT_Load_Glyph
+ * than relying on the font programs...
+ *
+ * Never use it, unless calling for trouble ;-)
+ *
+ * MT-Note : NO! This should be called only when setting/resetting
+ * instances, so there is no need to protect.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Instance_Transform_Flags( TT_Instance instance,
+ TT_Bool rotated,
+ TT_Bool stretched )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ ins->metrics.rotated = rotated;
+ ins->metrics.stretched = stretched;
+ ins->valid = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Instance_Metrics
+ *
+ * Description : Returns instance metrics.
+ *
+ * Input : instance the instance handle
+ * metrics address of target instance metrics record
+ *
+ * Output : Error code.
+ *
+ * MT-Note : YES! Reads only semi-permanent data.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Instance_Metrics( TT_Instance instance,
+ TT_Instance_Metrics* metrics )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ if ( !ins->valid )
+ Instance_Reset( ins );
+
+ metrics->pointSize = ins->metrics.pointSize;
+
+ metrics->x_scale = TT_MulDiv( 0x10000,
+ ins->metrics.x_scale1,
+ ins->metrics.x_scale2 );
+
+ metrics->y_scale = TT_MulDiv( 0x10000,
+ ins->metrics.y_scale1,
+ ins->metrics.y_scale2 );
+
+ metrics->x_resolution = ins->metrics.x_resolution;
+ metrics->y_resolution = ins->metrics.y_resolution;
+ metrics->x_ppem = ins->metrics.x_ppem;
+ metrics->y_ppem = ins->metrics.y_ppem;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Set_Instance_Pointer
+ *
+ * Description : Each instance has one pointer, which use is
+ * reserved to client applications. The TrueType
+ * engine never accesses or uses this field.
+ *
+ * This function is used to set the pointer.
+ *
+ * Input : face the given face handle
+ * data the generic pointer value
+ *
+ * Output : Error code.
+ *
+ * MT-Note : NO!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Set_Instance_Pointer( TT_Instance instance,
+ void* data )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+ else
+ ins->generic = data;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Instance_Pointer
+ *
+ * Description : Each instance has one pointer, which use is
+ * reserved to client applications. The TrueType
+ * engine never accesses or uses this field.
+ *
+ * This function is used to read the pointer.
+ *
+ * Input : face the given face handle
+ * data the generic pointer value
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : NO!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( void* )
+ TT_Get_Instance_Pointer( TT_Instance instance )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return NULL;
+ else
+ return ins->generic;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Instance
+ *
+ * Description : Closes a given instance.
+ *
+ * Input : instance address of instance handle
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Instance( TT_Instance instance )
+ {
+ PInstance ins = HANDLE_Instance( instance );
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ /* delete the instance -- this is thread-safe */
+ return CACHE_Done( &ins->owner->instances, ins );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_New_Glyph
+ *
+ * Description : Creates a new glyph object related to a given
+ * face.
+ *
+ * Input : face the face handle
+ * glyph address of target glyph handle
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_New_Glyph( TT_Face face,
+ TT_Glyph* glyph )
+ {
+ TT_Error error;
+ PFace _face = HANDLE_Face( face );
+ PGlyph _glyph;
+
+
+ if ( !_face )
+ return TT_Err_Invalid_Face_Handle;
+
+ /* get a new glyph from the face's cache -- this is thread-safe */
+ error = CACHE_New( &_face->glyphs, _glyph, _face );
+
+ HANDLE_Set( *glyph, _glyph );
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Glyph
+ *
+ * Description : Destroys a given glyph object.
+ *
+ * Input : glyph the glyph handle
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Glyph( TT_Glyph glyph )
+ {
+ PGlyph _glyph = HANDLE_Glyph( glyph );
+
+
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ /* delete the engine -- this is thread-safe */
+ return CACHE_Done( &_glyph->face->glyphs, _glyph );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Load_Glyph
+ *
+ * Description : Loads a glyph.
+ *
+ * Input : instance the instance handle
+ * glyph the glyph handle
+ * glyphIndex the glyph index
+ * loadFlags flags controlling how to load the glyph
+ * (none, scaled, hinted, both)
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Load_Glyph( TT_Instance instance,
+ TT_Glyph glyph,
+ TT_UShort glyphIndex,
+ TT_UShort loadFlags )
+ {
+ PInstance _ins;
+ PGlyph _glyph;
+ TT_Error error;
+
+
+ _ins = HANDLE_Instance( instance );
+
+ if ( !_ins )
+ loadFlags &= ~(TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH);
+
+ if ( (loadFlags & TTLOAD_SCALE_GLYPH) == 0 )
+ _ins = 0;
+
+ _glyph = HANDLE_Glyph( glyph );
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ if ( _ins )
+ {
+ if ( _ins->owner != _glyph->face )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( !_ins->valid )
+ {
+ /* This code can only be called in non thread-safe builds */
+ error = Instance_Reset( _ins );
+ if ( error )
+ return error;
+ }
+ }
+
+ return Load_TrueType_Glyph( _ins, _glyph, glyphIndex, loadFlags );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Glyph_Outline
+ *
+ * Description : Returns the glyph's outline data.
+ *
+ * Input : glyph the glyph handle
+ * outline address where the glyph outline will be returned
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES! Reads only semi-permanent data.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Glyph_Outline( TT_Glyph glyph,
+ TT_Outline* outline )
+ {
+ PGlyph _glyph = HANDLE_Glyph( glyph );
+
+
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ *outline = _glyph->outline;
+ outline->owner = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Glyph_Metrics
+ *
+ * Description : Extracts the glyph's horizontal metrics information.
+ *
+ * Input : glyph glyph object handle
+ * metrics address where metrics will be returned
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : NO! Glyph containers can't be shared.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Glyph_Metrics( TT_Glyph glyph,
+ TT_Glyph_Metrics* metrics )
+ {
+ PGlyph _glyph = HANDLE_Glyph( glyph );
+
+
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ metrics->bbox = _glyph->metrics.bbox;
+ metrics->bearingX = _glyph->metrics.horiBearingX;
+ metrics->bearingY = _glyph->metrics.horiBearingY;
+ metrics->advance = _glyph->metrics.horiAdvance;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Glyph_Big_Metrics
+ *
+ * Description : Extracts the glyph's big metrics information.
+ *
+ * Input : glyph glyph object handle
+ * metrics address where big metrics will be returned
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : NO! Glyph containers can't be shared.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Glyph_Big_Metrics( TT_Glyph glyph,
+ TT_Big_Glyph_Metrics* metrics )
+ {
+ PGlyph _glyph = HANDLE_Glyph( glyph );
+
+
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ *metrics = _glyph->metrics;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Glyph_Bitmap
+ *
+ * Description : Produces a bitmap from a glyph outline.
+ *
+ * Input : glyph the glyph container's handle
+ * bitmap target bitmap description block
+ * xOffset x offset in fractional pixels (26.6 format)
+ * yOffset y offset in fractional pixels (26.6 format)
+ *
+ * Output : Error code.
+ *
+ * Note : Only use integer pixel offsets if you want to preserve
+ * the fine hints applied to the outline. This means that
+ * xOffset and yOffset must be multiples of 64!
+ *
+ * MT-Safe : NO! Glyph containers can't be shared.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Glyph_Bitmap( TT_Glyph glyph,
+ TT_Raster_Map* bitmap,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset )
+ {
+ PEngine_Instance _engine;
+ TT_Engine engine;
+ TT_Error error;
+ PGlyph _glyph = HANDLE_Glyph( glyph );
+
+ TT_Outline outline;
+
+
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ _engine = _glyph->face->engine;
+ HANDLE_Set( engine, _engine );
+
+ outline = _glyph->outline;
+ /* XXX : For now, use only dropout mode 2 */
+ /* outline.dropout_mode = _glyph->scan_type; */
+ outline.dropout_mode = 2;
+
+ TT_Translate_Outline( &outline, xOffset, yOffset );
+ error = TT_Get_Outline_Bitmap( engine, &outline, bitmap );
+ TT_Translate_Outline( &outline, -xOffset, -yOffset );
+
+ return error;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_GRAY_SCALING
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Glyph_Pixmap
+ *
+ * Description : Produces a grayscaled pixmap from a glyph
+ * outline.
+ *
+ * Input : glyph the glyph container's handle
+ * pixmap target pixmap description block
+ * xOffset x offset in fractional pixels (26.6 format)
+ * yOffset y offset in fractional pixels (26.6 format)
+ *
+ * Output : Error code.
+ *
+ * Note : Only use integer pixel offsets to preserve the fine
+ * hinting of the glyph and the 'correct' anti-aliasing
+ * (where vertical and horizontal stems aren't grayed).
+ * This means that xOffset and yOffset must be multiples
+ * of 64!
+ *
+ * You can experiment with offsets of +32 to get 'blurred'
+ * versions of the glyphs (a nice effect at large sizes that
+ * some graphic designers may appreciate :)
+ *
+ * MT-Safe : NO! Glyph containers can't be shared.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Glyph_Pixmap( TT_Glyph glyph,
+ TT_Raster_Map* pixmap,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset )
+ {
+ PEngine_Instance _engine;
+ TT_Engine engine;
+ TT_Error error;
+ PGlyph _glyph = HANDLE_Glyph( glyph );
+
+ TT_Outline outline;
+
+
+ if ( !_glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ _engine = _glyph->face->engine;
+ HANDLE_Set(engine,_engine);
+
+ outline = _glyph->outline;
+ /* XXX : For now, use only dropout mode 2 */
+ /* outline.dropout_mode = _glyph->scan_type; */
+ outline.dropout_mode = 2;
+
+ TT_Translate_Outline( &outline, xOffset, yOffset );
+ error = TT_Get_Outline_Pixmap( engine, &outline, pixmap );
+ TT_Translate_Outline( &outline, -xOffset, -yOffset );
+
+ return error;
+ }
+
+#endif /* TT_CONFIG_OPTION_GRAY_SCALING */
+
+
+ static const TT_Outline null_outline
+ = { 0, 0, NULL, NULL, NULL, 0, 0, 0, 0 };
+
+
+/*******************************************************************
+ *
+ * Function : TT_New_Outline
+ *
+ * Description : Creates a new TrueType outline, reserving
+ * array space for a given number of points and
+ * contours.
+ *
+ * Input : numPoints number of points
+ * numContours number of contours
+ * outline address of target outline structure
+ *
+ * Output : Error code
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_New_Outline( TT_UShort numPoints,
+ TT_Short numContours,
+ TT_Outline* outline )
+ {
+ TT_Error error;
+
+
+ if ( !outline )
+ return TT_Err_Invalid_Argument;
+
+ *outline = null_outline;
+
+ if ( ALLOC( outline->points, numPoints*2*sizeof ( TT_F26Dot6 ) ) ||
+ ALLOC( outline->flags, numPoints *sizeof ( Byte ) ) ||
+ ALLOC( outline->contours, numContours*sizeof ( UShort ) ) )
+ goto Fail;
+
+ outline->n_points = numPoints;
+ outline->n_contours = numContours;
+ outline->owner = TRUE;
+ return TT_Err_Ok;
+
+ Fail:
+ outline->owner = TRUE;
+ TT_Done_Outline( outline );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Outline
+ *
+ * Description : Deletes an outline created through TT_New_Outline().
+ * Calling this function for outlines returned
+ * by TT_Get_Glyph_Outline() yields an error.
+ *
+ * Input : outline address of outline
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Outline( TT_Outline* outline )
+ {
+ if ( outline )
+ {
+ if ( outline->owner )
+ {
+ FREE( outline->points );
+ FREE( outline->flags );
+ FREE( outline->contours );
+ }
+ *outline = null_outline;
+ return TT_Err_Ok;
+ }
+ else
+ return TT_Err_Invalid_Argument;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Outline_Bitmap
+ *
+ * Description : Render a TrueType outline into a bitmap.
+ * Note that the bitmap must be created by the caller.
+ *
+ * Input : outline the outline to render
+ * bitmap the target bitmap
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Outline_Bitmap( TT_Engine engine,
+ TT_Outline* outline,
+ TT_Raster_Map* bitmap )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+ TT_Error error;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ if ( !outline || !bitmap )
+ return TT_Err_Invalid_Argument;
+
+ MUTEX_Lock( _engine->raster_lock );
+ error = RENDER_Glyph( outline, bitmap );
+ MUTEX_Release( _engine->raster_lock );
+
+ return error;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_GRAY_SCALING
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Outline_Pixmap
+ *
+ * Description : Render a TrueType outline into a pixmap.
+ * Note that the pixmap must be created by the caller.
+ *
+ * Input : outline the outline to render
+ * pixmap the target pixmap
+ *
+ * Output : Error code
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Outline_Pixmap( TT_Engine engine,
+ TT_Outline* outline,
+ TT_Raster_Map* pixmap )
+ {
+ PEngine_Instance _engine = HANDLE_Engine( engine );
+ TT_Error error;
+
+
+ if ( !_engine )
+ return TT_Err_Invalid_Engine;
+
+ if ( !outline || !pixmap )
+ return TT_Err_Invalid_Argument;
+
+ MUTEX_Lock( _engine->raster_lock );
+ error = RENDER_Gray_Glyph( outline, pixmap, _engine->raster_palette );
+ MUTEX_Release( _engine->raster_lock );
+ return error;
+ }
+
+#endif /* TT_CONFIG_OPTION_GRAY_SCALING */
+
+
+/*******************************************************************
+ *
+ * Function : TT_Copy_Outline
+ *
+ * Description : Copy an outline into another. The source and
+ * target outlines must have the same points and
+ * contours numbers.
+ *
+ * Input : source address of source outline
+ * target address of target outline
+ *
+ * Output : Error code
+ *
+ * Note : This function doesn't touch the target outline's 'owner'
+ * field.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Copy_Outline( TT_Outline* source,
+ TT_Outline* target )
+ {
+ if ( !source || !target ||
+ source->n_points != target->n_points ||
+ source->n_contours != target->n_contours )
+ return TT_Err_Invalid_Argument;
+
+ MEM_Copy( target->points, source->points,
+ source->n_points * 2 * sizeof ( TT_F26Dot6 ) );
+
+ MEM_Copy( target->flags, source->flags,
+ source->n_points * sizeof ( Byte ) );
+
+ MEM_Copy( target->contours, source->contours,
+ source->n_contours * sizeof ( Short ) );
+
+ target->high_precision = source->high_precision;
+ target->second_pass = target->second_pass;
+ target->dropout_mode = source->dropout_mode;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Transform_Outline
+ *
+ * Description : Applies a simple transformation to an outline.
+ *
+ * Input : outline the glyph's outline. Can be extracted
+ * from a glyph container through
+ * TT_Get_Glyph_Outline().
+ *
+ * matrix simple matrix with 16.16 fixed floats
+ *
+ * Output : Error code (always TT_Err_Ok).
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( void )
+ TT_Transform_Outline( TT_Outline* outline,
+ TT_Matrix* matrix )
+ {
+ UShort n;
+ TT_F26Dot6 x, y;
+ TT_Vector* vec;
+
+
+ vec = outline->points;
+ for ( n = 0; n < outline->n_points; n++ )
+ {
+ x = TT_MulFix( vec->x, matrix->xx ) +
+ TT_MulFix( vec->y, matrix->xy );
+
+ y = TT_MulFix( vec->x, matrix->yx ) +
+ TT_MulFix( vec->y, matrix->yy );
+
+ vec->x = x;
+ vec->y = y;
+ vec++;
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Transform_Vector
+ *
+ * Description : Apply a simple transform to a vector
+ *
+ * Input : x, y the vector.
+ *
+ * matrix simple matrix with 16.16 fixed floats
+ *
+ * Output : None.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( void )
+ TT_Transform_Vector( TT_F26Dot6* x,
+ TT_F26Dot6* y,
+ TT_Matrix* matrix )
+ {
+ TT_F26Dot6 xz, yz;
+
+
+ xz = TT_MulFix( *x, matrix->xx ) +
+ TT_MulFix( *y, matrix->xy );
+
+ yz = TT_MulFix( *x, matrix->yx ) +
+ TT_MulFix( *y, matrix->yy );
+
+ *x = xz;
+ *y = yz;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Translate_Outline
+ *
+ * Description : Applies a simple translation.
+ *
+ * Input : outline no comment :)
+ * xOffset
+ * yOffset
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( void )
+ TT_Translate_Outline( TT_Outline* outline,
+ TT_F26Dot6 xOffset,
+ TT_F26Dot6 yOffset )
+ {
+ UShort n;
+ TT_Vector* vec = outline->points;
+
+
+ for ( n = 0; n < outline->n_points; n++ )
+ {
+ vec->x += xOffset;
+ vec->y += yOffset;
+ vec++;
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Outline_BBox
+ *
+ * Description : Returns an outline's bounding box.
+ *
+ * Input : outline no comment :)
+ * bbox address where the bounding box is returned
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Outline_BBox( TT_Outline* outline,
+ TT_BBox* bbox )
+ {
+ TT_F26Dot6 x, y;
+ UShort k;
+
+
+ if ( outline && bbox )
+ {
+ if ( outline->n_points == 0 )
+ {
+ bbox->xMin = 0;
+ bbox->yMin = 0;
+ bbox->xMax = 0;
+ bbox->yMax = 0;
+ }
+ else
+ {
+ TT_Vector* vec = outline->points;
+
+ bbox->xMin = bbox->xMax = vec->x;
+ bbox->yMin = bbox->yMax = vec->y;
+ vec++;
+
+ for ( k = 1; k < outline->n_points; k++ )
+ {
+ x = vec->x;
+ if ( x < bbox->xMin ) bbox->xMin = x;
+ if ( x > bbox->xMax ) bbox->xMax = x;
+ y = vec->y;
+ if ( y < bbox->yMin ) bbox->yMin = y;
+ if ( y > bbox->yMax ) bbox->yMax = y;
+ vec++;
+ }
+ }
+ return TT_Err_Ok;
+ }
+ else
+ return TT_Err_Invalid_Argument;
+ }
+
+
+
+ /* ----------------- character mappings support ------------- */
+
+/*******************************************************************
+ *
+ * Function : TT_Get_CharMap_Count
+ *
+ * Description : Returns the number of charmaps in a given face.
+ *
+ * Input : face face object handle
+ *
+ * Output : Number of tables. -1 in case of error (bad handle).
+ *
+ * Note : DON'T USE THIS FUNCTION! IT HAS BEEN DEPRECATED!
+ *
+ * It is retained for backwards compatibility only and will
+ * fail on 16bit systems.
+ *
+ * MT-Safe : YES !
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( int )
+ TT_Get_CharMap_Count( TT_Face face )
+ {
+ PFace faze = HANDLE_Face( face );
+
+ return ( faze ? faze->numCMaps : -1 );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_CharMap_ID
+ *
+ * Description : Returns the ID of a given charmap.
+ *
+ * Input : face face object handle
+ * charmapIndex index of charmap in directory
+ * platformID address of returned platform ID
+ * encodingID address of returned encoding ID
+ *
+ * Output : error code
+ *
+ * MT-Safe : YES !
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_CharMap_ID( TT_Face face,
+ TT_UShort charmapIndex,
+ TT_UShort* platformID,
+ TT_UShort* encodingID )
+ {
+ PCMapTable cmap;
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( charmapIndex >= faze->numCMaps )
+ return TT_Err_Invalid_Argument;
+
+ cmap = faze->cMaps + charmapIndex;
+
+ *platformID = cmap->platformID;
+ *encodingID = cmap->platformEncodingID;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_CharMap
+ *
+ * Description : Looks up a charmap.
+ *
+ * Input : face face object handle
+ * charmapIndex index of charmap in directory
+ * charMap address of returned charmap handle
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_CharMap( TT_Face face,
+ TT_UShort charmapIndex,
+ TT_CharMap* charMap )
+ {
+ TT_Error error;
+ TT_Stream stream;
+ PCMapTable cmap;
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( charmapIndex >= faze->numCMaps )
+ return TT_Err_Invalid_Argument;
+
+ cmap = faze->cMaps + charmapIndex;
+
+ /* Load table if needed */
+ error = TT_Err_Ok;
+
+ /* MT-NOTE: We're modifying the face object, so protect it. */
+ MUTEX_Lock( faze->lock );
+
+ if ( !cmap->loaded )
+ {
+ (void)USE_Stream( faze->stream, stream );
+ if ( !error )
+ {
+ error = CharMap_Load( cmap, stream );
+ DONE_Stream( stream );
+ }
+
+ if ( error )
+ cmap = NULL;
+ else
+ cmap->loaded = TRUE;
+ }
+ MUTEX_Release( faze->lock );
+
+ HANDLE_Set( *charMap, cmap );
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Char_Index
+ *
+ * Description : Returns the glyph index corresponding to
+ * a given character code defined for the 'charmap'.
+ *
+ * Input : charMap charmap handle
+ * charcode character code
+ *
+ * Output : glyph index.
+ *
+ * Notes : Character code 0 is the unknown glyph, which should never
+ * be displayed.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_UShort )
+ TT_Char_Index( TT_CharMap charMap,
+ TT_ULong charCode )
+ {
+ PCMapTable cmap = HANDLE_CharMap( charMap );
+
+
+ if ( !cmap )
+ return 0; /* we return 0 in case of invalid char map */
+
+ return CharMap_Index( cmap, charCode );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Name_Count
+ *
+ * Description : Returns the number of strings found in the
+ * name table.
+ *
+ * Input : face face handle
+ *
+ * Output : number of strings.
+ *
+ * Notes : Returns -1 on error (invalid handle).
+ *
+ * DON'T USE THIS FUNCTION! IT HAS BEEN DEPRECATED!
+ *
+ * It is retained for backwards compatibility only and will
+ * fail on 16bit systems.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( int )
+ TT_Get_Name_Count( TT_Face face )
+ {
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return -1;
+
+ return faze->nameTable.numNameRecords;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Name_ID
+ *
+ * Description : Returns the IDs of the string number 'nameIndex'
+ * in the name table of a given face.
+ *
+ * Input : face face handle
+ * nameIndex index of string. First is 0
+ * platformID addresses of returned IDs
+ * encodingID
+ * languageID
+ * nameID
+ *
+ * Output : Error code.
+ *
+ * Notes : Some files have a corrupt or unusual name table, with some
+ * entries having a platformID > 3. These can usually
+ * be ignored by a client application.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Name_ID( TT_Face face,
+ TT_UShort nameIndex,
+ TT_UShort* platformID,
+ TT_UShort* encodingID,
+ TT_UShort* languageID,
+ TT_UShort* nameID )
+ {
+ TNameRec* namerec;
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( nameIndex >= faze->nameTable.numNameRecords )
+ return TT_Err_Invalid_Argument;
+
+ namerec = faze->nameTable.names + nameIndex;
+
+ *platformID = namerec->platformID;
+ *encodingID = namerec->encodingID;
+ *languageID = namerec->languageID;
+ *nameID = namerec->nameID;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Name_String
+ *
+ * Description : Returns the address and length of a given
+ * string found in the name table.
+ *
+ * Input : face face handle
+ * nameIndex string index
+ * stringPtr address of returned pointer to string
+ * length address of returned string length
+ *
+ * Output : Error code.
+ *
+ * Notes : If the string's platformID is invalid,
+ * stringPtr is NULL, and length is 0.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Name_String( TT_Face face,
+ TT_UShort nameIndex,
+ TT_String** stringPtr,
+ TT_UShort* length )
+ {
+ TNameRec* namerec;
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( nameIndex >= faze->nameTable.numNameRecords )
+ return TT_Err_Invalid_Argument;
+
+ namerec = faze->nameTable.names + nameIndex;
+
+ *stringPtr = (String*)namerec->string;
+ *length = namerec->stringLength;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Get_Font_Data
+ *
+ * Description : Loads any font table into client memory.
+ *
+ * Input : face Face object to look for.
+ *
+ * tag Tag of table to load. Use the value 0 if you
+ * want to access the whole font file, else set
+ * this parameter to a valid TrueType table tag
+ * that you can forge with the MAKE_TT_TAG
+ * macro.
+ *
+ * offset Starting offset in the table (or the file
+ * if tag == 0).
+ *
+ * buffer Address of target buffer
+ *
+ * length Address of decision variable:
+ *
+ * if length == NULL:
+ * Load the whole table. Returns an
+ * error if 'offset' != 0.
+ *
+ * if *length == 0 :
+ * Exit immediately, returning the
+ * length of the given table, or of
+ * the font file, depending on the
+ * value of 'tag'.
+ *
+ * if *length != 0 :
+ * Load the next 'length' bytes of
+ * table or font, starting at offset
+ * 'offset' (in table or font too).
+ *
+ * Output : Error code.
+ *
+ * MT-Safe : YES!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Get_Font_Data( TT_Face face,
+ TT_ULong tag,
+ TT_Long offset,
+ void* buffer,
+ TT_Long* length )
+ {
+ PFace faze = HANDLE_Face( face );
+
+
+ if ( !faze )
+ return TT_Err_Invalid_Face_Handle;
+
+ return Load_TrueType_Any( faze, tag, offset, buffer, length );
+ }
+
+
+ /************************ callback definition ******************/
+
+ /* Register a new callback to the TrueType engine -- this should */
+ /* only be used by higher-level libraries, not typical clients */
+ /* */
+ /* This is not part of the current FreeType release, thus */
+ /* undefined... */
+
+#if 0
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Register_Callback( TT_Engine engine,
+ int callback_id,
+ void* callback_ptr )
+ {
+ PEngine_Instance eng = HANDLE_Engine( engine );
+
+
+ if ( !eng )
+ return TT_Err_Invalid_Argument;
+
+ /* currently, we only support one callback */
+ if (callback_id != TT_Callback_Glyph_Outline_Load)
+ return TT_Err_Invalid_Argument;
+
+ eng->glCallback = (TT_Glyph_Loader_Callback)callback_ptr;
+ return TT_Err_Ok;
+ }
+#endif /* 0 */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttcache.c b/Build/source/libs/freetype/lib/ttcache.c
new file mode 100644
index 00000000000..21e6bf54c0f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttcache.c
@@ -0,0 +1,464 @@
+/*******************************************************************
+ *
+ * ttcache.c 1.1
+ *
+ * Generic object cache
+ *
+ * Copyright 1996-2000 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.
+ *
+ * Changes between 1.1 and 1.0:
+ *
+ * - introduced the refresher and finalizer in the cache class
+ * definition/implementation.
+ *
+ ******************************************************************/
+
+#include "ttengine.h"
+#include "ttmemory.h"
+#include "ttcache.h"
+#include "ttobjs.h"
+#include "ttdebug.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_cache
+
+#define ZERO_List( list ) list = NULL
+
+/* The macro FREE_Elements aliases the current engine instance's */
+/* free list_elements recycle list. */
+#define FREE_Elements ( engine->list_free_elements )
+
+/* Redefinition of LOCK and UNLOCK macros for New_Element and Done_Element */
+/* Note: The macros are redefined below for the cache functions */
+
+#undef LOCK
+#define LOCK() MUTEX_Lock ( engine->lock )
+
+#undef UNLOCK
+#define UNLOCK() MUTEX_Release( engine->lock )
+
+/*******************************************************************
+ *
+ * Function : Element_New
+ *
+ * Description : Gets a new (either fresh or recycled) list
+ * element. The element is unlisted.
+ *
+ * Input : None
+ *
+ * Output : List element address. NULL if out of memory.
+ *
+ ******************************************************************/
+
+ static
+ PList_Element Element_New( PEngine_Instance engine )
+ {
+ PList_Element element;
+
+
+ LOCK();
+ if ( FREE_Elements )
+ {
+ element = (PList_Element)FREE_Elements;
+ FREE_Elements = element->next;
+ }
+ else
+ {
+ if ( !MEM_Alloc( element, sizeof ( TList_Element ) ) )
+ {
+ element->next = NULL;
+ element->data = NULL;
+ }
+ }
+
+ /* Note: in case of failure, Alloc sets the pointer to NULL */
+ UNLOCK();
+
+ return element;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Element_Done
+ *
+ * Description : Recycles an unlinked list element.
+ *
+ * Input : The list element to recycle. It _must_ be unlisted.
+ *
+ * Output : none.
+ *
+ * Note : This function doesn't check the element.
+ *
+ ******************************************************************/
+
+ static
+ void Element_Done( PEngine_Instance engine,
+ PList_Element element )
+ {
+ LOCK();
+ /* Simply add the list element to the recycle list */
+ element->next = (PList_Element)FREE_Elements;
+ FREE_Elements = element;
+ UNLOCK();
+ }
+
+
+/* Redefinition of LOCK and UNLOCK macros for the cache functions */
+/* Note: The macros are defined above for the list element functions */
+
+#undef LOCK
+#define LOCK() MUTEX_Lock( *cache->lock )
+
+#undef UNLOCK
+#define UNLOCK() MUTEX_Release( *cache->lock )
+
+
+/*******************************************************************
+ *
+ * Function : Cache_Create
+ *
+ * Description : Creates a new cache that will be used to list
+ * and recycle several objects of the same class.
+ *
+ * Input : clazz a pointer to the cache's class. This is
+ * a simple structure that describes the
+ * the cache's object types and recycling
+ * limits.
+ *
+ * cache address of cache to create
+ *
+ * lock address of the mutex to use for this
+ * cache. The mutex will be used to protect
+ * the cache's lists. Use NULL for unprotected
+ * cache.
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Cache_Create( PEngine_Instance engine,
+ PCache_Class clazz,
+ TCache* cache,
+ TMutex* lock )
+ {
+ cache->engine = engine;
+ cache->clazz = clazz;
+ cache->lock = lock;
+ cache->idle_count = 0;
+
+ ZERO_List( cache->active );
+ ZERO_List( cache->idle );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Cache_Destroy
+ *
+ * Description : Destroys a cache and all its idle and active
+ * objects. This will call each object's destructor
+ * before freeing it.
+ *
+ * Input : cache address of cache to destroy
+ *
+ * Output : error code.
+ *
+ * Note: This function is not MT-Safe, as we assume that a client
+ * isn't stupid enough to use an object while destroying it.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Cache_Destroy( TCache* cache )
+ {
+ PDestructor destroy;
+ PList_Element current;
+ PList_Element next;
+
+
+ /* now destroy all active and idle listed objects */
+
+ /* get the destructor function */
+ destroy = cache->clazz->done;
+
+ /* destroy all elements in active list */
+ current = cache->active;
+ while ( current )
+ {
+ next = current->next;
+ destroy( current->data );
+ FREE( current->data );
+
+ Element_Done( cache->engine, current );
+ current = next;
+ }
+ ZERO_List(cache->active);
+
+ /* destroy all elements in idle list */
+ current = cache->idle;
+ while ( current )
+ {
+ next = current->next;
+ destroy( current->data );
+ FREE( current->data );
+
+ Element_Done( cache->engine, current );
+ current = next;
+ }
+ ZERO_List(cache->idle);
+
+ cache->clazz = NULL;
+ cache->idle_count = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Cache_New
+ *
+ * Description : Extracts a new object from a cache. This will
+ * try to recycle an idle object, if any is found.
+ * Otherwise, a new object will be allocated and
+ * built (by calling its constructor).
+ *
+ * Input : cache address of cache to use
+ * new_object address of target pointer to the 'new'
+ * object
+ * parent_object this pointer is passed to a new object
+ * constructor (unused if object is
+ * recycled)
+ *
+ * Output : Error code.
+ *
+ * Notes: This function is thread-safe, each cache list is protected
+ * through the cache's mutex, if there is one...
+ *
+ * *new_object will be set to NULL in case of failure.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Cache_New( TCache* cache,
+ void** new_object,
+ void* parent_object )
+ {
+ TT_Error error;
+ PList_Element current;
+ PConstructor build;
+ PRefresher reset;
+ void* object;
+
+
+ LOCK();
+ current = cache->idle;
+ if ( current )
+ {
+ cache->idle = current->next;
+ cache->idle_count--;
+ }
+ UNLOCK();
+
+ if ( current )
+ {
+ object = current->data;
+ reset = cache->clazz->reset;
+ if ( reset )
+ {
+ error = reset( object, parent_object );
+ if ( error )
+ {
+ LOCK();
+ current->next = cache->idle;
+ cache->idle = current;
+ cache->idle_count++;
+ UNLOCK();
+ goto Exit;
+ }
+ }
+ }
+ else
+ {
+ /* if no object was found in the cache, create a new one */
+ build = cache->clazz->init;
+
+ if ( MEM_Alloc( object, cache->clazz->object_size ) )
+ goto Memory_Fail;
+
+ current = Element_New( cache->engine );
+ if ( !current )
+ goto Memory_Fail;
+
+ current->data = object;
+
+ error = build( object, parent_object );
+ if ( error )
+ {
+ Element_Done( cache->engine, current );
+ goto Fail;
+ }
+ }
+
+ LOCK();
+ current->next = cache->active;
+ cache->active = current;
+ UNLOCK();
+
+ *new_object = current->data;
+ return TT_Err_Ok;
+
+ Exit:
+ *new_object = NULL;
+ return error;
+
+ Memory_Fail:
+ error = TT_Err_Out_Of_Memory;
+
+ Fail:
+ FREE( object );
+ goto Exit;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Cache_Done
+ *
+ * Description : Releases an object to the cache. This will either
+ * recycle or destroy the object, based on the cache's
+ * class and state.
+ *
+ * Input : cache the cache to use
+ * data the object to recycle/discard
+ *
+ * Output : error code.
+ *
+ * Notes : The object's destructor is called only when
+ * the objectwill be effectively destroyed by this
+ * function. This will not happen during recycling.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Cache_Done( TCache* cache,
+ void* data )
+ {
+ TT_Error error;
+ PList_Element element;
+ PList_Element prev;
+ PFinalizer finalize;
+ Long limit;
+ Bool destroy;
+
+
+ /* Look for object in active list */
+ LOCK();
+
+ element = cache->active;
+ prev = NULL;
+ while ( element )
+ {
+ if ( element->data == data )
+ {
+ if ( prev )
+ prev->next = element->next;
+ else
+ cache->active = element->next;
+ goto Suite;
+ }
+ prev = element;
+ element = element->next;
+ }
+
+ UNLOCK();
+ return TT_Err_Unlisted_Object;
+
+ Suite:
+
+ limit = cache->clazz->idle_limit;
+ destroy = (cache->idle_count >= limit);
+ UNLOCK();
+
+ if ( destroy )
+ {
+ /* destroy the object when the cache is full */
+ cache->clazz->done( element->data );
+ FREE( element->data );
+ Element_Done( cache->engine, element );
+ }
+ else
+ {
+ /* Finalize the object before adding it to the */
+ /* idle list. Return the error if any is found. */
+
+ finalize = cache->clazz->finalize;
+ if ( finalize )
+ {
+ error = finalize( element->data );
+ if ( error )
+ goto Exit;
+
+ /* Note: a failure at finalize time is a severe bug in */
+ /* the engine, which is why we allow ourselves to */
+ /* lose the object in this case. A finalizer should */
+ /* have its own error codes to spot this kind of */
+ /* problems easily. */
+ }
+
+ LOCK();
+ element->next = cache->idle;
+ cache->idle = element;
+ cache->idle_count++;
+ UNLOCK();
+ }
+
+ error = TT_Err_Ok;
+
+ Exit:
+ return error;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTCache_Init( PEngine_Instance engine )
+ {
+ /* Create list elements mutex */
+ FREE_Elements = NULL;
+ return TT_Err_Ok;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTCache_Done( PEngine_Instance engine )
+ {
+ /* We don't protect this function, as this is the end of the engine's */
+ /* execution.. */
+ PList_Element element, next;
+
+
+ /* frees the recycled list elements */
+ element = FREE_Elements;
+ while ( element )
+ {
+ next = element->next;
+ FREE( element );
+ element = next;
+ }
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttcache.h b/Build/source/libs/freetype/lib/ttcache.h
new file mode 100644
index 00000000000..0c33f4a1861
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttcache.h
@@ -0,0 +1,216 @@
+/*******************************************************************
+ *
+ * ttcache.h 1.1
+ *
+ * Generic object cache
+ *
+ * Copyright 1996-2000 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 defines and implements object caches.
+ *
+ * An object class is a structure layout that encapsulate one
+ * given type of data used by the FreeType engine. Each object
+ * class is completely described by:
+ *
+ * - a 'root' or 'leading' structure containing the first
+ * important fields of the class. The root structure is
+ * always of fixed size.
+ *
+ * It is implemented as a simple C structure, and may
+ * contain several pointers to sub-tables that can be
+ * sized and allocated dynamically.
+ *
+ * Examples: TFace, TInstance, TGlyph & TExecution_Context
+ * (defined in 'ttobjs.h')
+ *
+ * - we make a difference between 'child' pointers and 'peer'
+ * pointers. A 'child' pointer points to a sub-table that is
+ * owned by the object, while a 'peer' pointer points to any
+ * other kind of data the object isn't responsible for.
+ *
+ * An object class is thus usually a 'tree' of 'child' tables.
+ *
+ * - each object class needs a constructor and a destructor.
+ *
+ * A constructor is a function which receives the address of
+ * freshly allocated and zeroed object root structure and
+ * 'builds' all the valid child data that must be associated
+ * to the object before it becomes 'valid'.
+ *
+ * A destructor does the inverse job: given the address of
+ * a valid object, it must discard all its child data and
+ * zero its main fields (essentially the pointers and array
+ * sizes found in the root fields).
+ *
+ *
+ * Important notes:
+ *
+ * When the constructor fails to allocate an object, it must
+ * return immediately with an error code, and not try to release
+ * what it has previously allocated before the error. The cache
+ * manager detects the error and calls the destructor on the
+ * partial object, before returning the error to the caller (along
+ * with a NULL pointer for the "new" object).
+ *
+ * The destructor must thus be able to deal with "partial objects",
+ * i.e., objects where only part of the child tables are allocated,
+ * and only release these ones. As the TT_Free() function accepts
+ * a NULL parameter (and returns successfuly in this case), no check
+ * is really necessary when using the macro 'FREE()'.
+ *
+ * Currently, there is no check in the cache manager to see if a
+ * destructor fails (double error state!).
+ *
+ * This scheme is more compact and more maintanable than the one
+ * where de-allocation code is duplicated in the constructor
+ * _and_ the destructor.
+ *
+ *
+ *
+ * Changes between 1.1 and 1.0:
+ *
+ * - introduced the refreshed and finalizer class definition/implementation
+ * - inserted an engine instance pointer in the cache structure
+ *
+ ******************************************************************/
+
+#ifndef TTCACHE_H
+#define TTCACHE_H
+
+#include "tttypes.h"
+#include "ttconfig.h"
+#include "ttmutex.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ typedef TT_Error TConstructor( void* object,
+ void* parent );
+
+ typedef TT_Error TDestructor ( void* object );
+
+ typedef TConstructor TRefresher;
+ typedef TDestructor TFinalizer;
+
+ typedef TConstructor* PConstructor;
+ typedef TDestructor* PDestructor;
+ typedef TRefresher* PRefresher;
+ typedef TFinalizer* PFinalizer;
+
+
+ /* A Cache class record holds the data necessary to define */
+ /* a cache kind. */
+ struct TCache_Class_
+ {
+ ULong object_size;
+ Long idle_limit;
+ PConstructor init;
+ PDestructor done;
+ PRefresher reset;
+ PFinalizer finalize;
+ };
+
+ typedef struct TCache_Class_ TCache_Class;
+ typedef TCache_Class* PCache_Class;
+
+
+
+ /* Simple list node record. A list element is said to be 'unlinked' */
+ /* when it doesn't belong to any list. */
+ struct TList_Element_;
+
+ typedef struct TList_Element_ TList_Element;
+ typedef TList_Element* PList_Element;
+
+ struct TList_Element_
+ {
+ PList_Element next;
+ void* data;
+ };
+
+
+ /* Simple singly-linked list record - LIFO style, no tail field */
+ typedef PList_Element TSingle_List;
+
+ struct TCache_
+ {
+ PEngine_Instance engine;
+ PCache_Class clazz; /* 'class' is a reserved word in C++ */
+ TMutex* lock;
+ TSingle_List active;
+ TSingle_List idle;
+ Long idle_count;
+ };
+
+ typedef struct TCache_ TCache;
+ typedef TCache* PCache;
+
+ /* Returns a new list element, either fresh or recycled. */
+ /* Note: the returned element is unlinked. */
+
+ /* An object cache holds two lists tracking the active and */
+ /* idle objects that are currently created and used by the */
+ /* engine. It can also be 'protected' by a mutex. */
+
+ /* Initializes a new cache, of class 'clazz', pointed by 'cache', */
+ /* protected by the 'lock' mutex. Set 'lock' to NULL if the cache */
+ /* doesn't need protection */
+
+ FT_INTERNAL_DEF( TT_Error )
+ Cache_Create( PEngine_Instance engine,
+ PCache_Class clazz,
+ TCache* cache,
+ TMutex* lock );
+
+ /* Destroys a cache and all its listed objects */
+
+ FT_INTERNAL_DEF( TT_Error )
+ Cache_Destroy( TCache* cache );
+
+
+ /* Extracts a new object from the cache */
+
+ FT_INTERNAL_DEF( TT_Error )
+ Cache_New( TCache* cache,
+ void** new_object,
+ void* parent_object );
+
+
+ /* Returns an object to the cache, or discards it depending */
+ /* on the cache class' 'idle_limit' field */
+
+ FT_INTERNAL_DEF( TT_Error )
+ Cache_Done( TCache* cache, void* data );
+
+#define CACHE_New( _cache, _newobj, _parent ) \
+ Cache_New( (TCache*)_cache, (void**)&_newobj, (void*)_parent )
+
+#define CACHE_Done( _cache, _obj ) \
+ Cache_Done( (TCache*)_cache, (void*)_obj )
+
+
+
+ FT_INTERNAL_DEF( TT_Error )
+ TTCache_Init( PEngine_Instance engine );
+
+ FT_INTERNAL_DEF( TT_Error )
+ TTCache_Done( PEngine_Instance engine );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTCACHE_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttcalc.c b/Build/source/libs/freetype/lib/ttcalc.c
new file mode 100644
index 00000000000..44d2f8c6f7f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttcalc.c
@@ -0,0 +1,426 @@
+/*******************************************************************
+ *
+ * ttcalc.c
+ *
+ * Arithmetic Computations (body).
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#include "ttcalc.h"
+#include "ttdebug.h"
+#include "tttables.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_calc
+
+
+/* Support for 1-complement arithmetic has been totally dropped in this */
+/* release. You can still write your own code if you need it... */
+
+ static const Long Roots[63] =
+ {
+ 1, 1, 2, 3, 4, 5, 8, 11,
+ 16, 22, 32, 45, 64, 90, 128, 181,
+ 256, 362, 512, 724, 1024, 1448, 2048, 2896,
+ 4096, 5892, 8192, 11585, 16384, 23170, 32768, 46340,
+
+ 65536, 92681, 131072, 185363, 262144, 370727,
+ 524288, 741455, 1048576, 1482910, 2097152, 2965820,
+ 4194304, 5931641, 8388608, 11863283, 16777216, 23726566,
+
+ 33554432, 47453132, 67108864, 94906265,
+ 134217728, 189812531, 268435456, 379625062,
+ 536870912, 759250125, 1073741824, 1518500250,
+ 2147483647
+ };
+
+
+#ifdef LONG64
+
+ FT_EXPORT_FUNC( TT_Long )
+ TT_MulDiv( TT_Long a,
+ TT_Long b,
+ TT_Long c )
+ {
+ Long s;
+
+
+ s = a; a = ABS( a );
+ s ^= b; b = ABS( b );
+ s ^= c; c = ABS( c );
+
+ if ( c > 0 )
+ a = ( (TT_Int64)a * b + ( c >> 1 ) ) / c;
+ else
+ a = 0x7FFFFFFFL;
+
+ return ( s < 0 ) ? -a : a;
+ }
+
+
+ FT_EXPORT_FUNC( TT_Long )
+ TT_MulFix( TT_Long a,
+ TT_Long b )
+ {
+ Long s;
+
+
+ s = a; a = ABS( a );
+ s ^= b; b = ABS( b );
+
+ a = ((TT_Int64)a * b + 0x8000) / 0x10000;
+ return ( s < 0 ) ? -a : a;
+ }
+
+
+ FT_INTERNAL_FUNC( Int )
+ Order64( TT_Int64 z )
+ {
+ Int j = 0;
+
+
+ while ( z )
+ {
+ z = (unsigned INT64)z >> 1;
+ j++;
+ }
+ return j - 1;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Int32 )
+ Sqrt64( TT_Int64 l )
+ {
+ TT_Int64 r, s;
+
+
+ if ( l <= 0 ) return 0;
+ if ( l == 1 ) return 1;
+
+ r = Roots[Order64( l )];
+
+ do
+ {
+ s = r;
+ r = ( r + l/r ) >> 1;
+ }
+ while ( r > s || r*r > l );
+
+ return r;
+ }
+
+#else /* LONG64 */
+
+
+ /* The TT_MulDiv function has been optimized thanks to ideas from */
+ /* Graham Asher. The trick is to optimize computation when everything */
+ /* fits within 32-bits (a rather common case). */
+ /* */
+ /* we compute 'a*b+c/2', then divide it by 'c'. (positive values) */
+ /* */
+ /* 46340 is FLOOR(SQRT(2^31-1)). */
+ /* */
+ /* if ( a <= 46340 && b <= 46340 ) then ( a*b <= 0x7FFEA810 ) */
+ /* */
+ /* 0x7FFFFFFF - 0x7FFEA810 = 0x157F0 */
+ /* */
+ /* if ( c < 0x157F0*2 ) then ( a*b+c/2 <= 0x7FFFFFFF ) */
+ /* */
+ /* and 2*0x157F0 = 176096 */
+ /* */
+
+ FT_EXPORT_FUNC( TT_Long )
+ TT_MulDiv( TT_Long a,
+ TT_Long b,
+ TT_Long c )
+ {
+ long s;
+
+
+ if ( a == 0 || b == c )
+ return a;
+
+ s = a; a = ABS( a );
+ s ^= b; b = ABS( b );
+ s ^= c; c = ABS( c );
+
+ if ( a <= 46340 && b <= 46340 && c <= 176095L && c > 0 )
+ {
+ a = ( a * b + ( c >> 1 ) ) / c;
+ }
+ else if ( c > 0 )
+ {
+ TT_Int64 temp, temp2;
+
+ MulTo64( a, b, &temp );
+ temp2.hi = (TT_Int32)( c >> 31 );
+ temp2.lo = (TT_Word32)( c / 2 );
+ Add64( &temp, &temp2, &temp );
+ a = Div64by32( &temp, c );
+ }
+ else
+ a = 0x7FFFFFFFL;
+
+ return ( s < 0 ) ? -a : a;
+ }
+
+ /* The optimization for TT_MulFix is different. We could simply be */
+ /* happy by applying the same principles than with TT_MulDiv, because */
+ /* */
+ /* c = 0x10000 < 176096 */
+ /* */
+ /* however, in most cases, we have a 'b' with a value around 0x10000 */
+ /* which is greater than 46340. */
+ /* */
+ /* According to Graham's testing, most cases have 'a' < 100, so a good */
+ /* idea is to use bounds like 1024 and 2097151 (= floor(2^31-1)/1024 ) */
+ /* for 'a' and 'b' respectively.. */
+ /* */
+
+ FT_EXPORT_FUNC( TT_Long )
+ TT_MulFix( TT_Long a,
+ TT_Long b )
+ {
+ long s;
+
+ if ( a == 0 || b == 0x10000 )
+ return a;
+
+ s = a; a = ABS( a );
+ s ^= b; b = ABS( b );
+
+ if ( a <= 1024 && b <= 2097151 )
+ {
+ a = ( a*b + 0x8000 ) >> 16;
+ }
+ else
+ {
+ TT_Int64 temp, temp2;
+
+ MulTo64( a, b, &temp );
+ temp2.hi = 0;
+ temp2.lo = 0x8000;
+ Add64( &temp, &temp2, &temp );
+ a = Div64by32( &temp, 0x10000 );
+ }
+
+ return ( s < 0 ) ? -a : a;
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ Neg64( TT_Int64* x )
+ {
+ /* Remember that -(0x80000000) == 0x80000000 with 2-complement! */
+ /* We take care of that here. */
+
+ x->hi ^= 0xFFFFFFFFUL;
+ x->lo ^= 0xFFFFFFFFUL;
+ x->lo++;
+
+ if ( !x->lo )
+ {
+ x->hi++;
+ if ( x->hi == 0x80000000UL ) /* Check -MaxInt32 - 1 */
+ {
+ x->lo--;
+ x->hi--; /* We return 0x7FFFFFFF! */
+ }
+ }
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ Add64( TT_Int64* x,
+ TT_Int64* y,
+ TT_Int64* z )
+ {
+ register TT_Word32 lo, hi;
+
+
+ lo = x->lo + y->lo;
+ hi = x->hi + y->hi + ( lo < x->lo );
+
+ z->lo = lo;
+ z->hi = hi;
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ Sub64( TT_Int64* x,
+ TT_Int64* y,
+ TT_Int64* z )
+ {
+ register TT_Word32 lo, hi;
+
+
+ lo = x->lo - y->lo;
+ hi = x->hi - y->hi - ( (TT_Int32)lo < 0 );
+
+ z->lo = lo;
+ z->hi = hi;
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ MulTo64( TT_Int32 x,
+ TT_Int32 y,
+ TT_Int64* z )
+ {
+ TT_Int32 s;
+ TT_Word32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
+
+
+ s = x; x = ABS( x );
+ s ^= y; y = ABS( y );
+
+ lo1 = x & 0x0000FFFF; hi1 = x >> 16;
+ lo2 = y & 0x0000FFFF; hi2 = y >> 16;
+
+ lo = lo1*lo2;
+ i1 = lo1*hi2;
+ i2 = lo2*hi1;
+ hi = hi1*hi2;
+
+ /* Check carry overflow of i1 + i2 */
+
+ if ( i2 )
+ {
+ if ( i1 >= (TT_Word32)-(TT_Int32)i2 ) hi += 1L << 16;
+ i1 += i2;
+ }
+
+ i2 = i1 >> 16;
+ i1 = i1 << 16;
+
+ /* Check carry overflow of i1 + lo */
+ if ( i1 )
+ {
+ if ( lo >= (TT_Word32)-(TT_Int32)i1 ) hi++;
+ lo += i1;
+ }
+
+ hi += i2;
+
+ z->lo = lo;
+ z->hi = hi;
+
+ if ( s < 0 ) Neg64( z );
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Int32 )
+ Div64by32( TT_Int64* x,
+ TT_Int32 y )
+ {
+ TT_Int32 s;
+ TT_Word32 q, r, i, lo;
+
+
+ s = x->hi; if ( s < 0 ) Neg64( x );
+ s ^= y; y = ABS( y );
+
+ /* Shortcut */
+ if ( x->hi == 0 )
+ {
+ if ( y > 0 )
+ q = x->lo / y;
+ else
+ q = 0x7FFFFFFFL;
+
+ return ( s < 0 ) ? -(TT_Int32)q : (TT_Int32)q;
+ }
+
+ r = x->hi;
+ lo = x->lo;
+
+ if ( r >= (TT_Word32)y ) /* we know y is to be treated as unsigned here */
+ return ( s < 0 ) ? 0x80000001UL : 0x7FFFFFFFUL;
+ /* Return Max/Min Int32 if division overflow */
+ /* This includes division by zero! */
+ q = 0;
+ for ( i = 0; i < 32; i++ )
+ {
+ r <<= 1;
+ q <<= 1;
+ r |= lo >> 31;
+
+ if ( r >= (TT_Word32)y )
+ {
+ r -= y;
+ q |= 1;
+ }
+ lo <<= 1;
+ }
+
+ return ( s < 0 ) ? -(TT_Int32)q : (TT_Int32)q;
+ }
+
+
+ FT_INTERNAL_FUNC( Int )
+ Order64( TT_Int64* z )
+ {
+ TT_Word32 i;
+ Int j;
+
+
+ if ( z->hi )
+ {
+ i = z->hi;
+ j = 32;
+ }
+ else
+ {
+ i = z->lo;
+ j = 0;
+ }
+
+ while ( i > 0 )
+ {
+ i >>= 1;
+ j++;
+ }
+ return j-1;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Int32 )
+ Sqrt64( TT_Int64* l )
+ {
+ TT_Int64 l2;
+ TT_Int32 r, s;
+
+
+ if ( (TT_Int32)l->hi < 0 ||
+ (l->hi == 0 && l->lo == 0) ) return 0;
+
+ s = Order64( l );
+ if ( s == 0 ) return 1;
+
+ r = Roots[s];
+ do
+ {
+ s = r;
+ r = ( r + Div64by32(l,r) ) >> 1;
+ MulTo64( r, r, &l2 );
+ Sub64 ( l, &l2, &l2 );
+ }
+ while ( r > s || (TT_Int32)l2.hi < 0 );
+
+ return r;
+ }
+
+#endif /* LONG64 */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttcalc.h b/Build/source/libs/freetype/lib/ttcalc.h
new file mode 100644
index 00000000000..98da62a1c21
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttcalc.h
@@ -0,0 +1,119 @@
+/*******************************************************************
+ *
+ * ttcalc.h
+ *
+ * Arithmetic Computations (specification).
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+#ifndef TTCALC_H
+#define TTCALC_H
+
+#include "ttconfig.h"
+#include "freetype.h"
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifdef LONG64
+
+ typedef INT64 TT_Int64;
+
+#define ADD_64( x, y, z ) z = x + y
+#define SUB_64( x, y, z ) z = x - y
+#define MUL_64( x, y, z ) z = (TT_Int64)(x) * (y)
+
+#define DIV_64( x, y ) ( (x) / (y) )
+
+#define SQRT_64( x ) Sqrt64( x )
+#define SQRT_32( x ) Sqrt32( x )
+
+ FT_INTERNAL_DEF( TT_Int32 )
+ Sqrt64( TT_Int64 l )
+#if defined __GCC__ && defined TT_MAKE_OPTION_SINGLE_OBJECT
+ __attribute__ (( unused )) /* keep the compiler mute */
+#endif
+ ;
+
+#else /* LONG64 */
+
+ struct TT_Int64_
+ {
+ TT_Word32 lo;
+ TT_Word32 hi;
+ };
+
+ typedef struct TT_Int64_ TT_Int64;
+
+#define ADD_64( x, y, z ) Add64( &x, &y, &z )
+#define SUB_64( x, y, z ) Sub64( &x, &y, &z )
+#define MUL_64( x, y, z ) MulTo64( x, y, &z )
+
+#define DIV_64( x, y ) Div64by32( &x, y )
+
+#define SQRT_64( x ) Sqrt64( &x )
+#define SQRT_32( x ) Sqrt32( x )
+
+ FT_INTERNAL_DEF( void )
+ Add64( TT_Int64* x,
+ TT_Int64* y,
+ TT_Int64* z );
+ FT_INTERNAL_DEF( void )
+ Sub64( TT_Int64* x,
+ TT_Int64* y,
+ TT_Int64* z );
+
+ FT_INTERNAL_DEF( void )
+ MulTo64( TT_Int32 x,
+ TT_Int32 y,
+ TT_Int64* z );
+
+ FT_INTERNAL_DEF( TT_Int32 )
+ Div64by32( TT_Int64* x,
+ TT_Int32 y );
+
+ FT_INTERNAL_DEF( int )
+ Order64( TT_Int64* z );
+
+ FT_INTERNAL_DEF( TT_Int32 )
+ Sqrt64( TT_Int64* l )
+#if defined __GCC__ && defined TT_MAKE_OPTION_SINGLE_OBJECT
+ __attribute__ (( unused )) /* keep the compiler mute */
+#endif
+ ;
+
+#endif /* LONG64 */
+
+ /* The two following functions are now part of the API! */
+
+ /* TT_Long TT_MulDiv( TT_Long a, TT_Long b, TT_Long c ); */
+ /* TT_Long TT_MulFix( TT_Long a, TT_Long b ); */
+
+
+#define INT_TO_F26DOT6( x ) ( (Long)(x) << 6 )
+#define INT_TO_F2DOT14( x ) ( (Long)(x) << 14 )
+#define INT_TO_FIXED( x ) ( (Long)(x) << 16 )
+#define F2DOT14_TO_FIXED( x ) ( (Long)(x) << 2 )
+#define FLOAT_TO_FIXED( x ) ( (Long)(x * 65536.0) )
+
+#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ((x) + 32) & -64) \
+ : ( -((32 - (x)) & -64) ) )
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTCALC_H */
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttcmap.c b/Build/source/libs/freetype/lib/ttcmap.c
new file mode 100644
index 00000000000..a8ce85708d7
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttcmap.c
@@ -0,0 +1,635 @@
+/*******************************************************************
+ *
+ * ttcmap.c
+ *
+ * TrueType Character Mappings
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+#include "ttobjs.h"
+#include "ttdebug.h"
+#include "ttfile.h"
+#include "ttmemory.h"
+#include "ttload.h"
+#include "ttcmap.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_cmap
+
+
+/*******************************************************************
+ *
+ * Function : CharMap_Load
+ *
+ * Description : Loads a given charmap into memory.
+ *
+ * Input : cmap pointer to cmap table
+ *
+ * Output : Error code.
+ *
+ * Notes : - Assumes the the stream is already used (opened).
+ *
+ * - In case of error, releases all partially allocated
+ * tables.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ CharMap_Load( PCMapTable cmap,
+ TT_Stream input )
+ {
+ DEFINE_LOAD_LOCALS( input );
+
+ UShort num_SH, num_Seg, i;
+
+ UShort u, l, num_Groups, j;
+ ULong length;
+
+ PCMap0 cmap0;
+ PCMap2 cmap2;
+ PCMap4 cmap4;
+ PCMap6 cmap6;
+ PCMap8_12 cmap8_12;
+
+ PCMap2SubHeader cmap2sub;
+ PCMap4Segment segments;
+ PCMapGroup groups;
+
+
+ if ( cmap->loaded )
+ return TT_Err_Ok;
+
+ if ( FILE_Seek( cmap->offset ) )
+ return error;
+
+ switch ( cmap->format )
+ {
+ case 0:
+ cmap0 = &cmap->c.cmap0;
+
+ if ( ALLOC( cmap0->glyphIdArray, 256L ) ||
+ FILE_Read( (void*)cmap0->glyphIdArray, 256L ) )
+ goto Fail;
+
+ break;
+
+ case 2:
+ num_SH = 0;
+ cmap2 = &cmap->c.cmap2;
+
+ /* allocate subheader keys */
+
+ if ( ALLOC_ARRAY( cmap2->subHeaderKeys, 256, UShort ) ||
+ ACCESS_Frame( 512L ) )
+ goto Fail;
+
+ for ( i = 0; i < 256; i++ )
+ {
+ u = GET_UShort() / 8;
+ cmap2->subHeaderKeys[i] = u;
+
+ if ( num_SH < u )
+ num_SH = u;
+ }
+
+ FORGET_Frame();
+
+ /* load subheaders */
+
+ cmap2->numGlyphId = l =
+ ( ( cmap->length - 2L * (256 + 3) - num_SH * 8L ) & 0xffff) / 2;
+
+ if ( ALLOC_ARRAY( cmap2->subHeaders,
+ num_SH + 1,
+ TCMap2SubHeader ) ||
+ ACCESS_Frame( ( num_SH + 1 ) * 8L ) )
+ goto Fail;
+
+ cmap2sub = cmap2->subHeaders;
+
+ for ( i = 0; i <= num_SH; i++ )
+ {
+ cmap2sub->firstCode = GET_UShort();
+ cmap2sub->entryCount = GET_UShort();
+ cmap2sub->idDelta = GET_Short();
+ /* we apply the location offset immediately */
+ cmap2sub->idRangeOffset = GET_UShort() - ( num_SH - i ) * 8 - 2;
+
+ cmap2sub++;
+ }
+
+ FORGET_Frame();
+
+ /* load glyph ids */
+
+ if ( ALLOC_ARRAY( cmap2->glyphIdArray, l, UShort ) ||
+ ACCESS_Frame( l * 2L ) )
+ goto Fail;
+
+ for ( i = 0; i < l; i++ )
+ cmap2->glyphIdArray[i] = GET_UShort();
+
+ FORGET_Frame();
+ break;
+
+ case 4:
+ cmap4 = &cmap->c.cmap4;
+
+ /* load header */
+
+ if ( ACCESS_Frame( 8L ) )
+ goto Fail;
+
+ cmap4->segCountX2 = GET_UShort();
+ cmap4->searchRange = GET_UShort();
+ cmap4->entrySelector = GET_UShort();
+ cmap4->rangeShift = GET_UShort();
+
+ num_Seg = cmap4->segCountX2 / 2;
+
+ FORGET_Frame();
+
+ /* load segments */
+
+ if ( ALLOC_ARRAY( cmap4->segments,
+ num_Seg,
+ TCMap4Segment ) ||
+ ACCESS_Frame( (num_Seg * 4 + 1) * 2L ) )
+ goto Fail;
+
+ segments = cmap4->segments;
+
+ for ( i = 0; i < num_Seg; i++ )
+ segments[i].endCount = GET_UShort();
+
+ (void)GET_UShort();
+
+ for ( i = 0; i < num_Seg; i++ )
+ segments[i].startCount = GET_UShort();
+
+ for ( i = 0; i < num_Seg; i++ )
+ segments[i].idDelta = GET_Short();
+
+ for ( i = 0; i < num_Seg; i++ )
+ segments[i].idRangeOffset = GET_UShort();
+
+ FORGET_Frame();
+
+ cmap4->numGlyphId = l =
+ ( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xffff ) / 2;
+
+ /* load ids */
+
+ if ( ALLOC_ARRAY( cmap4->glyphIdArray, l , UShort ) ||
+ ACCESS_Frame( l * 2L ) )
+ goto Fail;
+
+ for ( i = 0; i < l; i++ )
+ cmap4->glyphIdArray[i] = GET_UShort();
+
+ FORGET_Frame();
+ break;
+
+ case 6:
+ cmap6 = &cmap->c.cmap6;
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail;
+
+ cmap6->firstCode = GET_UShort();
+ cmap6->entryCount = GET_UShort();
+
+ FORGET_Frame();
+
+ l = cmap6->entryCount;
+
+ if ( ALLOC_ARRAY( cmap6->glyphIdArray,
+ cmap6->entryCount,
+ Short ) ||
+ ACCESS_Frame( l * 2L ) )
+ goto Fail;
+
+ for ( i = 0; i < l; i++ )
+ cmap6->glyphIdArray[i] = GET_UShort();
+
+ FORGET_Frame();
+ break;
+
+ case 8:
+ case 12:
+ if ( FILE_Seek( cmap->offset - 2 ) )
+ return error;
+
+ cmap8_12 = &cmap->c.cmap8_12;
+
+ if ( ACCESS_Frame( 8L ) )
+ goto Fail;
+
+ length = GET_ULong();
+ cmap->length = (UShort)(length & 0xFFFFU);
+
+ if ( length!=cmap->length )
+ goto Fail;
+
+ GET_ULong(); /* language */
+
+ FORGET_Frame();
+
+ if ( cmap->format == 8 )
+ if ( FILE_Skip( 8192L ) )
+ goto Fail;
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail;
+ cmap8_12->nGroups = GET_ULong();
+ FORGET_Frame();
+
+ if ( cmap8_12->nGroups > 0xFFFF )
+ goto Fail;
+ num_Groups = cmap8_12->nGroups;
+
+ if ( ALLOC_ARRAY( cmap8_12->groups, num_Groups, TCMapGroup ) )
+ goto Fail;
+ if ( ACCESS_Frame( num_Groups * 3 * 4L ) )
+ goto Fail;
+
+ groups = cmap8_12->groups;
+
+ for ( j = 0; j < num_Groups; j++ )
+ {
+ groups[j].startCharCode = GET_ULong();
+ groups[j].endCharCode = GET_ULong();
+ groups[j].startGlyphID = GET_ULong();
+ }
+
+ FORGET_Frame();
+
+ cmap8_12->last_group = cmap8_12->groups;
+ break;
+
+ default: /* corrupt character mapping table */
+ return TT_Err_Invalid_CharMap_Format;
+
+ }
+ return TT_Err_Ok;
+
+ Fail:
+ CharMap_Free( cmap );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : CharMap_Free
+ *
+ * Description : Releases a given charmap table.
+ *
+ * Input : cmap pointer to cmap table
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ CharMap_Free( PCMapTable cmap )
+ {
+ if ( !cmap )
+ return TT_Err_Ok;
+
+ switch ( cmap->format )
+ {
+ case 0:
+ FREE( cmap->c.cmap0.glyphIdArray );
+ break;
+
+ case 2:
+ FREE( cmap->c.cmap2.subHeaderKeys );
+ FREE( cmap->c.cmap2.subHeaders );
+ FREE( cmap->c.cmap2.glyphIdArray );
+ break;
+
+ case 4:
+ FREE( cmap->c.cmap4.segments );
+ FREE( cmap->c.cmap4.glyphIdArray );
+ cmap->c.cmap4.segCountX2 = 0;
+ break;
+
+ case 6:
+ FREE( cmap->c.cmap6.glyphIdArray );
+ cmap->c.cmap6.entryCount = 0;
+ break;
+
+ case 8:
+ case 12:
+ FREE( cmap->c.cmap8_12.groups );
+ cmap->c.cmap8_12.nGroups = 0;
+ break;
+
+ default:
+ /* invalid table format, do nothing */
+ ;
+ }
+
+ cmap->loaded = FALSE;
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : CharMap_Index
+ *
+ * Description : Performs charcode->glyph index translation.
+ *
+ * Input : cmap pointer to cmap table
+ *
+ * Output : Glyph index, 0 in case of failure.
+ *
+ ******************************************************************/
+
+ static UShort code_to_index0 ( ULong charCode, PCMap0 cmap0 );
+ static UShort code_to_index2 ( ULong charCode, PCMap2 cmap2 );
+ static UShort code_to_index4 ( ULong charCode, PCMap4 cmap4 );
+ static UShort code_to_index6 ( ULong charCode, PCMap6 cmap6 );
+ static UShort code_to_index8_12( ULong charCode, PCMap8_12 cmap8_12 );
+
+
+ FT_INTERNAL_FUNC( UShort )
+ CharMap_Index( PCMapTable cmap,
+ ULong charcode )
+ {
+ switch ( cmap->format )
+ {
+ case 0:
+ return code_to_index0( charcode, &cmap->c.cmap0 );
+ case 2:
+ return code_to_index2( charcode, &cmap->c.cmap2 );
+ case 4:
+ return code_to_index4( charcode, &cmap->c.cmap4 );
+ case 6:
+ return code_to_index6( charcode, &cmap->c.cmap6 );
+ case 8:
+ case 12:
+ return code_to_index8_12( charcode, &cmap->c.cmap8_12 );
+ default:
+ return 0;
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : code_to_index0
+ *
+ * Description : Converts the character code into a glyph index.
+ * Uses format 0.
+ * charCode will be masked to get a value in the range
+ * 0x00-0xFF.
+ *
+ * Input : charCode the wanted character code
+ * cmap0 a pointer to a cmap table in format 0
+ *
+ * Output : Glyph index into the glyphs array.
+ * 0 if the glyph does not exist.
+ *
+ ******************************************************************/
+
+ static UShort code_to_index0( ULong charCode,
+ PCMap0 cmap0 )
+ {
+ if ( charCode <= 0xFF )
+ return cmap0->glyphIdArray[charCode];
+ else
+ return 0;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : code_to_index2
+ *
+ * Description : Converts the character code into a glyph index.
+ * Uses format 2.
+ *
+ * Input : charCode the wanted character code
+ * cmap2 a pointer to a cmap table in format 2
+ *
+ * Output : Glyph index into the glyphs array.
+ * 0 if the glyph does not exist.
+ *
+ ******************************************************************/
+
+ static UShort code_to_index2( ULong charCode,
+ PCMap2 cmap2 )
+ {
+ UShort index1, idx;
+ UInt offset;
+ TCMap2SubHeader sh2;
+
+
+ index1 = cmap2->subHeaderKeys[charCode <= 0xFF ?
+ charCode : (charCode >> 8)];
+
+ if ( index1 == 0 )
+ {
+ if ( charCode <= 0xFF )
+ return cmap2->glyphIdArray[charCode]; /* 8bit character code */
+ else
+ return 0;
+ }
+ else /* 16bit character code */
+ {
+ if ( charCode <= 0xFF )
+ return 0;
+
+ sh2 = cmap2->subHeaders[index1];
+
+ if ( (charCode & 0xFF) < (TT_UInt)sh2.firstCode )
+ return 0;
+
+ if ( (charCode & 0xFF) >= (TT_UInt)( sh2.firstCode + sh2.entryCount ) )
+ return 0;
+
+ offset = sh2.idRangeOffset / 2 + (charCode & 0xFF) - sh2.firstCode;
+ if ( offset < cmap2->numGlyphId )
+ idx = cmap2->glyphIdArray[offset];
+ else
+ return 0;
+
+ if ( idx )
+ return ( idx + sh2.idDelta ) & 0xFFFF;
+ else
+ return 0;
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : code_to_index4
+ *
+ * Description : Converts the character code into a glyph index.
+ * Uses format 4.
+ *
+ * Input : charCode the wanted character code
+ * cmap4 a pointer to a cmap table in format 4
+ *
+ * Output : Glyph index into the glyphs array.
+ * 0 if the glyph does not exist.
+ *
+ ******************************************************************/
+
+ static UShort code_to_index4( ULong charCode,
+ PCMap4 cmap4 )
+ {
+ UInt index1;
+ UShort segCount, i;
+ TCMap4Segment seg4;
+
+
+ segCount = cmap4->segCountX2 / 2;
+
+ for ( i = 0; i < segCount; i++ )
+ if ( charCode <= (TT_UInt)cmap4->segments[i].endCount )
+ break;
+
+ /* Safety check - even though the last endCount should be 0xFFFF */
+ if ( i >= segCount )
+ return 0;
+
+ seg4 = cmap4->segments[i];
+
+ if ( charCode < (TT_UInt)seg4.startCount )
+ return 0;
+
+ if ( seg4.idRangeOffset == 0 )
+ return ( charCode + seg4.idDelta ) & 0xFFFF;
+ else
+ {
+ index1 = seg4.idRangeOffset / 2 + (charCode - seg4.startCount) -
+ (segCount - i);
+
+ if ( index1 < cmap4->numGlyphId )
+ {
+ if ( cmap4->glyphIdArray[index1] == 0 )
+ return 0;
+ else
+ return ( cmap4->glyphIdArray[index1] + seg4.idDelta ) & 0xFFFF;
+ }
+ else
+ return 0;
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : code_to_index6
+ *
+ * Description : Converts the character code into a glyph index.
+ * Uses format 6.
+ *
+ * Input : charCode the wanted character code
+ * cmap6 a pointer to a cmap table in format 6
+ *
+ * Output : Glyph index into the glyphs array.
+ * 0 if the glyph does not exist (`missing character glyph').
+ *
+ ******************************************************************/
+
+ static UShort code_to_index6( ULong charCode,
+ PCMap6 cmap6 )
+ {
+ TT_UInt firstCode;
+
+
+ firstCode = cmap6->firstCode;
+
+ if ( charCode < firstCode )
+ return 0;
+
+ if ( charCode >= (firstCode + cmap6->entryCount) )
+ return 0;
+
+ return cmap6->glyphIdArray[charCode - firstCode];
+ }
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* code_to_index8_12 */
+ /* */
+ /* <Description> */
+ /* Converts the (possibly 32bit) character code into a glyph index. */
+ /* Uses format 8 or 12. */
+ /* */
+ /* <Input> */
+ /* charCode :: The wanted character code. */
+ /* cmap8_12 :: A pointer to a cmap table in format 8 or 12. */
+ /* */
+ /* <Return> */
+ /* Glyph index into the glyphs array. 0 if the glyph does not exist. */
+ /* */
+ static UShort code_to_index8_12( ULong charCode,
+ PCMap8_12 cmap8_12 )
+ {
+ PCMapGroup group, limit;
+
+
+ limit = cmap8_12->groups + cmap8_12->nGroups;
+
+ /* first, check against the last used group */
+
+ group = cmap8_12->last_group;
+
+ /* the following is equivalent to performing two tests, as in */
+ /* */
+ /* if ( charCode >= group->startCharCode && */
+ /* charCode <= group->endCharCode ) */
+ /* */
+ /* This is a bit strange, but it is faster, and the idea behind the */
+ /* cache is to significantly speed up charcode to glyph index */
+ /* conversion. */
+
+ if ( (ULong)( charCode - group->startCharCode ) <
+ (ULong)( group->endCharCode - group->startCharCode ) )
+ goto Found1;
+
+ for ( group = cmap8_12->groups; group < limit; group++ )
+ {
+ /* the ranges are sorted in increasing order. If we are out of */
+ /* the range here, the char code isn't in the charmap, so exit. */
+
+ if ( charCode > group->endCharCode )
+ continue;
+
+ if ( charCode >= group->startCharCode )
+ goto Found;
+ }
+ return 0;
+
+ Found:
+ cmap8_12->last_group = group;
+
+ Found1:
+ /* Theoretically, glyph indices > 0xFFFF are possible with this format,
+ but since all other TrueType tables expect 16bit glyph indices only
+ it doesn't make sense to support this. */
+ return (UShort)( group->startGlyphID +
+ ( charCode - group->startCharCode ) );
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttcmap.h b/Build/source/libs/freetype/lib/ttcmap.h
new file mode 100644
index 00000000000..ea16554c9d2
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttcmap.h
@@ -0,0 +1,202 @@
+/*******************************************************************
+ *
+ * ttcmap.h
+ *
+ * TrueType Character Mappings
+ *
+ * Copyright 1996-2002 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.
+ *
+ *
+ ******************************************************************/
+
+#ifndef TTCMAP_H
+#define TTCMAP_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /* format 0 */
+
+ struct TCMap0_
+ {
+ PByte glyphIdArray;
+ };
+
+ typedef struct TCMap0_ TCMap0;
+ typedef TCMap0* PCMap0;
+
+
+ /* format 2 */
+
+ struct TCMap2SubHeader_
+ {
+ UShort firstCode; /* first valid low byte */
+ UShort entryCount; /* number of valid low bytes */
+ Short idDelta; /* delta value to glyphIndex */
+ UShort idRangeOffset; /* offset from here to 1st code */
+ };
+
+ typedef struct TCMap2SubHeader_ TCMap2SubHeader;
+ typedef TCMap2SubHeader* PCMap2SubHeader;
+
+ struct TCMap2_
+ {
+ PUShort subHeaderKeys;
+ /* high byte mapping table */
+ /* value = subHeader index * 8 */
+
+ PCMap2SubHeader subHeaders;
+ PUShort glyphIdArray;
+ UShort numGlyphId; /* control value */
+ };
+
+ typedef struct TCMap2_ TCMap2;
+ typedef TCMap2* PCMap2;
+
+
+ /* format 4 */
+
+ struct TCMap4Segment_
+ {
+ UShort endCount;
+ UShort startCount;
+ Short idDelta; /* in the specs defined as UShort but the
+ example there gives negative values... */
+ UShort idRangeOffset;
+ };
+
+ typedef struct TCMap4Segment_ TCMap4Segment;
+ typedef TCMap4Segment* PCMap4Segment;
+
+ struct TCMap4_
+ {
+ UShort segCountX2; /* number of segments * 2 */
+ UShort searchRange; /* these parameters can be used */
+ UShort entrySelector; /* for a binary search */
+ UShort rangeShift;
+
+ PCMap4Segment segments;
+ PUShort glyphIdArray;
+ UShort numGlyphId; /* control value */
+ };
+
+ typedef struct TCMap4_ TCMap4;
+ typedef TCMap4* PCMap4;
+
+
+ /* format 6 */
+
+ struct TCMap6_
+ {
+ UShort firstCode; /* first character code of subrange */
+ UShort entryCount; /* number of character codes in subrange */
+
+ PUShort glyphIdArray;
+ };
+
+ typedef struct TCMap6_ TCMap6;
+ typedef TCMap6* PCMap6;
+
+
+ /* formats 8 & 12 */
+
+ /* auxiliary table for format 8 and 12 */
+
+ struct TCMapGroup_
+ {
+ ULong startCharCode;
+ ULong endCharCode;
+ ULong startGlyphID;
+ };
+
+ typedef struct TCMapGroup_ TCMapGroup;
+ typedef TCMapGroup* PCMapGroup;
+
+ /* FreeType handles format 8 and 12 identically. It is not necessary to
+ cover mixed 16bit and 32bit codes since FreeType always uses ULong
+ for input character codes -- converting Unicode surrogates to 32bit
+ character codes must be done by the application. */
+
+ struct TCMap8_12_
+ {
+ ULong nGroups;
+ PCMapGroup groups;
+
+ PCMapGroup last_group; /* last used group; this is a small */
+ /* cache to potentially increase speed */
+ };
+
+ typedef struct TCMap8_12_ TCMap8_12;
+ typedef TCMap8_12* PCMap8_12;
+
+
+ /* charmap table */
+
+ struct TCMapTable_
+ {
+ UShort platformID;
+ UShort platformEncodingID;
+ UShort format;
+ UShort length;
+ UShort version;
+
+ Bool loaded;
+ ULong offset;
+
+ union
+ {
+ TCMap0 cmap0;
+ TCMap2 cmap2;
+ TCMap4 cmap4;
+ TCMap6 cmap6;
+ TCMap8_12 cmap8_12;
+ } c;
+ };
+
+ typedef struct TCMapTable_ TCMapTable;
+ typedef TCMapTable* PCMapTable;
+
+
+
+ /* Load character mappings directory when face is loaded. */
+ /* The mappings themselves are only loaded on demand. */
+
+ FT_INTERNAL_DEF( TT_Error )
+ CharMap_Load( PCMapTable table,
+ TT_Stream input );
+
+
+ /* Destroy one character mapping table */
+
+ FT_INTERNAL_DEF( TT_Error )
+ CharMap_Free( PCMapTable table );
+
+
+ /* Use character mapping table to perform mapping */
+
+ FT_INTERNAL_DEF( UShort )
+ CharMap_Index( PCMapTable cmap,
+ ULong charCode );
+
+ /* NOTE: The PFace type isn't defined at this point */
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTCMAP_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttconfig.h b/Build/source/libs/freetype/lib/ttconfig.h
new file mode 100644
index 00000000000..7a30ebeb18d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttconfig.h
@@ -0,0 +1,273 @@
+/**************************************************************************
+ *
+ * ttconfig.h 1.2
+ *
+ * Configuration settings header file.
+ *
+ * Copyright 1996-2002 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.
+ *
+ * Notes:
+ *
+ * All the configuration #define statements have been gathered in
+ * this file to allow easy check and modification.
+ *
+ * The platform specificities are gathered in arch/<sys>/ft_conf.h
+ * which is included by this file.
+ *
+ * Changes between 1.2 and 1.1 :
+ *
+ * - the EXPORT_DEF/EXPORT_FUNC/LOCAL_DEF/LOCAL_FUNC mechanism have
+ * replaced with a more elaborate one (with FT_ before) that allows
+ * addition of qualifiers _after_ the type, which is needed for DLLs.
+ *
+ *************************************************************************/
+
+#ifndef TTCONFIG_H
+#define TTCONFIG_H
+
+
+
+/* --------------- auto configuration ---------------------------------- */
+
+/*************************************************************************/
+/* Here we include the file ft_conf.h for system dependent stuff. */
+/* The specific makefile is responsible for providing the right path to */
+/* this file. */
+
+#include "ft_conf.h"
+
+
+/*************************************************************************/
+/* */
+/* Some more settings used to be here, but they are now chosen */
+/* in the system-dependent file arch/<system>/ft_conf.h */
+
+
+
+/* --------------- special debugging ----------------------------------- */
+
+/*************************************************************************/
+/* Define this if you want to generate a special debug version of the */
+/* rasterizer. This will progressively draw the glyphs while the */
+/* computations are done directly on the graphics screen... (with */
+/* inverted glyphs). */
+/* */
+/* Use it at your own risk! It is not maintained currently. */
+/* */
+/* IMPORTANT: This is reserved to developers willing to debug the */
+/* rasterizer, which seems working very well in its */
+/* current state... */
+
+/* #define DEBUG_RASTER */
+
+
+/*************************************************************************/
+/* Define this to have a simple debugger version of RunIns(). */
+/* */
+/* Use it at your own risk! It is not maintained currently. */
+
+/* #define DEBUG_INTERPRETER */
+
+
+/*************************************************************************/
+/* Define this to have some housekeeping of allocation and deallocation. */
+/* */
+/* Please note that probably not all OS-specific versions of ttmemory.c */
+/* provide this functionality. */
+
+/* #define DEBUG_MEMORY */
+
+
+/*************************************************************************/
+/* Define this to have bounds checking for file buffer frames. */
+/* */
+/* Please note that probably not all OS-specific versions of ttfile.c */
+/* provide this functionality. */
+
+/* #define DEBUG_FILE */
+
+
+
+/* --------------- arithmetic and processor support -------------------- */
+
+/*************************************************************************/
+/* define ALIGNMENT to your processor/environment preferred alignment */
+/* size. A value of 8 should work on all current processors, even */
+/* 64-bits ones. */
+
+#ifndef ALIGNMENT
+#define ALIGNMENT 8
+#endif
+
+
+
+/* --------------- compilation model and naughty processors support ---- */
+
+/*************************************************************************/
+/* Under normal operation, the library is compiled into a single object */
+/* file. This gets rids of all the external symbols defined in each */
+/* component interface, and de-pollutes the name-space. */
+/* */
+/* However, you can still compile components into separate object files, */
+/* and gather all of them into the library. But you should then declare */
+/* some functions as externally visible. */
+/* */
+/* We use two macros, namely FT_INTERNAL_FUNC and FT_INTERNAL_DEF, which */
+/* apply to functions that are internal to the engine, and should never */
+/* be seen or linked by a client application. */
+/* */
+/* FT_INTERNAL_DEF used in header (.h) files, to define a function */
+/* that will be seen by other components. This */
+/* translates to "extern" in normal mode, and to */
+/* "static" in single-object mode. */
+/* */
+/* FT_INTERNAL_FUNC used in implementation (.c) files, just before */
+/* the function body. This translates to nothing */
+/* in normal mode, and to "static" in single-object */
+/* mode. */
+/* */
+/* It is called a "MAKE_OPTION" because the macro must be defined in the */
+/* Makefile, rather than this one. It allows any developer to quickly */
+/* switch from one mode to the other without messing with "ttconfig.h" */
+/* each time. */
+/* */
+/* The following macros are needed to compile the library with some */
+/* 16-bit (the infamous `_cdecl', `__loadds', `_export', `FAR', etc. */
+/* stuff) or perhaps C++ compilers (extern "C"). The typename is passed */
+/* as an argument, which allows the macro to add stuff _after_ the */
+/* typename, which is required by 16-bit msdos compiler syntax. */
+
+#ifndef TT_MAKE_OPTION_SINGLE_OBJECT
+
+#ifndef FT_INTERNAL_FUNC
+#define FT_INTERNAL_FUNC( type ) type
+#endif
+#ifndef FT_INTERNAL_DEF
+#define FT_INTERNAL_DEF( type ) extern type
+#endif
+
+#else /* ! TT_MAKE_OPTION_SINGLE_OBJECT */
+
+#ifndef FT_INTERNAL_FUNC
+#define FT_INTERNAL_FUNC( type ) static type
+#endif
+#ifndef FT_INTERNAL_DEF
+#define FT_INTERNAL_DEF( type ) static type
+#endif
+
+#endif /* TT_MAKE_OPTION_SINGLE_OBJECT */
+
+/* This is for variables; default is using the same as functions. */
+#ifndef FT_INTERNAL_DECL
+#define FT_INTERNAL_DECL( type ) FT_INTERNAL_DEF( type )
+#endif
+#ifndef FT_INTERNAL_VAR
+#define FT_INTERNAL_VAR( type ) FT_INTERNAL_DECL( type )
+#endif
+
+
+/*************************************************************************/
+/* Define FT_EXPORT_DEF and FT_EXPORT_FUNC as needed to build e.g. a DLL.*/
+/* All variables and functions visible from outside have these prefixes. */
+
+/* Backward compatibility only. Don't use for new code. */
+#ifdef EXPORT_DEF
+#define FT_EXPORT_DEF( type ) EXPORT_DEF type
+#endif
+#ifdef EXPORT_FUNC
+#define FT_EXPORT_FUNC( type ) EXPORT_FUNC type
+#endif
+/* End of backward compatibility section. */
+
+#ifndef FT_EXPORT_DEF
+#define FT_EXPORT_DEF( type ) extern type
+#endif
+
+#ifndef FT_EXPORT_FUNC
+#define FT_EXPORT_FUNC( type ) type
+#endif
+
+/* This is for variables; default is using the same as functions. */
+#ifndef FT_EXPORT_DECL
+#define FT_EXPORT_DECL( type ) FT_EXPORT_DEF( type )
+#endif
+#ifndef FT_EXPORT_VAR
+#define FT_EXPORT_VAR( type ) FT_EXPORT_DECL( type )
+#endif
+
+
+
+/* --------------- miscellaneous --------------------------------------- */
+
+/*************************************************************************/
+/* The number of extensions available. Don't change this value */
+/* except if you add new extensions to the engine. */
+
+#define TT_MAX_EXTENSIONS 8
+
+
+
+/* --------------- automatic setup -- don't touch ---------------------- */
+
+/*************************************************************************/
+/* If HAVE_TT_TEXT is defined we don't provide a default typedef for */
+/* defining TT_Text. */
+
+#ifndef HAVE_TT_TEXT
+#define HAVE_TT_TEXT
+ typedef char TT_Text;
+#endif
+
+
+/*************************************************************************/
+/* We define NULL in case it's not defined yet. The default */
+/* location is stdlib.h. */
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+
+/*************************************************************************/
+/* Some systems can't use vfprintf for error messages on stderr; if */
+/* HAVE_PRINT_FUNCTION is defined, the Print macro must be supplied */
+/* externally (having the same parameters). */
+/* */
+/* This is only used by the "ttdebug" component, which should be linked */
+/* to the engine only in debug mode. */
+
+#if defined( DEBUG_LEVEL_TRACE ) || defined( DEBUG_LEVEL_ERROR )
+#ifndef HAVE_PRINT_FUNCTION
+#define Print( format, ap ) vfprintf( stderr, (format), (ap) )
+#endif
+#endif
+
+
+/* --------------- internal (developer) configuration toggles ---------- */
+
+/*************************************************************************/
+/* Do not undefine this configuration macro. It is now a default that */
+/* must be kept in all release builds. */
+#undef TT_STATIC_INTERPRETER
+
+
+/*************************************************************************/
+/* Define this if you want to generate a static raster. This makes a */
+/* non re-entrant version of the scan-line converter, which is about */
+/* 10% faster and 50% bigger than an indirect one! */
+/* */
+/* NOTE : this is different from TT_CONFIG_OPTION_STATIC_RASTER. */
+/* This one only affects the calling convention. */
+#undef TT_STATIC_RASTER
+
+
+#endif /* TTCONFIG_H */
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttdebug.c b/Build/source/libs/freetype/lib/ttdebug.c
new file mode 100644
index 00000000000..4afe2dcc5ba
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttdebug.c
@@ -0,0 +1,404 @@
+/* Simple debugging component. Temporary */
+
+#include "ttdebug.h"
+#include "tttables.h"
+#include "ttobjs.h"
+
+
+#ifdef DEBUG_LEVEL_TRACE
+ char tt_trace_levels[trace_max];
+#endif
+
+#if defined( DEBUG_LEVEL_ERROR ) || defined( DEBUG_LEVEL_TRACE )
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+
+ static String tempStr[128];
+
+ static const String* OpStr[256] =
+ {
+ "SVTCA y", /* Set vectors to coordinate axis y */
+ "SVTCA x", /* Set vectors to coordinate axis x */
+ "SPvTCA y", /* Set Proj. vec. to coord. axis y */
+ "SPvTCA x", /* Set Proj. vec. to coord. axis x */
+ "SFvTCA y", /* Set Free. vec. to coord. axis y */
+ "SFvTCA x", /* Set Free. vec. to coord. axis x */
+ "SPvTL //", /* Set Proj. vec. parallel to segment */
+ "SPvTL +", /* Set Proj. vec. normal to segment */
+ "SFvTL //", /* Set Free. vec. parallel to segment */
+ "SFvTL +", /* Set Free. vec. normal to segment */
+ "SPvFS", /* Set Proj. vec. from stack */
+ "SFvFS", /* Set Free. vec. from stack */
+ "GPV", /* Get projection vector */
+ "GFV", /* Get freedom vector */
+ "SFvTPv", /* Set free. vec. to proj. vec. */
+ "ISECT", /* compute intersection */
+
+ "SRP0", /* Set reference point 0 */
+ "SRP1", /* Set reference point 1 */
+ "SRP2", /* Set reference point 2 */
+ "SZP0", /* Set Zone Pointer 0 */
+ "SZP1", /* Set Zone Pointer 1 */
+ "SZP2", /* Set Zone Pointer 2 */
+ "SZPS", /* Set all zone pointers */
+ "SLOOP", /* Set loop counter */
+ "RTG", /* Round to Grid */
+ "RTHG", /* Round to Half-Grid */
+ "SMD", /* Set Minimum Distance */
+ "ELSE", /* Else */
+ "JMPR", /* Jump Relative */
+ "SCvTCi", /* Set CVT */
+ "SSwCi", /* */
+ "SSW", /* */
+
+ "DUP",
+ "POP",
+ "CLEAR",
+ "SWAP",
+ "DEPTH",
+ "CINDEX",
+ "MINDEX",
+ "AlignPTS",
+ "INS_$28",
+ "UTP",
+ "LOOPCALL",
+ "CALL",
+ "FDEF",
+ "ENDF",
+ "MDAP[-]",
+ "MDAP[r]",
+
+ "IUP[y]",
+ "IUP[x]",
+ "SHP[0]",
+ "SHP[1]",
+ "SHC[0]",
+ "SHC[1]",
+ "SHZ[0]",
+ "SHZ[1]",
+ "SHPIX",
+ "IP",
+ "MSIRP[0]",
+ "MSIRP[1]",
+ "AlignRP",
+ "RTDG",
+ "MIAP[-]",
+ "MIAP[r]",
+
+ "NPushB",
+ "NPushW",
+ "WS",
+ "RS",
+ "WCvtP",
+ "RCvt",
+ "GC[0]",
+ "GC[1]",
+ "SCFS",
+ "MD[0]",
+ "MD[1]",
+ "MPPEM",
+ "MPS",
+ "FlipON",
+ "FlipOFF",
+ "DEBUG",
+
+ "LT",
+ "LTEQ",
+ "GT",
+ "GTEQ",
+ "EQ",
+ "NEQ",
+ "ODD",
+ "EVEN",
+ "IF",
+ "EIF",
+ "AND",
+ "OR",
+ "NOT",
+ "DeltaP1",
+ "SDB",
+ "SDS",
+
+ "ADD",
+ "SUB",
+ "DIV",
+ "MUL",
+ "ABS",
+ "NEG",
+ "FLOOR",
+ "CEILING",
+ "ROUND[G]",
+ "ROUND[B]",
+ "ROUND[W]",
+ "ROUND[?]",
+ "NROUND[G]",
+ "NROUND[B]",
+ "NROUND[W]",
+ "NROUND[?]",
+
+ "WCvtF",
+ "DeltaP2",
+ "DeltaP3",
+ "DeltaC1",
+ "DeltaC2",
+ "DeltaC3",
+ "SROUND",
+ "S45Round",
+ "JROT",
+ "JROF",
+ "ROFF",
+ "INS_$7B",
+ "RUTG",
+ "RDTG",
+ "SANGW",
+ "AA",
+
+ "FlipPT",
+ "FlipRgON",
+ "FlipRgOFF",
+ "INS_$83",
+ "INS_$84",
+ "ScanCTRL",
+ "SDPVTL[0]",
+ "SDPVTL[1]",
+ "GetINFO",
+ "IDEF",
+ "ROLL",
+ "MAX",
+ "MIN",
+ "ScanTYPE",
+ "IntCTRL",
+ "INS_$8F",
+
+ "INS_$90",
+ "INS_$91",
+ "INS_$92",
+ "INS_$93",
+ "INS_$94",
+ "INS_$95",
+ "INS_$96",
+ "INS_$97",
+ "INS_$98",
+ "INS_$99",
+ "INS_$9A",
+ "INS_$9B",
+ "INS_$9C",
+ "INS_$9D",
+ "INS_$9E",
+ "INS_$9F",
+
+ "INS_$A0",
+ "INS_$A1",
+ "INS_$A2",
+ "INS_$A3",
+ "INS_$A4",
+ "INS_$A5",
+ "INS_$A6",
+ "INS_$A7",
+ "INS_$A8",
+ "INS_$A9",
+ "INS_$AA",
+ "INS_$AB",
+ "INS_$AC",
+ "INS_$AD",
+ "INS_$AE",
+ "INS_$AF",
+
+ "PushB[0]",
+ "PushB[1]",
+ "PushB[2]",
+ "PushB[3]",
+ "PushB[4]",
+ "PushB[5]",
+ "PushB[6]",
+ "PushB[7]",
+ "PushW[0]",
+ "PushW[1]",
+ "PushW[2]",
+ "PushW[3]",
+ "PushW[4]",
+ "PushW[5]",
+ "PushW[6]",
+ "PushW[7]",
+
+ "MDRP[G]",
+ "MDRP[B]",
+ "MDRP[W]",
+ "MDRP[?]",
+ "MDRP[rG]",
+ "MDRP[rB]",
+ "MDRP[rW]",
+ "MDRP[r?]",
+ "MDRP[mG]",
+ "MDRP[mB]",
+ "MDRP[mW]",
+ "MDRP[m?]",
+ "MDRP[mrG]",
+ "MDRP[mrB]",
+ "MDRP[mrW]",
+ "MDRP[mr?]",
+ "MDRP[pG]",
+ "MDRP[pB]",
+
+ "MDRP[pW]",
+ "MDRP[p?]",
+ "MDRP[prG]",
+ "MDRP[prB]",
+ "MDRP[prW]",
+ "MDRP[pr?]",
+ "MDRP[pmG]",
+ "MDRP[pmB]",
+ "MDRP[pmW]",
+ "MDRP[pm?]",
+ "MDRP[pmrG]",
+ "MDRP[pmrB]",
+ "MDRP[pmrW]",
+ "MDRP[pmr?]",
+
+ "MIRP[G]",
+ "MIRP[B]",
+ "MIRP[W]",
+ "MIRP[?]",
+ "MIRP[rG]",
+ "MIRP[rB]",
+ "MIRP[rW]",
+ "MIRP[r?]",
+ "MIRP[mG]",
+ "MIRP[mB]",
+ "MIRP[mW]",
+ "MIRP[m?]",
+ "MIRP[mrG]",
+ "MIRP[mrB]",
+ "MIRP[mrW]",
+ "MIRP[mr?]",
+ "MIRP[pG]",
+ "MIRP[pB]",
+
+ "MIRP[pW]",
+ "MIRP[p?]",
+ "MIRP[prG]",
+ "MIRP[prB]",
+ "MIRP[prW]",
+ "MIRP[pr?]",
+ "MIRP[pmG]",
+ "MIRP[pmB]",
+ "MIRP[pmW]",
+ "MIRP[pm?]",
+ "MIRP[pmrG]",
+ "MIRP[pmrB]",
+ "MIRP[pmrW]",
+ "MIRP[pmr?]"
+ };
+
+
+ const String* Cur_U_Line( void* _exec )
+ {
+ String s[32];
+
+ Int op, i, n;
+
+ PExecution_Context exec;
+
+
+ exec = _exec;
+
+ op = exec->code[exec->IP];
+
+ sprintf( tempStr, "%s", OpStr[op] );
+
+ if ( op == 0x40 )
+ {
+ n = exec->code[exec->IP + 1];
+ sprintf( s, "(%d)", n );
+ strncat( tempStr, s, 8 );
+
+ if ( n > 20 ) n = 20; /* limit output */
+
+ for ( i = 0; i < n; i++ )
+ {
+ sprintf( s, " $%02hx", exec->code[exec->IP + i + 2] );
+ strncat( tempStr, s, 8 );
+ }
+ }
+ else if ( op == 0x41 )
+ {
+ n = exec->code[exec->IP + 1];
+ sprintf( s, "(%d)", n );
+ strncat( tempStr, s, 8 );
+
+ if ( n > 20 ) n = 20; /* limit output */
+
+ for ( i = 0; i < n; i++ )
+ {
+ sprintf( s, " $%02hx%02hx", exec->code[exec->IP + i*2 + 2],
+ exec->code[exec->IP + i*2 + 3] );
+ strncat( tempStr, s, 8 );
+ }
+ }
+ else if ( (op & 0xF8) == 0xB0 )
+ {
+ n = op - 0xB0;
+
+ for ( i = 0; i <= n; i++ )
+ {
+ sprintf( s, " $%02hx", exec->code[exec->IP + i + 1] );
+ strncat( tempStr, s, 8 );
+ }
+ }
+ else if ( (op & 0xF8) == 0xB8 )
+ {
+ n = op-0xB8;
+
+ for ( i = 0; i <= n; i++ )
+ {
+ sprintf( s, " $%02hx%02hx", exec->code[exec->IP + i*2 + 1],
+ exec->code[exec->IP + i*2 + 2] );
+ strncat( tempStr, s, 8 );
+ }
+ }
+
+ return (String*)tempStr;
+ }
+
+
+ /* the Print() function is defined in ttconfig.h; */
+ /* it defaults to vprintf on systems which have it */
+
+ void TT_Message( const String* fmt, ... )
+ {
+ va_list ap;
+
+ va_start( ap, fmt );
+ Print( fmt, ap );
+ va_end( ap );
+ }
+
+
+ void TT_Panic( const String* fmt, ... )
+ {
+ va_list ap;
+
+ va_start( ap, fmt );
+ Print( fmt, ap );
+ va_end( ap );
+
+ exit( EXIT_FAILURE );
+ }
+
+#endif /* defined( DEBUG_LEVEL_ERROR ) || defined( DEBUG_LEVEL_TRACE ) */
+
+#if defined( DEBUG_LEVEL_TRACE )
+
+ /* use this function to set the values of tt_trace_levels */
+
+ void set_tt_trace_levels( int index, char value )
+ {
+ tt_trace_levels[index] = value;
+ }
+
+#endif
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttdebug.h b/Build/source/libs/freetype/lib/ttdebug.h
new file mode 100644
index 00000000000..0fd1389febb
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttdebug.h
@@ -0,0 +1,170 @@
+/*******************************************************************
+ *
+ * ttdebug.h
+ *
+ * Debugging and Logging component (specification)
+ *
+ * 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). Define
+ * DEBUG_LEVEL_TRACE to enable this mode.
+ *
+ * - error mode:
+ *
+ * Only error messages are generated. Define
+ * DEBUG_LEVEL_ERROR to enable this mode.
+ *
+ * - release mode:
+ *
+ * Error messages are neither sent nor generated. The code is
+ * free from any debugging parts.
+ *
+ ******************************************************************/
+
+#ifndef TTDEBUG_H
+#define TTDEBUG_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+#if defined( DEBUG_LEVEL_TRACE )
+
+ typedef enum Trace_Component_
+ {
+ trace_any = 0,
+ trace_api,
+ trace_interp,
+ trace_load,
+ trace_gload,
+ trace_memory,
+ trace_file,
+ trace_mutex,
+ trace_cache,
+ trace_calc,
+ trace_cmap,
+ trace_extend,
+ trace_objs,
+ trace_raster,
+
+ trace_bitmap,
+ trace_max
+
+ } Trace_Component;
+
+
+ /* Here we define an array to hold the trace levels per component. */
+ /* Since it is globally defined, all array members are set to 0. */
+ /* You should set the values in this array either in your program */
+ /* or with your debugger. */
+ /* */
+ /* Currently, up to eight levels (PTRACE0-PTRACE7, see below) are */
+ /* used in some parts of the engine. */
+ /* */
+ /* For example, to have all tracing messages in the raster */
+ /* component, say */
+ /* */
+ /* #define DEBUG_LEVEL_TRACE */
+ /* #include "ttdebug.h" */
+ /* */
+ /* ... */
+ /* set_tt_trace_levels( trace_raster, 7 ) */
+ /* */
+ /* in your code before initializing the FreeType engine. */
+ /* */
+ /* Maybe it is better to define DEBUG_LEVEL_TRACE in ttconfig.h... */
+
+ extern char tt_trace_levels[trace_max];
+
+ /* IMPORTANT: */
+ /* */
+ /* Each component must define the macro TT_COMPONENT */
+ /* to a valid Trace_Component value before using any */
+ /* PTRACEx macro. */
+ /* */
+
+#define PTRACE( level, varformat ) \
+ if ( tt_trace_levels[TT_COMPONENT] >= level ) TT_Message##varformat
+
+#elif defined( DEBUG_LEVEL_ERROR )
+
+#define PTRACE( level, varformat ) /* nothing */
+
+#else /* RELEASE MODE */
+
+#define TT_Assert( condition, action ) /* nothing */
+
+#define PTRACE( level, varformat ) /* nothing */
+#define PERROR( varformat ) /* nothing */
+#define PANIC( varformat ) /* nothing */
+
+#endif
+
+
+/************************************************************************/
+/* */
+/* Define macros and fuctions that are common to the debug and trace */
+/* modes. */
+/* */
+
+#if defined( DEBUG_LEVEL_TRACE ) || defined( DEBUG_LEVEL_ERROR )
+
+
+#define TT_Assert( condition, action ) if ( !(condition) ) ( action )
+
+ void TT_Message( const String* fmt, ... );
+ void TT_Panic ( const String* fmt, ... );
+ /* print a message and exit */
+
+ const String* Cur_U_Line( void* exec );
+
+#define PERROR( varformat ) TT_Message##varformat
+#define PANIC( varformat ) TT_Panic##varformat
+
+#endif
+
+#if defined( DEBUG_LEVEL_TRACE )
+
+ void set_tt_trace_levels( int index, char value );
+
+#endif
+
+
+#define PTRACE0( varformat ) PTRACE( 0, varformat )
+#define PTRACE1( varformat ) PTRACE( 1, varformat )
+#define PTRACE2( varformat ) PTRACE( 2, varformat )
+#define PTRACE3( varformat ) PTRACE( 3, varformat )
+#define PTRACE4( varformat ) PTRACE( 4, varformat )
+#define PTRACE5( varformat ) PTRACE( 5, varformat )
+#define PTRACE6( varformat ) PTRACE( 6, varformat )
+#define PTRACE7( varformat ) PTRACE( 7, varformat )
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+
+#endif /* TTDEBUG_H */
diff --git a/Build/source/libs/freetype/lib/ttengine.h b/Build/source/libs/freetype/lib/ttengine.h
new file mode 100644
index 00000000000..e11df7e2884
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttengine.h
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * ttengine.h 1.1
+ *
+ * Engine instance structure definition
+ * (this spec has no associated 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.
+ *
+ * New in 1.1 :
+ *
+ * - added the 'raster_lock' mutex field to synchronize
+ * scan-line conversion in thread-safe and re-entrant builds.
+ *
+ *************************************************************************/
+
+#ifndef TTENGINE_H
+#define TTENGINE_H
+
+#include "tttypes.h"
+#include "ttconfig.h"
+#include "freetype.h"
+#include "ttmutex.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /***********************************************************************/
+ /* */
+ /* The freetype engine instance structure. */
+ /* */
+ /* This structure holds all the data that is necessary to run one */
+ /* instance of the freetype engine. It is needed to get a completely */
+ /* completely re-entrant version of the library. */
+ /* */
+ /* The goal is to move _all_ component-specific variables, either */
+ /* static or global in the structure; the component initializers and */
+ /* finalizers will all be called with the address of a valid */
+ /* TEngine_Instance. */
+ /* */
+ /***********************************************************************/
+
+ struct TEngine_Instance_
+ {
+ TMutex lock; /* engine lock */
+
+ void* list_free_elements;
+
+ void* objs_face_class; /* the face cache class */
+ void* objs_instance_class; /* the instance cache class */
+ void* objs_execution_class; /* the context cache class */
+ void* objs_glyph_class; /* the glyph cache class */
+
+ void* objs_face_cache; /* these caches are used to track */
+ void* objs_exec_cache; /* the current face and execution */
+ /* context objects */
+
+ void* file_component; /* ttfile implementation dependent */
+
+ TMutex raster_lock; /* mutex for this engine render pool */
+ void* raster_component; /* ttraster implementation depedent */
+ Byte raster_palette[5]; /* gray-levels palette for anti-aliasing */
+
+ void* extension_component; /* extensions dependent */
+
+#if 0
+ TT_Glyph_Loader_Callback glCallback; /* glyph loader callback, if any */
+#endif
+ };
+
+ /* NOTE : The raster's lock is only acquired by the Render_Glyph and */
+ /* Render_Gray_Glyph functions, which always release it on exit */
+ /* They do not lock the engine mutex. This means you shouldn't */
+ /* be concerned about deadlocks between the two mutexes, as */
+ /* these should never appear.. */
+
+ typedef struct TEngine_Instance_ TEngine_Instance;
+ typedef TEngine_Instance* PEngine_Instance;
+
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE /* for re-entrant builds */
+
+#define ENGINE_ARG TEngine_Instance* _engine
+#define ENGINE_ARGS TEngine_Instance* _engine,
+
+#define ENGINE_VAR _engine
+#define ENGINE_VARS _engine,
+
+#define ENGINE _engine
+
+#else /* for thread-unsafe builds */
+
+#define ENGINE_ARG /* none */
+#define ENGINE_ARGS /* none */
+
+#define ENGINE_VAR /* nothing */
+#define ENGINE_VARS /* nothing */
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTENGINE_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttextend.c b/Build/source/libs/freetype/lib/ttextend.c
new file mode 100644
index 00000000000..6a2813a80d7
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttextend.c
@@ -0,0 +1,212 @@
+/*******************************************************************
+ *
+ * ttextend.c 2.0
+ *
+ * Extensions Interface
+ *
+ * Copyright 1996-2000 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 is an updated version of the extension component, now
+ * located in the main library's source directory. It allows
+ * the dynamic registration/use of various face object extensions
+ * through a simple API.
+ *
+ ******************************************************************/
+
+#include "ttextend.h"
+#include "ttengine.h"
+#include "ttmemory.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_extend
+
+
+ struct TExtension_Registry_
+ {
+ Int num_extensions;
+ Long cur_offset;
+ TExtension_Class classes[TT_MAX_EXTENSIONS];
+ };
+
+ typedef struct TExtension_Registry_ TExtension_Registry;
+ typedef TExtension_Registry* PExtension_Registry;
+
+
+
+ /* Initialize the extension component */
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTExtend_Init( PEngine_Instance engine )
+ {
+ TT_Error error;
+ PExtension_Registry exts;
+
+
+ if ( ALLOC( exts, sizeof ( TExtension_Registry ) ) )
+ return error;
+
+ exts->num_extensions = 0;
+ exts->cur_offset = 0;
+ engine->extension_component = (void*)exts;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* Finalize the extension component */
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTExtend_Done( PEngine_Instance engine )
+ {
+ FREE( engine->extension_component );
+ return TT_Err_Ok;
+ }
+
+
+ /* Register a new extension */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Register_Extension( PEngine_Instance engine,
+ Long id,
+ Long size,
+ PExt_Constructor create,
+ PExt_Destructor destroy )
+ {
+ PExtension_Registry exts;
+ PExtension_Class clazz;
+ Int p;
+
+
+ exts = (PExtension_Registry)engine->extension_component;
+ if ( !exts )
+ return TT_Err_Ok;
+
+ p = exts->num_extensions;
+
+ if ( p >= TT_MAX_EXTENSIONS )
+ return TT_Err_Too_Many_Extensions;
+
+ clazz = exts->classes + p;
+ clazz->id = id;
+ clazz->size = size;
+ clazz->build = create;
+ clazz->destroy = destroy;
+
+ clazz->offset = exts->cur_offset;
+
+ exts->num_extensions++;
+ exts->cur_offset += ( size + ALIGNMENT-1 ) & -ALIGNMENT;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* Query an extension block by extension_ID */
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Extension_Get( PFace face,
+ Long extension_id,
+ void** extension_block )
+ {
+ PExtension_Registry registry;
+ PExtension_Class clazz;
+ Int n;
+
+
+ if ( !face->extension )
+ return TT_Err_Extensions_Unsupported;
+
+ registry = (PExtension_Registry)face->engine->extension_component;
+
+ for ( n = 0; n < face->n_extensions; n++ )
+ {
+ clazz = registry->classes + n;
+ if ( clazz->id == extension_id )
+ {
+ *extension_block = (PByte)face->extension + clazz->offset;
+ return TT_Err_Ok;
+ }
+ }
+
+ return TT_Err_Invalid_Extension_Id;
+ }
+
+
+ /* Destroy all extensions within a face object. Called by the */
+ /* face object destructor. */
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Extension_Destroy( PFace face )
+ {
+ PEngine_Instance engine = face->engine;
+ PExtension_Registry registry;
+ PExtension_Class clazz;
+ Int n;
+ PByte ext;
+
+
+ registry = (PExtension_Registry)engine->extension_component;
+
+ for ( n = 0; n < face->n_extensions; n++ )
+ {
+ clazz = registry->classes + n;
+ ext = (PByte)face->extension + clazz->offset;
+
+ /* the destructor is optional */
+ if ( clazz->destroy )
+ clazz->destroy( (void*)ext, face );
+ }
+
+ /* destroy the face's extension block too */
+ FREE( face->extension );
+ face->n_extensions = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* Create an extension within a face object. Called by the */
+ /* face object constructor. */
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Extension_Create( PFace face )
+ {
+ PEngine_Instance engine = face->engine;
+ PExtension_Registry registry;
+ PExtension_Class clazz;
+ TT_Error error;
+ Int n;
+ PByte ext;
+
+
+ registry = (PExtension_Registry)engine->extension_component;
+
+ face->n_extensions = registry->num_extensions;
+ if ( ALLOC( face->extension, registry->cur_offset ) )
+ return error;
+
+ for ( n = 0; n < face->n_extensions; n++ )
+ {
+ clazz = registry->classes + n;
+ ext = (PByte)face->extension + clazz->offset;
+ error = clazz->build( (void*)ext, face );
+ if ( error )
+ goto Fail;
+ }
+ return TT_Err_Ok;
+
+ Fail:
+ Extension_Destroy( face );
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttextend.h b/Build/source/libs/freetype/lib/ttextend.h
new file mode 100644
index 00000000000..5cc05373f75
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttextend.h
@@ -0,0 +1,167 @@
+/*******************************************************************
+ *
+ * ttextend.h 2.0
+ *
+ * Extensions Interface.
+ *
+ * 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 is an updated version of the extension component, now
+ * located in the main library's source directory. It allows
+ * the dynamic registration/use of various face object extensions
+ * through a simple API.
+ *
+ ******************************************************************/
+
+#ifndef TTEXTEND_H
+#define TTEXTEND_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+#include "ttobjs.h"
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /* The extensions don't need to be integrated at compile time into */
+ /* the engine, only at link time. */
+
+
+ /* When a new face object is created, the face constructor calls */
+ /* the extension constructor with the following arguments: */
+ /* */
+ /* ext : typeless pointer to the face's extension block. */
+ /* Its size is the one given at registration time */
+ /* in the extension class's 'size' field. */
+ /* */
+ /* face : the parent face object. Note that the extension */
+ /* constructor is called when the face object is */
+ /* built. */
+
+ typedef TT_Error TExt_Constructor( void* ext, PFace face );
+
+
+ /* When a face object is destroyed, the face destructor calls */
+ /* the extension destructor with the following arguments. */
+ /* */
+ /* ext : typeless pointer to the face's extension block. */
+ /* Its size is the one given at registration time */
+ /* in the extension class's 'size' field. */
+ /* */
+ /* face : the parent face object. Note that the extension */
+ /* destructor is called before the actual face object */
+ /* is destroyed. */
+
+ typedef TT_Error TExt_Destructor ( void* ext, PFace face );
+
+ typedef TExt_Constructor* PExt_Constructor;
+ typedef TExt_Destructor* PExt_Destructor;
+
+
+ struct TExtension_Class_
+ {
+ Long id; /* extension id */
+ Long size; /* size in bytes of extension record */
+ PExt_Constructor build; /* the extension's class constructor */
+ PExt_Destructor destroy; /* the extension's class destructor */
+
+ Long offset; /* offset of ext. record in face obj */
+ /* (set by the engine) */
+ };
+
+ typedef struct TExtension_Class_ TExtension_Class;
+ typedef TExtension_Class* PExtension_Class;
+
+
+#define Build_Extension_ID( a, b, c, d ) \
+ ( ((ULong)(a) << 24) | \
+ ((ULong)(b) << 16) | \
+ ((ULong)(c) << 8 ) | \
+ (ULong)(d) )
+
+ /* A note regarding extensions and the single-object compilation */
+ /* mode : */
+ /* */
+ /* When the engine is compiled as a single object file, extensions */
+ /* must remain linkable *after* compile time. In order to do this, */
+ /* we need to export the functions that an extension may need. */
+ /* Fortunately, we can limit ourselves to : */
+ /* */
+ /* o TT_Register_Extension (previously called Extension_Register) */
+ /* which is to be called by each extension on within */
+ /* it TT_Init_XXXX_Extension initializer. */
+ /* */
+ /* o File and frame access functions. Fortunately, these already */
+ /* have their names prefixed by "TT_", so no change was needed */
+ /* except replacing the FT_INTERNAL_DEF macro with FT_EXPORT_DEF. */
+ /* */
+ /* o Memory access functions, i.e. TT_Alloc and TT_Free. Again, */
+ /* the change is minimal */
+ /* */
+ /* o the table-lookup function : TT_LookUp_Table, formerly known */
+ /* as Load_TrueType_Table in ttload.c. */
+ /* */
+ /* */
+ /* Other than that, an extension should be able to #include all */
+ /* relevant header files to get access to internal types, but */
+ /* should not call engine internal functions.. */
+ /* */
+ /* If there is a need for a specific internal function call, let */
+ /* me known to see if we need to export it by default.. */
+ /* - DavidT */
+ /* */
+
+ /* Register a new extension. Called by extension */
+ /* service initializers. */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Register_Extension( PEngine_Instance engine,
+ Long id,
+ Long size,
+ PExt_Constructor create,
+ PExt_Destructor destroy );
+
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+ /* Initialize the extension component */
+ FT_INTERNAL_DEF( TT_Error )
+ TTExtend_Init( PEngine_Instance engine );
+
+ /* Finalize the extension component */
+ FT_INTERNAL_DEF( TT_Error )
+ TTExtend_Done( PEngine_Instance engine );
+
+ /* Create an extension within a face object. Called by the */
+ /* face object constructor. */
+ FT_INTERNAL_DEF( TT_Error )
+ Extension_Create( PFace face );
+
+ /* Destroy all extensions within a face object. Called by the */
+ /* face object destructor. */
+ FT_INTERNAL_DEF( TT_Error )
+ Extension_Destroy( PFace face );
+#endif
+
+ /* Query an extension block by extension_ID. Called by extension */
+ /* service routines. */
+ FT_EXPORT_DEF( TT_Error )
+ TT_Extension_Get( PFace face,
+ Long extension_id,
+ void** extension_block );
+
+#ifdef __cplusplus
+ }
+#endif
+
+
+#endif /* TTEXTEND_H */
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttfile.c b/Build/source/libs/freetype/lib/ttfile.c
new file mode 100644
index 00000000000..256082dad55
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttfile.c
@@ -0,0 +1,1176 @@
+/*******************************************************************
+ *
+ * ttfile.c (extended version) 2.1
+ *
+ * File I/O Component (body).
+ *
+ * Copyright 1996-2000 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.
+ *
+ * NOTES:
+ *
+ * This implementation relies on the ANSI libc. You may wish to
+ * modify it to get rid of libc and go straight to the your
+ * platform's stream routines.
+ *
+ * The same source code can be used for thread-safe and re-entrant
+ * builds of the library.
+ *
+ * Changes between 2.0 and 2.1 :
+ *
+ * - it is now possible to close a stream's file handle explicitely
+ * through the new API "TT_Flush_Stream". This will simply close
+ * a stream's file handle (useful to save system resources when
+ * dealing with lots of opened fonts). Of course, the function
+ * "TT_Use_Stream" will automatically re-open a stream's handle if
+ * necessary.
+ *
+ * - added "TT_Stream_Size" to replace "TT_File_Size" which wasn't
+ * used anyway. This one returns the size of any stream, even
+ * flushed one (when the previous TT_File_Size could only return
+ * the size of the current working stream). This is used by the
+ * new "Load_TrueType_Any" function in the tables loader.
+ *
+ ******************************************************************/
+
+#include "ttconfig.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "freetype.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttengine.h"
+#include "ttmutex.h"
+#include "ttmemory.h"
+#include "ttfile.h" /* our prototypes */
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_file
+
+
+/* For now, we don't define additional error messages in the core library */
+/* to report open-on demand errors. Define these error as standard ones */
+
+#define TT_Err_Could_Not_ReOpen_File TT_Err_Could_Not_Open_File
+#define TT_Err_Could_Not_ReSeek_File TT_Err_Could_Not_Open_File
+
+ /* This definition is mandatory for each file component! */
+ FT_EXPORT_FUNC( const )
+ TFileFrame TT_Null_FileFrame = { NULL, 0, 0 };
+
+/* It has proven useful to do some bounds checks during development phase. */
+/* They should probably be undefined for speed reasons in a later release. */
+
+#if DEBUG_FILE
+#define CHECK_FRAME( frame, n ) \
+ do { \
+ if ( frame.cursor + n > frame.address + frame.size ) \
+ Panic( "Frame boundary error!\n" ); \
+ } while ( 0 )
+#else
+#define CHECK_FRAME( frame, n ) /* nothing */
+#endif
+
+ /* Because a stream can be flushed, i.e. its file handle can be */
+ /* closed to save system resources, we must keep the stream's file */
+ /* pathname to be able to re-open it on demand when it is flushed */
+
+ struct TStream_Rec_;
+ typedef struct TStream_Rec_ TStream_Rec;
+ typedef TStream_Rec* PStream_Rec;
+
+ struct TStream_Rec_
+ {
+ Bool opened; /* is the stream handle opened ? */
+ TT_Text* name; /* the file's pathname */
+ Long position; /* current position within the file */
+
+ FILE* file; /* file handle */
+ Long base; /* stream base in file */
+ Long size; /* stream size in file */
+ };
+
+ /* We support embedded TrueType files by allowing them to be */
+ /* inside any file, at any location, hence the 'base' argument. */
+ /* Note however that the current implementation does not allow you */
+ /* to specify a 'base' index when opening a file. */
+ /* (will come later) */
+ /* I still don't know if this will turn out useful ?? - DavidT */
+
+#define STREAM2REC( x ) ( (TStream_Rec*)HANDLE_Val( x ) )
+
+ static TT_Error Stream_Activate ( PStream_Rec stream );
+ static TT_Error Stream_Deactivate( PStream_Rec stream );
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /**** ****/
+ /**** N O N R E E N T R A N T I M P L E M E N T A T I O N ****/
+ /**** ****/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+ /* in non-rentrant builds, we allocate a single block where we'll */
+ /* place all the frames smaller than FRAME_CACHE_SIZE, rather than */
+ /* allocating a new block on each access. Bigger frames will be */
+ /* malloced normally in the heap. */
+ /* */
+ /* See TT_Access_Frame() and TT_Forget_Frame() for details. */
+
+#define FRAME_CACHE_SIZE 2048
+
+ /* The TFile_Component structure holds all the data that was */
+ /* previously declared static or global in this component. */
+ /* */
+ /* It is accessible through the 'engine.file_component' */
+ /* variable in re-entrant builds, or directly through the */
+ /* static 'files' variable in other builds. */
+
+ struct TFile_Component_
+ {
+ TMutex lock; /* used by the thread-safe build only */
+ Byte* frame_cache; /* frame cache */
+ PStream_Rec stream; /* current stream */
+ TFileFrame frame; /* current frame */
+ };
+
+ typedef struct TFile_Component_ TFile_Component;
+
+ static TFile_Component files;
+
+#define CUR_Stream files.stream
+#define CUR_Frame files.frame
+
+#define STREAM_VARS /* void */
+#define STREAM_VAR /* void */
+
+/* The macro CUR_Stream denotes the current input stream. */
+/* Note that for the re-entrant version, the 'stream' name has been */
+/* chosen according to the macro STREAM_ARGS. */
+
+/* The macro CUR_Frame denotes the current file frame. */
+/* Note that for the re-entrant version, the 'frame' name has been */
+/* chosen according to the macro FRAME_ARGS. */
+
+/* The macro STREAM_VAR is used when calling public functions */
+/* that need an 'optional' stream argument. */
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ TT_Error error;
+
+
+ MUTEX_Create( files.lock );
+ files.stream = NULL;
+ ZERO_Frame( files.frame );
+
+ if ( ALLOC( files.frame_cache, FRAME_CACHE_SIZE ) )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ FREE( files.frame_cache );
+ MUTEX_Destroy( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Copies or duplicates a given stream.
+ *
+ * Input : org_stream original stream
+ * stream target stream (copy or duplicate)
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream org_stream,
+ TT_Stream* stream )
+ {
+ MUTEX_Lock( files.lock ); /* lock file mutex */
+
+ *stream = org_stream; /* copy the stream */
+ files.stream = STREAM2REC(org_stream); /* set current stream */
+
+ Stream_Activate( files.stream );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream target stream
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ HANDLE_Set( *stream, NULL );
+ MUTEX_Release( files.lock );
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function fails if the byte range is not within the
+ * the file, or if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big in both cases).
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( size <= FRAME_CACHE_SIZE )
+ {
+ /* use the cache */
+ CUR_Frame.address = files.frame_cache;
+ CUR_Frame.size = FRAME_CACHE_SIZE;
+ }
+ else
+ {
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+ }
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if (error)
+ {
+ if ( size > FRAME_CACHE_SIZE )
+ FREE( CUR_Frame.address );
+ CUR_Frame.address = NULL;
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Check_And_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * `size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function truncates `size' if the byte range is not
+ * within the file.
+ *
+ * It will fail if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big).
+ *
+ * It will fail if you make two consecutive calls
+ * to TT_Access_Frame(), without a TT_Forget_Frame() between
+ * them.
+ *
+ * The only difference with TT_Access_Frame() is that we
+ * check that the frame is within the current file. We
+ * otherwise truncate it.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+ Long readBytes, requested;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( size <= FRAME_CACHE_SIZE )
+ {
+ /* use the cache */
+ CUR_Frame.address = files.frame_cache;
+ CUR_Frame.size = FRAME_CACHE_SIZE;
+ }
+ else
+ {
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+ }
+
+ requested = size;
+ readBytes = CUR_Stream->size - TT_File_Pos( STREAM_VAR );
+ if ( size > readBytes )
+ size = readBytes;
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if (error)
+ {
+ if ( requested > FRAME_CACHE_SIZE )
+ FREE( CUR_Frame.address );
+ CUR_Frame.address = NULL;
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Forget_Frame
+ *
+ * Description : Releases a cached frame after reading.
+ *
+ * Input : None
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Forget_Frame( FRAME_ARG )
+ {
+ if ( CUR_Frame.address == NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( CUR_Frame.size > FRAME_CACHE_SIZE )
+ FREE( CUR_Frame.address );
+
+ ZERO_Frame( CUR_Frame );
+
+ return TT_Err_Ok;
+ }
+
+
+#else /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /******** ********/
+ /******** R E E N T R A N T I M P L E M E N T A T I O N ********/
+ /******** ********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+/* a simple macro to access the file component's data */
+#define files ( *((TFile_Component*)engine.file_component) )
+
+#define CUR_Stream STREAM2REC( stream ) /* re-entrant macros */
+#define CUR_Frame (*frame)
+
+#define STREAM_VARS stream,
+#define STREAM_VAR stream
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Init
+ *
+ * Description : Initializes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Init( PEngine_Instance engine )
+ {
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTFile_Done
+ *
+ * Description : Finalizes the File component.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTFile_Done( PEngine_Instance engine )
+ {
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Use_Stream
+ *
+ * Description : Duplicates a stream for a new usage.
+ *
+ * Input : input_stream source stream to duplicate
+ * copy address of target duplicate stream
+ *
+ * Output : error code.
+ * The target stream is set to NULL in case of failure.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Use_Stream( TT_Stream input_stream,
+ TT_Stream* copy )
+ {
+ PStream_Rec rec = STREAM2REC( input_stream );
+
+ return TT_Open_Stream( rec->name, copy );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Done_Stream
+ *
+ * Description : Releases a given stream.
+ *
+ * Input : stream target stream
+ *
+ * Output :
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Done_Stream( TT_Stream* stream )
+ {
+ return TT_Close_Stream( stream );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * 'size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function fails if the byte range is not within the
+ * the file, or if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big in both cases).
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if ( error )
+ {
+ FREE( CUR_Frame.address );
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Check_And_Access_Frame
+ *
+ * Description : Notifies the component that we're going to read
+ * `size' bytes from the current file position.
+ * This function should load/cache/map these bytes
+ * so that they will be addressed by the GET_xxx
+ * functions easily.
+ *
+ * Input : size number of bytes to access.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Notes: The function truncates `size' if the byte range is not
+ * within the file.
+ *
+ * It will fail if there is not enough memory to cache
+ * the bytes properly (which usually means that `size' is
+ * too big).
+ *
+ * It will fail if you make two consecutive calls
+ * to TT_Access_Frame(), without a TT_Forget_Frame() between
+ * them.
+ *
+ * The only difference with TT_Access_Frame() is that we
+ * check that the frame is within the current file. We
+ * otherwise truncate it.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS Long size )
+ {
+ TT_Error error;
+ Long readBytes;
+
+
+ if ( CUR_Frame.address != NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ if ( ALLOC( CUR_Frame.address, size ) )
+ return error;
+ CUR_Frame.size = size;
+
+ readBytes = CUR_Stream->size - TT_File_Pos( STREAM_VAR );
+ if ( size > readBytes )
+ size = readBytes;
+
+ error = TT_Read_File( STREAM_VARS (void*)CUR_Frame.address, size );
+ if ( error )
+ {
+ FREE( CUR_Frame.address );
+ CUR_Frame.size = 0;
+ }
+
+ CUR_Frame.cursor = CUR_Frame.address;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Forget_Frame
+ *
+ * Description : Releases a cached frame after reading.
+ *
+ * Input : None
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Forget_Frame( STREAM_ARGS FRAME_ARG )
+ {
+ if ( CUR_Frame.address == NULL )
+ return TT_Err_Nested_Frame_Access;
+
+ FREE( CUR_Frame.address );
+ ZERO_Frame( CUR_Frame );
+
+ return TT_Err_Ok;
+ }
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*********** ***********/
+ /*********** C O M M O N I M P L E M E N T A T I O N ***********/
+ /*********** ***********/
+ /*******************************************************************/
+ /*******************************************************************/
+ /*******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : Stream_Activate
+ *
+ * Description : activates a stream, this will either:
+ * - open a new file handle if the stream is closed
+ * - move the stream to the head of the linked list
+ *
+ * Input : stream the stream to activate
+ *
+ * Output : error condition.
+ *
+ * Note : This function is also called with fresh new streams
+ * created by TT_Open_Stream(). They have their 'size'
+ * field set to -1.
+ *
+ ******************************************************************/
+
+ static TT_Error Stream_Activate( PStream_Rec stream )
+ {
+ if ( !stream->opened )
+ {
+ if ( (stream->file = fopen( (TT_Text*)stream->name, "rb" )) == 0 )
+ return TT_Err_Could_Not_ReOpen_File;
+
+ stream->opened = TRUE;
+
+ /* A newly created stream has a size field of -1 */
+ if ( stream->size < 0 )
+ {
+ fseek( stream->file, 0, SEEK_END );
+ stream->size = ftell( stream->file );
+ fseek( stream->file, 0, SEEK_SET );
+ }
+
+ /* Reset cursor in file */
+ if ( stream->position )
+ {
+ if ( fseek( stream->file, stream->position, SEEK_SET ) != 0 )
+ {
+ /* error during seek */
+ fclose( stream->file );
+ stream->opened = FALSE;
+ return TT_Err_Could_Not_ReSeek_File;
+ }
+ }
+ }
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Stream_DeActivate
+ *
+ * Description : deactivates a stream, this will :
+ * - close its file handle if it was opened
+ * - remove it from the opened list if necessary
+ *
+ * Input : stream the stream to deactivate
+ *
+ * Output : Error condition
+ *
+ * Note : the function is called whenever a stream is deleted
+ * (_not_ when a stream handle's is closed due to an
+ * activation). However, the stream record isn't
+ * destroyed by it..
+ *
+ ******************************************************************/
+
+ static TT_Error Stream_Deactivate( PStream_Rec stream )
+ {
+ if ( stream->opened )
+ {
+ /* Save its current position within the file */
+ stream->position = ftell( stream->file );
+ fclose( stream->file );
+ stream->file = 0;
+ stream->opened = FALSE;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Stream_Size
+ *
+ * Description : Returns the length of a given stream, even if it
+ * is flushed.
+ *
+ * Input : stream the stream
+ *
+ * Output : Length of stream in bytes.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Stream_Size( TT_Stream stream )
+ {
+ PStream_Rec rec = STREAM2REC( stream );
+
+
+ if ( rec )
+ return rec->size;
+ else
+ return 0; /* invalid stream - return 0 */
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Open_Stream
+ *
+ * Description : Opens the font file and saves the total file size.
+ *
+ * Input : error address of stream's error variable
+ * (re-entrant build only)
+ * filepathname pathname of the file to open
+ * stream address of target TT_Stream structure
+ *
+ * Output : SUCCESS on sucess, FAILURE on error.
+ * The target stream is set to -1 in case of failure.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Open_Stream( const TT_Text* filepathname,
+ TT_Stream* stream )
+ {
+ Int len;
+ TT_Error error;
+ PStream_Rec stream_rec;
+
+ if ( ALLOC( *stream, sizeof ( TStream_Rec ) ) )
+ return error;
+
+ stream_rec = STREAM2REC( *stream );
+
+ stream_rec->file = NULL;
+ stream_rec->size = -1L;
+ stream_rec->base = 0;
+ stream_rec->opened = FALSE;
+ stream_rec->position = 0;
+
+ len = strlen( filepathname ) + 1;
+ if ( ALLOC( stream_rec->name, len ) )
+ goto Fail;
+
+ strncpy( stream_rec->name, filepathname, len );
+
+ error = Stream_Activate( stream_rec );
+ if ( error )
+ goto Fail_Activate;
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ CUR_Stream = stream_rec;
+#endif
+
+ return TT_Err_Ok;
+
+ Fail_Activate:
+ FREE( stream_rec->name );
+ Fail:
+ FREE( stream_rec );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Close_Stream
+ *
+ * Description : Closes a stream.
+ *
+ * Input : stream address of target TT_Stream structure
+ *
+ * Output : SUCCESS (always).
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TT_Close_Stream( TT_Stream* stream )
+ {
+ PStream_Rec rec = STREAM2REC( *stream );
+
+
+ Stream_Deactivate( rec );
+ FREE( rec->name );
+ FREE( rec );
+
+ HANDLE_Set( *stream, NULL );
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Flush_Stream
+ *
+ * Description : Flushes a stream, i.e., closes its file handle.
+ *
+ * Input : stream address of target TT_Stream structure
+ *
+ * Output : Error code
+ *
+ * NOTE : Never flush the current opened stream. This means that
+ * you should _never_ call this function between a
+ * TT_Use_Stream() and a TT_Done_Stream()!
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Flush_Stream( TT_Stream* stream )
+ {
+ PStream_Rec rec = STREAM2REC( *stream );
+
+
+ if ( rec )
+ {
+ Stream_Deactivate( rec );
+ return TT_Err_Ok;
+ }
+ else
+ return TT_Err_Invalid_Argument;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Seek_File
+ *
+ * Description : Seeks the file cursor to a different position.
+ *
+ * Input : position new position in file
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Seek_File( STREAM_ARGS Long position )
+ {
+ position += CUR_Stream->base;
+
+ if ( fseek( CUR_Stream->file, position, SEEK_SET ) )
+ return TT_Err_Invalid_File_Offset;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Skip_File
+ *
+ * Description : Skips forward the file cursor.
+ *
+ * Input : distance number of bytes to skip
+ *
+ * Output : see TT_Seek_File()
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Skip_File( STREAM_ARGS Long distance )
+ {
+ return TT_Seek_File( STREAM_VARS ftell( CUR_Stream->file ) -
+ CUR_Stream->base + distance );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_File
+ *
+ * Description : Reads a chunk of the file and copies it to memory.
+ *
+ * Input : buffer target buffer
+ * count length in bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if out of range.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_File( STREAM_ARGS void* buffer, Long count )
+ {
+ if ( fread( buffer, 1, count, CUR_Stream->file ) != (ULong)count )
+ return TT_Err_Invalid_File_Read;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_Read_At_File
+ *
+ * Description : Reads file at a specified position.
+ *
+ * Input : position position to seek to before read
+ * buffer target buffer
+ * count number of bytes to read
+ *
+ * Output : SUCCESS on success. FAILURE if error.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Read_At_File( STREAM_ARGS Long position,
+ void* buffer,
+ Long count )
+ {
+ TT_Error error;
+
+
+ if ( (error = TT_Seek_File( STREAM_VARS position )) != TT_Err_Ok ||
+ (error = TT_Read_File( STREAM_VARS buffer, count )) != TT_Err_Ok )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TT_File_Pos
+ *
+ * Description : Returns current file seek pointer.
+ *
+ * Input : none
+ *
+ * Output : Current file position.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_File_Pos( STREAM_ARG )
+ {
+ return ftell( CUR_Stream->file ) - CUR_Stream->base;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Byte
+ *
+ * Description : Extracts a byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted Byte.
+ *
+ ******************************************************************/
+#if 0
+ FT_EXPORT_FUNC( Byte )
+ TT_Get_Byte( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Byte)(*CUR_Frame.cursor++);
+ }
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : GET_Char
+ *
+ * Description : Extracts a signed byte from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted char.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Char )
+ TT_Get_Char( FRAME_ARG )
+ {
+ CHECK_FRAME( CUR_Frame, 1 );
+
+ return (Char)(*CUR_Frame.cursor++);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_Short
+ *
+ * Description : Extracts a short from the current file frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted short.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Short )
+ TT_Get_Short( FRAME_ARG )
+ {
+ Short getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = (Short)((CUR_Frame.cursor[0] << 8) |
+ CUR_Frame.cursor[1]);
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_UShort
+ *
+ * Description : Extracts an unsigned short from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted ushort.
+ *
+ ******************************************************************/
+#if 0
+ FT_EXPORT_FUNC( UShort )
+ TT_Get_UShort( FRAME_ARG )
+ {
+ UShort getshort;
+
+
+ CHECK_FRAME( CUR_Frame, 2 );
+
+ getshort = (UShort)((CUR_Frame.cursor[0] << 8) |
+ CUR_Frame.cursor[1]);
+
+ CUR_Frame.cursor += 2;
+
+ return getshort;
+ }
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : GET_Long
+ *
+ * Description : Extracts a long from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted long.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_Get_Long( FRAME_ARG )
+ {
+ Long getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ((Long)CUR_Frame.cursor[0] << 24) |
+ ((Long)CUR_Frame.cursor[1] << 16) |
+ ((Long)CUR_Frame.cursor[2] << 8 ) |
+ (Long)CUR_Frame.cursor[3];
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GET_ULong
+ *
+ * Description : Extracts an unsigned long from the frame.
+ *
+ * Input : None or current frame
+ *
+ * Output : Extracted ulong.
+ *
+ ******************************************************************/
+#if 0
+ FT_EXPORT_FUNC( ULong )
+ TT_Get_ULong( FRAME_ARG )
+ {
+ ULong getlong;
+
+
+ CHECK_FRAME( CUR_Frame, 4 );
+
+ getlong = ( ((ULong)CUR_Frame.cursor[0] << 24) |
+ ((ULong)CUR_Frame.cursor[1] << 16) |
+ ((ULong)CUR_Frame.cursor[2] << 8 ) |
+ (ULong)CUR_Frame.cursor[3] );
+
+ CUR_Frame.cursor += 4;
+
+ return getlong;
+ }
+#endif
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttfile.h b/Build/source/libs/freetype/lib/ttfile.h
new file mode 100644
index 00000000000..13d5fb98e15
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttfile.h
@@ -0,0 +1,430 @@
+/*******************************************************************
+ *
+ * ttfile.h 1.4
+ *
+ * File I/O Component (specification).
+ *
+ * Copyright 1996-2002 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.
+ *
+ * Changes between 1.4 and 1.2 :
+ *
+ * - the macros which used to be in ttload.h are now here
+ * (with their underlying functions)
+ *
+ * Changes between 1.3 and 1.2:
+ *
+ * - all functions report error values now
+ *
+ * - the stream semantics have also changed
+ *
+ * Changes between 1.2 and 1.1:
+ *
+ * - added macros to support re-entrant builds
+ *
+ * - added the TT_Duplicate_File function to duplicate streams
+ * (re-entrant builds only)
+ *
+ ******************************************************************/
+
+#ifndef TTFILE_H
+#define TTFILE_H
+
+#include "ttconfig.h"
+#include "freetype.h"
+#include "ttengine.h"
+#include "ttdebug.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /* Initialize file component */
+ FT_INTERNAL_DEF( TT_Error )
+ TTFile_Init( PEngine_Instance engine );
+
+ /* Done with file component */
+ FT_INTERNAL_DEF( TT_Error )
+ TTFile_Done( PEngine_Instance engine );
+
+
+ /****************************************************************/
+ /* */
+ /* Macros. */
+ /* */
+ /****************************************************************/
+
+/* The following macros are defined to simplify the writing of */
+/* the various table and glyph loaders. */
+
+/* For examples see the code in ttload.c, ttgload.c etc. */
+
+#define USE_Stream( original, duplicate ) \
+ ( (error = TT_Use_Stream( original, &duplicate )) != TT_Err_Ok )
+
+#define DONE_Stream( _stream ) \
+ TT_Done_Stream( &_stream )
+
+/* Define a file frame -- use it only when needed */
+#define DEFINE_A_FRAME TFileFrame frame = TT_Null_FileFrame
+
+/* Define a stream -- use it only when needed */
+#define DEFINE_A_STREAM TT_Stream stream
+
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE /* re-entrant implementation */
+
+/* The following macros define the necessary local */
+/* variables used to access streams and frames. */
+
+/* Define stream locals with frame */
+#define DEFINE_STREAM_LOCALS \
+ TT_Error error; \
+ DEFINE_A_STREAM; \
+ DEFINE_A_FRAME
+
+/* Define stream locals without frame */
+#define DEFINE_STREAM_LOCALS_WO_FRAME \
+ TT_Error error; \
+ DEFINE_A_STREAM
+
+/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
+#define DEFINE_LOAD_LOCALS( STREAM ) \
+ TT_Error error; \
+ DEFINE_A_STREAM = (STREAM); \
+ DEFINE_A_FRAME
+
+/* Define locals without frame with a predefined stream - see ttload.c */
+#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
+ TT_Error error; \
+ DEFINE_A_STREAM = (STREAM)
+
+/* Define all locals necessary to access a font file */
+#define DEFINE_ALL_LOCALS \
+ TT_Error error; \
+ DEFINE_A_STREAM; \
+ DEFINE_A_FRAME
+
+
+#define ACCESS_Frame( _size_ ) \
+ ( (error = TT_Access_Frame( stream, \
+ &frame, \
+ (Long)(_size_) )) != TT_Err_Ok )
+#define CHECK_AND_ACCESS_Frame( _size_ ) \
+ ( (error = TT_Check_And_Access_Frame( stream, \
+ &frame, \
+ (Long)(_size_) )) != TT_Err_Ok )
+#define FORGET_Frame() \
+ ( (void)TT_Forget_Frame( stream, &frame ) )
+
+#define GET_Byte() TT_Get_Byte ( &frame )
+#define GET_Char() TT_Get_Char ( &frame )
+#define GET_UShort() TT_Get_UShort( &frame )
+#define GET_Short() TT_Get_Short ( &frame )
+#define GET_Long() TT_Get_Long ( &frame )
+#define GET_ULong() TT_Get_ULong ( &frame )
+#define GET_Tag4() TT_Get_ULong ( &frame )
+
+#define FILE_Pos() TT_File_Pos ( stream )
+
+#define FILE_Seek( _position_ ) \
+ ( (error = TT_Seek_File( stream, \
+ (Long)(_position_) )) != TT_Err_Ok )
+#define FILE_Skip( _distance_ ) \
+ ( (error = TT_Skip_File( stream, \
+ (Long)(_distance_) )) != TT_Err_Ok )
+#define FILE_Read( buffer, count ) \
+ ( (error = TT_Read_File ( stream, \
+ buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+#define FILE_Read_At( pos, buffer, count ) \
+ ( (error = TT_Read_At_File( stream, \
+ (Long)(pos), \
+ buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+
+#else /* thread-safe implementation */
+
+/* Define stream locals with frame -- nothing in thread-safe mode */
+#define DEFINE_STREAM_LOCALS \
+ TT_Error error
+
+/* Define stream locals without frame -- nothing in thread-safe mode */
+#define DEFINE_STREAM_LOCALS_WO_FRAME \
+ TT_Error error
+
+/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
+#define DEFINE_LOAD_LOCALS( STREAM ) \
+ TT_Error error
+
+
+/* Define locals without frame with a predefined stream - see ttload.c */
+#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
+ TT_Error error
+
+/* Define all locals necessary to access a font file */
+#define DEFINE_ALL_LOCALS \
+ TT_Error error; \
+ DEFINE_A_STREAM
+
+
+#define ACCESS_Frame( _size_ ) \
+ ( (error = TT_Access_Frame( (Long)(_size_) )) != TT_Err_Ok )
+#define CHECK_AND_ACCESS_Frame( _size_ ) \
+ ( (error = TT_Check_And_Access_Frame( (Long)(_size_) )) != TT_Err_Ok )
+#define FORGET_Frame() \
+ ( (void)TT_Forget_Frame() )
+
+#define GET_Byte() TT_Get_Byte ()
+#define GET_Char() TT_Get_Char ()
+#define GET_UShort() TT_Get_UShort()
+#define GET_Short() TT_Get_Short ()
+#define GET_Long() TT_Get_Long ()
+#define GET_ULong() TT_Get_ULong ()
+#define GET_Tag4() TT_Get_ULong ()
+
+#define FILE_Pos() TT_File_Pos()
+
+#define FILE_Seek( _position_ ) \
+ ( (error = TT_Seek_File( (Long)(_position_) )) != TT_Err_Ok )
+#define FILE_Skip( _distance_ ) \
+ ( (error = TT_Skip_File( (Long)(_distance_) )) != TT_Err_Ok )
+#define FILE_Read( buffer, count ) \
+ ( (error = TT_Read_File ( buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+#define FILE_Read_At( pos, buffer, count ) \
+ ( (error = TT_Read_At_File( (Long)(pos), \
+ buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /****************************************************************/
+ /* */
+ /* Stream functions. */
+ /* */
+ /****************************************************************/
+
+ /* Open a file and return a stream handle for it. */
+ /* Should only be used for a new face object's main stream. */
+
+ FT_INTERNAL_DEF( TT_Error )
+ TT_Open_Stream( const TT_Text* name,
+ TT_Stream* stream );
+
+
+ /* Closes, then discards, a stream when it's no longer needed. */
+ /* Should only be used for a stream opend with TT_Open_Stream(). */
+
+ FT_INTERNAL_DEF( TT_Error )
+ TT_Close_Stream( TT_Stream* stream );
+
+
+ /* Informs the component that we're going to use the file */
+ /* opened in 'org_stream', and report errors to the 'error' */
+ /* variable. */
+
+ /* in non re-entrant builds, 'org_stream' is simply copied */
+ /* to 'stream'. Otherwise, the latter is a duplicate handle */
+ /* for the file opened with 'org_stream' */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Use_Stream( TT_Stream org_stream,
+ TT_Stream* stream );
+
+ /* Informs the component that we don't need to perform file */
+ /* operations on the stream 'stream' anymore. This must be */
+ /* used with streams "opened" with TT_Use_Stream() only! */
+
+ /* in re-entrant builds, this will really discard the stream */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Done_Stream( TT_Stream* stream );
+
+ /* Closes the stream's file handle to release system resources */
+ /* The function TT_Use_Stream automatically re-activates a */
+ /* flushed stream when it uses one */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Flush_Stream( TT_Stream* stream );
+
+/* The macros STREAM_ARGS and STREAM_ARG let us build a thread-safe */
+/* or re-entrant implementation depending on a single configuration */
+/*define. */
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+
+#define STREAM_ARGS TT_Stream stream,
+#define STREAM_ARG TT_Stream stream
+
+#else
+
+#define STREAM_ARGS /* void */
+#define STREAM_ARG void
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /****************************************************************/
+ /* */
+ /* File Functions. */
+ /* */
+ /* The following functions perform file operations on the */
+ /* currently 'used' stream. In thread-safe builds, only one */
+ /* stream can be used at a time. Synchronisation is performed */
+ /* through the Use_Stream()/Done_Stream() functions. */
+ /* */
+ /****************************************************************/
+
+ /* Read 'count' bytes from file into 'buffer' */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Read_File( STREAM_ARGS void* buffer,
+ Long count );
+
+
+ /* Seek file cursor to a given position */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Seek_File( STREAM_ARGS Long position );
+
+
+ /* Skip the next 'distance' bytes in file */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Skip_File( STREAM_ARGS Long distance );
+
+
+ /* Read the 'count' bytes at 'position' into 'buffer' */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Read_At_File( STREAM_ARGS Long position,
+ void* buffer,
+ Long count );
+
+ /* Return current file position */
+
+ FT_EXPORT_DEF( Long )
+ TT_File_Pos( STREAM_ARG );
+
+ /* Return length of a given stream, even if it is flushed */
+
+ FT_EXPORT_DEF( Long )
+ TT_Stream_Size( TT_Stream stream );
+
+
+ /****************************************************************/
+ /* */
+ /* Frame operations. */
+ /* */
+ /* For a comprehensive explanation of frames, please refer to */
+ /* the documentation files. */
+ /* */
+ /****************************************************************/
+
+ /* Frame type declaration.*/
+
+ struct TFileFrame_
+ {
+ Byte* address; /* frame buffer */
+ Byte* cursor; /* current cursor position in frame */
+ Long size; /* frame size */
+ };
+
+ typedef struct TFileFrame_ TFileFrame;
+
+ FT_EXPORT_DECL( const TFileFrame )
+ TT_Null_FileFrame;
+
+
+/* The macro ZERO_Frame is used to define and init a frame. */
+/* It is important to have a default frame of { NULL, NULL, 0 } */
+/* before a call to TT_Access_Frame(). Otherwise, the call will */
+/* fail with a TT_Err_Nested_Frame_Accesses error. */
+
+#define ZERO_Frame( frame ) \
+ { \
+ (frame).address = NULL; \
+ (frame).cursor = NULL; \
+ (frame).size = 0; \
+ }
+
+
+/* The macros FRAME_ARGS and FRAME_ARG let us build a thread-safe */
+/* or re-entrant implementation depending on a single configuration */
+/* define */
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+
+#define FRAME_ARGS TFileFrame* frame,
+#define FRAME_ARG TFileFrame* frame
+
+#else
+
+#define FRAME_ARGS /* void */
+#define FRAME_ARG void
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+ /* Access the next 'size' bytes from current position. */
+ /* Fails if all bytes cannot be read/accessed. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Access_Frame( STREAM_ARGS FRAME_ARGS Long size );
+
+
+ /* Access the bytes located in the next 'size' bytes of the file. */
+ /* Doesn't fail if less than 'size' bytes are accessible (like */
+ /* at the end of the file). */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Check_And_Access_Frame( STREAM_ARGS FRAME_ARGS Long size );
+
+ /* Forget frame */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Forget_Frame( STREAM_ARGS FRAME_ARG );
+
+
+ /* primitive routines for data accessing */
+
+ FT_EXPORT_DEF( Char )
+ TT_Get_Char( FRAME_ARG );
+
+ FT_EXPORT_DEF( Short )
+ TT_Get_Short( FRAME_ARG );
+
+ FT_EXPORT_DEF( Long )
+ TT_Get_Long( FRAME_ARG );
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+
+#define TT_Get_Byte( frame ) ( (Byte )TT_Get_Char ( frame ) )
+#define TT_Get_UShort( frame ) ( (UShort)TT_Get_Short( frame ) )
+#define TT_Get_ULong( frame ) ( (ULong )TT_Get_Long ( frame ) )
+
+#else
+
+#define TT_Get_Byte() ( (Byte )TT_Get_Char () )
+#define TT_Get_UShort() ( (UShort)TT_Get_Short() )
+#define TT_Get_ULong() ( (ULong )TT_Get_Long () )
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTFILE_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttgload.c b/Build/source/libs/freetype/lib/ttgload.c
new file mode 100644
index 00000000000..e7a838a40a7
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttgload.c
@@ -0,0 +1,1353 @@
+/*******************************************************************
+ *
+ * ttgload.c 1.0
+ *
+ * TrueType Glyph Loader.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttcalc.h"
+#include "ttfile.h"
+
+#include "tttables.h"
+#include "ttobjs.h"
+#include "ttgload.h"
+
+#include "ttmemory.h"
+#include "tttags.h"
+#include "ttload.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_gload
+
+
+/* composite font flags */
+
+#define ARGS_ARE_WORDS 0x001
+#define ARGS_ARE_XY_VALUES 0x002
+#define ROUND_XY_TO_GRID 0x004
+#define WE_HAVE_A_SCALE 0x008
+/* reserved 0x010 */
+#define MORE_COMPONENTS 0x020
+#define WE_HAVE_AN_XY_SCALE 0x040
+#define WE_HAVE_A_2X2 0x080
+#define WE_HAVE_INSTR 0x100
+#define USE_MY_METRICS 0x200
+
+
+/********************************************************/
+/* Return horizontal or vertical metrics in font units */
+/* for a given glyph. The metrics are the left side */
+/* bearing (resp. top side bearing) and advance width */
+/* (resp. advance height). */
+/* */
+/* This function will much probably move to another */
+/* component in the short future, but I haven't decided */
+/* which yet... */
+
+ FT_INTERNAL_FUNC( void )
+ TT_Get_Metrics( TT_Horizontal_Header* header,
+ UShort index,
+ Short* bearing,
+ UShort* advance )
+ {
+ PLongMetrics longs_m;
+
+ UShort k = header->number_Of_HMetrics;
+
+
+ if ( index < k )
+ {
+ longs_m = (PLongMetrics)header->long_metrics + index;
+ *bearing = longs_m->bearing;
+ *advance = longs_m->advance;
+ }
+ else
+ {
+ *bearing = ((PShortMetrics)header->short_metrics)[index - k];
+ *advance = ((PLongMetrics)header->long_metrics)[k - 1].advance;
+ }
+ }
+
+
+/********************************************************/
+/* Return horizontal metrics in font units for a given */
+/* glyph. If `check' is true, take care of mono-spaced */
+/* fonts by returning the advance width max. */
+
+ static void Get_HMetrics( PFace face,
+ UShort index,
+ Bool check,
+ Short* lsb,
+ UShort* aw )
+ {
+ TT_Get_Metrics( &face->horizontalHeader, index, lsb, aw );
+
+ if ( check && face->postscript.isFixedPitch )
+ *aw = face->horizontalHeader.advance_Width_Max;
+ }
+
+
+/********************************************************/
+/* Return advance width table for a given pixel size */
+/* if it is found in the font's `hdmx' table (if any). */
+
+ static PByte Get_Advance_Widths( PFace face,
+ UShort ppem )
+ {
+ UShort n;
+
+
+ for ( n = 0; n < face->hdmx.num_records; n++ )
+ if ( face->hdmx.records[n].ppem == ppem )
+ return face->hdmx.records[n].widths;
+
+ return NULL;
+ }
+
+
+/********************************************************/
+/* Copy current glyph into original one. */
+
+#define cur_to_org( n, zone ) \
+ MEM_Copy( (zone)->org, (zone)->cur, (n) * sizeof ( TT_Vector ) )
+
+/********************************************************/
+/* copy original glyph into current one */
+
+#define org_to_cur( n, zone ) \
+ MEM_Copy( (zone)->cur, (zone)->org, (n) * sizeof ( TT_Vector ) )
+
+/********************************************************/
+/* translate an array of coordinates */
+
+ static void translate_array( UShort n,
+ TT_Vector* coords,
+ TT_Pos delta_x,
+ TT_Pos delta_y )
+ {
+ UShort k;
+
+
+ if ( delta_x )
+ for ( k = 0; k < n; k++ )
+ coords[k].x += delta_x;
+
+ if ( delta_y )
+ for ( k = 0; k < n; k++ )
+ coords[k].y += delta_y;
+ }
+
+
+/********************************************************/
+/* mount one zone on top of another */
+
+ static void mount_zone( PGlyph_Zone source,
+ PGlyph_Zone target )
+ {
+ UShort np;
+ Short nc;
+
+ np = source->n_points;
+ nc = source->n_contours;
+
+ target->org = source->org + np;
+ target->cur = source->cur + np;
+ target->touch = source->touch + np;
+
+ target->contours = source->contours + nc;
+
+ target->n_points = 0;
+ target->n_contours = 0;
+ }
+
+
+/*******************************************************************
+ *
+ * Function: Load_Simple_Glyph
+ *
+ ******************************************************************/
+
+ static TT_Error Load_Simple_Glyph( PExecution_Context exec,
+ TT_Stream input,
+ Short n_contours,
+ Short left_contours,
+ UShort left_points,
+ UShort load_flags,
+ PSubglyph_Record subg )
+ {
+ DEFINE_LOAD_LOCALS( input );
+
+ PGlyph_Zone pts;
+ Short k;
+ UShort j;
+ UShort n_points, n_ins;
+ PFace face;
+ Byte* flag;
+ TT_Vector* vec;
+ TT_F26Dot6 x, y;
+
+
+ face = exec->face;
+
+ /* simple check */
+ if ( n_contours > left_contours )
+ {
+ PTRACE0(( "ERROR: Glyph index %ld has %d contours > left %d\n",
+ subg->index, n_contours, left_contours ));
+ return TT_Err_Too_Many_Contours;
+ }
+
+
+ /* preparing the execution context */
+ mount_zone( &subg->zone, &exec->pts );
+
+ /* reading the contours endpoints */
+ if ( ACCESS_Frame( (n_contours + 1) * 2L ) )
+ return error;
+
+ PTRACE4(( " Contour endpoints:" ));
+
+ for ( k = 0; k < n_contours; k++ )
+ {
+ exec->pts.contours[k] = GET_UShort();
+ PTRACE4(( " %d", exec->pts.contours[k] ));
+ }
+ PTRACE4(( "\n" ));
+
+ if ( n_contours > 0 )
+ n_points = exec->pts.contours[n_contours - 1] + 1;
+ else
+ n_points = 0;
+
+ n_ins = GET_UShort();
+
+ FORGET_Frame();
+
+ if ( n_points > left_points )
+ {
+ PTRACE0(( "ERROR: Too many points in glyph %ld\n", subg->index ));
+ return TT_Err_Too_Many_Points;
+ }
+
+ /* loading instructions */
+
+ PTRACE4(( " Instructions size: %d\n", n_ins ));
+
+ if ( n_ins > face->maxProfile.maxSizeOfInstructions )
+ {
+ PTRACE0(( "ERROR: Too many instructions!\n" ));
+ return TT_Err_Too_Many_Ins;
+ }
+
+ if ( FILE_Read( exec->glyphIns, n_ins ) )
+ return error;
+
+ if ( (error = Set_CodeRange( exec,
+ TT_CodeRange_Glyph,
+ exec->glyphIns,
+ n_ins )) != TT_Err_Ok )
+ return error;
+
+
+ /* read the flags */
+
+ if ( CHECK_AND_ACCESS_Frame( n_points * 5L ) )
+ return error;
+
+ j = 0;
+ flag = exec->pts.touch;
+
+ while ( j < n_points )
+ {
+ Byte c, cnt;
+
+ flag[j] = c = GET_Byte();
+ j++;
+
+ if ( c & 8 )
+ {
+ cnt = GET_Byte();
+ while( cnt > 0 )
+ {
+ flag[j++] = c;
+ cnt--;
+ }
+ }
+ }
+
+ /* read the X */
+
+ x = 0;
+ vec = exec->pts.org;
+
+ for ( j = 0; j < n_points; j++ )
+ {
+ if ( flag[j] & 2 )
+ {
+ if ( flag[j] & 16 )
+ x += GET_Byte();
+ else
+ x -= GET_Byte();
+ }
+ else
+ {
+ if ( (flag[j] & 16) == 0 )
+ x += GET_Short();
+ }
+
+ vec[j].x = x;
+ }
+
+
+ /* read the Y */
+
+ y = 0;
+
+ for ( j = 0; j < n_points; j++ )
+ {
+ if ( flag[j] & 4 )
+ {
+ if ( flag[j] & 32 )
+ y += GET_Byte();
+ else
+ y -= GET_Byte();
+ }
+ else
+ {
+ if ( (flag[j] & 32) == 0 )
+ y += GET_Short();
+ }
+
+ vec[j].y = y;
+ }
+
+ FORGET_Frame();
+ /* Now add the two shadow points at n and n + 1. */
+ /* We need the left side bearing and advance width. */
+
+ /* pp1 = xMin - lsb */
+ vec[n_points].x = subg->metrics.bbox.xMin - subg->metrics.horiBearingX;
+ vec[n_points].y = 0;
+
+ /* pp2 = pp1 + aw */
+ vec[n_points+1].x = vec[n_points].x + subg->metrics.horiAdvance;
+ vec[n_points+1].y = 0;
+
+ /* clear the touch flags */
+
+ for ( j = 0; j < n_points; j++ )
+ exec->pts.touch[j] &= TT_Flag_On_Curve;
+
+ exec->pts.touch[n_points ] = 0;
+ exec->pts.touch[n_points + 1] = 0;
+
+ /* Note that we return two more points that are not */
+ /* part of the glyph outline. */
+
+ n_points += 2;
+
+ /* now eventually scale and hint the glyph */
+
+ pts = &exec->pts;
+ pts->n_points = n_points;
+ pts->n_contours = n_contours;
+
+ if ( (load_flags & TTLOAD_SCALE_GLYPH) == 0 )
+ {
+ /* no scaling, just copy the orig arrays into the cur ones */
+ org_to_cur( n_points, pts );
+ }
+ else
+ {
+ /* first scale the glyph points */
+
+ for ( j = 0; j < n_points; j++ )
+ {
+ pts->org[j].x = Scale_X( &exec->metrics, pts->org[j].x );
+ pts->org[j].y = Scale_Y( &exec->metrics, pts->org[j].y );
+ }
+
+ /* if hinting, round pp1, and shift the glyph accordingly */
+ if ( subg->is_hinted )
+ {
+ x = pts->org[n_points - 2].x;
+ x = ((x+32) & -64) - x;
+ translate_array( n_points, pts->org, x, 0 );
+
+ org_to_cur( n_points, pts );
+
+ pts->cur[n_points - 1].x = (pts->cur[n_points - 1].x + 32) & -64;
+
+ /* now consider hinting */
+ if ( n_ins > 0 )
+ {
+ exec->is_composite = FALSE;
+ exec->pedantic_hinting = load_flags & TTLOAD_PEDANTIC;
+
+ error = Context_Run( exec, FALSE );
+ if (error && exec->pedantic_hinting)
+ return error;
+ }
+ }
+ else
+ org_to_cur( n_points, pts );
+ }
+
+ /* save glyph phantom points */
+ if (!subg->preserve_pps)
+ {
+ subg->pp1 = pts->cur[n_points - 2];
+ subg->pp2 = pts->cur[n_points - 1];
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_Composite_End
+ *
+ ******************************************************************/
+
+ static
+ TT_Error Load_Composite_End( UShort n_points,
+ Short n_contours,
+ PExecution_Context exec,
+ PSubglyph_Record subg,
+ UShort load_flags,
+ TT_Stream input )
+ {
+ DEFINE_LOAD_LOCALS( input );
+
+ UShort k, n_ins;
+ PGlyph_Zone pts;
+
+
+ if ( subg->is_hinted &&
+ subg->element_flag & WE_HAVE_INSTR )
+ {
+ if ( ACCESS_Frame( 2L ) )
+ return error;
+
+ n_ins = GET_UShort(); /* read size of instructions */
+ FORGET_Frame();
+
+ PTRACE4(( " Instructions size: %d\n", n_ins ));
+
+ if ( n_ins > exec->face->maxProfile.maxSizeOfInstructions )
+ {
+ PTRACE0(( "ERROR: Too many instructions in composite glyph %ld\n",
+ subg->index ));
+ return TT_Err_Too_Many_Ins;
+ }
+
+ if ( FILE_Read( exec->glyphIns, n_ins ) )
+ return error;
+
+ error = Set_CodeRange( exec,
+ TT_CodeRange_Glyph,
+ exec->glyphIns,
+ n_ins );
+
+ if ( error )
+ return error;
+ }
+ else
+ n_ins = 0;
+
+
+ /* prepare the execution context */
+ n_points += 2;
+ exec->pts = subg->zone;
+ pts = &exec->pts;
+
+ pts->n_points = n_points;
+ pts->n_contours = n_contours;
+
+ /* add phantom points */
+ pts->cur[n_points - 2] = subg->pp1;
+ pts->cur[n_points - 1] = subg->pp2;
+
+ pts->touch[n_points - 1] = 0;
+ pts->touch[n_points - 2] = 0;
+
+ /* if hinting, round the phantom points */
+ if ( subg->is_hinted )
+ {
+ pts->cur[n_points - 2].x = (subg->pp1.x + 32) & -64;
+ pts->cur[n_points - 1].x = (subg->pp2.x + 32) & -64;
+ }
+
+ for ( k = 0; k < n_points; k++ )
+ pts->touch[k] &= TT_Flag_On_Curve;
+
+ cur_to_org( n_points, pts );
+
+ /* now consider hinting */
+ if ( subg->is_hinted && n_ins > 0 )
+ {
+ exec->is_composite = TRUE;
+ exec->pedantic_hinting = load_flags & TTLOAD_PEDANTIC;
+
+ error = Context_Run( exec, FALSE );
+ if (error && exec->pedantic_hinting)
+ return error;
+ }
+
+ /* save glyph origin and advance points */
+ subg->pp1 = pts->cur[n_points - 2];
+ subg->pp2 = pts->cur[n_points - 1];
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Init_Glyph_Component
+ *
+ ******************************************************************/
+
+ static
+ void Init_Glyph_Component( PSubglyph_Record element,
+ PSubglyph_Record original,
+ PExecution_Context exec )
+ {
+ element->index = -1;
+ element->is_scaled = FALSE;
+ element->is_hinted = FALSE;
+
+ if ( original )
+ mount_zone( &original->zone, &element->zone );
+ else
+ element->zone = exec->pts;
+
+ element->zone.n_contours = 0;
+ element->zone.n_points = 0;
+
+ element->arg1 = 0;
+ element->arg2 = 0;
+
+ element->element_flag = 0;
+ element->preserve_pps = FALSE;
+
+ element->transform.xx = 1L << 16;
+ element->transform.xy = 0;
+ element->transform.yx = 0;
+ element->transform.yy = 1L << 16;
+
+ element->transform.ox = 0;
+ element->transform.oy = 0;
+
+ element->metrics.horiBearingX = 0;
+ element->metrics.horiAdvance = 0;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Glyph( PInstance instance,
+ PGlyph glyph,
+ UShort glyph_index,
+ UShort load_flags )
+ {
+ enum TPhases_
+ {
+ Load_Exit,
+ Load_Glyph,
+ Load_Header,
+ Load_Simple,
+ Load_Composite,
+ Load_End
+ };
+
+ typedef enum TPhases_ TPhases;
+
+ DEFINE_ALL_LOCALS;
+
+ PFace face;
+
+ UShort num_points;
+ Short num_contours;
+ UShort left_points;
+ Short left_contours;
+ UShort num_elem_points;
+
+ Long table;
+ UShort load_top;
+ Long k, l;
+ UShort new_flags;
+ Long index;
+ UShort u, v;
+
+ Long glyph_offset, offset;
+
+ TT_F26Dot6 x, y, nx, ny;
+
+ Fixed xx, xy, yx, yy;
+
+ PExecution_Context exec;
+
+ PSubglyph_Record subglyph, subglyph2;
+
+ TGlyph_Zone base_pts;
+
+ TPhases phase;
+ PByte widths;
+
+/* TT_Glyph_Loader_Callback cacheCb; */
+/* TT_Outline cached_outline; */
+
+
+ /* first of all, check arguments */
+ if ( !glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ face = glyph->face;
+ if ( !face )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ if ( glyph_index >= face->numGlyphs )
+ return TT_Err_Invalid_Glyph_Index;
+
+ if ( instance && (load_flags & TTLOAD_SCALE_GLYPH) == 0 )
+ {
+ instance = 0;
+ load_flags &= ~( TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH );
+ }
+
+ table = TT_LookUp_Table( face, TTAG_glyf );
+ if ( table < 0 )
+ {
+ PTRACE0(( "ERROR: There is no glyph table in this font file!\n" ));
+ return TT_Err_Glyf_Table_Missing;
+ }
+
+ glyph_offset = face->dirTables[table].Offset;
+
+ /* query new execution context */
+
+ if ( instance && instance->debug )
+ exec = instance->context;
+ else
+ exec = New_Context( face );
+
+ if ( !exec )
+ return TT_Err_Could_Not_Find_Context;
+
+ Context_Load( exec, face, instance );
+
+ if ( instance )
+ {
+ if ( instance->GS.instruct_control & 2 )
+ exec->GS = Default_GraphicsState;
+ else
+ exec->GS = instance->GS;
+ /* load default graphics state */
+
+ glyph->outline.high_precision = ( instance->metrics.y_ppem < 24 );
+ }
+
+ /* save its critical pointers, as they'll be modified during load */
+ base_pts = exec->pts;
+
+ /* init variables */
+ left_points = face->maxPoints;
+ left_contours = face->maxContours;
+
+ num_points = 0;
+ num_contours = 0;
+
+ load_top = 0;
+ subglyph = exec->loadStack;
+
+ Init_Glyph_Component( subglyph, NULL, exec );
+
+ subglyph->index = glyph_index;
+ subglyph->is_hinted = load_flags & TTLOAD_HINT_GLYPH;
+
+ /* when the cvt program has disabled hinting, the argument */
+ /* is ignored. */
+ if ( instance && instance->GS.instruct_control & 1 )
+ subglyph->is_hinted = FALSE;
+
+
+ /* now access stream */
+
+ if ( USE_Stream( face->stream, stream ) )
+ goto Fin;
+
+ /* Main loading loop */
+
+ phase = Load_Glyph;
+ index = 0;
+
+ while ( phase != Load_Exit )
+ {
+ subglyph = exec->loadStack + load_top;
+
+ switch ( phase )
+ {
+ /************************************************************/
+ /* */
+ /* Load_Glyph state */
+ /* */
+ /* reading a glyph's generic header to determine */
+ /* whether it's simple or composite */
+ /* */
+ /* exit states: Load_Header and Load_End */
+
+ case Load_Glyph:
+ /* check glyph index and table */
+
+ index = subglyph->index;
+ if ( index < 0 || index >= face->numGlyphs )
+ {
+ error = TT_Err_Invalid_Glyph_Index;
+ goto Fail;
+ }
+
+ /* get horizontal metrics */
+
+ {
+ Short left_bearing;
+ UShort advance_width;
+
+
+ Get_HMetrics( face, (UShort)index,
+ !(load_flags & TTLOAD_IGNORE_GLOBAL_ADVANCE_WIDTH),
+ &left_bearing,
+ &advance_width );
+
+ subglyph->metrics.horiBearingX = left_bearing;
+ subglyph->metrics.horiAdvance = advance_width;
+ }
+
+ phase = Load_Header;
+
+
+ /* The cache callback isn't part of the FreeType release yet */
+ /* It is discarded for the moment.. */
+ /* */
+#if 0
+ if ( instance )
+ {
+ /* is the glyph in an outline cache ? */
+ cacheCb = instance->owner->engine->glCallback;
+ if ( cacheCb && 0 ) /* disabled */
+ {
+ /* we have a callback */
+ error = cacheCb( instance->generic,
+ index, &cached_outline, &x, &y );
+ if ( !error )
+ {
+ /* no error, then append the outline to the current subglyph */
+ /* error = Append_Outline( subglyph,
+ &left_points,
+ &left_contours,
+ &cached_outline ); */
+ phase = Load_End;
+ }
+ }
+ }
+#endif
+ break;
+
+
+ /************************************************************/
+ /* */
+ /* Load_Header state */
+ /* */
+ /* reading a glyph's generic header to determine */
+ /* wether it's simple or composite */
+ /* */
+ /* exit states: Load_Simple and Load_Composite */
+ /* */
+
+ case Load_Header: /* load glyph */
+
+ if ( (TT_UInt)( index + 1 ) < (TT_UInt)face->numLocations &&
+ face->glyphLocations[index] == face->glyphLocations[index + 1] )
+ {
+ /* as described by Frederic Loyer, these are spaces, and */
+ /* not the unknown glyph. */
+
+ num_contours = 0;
+ num_points = 0;
+
+ subglyph->metrics.bbox.xMin = 0;
+ subglyph->metrics.bbox.xMax = 0;
+ subglyph->metrics.bbox.yMin = 0;
+ subglyph->metrics.bbox.yMax = 0;
+
+ subglyph->pp1.x = 0;
+ subglyph->pp2.x = subglyph->metrics.horiAdvance;
+ if (load_flags & TTLOAD_SCALE_GLYPH)
+ subglyph->pp2.x = Scale_X( &exec->metrics, subglyph->pp2.x );
+
+ exec->glyphSize = 0;
+ phase = Load_End;
+ break;
+ }
+
+ offset = glyph_offset + face->glyphLocations[index];
+
+ /* read first glyph header */
+ if ( FILE_Seek( offset ) ||
+ ACCESS_Frame( 10L ) )
+ goto Fail_File;
+
+ num_contours = GET_Short();
+
+ subglyph->metrics.bbox.xMin = GET_Short();
+ subglyph->metrics.bbox.yMin = GET_Short();
+ subglyph->metrics.bbox.xMax = GET_Short();
+ subglyph->metrics.bbox.yMax = GET_Short();
+
+ FORGET_Frame();
+
+ PTRACE6(( "Glyph %ld:\n", index ));
+ PTRACE6(( " # of contours: %d\n", num_contours ));
+ PTRACE6(( " xMin: %4d xMax: %4d\n",
+ subglyph->metrics.bbox.xMin,
+ subglyph->metrics.bbox.xMax ));
+ PTRACE6(( " yMin: %4d yMax: %4d\n",
+ subglyph->metrics.bbox.yMin,
+ subglyph->metrics.bbox.yMax ));
+
+ if ( num_contours > left_contours )
+ {
+ PTRACE0(( "ERROR: Too many contours for glyph %ld\n", index ));
+ error = TT_Err_Too_Many_Contours;
+ goto Fail;
+ }
+
+ subglyph->pp1.x = subglyph->metrics.bbox.xMin -
+ subglyph->metrics.horiBearingX;
+ subglyph->pp1.y = 0;
+ subglyph->pp2.x = subglyph->pp1.x + subglyph->metrics.horiAdvance;
+ if (load_flags & TTLOAD_SCALE_GLYPH)
+ {
+ subglyph->pp1.x = Scale_X( &exec->metrics, subglyph->pp1.x );
+ subglyph->pp2.x = Scale_X( &exec->metrics, subglyph->pp2.x );
+ }
+
+ /* is it a simple glyph ? */
+ if ( num_contours > 0 )
+ phase = Load_Simple;
+ else
+ phase = Load_Composite;
+
+ break;
+
+
+ /************************************************************/
+ /* */
+ /* Load_Simple state */
+ /* */
+ /* reading a simple glyph (num_contours must be set to */
+ /* the glyph's number of contours.) */
+ /* */
+ /* exit states : Load_End */
+ /* */
+
+ case Load_Simple:
+ new_flags = load_flags;
+
+ /* disable hinting when scaling */
+ if ( !subglyph->is_hinted )
+ new_flags &= ~TTLOAD_HINT_GLYPH;
+
+ error = Load_Simple_Glyph( exec,
+ stream,
+ num_contours,
+ left_contours,
+ left_points,
+ new_flags,
+ subglyph );
+ if ( error )
+ goto Fail;
+
+ /* Note: We could have put the simple loader source there */
+ /* but the code is fat enough already :-) */
+
+ num_points = exec->pts.n_points - 2;
+
+ phase = Load_End;
+
+ break;
+
+
+ /************************************************************/
+ /* */
+ /* Load_Composite state */
+ /* */
+ /* reading a composite glyph header a pushing a new */
+ /* load element on the stack. */
+ /* */
+ /* exit states: Load_Glyph */
+ /* */
+
+ case Load_Composite:
+
+ /* create a new element on the stack */
+ load_top++;
+
+ if ( load_top > face->maxComponents )
+ {
+ error = TT_Err_Invalid_Composite;
+ goto Fail;
+ }
+
+ subglyph2 = exec->loadStack + load_top;
+
+ Init_Glyph_Component( subglyph2, subglyph, NULL );
+ subglyph2->is_hinted = subglyph->is_hinted;
+
+ /* now read composite header */
+
+ if ( ACCESS_Frame( 4L ) )
+ goto Fail_File;
+
+ subglyph->element_flag = new_flags = GET_UShort();
+
+ subglyph2->index = GET_UShort();
+
+ FORGET_Frame();
+
+ k = 1 + 1;
+
+ if ( new_flags & ARGS_ARE_WORDS )
+ k *= 2;
+
+ if ( new_flags & WE_HAVE_A_SCALE )
+ k += 2;
+
+ else if ( new_flags & WE_HAVE_AN_XY_SCALE )
+ k += 4;
+
+ else if ( new_flags & WE_HAVE_A_2X2 )
+ k += 8;
+
+ if ( ACCESS_Frame( k ) )
+ goto Fail_File;
+
+ if ( new_flags & ARGS_ARE_WORDS )
+ {
+ k = GET_Short();
+ l = GET_Short();
+ }
+ else
+ {
+ k = GET_Char();
+ l = GET_Char();
+ }
+
+ subglyph->arg1 = k;
+ subglyph->arg2 = l;
+
+ if ( new_flags & ARGS_ARE_XY_VALUES )
+ {
+ subglyph->transform.ox = k;
+ subglyph->transform.oy = l;
+ }
+
+ xx = 1L << 16;
+ xy = 0;
+ yx = 0;
+ yy = 1L << 16;
+
+ if ( new_flags & WE_HAVE_A_SCALE )
+ {
+ xx = (Fixed)GET_Short() << 2;
+ yy = xx;
+ subglyph2->is_scaled = TRUE;
+ }
+ else if ( new_flags & WE_HAVE_AN_XY_SCALE )
+ {
+ xx = (Fixed)GET_Short() << 2;
+ yy = (Fixed)GET_Short() << 2;
+ subglyph2->is_scaled = TRUE;
+ }
+ else if ( new_flags & WE_HAVE_A_2X2 )
+ {
+ xx = (Fixed)GET_Short() << 2;
+ xy = (Fixed)GET_Short() << 2;
+ yx = (Fixed)GET_Short() << 2;
+ yy = (Fixed)GET_Short() << 2;
+ subglyph2->is_scaled = TRUE;
+ }
+
+ FORGET_Frame();
+
+ subglyph->transform.xx = xx;
+ subglyph->transform.xy = xy;
+ subglyph->transform.yx = yx;
+ subglyph->transform.yy = yy;
+
+ k = TT_MulFix( xx, yy ) - TT_MulFix( xy, yx );
+
+ /* disable hinting in case of scaling/slanting */
+ if ( ABS( k ) != (1L << 16) )
+ subglyph2->is_hinted = FALSE;
+
+ subglyph->file_offset = FILE_Pos();
+
+ phase = Load_Glyph;
+
+ break;
+
+
+ /************************************************************/
+ /* */
+ /* Load_End state */
+ /* */
+ /* after loading a glyph, apply transformation and offset */
+ /* where necessary, pops element and continue or */
+ /* stop process. */
+ /* */
+ /* exit states : Load_Composite and Load_Exit */
+ /* */
+
+ case Load_End:
+ if ( load_top > 0 )
+ {
+ subglyph2 = subglyph;
+
+ load_top--;
+ subglyph = exec->loadStack + load_top;
+
+ /* check advance width and left side bearing */
+
+ if ( !subglyph->preserve_pps &&
+ subglyph->element_flag & USE_MY_METRICS )
+ {
+ subglyph->metrics.horiBearingX = subglyph2->metrics.horiBearingX;
+ subglyph->metrics.horiAdvance = subglyph2->metrics.horiAdvance;
+
+ subglyph->pp1 = subglyph2->pp1;
+ subglyph->pp2 = subglyph2->pp2;
+
+ subglyph->preserve_pps = TRUE;
+ }
+
+ /* apply scale */
+
+ if ( subglyph2->is_scaled )
+ {
+ TT_Vector* cur = subglyph2->zone.cur;
+ TT_Vector* org = subglyph2->zone.org;
+
+ for ( u = 0; u < num_points; u++ )
+ {
+ nx = TT_MulFix( cur->x, subglyph->transform.xx ) +
+ TT_MulFix( cur->y, subglyph->transform.yx );
+
+ ny = TT_MulFix( cur->x, subglyph->transform.xy ) +
+ TT_MulFix( cur->y, subglyph->transform.yy );
+
+ cur->x = nx;
+ cur->y = ny;
+
+ nx = TT_MulFix( org->x, subglyph->transform.xx ) +
+ TT_MulFix( org->y, subglyph->transform.yx );
+
+ ny = TT_MulFix( org->x, subglyph->transform.xy ) +
+ TT_MulFix( org->y, subglyph->transform.yy );
+
+ org->x = nx;
+ org->y = ny;
+
+ cur++;
+ org++;
+ }
+ }
+
+ /* adjust counts */
+
+ num_elem_points = subglyph->zone.n_points;
+
+ for ( k = 0; k < num_contours; k++ )
+ subglyph2->zone.contours[k] += num_elem_points;
+
+ subglyph->zone.n_points += num_points;
+ subglyph->zone.n_contours += num_contours;
+
+ left_points -= num_points;
+ left_contours -= num_contours;
+
+ if ( !(subglyph->element_flag & ARGS_ARE_XY_VALUES) )
+ {
+ /* move second glyph according to control points */
+ /* the attach points are relative to the specific component */
+
+ u = (UShort)subglyph->arg1;
+ v = (UShort)subglyph->arg2;
+
+ if ( u >= num_elem_points ||
+ v >= num_points )
+ {
+ error = TT_Err_Invalid_Composite;
+ goto Fail;
+ }
+
+ /* adjust count */
+ v += num_elem_points;
+
+ x = subglyph->zone.cur[u].x - subglyph->zone.cur[v].x;
+ y = subglyph->zone.cur[u].y - subglyph->zone.cur[v].y;
+ }
+ else
+ {
+ /* apply offset */
+
+ x = subglyph->transform.ox;
+ y = subglyph->transform.oy;
+
+ if ( load_flags & TTLOAD_SCALE_GLYPH )
+ {
+ x = Scale_X( &exec->metrics, x );
+ y = Scale_Y( &exec->metrics, y );
+
+ if ( subglyph->element_flag & ROUND_XY_TO_GRID )
+ {
+ x = (x+32) & -64;
+ y = (y+32) & -64;
+ }
+ }
+ }
+
+ translate_array( num_points, subglyph2->zone.cur, x, y );
+
+ cur_to_org( num_points, &subglyph2->zone );
+
+ num_points = subglyph->zone.n_points;
+ num_contours = subglyph->zone.n_contours;
+
+ /* check for last component */
+
+ if ( FILE_Seek( subglyph->file_offset ) )
+ goto Fail_File;
+
+ if ( subglyph->element_flag & MORE_COMPONENTS )
+ phase = Load_Composite;
+ else
+ {
+ error = Load_Composite_End( num_points,
+ num_contours,
+ exec,
+ subglyph,
+ load_flags,
+ stream );
+ if ( error )
+ goto Fail;
+
+ phase = Load_End;
+ }
+ }
+ else
+ phase = Load_Exit;
+
+ break;
+
+
+ case Load_Exit:
+ break;
+ }
+ }
+
+ /* finally, copy the points arrays to the glyph object */
+
+ exec->pts = base_pts;
+
+ for ( u = 0; u < num_points + 2; u++ )
+ {
+ glyph->outline.points[u] = exec->pts.cur[u];
+ glyph->outline.flags [u] = exec->pts.touch[u];
+ }
+
+ for ( k = 0; k < num_contours; k++ )
+ glyph->outline.contours[k] = exec->pts.contours[k];
+
+ glyph->outline.n_points = num_points;
+ glyph->outline.n_contours = num_contours;
+ glyph->outline.second_pass = TRUE;
+
+ /* translate array so that (0,0) is the glyph's origin */
+ translate_array( num_points + 2,
+ glyph->outline.points,
+ -subglyph->pp1.x,
+ 0 );
+
+ TT_Get_Outline_BBox( &glyph->outline, &glyph->metrics.bbox );
+
+ if ( subglyph->is_hinted )
+ {
+ /* grid-fit the bounding box */
+ glyph->metrics.bbox.xMin &= -64;
+ glyph->metrics.bbox.yMin &= -64;
+ glyph->metrics.bbox.xMax = (glyph->metrics.bbox.xMax+63) & -64;
+ glyph->metrics.bbox.yMax = (glyph->metrics.bbox.yMax+63) & -64;
+ }
+
+ /* get the device-independent scaled horizontal metrics */
+ /* take care of fixed-pitch fonts... */
+ {
+ TT_Pos left_bearing;
+ TT_Pos advance;
+
+
+ left_bearing = subglyph->metrics.horiBearingX;
+ advance = subglyph->metrics.horiAdvance;
+
+ if ( face->postscript.isFixedPitch )
+ advance = face->horizontalHeader.advance_Width_Max;
+
+ if ( load_flags & TTLOAD_SCALE_GLYPH )
+ {
+ left_bearing = Scale_X( &exec->metrics, left_bearing );
+ advance = Scale_X( &exec->metrics, advance );
+ }
+
+ glyph->metrics.linearHoriBearingX = left_bearing;
+ glyph->metrics.linearHoriAdvance = advance;
+ }
+
+ glyph->metrics.horiBearingX = glyph->metrics.bbox.xMin;
+ glyph->metrics.horiBearingY = glyph->metrics.bbox.yMax;
+ glyph->metrics.horiAdvance = subglyph->pp2.x - subglyph->pp1.x;
+
+ /* Now take care of vertical metrics. In the case where there is */
+ /* no vertical information within the font (relatively common), make */
+ /* up some metrics `by hand' ... */
+
+ {
+ Short top_bearing; /* vertical top side bearing (EM units) */
+ UShort advance_height; /* vertical advance height (EM units) */
+
+ TT_Pos left; /* scaled vertical left side bearing */
+ TT_Pos orig_top; /* scaled original vertical top side bearing */
+ TT_Pos top; /* scaled vertical top side bearing */
+ TT_Pos advance; /* scaled vertical advance height */
+
+
+ /* Get the unscaled `tsb' and `ah' values */
+ if ( face->verticalInfo &&
+ face->verticalHeader.number_Of_VMetrics > 0 )
+ {
+ /* Don't assume that both the vertical header and vertical */
+ /* metrics are present in the same font :-) */
+
+ TT_Get_Metrics( (TT_Horizontal_Header*)&face->verticalHeader,
+ glyph_index,
+ &top_bearing,
+ &advance_height );
+ }
+ else
+ {
+
+ /* Make up the distances from the horizontal header.. */
+
+ /* NOTE: The OS/2 values are the only `portable' ones, */
+ /* which is why we use them... */
+ /* */
+ /* NOTE2: The sTypoDescender is negative, which is why */
+ /* we compute the baseline-to-baseline distance */
+ /* here with : */
+ /* ascender - descender + linegap */
+ /* */
+
+/* XXX What happens here with these Apple fonts without OS/2 table ? */
+
+ top_bearing = (Short) (face->os2.sTypoLineGap / 2);
+ advance_height = (UShort)(face->os2.sTypoAscender -
+ face->os2.sTypoDescender +
+ face->os2.sTypoLineGap);
+ }
+
+ /* We must adjust the top_bearing value from the bounding box */
+ /* given in the glyph header to te bounding box calculated with */
+ /* TT_Get_Outline_BBox() */
+
+ /* scale the metrics */
+ if ( load_flags & TTLOAD_SCALE_GLYPH )
+ {
+ orig_top = Scale_Y( &exec->metrics, top_bearing );
+ top = Scale_Y( &exec->metrics,
+ top_bearing + subglyph->metrics.bbox.yMax ) -
+ glyph->metrics.bbox.yMax;
+ advance = Scale_Y( &exec->metrics, advance_height );
+ }
+ else
+ {
+ orig_top = top_bearing;
+ top = top_bearing + subglyph->metrics.bbox.yMax -
+ glyph->metrics.bbox.yMax;
+ advance = advance_height;
+ }
+
+ glyph->metrics.linearVertBearingY = orig_top;
+ glyph->metrics.linearVertAdvance = advance;
+
+ /* XXX : for now, we have no better algo for the lsb, but it should */
+ /* work ok.. */
+ /* */
+ left = ( glyph->metrics.bbox.xMin - glyph->metrics.bbox.xMax ) / 2;
+
+ /* grid-fit them if necessary */
+ if ( subglyph->is_hinted )
+ {
+ left &= -64;
+ top = (top + 63) & -64;
+ advance = (advance + 32) & -64;
+ }
+
+ glyph->metrics.vertBearingX = left;
+ glyph->metrics.vertBearingY = top;
+ glyph->metrics.vertAdvance = advance;
+ }
+
+ /* Adjust advance width to the value contained in the hdmx table. */
+ if ( !exec->face->postscript.isFixedPitch && instance &&
+ subglyph->is_hinted )
+ {
+ widths = Get_Advance_Widths( exec->face,
+ exec->instance->metrics.x_ppem );
+ if ( widths )
+ glyph->metrics.horiAdvance = widths[glyph_index] << 6;
+ }
+
+ glyph->outline.dropout_mode = (Char)exec->GS.scan_type;
+
+ error = TT_Err_Ok;
+
+ Fail_File:
+ Fail:
+ DONE_Stream( stream );
+
+ Fin:
+
+ /* reset the execution context */
+ exec->pts = base_pts;
+
+ if ( !instance || !instance->debug )
+ Done_Context( exec );
+
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttgload.h b/Build/source/libs/freetype/lib/ttgload.h
new file mode 100644
index 00000000000..98e57ef8b79
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttgload.h
@@ -0,0 +1,51 @@
+/*******************************************************************
+ *
+ * ttgload.h 1.0
+ *
+ * TrueType Glyph Loader.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#ifndef TTGLOAD_H
+#define TTGLOAD_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+#include "ttobjs.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+ FT_INTERNAL_DEF( void )
+ TT_Get_Metrics( TT_Horizontal_Header* header,
+ UShort index,
+ Short* bearing,
+ UShort* advance );
+
+
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Glyph( PInstance instance,
+ PGlyph glyph,
+ UShort glyph_index,
+ UShort load_flags );
+
+#ifdef __cplusplus
+ }
+#endif
+
+
+#endif /* TTGLOAD_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttinterp.c b/Build/source/libs/freetype/lib/ttinterp.c
new file mode 100644
index 00000000000..3c991a5e130
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttinterp.c
@@ -0,0 +1,6681 @@
+/*******************************************************************
+ *
+ * ttinterp.c 3.1
+ *
+ * TrueType bytecode intepreter.
+ *
+ * Copyright 1996-2002 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.
+ *
+ *
+ * Changes between 3.1 and 3.0:
+ *
+ * - A more relaxed version of the interpreter. It is now able to
+ * ignore errors like out-of-bound array access and writes in
+ * order to silently support broken glyphs (even if the results
+ * are not always pretty).
+ *
+ * Note that one can use the flag TTLOAD_PEDANTIC to force
+ * TrueType-compliant interpretation.
+ *
+ * - A big #if used to completely disable the interpreter, which
+ * is due to the Apple patents issue.
+ *
+ ******************************************************************/
+
+#include "freetype.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttcalc.h"
+#include "ttmemory.h"
+#include "ttinterp.h"
+
+
+#ifndef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+ FT_INTERNAL_FUNC( TT_Error )
+ RunIns( EXEC_OP )
+ {
+ /* do nothing - always successful */
+
+#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER
+ /* make picky compilers happy */
+ (void)exc;
+#endif
+ return TT_Err_Ok;
+ }
+
+#else /* ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+
+#ifdef DEBUG_INTERPRETER
+ /* The debugger uses a special version of the TrueType */
+ /* interpreter, with some hooks and a simple user interface. */
+ /* Here we declare the needed additions. */
+#include "ttdebug.h"
+
+/* Define the `getch()' function, used for get user inputs. */
+
+#ifndef UNIX
+
+/* Outside Unix, we rely on getch() being defined by <conio.h>. */
+/* This has become a standard, coming from MS-DOS libraries, and */
+/* has been ported to OS/2, Win32, and perhaps others. */
+/* If it does not work for you, investigate the code for Unix */
+/* (here, and in test/fdebug.c). */
+#include <conio.h>
+#if defined( _M_I86 )
+ /* a recent compiler, which do not pollute name spaces... */
+#define getch(x) _getch(x)
+#endif /* modern compiler */
+
+#else /* !defined( UNIX ) */
+
+/* On Unix systems, it is an alias for `getchar()', and the */
+/* debugger front end must ensure that the `stdin' file */
+/* descriptor is not in line-by-line input mode. */
+#define getch getchar
+
+#endif
+
+#endif /* DEBUG_INTEPRETER */
+
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_interp
+
+
+/* In order to detect infinite loops in the code, we set-up a */
+/* counter within the run loop. a singly stroke of interpretation */
+/* is now limited to a maximum number of opcodes defined below. */
+/* */
+#define MAX_RUNNABLE_OPCODES 1000000
+
+
+/******************************************************************/
+/* */
+/* There are two kinds of implementations there: */
+/* */
+/* a. static implementation: */
+/* */
+/* The current execution context is a static variable, which */
+/* fields are accessed directly by the interpreter during */
+/* execution. The context is named 'cur'. */
+/* */
+/* This version is non-reentrant, of course. */
+/* */
+/* */
+/* b. indirect implementation: */
+/* */
+/* The current execution context is passed to _each_ function */
+/* as its first argument, and each field is thus accessed */
+/* indirectly. */
+/* */
+/* This version is, however, fully re-entrant. */
+/* */
+/* */
+/* The idea is that an indirect implementation may be slower to */
+/* execute on the low-end processors that are used in some */
+/* systems (like 386's or even 486's). */
+/* */
+/* When the interpreter started, we had no idea of the time that */
+/* glyph hinting (i.e. executing instructions) could take in the */
+/* whole process of rendering a glyph, and a 10 to 30% */
+/* performance penalty on low-end systems didn't seem much of a */
+/* good idea. This question led us to provide two distinct */
+/* builds from a single source, with the use of macros (again). */
+/* */
+/* Now that the engine is working (and working really well!), it */
+/* seems that the greatest time-consuming factors are: file i/o, */
+/* glyph loading, rasterizing and _then_ glyph hinting! */
+/* */
+/* Tests performed with two versions of the 'fttimer' program */
+/* seem to indicate that hinting takes less than 5% of the */
+/* rendering process, which is dominated by glyph loading and */
+/* scan-line conversion by an high order of magnitude. */
+/* */
+/* As a consequence, the indirect implementation is now the */
+/* default, as its performance costs can be considered */
+/* negligible in our context. Note, however, that we kept the */
+/* same source with macros because: */
+/* */
+/* - the code is kept very close in design to the Pascal one */
+/* used for development. */
+/* */
+/* - it's much more readable that way! */
+/* */
+/* - it's still open to later experimentation and tuning. */
+/* */
+/* TT_CONFIG_OPTION_STATIC_INTERPRETER (in ft_conf.h) toggles */
+/* the use of the static interpreter. */
+/* */
+
+#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */
+
+#define CUR (*exc)
+
+#else /* static implementation */
+
+#define CUR cur
+
+ static TExecution_Context cur; /* static exec. context variable */
+
+ /* Apparently, we have a _lot_ of direct indexing when accessing */
+ /* the static `cur', which makes the code bigger (due to all the */
+ /* four byte addresses). */
+
+#endif /* !TT_CONFIG_OPTION_STATIC_INTERPRETER */
+
+
+/* A bunch of macros to save typing (and ease reading). */
+
+#define INS_ARG EXEC_OPS PStorage args /* see ttobjs.h */
+
+#define SKIP_Code() SkipCode( EXEC_ARG )
+
+#define GET_ShortIns() GetShortIns( EXEC_ARG )
+
+#define COMPUTE_Funcs() Compute_Funcs( EXEC_ARG )
+
+#define NORMalize( x, y, v ) Normalize( EXEC_ARGS x, y, v )
+
+#define SET_SuperRound( scale, flags ) \
+ SetSuperRound( EXEC_ARGS scale, flags )
+
+#define INS_Goto_CodeRange( range, ip ) \
+ Ins_Goto_CodeRange( EXEC_ARGS range, ip )
+
+#define CUR_Func_project( x, y ) CUR.func_project( EXEC_ARGS x, y )
+#define CUR_Func_move( z, p, d ) CUR.func_move( EXEC_ARGS z, p, d )
+#define CUR_Func_dualproj( x, y ) CUR.func_dualproj( EXEC_ARGS x, y )
+#define CUR_Func_freeProj( x, y ) CUR.func_freeProj( EXEC_ARGS x, y )
+#define CUR_Func_round( d, c ) CUR.func_round( EXEC_ARGS d, c )
+
+#define CUR_Func_read_cvt( index ) \
+ CUR.func_read_cvt( EXEC_ARGS index )
+
+#define CUR_Func_write_cvt( index, val ) \
+ CUR.func_write_cvt( EXEC_ARGS index, val )
+
+#define CUR_Func_move_cvt( index, val ) \
+ CUR.func_move_cvt( EXEC_ARGS index, val )
+
+#define CURRENT_Ratio() Current_Ratio( EXEC_ARG )
+#define CURRENT_Ppem() Current_Ppem( EXEC_ARG )
+
+#define CALC_Length() Calc_Length( EXEC_ARG )
+
+#define INS_SxVTL( a, b, c, d ) Ins_SxVTL( EXEC_ARGS a, b, c, d )
+
+#define COMPUTE_Point_Displacement( a, b, c, d ) \
+ Compute_Point_Displacement( EXEC_ARGS a, b, c, d )
+
+#define MOVE_Zp2_Point( a, b, c, t ) Move_Zp2_Point( EXEC_ARGS a, b, c, t )
+
+#define CUR_Ppem() Cur_PPEM( EXEC_ARG )
+
+ /* Instruction dispatch function, as used by the interpreter */
+ typedef void (*TInstruction_Function)( INS_ARG );
+
+#define BOUNDS( x, n ) ( (TT_UInt)(x) >= (TT_UInt)(n) )
+
+
+
+/*********************************************************************/
+/* */
+/* Before an opcode is executed, the interpreter verifies that */
+/* there are enough arguments on the stack, with the help of */
+/* the Pop_Push_Count table. */
+/* */
+/* For each opcode, the first column gives the number of arguments */
+/* that are popped from the stack; the second one gives the number */
+/* of those that are pushed in result. */
+/* */
+/* Note that for opcodes with a varying number of parameters, */
+/* either 0 or 1 arg is verified before execution, depending */
+/* on the nature of the instruction: */
+/* */
+/* - if the number of arguments is given by the bytecode */
+/* stream or the loop variable, 0 is chosen. */
+/* */
+/* - if the first argument is a count n that is followed */
+/* by arguments a1..an, then 1 is chosen. */
+/* */
+
+#undef PACK
+#define PACK( x, y ) ((x << 4) | y)
+
+ static const Byte Pop_Push_Count[256] =
+ {
+ /* opcodes are gathered in groups of 16 */
+ /* please keep the spaces as they are */
+
+ /* SVTCA y */ PACK( 0, 0 ),
+ /* SVTCA x */ PACK( 0, 0 ),
+ /* SPvTCA y */ PACK( 0, 0 ),
+ /* SPvTCA x */ PACK( 0, 0 ),
+ /* SFvTCA y */ PACK( 0, 0 ),
+ /* SFvTCA x */ PACK( 0, 0 ),
+ /* SPvTL // */ PACK( 2, 0 ),
+ /* SPvTL + */ PACK( 2, 0 ),
+ /* SFvTL // */ PACK( 2, 0 ),
+ /* SFvTL + */ PACK( 2, 0 ),
+ /* SPvFS */ PACK( 2, 0 ),
+ /* SFvFS */ PACK( 2, 0 ),
+ /* GPV */ PACK( 0, 2 ),
+ /* GFV */ PACK( 0, 2 ),
+ /* SFvTPv */ PACK( 0, 0 ),
+ /* ISECT */ PACK( 5, 0 ),
+
+ /* SRP0 */ PACK( 1, 0 ),
+ /* SRP1 */ PACK( 1, 0 ),
+ /* SRP2 */ PACK( 1, 0 ),
+ /* SZP0 */ PACK( 1, 0 ),
+ /* SZP1 */ PACK( 1, 0 ),
+ /* SZP2 */ PACK( 1, 0 ),
+ /* SZPS */ PACK( 1, 0 ),
+ /* SLOOP */ PACK( 1, 0 ),
+ /* RTG */ PACK( 0, 0 ),
+ /* RTHG */ PACK( 0, 0 ),
+ /* SMD */ PACK( 1, 0 ),
+ /* ELSE */ PACK( 0, 0 ),
+ /* JMPR */ PACK( 1, 0 ),
+ /* SCvTCi */ PACK( 1, 0 ),
+ /* SSwCi */ PACK( 1, 0 ),
+ /* SSW */ PACK( 1, 0 ),
+
+ /* DUP */ PACK( 1, 2 ),
+ /* POP */ PACK( 1, 0 ),
+ /* CLEAR */ PACK( 0, 0 ),
+ /* SWAP */ PACK( 2, 2 ),
+ /* DEPTH */ PACK( 0, 1 ),
+ /* CINDEX */ PACK( 1, 1 ),
+ /* MINDEX */ PACK( 1, 0 ),
+ /* AlignPTS */ PACK( 2, 0 ),
+ /* INS_$28 */ PACK( 0, 0 ),
+ /* UTP */ PACK( 1, 0 ),
+ /* LOOPCALL */ PACK( 2, 0 ),
+ /* CALL */ PACK( 1, 0 ),
+ /* FDEF */ PACK( 1, 0 ),
+ /* ENDF */ PACK( 0, 0 ),
+ /* MDAP[0] */ PACK( 1, 0 ),
+ /* MDAP[1] */ PACK( 1, 0 ),
+
+ /* IUP[0] */ PACK( 0, 0 ),
+ /* IUP[1] */ PACK( 0, 0 ),
+ /* SHP[0] */ PACK( 0, 0 ),
+ /* SHP[1] */ PACK( 0, 0 ),
+ /* SHC[0] */ PACK( 1, 0 ),
+ /* SHC[1] */ PACK( 1, 0 ),
+ /* SHZ[0] */ PACK( 1, 0 ),
+ /* SHZ[1] */ PACK( 1, 0 ),
+ /* SHPIX */ PACK( 1, 0 ),
+ /* IP */ PACK( 0, 0 ),
+ /* MSIRP[0] */ PACK( 2, 0 ),
+ /* MSIRP[1] */ PACK( 2, 0 ),
+ /* AlignRP */ PACK( 0, 0 ),
+ /* RTDG */ PACK( 0, 0 ),
+ /* MIAP[0] */ PACK( 2, 0 ),
+ /* MIAP[1] */ PACK( 2, 0 ),
+
+ /* NPushB */ PACK( 0, 0 ),
+ /* NPushW */ PACK( 0, 0 ),
+ /* WS */ PACK( 2, 0 ),
+ /* RS */ PACK( 1, 1 ),
+ /* WCvtP */ PACK( 2, 0 ),
+ /* RCvt */ PACK( 1, 1 ),
+ /* GC[0] */ PACK( 1, 1 ),
+ /* GC[1] */ PACK( 1, 1 ),
+ /* SCFS */ PACK( 2, 0 ),
+ /* MD[0] */ PACK( 2, 1 ),
+ /* MD[1] */ PACK( 2, 1 ),
+ /* MPPEM */ PACK( 0, 1 ),
+ /* MPS */ PACK( 0, 1 ),
+ /* FlipON */ PACK( 0, 0 ),
+ /* FlipOFF */ PACK( 0, 0 ),
+ /* DEBUG */ PACK( 1, 0 ),
+
+ /* LT */ PACK( 2, 1 ),
+ /* LTEQ */ PACK( 2, 1 ),
+ /* GT */ PACK( 2, 1 ),
+ /* GTEQ */ PACK( 2, 1 ),
+ /* EQ */ PACK( 2, 1 ),
+ /* NEQ */ PACK( 2, 1 ),
+ /* ODD */ PACK( 1, 1 ),
+ /* EVEN */ PACK( 1, 1 ),
+ /* IF */ PACK( 1, 0 ),
+ /* EIF */ PACK( 0, 0 ),
+ /* AND */ PACK( 2, 1 ),
+ /* OR */ PACK( 2, 1 ),
+ /* NOT */ PACK( 1, 1 ),
+ /* DeltaP1 */ PACK( 1, 0 ),
+ /* SDB */ PACK( 1, 0 ),
+ /* SDS */ PACK( 1, 0 ),
+
+ /* ADD */ PACK( 2, 1 ),
+ /* SUB */ PACK( 2, 1 ),
+ /* DIV */ PACK( 2, 1 ),
+ /* MUL */ PACK( 2, 1 ),
+ /* ABS */ PACK( 1, 1 ),
+ /* NEG */ PACK( 1, 1 ),
+ /* FLOOR */ PACK( 1, 1 ),
+ /* CEILING */ PACK( 1, 1 ),
+ /* ROUND[0] */ PACK( 1, 1 ),
+ /* ROUND[1] */ PACK( 1, 1 ),
+ /* ROUND[2] */ PACK( 1, 1 ),
+ /* ROUND[3] */ PACK( 1, 1 ),
+ /* NROUND[0] */ PACK( 1, 1 ),
+ /* NROUND[1] */ PACK( 1, 1 ),
+ /* NROUND[2] */ PACK( 1, 1 ),
+ /* NROUND[3] */ PACK( 1, 1 ),
+
+ /* WCvtF */ PACK( 2, 0 ),
+ /* DeltaP2 */ PACK( 1, 0 ),
+ /* DeltaP3 */ PACK( 1, 0 ),
+ /* DeltaCn[0] */ PACK( 1, 0 ),
+ /* DeltaCn[1] */ PACK( 1, 0 ),
+ /* DeltaCn[2] */ PACK( 1, 0 ),
+ /* SROUND */ PACK( 1, 0 ),
+ /* S45Round */ PACK( 1, 0 ),
+ /* JROT */ PACK( 2, 0 ),
+ /* JROF */ PACK( 2, 0 ),
+ /* ROFF */ PACK( 0, 0 ),
+ /* INS_$7B */ PACK( 0, 0 ),
+ /* RUTG */ PACK( 0, 0 ),
+ /* RDTG */ PACK( 0, 0 ),
+ /* SANGW */ PACK( 1, 0 ),
+ /* AA */ PACK( 1, 0 ),
+
+ /* FlipPT */ PACK( 0, 0 ),
+ /* FlipRgON */ PACK( 2, 0 ),
+ /* FlipRgOFF */ PACK( 2, 0 ),
+ /* INS_$83 */ PACK( 0, 0 ),
+ /* INS_$84 */ PACK( 0, 0 ),
+ /* ScanCTRL */ PACK( 1, 0 ),
+ /* SDVPTL[0] */ PACK( 2, 0 ),
+ /* SDVPTL[1] */ PACK( 2, 0 ),
+ /* GetINFO */ PACK( 1, 1 ),
+ /* IDEF */ PACK( 1, 0 ),
+ /* ROLL */ PACK( 3, 3 ),
+ /* MAX */ PACK( 2, 1 ),
+ /* MIN */ PACK( 2, 1 ),
+ /* ScanTYPE */ PACK( 1, 0 ),
+ /* InstCTRL */ PACK( 2, 0 ),
+ /* INS_$8F */ PACK( 0, 0 ),
+
+ /* INS_$90 */ PACK( 0, 0 ),
+ /* INS_$91 */ PACK( 0, 0 ),
+ /* INS_$92 */ PACK( 0, 0 ),
+ /* INS_$93 */ PACK( 0, 0 ),
+ /* INS_$94 */ PACK( 0, 0 ),
+ /* INS_$95 */ PACK( 0, 0 ),
+ /* INS_$96 */ PACK( 0, 0 ),
+ /* INS_$97 */ PACK( 0, 0 ),
+ /* INS_$98 */ PACK( 0, 0 ),
+ /* INS_$99 */ PACK( 0, 0 ),
+ /* INS_$9A */ PACK( 0, 0 ),
+ /* INS_$9B */ PACK( 0, 0 ),
+ /* INS_$9C */ PACK( 0, 0 ),
+ /* INS_$9D */ PACK( 0, 0 ),
+ /* INS_$9E */ PACK( 0, 0 ),
+ /* INS_$9F */ PACK( 0, 0 ),
+
+ /* INS_$A0 */ PACK( 0, 0 ),
+ /* INS_$A1 */ PACK( 0, 0 ),
+ /* INS_$A2 */ PACK( 0, 0 ),
+ /* INS_$A3 */ PACK( 0, 0 ),
+ /* INS_$A4 */ PACK( 0, 0 ),
+ /* INS_$A5 */ PACK( 0, 0 ),
+ /* INS_$A6 */ PACK( 0, 0 ),
+ /* INS_$A7 */ PACK( 0, 0 ),
+ /* INS_$A8 */ PACK( 0, 0 ),
+ /* INS_$A9 */ PACK( 0, 0 ),
+ /* INS_$AA */ PACK( 0, 0 ),
+ /* INS_$AB */ PACK( 0, 0 ),
+ /* INS_$AC */ PACK( 0, 0 ),
+ /* INS_$AD */ PACK( 0, 0 ),
+ /* INS_$AE */ PACK( 0, 0 ),
+ /* INS_$AF */ PACK( 0, 0 ),
+
+ /* PushB[0] */ PACK( 0, 1 ),
+ /* PushB[1] */ PACK( 0, 2 ),
+ /* PushB[2] */ PACK( 0, 3 ),
+ /* PushB[3] */ PACK( 0, 4 ),
+ /* PushB[4] */ PACK( 0, 5 ),
+ /* PushB[5] */ PACK( 0, 6 ),
+ /* PushB[6] */ PACK( 0, 7 ),
+ /* PushB[7] */ PACK( 0, 8 ),
+ /* PushW[0] */ PACK( 0, 1 ),
+ /* PushW[1] */ PACK( 0, 2 ),
+ /* PushW[2] */ PACK( 0, 3 ),
+ /* PushW[3] */ PACK( 0, 4 ),
+ /* PushW[4] */ PACK( 0, 5 ),
+ /* PushW[5] */ PACK( 0, 6 ),
+ /* PushW[6] */ PACK( 0, 7 ),
+ /* PushW[7] */ PACK( 0, 8 ),
+
+ /* MDRP[00] */ PACK( 1, 0 ),
+ /* MDRP[01] */ PACK( 1, 0 ),
+ /* MDRP[02] */ PACK( 1, 0 ),
+ /* MDRP[03] */ PACK( 1, 0 ),
+ /* MDRP[04] */ PACK( 1, 0 ),
+ /* MDRP[05] */ PACK( 1, 0 ),
+ /* MDRP[06] */ PACK( 1, 0 ),
+ /* MDRP[07] */ PACK( 1, 0 ),
+ /* MDRP[08] */ PACK( 1, 0 ),
+ /* MDRP[09] */ PACK( 1, 0 ),
+ /* MDRP[10] */ PACK( 1, 0 ),
+ /* MDRP[11] */ PACK( 1, 0 ),
+ /* MDRP[12] */ PACK( 1, 0 ),
+ /* MDRP[13] */ PACK( 1, 0 ),
+ /* MDRP[14] */ PACK( 1, 0 ),
+ /* MDRP[15] */ PACK( 1, 0 ),
+
+ /* MDRP[16] */ PACK( 1, 0 ),
+ /* MDRP[17] */ PACK( 1, 0 ),
+ /* MDRP[18] */ PACK( 1, 0 ),
+ /* MDRP[19] */ PACK( 1, 0 ),
+ /* MDRP[20] */ PACK( 1, 0 ),
+ /* MDRP[21] */ PACK( 1, 0 ),
+ /* MDRP[22] */ PACK( 1, 0 ),
+ /* MDRP[23] */ PACK( 1, 0 ),
+ /* MDRP[24] */ PACK( 1, 0 ),
+ /* MDRP[25] */ PACK( 1, 0 ),
+ /* MDRP[26] */ PACK( 1, 0 ),
+ /* MDRP[27] */ PACK( 1, 0 ),
+ /* MDRP[28] */ PACK( 1, 0 ),
+ /* MDRP[29] */ PACK( 1, 0 ),
+ /* MDRP[30] */ PACK( 1, 0 ),
+ /* MDRP[31] */ PACK( 1, 0 ),
+
+ /* MIRP[00] */ PACK( 2, 0 ),
+ /* MIRP[01] */ PACK( 2, 0 ),
+ /* MIRP[02] */ PACK( 2, 0 ),
+ /* MIRP[03] */ PACK( 2, 0 ),
+ /* MIRP[04] */ PACK( 2, 0 ),
+ /* MIRP[05] */ PACK( 2, 0 ),
+ /* MIRP[06] */ PACK( 2, 0 ),
+ /* MIRP[07] */ PACK( 2, 0 ),
+ /* MIRP[08] */ PACK( 2, 0 ),
+ /* MIRP[09] */ PACK( 2, 0 ),
+ /* MIRP[10] */ PACK( 2, 0 ),
+ /* MIRP[11] */ PACK( 2, 0 ),
+ /* MIRP[12] */ PACK( 2, 0 ),
+ /* MIRP[13] */ PACK( 2, 0 ),
+ /* MIRP[14] */ PACK( 2, 0 ),
+ /* MIRP[15] */ PACK( 2, 0 ),
+
+ /* MIRP[16] */ PACK( 2, 0 ),
+ /* MIRP[17] */ PACK( 2, 0 ),
+ /* MIRP[18] */ PACK( 2, 0 ),
+ /* MIRP[19] */ PACK( 2, 0 ),
+ /* MIRP[20] */ PACK( 2, 0 ),
+ /* MIRP[21] */ PACK( 2, 0 ),
+ /* MIRP[22] */ PACK( 2, 0 ),
+ /* MIRP[23] */ PACK( 2, 0 ),
+ /* MIRP[24] */ PACK( 2, 0 ),
+ /* MIRP[25] */ PACK( 2, 0 ),
+ /* MIRP[26] */ PACK( 2, 0 ),
+ /* MIRP[27] */ PACK( 2, 0 ),
+ /* MIRP[28] */ PACK( 2, 0 ),
+ /* MIRP[29] */ PACK( 2, 0 ),
+ /* MIRP[30] */ PACK( 2, 0 ),
+ /* MIRP[31] */ PACK( 2, 0 )
+ };
+
+ static const TT_Vector Null_Vector = {0,0};
+
+#undef NULL_Vector
+#define NULL_Vector (TT_Vector*)&Null_Vector
+
+
+/*******************************************************************
+ *
+ * Function : Norm
+ *
+ * Description : Returns the norm (length) of a vector.
+ *
+ * Input : X, Y vector
+ *
+ * Output : Returns length in F26dot6.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Norm( TT_F26Dot6 X, TT_F26Dot6 Y )
+ {
+ TT_Int64 T1, T2;
+
+
+ MUL_64( X, X, T1 );
+ MUL_64( Y, Y, T2 );
+
+ ADD_64( T1, T2, T1 );
+
+ return (TT_F26Dot6)SQRT_64( T1 );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : FUnits_To_Pixels
+ *
+ * Description : Scale a distance in FUnits to pixel coordinates.
+ *
+ * Input : Distance in FUnits
+ *
+ * Output : Distance in 26.6 format.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 FUnits_To_Pixels( EXEC_OPS Short distance )
+ {
+ return TT_MulDiv( distance,
+ CUR.metrics.scale1,
+ CUR.metrics.scale2 );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Current_Ratio
+ *
+ * Description : Return the current aspect ratio scaling factor
+ * depending on the projection vector's state and
+ * device resolutions.
+ *
+ * Input : None
+ *
+ * Output : Aspect ratio in 16.16 format, always <= 1.0 .
+ *
+ *****************************************************************/
+
+ static Long Current_Ratio( EXEC_OP )
+ {
+ if ( CUR.metrics.ratio )
+ return CUR.metrics.ratio;
+
+ if ( CUR.GS.projVector.y == 0 )
+ CUR.metrics.ratio = CUR.metrics.x_ratio;
+
+ else if ( CUR.GS.projVector.x == 0 )
+ CUR.metrics.ratio = CUR.metrics.y_ratio;
+
+ else
+ {
+ Long x, y;
+
+
+ x = TT_MulDiv( CUR.GS.projVector.x, CUR.metrics.x_ratio, 0x4000 );
+ y = TT_MulDiv( CUR.GS.projVector.y, CUR.metrics.y_ratio, 0x4000 );
+ CUR.metrics.ratio = Norm( x, y );
+ }
+
+ return CUR.metrics.ratio;
+ }
+
+
+ static Long Current_Ppem( EXEC_OP )
+ {
+ return TT_MulFix( CUR.metrics.ppem, CURRENT_Ratio() );
+ }
+
+
+ static TT_F26Dot6 Read_CVT( EXEC_OPS ULong index )
+ {
+ return CUR.cvt[index];
+ }
+
+
+ static TT_F26Dot6 Read_CVT_Stretched( EXEC_OPS ULong index )
+ {
+ return TT_MulFix( CUR.cvt[index], CURRENT_Ratio() );
+ }
+
+
+ static void Write_CVT( EXEC_OPS ULong index, TT_F26Dot6 value )
+ {
+ CUR.cvt[index] = value;
+ }
+
+ static void Write_CVT_Stretched( EXEC_OPS ULong index, TT_F26Dot6 value )
+ {
+ CUR.cvt[index] = TT_MulDiv( value, 0x10000, CURRENT_Ratio() );
+ }
+
+
+ static void Move_CVT( EXEC_OPS ULong index, TT_F26Dot6 value )
+ {
+ CUR.cvt[index] += value;
+ }
+
+ static void Move_CVT_Stretched( EXEC_OPS ULong index, TT_F26Dot6 value )
+ {
+ CUR.cvt[index] += TT_MulDiv( value, 0x10000, CURRENT_Ratio() );
+ }
+
+
+/******************************************************************
+ *
+ * Function : Calc_Length
+ *
+ * Description : Computes the length in bytes of current opcode.
+ *
+ *****************************************************************/
+
+ static Bool Calc_Length( EXEC_OP )
+ {
+ CUR.opcode = CUR.code[CUR.IP];
+
+ switch ( CUR.opcode )
+ {
+ case 0x40:
+ if ( CUR.IP + 1 >= CUR.codeSize )
+ return FAILURE;
+
+ CUR.length = CUR.code[CUR.IP + 1] + 2;
+ break;
+
+ case 0x41:
+ if ( CUR.IP + 1 >= CUR.codeSize )
+ return FAILURE;
+
+ CUR.length = CUR.code[CUR.IP + 1] * 2 + 2;
+ break;
+
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ CUR.length = CUR.opcode - 0xB0 + 2;
+ break;
+
+ case 0xB8:
+ case 0xB9:
+ case 0xBA:
+ case 0xBB:
+ case 0xBC:
+ case 0xBD:
+ case 0xBE:
+ case 0xBF:
+ CUR.length = (CUR.opcode - 0xB8) * 2 + 3;
+ break;
+
+ default:
+ CUR.length = 1;
+ break;
+ }
+
+ /* make sure result is in range */
+
+ if ( CUR.IP + CUR.length > CUR.codeSize )
+ return FAILURE;
+
+ return SUCCESS;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : GetShortIns
+ *
+ * Description : Returns a short integer taken from the instruction
+ * stream at address IP.
+ *
+ * Input : None
+ *
+ * Output : Short read at Code^[IP..IP+1]
+ *
+ * Notes : Called through the GET_ShortIns() macro.
+ *
+ *****************************************************************/
+
+ static Short GetShortIns( EXEC_OP )
+ {
+ /* Reading a byte stream so there is no endianess (DaveP) */
+ CUR.IP += 2;
+ return (Short)((CUR.code[CUR.IP - 2] << 8) + CUR.code[CUR.IP - 1]);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Ins_Goto_CodeRange
+ *
+ * Description : Goes to a certain code range in the instruction
+ * stream.
+ *
+ * Input : aRange
+ * aIP
+ *
+ * Output : SUCCESS or FAILURE.
+ *
+ *****************************************************************/
+
+ static Bool Ins_Goto_CodeRange( EXEC_OPS Int aRange, ULong aIP )
+ {
+ TCodeRange* WITH;
+
+
+ if ( aRange < 1 || aRange > 3 )
+ {
+ CUR.error = TT_Err_Bad_Argument;
+ return FAILURE;
+ }
+
+ WITH = &CUR.codeRangeTable[aRange - 1];
+
+ if ( WITH->Base == NULL ) /* invalid coderange */
+ {
+ CUR.error = TT_Err_Invalid_CodeRange;
+ return FAILURE;
+ }
+
+ /* NOTE: Because the last instruction of a program may be a CALL */
+ /* which will return to the first byte *after* the code */
+ /* range, we test for aIP <= Size, instead of aIP < Size. */
+
+ if ( aIP > WITH->Size )
+ {
+ CUR.error = TT_Err_Code_Overflow;
+ return FAILURE;
+ }
+
+ CUR.code = WITH->Base;
+ CUR.codeSize = WITH->Size;
+ CUR.IP = aIP;
+ CUR.curRange = aRange;
+
+ return SUCCESS;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Direct_Move
+ *
+ * Description : Moves a point by a given distance along the
+ * freedom vector. The point will be touched.
+ *
+ * Input : point index of point to move
+ * distance distance to apply
+ * zone affected glyph zone
+ *
+ * Output : None
+ *
+ *****************************************************************/
+
+ static void Direct_Move( EXEC_OPS PGlyph_Zone zone,
+ UShort point,
+ TT_F26Dot6 distance )
+ {
+ TT_F26Dot6 v;
+
+
+ v = CUR.GS.freeVector.x;
+
+ if ( v != 0 )
+ {
+ zone->cur[point].x += TT_MulDiv( distance,
+ v * 0x10000L,
+ CUR.F_dot_P );
+
+ zone->touch[point] |= TT_Flag_Touched_X;
+ }
+
+ v = CUR.GS.freeVector.y;
+
+ if ( v != 0 )
+ {
+ zone->cur[point].y += TT_MulDiv( distance,
+ v * 0x10000L,
+ CUR.F_dot_P );
+
+ zone->touch[point] |= TT_Flag_Touched_Y;
+ }
+ }
+
+
+/******************************************************************/
+/* */
+/* The following versions are used whenever both vectors are both */
+/* along one of the coordinate unit vectors, i.e. in 90% cases. */
+/* */
+/******************************************************************/
+
+/*******************************************************************
+ * Direct_Move_X
+ *
+ *******************************************************************/
+
+ static void Direct_Move_X( EXEC_OPS PGlyph_Zone zone,
+ UShort point,
+ TT_F26Dot6 distance )
+ {
+ zone->cur[point].x += distance;
+ zone->touch[point] |= TT_Flag_Touched_X;
+ }
+
+
+/*******************************************************************
+ * Direct_Move_Y
+ *
+ *******************************************************************/
+
+ static void Direct_Move_Y( EXEC_OPS PGlyph_Zone zone,
+ UShort point,
+ TT_F26Dot6 distance )
+ {
+ zone->cur[point].y += distance;
+ zone->touch[point] |= TT_Flag_Touched_Y;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_None
+ *
+ * Description : Does not round, but adds engine compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : rounded distance.
+ *
+ * NOTE : The spec says very few about the relationship between
+ * rounding and engine compensation. However, it seems
+ * from the description of super round that we should
+ * should add the compensation before rounding.
+ *
+ ******************************************************************/
+
+ static TT_F26Dot6 Round_None( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = distance + compensation;
+ if ( val < 0 )
+ val = 0;
+ }
+ else {
+ val = distance - compensation;
+ if ( val > 0 )
+ val = 0;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_To_Grid
+ *
+ * Description : Rounds value to grid after adding engine
+ * compensation
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_To_Grid( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = distance + compensation + 32;
+ if ( val > 0 )
+ val &= ~63;
+ else
+ val = 0;
+ }
+ else
+ {
+ val = -( (compensation - distance + 32) & (-64) );
+ if ( val > 0 )
+ val = 0;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_To_Half_Grid
+ *
+ * Description : Rounds value to half grid after adding engine
+ * compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_To_Half_Grid( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = ((distance + compensation) & (-64)) + 32;
+ if ( val < 0 )
+ val = 0;
+ }
+ else
+ {
+ val = -( ((compensation - distance) & (-64)) + 32 );
+ if ( val > 0 )
+ val = 0;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_Down_To_Grid
+ *
+ * Description : Rounds value down to grid after adding engine
+ * compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_Down_To_Grid( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = distance + compensation;
+ if ( val > 0 )
+ val &= ~63;
+ else
+ val = 0;
+ }
+ else
+ {
+ val = -( (compensation - distance) & (-64) );
+ if ( val > 0 )
+ val = 0;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_Up_To_Grid
+ *
+ * Description : Rounds value up to grid after adding engine
+ * compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_Up_To_Grid( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = distance + compensation + 63;
+ if ( val > 0 )
+ val &= ~63;
+ else
+ val = 0;
+ }
+ else
+ {
+ val = -( (compensation - distance + 63) & (-64) );
+ if ( val > 0 )
+ val = 0;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_To_Double_Grid
+ *
+ * Description : Rounds value to double grid after adding engine
+ * compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_To_Double_Grid( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = distance + compensation + 16;
+ if ( val > 0 )
+ val &= ~31;
+ else
+ val = 0;
+ }
+ else
+ {
+ val = -( (compensation - distance + 16) & (-32) );
+ if ( val > 0 )
+ val = 0;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_Super
+ *
+ * Description : Super-rounds value to grid after adding engine
+ * compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ * NOTE : The spec says very few about the relationship between
+ * rounding and engine compensation. However, it seems
+ * from the description of super round that we should
+ * should add the compensation before rounding.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_Super( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = (distance - CUR.phase + CUR.threshold + compensation) &
+ (-CUR.period);
+ if ( val < 0 )
+ val = 0;
+ val += CUR.phase;
+ }
+ else
+ {
+ val = -( (CUR.threshold - CUR.phase - distance + compensation) &
+ (-CUR.period) );
+ if ( val > 0 )
+ val = 0;
+ val -= CUR.phase;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Round_Super_45
+ *
+ * Description : Super-rounds value to grid after adding engine
+ * compensation.
+ *
+ * Input : distance : distance to round
+ * compensation : engine compensation
+ *
+ * Output : Rounded distance.
+ *
+ * NOTE : There is a separate function for Round_Super_45 as we
+ * may need a greater precision.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Round_Super_45( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation )
+ {
+ TT_F26Dot6 val;
+
+
+ if ( distance >= 0 )
+ {
+ val = ( (distance - CUR.phase + CUR.threshold + compensation) /
+ CUR.period ) * CUR.period;
+ if ( val < 0 )
+ val = 0;
+ val += CUR.phase;
+ }
+ else
+ {
+ val = -( ( (CUR.threshold - CUR.phase - distance + compensation) /
+ CUR.period ) * CUR.period );
+ if ( val > 0 )
+ val = 0;
+ val -= CUR.phase;
+ }
+
+ return val;
+ }
+
+
+/*******************************************************************
+ * Compute_Round
+ *
+ *****************************************************************/
+
+ static void Compute_Round( EXEC_OPS Byte round_mode )
+ {
+ switch ( round_mode )
+ {
+ case TT_Round_Off:
+ CUR.func_round = (TRound_Function)Round_None;
+ break;
+
+ case TT_Round_To_Grid:
+ CUR.func_round = (TRound_Function)Round_To_Grid;
+ break;
+
+ case TT_Round_Up_To_Grid:
+ CUR.func_round = (TRound_Function)Round_Up_To_Grid;
+ break;
+
+ case TT_Round_Down_To_Grid:
+ CUR.func_round = (TRound_Function)Round_Down_To_Grid;
+ break;
+
+ case TT_Round_To_Half_Grid:
+ CUR.func_round = (TRound_Function)Round_To_Half_Grid;
+ break;
+
+ case TT_Round_To_Double_Grid:
+ CUR.func_round = (TRound_Function)Round_To_Double_Grid;
+ break;
+
+ case TT_Round_Super:
+ CUR.func_round = (TRound_Function)Round_Super;
+ break;
+
+ case TT_Round_Super_45:
+ CUR.func_round = (TRound_Function)Round_Super_45;
+ break;
+ }
+ }
+
+
+/*******************************************************************
+ *
+ * Function : SetSuperRound
+ *
+ * Description : Sets Super Round parameters.
+ *
+ * Input : GridPeriod Grid period
+ * selector SROUND opcode
+ *
+ * Output : None.
+ *
+ *****************************************************************/
+
+ static void SetSuperRound( EXEC_OPS TT_F26Dot6 GridPeriod,
+ Long selector )
+ {
+ switch ( (Int)(selector & 0xC0) )
+ {
+ case 0:
+ CUR.period = GridPeriod / 2;
+ break;
+
+ case 0x40:
+ CUR.period = GridPeriod;
+ break;
+
+ case 0x80:
+ CUR.period = GridPeriod * 2;
+ break;
+
+ /* This opcode is reserved, but... */
+
+ case 0xC0:
+ CUR.period = GridPeriod;
+ break;
+ }
+
+ switch ( (Int)(selector & 0x30) )
+ {
+ case 0:
+ CUR.phase = 0;
+ break;
+
+ case 0x10:
+ CUR.phase = CUR.period / 4;
+ break;
+
+ case 0x20:
+ CUR.phase = CUR.period / 2;
+ break;
+
+ case 0x30:
+ CUR.phase = GridPeriod * 3 / 4;
+ break;
+ }
+
+ if ( (selector & 0x0F) == 0 )
+ CUR.threshold = CUR.period - 1;
+ else
+ CUR.threshold = ( (Int)(selector & 0x0F) - 4 ) * CUR.period / 8;
+
+ CUR.period /= 256;
+ CUR.phase /= 256;
+ CUR.threshold /= 256;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Project
+ *
+ * Description : Computes the projection of vector given by (v2-v1)
+ * along the current projection vector.
+ *
+ * Input : v1, v2 input vector
+ *
+ * Output : Returns distance in F26dot6 format.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Project( EXEC_OPS TT_Vector* v1,
+ TT_Vector* v2 )
+ {
+ TT_Int64 T1, T2;
+
+
+ MUL_64( v1->x - v2->x, CUR.GS.projVector.x, T1 );
+ MUL_64( v1->y - v2->y, CUR.GS.projVector.y, T2 );
+
+ ADD_64( T1, T2, T1 );
+
+ return (TT_F26Dot6)DIV_64( T1, 0x4000L );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Dual_Project
+ *
+ * Description : Computes the projection of the vector given by
+ * (v2-v1) along the current dual vector.
+ *
+ * Input : v1, v2 input vector
+ *
+ * Output : Returns distance in F26dot6 format.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Dual_Project( EXEC_OPS TT_Vector* v1,
+ TT_Vector* v2 )
+ {
+ TT_Int64 T1, T2;
+
+
+ MUL_64( v1->x - v2->x, CUR.GS.dualVector.x, T1 );
+ MUL_64( v1->y - v2->y, CUR.GS.dualVector.y, T2 );
+
+ ADD_64( T1, T2, T1 );
+
+ return (TT_F26Dot6)DIV_64( T1, 0x4000L );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Free_Project
+ *
+ * Description : Computes the projection of the vector given by
+ * (v2-v1) along the current freedom vector.
+ *
+ * Input : v1, v2 input vector
+ *
+ * Output : Returns distance in F26dot6 format.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Free_Project( EXEC_OPS TT_Vector* v1,
+ TT_Vector* v2 )
+ {
+ TT_Int64 T1, T2;
+
+
+ MUL_64( v1->x - v2->x, CUR.GS.freeVector.x, T1 );
+ MUL_64( v1->y - v2->y, CUR.GS.freeVector.y, T2 );
+
+ ADD_64( T1, T2, T1 );
+
+ return (TT_F26Dot6)DIV_64( T1, 0x4000L );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Project_x
+ *
+ * Input : Vx, Vy input vector
+ *
+ * Output : Returns Vx.
+ *
+ * Note : Used as a dummy function.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Project_x( EXEC_OPS TT_Vector* v1,
+ TT_Vector* v2 )
+ {
+ return (v1->x - v2->x);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Project_y
+ *
+ * Input : Vx, Vy input vector
+ *
+ * Output : Returns Vy.
+ *
+ * Note : Used as a dummy function.
+ *
+ *****************************************************************/
+
+ static TT_F26Dot6 Project_y( EXEC_OPS TT_Vector* v1,
+ TT_Vector* v2 )
+ {
+ return (v1->y - v2->y);
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Compute_Funcs
+ *
+ * Description : Computes the projections and movement function
+ * pointers according to the current graphics state.
+ *
+ * Input : None
+ *
+ *****************************************************************/
+
+ static void Compute_Funcs( EXEC_OP )
+ {
+ if ( CUR.GS.freeVector.x == 0x4000 )
+ {
+ CUR.func_freeProj = (TProject_Function)Project_x;
+ CUR.F_dot_P = CUR.GS.projVector.x * 0x10000L;
+ }
+ else
+ {
+ if ( CUR.GS.freeVector.y == 0x4000 )
+ {
+ CUR.func_freeProj = (TProject_Function)Project_y;
+ CUR.F_dot_P = CUR.GS.projVector.y * 0x10000L;
+ }
+ else
+ {
+ CUR.func_freeProj = (TProject_Function)Free_Project;
+ CUR.F_dot_P = (Long)CUR.GS.projVector.x * CUR.GS.freeVector.x * 4 +
+ (Long)CUR.GS.projVector.y * CUR.GS.freeVector.y * 4;
+ }
+ }
+
+ CUR.cached_metrics = FALSE;
+
+ if ( CUR.GS.projVector.x == 0x4000 )
+ CUR.func_project = (TProject_Function)Project_x;
+ else
+ {
+ if ( CUR.GS.projVector.y == 0x4000 )
+ CUR.func_project = (TProject_Function)Project_y;
+ else
+ CUR.func_project = (TProject_Function)Project;
+ }
+
+ if ( CUR.GS.dualVector.x == 0x4000 )
+ CUR.func_dualproj = (TProject_Function)Project_x;
+ else
+ {
+ if ( CUR.GS.dualVector.y == 0x4000 )
+ CUR.func_dualproj = (TProject_Function)Project_y;
+ else
+ CUR.func_dualproj = (TProject_Function)Dual_Project;
+ }
+
+ CUR.func_move = (TMove_Function)Direct_Move;
+
+ if ( CUR.F_dot_P == 0x40000000L )
+ {
+ if ( CUR.GS.freeVector.x == 0x4000 )
+ CUR.func_move = (TMove_Function)Direct_Move_X;
+ else
+ {
+ if ( CUR.GS.freeVector.y == 0x4000 )
+ CUR.func_move = (TMove_Function)Direct_Move_Y;
+ }
+ }
+
+ /* at small sizes, F_dot_P can become too small, resulting */
+ /* in overflows and 'spikes' in a number of glyphs like 'w'. */
+
+ if ( ABS( CUR.F_dot_P ) < 0x4000000L )
+ CUR.F_dot_P = 0x40000000L;
+
+ /* Disable cached aspect ratio */
+ CUR.metrics.ratio = 0;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Normalize
+ *
+ * Description : Norms a vector
+ *
+ * Input : Vx, Vy input vector
+ * R normed unit vector
+ *
+ * Output : Returns FAILURE if a vector parameter is zero.
+ *
+ *****************************************************************/
+
+ static Bool Normalize( EXEC_OPS TT_F26Dot6 Vx,
+ TT_F26Dot6 Vy,
+ TT_UnitVector* R )
+ {
+ TT_F26Dot6 W;
+ Bool S1, S2;
+
+
+ if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
+ {
+ Vx *= 0x100;
+ Vy *= 0x100;
+
+ W = Norm( Vx, Vy );
+
+ if ( W == 0 )
+ {
+ /* UNDOCUMENTED! It seems that it's possible to try to */
+ /* normalize the vector (0,0). Return immediately. */
+ return SUCCESS;
+ }
+
+ R->x = (TT_F2Dot14)TT_MulDiv( Vx, 0x4000L, W );
+ R->y = (TT_F2Dot14)TT_MulDiv( Vy, 0x4000L, W );
+
+ return SUCCESS;
+ }
+
+ W = Norm( Vx, Vy );
+
+ Vx = TT_MulDiv( Vx, 0x4000L, W );
+ Vy = TT_MulDiv( Vy, 0x4000L, W );
+
+ W = Vx * Vx + Vy * Vy;
+
+ /* Now, we want that Sqrt( W ) = 0x4000 */
+ /* Or 0x1000000 <= W < 0x1004000 */
+
+ if ( Vx < 0 )
+ {
+ Vx = -Vx;
+ S1 = TRUE;
+ }
+ else
+ S1 = FALSE;
+
+ if ( Vy < 0 )
+ {
+ Vy = -Vy;
+ S2 = TRUE;
+ }
+ else
+ S2 = FALSE;
+
+ while ( W < 0x1000000L )
+ {
+ /* We need to increase W, by a minimal amount */
+ if ( Vx < Vy )
+ Vx++;
+ else
+ Vy++;
+
+ W = Vx * Vx + Vy * Vy;
+ }
+
+ while ( W >= 0x1004000L )
+ {
+ /* We need to decrease W, by a minimal amount */
+ if ( Vx < Vy )
+ Vx--;
+ else
+ Vy--;
+
+ W = Vx * Vx + Vy * Vy;
+ }
+
+ /* Note that in various cases, we can only */
+ /* compute a Sqrt(W) of 0x3FFF, eg. Vx = Vy */
+
+ if ( S1 )
+ Vx = -Vx;
+
+ if ( S2 )
+ Vy = -Vy;
+
+ R->x = (TT_F2Dot14)Vx; /* Type conversion */
+ R->y = (TT_F2Dot14)Vy; /* Type conversion */
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************
+ *
+ * Opcodes
+ *
+ ****************************************************************/
+
+
+ static Bool Ins_SxVTL( EXEC_OPS UShort aIdx1,
+ UShort aIdx2,
+ Int aOpc,
+ TT_UnitVector* Vec )
+ {
+ Long A, B, C;
+ TT_Vector* p1;
+ TT_Vector* p2;
+
+
+ if ( BOUNDS( aIdx1, CUR.zp2.n_points ) ||
+ BOUNDS( aIdx2, CUR.zp1.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return FAILURE;
+ }
+
+ p1 = CUR.zp1.cur + aIdx2;
+ p2 = CUR.zp2.cur + aIdx1;
+
+ A = p1->x - p2->x;
+ B = p1->y - p2->y;
+
+ if ( (aOpc & 1) != 0 )
+ {
+ C = B; /* CounterClockwise rotation */
+ B = A;
+ A = -C;
+ }
+
+ NORMalize( A, B, Vec );
+ return SUCCESS;
+ }
+
+
+/* When not using the big switch statements, the interpreter uses a */
+/* call table defined later below in this source. Each opcode must */
+/* thus have a corresponding function, even trivial ones. */
+/* */
+/* They're all defined there. */
+
+#define DO_SVTCA \
+ { \
+ Short A, B; \
+ \
+ \
+ A = (Short)(CUR.opcode & 1) << 14; \
+ B = A ^ (Short)0x4000; \
+ \
+ CUR.GS.freeVector.x = A; \
+ CUR.GS.projVector.x = A; \
+ CUR.GS.dualVector.x = A; \
+ \
+ CUR.GS.freeVector.y = B; \
+ CUR.GS.projVector.y = B; \
+ CUR.GS.dualVector.y = B; \
+ \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SPVTCA \
+ { \
+ Short A, B; \
+ \
+ \
+ A = (Short)(CUR.opcode & 1) << 14; \
+ B = A ^ (Short)0x4000; \
+ \
+ CUR.GS.projVector.x = A; \
+ CUR.GS.dualVector.x = A; \
+ \
+ CUR.GS.projVector.y = B; \
+ CUR.GS.dualVector.y = B; \
+ \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SFVTCA \
+ { \
+ Short A, B; \
+ \
+ \
+ A = (Short)(CUR.opcode & 1) << 14; \
+ B = A ^ (Short)0x4000; \
+ \
+ CUR.GS.freeVector.x = A; \
+ CUR.GS.freeVector.y = B; \
+ \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SPVTL \
+ if ( INS_SxVTL( (UShort)args[1], \
+ (UShort)args[0], \
+ CUR.opcode, \
+ &CUR.GS.projVector) == SUCCESS ) \
+ { \
+ CUR.GS.dualVector = CUR.GS.projVector; \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SFVTL \
+ if ( INS_SxVTL( (UShort)args[1], \
+ (UShort)args[0], \
+ CUR.opcode, \
+ &CUR.GS.freeVector) == SUCCESS ) \
+ COMPUTE_Funcs();
+
+
+#define DO_SFVTPV \
+ CUR.GS.freeVector = CUR.GS.projVector; \
+ COMPUTE_Funcs();
+
+
+#define DO_SPVFS \
+ { \
+ Short S; \
+ Long X, Y; \
+ \
+ \
+ /* Only use low 16bits, then sign extend */ \
+ S = (Short)args[1]; \
+ Y = (Long)S; \
+ S = (Short)args[0]; \
+ X = (Long)S; \
+ \
+ NORMalize( X, Y, &CUR.GS.projVector ); \
+ \
+ CUR.GS.dualVector = CUR.GS.projVector; \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_SFVFS \
+ { \
+ Short S; \
+ Long X, Y; \
+ \
+ \
+ /* Only use low 16bits, then sign extend */ \
+ S = (Short)args[1]; \
+ Y = (Long)S; \
+ S = (Short)args[0]; \
+ X = S; \
+ \
+ NORMalize( X, Y, &CUR.GS.freeVector ); \
+ COMPUTE_Funcs(); \
+ }
+
+
+#define DO_GPV \
+ args[0] = CUR.GS.projVector.x; \
+ args[1] = CUR.GS.projVector.y;
+
+
+#define DO_GFV \
+ args[0] = CUR.GS.freeVector.x; \
+ args[1] = CUR.GS.freeVector.y;
+
+
+#define DO_SRP0 \
+ CUR.GS.rp0 = (UShort)args[0];
+
+
+#define DO_SRP1 \
+ CUR.GS.rp1 = (UShort)args[0];
+
+
+#define DO_SRP2 \
+ CUR.GS.rp2 = (UShort)args[0];
+
+
+#define DO_RTHG \
+ CUR.GS.round_state = TT_Round_To_Half_Grid; \
+ CUR.func_round = (TRound_Function)Round_To_Half_Grid;
+
+
+#define DO_RTG \
+ CUR.GS.round_state = TT_Round_To_Grid; \
+ CUR.func_round = (TRound_Function)Round_To_Grid;
+
+
+#define DO_RTDG \
+ CUR.GS.round_state = TT_Round_To_Double_Grid; \
+ CUR.func_round = (TRound_Function)Round_To_Double_Grid;
+
+
+#define DO_RUTG \
+ CUR.GS.round_state = TT_Round_Up_To_Grid; \
+ CUR.func_round = (TRound_Function)Round_Up_To_Grid;
+
+
+#define DO_RDTG \
+ CUR.GS.round_state = TT_Round_Down_To_Grid; \
+ CUR.func_round = (TRound_Function)Round_Down_To_Grid;
+
+
+#define DO_ROFF \
+ CUR.GS.round_state = TT_Round_Off; \
+ CUR.func_round = (TRound_Function)Round_None;
+
+
+#define DO_SROUND \
+ SET_SuperRound( 0x4000L, args[0] ); \
+ CUR.GS.round_state = TT_Round_Super; \
+ CUR.func_round = (TRound_Function)Round_Super;
+
+
+#define DO_S45ROUND \
+ SET_SuperRound( 0x2D41L, args[0] ); \
+ CUR.GS.round_state = TT_Round_Super_45; \
+ CUR.func_round = (TRound_Function)Round_Super_45;
+
+
+#define DO_SLOOP \
+ if ( args[0] < 0 ) \
+ CUR.error = TT_Err_Bad_Argument; \
+ else \
+ CUR.GS.loop = args[0];
+
+
+#define DO_SMD \
+ CUR.GS.minimum_distance = (TT_F26Dot6)args[0];
+
+
+#define DO_SCVTCI \
+ CUR.GS.control_value_cutin = (TT_F26Dot6)args[0];
+
+
+#define DO_SSWCI \
+ CUR.GS.single_width_cutin = (TT_F26Dot6)args[0];
+
+
+ /* XXX : UNDOCUMENTED! or bug in the Windows engine? */
+ /* */
+ /* It seems that the value that is read here is */
+ /* expressed in 16.16 format, rather than in */
+ /* font units.. */
+ /* */
+#define DO_SSW \
+ CUR.GS.single_width_value = (TT_F26Dot6)(args[0] >> 10);
+
+
+#define DO_FLIPON \
+ CUR.GS.auto_flip = TRUE;
+
+
+#define DO_FLIPOFF \
+ CUR.GS.auto_flip = FALSE;
+
+
+#define DO_SDB \
+ CUR.GS.delta_base = (Short)args[0];
+
+
+#define DO_SDS \
+ CUR.GS.delta_shift = (Short)args[0];
+
+
+#define DO_MD /* nothing */
+
+
+#define DO_MPPEM \
+ args[0] = CURRENT_Ppem();
+
+
+#define DO_MPS \
+ args[0] = CUR.metrics.pointSize;
+
+
+#define DO_DUP \
+ args[1] = args[0];
+
+
+#define DO_CLEAR \
+ CUR.new_top = 0;
+
+
+#define DO_SWAP \
+ { \
+ Long L; \
+ \
+ L = args[0]; \
+ args[0] = args[1]; \
+ args[1] = L; \
+ }
+
+
+#define DO_DEPTH \
+ args[0] = CUR.top;
+
+
+#define DO_CINDEX \
+ { \
+ Long L; \
+ \
+ \
+ L = args[0]; \
+ \
+ if ( L <= 0 || L > CUR.args ) \
+ CUR.error = TT_Err_Invalid_Reference; \
+ else \
+ args[0] = CUR.stack[CUR.args - L]; \
+ }
+
+
+#define DO_JROT \
+ if ( args[1] != 0 ) \
+ { \
+ CUR.IP += args[0]; \
+ CUR.step_ins = FALSE; \
+ }
+
+
+#define DO_JMPR \
+ CUR.IP += args[0]; \
+ CUR.step_ins = FALSE;
+
+
+#define DO_JROF \
+ if ( args[1] == 0 ) \
+ { \
+ CUR.IP += args[0]; \
+ CUR.step_ins = FALSE; \
+ }
+
+
+#define DO_LT \
+ args[0] = (args[0] < args[1]);
+
+
+#define DO_LTEQ \
+ args[0] = (args[0] <= args[1]);
+
+
+#define DO_GT \
+ args[0] = (args[0] > args[1]);
+
+
+#define DO_GTEQ \
+ args[0] = (args[0] >= args[1]);
+
+
+#define DO_EQ \
+ args[0] = (args[0] == args[1]);
+
+
+#define DO_NEQ \
+ args[0] = (args[0] != args[1]);
+
+
+#define DO_ODD \
+ args[0] = ( (CUR_Func_round( args[0], 0 ) & 127) == 64 );
+
+
+#define DO_EVEN \
+ args[0] = ( (CUR_Func_round( args[0], 0 ) & 127) == 0 );
+
+
+#define DO_AND \
+ args[0] = ( args[0] && args[1] );
+
+
+#define DO_OR \
+ args[0] = ( args[0] || args[1] );
+
+
+#define DO_NOT \
+ args[0] = !args[0];
+
+
+#define DO_ADD \
+ args[0] += args[1];
+
+
+#define DO_SUB \
+ args[0] -= args[1];
+
+
+#define DO_DIV \
+ if ( args[1] == 0 ) \
+ CUR.error = TT_Err_Divide_By_Zero; \
+ else \
+ args[0] = TT_MulDiv( args[0], 64L, args[1] );
+
+
+#define DO_MUL \
+ args[0] = TT_MulDiv( args[0], args[1], 64L );
+
+
+#define DO_ABS \
+ args[0] = ABS( args[0] );
+
+
+#define DO_NEG \
+ args[0] = -args[0];
+
+
+#define DO_FLOOR \
+ args[0] &= -64;
+
+
+#define DO_CEILING \
+ args[0] = (args[0] + 63) & (-64);
+
+
+#define DO_RS \
+ { \
+ ULong I = (ULong)args[0]; \
+ if ( BOUNDS( I, CUR.storeSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ else \
+ args[0] = 0; \
+ } \
+ else \
+ args[0] = CUR.storage[I]; \
+ }
+
+
+#define DO_WS \
+ { \
+ ULong I = (ULong)args[0]; \
+ if ( BOUNDS( I, CUR.storeSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ } \
+ else \
+ CUR.storage[I] = args[1]; \
+ }
+
+
+
+#define DO_RCVT \
+ { \
+ ULong I = (ULong)args[0]; \
+ if ( BOUNDS( I, CUR.cvtSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ else \
+ args[0] = 0; \
+ } \
+ else \
+ args[0] = CUR_Func_read_cvt(I); \
+ }
+
+
+#define DO_WCVTP \
+ { \
+ ULong I = (ULong)args[0]; \
+ if ( BOUNDS( I, CUR.cvtSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ } \
+ else \
+ CUR_Func_write_cvt( I, args[1] ); \
+ }
+
+
+#define DO_WCVTF \
+ { \
+ ULong I = (ULong)args[0]; \
+ if ( BOUNDS( I, CUR.cvtSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ } \
+ else \
+ CUR.cvt[I] = FUnits_To_Pixels( EXEC_ARGS (Short)args[1] ); \
+ }
+
+
+#define DO_DEBUG \
+ CUR.error = TT_Err_Debug_OpCode;
+
+
+#define DO_ROUND \
+ args[0] = CUR_Func_round( args[0], \
+ CUR.metrics.compensations[CUR.opcode-0x68] );
+
+
+#define DO_NROUND \
+ args[0] = Round_None( EXEC_ARGS \
+ args[0], \
+ CUR.metrics.compensations[CUR.opcode - 0x6C] );
+
+
+#define DO_MAX \
+ if ( args[1] > args[0] ) \
+ args[0] = args[1];
+
+
+#define DO_MIN \
+ if ( args[1] < args[0] ) \
+ args[0] = args[1];
+
+
+#ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH
+
+
+#undef ARRAY_BOUND_ERROR
+#define ARRAY_BOUND_ERROR \
+ { \
+ CUR.error = TT_Err_Invalid_Reference; \
+ return; \
+ }
+
+
+/*******************************************/
+/* SVTCA[a] : Set F and P vectors to axis */
+/* CodeRange : $00-$01 */
+/* Stack : --> */
+
+ static void Ins_SVTCA( INS_ARG )
+ {
+ DO_SVTCA
+ }
+
+
+/*******************************************/
+/* SPVTCA[a] : Set PVector to Axis */
+/* CodeRange : $02-$03 */
+/* Stack : --> */
+
+ static void Ins_SPVTCA( INS_ARG )
+ {
+ DO_SPVTCA
+ }
+
+
+/*******************************************/
+/* SFVTCA[a] : Set FVector to Axis */
+/* CodeRange : $04-$05 */
+/* Stack : --> */
+
+ static void Ins_SFVTCA( INS_ARG )
+ {
+ DO_SFVTCA
+ }
+
+/*******************************************/
+/* SPVTL[a] : Set PVector to Line */
+/* CodeRange : $06-$07 */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_SPVTL( INS_ARG )
+ {
+ DO_SPVTL
+ }
+
+
+/*******************************************/
+/* SFVTL[a] : Set FVector to Line */
+/* CodeRange : $08-$09 */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_SFVTL( INS_ARG )
+ {
+ DO_SFVTL
+ }
+
+
+/*******************************************/
+/* SFVTPV[] : Set FVector to PVector */
+/* CodeRange : $0E */
+/* Stack : --> */
+
+ static void Ins_SFVTPV( INS_ARG )
+ {
+ DO_SFVTPV
+ }
+
+
+/*******************************************/
+/* SPVFS[] : Set PVector From Stack */
+/* CodeRange : $0A */
+/* Stack : f2.14 f2.14 --> */
+
+ static void Ins_SPVFS( INS_ARG )
+ {
+ DO_SPVFS
+ }
+
+
+/*******************************************/
+/* SFVFS[] : Set FVector From Stack */
+/* CodeRange : $0B */
+/* Stack : f2.14 f2.14 --> */
+
+ static void Ins_SFVFS( INS_ARG )
+ {
+ DO_SFVFS
+ }
+
+
+/*******************************************/
+/* GPV[] : Get Projection Vector */
+/* CodeRange : $0C */
+/* Stack : ef2.14 --> ef2.14 */
+
+ static void Ins_GPV( INS_ARG )
+ {
+ DO_GPV
+ }
+
+
+/*******************************************/
+/* GFV[] : Get Freedom Vector */
+/* CodeRange : $0D */
+/* Stack : ef2.14 --> ef2.14 */
+
+ static void Ins_GFV( INS_ARG )
+ {
+ DO_GFV
+ }
+
+
+/*******************************************/
+/* SRP0[] : Set Reference Point 0 */
+/* CodeRange : $10 */
+/* Stack : uint32 --> */
+
+ static void Ins_SRP0( INS_ARG )
+ {
+ DO_SRP0
+ }
+
+
+/*******************************************/
+/* SRP1[] : Set Reference Point 1 */
+/* CodeRange : $11 */
+/* Stack : uint32 --> */
+
+ static void Ins_SRP1( INS_ARG )
+ {
+ DO_SRP1
+ }
+
+
+/*******************************************/
+/* SRP2[] : Set Reference Point 2 */
+/* CodeRange : $12 */
+/* Stack : uint32 --> */
+
+ static void Ins_SRP2( INS_ARG )
+ {
+ DO_SRP2
+ }
+
+
+/*******************************************/
+/* RTHG[] : Round To Half Grid */
+/* CodeRange : $19 */
+/* Stack : --> */
+
+ static void Ins_RTHG( INS_ARG )
+ {
+ DO_RTHG
+ }
+
+
+/*******************************************/
+/* RTG[] : Round To Grid */
+/* CodeRange : $18 */
+/* Stack : --> */
+
+ static void Ins_RTG( INS_ARG )
+ {
+ DO_RTG
+ }
+
+
+/*******************************************/
+/* RTDG[] : Round To Double Grid */
+/* CodeRange : $3D */
+/* Stack : --> */
+
+ static void Ins_RTDG( INS_ARG )
+ {
+ DO_RTDG
+ }
+
+
+/*******************************************/
+/* RUTG[] : Round Up To Grid */
+/* CodeRange : $7C */
+/* Stack : --> */
+
+ static void Ins_RUTG( INS_ARG )
+ {
+ DO_RUTG
+ }
+
+
+/*******************************************/
+/* RDTG[] : Round Down To Grid */
+/* CodeRange : $7D */
+/* Stack : --> */
+
+ static void Ins_RDTG( INS_ARG )
+ {
+ DO_RDTG
+ }
+
+
+/*******************************************/
+/* ROFF[] : Round OFF */
+/* CodeRange : $7A */
+/* Stack : --> */
+
+ static void Ins_ROFF( INS_ARG )
+ {
+ DO_ROFF
+ }
+
+
+/*******************************************/
+/* SROUND[] : Super ROUND */
+/* CodeRange : $76 */
+/* Stack : Eint8 --> */
+
+ static void Ins_SROUND( INS_ARG )
+ {
+ DO_SROUND
+ }
+
+
+/*******************************************/
+/* S45ROUND[]: Super ROUND 45 degrees */
+/* CodeRange : $77 */
+/* Stack : uint32 --> */
+
+ static void Ins_S45ROUND( INS_ARG )
+ {
+ DO_S45ROUND
+ }
+
+
+/*******************************************/
+/* SLOOP[] : Set LOOP variable */
+/* CodeRange : $17 */
+/* Stack : int32? --> */
+
+ static void Ins_SLOOP( INS_ARG )
+ {
+ DO_SLOOP
+ }
+
+
+/*******************************************/
+/* SMD[] : Set Minimum Distance */
+/* CodeRange : $1A */
+/* Stack : f26.6 --> */
+
+ static void Ins_SMD( INS_ARG )
+ {
+ DO_SMD
+ }
+
+
+/**********************************************/
+/* SCVTCI[] : Set Control Value Table Cut In */
+/* CodeRange : $1D */
+/* Stack : f26.6 --> */
+
+ static void Ins_SCVTCI( INS_ARG )
+ {
+ DO_SCVTCI
+ }
+
+
+/**********************************************/
+/* SSWCI[] : Set Single Width Cut In */
+/* CodeRange : $1E */
+/* Stack : f26.6 --> */
+
+ static void Ins_SSWCI( INS_ARG )
+ {
+ DO_SSWCI
+ }
+
+
+/**********************************************/
+/* SSW[] : Set Single Width */
+/* CodeRange : $1F */
+/* Stack : int32? --> */
+
+ static void Ins_SSW( INS_ARG )
+ {
+ DO_SSW
+ }
+
+
+/**********************************************/
+/* FLIPON[] : Set Auto_flip to On */
+/* CodeRange : $4D */
+/* Stack : --> */
+
+ static void Ins_FLIPON( INS_ARG )
+ {
+ DO_FLIPON
+ }
+
+
+/**********************************************/
+/* FLIPOFF[] : Set Auto_flip to Off */
+/* CodeRange : $4E */
+/* Stack : --> */
+
+ static void Ins_FLIPOFF( INS_ARG )
+ {
+ DO_FLIPOFF
+ }
+
+
+/**********************************************/
+/* SANGW[] : Set Angle Weight */
+/* CodeRange : $7E */
+/* Stack : uint32 --> */
+
+ static void Ins_SANGW( INS_ARG )
+ {
+ /* instruction not supported anymore */
+ }
+
+
+/**********************************************/
+/* SDB[] : Set Delta Base */
+/* CodeRange : $5E */
+/* Stack : uint32 --> */
+
+ static void Ins_SDB( INS_ARG )
+ {
+ DO_SDB
+ }
+
+
+/**********************************************/
+/* SDS[] : Set Delta Shift */
+/* CodeRange : $5F */
+/* Stack : uint32 --> */
+
+ static void Ins_SDS( INS_ARG )
+ {
+ DO_SDS
+ }
+
+
+/**********************************************/
+/* MPPEM[] : Measure Pixel Per EM */
+/* CodeRange : $4B */
+/* Stack : --> Euint16 */
+
+ static void Ins_MPPEM( INS_ARG )
+ {
+ DO_MPPEM
+ }
+
+
+/**********************************************/
+/* MPS[] : Measure PointSize */
+/* CodeRange : $4C */
+/* Stack : --> Euint16 */
+
+ static void Ins_MPS( INS_ARG )
+ {
+ DO_MPS
+ }
+
+/*******************************************/
+/* DUP[] : Duplicate top stack element */
+/* CodeRange : $20 */
+/* Stack : StkElt --> StkElt StkElt */
+
+ static void Ins_DUP( INS_ARG )
+ {
+ DO_DUP
+ }
+
+
+/*******************************************/
+/* POP[] : POPs the stack's top elt. */
+/* CodeRange : $21 */
+/* Stack : StkElt --> */
+
+ static void Ins_POP( INS_ARG )
+ {
+ /* nothing to do */
+ }
+
+
+/*******************************************/
+/* CLEAR[] : Clear the entire stack */
+/* CodeRange : $22 */
+/* Stack : StkElt... --> */
+
+ static void Ins_CLEAR( INS_ARG )
+ {
+ DO_CLEAR
+ }
+
+
+/*******************************************/
+/* SWAP[] : Swap the top two elements */
+/* CodeRange : $23 */
+/* Stack : 2 * StkElt --> 2 * StkElt */
+
+ static void Ins_SWAP( INS_ARG )
+ {
+ DO_SWAP
+ }
+
+
+/*******************************************/
+/* DEPTH[] : return the stack depth */
+/* CodeRange : $24 */
+/* Stack : --> uint32 */
+
+ static void Ins_DEPTH( INS_ARG )
+ {
+ DO_DEPTH
+ }
+
+
+/*******************************************/
+/* CINDEX[] : copy indexed element */
+/* CodeRange : $25 */
+/* Stack : int32 --> StkElt */
+
+ static void Ins_CINDEX( INS_ARG )
+ {
+ DO_CINDEX
+ }
+
+
+/*******************************************/
+/* EIF[] : End IF */
+/* CodeRange : $59 */
+/* Stack : --> */
+
+ static void Ins_EIF( INS_ARG )
+ {
+ /* nothing to do */
+ }
+
+
+/*******************************************/
+/* JROT[] : Jump Relative On True */
+/* CodeRange : $78 */
+/* Stack : StkElt int32 --> */
+
+ static void Ins_JROT( INS_ARG )
+ {
+ DO_JROT
+ }
+
+
+/*******************************************/
+/* JMPR[] : JuMP Relative */
+/* CodeRange : $1C */
+/* Stack : int32 --> */
+
+ static void Ins_JMPR( INS_ARG )
+ {
+ DO_JMPR
+ }
+
+
+/*******************************************/
+/* JROF[] : Jump Relative On False */
+/* CodeRange : $79 */
+/* Stack : StkElt int32 --> */
+
+ static void Ins_JROF( INS_ARG )
+ {
+ DO_JROF
+ }
+
+
+/*******************************************/
+/* LT[] : Less Than */
+/* CodeRange : $50 */
+/* Stack : int32? int32? --> bool */
+
+ static void Ins_LT( INS_ARG )
+ {
+ DO_LT
+ }
+
+
+/*******************************************/
+/* LTEQ[] : Less Than or EQual */
+/* CodeRange : $51 */
+/* Stack : int32? int32? --> bool */
+
+ static void Ins_LTEQ( INS_ARG )
+ {
+ DO_LTEQ
+ }
+
+
+/*******************************************/
+/* GT[] : Greater Than */
+/* CodeRange : $52 */
+/* Stack : int32? int32? --> bool */
+
+ static void Ins_GT( INS_ARG )
+ {
+ DO_GT
+ }
+
+
+/*******************************************/
+/* GTEQ[] : Greater Than or EQual */
+/* CodeRange : $53 */
+/* Stack : int32? int32? --> bool */
+
+ static void Ins_GTEQ( INS_ARG )
+ {
+ DO_GTEQ
+ }
+
+
+/*******************************************/
+/* EQ[] : EQual */
+/* CodeRange : $54 */
+/* Stack : StkElt StkElt --> bool */
+
+ static void Ins_EQ( INS_ARG )
+ {
+ DO_EQ
+ }
+
+
+/*******************************************/
+/* NEQ[] : Not EQual */
+/* CodeRange : $55 */
+/* Stack : StkElt StkElt --> bool */
+
+ static void Ins_NEQ( INS_ARG )
+ {
+ DO_NEQ
+ }
+
+
+/*******************************************/
+/* ODD[] : Odd */
+/* CodeRange : $56 */
+/* Stack : f26.6 --> bool */
+
+ static void Ins_ODD( INS_ARG )
+ {
+ DO_ODD
+ }
+
+
+/*******************************************/
+/* EVEN[] : Even */
+/* CodeRange : $57 */
+/* Stack : f26.6 --> bool */
+
+ static void Ins_EVEN( INS_ARG )
+ {
+ DO_EVEN
+ }
+
+
+/*******************************************/
+/* AND[] : logical AND */
+/* CodeRange : $5A */
+/* Stack : uint32 uint32 --> uint32 */
+
+ static void Ins_AND( INS_ARG )
+ {
+ DO_AND
+ }
+
+
+/*******************************************/
+/* OR[] : logical OR */
+/* CodeRange : $5B */
+/* Stack : uint32 uint32 --> uint32 */
+
+ static void Ins_OR( INS_ARG )
+ {
+ DO_OR
+ }
+
+
+/*******************************************/
+/* NOT[] : logical NOT */
+/* CodeRange : $5C */
+/* Stack : StkElt --> uint32 */
+
+ static void Ins_NOT( INS_ARG )
+ {
+ DO_NOT
+ }
+
+
+/*******************************************/
+/* ADD[] : ADD */
+/* CodeRange : $60 */
+/* Stack : f26.6 f26.6 --> f26.6 */
+
+ static void Ins_ADD( INS_ARG )
+ {
+ DO_ADD
+ }
+
+
+/*******************************************/
+/* SUB[] : SUBstract */
+/* CodeRange : $61 */
+/* Stack : f26.6 f26.6 --> f26.6 */
+
+ static void Ins_SUB( INS_ARG )
+ {
+ DO_SUB
+ }
+
+
+/*******************************************/
+/* DIV[] : DIVide */
+/* CodeRange : $62 */
+/* Stack : f26.6 f26.6 --> f26.6 */
+
+ static void Ins_DIV( INS_ARG )
+ {
+ DO_DIV
+ }
+
+
+/*******************************************/
+/* MUL[] : MULtiply */
+/* CodeRange : $63 */
+/* Stack : f26.6 f26.6 --> f26.6 */
+
+ static void Ins_MUL( INS_ARG )
+ {
+ DO_MUL
+ }
+
+
+/*******************************************/
+/* ABS[] : ABSolute value */
+/* CodeRange : $64 */
+/* Stack : f26.6 --> f26.6 */
+
+ static void Ins_ABS( INS_ARG )
+ {
+ DO_ABS
+ }
+
+
+/*******************************************/
+/* NEG[] : NEGate */
+/* CodeRange : $65 */
+/* Stack : f26.6 --> f26.6 */
+
+ static void Ins_NEG( INS_ARG )
+ {
+ DO_NEG
+ }
+
+
+/*******************************************/
+/* FLOOR[] : FLOOR */
+/* CodeRange : $66 */
+/* Stack : f26.6 --> f26.6 */
+
+ static void Ins_FLOOR( INS_ARG )
+ {
+ DO_FLOOR
+ }
+
+
+/*******************************************/
+/* CEILING[] : CEILING */
+/* CodeRange : $67 */
+/* f26.6 --> f26.6 */
+
+ static void Ins_CEILING( INS_ARG )
+ {
+ DO_CEILING
+ }
+
+/*******************************************/
+/* RS[] : Read Store */
+/* CodeRange : $43 */
+/* Stack : uint32 --> uint32 */
+
+ static void Ins_RS( INS_ARG )
+ {
+ DO_RS
+ }
+
+
+/*******************************************/
+/* WS[] : Write Store */
+/* CodeRange : $42 */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_WS( INS_ARG )
+ {
+ DO_WS
+ }
+
+
+/*******************************************/
+/* WCVTP[] : Write CVT in Pixel units */
+/* CodeRange : $44 */
+/* Stack : f26.6 uint32 --> */
+
+ static void Ins_WCVTP( INS_ARG )
+ {
+ DO_WCVTP
+ }
+
+
+/*******************************************/
+/* WCVTF[] : Write CVT in FUnits */
+/* CodeRange : $70 */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_WCVTF( INS_ARG )
+ {
+ DO_WCVTF
+ }
+
+
+/*******************************************/
+/* RCVT[] : Read CVT */
+/* CodeRange : $45 */
+/* Stack : uint32 --> f26.6 */
+
+ static void Ins_RCVT( INS_ARG )
+ {
+ DO_RCVT
+ }
+
+
+/********************************************/
+/* AA[] : Adjust Angle */
+/* CodeRange : $7F */
+/* Stack : uint32 --> */
+
+ static void Ins_AA( INS_ARG )
+ {
+ /* Intentional - no longer supported */
+ }
+
+
+/********************************************/
+/* DEBUG[] : DEBUG. Unsupported */
+/* CodeRange : $4F */
+/* Stack : uint32 --> */
+
+/* NOTE : The original instruction pops a value from the stack */
+
+ static void Ins_DEBUG( INS_ARG )
+ {
+ DO_DEBUG
+ }
+
+/*******************************************/
+/* ROUND[ab] : ROUND value */
+/* CodeRange : $68-$6B */
+/* Stack : f26.6 --> f26.6 */
+
+ static void Ins_ROUND( INS_ARG )
+ {
+ DO_ROUND
+ }
+
+/*******************************************/
+/* NROUND[ab]: No ROUNDing of value */
+/* CodeRange : $6C-$6F */
+/* Stack : f26.6 --> f26.6 */
+
+ static void Ins_NROUND( INS_ARG )
+ {
+ DO_NROUND
+ }
+
+
+
+/*******************************************/
+/* MAX[] : MAXimum */
+/* CodeRange : $68 */
+/* Stack : int32? int32? --> int32 */
+
+ static void Ins_MAX( INS_ARG )
+ {
+ DO_MAX
+ }
+
+
+/*******************************************/
+/* MIN[] : MINimum */
+/* CodeRange : $69 */
+/* Stack : int32? int32? --> int32 */
+
+ static void Ins_MIN( INS_ARG )
+ {
+ DO_MIN
+ }
+
+
+#endif /* !TT_CONFIG_OPTION_INTERPRETER_SWITCH */
+
+
+/* The following functions are called as is within the switch statement */
+
+/*******************************************/
+/* MINDEX[] : move indexed element */
+/* CodeRange : $26 */
+/* Stack : int32? --> StkElt */
+
+ static void Ins_MINDEX( INS_ARG )
+ {
+ Long L, K;
+
+
+ L = args[0];
+
+ if ( L <= 0 || L > CUR.args )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ K = CUR.stack[CUR.args - L];
+
+ MEM_Move( (&CUR.stack[CUR.args - L ]),
+ (&CUR.stack[CUR.args - L + 1]),
+ (L - 1) * sizeof ( Long ) );
+
+ CUR.stack[CUR.args - 1] = K;
+ }
+
+
+/*******************************************/
+/* ROLL[] : roll top three elements */
+/* CodeRange : $8A */
+/* Stack : 3 * StkElt --> 3 * StkElt */
+
+ static void Ins_ROLL( INS_ARG )
+ {
+ Long A, B, C;
+
+
+ A = args[2];
+ B = args[1];
+ C = args[0];
+
+ args[2] = C;
+ args[1] = A;
+ args[0] = B;
+ }
+
+
+
+/****************************************************************/
+/* */
+/* MANAGING THE FLOW OF CONTROL */
+/* */
+/* Instructions appear in the specs' order. */
+/* */
+/****************************************************************/
+
+ static Bool SkipCode( EXEC_OP )
+ {
+ CUR.IP += CUR.length;
+
+ if ( CUR.IP < CUR.codeSize )
+ if ( CALC_Length() == SUCCESS )
+ return SUCCESS;
+
+ CUR.error = TT_Err_Code_Overflow;
+ return FAILURE;
+ }
+
+
+/*******************************************/
+/* IF[] : IF test */
+/* CodeRange : $58 */
+/* Stack : StkElt --> */
+
+ static void Ins_IF( INS_ARG )
+ {
+ Int nIfs;
+ Bool Out;
+
+
+ if ( args[0] != 0 )
+ return;
+
+ nIfs = 1;
+ Out = 0;
+
+ do
+ {
+ if ( SKIP_Code() == FAILURE )
+ return;
+
+ switch ( CUR.opcode )
+ {
+ case 0x58: /* IF */
+ nIfs++;
+ break;
+
+ case 0x1b: /* ELSE */
+ Out = (nIfs == 1);
+ break;
+
+ case 0x59: /* EIF */
+ nIfs--;
+ Out = (nIfs == 0);
+ break;
+ }
+ } while ( Out == 0 );
+ }
+
+
+/*******************************************/
+/* ELSE[] : ELSE */
+/* CodeRange : $1B */
+/* Stack : --> */
+
+ static void Ins_ELSE( INS_ARG )
+ {
+ Int nIfs;
+
+
+ nIfs = 1;
+
+ do
+ {
+ if ( SKIP_Code() == FAILURE )
+ return;
+
+ switch ( CUR.opcode )
+ {
+ case 0x58: /* IF */
+ nIfs++;
+ break;
+
+ case 0x59: /* EIF */
+ nIfs--;
+ break;
+ }
+ } while ( nIfs != 0 );
+ }
+
+
+/****************************************************************/
+/* */
+/* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */
+/* */
+/* Instructions appear in the specs' order. */
+/* */
+/****************************************************************/
+
+ static PDefRecord Locate_FDef( EXEC_OPS Int n, Bool new_def )
+ {
+ PDefRecord def;
+ UShort hash;
+ UShort cnt;
+
+ /* The function table is interpreted as a simple hash table */
+ /* with indexes computed modulo maxFDefs and the linear search */
+ /* of free cells in the case of a collision. */
+ /* Except for some old Apple fonts, all functions in a TrueType */
+ /* font fit into 0..maxFDefs - 1 range and the lookup is */
+ /* reduced to a single step. */
+
+ /* Minor optimization. */
+ if ( !new_def && ( n < 0 || n > CUR.maxFunc ) )
+ return NULL;
+
+ for ( cnt = 0; cnt < CUR.maxFDefs; ++cnt )
+ {
+ hash = ( (UShort)n + cnt ) % CUR.maxFDefs;
+ def = &CUR.FDefs[ hash ];
+ if ( !def->Active )
+ return new_def ? def : NULL;
+ if ( def->Opc == n )
+ return def;
+ }
+
+ /* The table is full and the entry has not been found. */
+ return NULL;
+ }
+
+
+/*******************************************/
+/* FDEF[] : Function DEFinition */
+/* CodeRange : $2C */
+/* Stack : uint32 --> */
+
+ static void Ins_FDEF( INS_ARG )
+ {
+ Int n;
+ PDefRecord def;
+
+
+ /* check that there is enough room */
+ if ( CUR.numFDefs >= CUR.maxFDefs )
+ {
+ CUR.error = TT_Err_Too_Many_FDefs;
+ return;
+ }
+
+ n = (Int)args[0];
+ if ( n < 0 || n != (int)args[0] )
+ {
+ /* Gotcha. Function index is uint32 according to the specs */
+ /* but TDefRecord.Opc is defined as Int. We cannot store */
+ /* the definition of this function. */
+ CUR.error = TT_Err_Bad_Argument;
+ return;
+ }
+
+ def = Locate_FDef( EXEC_ARGS n, TRUE );
+ if ( !def )
+ {
+ /* Oh, oh. Something is wrong. Locate_FDef should never fail here. */
+ CUR.error = TT_Err_Too_Many_Ins;
+ return;
+ }
+
+ /* Some font programs are broken enough to redefine functions! */
+ if ( !def->Active )
+ CUR.numFDefs++;
+
+ def->Range = CUR.curRange;
+ def->Opc = n;
+ def->Start = CUR.IP + 1;
+ def->Active = TRUE;
+
+ if ( n > CUR.maxFunc )
+ CUR.maxFunc = n;
+
+ /* Now skip the whole function definition. */
+ /* We don't allow nested IDEFS & FDEFs. */
+
+ while ( SKIP_Code() == SUCCESS )
+ {
+ switch ( CUR.opcode )
+ {
+ case 0x89: /* IDEF */
+ case 0x2c: /* FDEF */
+ CUR.error = TT_Err_Nested_DEFS;
+ return;
+ case 0x2d: /* ENDF */
+ return;
+ }
+ }
+ }
+
+
+/*******************************************/
+/* ENDF[] : END Function definition */
+/* CodeRange : $2D */
+/* Stack : --> */
+
+ static void Ins_ENDF( INS_ARG )
+ {
+ PCallRecord pRec;
+
+
+ if ( CUR.callTop <= 0 ) /* We encountered an ENDF without a call */
+ {
+ CUR.error = TT_Err_ENDF_In_Exec_Stream;
+ return;
+ }
+
+ CUR.callTop--;
+
+ pRec = &CUR.callStack[CUR.callTop];
+
+ pRec->Cur_Count--;
+
+ CUR.step_ins = FALSE;
+
+ if ( pRec->Cur_Count > 0 )
+ {
+ CUR.callTop++;
+ CUR.IP = pRec->Cur_Restart;
+ }
+ else
+ /* Loop through the current function */
+ INS_Goto_CodeRange( pRec->Caller_Range,
+ pRec->Caller_IP );
+
+ /* Exit the current call frame. */
+
+ /* NOTE: When the last intruction of a program */
+ /* is a CALL or LOOPCALL, the return address */
+ /* is always out of the code range. This is */
+ /* a valid address, and it's why we do not test */
+ /* the result of Ins_Goto_CodeRange() here! */
+ }
+
+
+/*******************************************/
+/* CALL[] : CALL function */
+/* CodeRange : $2B */
+/* Stack : uint32? --> */
+
+ static void Ins_CALL( INS_ARG )
+ {
+ Int n;
+ PDefRecord def;
+ PCallRecord pCrec;
+
+
+ n = (Int)args[0];
+ def = Locate_FDef( EXEC_ARGS n, FALSE );
+ if ( !def )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ /* check call stack */
+ if ( CUR.callTop >= CUR.callSize )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ pCrec = CUR.callStack + CUR.callTop;
+
+ pCrec->Caller_Range = CUR.curRange;
+ pCrec->Caller_IP = CUR.IP + 1;
+ pCrec->Cur_Count = 1;
+ pCrec->Cur_Restart = def->Start;
+
+ CUR.callTop++;
+
+ INS_Goto_CodeRange( def->Range,
+ def->Start );
+
+ CUR.step_ins = FALSE;
+ }
+
+
+/*******************************************/
+/* LOOPCALL[]: LOOP and CALL function */
+/* CodeRange : $2A */
+/* Stack : uint32? Eint16? --> */
+
+ static void Ins_LOOPCALL( INS_ARG )
+ {
+ Int n;
+ Long count;
+ PDefRecord def;
+ PCallRecord pTCR;
+
+
+ n = (Int)args[1];
+ def = Locate_FDef( EXEC_ARGS n, FALSE );
+ if ( !def )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ if ( CUR.callTop >= CUR.callSize )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ count = (Long)args[0];
+ if ( count <= 0 )
+ return;
+
+ pTCR = &CUR.callStack[CUR.callTop];
+
+ pTCR->Caller_Range = CUR.curRange;
+ pTCR->Caller_IP = CUR.IP + 1;
+ pTCR->Cur_Count = count;
+ pTCR->Cur_Restart = def->Start;
+
+ CUR.callTop++;
+
+ INS_Goto_CodeRange( def->Range,
+ def->Start );
+
+ CUR.step_ins = FALSE;
+ }
+
+
+/*******************************************/
+/* IDEF[] : Instruction DEFinition */
+/* CodeRange : $89 */
+/* Stack : Eint8 --> */
+
+ static void Ins_IDEF( INS_ARG )
+ {
+ Byte opcode;
+ PDefRecord def;
+ PDefRecord limit;
+
+
+ opcode = (Byte)args[0];
+
+ /* First of all, look for the same instruction in our table */
+ def = CUR.IDefs;
+ limit = def + CUR.numIDefs;
+ for ( ; def < limit; def++ )
+ if ( def->Opc == opcode )
+ break;
+
+ if ( def == limit )
+ {
+ /* check that there is enough room for a new instruction */
+ if ( CUR.numIDefs >= CUR.maxIDefs )
+ {
+ /* We could introduce a new error message (the same as for FDEF), */
+ /* but we're too close from the release to change all the 'po' */
+ /* files again... */
+ CUR.error = TT_Err_Too_Many_Ins;
+ return;
+ }
+ CUR.numIDefs++;
+ }
+
+ def->Opc = opcode;
+ def->Start = CUR.IP + 1;
+ def->Range = CUR.curRange;
+ def->Active = TRUE;
+
+ if ( opcode > CUR.maxIns )
+ CUR.maxIns = opcode;
+
+ /* Now skip the whole function definition */
+ /* We don't allow nested IDEFs & FDEFs. */
+
+ while ( SKIP_Code() == SUCCESS )
+ {
+ switch ( CUR.opcode )
+ {
+ case 0x89: /* IDEF */
+ case 0x2c: /* FDEF */
+ CUR.error = TT_Err_Nested_DEFS;
+ return;
+ case 0x2d: /* ENDF */
+ return;
+ }
+ }
+ }
+
+
+/****************************************************************/
+/* */
+/* PUSHING DATA ONTO THE INTERPRETER STACK */
+/* */
+/* Instructions appear in the specs' order. */
+/* */
+/****************************************************************/
+
+/*******************************************/
+/* NPUSHB[] : PUSH N Bytes */
+/* CodeRange : $40 */
+/* Stack : --> uint32... */
+
+ static void Ins_NPUSHB( INS_ARG )
+ {
+ UShort L, K;
+
+
+ L = (UShort)CUR.code[CUR.IP + 1];
+
+ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ for ( K = 1; K <= L; K++ )
+ args[K - 1] = CUR.code[CUR.IP + K + 1];
+
+ CUR.new_top += L;
+ }
+
+
+/*******************************************/
+/* NPUSHW[] : PUSH N Words */
+/* CodeRange : $41 */
+/* Stack : --> int32... */
+
+ static void Ins_NPUSHW( INS_ARG )
+ {
+ UShort L, K;
+
+
+ L = (UShort)CUR.code[CUR.IP + 1];
+
+ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ CUR.IP += 2;
+
+ for ( K = 0; K < L; K++ )
+ args[K] = GET_ShortIns();
+
+ CUR.step_ins = FALSE;
+ CUR.new_top += L;
+ }
+
+
+/*******************************************/
+/* PUSHB[abc]: PUSH Bytes */
+/* CodeRange : $B0-$B7 */
+/* Stack : --> uint32... */
+
+ static void Ins_PUSHB( INS_ARG )
+ {
+ UShort L, K;
+
+
+ L = (UShort)CUR.opcode - 0xB0 + 1;
+
+ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ for ( K = 1; K <= L; K++ )
+ args[K - 1] = CUR.code[CUR.IP + K];
+ }
+
+
+/*******************************************/
+/* PUSHW[abc]: PUSH Words */
+/* CodeRange : $B8-$BF */
+/* Stack : --> int32... */
+
+ static void Ins_PUSHW( INS_ARG )
+ {
+ UShort L, K;
+
+
+ L = (UShort)CUR.opcode - 0xB8 + 1;
+
+ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ CUR.IP++;
+
+ for ( K = 0; K < L; K++ )
+ args[K] = GET_ShortIns();
+
+ CUR.step_ins = FALSE;
+ }
+
+
+
+/****************************************************************/
+/* */
+/* MANAGING THE GRAPHICS STATE */
+/* */
+/* Instructions appear in the specs' order. */
+/* */
+/****************************************************************/
+
+/**********************************************/
+/* GC[a] : Get Coordinate projected onto */
+/* CodeRange : $46-$47 */
+/* Stack : uint32 --> f26.6 */
+
+/* BULLSHIT: Measures from the original glyph must be taken */
+/* along the dual projection vector! */
+
+ static void Ins_GC( INS_ARG )
+ {
+ ULong L;
+ TT_F26Dot6 R;
+
+
+ L = (ULong)args[0];
+
+ if ( BOUNDS( L, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ else
+ R = 0;
+ }
+ else
+ {
+ if ( CUR.opcode & 1 )
+ R = CUR_Func_dualproj( CUR.zp2.org + L, NULL_Vector );
+ else
+ R = CUR_Func_project( CUR.zp2.cur + L, NULL_Vector );
+ }
+
+ args[0] = R;
+ }
+
+
+/**********************************************/
+/* SCFS[] : Set Coordinate From Stack */
+/* CodeRange : $48 */
+/* Stack : f26.6 uint32 --> */
+/* */
+/* Formula: */
+/* */
+/* OA := OA + ( value - OA.p )/( f.p ) * f */
+/* */
+
+ static void Ins_SCFS( INS_ARG )
+ {
+ Long K;
+ UShort L;
+
+
+ L = (UShort)args[0];
+
+ if ( BOUNDS( L, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ K = CUR_Func_project( CUR.zp2.cur + L, NULL_Vector );
+
+ CUR_Func_move( &CUR.zp2, L, args[1] - K );
+
+ /* not part of the specs, but here for safety */
+
+ if ( CUR.GS.gep2 == 0 )
+ CUR.zp2.org[L] = CUR.zp2.cur[L];
+ }
+
+
+/**********************************************/
+/* MD[a] : Measure Distance */
+/* CodeRange : $49-$4A */
+/* Stack : uint32 uint32 --> f26.6 */
+
+/* BULLSHIT: Measure taken in the original glyph must be along */
+/* the dual projection vector. */
+
+/* Second BULLSHIT: Flag attributes are inverted! */
+/* 0 => measure distance in original outline */
+/* 1 => measure distance in grid-fitted outline */
+
+/* Third one !! : zp0 - zp1, and not "zp2 - zp1" !!! */
+/* */
+
+ static void Ins_MD( INS_ARG )
+ {
+ UShort K, L;
+ TT_F26Dot6 D;
+
+
+ K = (UShort)args[1];
+ L = (UShort)args[0];
+
+ if( BOUNDS( L, CUR.zp0.n_points ) ||
+ BOUNDS( K, CUR.zp1.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ else
+ D = 0;
+ }
+ else
+ {
+ if ( CUR.opcode & 1 )
+ D = CUR_Func_project( CUR.zp0.cur + L, CUR.zp1.cur + K );
+ else
+ D = CUR_Func_dualproj( CUR.zp0.org + L, CUR.zp1.org + K );
+ }
+
+ args[0] = D;
+ }
+
+
+/*******************************************/
+/* SDPVTL[a] : Set Dual PVector to Line */
+/* CodeRange : $86-$87 */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_SDPVTL( INS_ARG )
+ {
+ Long A, B, C;
+ UShort p1, p2; /* was Int in pas type ERROR */
+
+
+ p1 = (UShort)args[1];
+ p2 = (UShort)args[0];
+
+ if ( BOUNDS( p2, CUR.zp1.n_points ) ||
+ BOUNDS( p1, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ {
+ TT_Vector* v1 = CUR.zp1.org + p2;
+ TT_Vector* v2 = CUR.zp2.org + p1;
+
+
+ A = v1->x - v2->x;
+ B = v1->y - v2->y;
+ }
+
+ if ( (CUR.opcode & 1) != 0 )
+ {
+ C = B; /* CounterClockwise rotation */
+ B = A;
+ A = -C;
+ }
+
+ NORMalize( A, B, &CUR.GS.dualVector );
+
+ {
+ TT_Vector* v1 = CUR.zp1.cur + p2;
+ TT_Vector* v2 = CUR.zp2.cur + p1;
+
+
+ A = v1->x - v2->x;
+ B = v1->y - v2->y;
+ }
+
+ if ( (CUR.opcode & 1) != 0 )
+ {
+ C = B; /* CounterClockwise rotation */
+ B = A;
+ A = -C;
+ }
+
+ NORMalize( A, B, &CUR.GS.projVector );
+
+ COMPUTE_Funcs();
+ }
+
+
+/*******************************************/
+/* SZP0[] : Set Zone Pointer 0 */
+/* CodeRange : $13 */
+/* Stack : uint32 --> */
+
+ static void Ins_SZP0( INS_ARG )
+ {
+ switch ( (Int)args[0] )
+ {
+ case 0:
+ CUR.zp0 = CUR.twilight;
+ break;
+
+ case 1:
+ CUR.zp0 = CUR.pts;
+ break;
+
+ default:
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ CUR.GS.gep0 = (UShort)args[0];
+ }
+
+
+/*******************************************/
+/* SZP1[] : Set Zone Pointer 1 */
+/* CodeRange : $14 */
+/* Stack : uint32 --> */
+
+ static void Ins_SZP1( INS_ARG )
+ {
+ switch ( (Int)args[0] )
+ {
+ case 0:
+ CUR.zp1 = CUR.twilight;
+ break;
+
+ case 1:
+ CUR.zp1 = CUR.pts;
+ break;
+
+ default:
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ CUR.GS.gep1 = (UShort)args[0];
+ }
+
+
+/*******************************************/
+/* SZP2[] : Set Zone Pointer 2 */
+/* CodeRange : $15 */
+/* Stack : uint32 --> */
+
+ static void Ins_SZP2( INS_ARG )
+ {
+ switch ( (Int)args[0] )
+ {
+ case 0:
+ CUR.zp2 = CUR.twilight;
+ break;
+
+ case 1:
+ CUR.zp2 = CUR.pts;
+ break;
+
+ default:
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ CUR.GS.gep2 = (UShort)args[0];
+ }
+
+
+/*******************************************/
+/* SZPS[] : Set Zone Pointers */
+/* CodeRange : $16 */
+/* Stack : uint32 --> */
+
+ static void Ins_SZPS( INS_ARG )
+ {
+ switch ( (Int)args[0] )
+ {
+ case 0:
+ CUR.zp0 = CUR.twilight;
+ break;
+
+ case 1:
+ CUR.zp0 = CUR.pts;
+ break;
+
+ default:
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ CUR.zp1 = CUR.zp0;
+ CUR.zp2 = CUR.zp0;
+
+ CUR.GS.gep0 = (UShort)args[0];
+ CUR.GS.gep1 = (UShort)args[0];
+ CUR.GS.gep2 = (UShort)args[0];
+ }
+
+
+/*******************************************/
+/* INSTCTRL[]: INSTruction ConTRol */
+/* CodeRange : $8e */
+/* Stack : int32 int32 --> */
+
+ static void Ins_INSTCTRL( INS_ARG )
+ {
+ Long K, L;
+
+
+ K = args[1];
+ L = args[0];
+
+ if ( K < 1 || K > 2 )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ if ( L != 0 )
+ L = K;
+
+ CUR.GS.instruct_control =
+ (Byte)( CUR.GS.instruct_control & ~(Byte)K ) | (Byte)L;
+ }
+
+
+/*******************************************/
+/* SCANCTRL[]: SCAN ConTRol */
+/* CodeRange : $85 */
+/* Stack : uint32? --> */
+
+ static void Ins_SCANCTRL( INS_ARG )
+ {
+ Int A;
+
+
+ /* Get Threshold */
+ A = (Int)(args[0] & 0xFF);
+
+ if ( A == 0xFF )
+ {
+ CUR.GS.scan_control = TRUE;
+ return;
+ }
+ else if ( A == 0 )
+ {
+ CUR.GS.scan_control = FALSE;
+ return;
+ }
+
+ A *= 64;
+
+ if ( (args[0] & 0x100) != 0 && CUR.metrics.pointSize <= A )
+ CUR.GS.scan_control = TRUE;
+
+ if ( (args[0] & 0x200) != 0 && CUR.metrics.rotated )
+ CUR.GS.scan_control = TRUE;
+
+ if ( (args[0] & 0x400) != 0 && CUR.metrics.stretched )
+ CUR.GS.scan_control = TRUE;
+
+ if ( (args[0] & 0x800) != 0 && CUR.metrics.pointSize > A )
+ CUR.GS.scan_control = FALSE;
+
+ if ( (args[0] & 0x1000) != 0 && CUR.metrics.rotated )
+ CUR.GS.scan_control = FALSE;
+
+ if ( (args[0] & 0x2000) != 0 && CUR.metrics.stretched )
+ CUR.GS.scan_control = FALSE;
+}
+
+
+/*******************************************/
+/* SCANTYPE[]: SCAN TYPE */
+/* CodeRange : $8D */
+/* Stack : uint32? --> */
+
+ static void Ins_SCANTYPE( INS_ARG )
+ {
+ /* For compatibility with future enhancements, */
+ /* we must ignore new modes */
+
+ if ( args[0] >= 0 && args[0] <= 5 )
+ {
+ if ( args[0] == 3 )
+ args[0] = 2;
+
+ CUR.GS.scan_type = (Int)args[0];
+ }
+ }
+
+
+
+/****************************************************************/
+/* */
+/* MANAGING OUTLINES */
+/* */
+/* Instructions appear in the specs' order. */
+/* */
+/****************************************************************/
+
+/**********************************************/
+/* FLIPPT[] : FLIP PoinT */
+/* CodeRange : $80 */
+/* Stack : uint32... --> */
+
+ static void Ins_FLIPPT( INS_ARG )
+ {
+ UShort point;
+
+
+ if ( CUR.top < CUR.GS.loop )
+ {
+ CUR.error = TT_Err_Too_Few_Arguments;
+ return;
+ }
+
+ while ( CUR.GS.loop > 0 )
+ {
+ CUR.args--;
+
+ point = (UShort)CUR.stack[CUR.args];
+
+ if ( BOUNDS( point, CUR.pts.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ }
+ else
+ CUR.pts.touch[point] ^= TT_Flag_On_Curve;
+
+ CUR.GS.loop--;
+ }
+
+ CUR.GS.loop = 1;
+ CUR.new_top = CUR.args;
+ }
+
+
+/**********************************************/
+/* FLIPRGON[]: FLIP RanGe ON */
+/* CodeRange : $81 */
+/* Stack : uint32 uint32 --> */
+/* (but UShorts are sufficient) */
+
+ static void Ins_FLIPRGON( INS_ARG )
+ {
+ UShort I, K, L;
+
+
+ K = (UShort)args[1];
+ L = (UShort)args[0];
+
+ if ( BOUNDS( K, CUR.pts.n_points ) ||
+ BOUNDS( L, CUR.pts.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ for ( I = L; I <= K; I++ )
+ CUR.pts.touch[I] |= TT_Flag_On_Curve;
+ }
+
+
+/**********************************************/
+/* FLIPRGOFF : FLIP RanGe OFF */
+/* CodeRange : $82 */
+/* Stack : uint32 uint32 --> */
+/* (but UShorts are sufficient) */
+
+ static void Ins_FLIPRGOFF( INS_ARG )
+ {
+ UShort I, K, L;
+
+
+ K = (UShort)args[1];
+ L = (UShort)args[0];
+
+ if ( BOUNDS( K, CUR.pts.n_points ) ||
+ BOUNDS( L, CUR.pts.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ for ( I = L; I <= K; I++ )
+ CUR.pts.touch[I] &= ~TT_Flag_On_Curve;
+ }
+
+
+ static Bool Compute_Point_Displacement( EXEC_OPS
+ PCoordinates x,
+ PCoordinates y,
+ PGlyph_Zone zone,
+ UShort* refp )
+ {
+ TGlyph_Zone zp;
+ UShort p;
+ TT_F26Dot6 d;
+
+
+ if ( CUR.opcode & 1 )
+ {
+ zp = CUR.zp0;
+ p = CUR.GS.rp1;
+ }
+ else
+ {
+ zp = CUR.zp1;
+ p = CUR.GS.rp2;
+ }
+
+ if ( BOUNDS( p, zp.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Displacement;
+ return FAILURE;
+ }
+
+ *zone = zp;
+ *refp = p;
+
+ d = CUR_Func_project( zp.cur + p, zp.org + p );
+
+ *x = TT_MulDiv(d, (Long)CUR.GS.freeVector.x * 0x10000L, CUR.F_dot_P );
+ *y = TT_MulDiv(d, (Long)CUR.GS.freeVector.y * 0x10000L, CUR.F_dot_P );
+
+ return SUCCESS;
+ }
+
+
+ static void Move_Zp2_Point( EXEC_OPS
+ UShort point,
+ TT_F26Dot6 dx,
+ TT_F26Dot6 dy,
+ Bool touch )
+ {
+ if ( CUR.GS.freeVector.x != 0 )
+ {
+ CUR.zp2.cur[point].x += dx;
+ if ( touch )
+ CUR.zp2.touch[point] |= TT_Flag_Touched_X;
+ }
+
+ if ( CUR.GS.freeVector.y != 0 )
+ {
+ CUR.zp2.cur[point].y += dy;
+ if ( touch )
+ CUR.zp2.touch[point] |= TT_Flag_Touched_Y;
+ }
+ }
+
+
+/**********************************************/
+/* SHP[a] : SHift Point by the last point */
+/* CodeRange : $32-33 */
+/* Stack : uint32... --> */
+
+ static void Ins_SHP( INS_ARG )
+ {
+ TGlyph_Zone zp;
+ UShort refp;
+
+ TT_F26Dot6 dx,
+ dy;
+ UShort point;
+
+
+ if ( CUR.top < CUR.GS.loop )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
+ return;
+
+ while ( CUR.GS.loop > 0 )
+ {
+ CUR.args--;
+ point = (UShort)CUR.stack[CUR.args];
+
+ if ( BOUNDS( point, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ }
+ else
+ /* UNDOCUMENTED! SHP touches the points */
+ MOVE_Zp2_Point( point, dx, dy, TRUE );
+
+ CUR.GS.loop--;
+ }
+
+ CUR.GS.loop = 1;
+ CUR.new_top = CUR.args;
+ }
+
+
+/**********************************************/
+/* SHC[a] : SHift Contour */
+/* CodeRange : $34-35 */
+/* Stack : uint32 --> */
+
+ static void Ins_SHC( INS_ARG )
+ {
+ TGlyph_Zone zp;
+ UShort refp;
+ TT_F26Dot6 dx,
+ dy;
+
+ Short contour;
+ UShort first_point, last_point, i;
+
+
+ contour = (UShort)args[0];
+
+ if ( BOUNDS( contour, CUR.pts.n_contours ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
+ return;
+
+ if ( contour == 0 )
+ first_point = 0;
+ else
+ first_point = CUR.pts.contours[contour - 1] + 1;
+
+ last_point = CUR.pts.contours[contour];
+
+ /* XXX: this is probably wrong... at least it prevents memory */
+ /* corruption when zp2 is the twilight zone */
+ if ( last_point > CUR.zp2.n_points )
+ {
+ if ( CUR.zp2.n_points > 0 )
+ last_point = CUR.zp2.n_points - 1;
+ else
+ last_point = 0;
+ }
+
+ /* UNDOCUMENTED! SHC doesn't touch the points */
+ for ( i = first_point; i <= last_point; i++ )
+ {
+ if ( zp.cur != CUR.zp2.cur || refp != i )
+ MOVE_Zp2_Point( i, dx, dy, FALSE );
+ }
+ }
+
+
+/**********************************************/
+/* SHZ[a] : SHift Zone */
+/* CodeRange : $36-37 */
+/* Stack : uint32 --> */
+
+ static void Ins_SHZ( INS_ARG )
+ {
+ TGlyph_Zone zp;
+ UShort refp;
+ TT_F26Dot6 dx,
+ dy;
+
+ UShort last_point, i;
+
+
+ if ( BOUNDS( args[0], 2 ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
+ return;
+
+ if ( CUR.zp2.n_points > 0 )
+ last_point = CUR.zp2.n_points - 1;
+ else
+ last_point = 0;
+
+ /* UNDOCUMENTED! SHZ doesn't touch the points */
+ for ( i = 0; i <= last_point; i++ )
+ {
+ if ( zp.cur != CUR.zp2.cur || refp != i )
+ MOVE_Zp2_Point( i, dx, dy, FALSE );
+ }
+ }
+
+
+/**********************************************/
+/* SHPIX[] : SHift points by a PIXel amount */
+/* CodeRange : $38 */
+/* Stack : f26.6 uint32... --> */
+
+ static void Ins_SHPIX( INS_ARG )
+ {
+ TT_F26Dot6 dx, dy;
+ UShort point;
+
+
+ if ( CUR.top < CUR.GS.loop + 1 )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ dx = TT_MulDiv( args[0],
+ (Long)CUR.GS.freeVector.x,
+ 0x4000 );
+ dy = TT_MulDiv( args[0],
+ (Long)CUR.GS.freeVector.y,
+ 0x4000 );
+
+ while ( CUR.GS.loop > 0 )
+ {
+ CUR.args--;
+
+ point = (UShort)CUR.stack[CUR.args];
+
+ if ( BOUNDS( point, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ }
+ else
+ MOVE_Zp2_Point( point, dx, dy, TRUE );
+
+ CUR.GS.loop--;
+ }
+
+ CUR.GS.loop = 1;
+ CUR.new_top = CUR.args;
+ }
+
+
+/**********************************************/
+/* MSIRP[a] : Move Stack Indirect Relative */
+/* CodeRange : $3A-$3B */
+/* Stack : f26.6 uint32 --> */
+
+ static void Ins_MSIRP( INS_ARG )
+ {
+ UShort point;
+ TT_F26Dot6 distance;
+
+
+ point = (UShort)args[0];
+
+ if ( BOUNDS( point, CUR.zp1.n_points ) ||
+ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ /* XXX: UNDOCUMENTED! behaviour */
+ if ( CUR.GS.gep0 == 0 ) /* if in twilight zone */
+ {
+ CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0];
+ CUR.zp1.cur[point] = CUR.zp1.org[point];
+ }
+
+ distance = CUR_Func_project( CUR.zp1.cur + point,
+ CUR.zp0.cur + CUR.GS.rp0 );
+
+ CUR_Func_move( &CUR.zp1, point, args[1] - distance );
+
+ CUR.GS.rp1 = CUR.GS.rp0;
+ CUR.GS.rp2 = point;
+
+ if ( (CUR.opcode & 1) != 0 )
+ CUR.GS.rp0 = point;
+ }
+
+
+/**********************************************/
+/* MDAP[a] : Move Direct Absolute Point */
+/* CodeRange : $2E-$2F */
+/* Stack : uint32 --> */
+
+ static void Ins_MDAP( INS_ARG )
+ {
+ UShort point;
+ TT_F26Dot6 cur_dist,
+ distance;
+
+
+ point = (UShort)args[0];
+
+ if ( BOUNDS( point, CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ /* XXX: Is there some undocumented feature while in the */
+ /* twilight zone? ? */
+ if ( (CUR.opcode & 1) != 0 )
+ {
+ cur_dist = CUR_Func_project( CUR.zp0.cur + point, NULL_Vector );
+ distance = CUR_Func_round( cur_dist,
+ CUR.metrics.compensations[0] ) - cur_dist;
+ }
+ else
+ distance = 0;
+
+ CUR_Func_move( &CUR.zp0, point, distance );
+
+ CUR.GS.rp0 = point;
+ CUR.GS.rp1 = point;
+ }
+
+
+/**********************************************/
+/* MIAP[a] : Move Indirect Absolute Point */
+/* CodeRange : $3E-$3F */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_MIAP( INS_ARG )
+ {
+ ULong cvtEntry;
+ UShort point;
+ TT_F26Dot6 distance,
+ org_dist;
+
+
+ cvtEntry = (ULong)args[1];
+ point = (UShort)args[0];
+
+ if ( BOUNDS( point, CUR.zp0.n_points ) ||
+ BOUNDS( cvtEntry, CUR.cvtSize ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ /* UNDOCUMENTED! */
+ /* */
+ /* The behaviour of an MIAP instruction is quite */
+ /* different when used in the twilight zone. */
+ /* */
+ /* First, no control value cutin test is performed */
+ /* as it would fail anyway. Second, the original */
+ /* point, i.e. (org_x,org_y) of zp0.point, is set */
+ /* to the absolute, unrounded distance found in */
+ /* the CVT. */
+ /* */
+ /* This is used in the CVT programs of the Microsoft */
+ /* fonts Arial, Times, etc., in order to re-adjust */
+ /* some key font heights. It allows the use of the */
+ /* IP instruction in the twilight zone, which */
+ /* otherwise would be "illegal" according to the */
+ /* specs :) */
+ /* */
+ /* We implement it with a special sequence for the */
+ /* twilight zone. This is a bad hack, but it seems */
+ /* to work. */
+
+ distance = CUR_Func_read_cvt( cvtEntry );
+
+ if ( CUR.GS.gep0 == 0 ) /* If in twilight zone */
+ {
+ CUR.zp0.org[point].x = TT_MulDiv( CUR.GS.freeVector.x,
+ distance, 0x4000L );
+ CUR.zp0.org[point].y = TT_MulDiv( CUR.GS.freeVector.y,
+ distance, 0x4000L );
+ CUR.zp0.cur[point] = CUR.zp0.org[point];
+ }
+
+ org_dist = CUR_Func_project( CUR.zp0.cur + point, NULL_Vector );
+
+ if ( (CUR.opcode & 1) != 0 ) /* rounding and control cutin flag */
+ {
+ if ( ABS( distance - org_dist ) > CUR.GS.control_value_cutin )
+ distance = org_dist;
+
+ distance = CUR_Func_round( distance, CUR.metrics.compensations[0] );
+ }
+
+ CUR_Func_move( &CUR.zp0, point, distance - org_dist );
+
+ CUR.GS.rp0 = point;
+ CUR.GS.rp1 = point;
+ }
+
+
+/**********************************************/
+/* MDRP[abcde] : Move Direct Relative Point */
+/* CodeRange : $C0-$DF */
+/* Stack : uint32 --> */
+
+ static void Ins_MDRP( INS_ARG )
+ {
+ UShort point;
+ TT_F26Dot6 org_dist, distance;
+
+
+ point = (UShort)args[0];
+
+ if ( BOUNDS( point, CUR.zp1.n_points ) ||
+ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ /* XXX: Is there some undocumented feature while in the */
+ /* twilight zone? */
+
+ org_dist = CUR_Func_dualproj( CUR.zp1.org + point,
+ CUR.zp0.org + CUR.GS.rp0 );
+
+ /* single width cutin test */
+
+ if ( ABS( org_dist ) < CUR.GS.single_width_cutin )
+ {
+ if ( org_dist >= 0 )
+ org_dist = CUR.GS.single_width_value;
+ else
+ org_dist = -CUR.GS.single_width_value;
+ }
+
+ /* round flag */
+
+ if ( (CUR.opcode & 4) != 0 )
+ distance = CUR_Func_round( org_dist,
+ CUR.metrics.compensations[CUR.opcode & 3] );
+ else
+ distance = Round_None( EXEC_ARGS
+ org_dist,
+ CUR.metrics.compensations[CUR.opcode & 3] );
+
+ /* minimum distance flag */
+
+ if ( (CUR.opcode & 8) != 0 )
+ {
+ if ( org_dist >= 0 )
+ {
+ if ( distance < CUR.GS.minimum_distance )
+ distance = CUR.GS.minimum_distance;
+ }
+ else
+ {
+ if ( distance > -CUR.GS.minimum_distance )
+ distance = -CUR.GS.minimum_distance;
+ }
+ }
+
+ /* now move the point */
+
+ org_dist = CUR_Func_project( CUR.zp1.cur + point,
+ CUR.zp0.cur + CUR.GS.rp0 );
+
+ CUR_Func_move( &CUR.zp1, point, distance - org_dist );
+
+ CUR.GS.rp1 = CUR.GS.rp0;
+ CUR.GS.rp2 = point;
+
+ if ( (CUR.opcode & 16) != 0 )
+ CUR.GS.rp0 = point;
+ }
+
+
+/**********************************************/
+/* MIRP[abcde] : Move Indirect Relative Point */
+/* CodeRange : $E0-$FF */
+/* Stack : int32? uint32 --> */
+
+ static void Ins_MIRP( INS_ARG )
+ {
+ UShort point;
+ ULong cvtEntry;
+
+ TT_F26Dot6 cvt_dist,
+ distance,
+ cur_dist,
+ org_dist;
+
+
+ point = (UShort)args[0];
+ cvtEntry = (ULong)(args[1] + 1);
+
+ /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
+
+ if ( BOUNDS( point, CUR.zp1.n_points ) ||
+ BOUNDS( cvtEntry, CUR.cvtSize + 1 ) ||
+ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ if ( !cvtEntry )
+ cvt_dist = 0;
+ else
+ cvt_dist = CUR_Func_read_cvt( cvtEntry - 1 );
+
+ /* single width test */
+
+ if ( ABS( cvt_dist ) < CUR.GS.single_width_cutin )
+ {
+ if ( cvt_dist >= 0 )
+ cvt_dist = CUR.GS.single_width_value;
+ else
+ cvt_dist = -CUR.GS.single_width_value;
+ }
+
+ /* XXX : UNDOCUMENTED! -- twilight zone */
+
+ if ( CUR.GS.gep1 == 0 )
+ {
+ CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +
+ TT_MulDiv( cvt_dist,
+ CUR.GS.freeVector.x,
+ 0x4000 );
+
+ CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +
+ TT_MulDiv( cvt_dist,
+ CUR.GS.freeVector.y,
+ 0x4000 );
+
+ CUR.zp1.cur[point] = CUR.zp1.org[point];
+ }
+
+ org_dist = CUR_Func_dualproj( CUR.zp1.org + point,
+ CUR.zp0.org + CUR.GS.rp0 );
+
+ cur_dist = CUR_Func_project( CUR.zp1.cur + point,
+ CUR.zp0.cur + CUR.GS.rp0 );
+
+ /* auto-flip test */
+
+ if ( CUR.GS.auto_flip )
+ {
+ if ( (org_dist ^ cvt_dist) < 0 )
+ cvt_dist = -cvt_dist;
+ }
+
+ /* control value cutin and round */
+
+ if ( (CUR.opcode & 4) != 0 )
+ {
+ /* XXX: UNDOCUMENTED! Only perform cut-in test when both points */
+ /* refer to the same zone. */
+
+ if ( CUR.GS.gep0 == CUR.GS.gep1 )
+ if ( ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin )
+ cvt_dist = org_dist;
+
+ distance = CUR_Func_round( cvt_dist,
+ CUR.metrics.compensations[CUR.opcode & 3] );
+ }
+ else
+ distance = Round_None( EXEC_ARGS
+ cvt_dist,
+ CUR.metrics.compensations[CUR.opcode & 3] );
+
+ /* minimum distance test */
+
+ if ( (CUR.opcode & 8) != 0 )
+ {
+ if ( org_dist >= 0 )
+ {
+ if ( distance < CUR.GS.minimum_distance )
+ distance = CUR.GS.minimum_distance;
+ }
+ else
+ {
+ if ( distance > -CUR.GS.minimum_distance )
+ distance = -CUR.GS.minimum_distance;
+ }
+ }
+
+ CUR_Func_move( &CUR.zp1, point, distance - cur_dist );
+
+ CUR.GS.rp1 = CUR.GS.rp0;
+
+ if ( (CUR.opcode & 16) != 0 )
+ CUR.GS.rp0 = point;
+
+ /* UNDOCUMENTED! */
+
+ CUR.GS.rp2 = point;
+ }
+
+
+/**********************************************/
+/* ALIGNRP[] : ALIGN Relative Point */
+/* CodeRange : $3C */
+/* Stack : uint32 uint32... --> */
+
+ static void Ins_ALIGNRP( INS_ARG )
+ {
+ UShort point;
+ TT_F26Dot6 distance;
+
+
+ if ( CUR.top < CUR.GS.loop ||
+ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ while ( CUR.GS.loop > 0 )
+ {
+ CUR.args--;
+
+ point = (UShort)CUR.stack[CUR.args];
+
+ if ( BOUNDS( point, CUR.zp1.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ }
+ else
+ {
+ distance = CUR_Func_project( CUR.zp1.cur + point,
+ CUR.zp0.cur + CUR.GS.rp0 );
+
+ CUR_Func_move( &CUR.zp1, point, -distance );
+ }
+
+ CUR.GS.loop--;
+ }
+
+ CUR.GS.loop = 1;
+ CUR.new_top = CUR.args;
+ }
+
+
+/**********************************************/
+/* ISECT[] : moves point to InterSECTion */
+/* CodeRange : $0F */
+/* Stack : 5 * uint32 --> */
+
+ static void Ins_ISECT( INS_ARG )
+ {
+ UShort point,
+ a0, a1,
+ b0, b1;
+
+ TT_F26Dot6 discriminant;
+
+ TT_F26Dot6 dx, dy,
+ dax, day,
+ dbx, dby;
+
+ TT_F26Dot6 val;
+
+ TT_Vector R;
+
+
+ point = (UShort)args[0];
+
+ a0 = (UShort)args[1];
+ a1 = (UShort)args[2];
+ b0 = (UShort)args[3];
+ b1 = (UShort)args[4];
+
+ if ( BOUNDS( b0, CUR.zp0.n_points ) ||
+ BOUNDS( b1, CUR.zp0.n_points ) ||
+ BOUNDS( a0, CUR.zp1.n_points ) ||
+ BOUNDS( a1, CUR.zp1.n_points ) ||
+ BOUNDS( point, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ dbx = CUR.zp0.cur[b1].x - CUR.zp0.cur[b0].x;
+ dby = CUR.zp0.cur[b1].y - CUR.zp0.cur[b0].y;
+
+ dax = CUR.zp1.cur[a1].x - CUR.zp1.cur[a0].x;
+ day = CUR.zp1.cur[a1].y - CUR.zp1.cur[a0].y;
+
+ dx = CUR.zp0.cur[b0].x - CUR.zp1.cur[a0].x;
+ dy = CUR.zp0.cur[b0].y - CUR.zp1.cur[a0].y;
+
+ CUR.zp2.touch[point] |= TT_Flag_Touched_Both;
+
+ discriminant = TT_MulDiv( dax, -dby, 0x40L ) +
+ TT_MulDiv( day, dbx, 0x40L );
+
+ if ( ABS( discriminant ) >= 0x40 )
+ {
+ val = TT_MulDiv( dx, -dby, 0x40L ) + TT_MulDiv( dy, dbx, 0x40L );
+
+ R.x = TT_MulDiv( val, dax, discriminant );
+ R.y = TT_MulDiv( val, day, discriminant );
+
+ CUR.zp2.cur[point].x = CUR.zp1.cur[a0].x + R.x;
+ CUR.zp2.cur[point].y = CUR.zp1.cur[a0].y + R.y;
+ }
+ else
+ {
+ /* else, take the middle of the middles of A and B */
+
+ CUR.zp2.cur[point].x = ( CUR.zp1.cur[a0].x +
+ CUR.zp1.cur[a1].x +
+ CUR.zp0.cur[b0].x +
+ CUR.zp0.cur[b1].x ) / 4;
+ CUR.zp2.cur[point].y = ( CUR.zp1.cur[a0].y +
+ CUR.zp1.cur[a1].y +
+ CUR.zp0.cur[b0].y +
+ CUR.zp0.cur[b1].y ) / 4;
+ }
+ }
+
+
+/**********************************************/
+/* ALIGNPTS[] : ALIGN PoinTS */
+/* CodeRange : $27 */
+/* Stack : uint32 uint32 --> */
+
+ static void Ins_ALIGNPTS( INS_ARG )
+ {
+ UShort p1, p2;
+ TT_F26Dot6 distance;
+
+
+ p1 = (UShort)args[0];
+ p2 = (UShort)args[1];
+
+ if ( BOUNDS( args[0], CUR.zp1.n_points ) ||
+ BOUNDS( args[1], CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ distance = CUR_Func_project( CUR.zp0.cur + p2,
+ CUR.zp1.cur + p1 ) / 2;
+
+ CUR_Func_move( &CUR.zp1, p1, distance );
+ CUR_Func_move( &CUR.zp0, p2, -distance );
+ }
+
+
+/**********************************************/
+/* IP[] : Interpolate Point */
+/* CodeRange : $39 */
+/* Stack : uint32... --> */
+
+ static void Ins_IP( INS_ARG )
+ {
+ TT_F26Dot6 org_a, org_b, org_x,
+ cur_a, cur_b, cur_x,
+ distance;
+ UShort point;
+
+
+ if ( CUR.top < CUR.GS.loop )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ /* XXX: there are some glyphs in some braindead but popular */
+ /* fonts out there (e.g. [aeu]grave in monotype.ttf) */
+ /* calling IP[] with bad values of rp[12] */
+ /* do something sane when this odd thing happens */
+
+ if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) ||
+ BOUNDS( CUR.GS.rp2, CUR.zp1.n_points ) )
+ {
+ org_a = cur_a = 0;
+ org_b = cur_b = 0;
+ }
+ else
+ {
+ org_a = CUR_Func_dualproj( CUR.zp0.org + CUR.GS.rp1, NULL_Vector );
+ org_b = CUR_Func_dualproj( CUR.zp1.org + CUR.GS.rp2, NULL_Vector );
+
+ cur_a = CUR_Func_project( CUR.zp0.cur + CUR.GS.rp1, NULL_Vector );
+ cur_b = CUR_Func_project( CUR.zp1.cur + CUR.GS.rp2, NULL_Vector );
+ }
+
+ while ( CUR.GS.loop > 0 )
+ {
+ CUR.args--;
+
+ point = (UShort)CUR.stack[CUR.args];
+ if ( BOUNDS( point, CUR.zp2.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ }
+ else
+ {
+ org_x = CUR_Func_dualproj( CUR.zp2.org + point, NULL_Vector );
+ cur_x = CUR_Func_project ( CUR.zp2.cur + point, NULL_Vector );
+
+ if ( ( org_a <= org_b && org_x <= org_a ) ||
+ ( org_a > org_b && org_x >= org_a ) )
+
+ distance = ( cur_a - org_a ) + ( org_x - cur_x );
+
+ else if ( ( org_a <= org_b && org_x >= org_b ) ||
+ ( org_a > org_b && org_x < org_b ) )
+
+ distance = ( cur_b - org_b ) + ( org_x - cur_x );
+
+ else
+ /* note: it seems that rounding this value isn't a good */
+ /* idea (cf. width of capital 'S' in Times) */
+
+ distance = TT_MulDiv( cur_b - cur_a,
+ org_x - org_a,
+ org_b - org_a ) + ( cur_a - cur_x );
+
+ CUR_Func_move( &CUR.zp2, point, distance );
+ }
+
+ CUR.GS.loop--;
+ }
+
+ CUR.GS.loop = 1;
+ CUR.new_top = CUR.args;
+ }
+
+
+/**********************************************/
+/* UTP[a] : UnTouch Point */
+/* CodeRange : $29 */
+/* Stack : uint32 --> */
+
+ static void Ins_UTP( INS_ARG )
+ {
+ UShort point;
+ Byte mask;
+
+
+ point = (UShort)args[0];
+
+ if ( BOUNDS( point, CUR.zp0.n_points ) )
+ {
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
+ mask = 0xFF;
+
+ if ( CUR.GS.freeVector.x != 0 )
+ mask &= ~TT_Flag_Touched_X;
+
+ if ( CUR.GS.freeVector.y != 0 )
+ mask &= ~TT_Flag_Touched_Y;
+
+ CUR.zp0.touch[point] &= mask;
+ }
+
+
+ /* Local variables for Ins_IUP: */
+ struct LOC_Ins_IUP
+ {
+ TT_Vector* orgs; /* original and current coordinate */
+ TT_Vector* curs; /* arrays */
+ };
+
+
+ static void Shift( UShort p1,
+ UShort p2,
+ UShort p,
+ struct LOC_Ins_IUP* LINK )
+ {
+ UShort i;
+ TT_F26Dot6 x;
+
+
+ x = LINK->curs[p].x - LINK->orgs[p].x;
+
+ for ( i = p1; i < p; i++ )
+ LINK->curs[i].x += x;
+
+ for ( i = p + 1; i <= p2; i++ )
+ LINK->curs[i].x += x;
+ }
+
+
+ static void Interp( UShort p1,
+ UShort p2,
+ UShort ref1,
+ UShort ref2,
+ struct LOC_Ins_IUP* LINK )
+ {
+ UShort i;
+ TT_F26Dot6 x, x1, x2, d1, d2;
+
+
+ if ( p1 > p2 )
+ return;
+
+ x1 = LINK->orgs[ref1].x;
+ d1 = LINK->curs[ref1].x - LINK->orgs[ref1].x;
+ x2 = LINK->orgs[ref2].x;
+ d2 = LINK->curs[ref2].x - LINK->orgs[ref2].x;
+
+ if ( x1 == x2 )
+ {
+ for ( i = p1; i <= p2; i++ )
+ {
+ x = LINK->orgs[i].x;
+
+ if ( x <= x1 )
+ x += d1;
+ else
+ x += d2;
+
+ LINK->curs[i].x = x;
+ }
+ return;
+ }
+
+ if ( x1 < x2 )
+ {
+ for ( i = p1; i <= p2; i++ )
+ {
+ x = LINK->orgs[i].x;
+
+ if ( x <= x1 )
+ x += d1;
+ else
+ {
+ if ( x >= x2 )
+ x += d2;
+ else
+ x = LINK->curs[ref1].x +
+ TT_MulDiv( x - x1,
+ LINK->curs[ref2].x - LINK->curs[ref1].x,
+ x2 - x1 );
+ }
+ LINK->curs[i].x = x;
+ }
+ return;
+ }
+
+ /* x2 < x1 */
+
+ for ( i = p1; i <= p2; i++ )
+ {
+ x = LINK->orgs[i].x;
+ if ( x <= x2 )
+ x += d2;
+ else
+ {
+ if ( x >= x1 )
+ x += d1;
+ else
+ x = LINK->curs[ref1].x +
+ TT_MulDiv( x - x1,
+ LINK->curs[ref2].x - LINK->curs[ref1].x,
+ x2 - x1 );
+ }
+ LINK->curs[i].x = x;
+ }
+ }
+
+
+/**********************************************/
+/* IUP[a] : Interpolate Untouched Points */
+/* CodeRange : $30-$31 */
+/* Stack : --> */
+
+ static void Ins_IUP( INS_ARG )
+ {
+ struct LOC_Ins_IUP V;
+ Byte mask;
+
+ UShort first_point; /* first point of contour */
+ UShort end_point; /* end point (last+1) of contour */
+
+ UShort first_touched; /* first touched point in contour */
+ UShort cur_touched; /* current touched point in contour */
+
+ UShort point; /* current point */
+ Short contour; /* current contour */
+
+
+ if ( CUR.opcode & 1 )
+ {
+ mask = TT_Flag_Touched_X;
+ V.orgs = CUR.pts.org;
+ V.curs = CUR.pts.cur;
+ }
+ else
+ {
+ mask = TT_Flag_Touched_Y;
+ V.orgs = (TT_Vector*)( ((TT_F26Dot6*)CUR.pts.org) + 1 );
+ V.curs = (TT_Vector*)( ((TT_F26Dot6*)CUR.pts.cur) + 1 );
+ }
+
+ contour = 0;
+ point = 0;
+
+ do
+ {
+ end_point = CUR.pts.contours[contour];
+ first_point = point;
+
+ while ( point <= end_point && (CUR.pts.touch[point] & mask) == 0 )
+ point++;
+
+ if ( point <= end_point )
+ {
+ first_touched = point;
+ cur_touched = point;
+
+ point++;
+
+ while ( point <= end_point )
+ {
+ if ( (CUR.pts.touch[point] & mask) != 0 )
+ {
+ if ( point > 0 )
+ Interp( cur_touched + 1,
+ point - 1,
+ cur_touched,
+ point,
+ &V );
+ cur_touched = point;
+ }
+
+ point++;
+ }
+
+ if ( cur_touched == first_touched )
+ Shift( first_point, end_point, cur_touched, &V );
+ else
+ {
+ Interp( cur_touched + 1,
+ end_point,
+ cur_touched,
+ first_touched,
+ &V );
+
+ if ( first_touched > 0 )
+ Interp( first_point,
+ first_touched - 1,
+ cur_touched,
+ first_touched,
+ &V );
+ }
+ }
+ contour++;
+ } while ( contour < CUR.pts.n_contours );
+ }
+
+
+/**********************************************/
+/* DELTAPn[] : DELTA Exceptions P1, P2, P3 */
+/* CodeRange : $5D,$71,$72 */
+/* Stack : uint32 (2 * uint32)... --> */
+
+ static void Ins_DELTAP( INS_ARG )
+ {
+ ULong nump, k;
+ UShort A;
+ ULong C;
+ Long B;
+
+
+ nump = (ULong)args[0]; /* some points theoretically may occur more
+ than once, thus UShort isn't enough */
+
+ for ( k = 1; k <= nump; k++ )
+ {
+ if ( CUR.args < 2 )
+ {
+ CUR.error = TT_Err_Too_Few_Arguments;
+ return;
+ }
+
+ CUR.args -= 2;
+
+ A = (UShort)CUR.stack[CUR.args + 1];
+ B = CUR.stack[CUR.args];
+
+ /* XXX : because some popular fonts contain some invalid DeltaP */
+ /* instructions, we simply ignore them when the stacked */
+ /* point reference is off limit, rather than returning an */
+ /* error. As a delta instruction doesn't change a glyph */
+ /* in great ways, this shouldn't be a problem.. */
+
+ if ( !BOUNDS( A, CUR.zp0.n_points ) )
+ {
+ C = ((ULong)B & 0xF0) >> 4;
+
+ switch ( CUR.opcode )
+ {
+ case 0x5d:
+ break;
+
+ case 0x71:
+ C += 16;
+ break;
+
+ case 0x72:
+ C += 32;
+ break;
+ }
+
+ C += CUR.GS.delta_base;
+
+ if ( CURRENT_Ppem() == (Long)C )
+ {
+ B = ((ULong)B & 0xF) - 8;
+ if ( B >= 0 )
+ B++;
+ B = B * 64L / (1L << CUR.GS.delta_shift);
+
+ CUR_Func_move( &CUR.zp0, A, B );
+ }
+ }
+ else
+ if ( CUR.pedantic_hinting )
+ CUR.error = TT_Err_Invalid_Reference;
+ }
+
+ CUR.new_top = CUR.args;
+ }
+
+
+/**********************************************/
+/* DELTACn[] : DELTA Exceptions C1, C2, C3 */
+/* CodeRange : $73,$74,$75 */
+/* Stack : uint32 (2 * uint32)... --> */
+
+ static void Ins_DELTAC( INS_ARG )
+ {
+ ULong nump, k;
+ ULong A, C;
+ Long B;
+
+
+ nump = (ULong)args[0];
+
+ for ( k = 1; k <= nump; k++ )
+ {
+ if ( CUR.args < 2 )
+ {
+ CUR.error = TT_Err_Too_Few_Arguments;
+ return;
+ }
+
+ CUR.args -= 2;
+
+ A = (ULong)CUR.stack[CUR.args + 1];
+ B = CUR.stack[CUR.args];
+
+ if ( BOUNDS( A, CUR.cvtSize ) )
+ {
+ if ( CUR.pedantic_hinting )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+ }
+ else
+ {
+ C = ((ULong)B & 0xF0) >> 4;
+
+ switch ( CUR.opcode )
+ {
+ case 0x73:
+ break;
+
+ case 0x74:
+ C += 16;
+ break;
+
+ case 0x75:
+ C += 32;
+ break;
+ }
+
+ C += CUR.GS.delta_base;
+
+ if ( CURRENT_Ppem() == (Long)C )
+ {
+ B = ((ULong)B & 0xF) - 8;
+ if ( B >= 0 )
+ B++;
+ B = B * 64L / (1L << CUR.GS.delta_shift);
+
+ CUR_Func_move_cvt( A, B );
+ }
+ }
+ }
+
+ CUR.new_top = CUR.args;
+ }
+
+
+
+/****************************************************************/
+/* */
+/* MISC. INSTRUCTIONS */
+/* */
+/****************************************************************/
+
+
+/**********************************************/
+/* GETINFO[] : GET INFOrmation */
+/* CodeRange : $88 */
+/* Stack : uint32 --> uint32 */
+
+/* XXX According to Apple specs, bits 1 & 2 of the argument ought to be */
+/* consulted before rotated / stretched info is returned */
+
+ static void Ins_GETINFO( INS_ARG )
+ {
+ Long K;
+
+
+ K = 0;
+
+ /* We return then Windows 3.1 version number */
+ /* for the font scaler */
+ if ( (args[0] & 1) != 0 )
+ K = 3;
+
+ /* Has the glyph been rotated ? */
+ if ( CUR.metrics.rotated )
+ K |= 0x80;
+
+ /* Has the glyph been stretched ? */
+ if ( CUR.metrics.stretched )
+ K |= 0x100;
+
+ args[0] = K;
+ }
+
+
+ static void Ins_UNKNOWN( INS_ARG )
+ {
+ /* look up the current instruction in our table */
+ PDefRecord def, limit;
+
+ def = CUR.IDefs;
+ limit = def + CUR.numIDefs;
+ for ( ; def < limit; def++ )
+ {
+ if ( def->Opc == CUR.opcode && def->Active )
+ {
+ PCallRecord pCrec;
+
+ /* implement instruction as a function call */
+
+ /* check call stack */
+ if ( CUR.callTop >= CUR.callSize )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ return;
+ }
+
+ pCrec = CUR.callStack + CUR.callTop;
+
+ pCrec->Caller_Range = CUR.curRange;
+ pCrec->Caller_IP = CUR.IP + 1;
+ pCrec->Cur_Count = 1;
+ pCrec->Cur_Restart = def->Start;
+
+ CUR.callTop++;
+
+ INS_Goto_CodeRange( def->Range,
+ def->Start );
+
+ CUR.step_ins = FALSE;
+ return;
+ }
+ }
+
+ CUR.error = TT_Err_Invalid_Opcode;
+ }
+
+
+#ifndef TT_CONFIG_OPTION_INTERPRETER_SWITCH
+ static TInstruction_Function Instruct_Dispatch[256] =
+ {
+ /* Opcodes are gathered in groups of 16. */
+ /* Please keep the spaces as they are. */
+
+ /* SVTCA y */ Ins_SVTCA,
+ /* SVTCA x */ Ins_SVTCA,
+ /* SPvTCA y */ Ins_SPVTCA,
+ /* SPvTCA x */ Ins_SPVTCA,
+ /* SFvTCA y */ Ins_SFVTCA,
+ /* SFvTCA x */ Ins_SFVTCA,
+ /* SPvTL // */ Ins_SPVTL,
+ /* SPvTL + */ Ins_SPVTL,
+ /* SFvTL // */ Ins_SFVTL,
+ /* SFvTL + */ Ins_SFVTL,
+ /* SPvFS */ Ins_SPVFS,
+ /* SFvFS */ Ins_SFVFS,
+ /* GPV */ Ins_GPV,
+ /* GFV */ Ins_GFV,
+ /* SFvTPv */ Ins_SFVTPV,
+ /* ISECT */ Ins_ISECT,
+
+ /* SRP0 */ Ins_SRP0,
+ /* SRP1 */ Ins_SRP1,
+ /* SRP2 */ Ins_SRP2,
+ /* SZP0 */ Ins_SZP0,
+ /* SZP1 */ Ins_SZP1,
+ /* SZP2 */ Ins_SZP2,
+ /* SZPS */ Ins_SZPS,
+ /* SLOOP */ Ins_SLOOP,
+ /* RTG */ Ins_RTG,
+ /* RTHG */ Ins_RTHG,
+ /* SMD */ Ins_SMD,
+ /* ELSE */ Ins_ELSE,
+ /* JMPR */ Ins_JMPR,
+ /* SCvTCi */ Ins_SCVTCI,
+ /* SSwCi */ Ins_SSWCI,
+ /* SSW */ Ins_SSW,
+
+ /* DUP */ Ins_DUP,
+ /* POP */ Ins_POP,
+ /* CLEAR */ Ins_CLEAR,
+ /* SWAP */ Ins_SWAP,
+ /* DEPTH */ Ins_DEPTH,
+ /* CINDEX */ Ins_CINDEX,
+ /* MINDEX */ Ins_MINDEX,
+ /* AlignPTS */ Ins_ALIGNPTS,
+ /* INS_$28 */ Ins_UNKNOWN,
+ /* UTP */ Ins_UTP,
+ /* LOOPCALL */ Ins_LOOPCALL,
+ /* CALL */ Ins_CALL,
+ /* FDEF */ Ins_FDEF,
+ /* ENDF */ Ins_ENDF,
+ /* MDAP[0] */ Ins_MDAP,
+ /* MDAP[1] */ Ins_MDAP,
+
+ /* IUP[0] */ Ins_IUP,
+ /* IUP[1] */ Ins_IUP,
+ /* SHP[0] */ Ins_SHP,
+ /* SHP[1] */ Ins_SHP,
+ /* SHC[0] */ Ins_SHC,
+ /* SHC[1] */ Ins_SHC,
+ /* SHZ[0] */ Ins_SHZ,
+ /* SHZ[1] */ Ins_SHZ,
+ /* SHPIX */ Ins_SHPIX,
+ /* IP */ Ins_IP,
+ /* MSIRP[0] */ Ins_MSIRP,
+ /* MSIRP[1] */ Ins_MSIRP,
+ /* AlignRP */ Ins_ALIGNRP,
+ /* RTDG */ Ins_RTDG,
+ /* MIAP[0] */ Ins_MIAP,
+ /* MIAP[1] */ Ins_MIAP,
+
+ /* NPushB */ Ins_NPUSHB,
+ /* NPushW */ Ins_NPUSHW,
+ /* WS */ Ins_WS,
+ /* RS */ Ins_RS,
+ /* WCvtP */ Ins_WCVTP,
+ /* RCvt */ Ins_RCVT,
+ /* GC[0] */ Ins_GC,
+ /* GC[1] */ Ins_GC,
+ /* SCFS */ Ins_SCFS,
+ /* MD[0] */ Ins_MD,
+ /* MD[1] */ Ins_MD,
+ /* MPPEM */ Ins_MPPEM,
+ /* MPS */ Ins_MPS,
+ /* FlipON */ Ins_FLIPON,
+ /* FlipOFF */ Ins_FLIPOFF,
+ /* DEBUG */ Ins_DEBUG,
+
+ /* LT */ Ins_LT,
+ /* LTEQ */ Ins_LTEQ,
+ /* GT */ Ins_GT,
+ /* GTEQ */ Ins_GTEQ,
+ /* EQ */ Ins_EQ,
+ /* NEQ */ Ins_NEQ,
+ /* ODD */ Ins_ODD,
+ /* EVEN */ Ins_EVEN,
+ /* IF */ Ins_IF,
+ /* EIF */ Ins_EIF,
+ /* AND */ Ins_AND,
+ /* OR */ Ins_OR,
+ /* NOT */ Ins_NOT,
+ /* DeltaP1 */ Ins_DELTAP,
+ /* SDB */ Ins_SDB,
+ /* SDS */ Ins_SDS,
+
+ /* ADD */ Ins_ADD,
+ /* SUB */ Ins_SUB,
+ /* DIV */ Ins_DIV,
+ /* MUL */ Ins_MUL,
+ /* ABS */ Ins_ABS,
+ /* NEG */ Ins_NEG,
+ /* FLOOR */ Ins_FLOOR,
+ /* CEILING */ Ins_CEILING,
+ /* ROUND[0] */ Ins_ROUND,
+ /* ROUND[1] */ Ins_ROUND,
+ /* ROUND[2] */ Ins_ROUND,
+ /* ROUND[3] */ Ins_ROUND,
+ /* NROUND[0] */ Ins_NROUND,
+ /* NROUND[1] */ Ins_NROUND,
+ /* NROUND[2] */ Ins_NROUND,
+ /* NROUND[3] */ Ins_NROUND,
+
+ /* WCvtF */ Ins_WCVTF,
+ /* DeltaP2 */ Ins_DELTAP,
+ /* DeltaP3 */ Ins_DELTAP,
+ /* DeltaCn[0] */ Ins_DELTAC,
+ /* DeltaCn[1] */ Ins_DELTAC,
+ /* DeltaCn[2] */ Ins_DELTAC,
+ /* SROUND */ Ins_SROUND,
+ /* S45Round */ Ins_S45ROUND,
+ /* JROT */ Ins_JROT,
+ /* JROF */ Ins_JROF,
+ /* ROFF */ Ins_ROFF,
+ /* INS_$7B */ Ins_UNKNOWN,
+ /* RUTG */ Ins_RUTG,
+ /* RDTG */ Ins_RDTG,
+ /* SANGW */ Ins_SANGW,
+ /* AA */ Ins_AA,
+
+ /* FlipPT */ Ins_FLIPPT,
+ /* FlipRgON */ Ins_FLIPRGON,
+ /* FlipRgOFF */ Ins_FLIPRGOFF,
+ /* INS_$83 */ Ins_UNKNOWN,
+ /* INS_$84 */ Ins_UNKNOWN,
+ /* ScanCTRL */ Ins_SCANCTRL,
+ /* SDPVTL[0] */ Ins_SDPVTL,
+ /* SDPVTL[1] */ Ins_SDPVTL,
+ /* GetINFO */ Ins_GETINFO,
+ /* IDEF */ Ins_IDEF,
+ /* ROLL */ Ins_ROLL,
+ /* MAX */ Ins_MAX,
+ /* MIN */ Ins_MIN,
+ /* ScanTYPE */ Ins_SCANTYPE,
+ /* InstCTRL */ Ins_INSTCTRL,
+ /* INS_$8F */ Ins_UNKNOWN,
+
+ /* INS_$90 */ Ins_UNKNOWN,
+ /* INS_$91 */ Ins_UNKNOWN,
+ /* INS_$92 */ Ins_UNKNOWN,
+ /* INS_$93 */ Ins_UNKNOWN,
+ /* INS_$94 */ Ins_UNKNOWN,
+ /* INS_$95 */ Ins_UNKNOWN,
+ /* INS_$96 */ Ins_UNKNOWN,
+ /* INS_$97 */ Ins_UNKNOWN,
+ /* INS_$98 */ Ins_UNKNOWN,
+ /* INS_$99 */ Ins_UNKNOWN,
+ /* INS_$9A */ Ins_UNKNOWN,
+ /* INS_$9B */ Ins_UNKNOWN,
+ /* INS_$9C */ Ins_UNKNOWN,
+ /* INS_$9D */ Ins_UNKNOWN,
+ /* INS_$9E */ Ins_UNKNOWN,
+ /* INS_$9F */ Ins_UNKNOWN,
+
+ /* INS_$A0 */ Ins_UNKNOWN,
+ /* INS_$A1 */ Ins_UNKNOWN,
+ /* INS_$A2 */ Ins_UNKNOWN,
+ /* INS_$A3 */ Ins_UNKNOWN,
+ /* INS_$A4 */ Ins_UNKNOWN,
+ /* INS_$A5 */ Ins_UNKNOWN,
+ /* INS_$A6 */ Ins_UNKNOWN,
+ /* INS_$A7 */ Ins_UNKNOWN,
+ /* INS_$A8 */ Ins_UNKNOWN,
+ /* INS_$A9 */ Ins_UNKNOWN,
+ /* INS_$AA */ Ins_UNKNOWN,
+ /* INS_$AB */ Ins_UNKNOWN,
+ /* INS_$AC */ Ins_UNKNOWN,
+ /* INS_$AD */ Ins_UNKNOWN,
+ /* INS_$AE */ Ins_UNKNOWN,
+ /* INS_$AF */ Ins_UNKNOWN,
+
+ /* PushB[0] */ Ins_PUSHB,
+ /* PushB[1] */ Ins_PUSHB,
+ /* PushB[2] */ Ins_PUSHB,
+ /* PushB[3] */ Ins_PUSHB,
+ /* PushB[4] */ Ins_PUSHB,
+ /* PushB[5] */ Ins_PUSHB,
+ /* PushB[6] */ Ins_PUSHB,
+ /* PushB[7] */ Ins_PUSHB,
+ /* PushW[0] */ Ins_PUSHW,
+ /* PushW[1] */ Ins_PUSHW,
+ /* PushW[2] */ Ins_PUSHW,
+ /* PushW[3] */ Ins_PUSHW,
+ /* PushW[4] */ Ins_PUSHW,
+ /* PushW[5] */ Ins_PUSHW,
+ /* PushW[6] */ Ins_PUSHW,
+ /* PushW[7] */ Ins_PUSHW,
+
+ /* MDRP[00] */ Ins_MDRP,
+ /* MDRP[01] */ Ins_MDRP,
+ /* MDRP[02] */ Ins_MDRP,
+ /* MDRP[03] */ Ins_MDRP,
+ /* MDRP[04] */ Ins_MDRP,
+ /* MDRP[05] */ Ins_MDRP,
+ /* MDRP[06] */ Ins_MDRP,
+ /* MDRP[07] */ Ins_MDRP,
+ /* MDRP[08] */ Ins_MDRP,
+ /* MDRP[09] */ Ins_MDRP,
+ /* MDRP[10] */ Ins_MDRP,
+ /* MDRP[11] */ Ins_MDRP,
+ /* MDRP[12] */ Ins_MDRP,
+ /* MDRP[13] */ Ins_MDRP,
+ /* MDRP[14] */ Ins_MDRP,
+ /* MDRP[15] */ Ins_MDRP,
+
+ /* MDRP[16] */ Ins_MDRP,
+ /* MDRP[17] */ Ins_MDRP,
+ /* MDRP[18] */ Ins_MDRP,
+ /* MDRP[19] */ Ins_MDRP,
+ /* MDRP[20] */ Ins_MDRP,
+ /* MDRP[21] */ Ins_MDRP,
+ /* MDRP[22] */ Ins_MDRP,
+ /* MDRP[23] */ Ins_MDRP,
+ /* MDRP[24] */ Ins_MDRP,
+ /* MDRP[25] */ Ins_MDRP,
+ /* MDRP[26] */ Ins_MDRP,
+ /* MDRP[27] */ Ins_MDRP,
+ /* MDRP[28] */ Ins_MDRP,
+ /* MDRP[29] */ Ins_MDRP,
+ /* MDRP[30] */ Ins_MDRP,
+ /* MDRP[31] */ Ins_MDRP,
+
+ /* MIRP[00] */ Ins_MIRP,
+ /* MIRP[01] */ Ins_MIRP,
+ /* MIRP[02] */ Ins_MIRP,
+ /* MIRP[03] */ Ins_MIRP,
+ /* MIRP[04] */ Ins_MIRP,
+ /* MIRP[05] */ Ins_MIRP,
+ /* MIRP[06] */ Ins_MIRP,
+ /* MIRP[07] */ Ins_MIRP,
+ /* MIRP[08] */ Ins_MIRP,
+ /* MIRP[09] */ Ins_MIRP,
+ /* MIRP[10] */ Ins_MIRP,
+ /* MIRP[11] */ Ins_MIRP,
+ /* MIRP[12] */ Ins_MIRP,
+ /* MIRP[13] */ Ins_MIRP,
+ /* MIRP[14] */ Ins_MIRP,
+ /* MIRP[15] */ Ins_MIRP,
+
+ /* MIRP[16] */ Ins_MIRP,
+ /* MIRP[17] */ Ins_MIRP,
+ /* MIRP[18] */ Ins_MIRP,
+ /* MIRP[19] */ Ins_MIRP,
+ /* MIRP[20] */ Ins_MIRP,
+ /* MIRP[21] */ Ins_MIRP,
+ /* MIRP[22] */ Ins_MIRP,
+ /* MIRP[23] */ Ins_MIRP,
+ /* MIRP[24] */ Ins_MIRP,
+ /* MIRP[25] */ Ins_MIRP,
+ /* MIRP[26] */ Ins_MIRP,
+ /* MIRP[27] */ Ins_MIRP,
+ /* MIRP[28] */ Ins_MIRP,
+ /* MIRP[29] */ Ins_MIRP,
+ /* MIRP[30] */ Ins_MIRP,
+ /* MIRP[31] */ Ins_MIRP
+ };
+#endif
+
+
+/****************************************************************/
+/* */
+/* RUN */
+/* */
+/* This function executes a run of opcodes. It will exit */
+/* in the following cases: */
+/* */
+/* - Errors (in which case it returns FALSE) */
+/* */
+/* - Reaching the end of the main code range (returns TRUE). */
+/* Reaching the end of a code range within a function */
+/* call is an error. */
+/* */
+/* - After executing one single opcode, if the flag */
+/* 'Instruction_Trap' is set to TRUE (returns TRUE). */
+/* */
+/* On exit whith TRUE, test IP < CodeSize to know wether it */
+/* comes from a instruction trap or a normal termination. */
+/* */
+/* */
+/* Note: The documented DEBUG opcode pops a value from */
+/* the stack. This behaviour is unsupported, here */
+/* a DEBUG opcode is always an error. */
+/* */
+/* */
+/* THIS IS THE INTERPRETER'S MAIN LOOP */
+/* */
+/* Instructions appear in the specs' order. */
+/* */
+/****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+#ifndef DEBUG_INTERPRETER
+ RunIns( PExecution_Context exc )
+#else
+ RunIns2( PExecution_Context exc )
+#endif
+ {
+ UShort A;
+ PDefRecord WITH;
+ PCallRecord WITH1;
+
+ Long ins_counter = 0; /* executed instructions counter */
+
+#ifdef TT_CONFIG_OPTION_STATIC_INTERPRETER
+ cur = *exc;
+#endif
+
+ /* set CVT functions */
+ CUR.metrics.ratio = 0;
+ if ( CUR.metrics.x_ppem != CUR.metrics.y_ppem )
+ {
+ /* non-square pixels, use the stretched routines */
+ CUR.func_read_cvt = Read_CVT_Stretched;
+ CUR.func_write_cvt = Write_CVT_Stretched;
+ CUR.func_move_cvt = Move_CVT_Stretched;
+ }
+ else
+ {
+ /* square pixels, use normal routines */
+ CUR.func_read_cvt = Read_CVT;
+ CUR.func_write_cvt = Write_CVT;
+ CUR.func_move_cvt = Move_CVT;
+ }
+
+ COMPUTE_Funcs();
+ Compute_Round( EXEC_ARGS (Byte)( CUR.GS.round_state ) );
+
+ do
+ {
+ if ( CALC_Length() != SUCCESS )
+ {
+ CUR.error = TT_Err_Code_Overflow;
+ goto LErrorLabel_;
+ }
+
+ /* First, let's check for empty stack and overflow */
+
+ CUR.args = CUR.top - (Pop_Push_Count[CUR.opcode] >> 4);
+
+ /* `args' is the top of the stack once arguments have been popped. */
+ /* One can also interpret it as the index of the last argument. */
+
+ if ( CUR.args < 0 )
+ {
+ CUR.error = TT_Err_Too_Few_Arguments;
+ goto LErrorLabel_;
+ }
+
+ CUR.new_top = CUR.args + (Pop_Push_Count[CUR.opcode] & 15);
+
+ /* `new_top' is the new top of the stack, after the instruction's */
+ /* execution. `top' will be set to `new_top' after the 'switch' */
+ /* statement. */
+
+ if ( CUR.new_top > CUR.stackSize )
+ {
+ CUR.error = TT_Err_Stack_Overflow;
+ goto LErrorLabel_;
+ }
+
+ CUR.step_ins = TRUE;
+ CUR.error = TT_Err_Ok;
+
+#ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH
+ {
+ PStorage args = CUR.stack + CUR.args;
+ Byte opcode = CUR.opcode;
+
+
+#undef ARRAY_BOUND_ERROR
+#define ARRAY_BOUND_ERROR goto Set_Invalid_Ref
+
+ switch ( opcode )
+ {
+ case 0x00: /* SVTCA y */
+ case 0x01: /* SVTCA x */
+ case 0x02: /* SPvTCA y */
+ case 0x03: /* SPvTCA x */
+ case 0x04: /* SFvTCA y */
+ case 0x05: /* SFvTCA x */
+ {
+ Short AA, BB;
+
+
+ AA = (Short)(opcode & 1) << 14;
+ BB = AA ^ (Short)0x4000;
+
+ if ( opcode < 4 )
+ {
+ CUR.GS.projVector.x = AA;
+ CUR.GS.projVector.y = BB;
+
+ CUR.GS.dualVector.x = AA;
+ CUR.GS.dualVector.y = BB;
+ }
+
+ if ( (opcode & 2) == 0 )
+ {
+ CUR.GS.freeVector.x = AA;
+ CUR.GS.freeVector.y = BB;
+ }
+
+ COMPUTE_Funcs();
+ }
+ break;
+
+ case 0x06: /* SPvTL // */
+ case 0x07: /* SPvTL + */
+ DO_SPVTL
+ break;
+
+ case 0x08: /* SFvTL // */
+ case 0x09: /* SFvTL + */
+ DO_SFVTL
+ break;
+
+ case 0x0A: /* SPvFS */
+ DO_SPVFS
+ break;
+
+ case 0x0B: /* SFvFS */
+ DO_SFVFS
+ break;
+
+ case 0x0C: /* GPV */
+ DO_GPV
+ break;
+
+ case 0x0D: /* GFV */
+ DO_GFV
+ break;
+
+ case 0x0E: /* SFvTPv */
+ DO_SFVTPV
+ break;
+
+ case 0x0F: /* ISECT */
+ Ins_ISECT( EXEC_ARGS args );
+ break;
+
+ case 0x10: /* SRP0 */
+ DO_SRP0
+ break;
+
+ case 0x11: /* SRP1 */
+ DO_SRP1
+ break;
+
+ case 0x12: /* SRP2 */
+ DO_SRP2
+ break;
+
+ case 0x13: /* SZP0 */
+ Ins_SZP0( EXEC_ARGS args );
+ break;
+
+ case 0x14: /* SZP1 */
+ Ins_SZP1( EXEC_ARGS args );
+ break;
+
+ case 0x15: /* SZP2 */
+ Ins_SZP2( EXEC_ARGS args );
+ break;
+
+ case 0x16: /* SZPS */
+ Ins_SZPS( EXEC_ARGS args );
+ break;
+
+ case 0x17: /* SLOOP */
+ DO_SLOOP
+ break;
+
+ case 0x18: /* RTG */
+ DO_RTG
+ break;
+
+ case 0x19: /* RTHG */
+ DO_RTHG
+ break;
+
+ case 0x1A: /* SMD */
+ DO_SMD
+ break;
+
+ case 0x1B: /* ELSE */
+ Ins_ELSE( EXEC_ARGS args );
+ break;
+
+ case 0x1C: /* JMPR */
+ DO_JMPR
+ break;
+
+ case 0x1D: /* SCVTCI */
+ DO_SCVTCI
+ break;
+
+ case 0x1E: /* SSWCI */
+ DO_SSWCI
+ break;
+
+ case 0x1F: /* SSW */
+ DO_SSW
+ break;
+
+ case 0x20: /* DUP */
+ DO_DUP
+ break;
+
+ case 0x21: /* POP */
+ /* nothing :-) !! */
+ break;
+
+ case 0x22: /* CLEAR */
+ DO_CLEAR
+ break;
+
+ case 0x23: /* SWAP */
+ DO_SWAP
+ break;
+
+ case 0x24: /* DEPTH */
+ DO_DEPTH
+ break;
+
+ case 0x25: /* CINDEX */
+ DO_CINDEX
+ break;
+
+ case 0x26: /* MINDEX */
+ Ins_MINDEX( EXEC_ARGS args );
+ break;
+
+ case 0x27: /* ALIGNPTS */
+ Ins_ALIGNPTS( EXEC_ARGS args );
+ break;
+
+ case 0x28: /* ???? */
+ Ins_UNKNOWN( EXEC_ARGS args );
+ break;
+
+ case 0x29: /* UTP */
+ Ins_UTP( EXEC_ARGS args );
+ break;
+
+ case 0x2A: /* LOOPCALL */
+ Ins_LOOPCALL( EXEC_ARGS args );
+ break;
+
+ case 0x2B: /* CALL */
+ Ins_CALL( EXEC_ARGS args );
+ break;
+
+ case 0x2C: /* FDEF */
+ Ins_FDEF( EXEC_ARGS args );
+ break;
+
+ case 0x2D: /* ENDF */
+ Ins_ENDF( EXEC_ARGS args );
+ break;
+
+ case 0x2E: /* MDAP */
+ case 0x2F: /* MDAP */
+ Ins_MDAP( EXEC_ARGS args );
+ break;
+
+
+ case 0x30: /* IUP */
+ case 0x31: /* IUP */
+ Ins_IUP( EXEC_ARGS args );
+ break;
+
+ case 0x32: /* SHP */
+ case 0x33: /* SHP */
+ Ins_SHP( EXEC_ARGS args );
+ break;
+
+ case 0x34: /* SHC */
+ case 0x35: /* SHC */
+ Ins_SHC( EXEC_ARGS args );
+ break;
+
+ case 0x36: /* SHZ */
+ case 0x37: /* SHZ */
+ Ins_SHZ( EXEC_ARGS args );
+ break;
+
+ case 0x38: /* SHPIX */
+ Ins_SHPIX( EXEC_ARGS args );
+ break;
+
+ case 0x39: /* IP */
+ Ins_IP( EXEC_ARGS args );
+ break;
+
+ case 0x3A: /* MSIRP */
+ case 0x3B: /* MSIRP */
+ Ins_MSIRP( EXEC_ARGS args );
+ break;
+
+ case 0x3C: /* AlignRP */
+ Ins_ALIGNRP( EXEC_ARGS args );
+ break;
+
+ case 0x3D: /* RTDG */
+ DO_RTDG
+ break;
+
+ case 0x3E: /* MIAP */
+ case 0x3F: /* MIAP */
+ Ins_MIAP( EXEC_ARGS args );
+ break;
+
+ case 0x40: /* NPUSHB */
+ Ins_NPUSHB( EXEC_ARGS args );
+ break;
+
+ case 0x41: /* NPUSHW */
+ Ins_NPUSHW( EXEC_ARGS args );
+ break;
+
+ case 0x42: /* WS */
+ DO_WS
+ break;
+
+ Set_Invalid_Ref:
+ CUR.error = TT_Err_Invalid_Reference;
+ break;
+
+ case 0x43: /* RS */
+ DO_RS
+ break;
+
+ case 0x44: /* WCVTP */
+ DO_WCVTP
+ break;
+
+ case 0x45: /* RCVT */
+ DO_RCVT
+ break;
+
+ case 0x46: /* GC */
+ case 0x47: /* GC */
+ Ins_GC( EXEC_ARGS args );
+ break;
+
+ case 0x48: /* SCFS */
+ Ins_SCFS( EXEC_ARGS args );
+ break;
+
+ case 0x49: /* MD */
+ case 0x4A: /* MD */
+ Ins_MD( EXEC_ARGS args );
+ break;
+
+ case 0x4B: /* MPPEM */
+ DO_MPPEM
+ break;
+
+ case 0x4C: /* MPS */
+ DO_MPS
+ break;
+
+ case 0x4D: /* FLIPON */
+ DO_FLIPON
+ break;
+
+ case 0x4E: /* FLIPOFF */
+ DO_FLIPOFF
+ break;
+
+ case 0x4F: /* DEBUG */
+ DO_DEBUG
+ break;
+
+ case 0x50: /* LT */
+ DO_LT
+ break;
+
+ case 0x51: /* LTEQ */
+ DO_LTEQ
+ break;
+
+ case 0x52: /* GT */
+ DO_GT
+ break;
+
+ case 0x53: /* GTEQ */
+ DO_GTEQ
+ break;
+
+ case 0x54: /* EQ */
+ DO_EQ
+ break;
+
+ case 0x55: /* NEQ */
+ DO_NEQ
+ break;
+
+ case 0x56: /* ODD */
+ DO_ODD
+ break;
+
+ case 0x57: /* EVEN */
+ DO_EVEN
+ break;
+
+ case 0x58: /* IF */
+ Ins_IF( EXEC_ARGS args );
+ break;
+
+ case 0x59: /* EIF */
+ /* do nothing */
+ break;
+
+ case 0x5A: /* AND */
+ DO_AND
+ break;
+
+ case 0x5B: /* OR */
+ DO_OR
+ break;
+
+ case 0x5C: /* NOT */
+ DO_NOT
+ break;
+
+ case 0x5D: /* DELTAP1 */
+ Ins_DELTAP( EXEC_ARGS args );
+ break;
+
+ case 0x5E: /* SDB */
+ DO_SDB
+ break;
+
+ case 0x5F: /* SDS */
+ DO_SDS
+ break;
+
+ case 0x60: /* ADD */
+ DO_ADD
+ break;
+
+ case 0x61: /* SUB */
+ DO_SUB
+ break;
+
+ case 0x62: /* DIV */
+ DO_DIV
+ break;
+
+ case 0x63: /* MUL */
+ DO_MUL
+ break;
+
+ case 0x64: /* ABS */
+ DO_ABS
+ break;
+
+ case 0x65: /* NEG */
+ DO_NEG
+ break;
+
+ case 0x66: /* FLOOR */
+ DO_FLOOR
+ break;
+
+ case 0x67: /* CEILING */
+ DO_CEILING
+ break;
+
+ case 0x68: /* ROUND */
+ case 0x69: /* ROUND */
+ case 0x6A: /* ROUND */
+ case 0x6B: /* ROUND */
+ DO_ROUND
+ break;
+
+ case 0x6C: /* NROUND */
+ case 0x6D: /* NROUND */
+ case 0x6E: /* NRRUND */
+ case 0x6F: /* NROUND */
+ DO_NROUND
+ break;
+
+ case 0x70: /* WCVTF */
+ DO_WCVTF
+ break;
+
+ case 0x71: /* DELTAP2 */
+ case 0x72: /* DELTAP3 */
+ Ins_DELTAP( EXEC_ARGS args );
+ break;
+
+ case 0x73: /* DELTAC0 */
+ case 0x74: /* DELTAC1 */
+ case 0x75: /* DELTAC2 */
+ Ins_DELTAC( EXEC_ARGS args );
+ break;
+
+ case 0x76: /* SROUND */
+ DO_SROUND
+ break;
+
+ case 0x77: /* S45Round */
+ DO_S45ROUND
+ break;
+
+ case 0x78: /* JROT */
+ DO_JROT
+ break;
+
+ case 0x79: /* JROF */
+ DO_JROF
+ break;
+
+ case 0x7A: /* ROFF */
+ DO_ROFF
+ break;
+
+ case 0x7B: /* ???? */
+ Ins_UNKNOWN( EXEC_ARGS args );
+ break;
+
+ case 0x7C: /* RUTG */
+ DO_RUTG
+ break;
+
+ case 0x7D: /* RDTG */
+ DO_RDTG
+ break;
+
+ case 0x7E: /* SANGW */
+ case 0x7F: /* AA */
+ /* nothing - obsolete */
+ break;
+
+ case 0x80: /* FLIPPT */
+ Ins_FLIPPT( EXEC_ARGS args );
+ break;
+
+ case 0x81: /* FLIPRGON */
+ Ins_FLIPRGON( EXEC_ARGS args );
+ break;
+
+ case 0x82: /* FLIPRGOFF */
+ Ins_FLIPRGOFF( EXEC_ARGS args );
+ break;
+
+ case 0x83: /* UNKNOWN */
+ case 0x84: /* UNKNOWN */
+ Ins_UNKNOWN( EXEC_ARGS args );
+ break;
+
+ case 0x85: /* SCANCTRL */
+ Ins_SCANCTRL( EXEC_ARGS args );
+ break;
+
+ case 0x86: /* SDPVTL */
+ case 0x87: /* SDPVTL */
+ Ins_SDPVTL( EXEC_ARGS args );
+ break;
+
+ case 0x88: /* GETINFO */
+ Ins_GETINFO( EXEC_ARGS args );
+ break;
+
+ case 0x89: /* IDEF */
+ Ins_IDEF( EXEC_ARGS args );
+ break;
+
+ case 0x8A: /* ROLL */
+ Ins_ROLL( EXEC_ARGS args );
+ break;
+
+ case 0x8B: /* MAX */
+ DO_MAX
+ break;
+
+ case 0x8C: /* MIN */
+ DO_MIN
+ break;
+
+ case 0x8D: /* SCANTYPE */
+ Ins_SCANTYPE( EXEC_ARGS args );
+ break;
+
+ case 0x8E: /* INSTCTRL */
+ Ins_INSTCTRL( EXEC_ARGS args );
+ break;
+
+ case 0x8F:
+ Ins_UNKNOWN( EXEC_ARGS args );
+ break;
+
+ default:
+ if ( opcode >= 0xE0 )
+ Ins_MIRP( EXEC_ARGS args );
+ else if ( opcode >= 0xC0 )
+ Ins_MDRP( EXEC_ARGS args );
+ else if ( opcode >= 0xB8 )
+ Ins_PUSHW( EXEC_ARGS args );
+ else if ( opcode >= 0xB0 )
+ Ins_PUSHB( EXEC_ARGS args );
+ else
+ Ins_UNKNOWN( EXEC_ARGS args );
+ }
+
+ }
+#else
+ Instruct_Dispatch[CUR.opcode]( EXEC_ARGS &CUR.stack[CUR.args] );
+#endif
+ if ( CUR.error != TT_Err_Ok )
+ {
+ switch ( (Int)(CUR.error) )
+ {
+ case TT_Err_Invalid_Opcode: /* looking for redefined instructions */
+ A = 0;
+
+ while ( A < CUR.numIDefs )
+ {
+ WITH = &CUR.IDefs[A];
+
+ if ( WITH->Active && CUR.opcode == WITH->Opc )
+ {
+ if ( CUR.callTop >= CUR.callSize )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ goto LErrorLabel_;
+ }
+
+ WITH1 = &CUR.callStack[CUR.callTop];
+
+ WITH1->Caller_Range = CUR.curRange;
+ WITH1->Caller_IP = CUR.IP + 1;
+ WITH1->Cur_Count = 1;
+ WITH1->Cur_Restart = WITH->Start;
+
+ if ( INS_Goto_CodeRange( WITH->Range, WITH->Start ) == FAILURE )
+ goto LErrorLabel_;
+
+ goto LSuiteLabel_;
+ }
+ else
+ {
+ A++;
+ continue;
+ }
+ }
+
+ CUR.error = TT_Err_Invalid_Opcode;
+ goto LErrorLabel_;
+/* break; Unreachable code warning suppress. Leave in case a later
+ change to remind the editor to consider break; */
+
+ default:
+ goto LErrorLabel_;
+/* break; */
+ }
+ }
+
+ CUR.top = CUR.new_top;
+
+ if ( CUR.step_ins )
+ CUR.IP += CUR.length;
+
+ /* increment instruction counter and check if we didn't */
+ /* run this program for too long ?? (e.g. infinite loops) */
+ if ( ++ins_counter > MAX_RUNNABLE_OPCODES )
+ {
+ CUR.error = TT_Err_Execution_Too_Long;
+ goto LErrorLabel_;
+ }
+
+ LSuiteLabel_:
+
+ if ( CUR.IP >= CUR.codeSize )
+ {
+ if ( CUR.callTop > 0 )
+ {
+ CUR.error = TT_Err_Code_Overflow;
+ goto LErrorLabel_;
+ }
+ else
+ goto LNo_Error_;
+ }
+ } while ( !CUR.instruction_trap );
+
+ LNo_Error_:
+ CUR.error = TT_Err_Ok;
+
+ LErrorLabel_:
+
+#ifdef TT_CONFIG_OPTION_STATIC_INTERPRETER
+ *exc = cur;
+#endif
+
+ return CUR.error;
+
+
+ }
+
+
+
+#ifdef DEBUG_INTERPRETER
+
+ /* This function must be declared by the debugger front end */
+ /* in order to specify which code range to debug. */
+
+ int debug_coderange = TT_CodeRange_Glyph;
+
+ FT_INTERNAL_FUNC( TT_Error )
+ RunIns( PExecution_Context exc )
+ {
+ Int A, diff;
+ ULong next_IP;
+ Char ch, oldch;
+ char *temp;
+ int key;
+
+ TT_Error error = 0;
+
+ TGlyph_Zone save;
+ TGlyph_Zone pts;
+
+#define TT_Round_Off 5
+#define TT_Round_To_Half_Grid 0
+#define TT_Round_To_Grid 1
+#define TT_Round_To_Double_Grid 2
+#define TT_Round_Up_To_Grid 4
+#define TT_Round_Down_To_Grid 3
+#define TT_Round_Super 6
+#define TT_Round_Super_45 7
+
+ const String* round_str[8] =
+ {
+ "to half-grid",
+ "to grid",
+ "to double grid",
+ "down to grid",
+ "up to grid",
+ "off",
+ "super",
+ "super 45"
+ };
+
+ /* Check that we're running the code range that is effectively */
+ /* asked by the debugger front end. */
+ if ( CUR.curRange != debug_coderange )
+ return RunIns2( &CUR );
+
+ pts = CUR.pts;
+
+ save.n_points = pts.n_points;
+ save.n_contours = pts.n_contours;
+
+ MEM_Alloc( save.org, sizeof ( TT_Vector ) * save.n_points );
+ MEM_Alloc( save.cur, sizeof ( TT_Vector ) * save.n_points );
+ MEM_Alloc( save.touch, sizeof ( Byte ) * save.n_points );
+
+ CUR.instruction_trap = 1;
+
+ oldch = '\0';
+
+ do
+ {
+ if ( CUR.IP < CUR.codeSize )
+ {
+#ifdef TT_CONFIG_OPTION_STATIC_INTERPRETER
+ cur = *exc;
+#endif
+ CALC_Length();
+
+ CUR.args = CUR.top - (Pop_Push_Count[CUR.opcode] >> 4);
+
+ /* `args' is the top of the stack once arguments have been popped. */
+ /* One can also interpret it as the index of the last argument. */
+
+ /* Print the current line. We use a 80-columns console with the */
+ /* following formatting: */
+ /* */
+ /* [loc]:[addr] [opcode] [disassemby] [a][b]|[c][d] */
+ /* */
+
+ {
+ char temp[80];
+ int n, col, pop;
+ int args = CUR.args;
+
+
+ sprintf( temp, "%78c\n", ' ' );
+
+ /* first letter of location */
+ switch ( CUR.curRange )
+ {
+ case TT_CodeRange_Glyph:
+ temp[0] = 'g';
+ break;
+ case TT_CodeRange_Cvt:
+ temp[0] = 'c';
+ break;
+ default:
+ temp[0] = 'f';
+ }
+
+ /* current IP */
+ sprintf( temp+1, "%04lx: %02x %-36.36s",
+ CUR.IP,
+ CUR.opcode,
+ Cur_U_Line(&CUR) );
+
+ strncpy( temp+46, " (", 2 );
+
+ args = CUR.top - 1;
+ pop = Pop_Push_Count[CUR.opcode] >> 4;
+ col = 48;
+ for ( n = 6; n > 0; n-- )
+ {
+ if ( pop == 0 )
+ temp[col-1] = (temp[col-1] == '(' ? ' ' : ')' );
+
+ if ( args < CUR.top && args >= 0 )
+ sprintf( temp+col, "%04lx", CUR.stack[args] );
+ else
+ sprintf( temp+col, " " );
+
+ temp[col+4] = ' ';
+ col += 5;
+ pop--;
+ args--;
+ }
+ temp[78] = '\n';
+ temp[79] = '\0';
+ PTRACE0(( temp ));
+ }
+
+ /* First, check for empty stack and overflow */
+ if ( CUR.args < 0 )
+ {
+ PTRACE0(( "ERROR : Too few arguments\n" ));
+ CUR.error = TT_Err_Too_Few_Arguments;
+ goto LErrorLabel_;
+ }
+
+ CUR.new_top = CUR.args + (Pop_Push_Count[CUR.opcode] & 15);
+
+ /* new_top is the new top of the stack, after the instruction's */
+ /* execution. top will be set to new_top after the 'case' */
+
+ if ( CUR.new_top > CUR.stackSize )
+ {
+ PTRACE0(( "ERROR : Stack overflow\n" ));
+ CUR.error = TT_Err_Stack_Overflow;
+ goto LErrorLabel_;
+ }
+
+#ifdef TT_CONFIG_OPTION_STATIC_INTERPRETER
+ *exc = cur;
+#endif
+ }
+ else
+ PTRACE0(( "End of program reached.\n" ));
+
+ key = 0;
+ do
+ {
+ /* read keyboard */
+
+ ch = getch();
+
+ switch ( ch )
+ {
+ /* Help - show keybindings */
+ case '?':
+ PTRACE0(( "FDebug Help\n\n" ));
+ PTRACE0(( "? Show this page\n" ));
+ PTRACE0(( "q Quit debugger\n" ));
+ PTRACE0(( "n Skip to next instruction\n" ));
+ PTRACE0(( "s Step into\n" ));
+ PTRACE0(( "v Show vector info\n" ));
+ PTRACE0(( "g Show graphics state\n" ));
+ PTRACE0(( "p Show points zone\n\n" ));
+ break;
+
+ /* Show vectors */
+ case 'v':
+ PTRACE0(( "freedom (%04hx,%04hx)\n", CUR.GS.freeVector.x,
+ CUR.GS.freeVector.y ));
+ PTRACE0(( "projection (%04hx,%04hx)\n", CUR.GS.projVector.x,
+ CUR.GS.projVector.y ));
+ PTRACE0(( "dual (%04hx,%04hx)\n\n", CUR.GS.dualVector.x,
+ CUR.GS.dualVector.y ));
+ break;
+
+ /* Show graphics state */
+ case 'g':
+ PTRACE0(( "rounding %s\n", round_str[CUR.GS.round_state] ));
+ PTRACE0(( "min dist %04lx\n", CUR.GS.minimum_distance ));
+ PTRACE0(( "cvt_cutin %04lx\n", CUR.GS.control_value_cutin ));
+ break;
+
+ /* Show points table */
+ case 'p':
+ for ( A = 0; A < CUR.pts.n_points; A++ )
+ {
+ PTRACE0(( "%02hx ", A ));
+ PTRACE0(( "%08lx,%08lx - ", pts.org[A].x, pts.org[A].y ));
+ PTRACE0(( "%08lx,%08lx\n", pts.cur[A].x, pts.cur[A].y ));
+ }
+ PTRACE0(( "\n" ));
+ break;
+
+ default:
+ key = 1;
+ }
+ } while ( !key );
+
+ MEM_Copy( save.org, pts.org, pts.n_points * sizeof ( TT_Vector ) );
+ MEM_Copy( save.cur, pts.cur, pts.n_points * sizeof ( TT_Vector ) );
+ MEM_Copy( save.touch, pts.touch, pts.n_points );
+
+ /* a return indicate the last command */
+ if (ch == '\r')
+ ch = oldch;
+
+ switch ( ch )
+ {
+ /* Quit debugger */
+ case 'q':
+ goto LErrorLabel_;
+
+ /* Step over */
+ case 'n':
+ if ( CUR.IP < CUR.codeSize )
+ {
+ /* `step over' is equivalent to `step into' except if */
+ /* the current opcode is a CALL or LOOPCALL */
+ if ( CUR.opcode != 0x2a && CUR.opcode != 0x2b )
+ goto Step_into;
+
+ /* otherwise, loop execution until we reach the next opcode */
+ next_IP = CUR.IP + CUR.length;
+ while ( CUR.IP != next_IP )
+ {
+ if ( ( error = RunIns2( &CUR ) ) != 0 )
+ goto LErrorLabel_;
+ }
+ }
+ oldch = ch;
+ break;
+
+ /* Step into */
+ case 's':
+ if ( CUR.IP < CUR.codeSize )
+
+ Step_into:
+ if ( ( error = RunIns2( &CUR ) ) != 0 )
+ goto LErrorLabel_;
+ oldch = ch;
+ break;
+
+ default:
+ PTRACE0(( "unknown command. Press ? for help\n" ));
+ oldch = '\0';
+ }
+
+ for ( A = 0; A < pts.n_points; A++ )
+ {
+ diff = 0;
+ if ( save.org[A].x != pts.org[A].x ) diff |= 1;
+ if ( save.org[A].y != pts.org[A].y ) diff |= 2;
+ if ( save.cur[A].x != pts.cur[A].x ) diff |= 4;
+ if ( save.cur[A].y != pts.cur[A].y ) diff |= 8;
+ if ( save.touch[A] != pts.touch[A] ) diff |= 16;
+
+ if ( diff )
+ {
+ PTRACE0(( "%02hx ", A ));
+
+ if ( diff & 16 ) temp = "(%01hx)"; else temp = " %01hx ";
+ PTRACE0(( temp, save.touch[A] & 7 ));
+
+ if ( diff & 1 ) temp = "(%08lx)"; else temp = " %08lx ";
+ PTRACE0(( temp, save.org[A].x ));
+
+ if ( diff & 2 ) temp = "(%08lx)"; else temp = " %08lx ";
+ PTRACE0(( temp, save.org[A].y ));
+
+ if ( diff & 4 ) temp = "(%08lx)"; else temp = " %08lx ";
+ PTRACE0(( temp, save.cur[A].x ));
+
+ if ( diff & 8 ) temp = "(%08lx)"; else temp = " %08lx ";
+ PTRACE0(( temp, save.cur[A].y ));
+
+ PTRACE0(( "\n" ));
+
+ PTRACE0(( "%02hx ", A ));
+
+ if ( diff & 16 ) temp = "[%01hx]"; else temp = " %01hx ";
+ PTRACE0(( temp, pts.touch[A] & 7 ));
+
+ if ( diff & 1 ) temp = "[%08lx]"; else temp = " %08lx ";
+ PTRACE0(( temp, pts.org[A].x ));
+
+ if ( diff & 2 ) temp = "[%08lx]"; else temp = " %08lx ";
+ PTRACE0(( temp, pts.org[A].y ));
+
+ if ( diff & 4 ) temp = "[%08lx]"; else temp = " %08lx ";
+ PTRACE0(( temp, pts.cur[A].x ));
+
+ if ( diff & 8 ) temp = "[%08lx]"; else temp = " %08lx ";
+ PTRACE0(( temp, pts.cur[A].y ));
+
+ PTRACE0(( "\n\n" ));
+ }
+ }
+ } while ( TRUE );
+
+ LErrorLabel_:
+
+ return error;
+ }
+
+#endif /* DEBUG_INTERPRETER */
+
+
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttinterp.h b/Build/source/libs/freetype/lib/ttinterp.h
new file mode 100644
index 00000000000..2c92a0ae59d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttinterp.h
@@ -0,0 +1,55 @@
+/*******************************************************************
+ *
+ * ttinterp.h 2.2
+ *
+ * TrueType bytecode intepreter.
+ *
+ * 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.
+ *
+ *
+ * Changes between 2.2 and 2.1:
+ *
+ * - a small bugfix in the Push opcodes
+ *
+ * Changes between 2.1 and 2.0:
+ *
+ * - created the TTExec component to take care of all execution
+ * context management. The interpreter has now one single
+ * function.
+ *
+ * - made some changes to support re-entrancy. The re-entrant
+ * interpreter is smaller!
+ *
+ ******************************************************************/
+
+#ifndef TTINTERP_H
+#define TTINTERP_H
+
+#include "ttconfig.h"
+#include "ttobjs.h"
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /* Run instructions in current execution context */
+
+ FT_INTERNAL_DEF( TT_Error )
+ RunIns( PExecution_Context exc );
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTINTERP_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttload.c b/Build/source/libs/freetype/lib/ttload.c
new file mode 100644
index 00000000000..0cf2894aa71
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttload.c
@@ -0,0 +1,1598 @@
+
+/*******************************************************************
+ *
+ * ttload.c 1.0
+ *
+ * TrueType Tables Loader.
+ *
+ * Copyright 1996-2001, 2002 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.
+ *
+ ******************************************************************/
+
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttcalc.h"
+#include "ttfile.h"
+
+#include "tttables.h"
+#include "ttobjs.h"
+
+#include "ttmemory.h"
+#include "tttags.h"
+#include "ttload.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_load
+
+/* In all functions, the stream is taken from the 'face' object */
+#define DEFINE_LOCALS DEFINE_LOAD_LOCALS( face->stream )
+#define DEFINE_LOCALS_WO_FRAME DEFINE_LOAD_LOCALS_WO_FRAME( face->stream )
+
+
+/*******************************************************************
+ *
+ * Function : LookUp_TrueType_Table
+ *
+ * Description : Looks for a TrueType table by name.
+ *
+ * Input : face face table to look for
+ * tag searched tag
+ *
+ * Output : Index of table if found, -1 otherwise.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( Long )
+ TT_LookUp_Table( PFace face,
+ ULong tag )
+ {
+ UShort i;
+
+
+ PTRACE4(( "TT_LookUp_Table( %08lx, %c%c%c%c )\n",
+ (Long)face,
+ (Char)(tag >> 24),
+ (Char)(tag >> 16),
+ (Char)(tag >> 8),
+ (Char)(tag) ));
+
+ for ( i = 0; i < face->numTables; i++ )
+ if ( face->dirTables[i].Tag == tag )
+ return i;
+
+ PTRACE4(( " Could not find table!\n" ));
+ return -1;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Collection
+ *
+ * Description : Loads the TTC table directory into face table.
+ *
+ * Input : face face record to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ static TT_Error Load_TrueType_Collection( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ ULong n;
+
+
+ PTRACE3(( "Load_TrueType_Collection( %08lx )\n", (long)face ));
+
+ if ( FILE_Seek ( 0L ) ||
+ ACCESS_Frame( 12L ) )
+ return error;
+
+ face->ttcHeader.Tag = GET_Tag4();
+ face->ttcHeader.version = GET_Long();
+ face->ttcHeader.DirCount = GET_Long();
+
+ FORGET_Frame();
+
+ if ( face->ttcHeader.Tag != TTAG_ttcf )
+ {
+ face->ttcHeader.Tag = 0;
+ face->ttcHeader.version = 0;
+ face->ttcHeader.DirCount = 0;
+
+ face->ttcHeader.TableDirectory = NULL;
+
+ PTRACE3(("skipped.\n"));
+
+ return TT_Err_File_Is_Not_Collection;
+ }
+
+ if ( ALLOC_ARRAY( face->ttcHeader.TableDirectory,
+ face->ttcHeader.DirCount,
+ ULong ) ||
+ ACCESS_Frame( face->ttcHeader.DirCount * 4L ) )
+ return error;
+
+ for ( n = 0; n < face->ttcHeader.DirCount; n++ )
+ face->ttcHeader.TableDirectory[n] = GET_ULong();
+
+ FORGET_Frame();
+
+ PTRACE3(( "collections directory loaded.\n" ));
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Directory
+ *
+ * Description : Loads the table directory into face table.
+ *
+ * Input : face face record to look for
+ *
+ * faceIndex the index of the TrueType font, when
+ * we're opening a collection.
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Directory( PFace face,
+ ULong faceIndex )
+ {
+ DEFINE_LOCALS;
+
+ UShort n, limit;
+ TTableDir tableDir;
+
+ PTableDirEntry entry;
+
+
+ PTRACE2(("Load_TT_Directory( %08lx, %ld )\n", (long)face, faceIndex));
+
+ error = Load_TrueType_Collection( face );
+
+ if ( error )
+ {
+ if ( error != TT_Err_File_Is_Not_Collection )
+ return error;
+
+ /* the file isn't a collection, exit if we're asking */
+ /* for a collected font */
+ if ( faceIndex != 0 )
+ return error;
+
+ /* Now skip to the beginning of the file */
+ if ( FILE_Seek( 0L ) )
+ return error;
+ }
+ else
+ {
+ /* The file is a collection. Check the font index */
+ if ( faceIndex >= face->ttcHeader.DirCount )
+ return TT_Err_Invalid_Argument;
+
+ /* select a TrueType font in the ttc file */
+ if ( FILE_Seek( face->ttcHeader.TableDirectory[faceIndex] ) )
+ return error;
+ }
+
+ if ( ACCESS_Frame( 12L ) )
+ return error;
+
+ tableDir.version = GET_Long();
+ tableDir.numTables = GET_UShort();
+
+ tableDir.searchRange = GET_UShort();
+ tableDir.entrySelector = GET_UShort();
+ tableDir.rangeShift = GET_UShort();
+
+ FORGET_Frame();
+
+ PTRACE2(( "-- Tables count : %12u\n", tableDir.numTables ));
+ PTRACE2(( "-- Format version : %08lx\n", tableDir.version ));
+
+ /* Check that we have a 'sfnt' format there */
+
+ if ( tableDir.version != 0x00010000 && /* MS fonts */
+ tableDir.version != 0x74727565 && /* Mac fonts */
+ tableDir.version != 0x00000000 ) /* some Korean fonts */
+ {
+ PERROR(( "!! invalid file format" ));
+ return TT_Err_Invalid_File_Format;
+ }
+
+ face->numTables = tableDir.numTables;
+
+ if ( ALLOC_ARRAY( face->dirTables,
+ face->numTables,
+ TTableDirEntry ) )
+ return error;
+
+ if ( ACCESS_Frame( face->numTables * 16L ) )
+ return error;
+
+ limit = face->numTables;
+ entry = face->dirTables;
+
+ for ( n = 0; n < limit; n++ )
+ { /* loop through the tables and get all entries */
+ entry->Tag = GET_Tag4();
+ entry->CheckSum = GET_ULong();
+ entry->Offset = GET_Long();
+ entry->Length = GET_Long();
+
+ PTRACE2(( " %c%c%c%c - %08lx - %08lx\n",
+ (Char)(entry->Tag >> 24),
+ (Char)(entry->Tag >> 16),
+ (Char)(entry->Tag >> 8 ),
+ (Char)(entry->Tag),
+ entry->Offset,
+ entry->Length ));
+ entry++;
+ }
+
+ FORGET_Frame();
+
+ PTRACE2(( "Directory loaded\n\n" ));
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_MaxProfile
+ *
+ * Description : Loads the maxp table into face table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_MaxProfile( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long i;
+ PMaxProfile maxProfile = &face->maxProfile;
+
+
+ PTRACE2(( "Load_TT_MaxProfile( %08lx )\n", (long)face ));
+
+ if ( ( i = TT_LookUp_Table( face, TTAG_maxp ) ) < 0 )
+ return TT_Err_Max_Profile_Missing;
+
+ if ( FILE_Seek( face->dirTables[i].Offset ) ) /* seek to maxprofile */
+ return error;
+
+ if ( ACCESS_Frame( 32L ) ) /* read into frame */
+ return error;
+
+ /* read frame data into face table */
+ maxProfile->version = GET_ULong();
+
+ maxProfile->numGlyphs = GET_UShort();
+
+ maxProfile->maxPoints = GET_UShort();
+ maxProfile->maxContours = GET_UShort();
+ maxProfile->maxCompositePoints = GET_UShort();
+ maxProfile->maxCompositeContours = GET_UShort();
+
+ maxProfile->maxZones = GET_UShort();
+ maxProfile->maxTwilightPoints = GET_UShort();
+
+ maxProfile->maxStorage = GET_UShort();
+ maxProfile->maxFunctionDefs = GET_UShort();
+ maxProfile->maxInstructionDefs = GET_UShort();
+ maxProfile->maxStackElements = GET_UShort();
+ maxProfile->maxSizeOfInstructions = GET_UShort();
+ maxProfile->maxComponentElements = GET_UShort();
+ maxProfile->maxComponentDepth = GET_UShort();
+
+ FORGET_Frame();
+
+ /* XXX : an adjustement that is necessary to load certain */
+ /* broken fonts like "Keystrokes MT" :-( */
+ /* */
+ /* We allocate 64 function entries by default when */
+ /* the maxFunctionDefs field is null. */
+
+ if (maxProfile->maxFunctionDefs == 0)
+ maxProfile->maxFunctionDefs = 64;
+
+ face->numGlyphs = maxProfile->numGlyphs;
+
+ face->maxPoints = MAX( maxProfile->maxCompositePoints,
+ maxProfile->maxPoints );
+ face->maxContours = MAX( maxProfile->maxCompositeContours,
+ maxProfile->maxContours );
+ face->maxComponents = maxProfile->maxComponentElements +
+ maxProfile->maxComponentDepth;
+
+ /* XXX: Some fonts have maxComponents set to 0; we will */
+ /* then use 16 of them by default. */
+ if ( face->maxComponents == 0 )
+ face->maxComponents = 16;
+
+ /* We also increase maxPoints and maxContours in order to support */
+ /* some broken fonts. */
+ face->maxPoints += 8;
+ face->maxContours += 4;
+
+ PTRACE2(( "GASP loaded.\n" ));
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Gasp
+ *
+ * Description : Loads the TrueType Gasp table into the face
+ * table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Gasp( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long i;
+ UShort j;
+ TGasp* gas;
+ GaspRange* gaspranges;
+
+
+ PTRACE2(( "Load_TT_Gasp( %08lx )\n", (long)face ));
+
+ if ( ( i = TT_LookUp_Table( face, TTAG_gasp ) ) < 0 )
+ return TT_Err_Ok; /* gasp table is not required */
+
+ if ( FILE_Seek( face->dirTables[i].Offset ) ||
+ ACCESS_Frame( 4L ) )
+ return error;
+
+ gas = &face->gasp;
+
+ gas->version = GET_UShort();
+ gas->numRanges = GET_UShort();
+
+ FORGET_Frame();
+
+ PTRACE3(( "number of ranges = %d\n", gas->numRanges ));
+
+ if ( ALLOC_ARRAY( gaspranges, gas->numRanges, GaspRange ) ||
+ ACCESS_Frame( gas->numRanges * 4L ) )
+ goto Fail;
+
+ face->gasp.gaspRanges = gaspranges;
+
+ for ( j = 0; j < gas->numRanges; j++ )
+ {
+ gaspranges[j].maxPPEM = GET_UShort();
+ gaspranges[j].gaspFlag = GET_UShort();
+
+ PTRACE3(( " [max:%d flag:%d]",
+ gaspranges[j].maxPPEM,
+ gaspranges[j].gaspFlag ));
+ }
+ PTRACE3(("\n"));
+
+ FORGET_Frame();
+
+ PTRACE2(( "GASP loaded\n" ));
+ return TT_Err_Ok;
+
+ Fail:
+ FREE( gaspranges );
+ gas->numRanges = 0;
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Header
+ *
+ * Description : Loads the TrueType header table into the face
+ * table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Header( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long i;
+ TT_Header* header;
+
+
+ PTRACE2(( "Load_TT_Header( %08lx )\n", (long)face ));
+
+ if ( ( i = TT_LookUp_Table( face, TTAG_head ) ) < 0 )
+ {
+ PTRACE0(( "Font Header is missing !!\n" ));
+ return TT_Err_Header_Table_Missing;
+ }
+
+ if ( FILE_Seek( face->dirTables[i].Offset ) ||
+ ACCESS_Frame( 54L ) )
+ return error;
+
+ header = &face->fontHeader;
+
+ header->Table_Version = GET_ULong();
+ header->Font_Revision = GET_ULong();
+
+ header->CheckSum_Adjust = GET_Long();
+ header->Magic_Number = GET_Long();
+
+ header->Flags = GET_UShort();
+ header->Units_Per_EM = GET_UShort();
+
+ header->Created [0] = GET_Long();
+ header->Created [1] = GET_Long();
+ header->Modified[0] = GET_Long();
+ header->Modified[1] = GET_Long();
+
+ header->xMin = GET_Short();
+ header->yMin = GET_Short();
+ header->xMax = GET_Short();
+ header->yMax = GET_Short();
+
+ header->Mac_Style = GET_UShort();
+ header->Lowest_Rec_PPEM = GET_UShort();
+
+ header->Font_Direction = GET_Short();
+ header->Index_To_Loc_Format = GET_Short();
+ header->Glyph_Data_Format = GET_Short();
+
+ FORGET_Frame();
+
+ PTRACE2(( " Units per EM : %8u\n", header->Units_Per_EM ));
+ PTRACE2(( " IndexToLoc : %8d\n", header->Index_To_Loc_Format ));
+ PTRACE2(( "Font Header Loaded.\n" ));
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Metrics
+ *
+ * Description : Loads the horizontal or vertical metrics table
+ * into face object.
+ *
+ * Input : face
+ * vertical set to true when loading the vmtx table,
+ * or false for hmtx
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ static
+ TT_Error Load_TrueType_Metrics( PFace face,
+ Bool vertical )
+ {
+ DEFINE_LOCALS;
+
+ Long n, num_shorts, num_shorts_checked, num_longs;
+
+ PLongMetrics* longs;
+ PShortMetrics* shorts;
+
+ PLongMetrics long_metric;
+
+
+ PTRACE2(( "Load_TT_%s_Metrics( %08lx )\n",
+ vertical ? "Vertical" : "Horizontal",
+ (long)face ));
+
+ if ( vertical )
+ {
+ /* The table is optional, quit silently if it wasn't found */
+ /* XXX : Some fonts have a valid vertical header with a non-null */
+ /* "number_of_VMetrics" fields, but no corresponding */
+ /* 'vmtx' table to get the metrics from (e.g. mingliu) */
+ /* */
+ /* For safety, we set the field to 0 ! */
+ /* */
+ n = TT_LookUp_Table( face, TTAG_vmtx );
+ if ( n < 0 )
+ {
+ /* Set the number_Of_VMetrics to 0! */
+ PTRACE2(( " no vertical header in file.\n" ));
+ face->verticalHeader.number_Of_VMetrics = 0;
+ return TT_Err_Ok;
+ }
+
+ num_longs = face->verticalHeader.number_Of_VMetrics;
+ longs = (PLongMetrics*)&face->verticalHeader.long_metrics;
+ shorts = (PShortMetrics*)&face->verticalHeader.short_metrics;
+ }
+ else
+ {
+ if ( ( n = TT_LookUp_Table( face, TTAG_hmtx ) ) < 0 )
+ {
+ PERROR(( "!! No Horizontal metrics in file !!\n" ));
+ return TT_Err_Hmtx_Table_Missing;
+ }
+
+ num_longs = face->horizontalHeader.number_Of_HMetrics;
+ longs = (PLongMetrics*)&face->horizontalHeader.long_metrics;
+ shorts = (PShortMetrics*)&face->horizontalHeader.short_metrics;
+ }
+
+ /* never trust derived values! */
+
+ num_shorts = face->maxProfile.numGlyphs - num_longs;
+ num_shorts_checked = ( face->dirTables[n].Length - num_longs * 4 ) / 2;
+
+ if ( num_shorts < 0 ) /* sanity check */
+ {
+ PERROR(( "!! more metrics than glyphs!\n" ));
+ if ( vertical )
+ return TT_Err_Invalid_Vert_Metrics;
+ else
+ return TT_Err_Invalid_Horiz_Metrics;
+ }
+
+ if ( ALLOC_ARRAY( *longs, num_longs, TLongMetrics ) ||
+ ALLOC_ARRAY( *shorts, num_shorts, TShortMetrics ) )
+ return error;
+
+ if ( FILE_Seek( face->dirTables[n].Offset ) ||
+ ACCESS_Frame( face->dirTables[n].Length ) )
+ return error;
+
+ long_metric = *longs;
+ for ( n = 0; n < num_longs; n++ )
+ {
+ long_metric->advance = GET_UShort();
+ long_metric->bearing = GET_Short();
+ long_metric++;
+ }
+
+ /* do we have an inconsistent number of metric values? */
+
+ if ( num_shorts > num_shorts_checked )
+ {
+ for ( n = 0; n < num_shorts_checked; n++ )
+ (*shorts)[n] = GET_Short();
+
+ /* we fill up the missing left side bearings with the */
+ /* last valid value. Since this will occur for buggy CJK */
+ /* fonts usually, nothing serious will happen. */
+
+ for ( n = num_shorts_checked; n < num_shorts; n++ )
+ (*shorts)[n] = (*shorts)[num_shorts_checked - 1];
+ }
+ else
+ {
+ for ( n = 0; n < num_shorts; n++ )
+ (*shorts)[n] = GET_Short();
+ }
+
+ FORGET_Frame();
+
+ PTRACE2(( "loaded\n" ));
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Metrics_Header
+ *
+ * Description : Loads either the "hhea" or "vhea" table in memory
+ *
+ * Input : face face table to look for
+ * vertical a boolean. When set, queries the optional
+ * "vhea" table. Otherwise, load the mandatory
+ * "hhea" horizontal header.
+ *
+ * Output : Error code.
+ *
+ * Note : This function now loads the corresponding metrics table
+ * (either hmtx or vmtx) and attaches it to the header.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Metrics_Header( PFace face,
+ Bool vertical )
+ {
+ DEFINE_LOCALS;
+
+ Long i;
+
+ TT_Horizontal_Header* header;
+
+
+ PTRACE2(( vertical ? "Vertical header" : "Horizontal header " ));
+
+ if ( vertical )
+ {
+ face->verticalInfo = 0;
+
+ /* The vertical header table is optional, so return quietly if */
+ /* we don't find it.. */
+ if ( ( i = TT_LookUp_Table( face, TTAG_vhea ) ) < 0 )
+ return TT_Err_Ok;
+
+ face->verticalInfo = 1;
+ header = (TT_Horizontal_Header*)&face->verticalHeader;
+ }
+ else
+ {
+ /* The orizontal header is mandatory, return an error if we */
+ /* don't find it. */
+ if ( ( i = TT_LookUp_Table( face, TTAG_hhea ) ) < 0 )
+ return TT_Err_Horiz_Header_Missing;
+
+ header = &face->horizontalHeader;
+ }
+
+ if ( FILE_Seek( face->dirTables[i].Offset ) ||
+ ACCESS_Frame( 36L ) )
+ return error;
+
+ header->Version = GET_ULong();
+ header->Ascender = GET_Short();
+ header->Descender = GET_Short();
+ header->Line_Gap = GET_Short();
+
+ header->advance_Width_Max = GET_UShort();
+
+ header->min_Left_Side_Bearing = GET_Short();
+ header->min_Right_Side_Bearing = GET_Short();
+ header->xMax_Extent = GET_Short();
+ header->caret_Slope_Rise = GET_Short();
+ header->caret_Slope_Run = GET_Short();
+
+ header->Reserved0 = GET_Short(); /* this is caret_Offset for
+ vertical headers */
+ header->Reserved1 = GET_Short();
+ header->Reserved2 = GET_Short();
+ header->Reserved3 = GET_Short();
+ header->Reserved4 = GET_Short();
+
+ header->metric_Data_Format = GET_Short();
+ header->number_Of_HMetrics = GET_UShort();
+
+ FORGET_Frame();
+
+ header->long_metrics = NULL;
+ header->short_metrics = NULL;
+
+ PTRACE2(( "loaded\n" ));
+
+ /* Now try to load the corresponding metrics */
+
+ return Load_TrueType_Metrics( face, vertical );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Locations
+ *
+ * Description : Loads the location table into face table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : Error code.
+ *
+ * NOTE:
+ * The Font Header *must* be loaded in the leading segment
+ * calling this function.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Locations( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long n, limit;
+ Short LongOffsets;
+
+
+ PTRACE2(( "Locations " ));
+
+ LongOffsets = face->fontHeader.Index_To_Loc_Format;
+
+ if ( ( n = TT_LookUp_Table( face, TTAG_loca ) ) < 0 )
+ return TT_Err_Locations_Missing;
+
+ if ( FILE_Seek( face->dirTables[n].Offset ) )
+ return error;
+
+ if ( LongOffsets != 0 )
+ {
+ face->numLocations = face->dirTables[n].Length >> 2;
+
+ PTRACE2(( "(32 bit offsets): %12lu ",
+ face->numLocations ));
+
+ if ( ALLOC_ARRAY( face->glyphLocations,
+ face->numLocations,
+ Long ) )
+ return error;
+
+ if ( ACCESS_Frame( face->numLocations * 4L ) )
+ return error;
+
+ limit = face->numLocations;
+
+ for ( n = 0; n < limit; n++ )
+ face->glyphLocations[n] = GET_Long();
+
+ FORGET_Frame();
+ }
+ else
+ {
+ face->numLocations = face->dirTables[n].Length >> 1;
+
+ PTRACE2(( "(16 bit offsets): %12lu ",
+ face->numLocations ));
+
+ if ( ALLOC_ARRAY( face->glyphLocations,
+ face->numLocations,
+ Long ) )
+ return error;
+
+ if ( ACCESS_Frame( face->numLocations * 2L ) )
+ return error;
+
+ limit = face->numLocations;
+
+ for ( n = 0; n < limit; n++ )
+ face->glyphLocations[n] =
+ (Long)((ULong)GET_UShort() * 2);
+
+ FORGET_Frame();
+ }
+
+ PTRACE2(( "loaded\n" ));
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Names
+ *
+ * Description : Loads the name table into face table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Names( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ UShort i, bytes;
+ Long n;
+ PByte storage;
+
+ TName_Table* names;
+ TNameRec* namerec;
+
+
+ PTRACE2(( "Names " ));
+
+ if ( ( n = TT_LookUp_Table( face, TTAG_name ) ) < 0 )
+ {
+ /* The name table is required so indicate failure. */
+ PTRACE2(( "is missing!\n" ));
+
+ return TT_Err_Name_Table_Missing;
+ }
+
+ /* Seek to the beginning of the table and check the frame access. */
+ /* The names table has a 6 byte header. */
+ if ( FILE_Seek( face->dirTables[n].Offset ) ||
+ ACCESS_Frame( 6L ) )
+ return error;
+
+ names = &face->nameTable;
+
+ /* Load the initial names data. */
+ names->format = GET_UShort();
+ names->numNameRecords = GET_UShort();
+ names->storageOffset = GET_UShort();
+
+ FORGET_Frame();
+
+ /* Allocate the array of name records. */
+ if ( ALLOC_ARRAY( names->names,
+ names->numNameRecords,
+ TNameRec ) ||
+ ACCESS_Frame( names->numNameRecords * 12L ) )
+ {
+ names->numNameRecords = 0;
+ goto Fail;
+ }
+
+ /* Load the name records and determine how much storage is needed */
+ /* to hold the strings themselves. */
+
+ for ( i = bytes = 0; i < names->numNameRecords; i++ )
+ {
+ namerec = names->names + i;
+ namerec->platformID = GET_UShort();
+ namerec->encodingID = GET_UShort();
+ namerec->languageID = GET_UShort();
+ namerec->nameID = GET_UShort();
+ namerec->stringLength = GET_UShort();
+ namerec->stringOffset = GET_UShort();
+
+#if 0
+ /* check the ids */
+ if ( namerec->platformID <= 3 )
+ {
+#endif
+ /* this test takes care of 'holes' in the names tables, as */
+ /* reported by Erwin */
+ if ( (namerec->stringOffset + namerec->stringLength) > bytes )
+ bytes = namerec->stringOffset + namerec->stringLength;
+#if 0
+ }
+#endif
+ }
+
+ FORGET_Frame();
+
+ /* Allocate storage for the strings if they exist. */
+
+ names->storage = NULL;
+
+ if ( bytes > 0 )
+ {
+ if ( ALLOC( storage, bytes ) ||
+ FILE_Read_At( face->dirTables[n].Offset + names->storageOffset,
+ (void*)storage,
+ bytes ) )
+ goto Fail_Storage;
+
+ names->storage = storage;
+
+ /* Go through and assign the string pointers to the name records. */
+
+ for ( i = 0; i < names->numNameRecords; i++ )
+ {
+ namerec = names->names + i;
+ namerec->string = storage + names->names[i].stringOffset;
+
+/* It is possible (but rather unlikely) that a new platform ID will be */
+/* added by Apple, so we can't rule out IDs > 3. */
+
+#if 0
+ if ( namerec->platformID <= 3 )
+ namerec->string = storage + names->names[i].stringOffset;
+ else
+ {
+ namerec->string = NULL;
+ namerec->stringLength = 0;
+ }
+#endif
+ }
+ }
+
+#ifdef DEBUG_LEVEL_TRACE
+
+ for ( i = 0; i < names->numNameRecords; i++ )
+ {
+ int j;
+
+
+ PTRACE2(( "%d %d %x %d ",
+ names->names[i].platformID,
+ names->names[i].encodingID,
+ names->names[i].languageID,
+ names->names[i].nameID ));
+
+ /* I know that M$ encoded strings are Unicode, */
+ /* but this works reasonable well for debugging purposes. */
+ for ( j = 0; j < names->names[i].stringLength; j++ )
+ {
+ if (names->names[i].string)
+ {
+ Char c = *(names->names[i].string + j);
+
+
+ if ( (Byte)c < 128 )
+ PTRACE2(( "%c", c ));
+ }
+ }
+
+ PTRACE2(( "\n" ));
+ }
+
+#endif /* DEBUG_LEVEL_TRACE */
+
+ PTRACE2(( "loaded\n" ));
+ return TT_Err_Ok;
+
+ Fail_Storage:
+ FREE( storage );
+
+ Fail:
+ Free_TrueType_Names( face );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Free_TrueType_Names
+ *
+ * Description : Frees a name table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : TT_Err_Ok.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Free_TrueType_Names( PFace face )
+ {
+ TName_Table* names = &face->nameTable;
+
+
+ /* free strings table */
+ FREE( names->names );
+
+ /* free strings storage */
+ FREE( names->storage );
+
+ names->numNameRecords = 0;
+ names->format = 0;
+ names->storageOffset = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_CVT
+ *
+ * Description : Loads cvt table into resident table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_CVT( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long n, limit;
+
+
+ PTRACE2(( "CVT " ));
+
+ if ( ( n = TT_LookUp_Table( face, TTAG_cvt ) ) < 0 )
+ {
+ PTRACE2(( "is missing!\n" ));
+
+ face->cvtSize = 0;
+ face->cvt = NULL;
+ return TT_Err_Ok;
+ }
+
+ face->cvtSize = face->dirTables[n].Length / 2;
+
+ if ( ALLOC_ARRAY( face->cvt,
+ face->cvtSize,
+ Short ) )
+ return error;
+
+ if ( FILE_Seek( face->dirTables[n].Offset ) ||
+ ACCESS_Frame( face->cvtSize * 2L ) )
+ return error;
+
+ limit = face->cvtSize;
+
+ for ( n = 0; n < limit; n++ )
+ face->cvt[n] = GET_Short();
+
+ FORGET_Frame();
+
+ PTRACE2(( "loaded\n" ));
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_CMap
+ *
+ * Description : Loads the cmap directory in memory.
+ * The cmaps themselves are loaded in ttcmap.c .
+ *
+ * Input : face
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_CMap( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long off, table_start;
+ Long n, limit;
+
+ TCMapDir cmap_dir;
+ TCMapDirEntry entry_;
+ PCMapTable cmap;
+
+
+ PTRACE2(( "CMaps " ));
+
+ if ( ( n = TT_LookUp_Table( face, TTAG_cmap ) ) < 0 )
+ return TT_Err_CMap_Table_Missing;
+
+ table_start = face->dirTables[n].Offset;
+
+ if ( ( FILE_Seek( table_start ) ) ||
+ ( ACCESS_Frame( 4L ) ) ) /* 4 bytes cmap header */
+ return error;
+
+ cmap_dir.tableVersionNumber = GET_UShort();
+ cmap_dir.numCMaps = GET_UShort();
+
+ FORGET_Frame();
+
+ off = FILE_Pos(); /* save offset to cmapdir[] which follows */
+
+ /* save space in face table for cmap tables */
+ if ( ALLOC_ARRAY( face->cMaps,
+ cmap_dir.numCMaps,
+ TCMapTable ) )
+ return error;
+
+ face->numCMaps = cmap_dir.numCMaps;
+
+ limit = face->numCMaps;
+ cmap = face->cMaps;
+
+ for ( n = 0; n < limit; n++ )
+ {
+ if ( FILE_Seek( off ) ||
+ ACCESS_Frame( 8L ) )
+ return error;
+
+ /* extra code using entry_ for platxxx could be cleaned up later */
+ cmap->loaded = FALSE;
+ cmap->platformID = entry_.platformID = GET_UShort();
+ cmap->platformEncodingID = entry_.platformEncodingID = GET_UShort();
+
+ entry_.offset = GET_Long();
+
+ FORGET_Frame();
+
+ off = FILE_Pos();
+
+ if ( FILE_Seek( table_start + entry_.offset ) ||
+ ACCESS_Frame( 6L ) )
+ return error;
+
+ cmap->format = GET_UShort();
+ cmap->length = GET_UShort();
+ cmap->version = GET_UShort();
+
+ FORGET_Frame();
+
+ cmap->offset = FILE_Pos();
+
+ cmap++;
+ }
+
+ PTRACE2(( "loaded\n" ));
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Programs
+ *
+ * Description : Loads the font (fpgm) and cvt programs into the
+ * face table.
+ *
+ * Input : face
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Programs( PFace face )
+ {
+ DEFINE_LOCALS_WO_FRAME;
+
+ Long n;
+
+
+ PTRACE2(( "Font program " ));
+
+ /* The font program is optional */
+ if ( ( n = TT_LookUp_Table( face, TTAG_fpgm ) ) < 0 )
+ {
+ face->fontProgram = NULL;
+ face->fontPgmSize = 0;
+
+ PTRACE2(( "is missing!\n" ));
+ }
+ else
+ {
+ face->fontPgmSize = face->dirTables[n].Length;
+
+ if ( ALLOC( face->fontProgram,
+ face->fontPgmSize ) ||
+ FILE_Read_At( face->dirTables[n].Offset,
+ (void*)face->fontProgram,
+ face->fontPgmSize ) )
+ return error;
+
+ PTRACE2(( "loaded, %12d bytes\n", face->fontPgmSize ));
+ }
+
+ PTRACE2(( "Prep program " ));
+
+ if ( ( n = TT_LookUp_Table( face, TTAG_prep ) ) < 0 )
+ {
+ face->cvtProgram = NULL;
+ face->cvtPgmSize = 0;
+
+ PTRACE2(( "is missing!\n" ));
+ }
+ else
+ {
+ face->cvtPgmSize = face->dirTables[n].Length;
+
+ if ( ALLOC( face->cvtProgram,
+ face->cvtPgmSize ) ||
+ FILE_Read_At( face->dirTables[n].Offset,
+ (void*)face->cvtProgram,
+ face->cvtPgmSize ) )
+ return error;
+
+ PTRACE2(( "loaded, %12d bytes\n", face->cvtPgmSize ));
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_OS_2
+ *
+ * Description : Loads the OS2 Table.
+ *
+ * Input : face
+ *
+ * Output : Error code.
+ *
+ * NOTE : This function used to be named Load_TrueType_OS2.
+ * We changed its name to avoid a name clash (OS2 happens
+ * to be a reserved name on some OS/2 compilers...)
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_OS_2( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long i;
+ TT_OS2* os2;
+
+
+ PTRACE2(( "OS/2 Table " ));
+
+ /* We now support old Mac fonts where the OS/2 table doesn't */
+ /* exist. Simply put, we set the `version' field to 0xFFFF */
+ /* and test this value each time we need to access the table. */
+ if ( ( i = TT_LookUp_Table( face, TTAG_OS2 ) ) < 0 )
+ {
+ PTRACE2(( "is missing\n!" ));
+ face->os2.version = 0xFFFF;
+ error = TT_Err_Ok;
+ return TT_Err_Ok;
+ }
+
+ if ( FILE_Seek( face->dirTables[i].Offset ) ||
+ ACCESS_Frame( 78L ) )
+ return error;
+
+ os2 = &face->os2;
+
+ os2->version = GET_UShort();
+ os2->xAvgCharWidth = GET_Short();
+ os2->usWeightClass = GET_UShort();
+ os2->usWidthClass = GET_UShort();
+ os2->fsType = GET_Short();
+ os2->ySubscriptXSize = GET_Short();
+ os2->ySubscriptYSize = GET_Short();
+ os2->ySubscriptXOffset = GET_Short();
+ os2->ySubscriptYOffset = GET_Short();
+ os2->ySuperscriptXSize = GET_Short();
+ os2->ySuperscriptYSize = GET_Short();
+ os2->ySuperscriptXOffset = GET_Short();
+ os2->ySuperscriptYOffset = GET_Short();
+ os2->yStrikeoutSize = GET_Short();
+ os2->yStrikeoutPosition = GET_Short();
+ os2->sFamilyClass = GET_Short();
+
+ for ( i = 0; i < 10; i++ )
+ os2->panose[i] = GET_Byte();
+
+ os2->ulUnicodeRange1 = GET_ULong();
+ os2->ulUnicodeRange2 = GET_ULong();
+ os2->ulUnicodeRange3 = GET_ULong();
+ os2->ulUnicodeRange4 = GET_ULong();
+
+ for ( i = 0; i < 4; i++ )
+ os2->achVendID[i] = GET_Byte();
+
+ os2->fsSelection = GET_UShort();
+ os2->usFirstCharIndex = GET_UShort();
+ os2->usLastCharIndex = GET_UShort();
+ os2->sTypoAscender = GET_Short();
+ os2->sTypoDescender = GET_Short();
+ os2->sTypoLineGap = GET_Short();
+ os2->usWinAscent = GET_UShort();
+ os2->usWinDescent = GET_UShort();
+
+ FORGET_Frame();
+
+ os2->ulCodePageRange1 = 0;
+ os2->ulCodePageRange2 = 0;
+ os2->sxHeight = 0;
+ os2->sCapHeight = 0;
+ os2->usDefaultChar = 0;
+ os2->usBreakChar = 0;
+ os2->usMaxContext = 0;
+
+ if ( os2->version >= 0x0001 )
+ {
+ /* only version 1 tables */
+
+ if ( ACCESS_Frame( 8L ) ) /* read into frame */
+ return error;
+
+ os2->ulCodePageRange1 = GET_ULong();
+ os2->ulCodePageRange2 = GET_ULong();
+
+ FORGET_Frame();
+
+ if ( os2->version >= 0x0002 )
+ {
+ /* only version 2 tables */
+
+ if ( ACCESS_Frame( 10L ) )
+ return error;
+
+ os2->sxHeight = GET_Short();
+ os2->sCapHeight = GET_Short();
+ os2->usDefaultChar = GET_UShort();
+ os2->usBreakChar = GET_UShort();
+ os2->usMaxContext = GET_UShort();
+
+ FORGET_Frame();
+ }
+ }
+
+ PTRACE2(( "loaded\n" ));
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_PostScript
+ *
+ * Description : Loads the post table into face table.
+ *
+ * Input : face face table to look for
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_PostScript( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ Long i;
+
+ TT_Postscript* post = &face->postscript;
+
+
+ PTRACE2(( "PostScript " ));
+
+ if ( ( i = TT_LookUp_Table( face, TTAG_post ) ) < 0 )
+ return TT_Err_Post_Table_Missing;
+
+ if ( FILE_Seek( face->dirTables[i].Offset ) ||
+ ACCESS_Frame( 32L ) )
+ return error;
+
+ /* read frame data into face table */
+
+ post->FormatType = GET_ULong();
+ post->italicAngle = GET_ULong();
+ post->underlinePosition = GET_Short();
+ post->underlineThickness = GET_Short();
+ post->isFixedPitch = GET_ULong();
+ post->minMemType42 = GET_ULong();
+ post->maxMemType42 = GET_ULong();
+ post->minMemType1 = GET_ULong();
+ post->maxMemType1 = GET_ULong();
+
+ FORGET_Frame();
+
+ /* we don't load the glyph names, we do that in a */
+ /* library extension (ftxpost). */
+
+ PTRACE2(( "loaded\n" ));
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Hdmx
+ *
+ * Description : Loads the horizontal device metrics table.
+ *
+ * Input : face face object to look for
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Hdmx( PFace face )
+ {
+ DEFINE_LOCALS;
+
+ TT_Hdmx_Record* rec;
+ TT_Hdmx hdmx;
+ Long table;
+ UShort n, num_glyphs;
+ Long record_size;
+
+
+ hdmx.version = 0;
+ hdmx.num_records = 0;
+ hdmx.records = 0;
+
+ face->hdmx = hdmx;
+
+ if ( ( table = TT_LookUp_Table( face, TTAG_hdmx ) ) < 0 )
+ return TT_Err_Ok;
+
+ if ( FILE_Seek( face->dirTables[table].Offset ) ||
+ ACCESS_Frame( 8L ) )
+ return error;
+
+ hdmx.version = GET_UShort();
+ hdmx.num_records = GET_Short();
+ record_size = GET_Long();
+
+ FORGET_Frame();
+
+ /* Only recognize format 0 */
+
+ if ( hdmx.version != 0 )
+ return TT_Err_Ok;
+
+ if ( ALLOC( hdmx.records, sizeof ( TT_Hdmx_Record ) * hdmx.num_records ) )
+ return error;
+
+ num_glyphs = face->numGlyphs;
+ record_size -= num_glyphs+2;
+ rec = hdmx.records;
+
+ for ( n = 0; n < hdmx.num_records; n++ )
+ {
+ /* read record */
+
+ if ( ACCESS_Frame( 2L ) )
+ goto Fail;
+
+ rec->ppem = GET_Byte();
+ rec->max_width = GET_Byte();
+
+ FORGET_Frame();
+
+ if ( ALLOC( rec->widths, num_glyphs ) ||
+ FILE_Read( rec->widths, num_glyphs ) )
+ goto Fail;
+
+ /* skip padding bytes */
+ if ( record_size > 0 )
+ if ( FILE_Skip( record_size ) )
+ goto Fail;
+
+ rec++;
+ }
+
+ face->hdmx = hdmx;
+
+ return TT_Err_Ok;
+
+ Fail:
+ for ( n = 0; n < hdmx.num_records; n++ )
+ FREE( hdmx.records[n].widths );
+
+ FREE( hdmx.records );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Free_TrueType_Hdmx
+ *
+ * Description : Frees the horizontal device metrics table.
+ *
+ * Input : face face object to look for
+ *
+ * Output : TT_Err_Ok.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Free_TrueType_Hdmx( PFace face )
+ {
+ UShort n;
+
+
+ if ( !face )
+ return TT_Err_Ok;
+
+ for ( n = 0; n < face->hdmx.num_records; n++ )
+ FREE( face->hdmx.records[n].widths );
+
+ FREE( face->hdmx.records );
+ face->hdmx.num_records = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Load_TrueType_Any
+ *
+ * Description : Loads any font table into client memory. Used by
+ * the TT_Get_Font_Data() API function.
+ *
+ * Input : face face object to look for
+ *
+ * tag tag of table to load. Use the value 0 if you
+ * want to access the whole font file, else set
+ * this parameter to a valid TrueType table tag
+ * that you can forge with the MAKE_TT_TAG
+ * macro.
+ *
+ * offset starting offset in the table (or the file
+ * if tag == 0 )
+ *
+ * buffer address of target buffer
+ *
+ * length address of decision variable :
+ *
+ * if length == NULL :
+ * load the whole table. returns an
+ * an error if 'offset' == 0 !!
+ *
+ * if *length == 0 :
+ * exit immediately, returning the
+ * length of the given table, or of
+ * the font file, depending on the
+ * value of 'tag'
+ *
+ * if *length != 0 :
+ * load the next 'length' bytes of
+ * table or font, starting at offset
+ * 'offset' (in table or font too).
+ *
+ * Output : Error condition
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Load_TrueType_Any( PFace face,
+ ULong tag,
+ Long offset,
+ void* buffer,
+ Long* length )
+ {
+ TT_Stream stream;
+ TT_Error error;
+ Long table;
+ ULong size;
+
+
+ if ( tag != 0 )
+ {
+ /* look for tag in font directory */
+ table = TT_LookUp_Table( face, tag );
+ if ( table < 0 )
+ return TT_Err_Table_Missing;
+
+ offset += face->dirTables[table].Offset;
+ size = face->dirTables[table].Length;
+ }
+ else
+ /* tag = 0 -- the use want to access the font file directly */
+ size = TT_Stream_Size( face->stream );
+
+ if ( length && *length == 0 )
+ {
+ *length = size;
+ return TT_Err_Ok;
+ }
+
+ if ( length )
+ size = *length;
+
+ if ( !USE_Stream( face->stream, stream ) )
+ (void)FILE_Read_At( offset, buffer, size );
+ DONE_Stream( stream );
+
+ return error;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttload.h b/Build/source/libs/freetype/lib/ttload.h
new file mode 100644
index 00000000000..d5f74d40e17
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttload.h
@@ -0,0 +1,238 @@
+/*******************************************************************
+ *
+ * ttload.h 1.2
+ *
+ * TrueType Tables Loader.
+ *
+ * Copyright 1996-2002 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.
+ *
+ *
+ * Changes between 1.2 and 1.1 :
+ *
+ * - the macros are now in ttfile.h (with their underlying functions)
+ *
+ * Changes between 1.1 and 1.0 :
+ *
+ * - add function Load_TrueType_Any used by TT_Get_Font_Data
+ *
+ ******************************************************************/
+
+#ifndef TTLOAD_H
+#define TTLOAD_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+#include "ttobjs.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ FT_EXPORT_DEF( Long )
+ TT_LookUp_Table( PFace face,
+ ULong tag );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Directory( PFace face,
+ ULong faceIndex );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_MaxProfile( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Gasp( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Header( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Locations( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Names( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_CVT( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_CMap( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Programs( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_OS_2( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_PostScript( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Hdmx( PFace face );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Metrics_Header( PFace face,
+ Bool vertical );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Load_TrueType_Any( PFace face,
+ ULong tag,
+ Long offset,
+ void* buffer,
+ Long* length );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Free_TrueType_Names( PFace face );
+ FT_INTERNAL_DEF( TT_Error )
+ Free_TrueType_Hdmx ( PFace face );
+
+
+/* The following macros are defined to simplify the writing of */
+/* the various table and glyph loaders. */
+
+/* For examples see the code in ttload.c, ttgload.c etc. */
+
+#define USE_Stream( original, duplicate ) \
+ ( (error = TT_Use_Stream( original, &duplicate )) != TT_Err_Ok )
+
+#define DONE_Stream( _stream ) \
+ TT_Done_Stream( &_stream )
+
+/* Define a file frame -- use it only when needed */
+#define DEFINE_A_FRAME TFileFrame frame = TT_Null_FileFrame
+
+/* Define a stream -- use it only when needed */
+#define DEFINE_A_STREAM TT_Stream stream
+
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE /* re-entrant implementation */
+
+/* The following macros define the necessary local */
+/* variables used to access streams and frames. */
+
+/* Define stream locals with frame */
+#define DEFINE_STREAM_LOCALS \
+ TT_Error error; \
+ DEFINE_A_STREAM; \
+ DEFINE_A_FRAME
+
+/* Define stream locals without frame */
+#define DEFINE_STREAM_LOCALS_WO_FRAME \
+ TT_Error error; \
+ DEFINE_A_STREAM
+
+/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
+#define DEFINE_LOAD_LOCALS( STREAM ) \
+ TT_Error error; \
+ DEFINE_A_STREAM = (STREAM); \
+ DEFINE_A_FRAME
+
+/* Define locals without frame with a predefined stream - see ttload.c */
+#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
+ TT_Error error; \
+ DEFINE_A_STREAM = (STREAM)
+
+/* Define all locals necessary to access a font file */
+#define DEFINE_ALL_LOCALS \
+ TT_Error error; \
+ DEFINE_A_STREAM; \
+ DEFINE_A_FRAME
+
+
+#define ACCESS_Frame( _size_ ) \
+ ( (error = TT_Access_Frame( stream, \
+ &frame, \
+ (Long)(_size_) )) != TT_Err_Ok )
+#define CHECK_ACCESS_Frame( _size_ ) \
+ ( (error = TT_Check_And_Access_Frame( stream, \
+ &frame, \
+ (Long)(_size_) )) != TT_Err_Ok )
+#define FORGET_Frame() \
+ ( (void)TT_Forget_Frame( stream, &frame ) )
+
+#define GET_Byte() TT_Get_Byte ( &frame )
+#define GET_Char() TT_Get_Char ( &frame )
+#define GET_UShort() TT_Get_UShort( &frame )
+#define GET_Short() TT_Get_Short ( &frame )
+#define GET_Long() TT_Get_Long ( &frame )
+#define GET_ULong() TT_Get_ULong ( &frame )
+#define GET_Tag4() TT_Get_ULong ( &frame )
+
+#define FILE_Pos() TT_File_Pos ( stream )
+
+#define FILE_Seek( _position_ ) \
+ ( (error = TT_Seek_File( stream, \
+ (Long)(_position_) )) != TT_Err_Ok )
+#define FILE_Skip( _distance_ ) \
+ ( (error = TT_Skip_File( stream, \
+ (Long)(_distance_) )) != TT_Err_Ok )
+#define FILE_Read( buffer, count ) \
+ ( (error = TT_Read_File ( stream, \
+ buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+#define FILE_Read_At( pos, buffer, count ) \
+ ( (error = TT_Read_At_File( stream, \
+ (Long)(pos), \
+ buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+
+#else /* thread-safe implementation */
+
+/* Define stream locals with frame -- nothing in thread-safe mode */
+#define DEFINE_STREAM_LOCALS \
+ TT_Error error
+
+/* Define stream locals without frame -- nothing in thread-safe mode */
+#define DEFINE_STREAM_LOCALS_WO_FRAME \
+ TT_Error error
+
+/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
+#define DEFINE_LOAD_LOCALS( STREAM ) \
+ TT_Error error
+
+
+/* Define locals without frame with a predefined stream - see ttload.c */
+#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
+ TT_Error error
+
+/* Define all locals necessary to access a font file */
+#define DEFINE_ALL_LOCALS \
+ TT_Error error; \
+ DEFINE_A_STREAM
+
+
+#define ACCESS_Frame( _size_ ) \
+ ( (error = TT_Access_Frame( (Long)(_size_) )) != TT_Err_Ok )
+#define CHECK_ACCESS_Frame( _size_ ) \
+ ( (error = TT_Check_And_Access_Frame( (Long)(_size_) )) != TT_Err_Ok )
+#define FORGET_Frame() \
+ ( (void)TT_Forget_Frame() )
+
+#define GET_Byte() TT_Get_Byte ()
+#define GET_Char() TT_Get_Char ()
+#define GET_UShort() TT_Get_UShort()
+#define GET_Short() TT_Get_Short ()
+#define GET_Long() TT_Get_Long ()
+#define GET_ULong() TT_Get_ULong ()
+#define GET_Tag4() TT_Get_ULong ()
+
+#define FILE_Pos() TT_File_Pos()
+
+#define FILE_Seek( _position_ ) \
+ ( (error = TT_Seek_File( (Long)(_position_) )) != TT_Err_Ok )
+#define FILE_Skip( _distance_ ) \
+ ( (error = TT_Skip_File( (Long)(_distance_) )) != TT_Err_Ok )
+#define FILE_Read( buffer, count ) \
+ ( (error = TT_Read_File ( buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+#define FILE_Read_At( pos, buffer, count ) \
+ ( (error = TT_Read_At_File( (Long)(pos), \
+ buffer, \
+ (Long)(count) )) != TT_Err_Ok )
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTLOAD_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttmemory.c b/Build/source/libs/freetype/lib/ttmemory.c
new file mode 100644
index 00000000000..bdfa0cfe62b
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttmemory.c
@@ -0,0 +1,399 @@
+/*******************************************************************
+ *
+ * ttmemory.c 1.2
+ *
+ * Memory management component (body).
+ *
+ * Copyright 1996-2000 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.
+ *
+ *
+ * Changes between 1.1 and 1.2:
+ *
+ * - the font pool is gone.
+ *
+ * - introduced the FREE macro and the Free function for
+ * future use in destructors.
+ *
+ * - Init_FontPool() is now a macro to allow the compilation of
+ * 'legacy' applications (all four test programs have been updated).
+ *
+ ******************************************************************/
+
+#include "ttdebug.h"
+#include "ttmemory.h"
+#include "ttengine.h"
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_memory
+
+
+#ifdef DEBUG_MEMORY
+
+#include <stdio.h>
+
+#define MAX_TRACKED_BLOCKS 4096
+
+ struct TMemRec_
+ {
+ void* base;
+ Long size;
+ };
+
+ typedef struct TMemRec_ TMemRec;
+
+ static TMemRec pointers[MAX_TRACKED_BLOCKS + 1];
+
+ static Int num_alloc;
+ static Int num_free;
+ static Int num_realloc; /* counts only `real' reallocations
+ (i.e., an existing buffer will be resized
+ to a value larger than zero */
+
+ static Int fail_alloc;
+ static Int fail_realloc;
+ static Int fail_free;
+
+#endif /* DEBUG_MEMORY */
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ Long TTMemory_Allocated;
+ Long TTMemory_MaxAllocated;
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : TT_Alloc
+ *
+ * Description : Allocates memory from the heap buffer.
+ *
+ * Input : Size size of the memory to be allocated
+ * P pointer to a buffer pointer
+ *
+ * Output : Error code.
+ *
+ * NOTE : The newly allocated block should _always_ be zeroed
+ * on return. Many parts of the engine rely on this to
+ * work properly.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Alloc( ULong Size,
+ void** P )
+ {
+#ifdef DEBUG_MEMORY
+ Int i;
+#endif
+
+
+ if ( !P )
+ return TT_Err_Invalid_Argument;
+
+ if ( Size > (size_t)-1 )
+ return TT_Err_Out_Of_Memory;
+ if ( Size > 0 )
+ {
+ *P = (void*)malloc( Size );
+ if ( !*P )
+ return TT_Err_Out_Of_Memory;
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated += Size;
+ TTMemory_MaxAllocated += Size;
+#endif
+
+#ifdef DEBUG_MEMORY
+
+ num_alloc++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != NULL )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_alloc++;
+ else
+ {
+ pointers[i].base = *P;
+ pointers[i].size = Size;
+ }
+
+#endif /* DEBUG_MEMORY */
+
+ MEM_Set( *P, 0, Size );
+ }
+ else
+ *P = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
+
+/*******************************************************************
+ *
+ * Function : TT_Realloc
+ *
+ * Description : Reallocates memory from the heap buffer.
+ *
+ * Input : Size new size of the memory to be allocated;
+ * if zero, TT_Free() will be called
+ * P pointer to a buffer pointer; if *P == NULL,
+ * TT_Alloc() will be called
+ *
+ * Output : Error code.
+ *
+ * NOTES : It's not necessary to zero the memory in case the
+ * reallocated buffer is larger than before -- the
+ * application has to take care of this.
+ *
+ * If the memory request fails, TT_Free() will be
+ * called on *P, and TT_Err_Out_Of_Memory returned.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Realloc( ULong Size,
+ void** P )
+ {
+ void* Q;
+
+#ifdef DEBUG_MEMORY
+ Int i;
+#endif
+
+
+ if ( !P )
+ return TT_Err_Invalid_Argument;
+
+ if ( !*P )
+ return TT_Alloc( Size, P );
+
+ if ( Size == 0 )
+ return TT_Free( P );
+
+ if ( Size > (size_t)-1 )
+ {
+ TT_Free( *P );
+ return TT_Err_Out_Of_Memory;
+ }
+
+ Q = (void*)realloc( *P, Size );
+ if ( !Q )
+ {
+ TT_Free( *P );
+ return TT_Err_Out_Of_Memory;
+ }
+
+#ifdef DEBUG_MEMORY
+
+ num_realloc++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_realloc++;
+ else
+ {
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated += Size - pointers[i].size;
+ if ( Size > pointers[i].size )
+ TTMemory_MaxAllocated += Size - pointers[i].size;
+#endif
+
+ pointers[i].base = Q;
+ pointers[i].size = Size;
+ }
+#endif /* DEBUG_MEMORY */
+
+ *P = Q;
+
+ return TT_Err_Ok;
+ }
+
+
+#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
+
+
+/*******************************************************************
+ *
+ * Function : TT_Free
+ *
+ * Description : Releases a previously allocated block of memory.
+ *
+ * Input : P pointer to memory block
+ *
+ * Output : Always SUCCESS.
+ *
+ * Note : The pointer must _always_ be set to NULL by this function.
+ *
+ ******************************************************************/
+
+ FT_EXPORT_FUNC( TT_Error )
+ TT_Free( void** P )
+ {
+#ifdef DEBUG_MEMORY
+ Int i;
+#endif /* DEBUG_MEMORY */
+
+
+ if ( !P || !*P )
+ return TT_Err_Ok;
+
+#ifdef DEBUG_MEMORY
+
+ num_free++;
+
+ i = 0;
+ while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
+ i++;
+
+ if ( i >= MAX_TRACKED_BLOCKS )
+ fail_free++;
+ else
+ {
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated -= pointers[i].size;
+#endif
+
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+#endif /* DEBUG_MEMORY */
+
+ free( *P );
+
+ *P = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTMemory_Init
+ *
+ * Description : Initializes the memory.
+ *
+ * Output : Always SUCCESS.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTMemory_Init( void )
+ {
+#ifdef DEBUG_MEMORY
+ Int i;
+
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ pointers[i].base = NULL;
+ pointers[i].size = 0;
+ }
+
+ num_alloc = 0;
+ num_realloc = 0;
+ num_free = 0;
+
+ fail_alloc = 0;
+ fail_realloc = 0;
+ fail_free = 0;
+#endif
+
+
+#ifndef TT_CONFIG_OPTION_THREAD_SAFE
+ TTMemory_Allocated = 0;
+ TTMemory_MaxAllocated = 0;
+#endif
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTMemory_Done
+ *
+ * Description : Finalizes memory usage.
+ *
+ * Output : Always SUCCESS.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTMemory_Done( void )
+ {
+#ifdef DEBUG_MEMORY
+ Int i, num_leaked, tot_leaked;
+
+
+ num_leaked = 0;
+ tot_leaked = 0;
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ if ( pointers[i].base )
+ {
+ num_leaked ++;
+ tot_leaked += pointers[i].size;
+ }
+ }
+
+ fprintf( stderr,
+ "%d memory allocations, of which %d failed\n",
+ num_alloc,
+ fail_alloc );
+
+ fprintf( stderr,
+ "%d memory reallocations, of which %d failed\n",
+ num_realloc,
+ fail_realloc );
+
+ fprintf( stderr,
+ "%d memory deallocations, of which %d failed\n",
+ num_free,
+ fail_free );
+
+ if ( num_leaked > 0 )
+ {
+ fprintf( stderr,
+ "There are %d leaked memory blocks, totalizing %d bytes\n",
+ num_leaked, tot_leaked );
+
+ for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
+ {
+ if ( pointers[i].base )
+ {
+ fprintf( stderr,
+ "index: %4d (base: $%08lx, size: %08ld)\n",
+ i,
+ (long)pointers[i].base,
+ pointers[i].size );
+ }
+ }
+ }
+ else
+ fprintf( stderr, "No memory leaks!\n" );
+
+#endif /* DEBUG_MEMORY */
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttmemory.h b/Build/source/libs/freetype/lib/ttmemory.h
new file mode 100644
index 00000000000..5173567849f
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttmemory.h
@@ -0,0 +1,129 @@
+/*******************************************************************
+ *
+ * ttmemory.h 1.2
+ *
+ * Memory management component (specification).
+ *
+ * Copyright 1996-2000 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.
+ *
+ * Changes between 1.2 and 1.1:
+ *
+ * - the font pool is gone! All allocations are now performed
+ * with malloc() and free().
+ *
+ * - introduced the FREE() macro and the Free() function for
+ * future use in destructors.
+ *
+ * - Init_FontPool() is now a macro to allow the compilation of
+ * 'legacy' applications (all four test programs have been updated).
+ *
+ ******************************************************************/
+
+#ifndef TTMEMORY_H
+#define TTMEMORY_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+#include <string.h>
+
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#define MEM_Set( dest, byte, count ) memset( dest, byte, count )
+
+#ifdef HAVE_MEMCPY
+#define MEM_Copy( dest, source, count ) memcpy( dest, source, count )
+#else
+#define MEM_Copy( dest, source, count ) bcopy( source, dest, count )
+#endif
+
+#ifdef HAVE_MEMMOVE
+#define MEM_Move( dest, source, count ) memmove( dest, source, count )
+#else
+#define MEM_Move( dest, source, count ) bcopy( source, dest, count )
+#endif
+
+
+#define MEM_Alloc( _pointer_, _size_ ) \
+ TT_Alloc( _size_, (void**)&(_pointer_) )
+
+#define MEM_Realloc( _pointer_, _size_ ) \
+ TT_Realloc( _size_, (void**)&(_pointer_) )
+
+#define ALLOC( _pointer_, _size_ ) \
+ ( ( error = MEM_Alloc( _pointer_, _size_ ) ) != TT_Err_Ok )
+
+#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
+ ( ( error = MEM_Alloc( _pointer_, \
+ (_count_) * sizeof ( _type_ ) ) ) != TT_Err_Ok )
+
+#define REALLOC( _pointer_, _size_ ) \
+ ( ( error = MEM_Realloc( _pointer_, _size_ ) ) != TT_Err_Ok )
+
+#define REALLOC_ARRAY( _pointer_, _count_, _type_ ) \
+ ( (error = MEM_Realloc( _pointer_, \
+ (_count_) * sizeof ( _type_ ) ) ) != TT_Err_Ok )
+
+#define FREE( _pointer_ ) \
+ TT_Free( (void**)&(_pointer_) )
+
+
+ /* Allocate a block of memory of 'Size' bytes from the heap, and */
+ /* sets the pointer '*P' to its address. If 'Size' is 0, or in */
+ /* case of error, the pointer is always set to NULL. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Alloc( ULong Size,
+ void** P );
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
+ /* Reallocates a block of memory pointed to by '*P' to 'Size' */
+ /* bytes from the heap, possibly changing '*P'. If 'Size' is 0, */
+ /* TT_Free() is called, if '*P' is NULL, TT_Alloc() is called. */
+ /* '*P' is freed (if it's non-NULL) in case of error. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Realloc( ULong Size,
+ void** P );
+
+#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
+
+ /* Releases a block that was previously allocated through Alloc. */
+ /* Note that the function returns successfully when P or *P are */
+ /* already NULL. The pointer '*P' is set to NULL on exit in */
+ /* case of success. */
+
+ FT_EXPORT_DEF( TT_Error )
+ TT_Free( void** P );
+
+
+ /* For "legacy" applications, that should be re-coded. */
+ /* Note that this won't release the previously allocated font pool. */
+
+#define Init_FontPool( x, y ) while( 0 ) { }
+
+
+ FT_INTERNAL_DEF( TT_Error )
+ TTMemory_Init( void );
+ FT_INTERNAL_DEF( TT_Error )
+ TTMemory_Done( void );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTMEMORY_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttmutex.c b/Build/source/libs/freetype/lib/ttmutex.c
new file mode 100644
index 00000000000..e7c3b53c671
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttmutex.c
@@ -0,0 +1,85 @@
+/*******************************************************************
+ *
+ * ttmutex.c 1.0
+ *
+ * Mutual exclusion object, single-threaded implementation
+ *
+ * Copyright 1996-2000 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.
+ *
+ * NOTE: This is a generic non-functional implementation
+ * that you are welcome to refine for your own system.
+ *
+ * Please name your system-specific source with a
+ * different name (like ttmutex-os2.c or ttmutex-linux.c)
+ * and change your makefile accordingly.
+ *
+ ******************************************************************/
+
+#include "ttmutex.h"
+
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_mutex
+
+
+/* ANSI C prevents the compilation of empty units. We thus introduce */
+/* a dummy typedef to get rid of compiler warnings/errors. */
+/* Note that gcc's -ansi -pedantic does not report any error here. */
+/* Watcom, VC++ or Borland C++ do however. */
+
+ typedef void _ttmutex_to_satisfy_ANSI_C_;
+
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE
+
+ FT_INTERNAL_FUNC( void )
+ TT_Mutex_Create( TMutex* mutex )
+ {
+ *mutex = (void*)-1;
+ /* Replace this line with your own mutex creation code */
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ TT_Mutex_Delete( TMutex* mutex )
+ {
+ *mutex = (void*)0;
+ /* Replace this line with your own mutex destruction code */
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ TT_Mutex_Lock( TMutex* mutex )
+ {
+ /* NOTE: It is legal to call this function with a NULL argument */
+ /* in which case an immediate return is appropriate. */
+ if ( !mutex )
+ return;
+
+ ; /* Insert your own mutex locking code here */
+ }
+
+
+ FT_INTERNAL_FUNC( void )
+ TT_Mutex_Release( TMutex* mutex )
+ {
+ /* NOTE: It is legal to call this function with a NULL argument */
+ /* in which case an immediate return is appropriate */
+ if ( !mutex )
+ return;
+
+ ; /* Insert your own mutex release code here */
+ }
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttmutex.h b/Build/source/libs/freetype/lib/ttmutex.h
new file mode 100644
index 00000000000..3dae642af99
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttmutex.h
@@ -0,0 +1,63 @@
+/*******************************************************************
+ *
+ * ttmutex.h 1.0
+ *
+ * Mutual exclusion object / dummy generic interface.
+ *
+ * Copyright 1996-2000 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.
+ *
+ * Note: This file provides a generic interface. The implementation
+ * to compile depends on your system and the type of
+ * library you want to build (either singly-threaded,
+ * thread-safe or re-entrant).
+ *
+ * Please read the technical documentation for more details.
+ *
+ ******************************************************************/
+
+#ifndef TTMUTEX_H
+#define TTMUTEX_H
+
+#include "ttconfig.h"
+
+
+ typedef void* TMutex; /* typeless reference to a mutex */
+
+#ifdef TT_CONFIG_OPTION_THREAD_SAFE /* thread-safe and re-entrant builds */
+
+#define MUTEX_Create( mutex ) TT_Mutex_Create ( &(mutex) )
+#define MUTEX_Destroy( mutex ) TT_Mutex_Delete ( &(mutex) )
+#define MUTEX_Lock( mutex ) TT_Mutex_Lock ( &(mutex) )
+#define MUTEX_Release( mutex ) TT_Mutex_Release( &(mutex) )
+
+ FT_INTERNAL_DEF( void )
+ TT_Mutex_Create( TMutex* mutex ); /* Create a new mutex */
+ FT_INTERNAL_DEF( void )
+ TT_Mutex_Delete( TMutex* mutex ); /* Delete a mutex */
+ FT_INTERNAL_DEF( void )
+ TT_Mutex_Lock( TMutex* mutex ); /* Lock a mutex */
+ FT_INTERNAL_DEF( void )
+ TT_Mutex_Release( TMutex* mutex ); /* Release a mutex */
+
+#else /* for the single-thread build */
+
+#define MUTEX_Create( mutex ) /* nothing */
+#define MUTEX_Destroy( mutex ) /* nothing */
+#define MUTEX_Lock( mutex ) /* nothing */
+#define MUTEX_Release( mutex ) /* nothing */
+
+ /* No code will be generated for mutex operations */
+
+#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
+
+#endif /* TTMUTEX_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttobjs.c b/Build/source/libs/freetype/lib/ttobjs.c
new file mode 100644
index 00000000000..3c6331dedcb
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttobjs.c
@@ -0,0 +1,1500 @@
+/*******************************************************************
+ *
+ * ttobjs.c 1.0
+ *
+ * Objects manager.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include "ttobjs.h"
+#include "ttfile.h"
+#include "ttcalc.h"
+#include "ttmemory.h"
+#include "ttload.h"
+#include "ttinterp.h"
+#include "ttdebug.h"
+
+
+/* Add extensions definition */
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+#include "ttextend.h"
+#endif
+
+/* Required by tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_objs
+
+/*******************************************************************
+ *
+ * Function : New_Context
+ *
+ * Description : Creates a new execution context for a given
+ * face object.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( PExecution_Context )
+ New_Context( PFace face )
+ {
+ PEngine_Instance engine;
+ PExecution_Context exec;
+
+
+ if ( !face )
+ return NULL;
+
+ engine = face->engine;
+ CACHE_New( engine->objs_exec_cache, exec, face );
+ return exec;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Done_Context
+ *
+ * Description : Discards an execution context.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Done_Context( PExecution_Context exec )
+ {
+ PEngine_Instance engine;
+
+
+ if ( !exec )
+ return TT_Err_Ok;
+
+ engine = exec->face->engine;
+ return CACHE_Done( engine->objs_exec_cache, exec );
+ }
+
+
+#if 0
+
+/*******************************************************************
+ *
+ * Function : New_Instance
+ *
+ * Description : Creates a new instance for a given face object.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( PInstance )
+ New_Instance( PFace face )
+ {
+ PInstance ins;
+
+
+ if ( !face )
+ return NULL;
+
+ CACHE_New( &face->instances, ins, face );
+
+ return ins;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Done_Instance
+ *
+ * Description : Discards an instance.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Done_Instance( PInstance instance )
+ {
+ return CACHE_Done( &instance->owner->instances, instance );
+ }
+
+#endif
+
+
+/*******************************************************************
+ * *
+ * GLYPH ZONE FUNCTIONS *
+ * *
+ * *
+ *******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : New_Glyph_Zone
+ *
+ * Description : Allocates a new glyph zone
+ *
+ * Input : pts pointer to the target glyph zone record
+ * maxPoints capacity of glyph zone in points
+ * maxContours capacity of glyph zone in contours
+ *
+ * Return : Error code.
+ *
+ *****************************************************************/
+
+ static
+ TT_Error New_Glyph_Zone( PGlyph_Zone pts,
+ UShort maxPoints,
+ UShort maxContours )
+ {
+ TT_Error error;
+
+
+ if ( ALLOC( pts->org, maxPoints * 2 * sizeof ( TT_F26Dot6 ) ) ||
+ ALLOC( pts->cur, maxPoints * 2 * sizeof ( TT_F26Dot6 ) ) ||
+ ALLOC( pts->touch, maxPoints * sizeof ( Byte ) ) ||
+ ALLOC( pts->contours, maxContours * sizeof ( Short ) ) )
+ return error;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Done_Glyph_Zone
+ *
+ * Description : Deallocates a glyph zone
+ *
+ * Input : pts pointer to the target glyph zone record
+ *
+ * Return : Error code.
+ *
+ *****************************************************************/
+
+ static
+ TT_Error Done_Glyph_Zone( PGlyph_Zone pts )
+ {
+ FREE( pts->contours );
+ FREE( pts->touch );
+ FREE( pts->cur );
+ FREE( pts->org );
+
+ return TT_Err_Ok;
+ }
+
+
+
+/*******************************************************************
+ * *
+ * CODERANGE FUNCTIONS *
+ * *
+ *******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : Goto_CodeRange
+ *
+ * Description : Switch to a new code range (updates Code and IP).
+ *
+ * Input : exec target execution context
+ * range new execution code range
+ * IP new IP in new code range
+ *
+ * Output : SUCCESS on success. FAILURE on error (no code range).
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Goto_CodeRange( PExecution_Context exec,
+ Int range,
+ ULong IP )
+ {
+ PCodeRange cr;
+
+
+ if ( range < 1 || range > 3 )
+ return TT_Err_Bad_Argument;
+
+ cr = &exec->codeRangeTable[range - 1];
+
+ if ( cr->Base == NULL )
+ return TT_Err_Invalid_CodeRange;
+
+ /* NOTE: Because the last instruction of a program may be a CALL */
+ /* which will return to the first byte *after* the code */
+ /* range, we test for IP <= Size, instead of IP < Size. */
+
+ if ( IP > cr->Size )
+ return TT_Err_Code_Overflow;
+
+ exec->code = cr->Base;
+ exec->codeSize = cr->Size;
+ exec->IP = IP;
+ exec->curRange = range;
+
+ return TT_Err_Ok;
+ }
+
+
+#if 0
+
+/*******************************************************************
+ *
+ * Function : Get_CodeRange
+ *
+ * Description : Returns a pointer to a given code range. Should
+ * be used only by the debugger. Returns NULL if
+ * 'range' is out of current bounds.
+ *
+ * Input : exec target execution context
+ * range new execution code range
+ *
+ * Output : Pointer to the code range record. NULL on failure.
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( PCodeRange )
+ Get_CodeRange( PExecution_Context exec,
+ Int range )
+ {
+ if ( range < 1 || range > 3 )
+ return NULL;
+ else /* arrays start with 1 in Pascal, and with 0 in C */
+ return &exec->codeRangeTable[range - 1];
+ }
+
+#endif
+
+
+/*******************************************************************
+ *
+ * Function : Set_CodeRange
+ *
+ * Description : Sets a code range.
+ *
+ * Input : exec target execution context
+ * range code range index
+ * base new code base
+ * length range size in bytes
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Set_CodeRange( PExecution_Context exec,
+ Int range,
+ void* base,
+ ULong length )
+ {
+ if ( range < 1 || range > 3 )
+ return TT_Err_Bad_Argument;
+
+ exec->codeRangeTable[range - 1].Base = (Byte*)base;
+ exec->codeRangeTable[range - 1].Size = length;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Clear_CodeRange
+ *
+ * Description : Clears a code range.
+ *
+ * Input : exec target execution context
+ * range code range index
+ *
+ * Output : SUCCESS on success. FAILURE on error.
+ *
+ * Note : Does not set the Error variable.
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Clear_CodeRange( PExecution_Context exec,
+ Int range )
+ {
+ if ( range < 1 || range > 3 )
+ return TT_Err_Bad_Argument;
+
+ exec->codeRangeTable[range - 1].Base = NULL;
+ exec->codeRangeTable[range - 1].Size = 0;
+
+ return TT_Err_Ok;
+ }
+
+
+
+/*******************************************************************
+ * *
+ * EXECUTION CONTEXT ROUTINES *
+ * *
+ *******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : Context_Destroy
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Context_Destroy( void* _context )
+ {
+ PExecution_Context exec = (PExecution_Context)_context;
+
+ if ( !exec )
+ return TT_Err_Ok;
+
+ /* free composite load stack */
+ FREE( exec->loadStack );
+ exec->loadSize = 0;
+
+ /* points zone */
+ Done_Glyph_Zone( &exec->pts );
+ exec->maxPoints = 0;
+ exec->maxContours = 0;
+
+ /* free stack */
+ FREE( exec->stack );
+ exec->stackSize = 0;
+
+ /* free call stack */
+ FREE( exec->callStack );
+ exec->callSize = 0;
+ exec->callTop = 0;
+
+ /* free glyph code range */
+ FREE( exec->glyphIns );
+ exec->glyphSize = 0;
+
+ exec->instance = NULL;
+ exec->face = NULL;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Context_Create
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Context_Create( void* _context,
+ void* _face )
+ {
+ PExecution_Context exec = (PExecution_Context)_context;
+
+ PFace face = (PFace)_face;
+ TT_Error error;
+
+
+ /* XXX : We don't reserve arrays anymore, this is done automatically */
+ /* during a "Context_Load".. */
+
+ exec->callSize = 32;
+ if ( ALLOC_ARRAY( exec->callStack, exec->callSize, TCallRecord ) )
+ goto Fail_Memory;
+
+ /* all values in the context are set to 0 already, but this is */
+ /* here as a remainder */
+ exec->maxPoints = 0;
+ exec->maxContours = 0;
+
+ exec->stackSize = 0;
+ exec->loadSize = 0;
+ exec->glyphSize = 0;
+
+ exec->stack = NULL;
+ exec->loadStack = NULL;
+ exec->glyphIns = NULL;
+
+ exec->face = face;
+ exec->instance = NULL;
+
+ return TT_Err_Ok;
+
+ Fail_Memory:
+ Context_Destroy( exec );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Context_Load
+ *
+ *****************************************************************/
+
+/****************************************************************/
+/* */
+/* Update_Max : Reallocate a buffer if it needs to */
+/* */
+/* input: size address of buffer's current size */
+/* expressed in elements */
+/* */
+/* multiplier size in bytes of each element in the */
+/* buffer */
+/* */
+/* buff address of the buffer base pointer */
+/* */
+/* new_max new capacity (size) of the buffer */
+
+ static
+ TT_Error Update_Max( ULong* size,
+ ULong multiplier,
+ void** buff,
+ ULong new_max )
+ {
+ TT_Error error;
+
+ if ( *size < new_max )
+ {
+ FREE( *buff );
+ if ( ALLOC( *buff, new_max * multiplier ) )
+ return error;
+ *size = new_max;
+ }
+ return TT_Err_Ok;
+ }
+
+
+/****************************************************************/
+/* */
+/* Update_Zone: Reallocate a zone if it needs to */
+/* */
+/* input: zone address of the target zone */
+/* */
+/* maxPoints address of the zone's current capacity */
+/* in points */
+/* */
+/* maxContours address of the zone's current capacity */
+/* in contours */
+/* */
+/* newPoints new capacity in points */
+/* */
+/* newContours new capacity in contours */
+/* */
+
+ static
+ TT_Error Update_Zone( PGlyph_Zone zone,
+ UShort* maxPoints,
+ UShort* maxContours,
+ UShort newPoints,
+ UShort newContours )
+ {
+ if ( *maxPoints < newPoints || *maxContours < newContours )
+ {
+ TT_Error error;
+
+
+ Done_Glyph_Zone( zone );
+
+ error = New_Glyph_Zone( zone, newPoints, newContours );
+ if ( error )
+ return error;
+
+ *maxPoints = newPoints;
+ *maxContours = newContours;
+ }
+ return TT_Err_Ok;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Context_Load( PExecution_Context exec,
+ PFace face,
+ PInstance ins )
+ {
+ Int i;
+ TMaxProfile* maxp;
+ TT_Error error;
+
+ exec->face = face;
+ maxp = &face->maxProfile;
+
+ exec->instance = ins;
+
+ if ( ins )
+ {
+ exec->numFDefs = ins->numFDefs;
+ exec->numIDefs = ins->numIDefs;
+ exec->maxFDefs = ins->maxFDefs;
+ exec->maxIDefs = ins->maxIDefs;
+ exec->FDefs = ins->FDefs;
+ exec->IDefs = ins->IDefs;
+ exec->metrics = ins->metrics;
+
+ exec->maxFunc = ins->maxFunc;
+ exec->maxIns = ins->maxIns;
+
+ for ( i = 0; i < MAX_CODE_RANGES; i++ )
+ exec->codeRangeTable[i] = ins->codeRangeTable[i];
+
+ /* set graphics state */
+ exec->GS = ins->GS;
+
+ exec->cvtSize = ins->cvtSize;
+ exec->cvt = ins->cvt;
+
+ exec->storeSize = ins->storeSize;
+ exec->storage = ins->storage;
+
+ exec->twilight = ins->twilight;
+ }
+
+ error = Update_Max( &exec->loadSize,
+ sizeof ( TSubglyph_Record ),
+ (void**)&exec->loadStack,
+ face->maxComponents + 1 );
+ if ( error )
+ return error;
+
+ error = Update_Max( &exec->stackSize,
+ sizeof ( TT_F26Dot6 ),
+ (void**)&exec->stack,
+ maxp->maxStackElements + 32 );
+ /* XXX : We reserve a little more elements on the stack to deal safely */
+ /* with broken fonts like arialbs, courbs, timesbs... */
+ if ( error )
+ return error;
+
+ error = Update_Max( &exec->glyphSize,
+ sizeof ( Byte ),
+ (void**)&exec->glyphIns,
+ maxp->maxSizeOfInstructions );
+ if ( error )
+ return error;
+
+ error = Update_Zone( &exec->pts,
+ &exec->maxPoints,
+ &exec->maxContours,
+ exec->face->maxPoints + 2,
+ exec->face->maxContours );
+ /* XXX : We reserve two positions for the phantom points! */
+ if ( error )
+ return error;
+
+ exec->pts.n_points = 0;
+ exec->pts.n_contours = 0;
+
+ exec->instruction_trap = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Context_Save
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Context_Save( PExecution_Context exec,
+ PInstance ins )
+ {
+ Int i;
+
+ /* XXXX : Will probably disappear soon with all the coderange */
+ /* management, which is now rather obsolete. */
+
+ ins->numFDefs = exec->numFDefs;
+ ins->numIDefs = exec->numIDefs;
+ ins->maxFunc = exec->maxFunc;
+ ins->maxIns = exec->maxIns;
+
+ for ( i = 0; i < MAX_CODE_RANGES; i++ )
+ ins->codeRangeTable[i] = exec->codeRangeTable[i];
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Context_Run
+ *
+ *****************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Context_Run( PExecution_Context exec,
+ Bool debug )
+ {
+ TT_Error error;
+
+
+ if ( (error = Goto_CodeRange( exec,
+ TT_CodeRange_Glyph, 0 )) != TT_Err_Ok )
+ return error;
+
+ exec->zp0 = exec->pts;
+ exec->zp1 = exec->pts;
+ exec->zp2 = exec->pts;
+
+ exec->GS.gep0 = 1;
+ exec->GS.gep1 = 1;
+ exec->GS.gep2 = 1;
+
+ exec->GS.projVector.x = 0x4000;
+ exec->GS.projVector.y = 0x0000;
+
+ exec->GS.freeVector = exec->GS.projVector;
+ exec->GS.dualVector = exec->GS.projVector;
+
+ exec->GS.round_state = 1;
+ exec->GS.loop = 1;
+
+ /* some glyphs leave something on the stack. so we clean it */
+ /* before a new execution. */
+ exec->top = 0;
+ exec->callTop = 0;
+
+ if ( !debug )
+ return RunIns( exec );
+ else
+ return TT_Err_Ok;
+ }
+
+
+ FT_INTERNAL_VAR( const TGraphicsState )
+ Default_GraphicsState =
+ {
+ 0, 0, 0,
+ { 0x4000, 0 },
+ { 0x4000, 0 },
+ { 0x4000, 0 },
+ 1, 64, 1,
+ TRUE, 68, 0, 0, 9, 3,
+ 0, FALSE, 2, 1, 1, 1
+ };
+
+
+
+/*******************************************************************
+ * *
+ * INSTANCE FUNCTIONS *
+ * *
+ * *
+ *******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : Instance_Destroy
+ *
+ * Description :
+ *
+ * Input : _instance the instance object to destroy
+ *
+ * Output : error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Instance_Destroy( void* _instance )
+ {
+ PInstance ins = (PInstance)_instance;
+
+
+ if ( !_instance )
+ return TT_Err_Ok;
+
+ if ( ins->debug )
+ {
+ /* the debug context must be deleted by the debugger itself */
+ ins->context = NULL;
+ ins->debug = FALSE;
+ }
+
+ FREE( ins->cvt );
+ ins->cvtSize = 0;
+
+ /* free storage area */
+ FREE( ins->storage );
+ ins->storeSize = 0;
+
+ /* twilight zone */
+ Done_Glyph_Zone( &ins->twilight );
+
+ FREE( ins->FDefs );
+ FREE( ins->IDefs );
+ ins->numFDefs = 0;
+ ins->numIDefs = 0;
+ ins->maxFDefs = 0;
+ ins->maxIDefs = 0;
+ ins->maxFunc = -1;
+ ins->maxIns = -1;
+
+ ins->owner = NULL;
+ ins->valid = FALSE;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Instance_Create
+ *
+ * Description :
+ *
+ * Input : _instance instance record to initialize
+ * _face parent face object
+ *
+ * Output : Error code. All partially built subtables are
+ * released on error.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Instance_Create( void* _instance,
+ void* _face )
+ {
+ PInstance ins = (PInstance)_instance;
+ PFace face = (PFace)_face;
+ TT_Error error;
+ Int i;
+ UShort n_twilight;
+
+ PMaxProfile maxp = &face->maxProfile;
+
+
+ ins->owner = face;
+ ins->valid = FALSE;
+
+ ins->maxFDefs = maxp->maxFunctionDefs;
+ ins->maxIDefs = maxp->maxInstructionDefs;
+ ins->cvtSize = face->cvtSize;
+ ins->storeSize = maxp->maxStorage;
+
+ /* Set default metrics */
+ {
+ PIns_Metrics metrics = &ins->metrics;
+
+
+ metrics->pointSize = 10 * 64; /* default pointsize = 10pts */
+
+ metrics->x_resolution = 96; /* default resolution = 96dpi */
+ metrics->y_resolution = 96;
+
+ metrics->x_ppem = 0;
+ metrics->y_ppem = 0;
+
+ metrics->rotated = FALSE;
+ metrics->stretched = FALSE;
+
+ /* set default compensation ( all 0 ) */
+ for ( i = 0; i < 4; i++ )
+ metrics->compensations[i] = 0;
+ }
+
+ /* allocate function defs, instruction defs, cvt and storage area */
+ if ( ALLOC_ARRAY( ins->FDefs, ins->maxFDefs, TDefRecord ) ||
+ ALLOC_ARRAY( ins->IDefs, ins->maxIDefs, TDefRecord ) ||
+ ALLOC_ARRAY( ins->cvt, ins->cvtSize, Long ) ||
+ ALLOC_ARRAY( ins->storage, ins->storeSize, Long ) )
+ goto Fail_Memory;
+
+ /* reserve twilight zone */
+ n_twilight = maxp->maxTwilightPoints;
+ error = New_Glyph_Zone( &ins->twilight, n_twilight, 0 );
+ if (error)
+ goto Fail_Memory;
+
+ ins->twilight.n_points = n_twilight;
+
+ return TT_Err_Ok;
+
+ Fail_Memory:
+ Instance_Destroy( ins );
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Instance_Init
+ *
+ * Description : Initialize a fresh new instance.
+ * Executes the font program if any is found.
+ *
+ * Input : _instance the instance object to destroy
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Instance_Init( PInstance ins )
+ {
+ PExecution_Context exec;
+
+ TT_Error error;
+ PFace face = ins->owner;
+
+
+ if ( ins->debug )
+ exec = ins->context;
+ else
+ exec = New_Context( face );
+ /* debugging instances have their own context */
+
+ if ( !exec )
+ return TT_Err_Could_Not_Find_Context;
+
+ ins->GS = Default_GraphicsState;
+
+ ins->numFDefs = 0;
+ ins->numIDefs = 0;
+ ins->maxFunc = -1;
+ ins->maxIns = -1;
+
+ Context_Load( exec, face, ins );
+
+ exec->callTop = 0;
+ exec->top = 0;
+
+ exec->period = 64;
+ exec->phase = 0;
+ exec->threshold = 0;
+
+ {
+ PIns_Metrics metrics = &exec->metrics;
+
+
+ metrics->x_ppem = 0;
+ metrics->y_ppem = 0;
+ metrics->pointSize = 0;
+ metrics->x_scale1 = 0;
+ metrics->x_scale2 = 1;
+ metrics->y_scale1 = 0;
+ metrics->y_scale2 = 1;
+
+ metrics->ppem = 0;
+ metrics->scale1 = 0;
+ metrics->scale2 = 1;
+ metrics->ratio = 1L << 16;
+ }
+
+ exec->instruction_trap = FALSE;
+
+ exec->cvtSize = ins->cvtSize;
+ exec->cvt = ins->cvt;
+
+ exec->F_dot_P = 0x10000;
+
+ /* allow font program execution */
+ Set_CodeRange( exec,
+ TT_CodeRange_Font,
+ face->fontProgram,
+ face->fontPgmSize );
+
+ /* disable CVT and glyph programs coderange */
+ Clear_CodeRange( exec, TT_CodeRange_Cvt );
+ Clear_CodeRange( exec, TT_CodeRange_Glyph );
+
+ if ( face->fontPgmSize > 0 )
+ {
+ error = Goto_CodeRange( exec, TT_CodeRange_Font, 0 );
+ if ( error )
+ goto Fin;
+
+ error = RunIns( exec );
+ }
+ else
+ error = TT_Err_Ok;
+
+ Fin:
+ Context_Save( exec, ins );
+
+ if ( !ins->debug )
+ Done_Context( exec );
+ /* debugging instances keep their context */
+
+ ins->valid = FALSE;
+
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Instance_Reset
+ *
+ * Description : Resets an instance to a new pointsize/transform.
+ * Executes the cvt program if any is found.
+ *
+ * Input : _instance the instance object to destroy
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Instance_Reset( PInstance ins )
+ {
+ PExecution_Context exec;
+
+ TT_Error error;
+ ULong i;
+ UShort j;
+ PFace face;
+
+
+ if ( !ins )
+ return TT_Err_Invalid_Instance_Handle;
+
+ if ( ins->valid )
+ return TT_Err_Ok;
+
+ face = ins->owner;
+
+ if ( ins->metrics.x_ppem < 1 ||
+ ins->metrics.y_ppem < 1 )
+ return TT_Err_Invalid_PPem;
+
+ /* compute new transformation */
+ if ( ins->metrics.x_ppem >= ins->metrics.y_ppem )
+ {
+ ins->metrics.scale1 = ins->metrics.x_scale1;
+ ins->metrics.scale2 = ins->metrics.x_scale2;
+ ins->metrics.ppem = ins->metrics.x_ppem;
+ ins->metrics.x_ratio = 1L << 16;
+ ins->metrics.y_ratio = TT_MulDiv( ins->metrics.y_ppem,
+ 0x10000,
+ ins->metrics.x_ppem );
+ }
+ else
+ {
+ ins->metrics.scale1 = ins->metrics.y_scale1;
+ ins->metrics.scale2 = ins->metrics.y_scale2;
+ ins->metrics.ppem = ins->metrics.y_ppem;
+ ins->metrics.x_ratio = TT_MulDiv( ins->metrics.x_ppem,
+ 0x10000,
+ ins->metrics.y_ppem );
+ ins->metrics.y_ratio = 1L << 16;
+ }
+
+ /* Scale the cvt values to the new ppem. */
+ /* We use by default the y ppem to scale the CVT. */
+
+ for ( i = 0; i < ins->cvtSize; i++ )
+ ins->cvt[i] = TT_MulDiv( face->cvt[i],
+ ins->metrics.scale1,
+ ins->metrics.scale2 );
+
+ /* All twilight points are originally zero */
+ for ( j = 0; j < ins->twilight.n_points; j++ )
+ {
+ ins->twilight.org[j].x = 0;
+ ins->twilight.org[j].y = 0;
+ ins->twilight.cur[j].x = 0;
+ ins->twilight.cur[j].y = 0;
+ }
+
+ /* clear storage area */
+ for ( i = 0; i < ins->storeSize; i++ )
+ ins->storage[i] = 0;
+
+ ins->GS = Default_GraphicsState;
+
+ /* get execution context and run prep program */
+
+ if ( ins->debug )
+ exec = ins->context;
+ else
+ exec = New_Context(face);
+ /* debugging instances have their own context */
+
+ if ( !exec )
+ return TT_Err_Could_Not_Find_Context;
+
+ Context_Load( exec, face, ins );
+
+ Set_CodeRange( exec,
+ TT_CodeRange_Cvt,
+ face->cvtProgram,
+ face->cvtPgmSize );
+
+ Clear_CodeRange( exec, TT_CodeRange_Glyph );
+
+ exec->instruction_trap = FALSE;
+
+ exec->top = 0;
+ exec->callTop = 0;
+
+ if ( face->cvtPgmSize > 0 )
+ {
+ error = Goto_CodeRange( exec, TT_CodeRange_Cvt, 0 );
+ if ( error )
+ goto Fin;
+
+ if ( !ins->debug )
+ error = RunIns( exec );
+ }
+ else
+ error = TT_Err_Ok;
+
+ ins->GS = exec->GS;
+ /* save default graphics state */
+
+ Fin:
+ Context_Save( exec, ins );
+
+ if ( !ins->debug )
+ Done_Context( exec );
+ /* debugging instances keep their context */
+
+ if ( !error )
+ ins->valid = TRUE;
+
+ return error;
+ }
+
+
+
+/*******************************************************************
+ * *
+ * FACE FUNCTIONS *
+ * *
+ * *
+ *******************************************************************/
+
+/*******************************************************************
+ *
+ * Function : Face_Destroy
+ *
+ * Description : The face object destructor.
+ *
+ * Input : _face typeless pointer to the face object to destroy
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Face_Destroy( void* _face )
+ {
+ PFace face = (PFace)_face;
+ UShort n;
+
+
+ if ( !face )
+ return TT_Err_Ok;
+
+ /* well, we assume that no other thread is using the face */
+ /* at this moment, but one is never sure enough. */
+ MUTEX_Lock( face->lock );
+
+ /* first of all, destroys the cached sub-objects */
+ Cache_Destroy( &face->instances );
+ Cache_Destroy( &face->glyphs );
+
+ /* destroy the extensions */
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+ Extension_Destroy( face );
+#endif
+
+ /* freeing the collection table */
+ FREE( face->ttcHeader.TableDirectory );
+ face->ttcHeader.DirCount = 0;
+
+ /* freeing table directory */
+ FREE( face->dirTables );
+ face->numTables = 0;
+
+ /* freeing the locations table */
+ FREE( face->glyphLocations );
+ face->numLocations = 0;
+
+ /* freeing the character mapping tables */
+ for ( n = 0; n < face->numCMaps; n++ )
+ CharMap_Free( face->cMaps + n );
+
+ FREE( face->cMaps );
+ face->numCMaps = 0;
+
+ /* freeing the CVT */
+ FREE( face->cvt );
+ face->cvtSize = 0;
+
+ /* freeing the horizontal metrics */
+ FREE( face->horizontalHeader.long_metrics );
+ FREE( face->horizontalHeader.short_metrics );
+
+ /* freeing the vertical ones, if any */
+ if (face->verticalInfo)
+ {
+ FREE( face->verticalHeader.long_metrics );
+ FREE( face->verticalHeader.short_metrics );
+ face->verticalInfo = 0;
+ }
+
+ /* freeing the programs */
+ FREE( face->fontProgram );
+ FREE( face->cvtProgram );
+ face->fontPgmSize = 0;
+ face->cvtPgmSize = 0;
+
+ /* freeing the gasp table */
+ FREE( face->gasp.gaspRanges );
+ face->gasp.numRanges = 0;
+
+ /* freeing the name table */
+ Free_TrueType_Names( face );
+
+ /* freeing the hdmx table */
+ Free_TrueType_Hdmx( face );
+
+ /* TT_Close_Stream( &face->stream ); -- this is performed by the API */
+
+ /* destroy the mutex */
+ MUTEX_Destroy(face->lock);
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Face_Create
+ *
+ * Description : The face object constructor.
+ *
+ * Input : _face face record to build
+ * _input input stream where to load font data
+ *
+ * Output : Error code.
+ *
+ * NOTE : The input stream is kept in the face object. The
+ * caller shouldn't destroy it after calling Face_Create().
+ *
+ ******************************************************************/
+
+#undef LOAD_
+#define LOAD_( table ) \
+ (error = Load_TrueType_##table (face)) != TT_Err_Ok
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Face_Create( void* _face,
+ void* _input )
+ {
+ PEngine_Instance engine;
+
+ TFont_Input* input = (TFont_Input*)_input;
+ PFace face = (PFace)_face;
+ TT_Error error;
+
+
+ face->stream = input->stream;
+ face->engine = input->engine;
+
+ engine = face->engine;
+
+ MUTEX_Create( face->lock );
+
+ Cache_Create( engine,
+ engine->objs_instance_class,
+ &face->instances,
+ &face->lock );
+
+ Cache_Create( engine,
+ engine->objs_glyph_class,
+ &face->glyphs,
+ &face->lock );
+
+ /* Load collection directory if present, then font directory */
+
+ error = Load_TrueType_Directory( face, input->fontIndex );
+ if ( error )
+ goto Fail;
+
+ /* Load tables */
+
+ if ( LOAD_( Header ) ||
+ LOAD_( MaxProfile ) ||
+ LOAD_( Locations ) ||
+
+ (error = Load_TrueType_Metrics_Header( face, 0 )) != TT_Err_Ok ||
+ /* load the 'hhea' & 'hmtx' tables at once */
+
+ LOAD_( CMap ) ||
+ LOAD_( CVT ) ||
+ LOAD_( Programs ) ||
+ LOAD_( Gasp ) ||
+ LOAD_( Names ) ||
+ LOAD_( OS_2 ) ||
+ LOAD_( PostScript ) ||
+
+ (error = Load_TrueType_Metrics_Header( face, 1 )) != TT_Err_Ok ||
+ /* try to load the 'vhea' & 'vmtx' at once if present */
+
+ LOAD_( Hdmx ) )
+
+ goto Fail;
+
+#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+ if ( ( error = Extension_Create( face ) ) != TT_Err_Ok )
+ return error;
+#endif
+
+ return TT_Err_Ok;
+
+ Fail :
+ Face_Destroy( face );
+ return error;
+ }
+
+#undef LOAD_
+
+
+/*******************************************************************
+ *
+ * Function : Glyph_Destroy
+ *
+ * Description : The glyph object destructor.
+ *
+ * Input : _glyph typeless pointer to the glyph record to destroy
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Glyph_Destroy( void* _glyph )
+ {
+ PGlyph glyph = (PGlyph)_glyph;
+
+
+ if ( !glyph )
+ return TT_Err_Ok;
+
+ glyph->outline.owner = TRUE;
+ return TT_Done_Outline( &glyph->outline );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Glyph_Create
+ *
+ * Description : The glyph object constructor.
+ *
+ * Input : _glyph glyph record to build.
+ * _face the glyph's parent face.
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Glyph_Create( void* _glyph,
+ void* _face )
+ {
+ PFace face = (PFace)_face;
+ PGlyph glyph = (PGlyph)_glyph;
+
+
+ if ( !face )
+ return TT_Err_Invalid_Face_Handle;
+
+ if ( !glyph )
+ return TT_Err_Invalid_Glyph_Handle;
+
+ glyph->face = face;
+
+ /* XXX: Don't forget the space for the 2 phantom points */
+ return TT_New_Outline( glyph->face->maxPoints + 2,
+ glyph->face->maxContours,
+ &glyph->outline );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Scale_X
+ *
+ * Description : scale an horizontal distance from font
+ * units to 26.6 pixels
+ *
+ * Input : metrics pointer to metrics
+ * x value to scale
+ *
+ * Output : scaled value
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Pos )
+ Scale_X( PIns_Metrics metrics,
+ TT_Pos x )
+ {
+ return TT_MulDiv( x, metrics->x_scale1, metrics->x_scale2 );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : Scale_Y
+ *
+ * Description : scale a vertical distance from font
+ * units to 26.6 pixels
+ *
+ * Input : metrics pointer to metrics
+ * y value to scale
+ *
+ * Output : scaled value
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Pos )
+ Scale_Y( PIns_Metrics metrics,
+ TT_Pos y )
+ {
+ return TT_MulDiv( y, metrics->y_scale1, metrics->y_scale2 );
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTObjs_Init
+ *
+ * Description : The TTObjs component initializer. Creates the
+ * object cache classes, as well as the face record
+ * cache.
+ *
+ * Input : engine engine instance
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ static
+ const TCache_Class objs_face_class =
+ {
+ sizeof ( TFace ),
+ -1,
+ Face_Create,
+ Face_Destroy,
+ NULL,
+ NULL
+ };
+
+ static
+ const TCache_Class objs_instance_class =
+ {
+ sizeof ( TInstance ),
+ -1,
+ Instance_Create,
+ Instance_Destroy,
+ NULL,
+ NULL
+ };
+
+ /* Note that we use a cache size of 1 for the execution context. */
+ /* This is to avoid re-creating a new context each time we */
+ /* change one instance's attribute (resolution and/or char sizes) */
+ /* or when we load a glyph. */
+
+ static
+ const TCache_Class objs_exec_class =
+ {
+ sizeof ( TExecution_Context ),
+ 1,
+ Context_Create,
+ Context_Destroy,
+ NULL,
+ NULL
+ };
+
+ static
+ const TCache_Class objs_glyph_class =
+ {
+ sizeof ( TGlyph ),
+ -1,
+ Glyph_Create,
+ Glyph_Destroy,
+ NULL,
+ NULL
+ };
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTObjs_Init( PEngine_Instance engine )
+ {
+ PCache face_cache, exec_cache;
+ TT_Error error;
+
+
+ face_cache = 0;
+ exec_cache = 0;
+
+ if ( ALLOC( face_cache, sizeof ( TCache ) ) ||
+ ALLOC( exec_cache, sizeof ( TCache ) ) )
+ goto Fail;
+
+ /* create face cache */
+ error = Cache_Create( engine, (PCache_Class)&objs_face_class,
+ face_cache, &engine->lock );
+ if ( error )
+ goto Fail;
+
+ engine->objs_face_cache = face_cache;
+
+ error = Cache_Create( engine, (PCache_Class)&objs_exec_class,
+ exec_cache, &engine->lock );
+ if ( error )
+ goto Fail;
+
+ engine->objs_exec_cache = exec_cache;
+
+ engine->objs_face_class = (PCache_Class)&objs_face_class;
+ engine->objs_instance_class = (PCache_Class)&objs_instance_class;
+ engine->objs_execution_class = (PCache_Class)&objs_exec_class;
+ engine->objs_glyph_class = (PCache_Class)&objs_glyph_class;
+
+ goto Exit;
+
+ Fail:
+ FREE( face_cache );
+ FREE( exec_cache );
+
+ Exit:
+ return error;
+ }
+
+
+/*******************************************************************
+ *
+ * Function : TTObjs_Done
+ *
+ * Description : The TTObjs component finalizer.
+ *
+ * Input : engine engine instance
+ *
+ * Output : Error code.
+ *
+ ******************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTObjs_Done( PEngine_Instance engine )
+ {
+ /* destroy all active faces and contexts before releasing the */
+ /* caches */
+ Cache_Destroy( (TCache*)engine->objs_exec_cache );
+ Cache_Destroy( (TCache*)engine->objs_face_cache );
+
+ /* Now frees caches and cache classes */
+ FREE( engine->objs_exec_cache );
+ FREE( engine->objs_face_cache );
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttobjs.h b/Build/source/libs/freetype/lib/ttobjs.h
new file mode 100644
index 00000000000..0457609e366
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttobjs.h
@@ -0,0 +1,881 @@
+/*******************************************************************
+ *
+ * ttobjs.h 1.0
+ *
+ * Objects definition unit.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#ifndef TTOBJS_H
+#define TTOBJS_H
+
+#include "ttconfig.h"
+#include "ttengine.h"
+#include "ttmutex.h"
+#include "ttcache.h"
+#include "tttables.h"
+#include "ttcmap.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* */
+/* This file contains the definitions and methods of the four */
+/* kinds of objects managed by the FreeType engine. These are: */
+/* */
+/* */
+/* Face objects: */
+/* */
+/* There is always one face object per opened TrueType font */
+/* file, and only one. The face object contains data that is */
+/* independent of current transform/scaling/rotation and */
+/* pointsize, or glyph index. This data is made of several */
+/* critical tables that are loaded on face object creation. */
+/* */
+/* A face object tracks all active and recycled objects of */
+/* the instance and execution context classes. Destroying a face */
+/* object will automatically destroy all associated instances. */
+/* */
+/* */
+/* Instance objects: */
+/* */
+/* An instance object always relates to a given face object, */
+/* known as its 'parent' or 'owner', and contains only the */
+/* data that is specific to one given pointsize/transform of */
+/* the face. You can only create an instance from a face object. */
+/* */
+/* An instance's current transform/pointsize can be changed */
+/* at any time using a single high-level API call, */
+/* TT_Reset_Instance(). */
+/* */
+/* Execution Context objects: */
+/* */
+/* An execution context (or context in short) relates to a face. */
+/* It contains the data and tables that are necessary to load */
+/* and hint (i.e. execute the glyph instructions of) one glyph. */
+/* A context is a transient object that is queried/created on */
+/* the fly: client applications never deal with them directly. */
+/* */
+/* */
+/* Glyph objects: */
+/* */
+/* A glyph object contains only the minimal glyph information */
+/* needed to render one glyph correctly. This means that a glyph */
+/* object really contains tables that are sized to hold the */
+/* contents of _any_ glyph of a given face. A client application */
+/* can usually create one glyph object for a given face, then use */
+/* it for all subsequent loads. */
+/* */
+/* Here is an example of a client application : */
+/* (NOTE: No error checking performed here!) */
+/* */
+/* */
+/* TT_Face face; -- face handle */
+/* TT_Instance ins1, ins2; -- two instance handles */
+/* TT_Glyph glyph; -- glyph handle */
+/* */
+/* TT_Init_FreeType(); */
+/* */
+/* -- Initialize the engine. This must be done prior to _any_ */
+/* operation. */
+/* */
+/* TT_Open_Face( "/some/face/name.ttf", &face ); */
+/* */
+/* -- create the face object. This call opens the font file */
+/* */
+/* TT_New_Instance( face, &ins1 ); */
+/* TT_New_Instance( face, &ins2 ); */
+/* */
+/* TT_Set_Instance_PointSize( ins1, 8 ); */
+/* TT_Set_Instance_PointSize( ins2, 12 ); */
+/* */
+/* -- create two distinct instances of the same face */
+/* -- ins1 is pointsize 8 at resolution 96 dpi */
+/* -- ins2 is pointsize 12 at resolution 96 dpi */
+/* */
+/* TT_New_Glyph( face, &glyph ); */
+/* */
+/* -- create a new glyph object which will receive the contents */
+/* of any glyph of 'face' */
+/* */
+/* TT_Load_Glyph( ins1, glyph, 64, DEFAULT_GLYPH_LOAD ); */
+/* */
+/* -- load glyph indexed 64 at pointsize 8 in the 'glyph' object */
+/* -- NOTE: This call will fail if the instance and the glyph */
+/* do not relate to the same face object. */
+/* */
+/* TT_Get_Outline( glyph, &outline ); */
+/* */
+/* -- extract the glyph outline from the object and copies it */
+/* to the 'outline' record */
+/* */
+/* TT_Get_Metrics( glyph, &metrics ); */
+/* */
+/* -- extract the glyph metrics and put them into the 'metrics' */
+/* record */
+/* */
+/* TT_Load_Glyph( ins2, glyph, 64, DEFAULT_GLYPH_LOAD ); */
+/* */
+/* -- load the same glyph at pointsize 12 in the 'glyph' object */
+/* */
+/* */
+/* TT_Close_Face( &face ); */
+/* */
+/* -- destroy the face object. This will destroy 'ins1' and */
+/* 'ins2'. However, the glyph object will still be available */
+/* */
+/* TT_Done_FreeType(); */
+/* */
+/* -- Finalize the engine. This will also destroy all pending */
+/* glyph objects (here 'glyph'). */
+
+ struct TFace_;
+ struct TInstance_;
+ struct TExecution_Context_;
+ struct TGlyph_;
+
+ typedef struct TFace_ TFace;
+ typedef TFace* PFace;
+
+ typedef struct TInstance_ TInstance;
+ typedef TInstance* PInstance;
+
+ typedef struct TExecution_Context_ TExecution_Context;
+ typedef TExecution_Context* PExecution_Context;
+
+ typedef struct TGlyph_ TGlyph;
+ typedef TGlyph* PGlyph;
+
+
+ /*************************************************************/
+ /* */
+ /* ADDITIONAL SUBTABLES */
+ /* */
+ /* These tables are not precisely defined by the specs */
+ /* but their structures is implied by the TrueType font */
+ /* file layout. */
+ /* */
+ /*************************************************************/
+
+ /* Graphics State */
+ /* */
+ /* The Graphics State (GS) is managed by the */
+ /* instruction field, but does not come from */
+ /* the font file. Thus, we can use 'int's */
+ /* where needed. */
+
+ struct TGraphicsState_
+ {
+ UShort rp0;
+ UShort rp1;
+ UShort rp2;
+
+ TT_UnitVector dualVector;
+ TT_UnitVector projVector;
+ TT_UnitVector freeVector;
+
+ Long loop;
+ TT_F26Dot6 minimum_distance;
+ Int round_state;
+
+ Bool auto_flip;
+ TT_F26Dot6 control_value_cutin;
+ TT_F26Dot6 single_width_cutin;
+ TT_F26Dot6 single_width_value;
+ Short delta_base;
+ Short delta_shift;
+
+ Byte instruct_control;
+ Bool scan_control;
+ Int scan_type;
+
+ UShort gep0;
+ UShort gep1;
+ UShort gep2;
+ };
+
+ typedef struct TGraphicsState_ TGraphicsState;
+
+
+ FT_INTERNAL_DEF( const TGraphicsState ) Default_GraphicsState;
+
+
+ /*************************************************************/
+ /* */
+ /* EXECUTION SUBTABLES */
+ /* */
+ /* These sub-tables relate to instruction execution. */
+ /* */
+ /*************************************************************/
+
+#define MAX_CODE_RANGES 3
+
+/* There can only be 3 active code ranges at once: */
+/* - the Font Program */
+/* - the CVT Program */
+/* - a glyph's instructions set */
+
+#define TT_CodeRange_Font 1
+#define TT_CodeRange_Cvt 2
+#define TT_CodeRange_Glyph 3
+
+
+ struct TCodeRange_
+ {
+ PByte Base;
+ ULong Size;
+ };
+
+ typedef struct TCodeRange_ TCodeRange;
+ typedef TCodeRange* PCodeRange;
+
+
+ /* Defintion of a code range */
+ /* */
+ /* Code ranges can be resident to a glyph (i.e. the Font Program) */
+ /* while some others are volatile (Glyph instructions). */
+ /* Tracking the state and presence of code ranges allows function */
+ /* and instruction definitions within a code range to be forgotten */
+ /* when the range is discarded. */
+
+ typedef TCodeRange TCodeRangeTable[MAX_CODE_RANGES];
+
+ /* defines a function/instruction definition record */
+
+ struct TDefRecord_
+ {
+ Int Range; /* in which code range is it located ? */
+ ULong Start; /* where does it start ? */
+ Int Opc; /* function #, or instruction code */
+ Bool Active; /* is it active ? */
+ };
+
+ typedef struct TDefRecord_ TDefRecord;
+ typedef TDefRecord* PDefRecord;
+ typedef TDefRecord* PDefArray;
+
+ /* defines a call record, used to manage function calls. */
+
+ struct TCallRecord_
+ {
+ Int Caller_Range;
+ ULong Caller_IP;
+ Long Cur_Count;
+ ULong Cur_Restart;
+ };
+
+ typedef struct TCallRecord_ TCallRecord;
+ typedef TCallRecord* PCallRecord;
+ typedef TCallRecord* PCallStack; /* defines a simple call stack */
+
+
+ /* This type defining a set of glyph points will be used to represent */
+ /* each zone (regular and twilight) during instructions decoding. */
+ struct TGlyph_Zone_
+ {
+ UShort n_points; /* number of points in zone */
+ Short n_contours; /* number of contours */
+
+ TT_Vector* org; /* original points coordinates */
+ TT_Vector* cur; /* current points coordinates */
+
+ Byte* touch; /* current touch flags */
+ UShort* contours; /* contour end points */
+ };
+
+ typedef struct TGlyph_Zone_ TGlyph_Zone;
+ typedef TGlyph_Zone* PGlyph_Zone;
+
+
+
+#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER
+ /* Normal (indexed) implementation */
+
+#define EXEC_OPS PExecution_Context exc,
+#define EXEC_OP PExecution_Context exc
+#define EXEC_ARGS exc,
+#define EXEC_ARG exc
+
+#else
+ /* Static implementation, with one shared execution context. */
+
+#define EXEC_OPS /* [nothing] */
+#define EXEC_OP /* void */
+#define EXEC_ARGS /* [nothing] */
+#define EXEC_ARG /* void */
+
+#endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */
+
+
+ /* Rounding function, as used by the interpreter */
+ typedef TT_F26Dot6 (*TRound_Function)( EXEC_OPS TT_F26Dot6 distance,
+ TT_F26Dot6 compensation );
+
+ /* Point displacement along the freedom vector routine, as */
+ /* used by the interpreter */
+ typedef void (*TMove_Function)( EXEC_OPS PGlyph_Zone zone,
+ UShort point,
+ TT_F26Dot6 distance );
+
+ /* Distance projection along one of the proj. vectors, as used */
+ /* by the interpreter */
+ typedef TT_F26Dot6 (*TProject_Function)( EXEC_OPS TT_Vector* v1,
+ TT_Vector* v2 );
+
+ /* reading a cvt value. Take care of non-square pixels when needed */
+ typedef TT_F26Dot6 (*TGet_CVT_Function)( EXEC_OPS ULong index );
+
+ /* setting or moving a cvt value. Take care of non-square pixels */
+ /* when needed */
+ typedef void (*TSet_CVT_Function)( EXEC_OPS ULong index,
+ TT_F26Dot6 value );
+
+ /* subglyph transformation record */
+ struct TTransform_
+ {
+ TT_Fixed xx, xy; /* transformation */
+ TT_Fixed yx, yy; /* matrix */
+ TT_F26Dot6 ox, oy; /* offsets */
+ };
+
+ typedef struct TTransform_ TTransform;
+ typedef TTransform* PTransform;
+
+ /* subglyph loading record. Used to load composite components */
+ struct TSubglyph_Record_
+ {
+ Long index; /* subglyph index; initialized with -1 */
+ Bool is_scaled; /* is the subglyph scaled? */
+ Bool is_hinted; /* should it be hinted? */
+ Bool preserve_pps; /* preserve phantom points? */
+
+ Long file_offset;
+
+ TT_Big_Glyph_Metrics metrics;
+
+ TGlyph_Zone zone;
+
+ Long arg1; /* first argument */
+ Long arg2; /* second argument */
+
+ UShort element_flag; /* current load element flag */
+
+ TTransform transform; /* transform */
+
+ TT_Vector pp1, pp2; /* phantom points */
+
+ };
+
+ typedef struct TSubglyph_Record_ TSubglyph_Record;
+ typedef TSubglyph_Record* PSubglyph_Record;
+ typedef TSubglyph_Record* PSubglyph_Stack;
+
+ /* A note regarding non-squared pixels: */
+ /* */
+ /* (This text will probably go into some docs at some time, for */
+ /* now, it is kept there to explain some definitions in the */
+ /* TIns_Metrics record). */
+ /* */
+ /* The CVT is a one-dimensional array containing values that */
+ /* control certain important characteristics in a font, like */
+ /* the height of all capitals, all lowercase letter, default */
+ /* spacing or stem width/height. */
+ /* */
+ /* These values are found in FUnits in the font file, and must be */
+ /* scaled to pixel coordinates before being used by the CVT and */
+ /* glyph programs. Unfortunately, when using distinct x and y */
+ /* resolutions (or distinct x and y pointsizes), there are two */
+ /* possible scalings. */
+ /* */
+ /* A first try was to implement a 'lazy' scheme where all values */
+ /* were scaled when first used. However, while some values are always */
+ /* used in the same direction, and some other are used in many */
+ /* different circumstances and orientations. */
+ /* */
+ /* I have found a simpler way to do the same, and it even seems to */
+ /* work in most of the cases: */
+ /* */
+ /* - all CVT values are scaled to the maximum ppem size */
+ /* */
+ /* - when performing a read or write in the CVT, a ratio factor */
+ /* is used to perform adequate scaling. Example: */
+ /* */
+ /* x_ppem = 14 */
+ /* y_ppem = 10 */
+ /* */
+ /* we choose ppem = x_ppem = 14 as the CVT scaling size. All cvt */
+ /* entries are scaled to it. */
+ /* */
+ /* x_ratio = 1.0 */
+ /* y_ratio = y_ppem/ppem (< 1.0) */
+ /* */
+ /* we compute the current ratio like: */
+ /* */
+ /* - if projVector is horizontal, */
+ /* ratio = x_ratio = 1.0 */
+ /* - if projVector is vertical, */
+ /* ratop = y_ratio */
+ /* - else, */
+ /* ratio = sqrt((proj.x*x_ratio)^2 + (proj.y*y_ratio)^2) */
+ /* */
+ /* reading a cvt value returns ratio * cvt[index] */
+ /* writing a cvt value in pixels cvt[index] / ratio */
+ /* */
+ /* the current ppem is simply ratio * ppem */
+ /* */
+
+ /* metrics used by the instance and execution context objects */
+ struct TIns_Metrics_
+ {
+ TT_F26Dot6 pointSize; /* point size. 1 point = 1/72 inch. */
+
+ UShort x_resolution; /* device horizontal resolution in dpi. */
+ UShort y_resolution; /* device vertical resolution in dpi. */
+
+ UShort x_ppem; /* horizontal pixels per EM */
+ UShort y_ppem; /* vertical pixels per EM */
+
+ Long x_scale1;
+ Long x_scale2; /* used to scale FUnits to fractional pixels */
+
+ Long y_scale1;
+ Long y_scale2; /* used to scale FUnits to fractional pixels */
+
+ /* for non-square pixels */
+ Long x_ratio;
+ Long y_ratio;
+
+ UShort ppem; /* maximum ppem size */
+ Long ratio; /* current ratio */
+ Long scale1;
+ Long scale2; /* scale for ppem */
+
+ TT_F26Dot6 compensations[4]; /* device-specific compensations */
+
+ Bool rotated; /* `is the glyph rotated?'-flag */
+ Bool stretched; /* `is the glyph stretched?'-flag */
+ };
+
+ typedef struct TIns_Metrics_ TIns_Metrics;
+ typedef TIns_Metrics* PIns_Metrics;
+
+
+
+ /***********************************************************************/
+ /* */
+ /* FreeType Face Type */
+ /* */
+ /***********************************************************************/
+
+ struct TFace_
+ {
+ /* parent engine instance for the face object */
+ PEngine_Instance engine;
+
+ /* i/o stream */
+ TT_Stream stream;
+
+ /* used only by the threaded builds of the library */
+ TMutex lock;
+
+ /* TrueType collection header, if any was found */
+ TTTCHeader ttcHeader;
+
+ /* maximum profile table, as found in the TrueType file */
+ TMaxProfile maxProfile;
+
+ /* Note: */
+ /* it seems that some maximum values cannot be */
+ /* taken directly from this table, but rather by */
+ /* combining some of its fields; e.g. the max. */
+ /* number of points seems to be given by */
+ /* MAX( maxPoints, maxCompositePoints ) */
+ /* */
+ /* For this reason, we define later our own */
+ /* max values that are used to load and allocate */
+ /* further tables. */
+
+ TT_Header fontHeader; /* the font header, as */
+ /* found in the TTF file */
+ TT_Horizontal_Header horizontalHeader; /* the horizontal header */
+
+ Bool verticalInfo; /* True when vertical table */
+ TT_Vertical_Header verticalHeader; /* is present in the font */
+
+ TT_OS2 os2; /* 'OS/2' table */
+
+ TT_Postscript postscript; /* 'Post' table */
+
+ TT_Hdmx hdmx; /* 'Hdmx' table */
+
+ TName_Table nameTable; /* name table */
+
+ TGasp gasp; /* the 'gasp' table */
+
+ /* The directory of TrueType tables for this typeface */
+ UShort numTables;
+ PTableDirEntry dirTables;
+
+ /* The directory of character mappings table for */
+ /* this typeface */
+ UShort numCMaps;
+ PCMapTable cMaps;
+
+ /* The glyph locations table */
+ ULong numLocations; /* UShort is not enough */
+#ifndef TT_HUGE_PTR
+ PStorage glyphLocations;
+#else
+ Storage TT_HUGE_PTR * glyphLocations;
+#endif
+
+ /* NOTE : The "hmtx" is now part of the horizontal header */
+
+ /* the font program, if any */
+ ULong fontPgmSize;
+ PByte fontProgram;
+
+ /* the cvt program, if any */
+ ULong cvtPgmSize;
+ PByte cvtProgram;
+
+ /* the original, unscaled, control value table */
+ ULong cvtSize;
+ PShort cvt;
+
+ /* The following values _must_ be set by the */
+ /* maximum profile loader */
+
+ UShort numGlyphs; /* the face's total number of glyphs */
+ UShort maxPoints; /* max glyph points number, simple and composite */
+ UShort maxContours; /* max glyph contours numb, simple and composite */
+ UShort maxComponents; /* max components in a composite glyph */
+
+ /* the following are object caches to track active */
+ /* and recycled instances and execution contexts */
+ /* objects. See 'ttcache.h' */
+
+ TCache instances; /* current instances for this face */
+ TCache glyphs; /* current glyph containers for this face */
+
+
+ /* A typeless pointer to the face object extensions defined */
+ /* in the 'ttextend.*' files. */
+ void* extension;
+ Int n_extensions; /* number of extensions */
+
+ /* Use extensions to provide additional capabilities to the */
+ /* engine. Read the developer's guide in the documentation */
+ /* directory to know how to do that. */
+
+ /* a generic pointer for client use - see TT_Set/Get_Face_Pointer */
+ void* generic;
+ };
+
+
+
+ /***********************************************************************/
+ /* */
+ /* FreeType Instance Type */
+ /* */
+ /***********************************************************************/
+
+ struct TInstance_
+ {
+ PFace owner; /* face object */
+
+ Bool valid;
+
+ TIns_Metrics metrics;
+
+ UShort numFDefs; /* number of function definitions */
+ UShort maxFDefs;
+ PDefArray FDefs; /* table of FDefs entries */
+
+ UShort numIDefs; /* number of instruction definitions */
+ UShort maxIDefs;
+ PDefArray IDefs; /* table of IDefs entries */
+
+ Int maxFunc; /* maximum function definition id */
+ Int maxIns; /* maximum instruction definition id */
+
+ TCodeRangeTable codeRangeTable;
+
+ TGraphicsState GS;
+ TGraphicsState default_GS;
+
+ ULong cvtSize; /* the scaled control value table */
+ PLong cvt;
+
+ ULong storeSize; /* The storage area is now part of the */
+ PLong storage; /* instance */
+
+ TGlyph_Zone twilight; /* The instance's twilight zone */
+
+ /* debugging variables */
+
+ /* When using the debugger, we must keep the */
+ /* execution context tied to the instance */
+ /* object rather than asking it on demand */
+
+ Bool debug;
+ PExecution_Context context;
+
+ /* a generic pointer for client use - see TT_Set/Get_Instance_Pointer */
+ void* generic;
+ };
+
+
+ /***********************************************************************/
+ /* */
+ /* FreeType Execution Context Type */
+ /* */
+ /***********************************************************************/
+
+ struct TExecution_Context_
+ {
+ PFace face;
+ PInstance instance;
+
+ /* instructions state */
+
+ TT_Error error; /* last execution error */
+
+ Long top; /* top of exec. stack */
+
+ ULong stackSize; /* size of exec. stack */
+ PStorage stack; /* current exec. stack */
+
+ Long args;
+ ULong new_top; /* new top after exec. */
+
+ TGlyph_Zone zp0, /* zone records */
+ zp1,
+ zp2,
+ pts,
+ twilight;
+
+ TIns_Metrics metrics; /* instance metrics */
+
+ TGraphicsState GS; /* current graphics state */
+
+ Int curRange; /* current code range number */
+ PByte code; /* current code range */
+ ULong IP; /* current instruction pointer */
+ ULong codeSize; /* size of current range */
+
+ Byte opcode; /* current opcode */
+ Int length; /* length of current opcode */
+
+ Bool step_ins; /* true if the interpreter must */
+ /* increment IP after ins. exec */
+ ULong cvtSize;
+ PLong cvt;
+
+ ULong glyphSize; /* glyph instructions buffer size */
+ PByte glyphIns; /* glyph instructions buffer */
+
+ UShort numFDefs; /* number of function defs */
+ UShort maxFDefs; /* maximum number of function defs */
+ PDefRecord FDefs; /* table of FDefs entries */
+
+ UShort numIDefs; /* number of instruction defs */
+ UShort maxIDefs; /* maximum number of instruction defs */
+ PDefRecord IDefs; /* table of IDefs entries */
+
+ Int maxFunc;
+ Int maxIns;
+
+ Int callTop, /* top of call stack during execution */
+ callSize; /* size of call stack */
+ PCallStack callStack; /* call stack */
+
+ UShort maxPoints; /* capacity of this context's "pts" */
+ UShort maxContours; /* record, expressed in points and */
+ /* contours.. */
+
+ TCodeRangeTable codeRangeTable; /* table of valid coderanges */
+ /* useful for the debugger */
+
+ ULong storeSize; /* size of current storage */
+ PLong storage; /* storage area */
+
+ TT_F26Dot6 period; /* values used for the */
+ TT_F26Dot6 phase; /* 'SuperRounding' */
+ TT_F26Dot6 threshold;
+
+ /* this seems to be unused */
+#if 0
+ Int cur_ppem; /* ppem along the current proj vector */
+#endif
+ Long scale1; /* scaling values along the current */
+ Long scale2; /* projection vector too.. */
+ Bool cached_metrics; /* the ppem is computed lazily. used */
+ /* to trigger computation when needed */
+
+ Bool instruction_trap; /* If True, the interpreter will */
+ /* exit after each instruction */
+
+ TGraphicsState default_GS; /* graphics state resulting from */
+ /* the prep program */
+ Bool is_composite; /* ture if the glyph is composite */
+
+ Bool pedantic_hinting; /* if true, read and write array */
+ /* bounds faults halt the hinting */
+
+ /* latest interpreter additions */
+
+ Long F_dot_P; /* dot product of freedom and projection */
+ /* vectors */
+ TRound_Function func_round; /* current rounding function */
+
+ TProject_Function func_project, /* current projection function */
+ func_dualproj, /* current dual proj. function */
+ func_freeProj; /* current freedom proj. func */
+
+ TMove_Function func_move; /* current point move function */
+
+ TGet_CVT_Function func_read_cvt; /* read a cvt entry */
+ TSet_CVT_Function func_write_cvt; /* write a cvt entry (in pixels) */
+ TSet_CVT_Function func_move_cvt; /* incr a cvt entry (in pixels) */
+
+ ULong loadSize;
+ PSubglyph_Stack loadStack; /* loading subglyph stack */
+
+ };
+
+
+ /***********************************************************************/
+ /* */
+ /* FreeType Glyph Object Type */
+ /* */
+ /***********************************************************************/
+
+ struct TGlyph_
+ {
+ PFace face;
+ TT_Big_Glyph_Metrics metrics;
+ TT_Outline outline;
+ };
+
+
+ /* The following type is used to load a font from a collection. */
+ /* See Face_Create in ttobjs.c */
+
+ struct TFont_Input_
+ {
+ TT_Stream stream; /* input stream */
+ ULong fontIndex; /* index of font in collection */
+ PEngine_Instance engine; /* parent engine instance */
+
+ };
+
+ typedef struct TFont_Input_ TFont_Input;
+
+
+ /********************************************************************/
+ /* */
+ /* Code Range Functions */
+ /* */
+ /********************************************************************/
+
+ /* Goto a specified coderange */
+ FT_INTERNAL_DEF( TT_Error )
+ Goto_CodeRange( PExecution_Context exec,
+ Int range,
+ ULong IP );
+
+#if 0
+ /* Return a pointer to a given coderange record. */
+ /* Used only by the debugger. */
+ FT_INTERNAL_DEF( PCodeRange )
+ Get_CodeRange( PExecution_Context exec,
+ Int range );
+#endif
+
+ /* Set a given code range properties */
+ FT_INTERNAL_DEF( TT_Error )
+ Set_CodeRange( PExecution_Context exec,
+ Int range,
+ void* base,
+ ULong length );
+
+ /* Clear a given coderange */
+ FT_INTERNAL_DEF( TT_Error )
+ Clear_CodeRange( PExecution_Context exec, Int range );
+
+
+ FT_INTERNAL_DEF( PExecution_Context )
+ New_Context( PFace face );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Done_Context( PExecution_Context exec );
+
+
+ FT_INTERNAL_DEF( TT_Error )
+ Context_Load( PExecution_Context exec,
+ PFace face,
+ PInstance ins );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Context_Save( PExecution_Context exec,
+ PInstance ins );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Context_Run( PExecution_Context exec,
+ Bool debug );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Instance_Init( PInstance ins );
+
+ FT_INTERNAL_DEF( TT_Error )
+ Instance_Reset( PInstance ins );
+
+
+ /********************************************************************/
+ /* */
+ /* Handy scaling functions */
+ /* */
+ /********************************************************************/
+
+ FT_INTERNAL_DEF( TT_Pos )
+ Scale_X( PIns_Metrics metrics,
+ TT_Pos x );
+ FT_INTERNAL_DEF( TT_Pos )
+ Scale_Y( PIns_Metrics metrics,
+ TT_Pos y );
+
+ /********************************************************************/
+ /* */
+ /* Component Initializer/Finalizer */
+ /* */
+ /* Called from 'freetype.c' */
+ /* The component must create and register the face, instance and */
+ /* execution context cache classes before any object can be */
+ /* managed. */
+ /* */
+ /********************************************************************/
+
+ FT_INTERNAL_DEF( TT_Error )
+ TTObjs_Init( PEngine_Instance engine );
+ FT_INTERNAL_DEF( TT_Error )
+ TTObjs_Done( PEngine_Instance engine );
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTOBJS_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttraster.c b/Build/source/libs/freetype/lib/ttraster.c
new file mode 100644
index 00000000000..e8024546423
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttraster.c
@@ -0,0 +1,2725 @@
+/*******************************************************************
+ *
+ * ttraster.c 1.5
+ *
+ * The FreeType glyph rasterizer (body).
+ *
+ * Copyright 1996-2000 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.
+ *
+ * NOTES:
+ *
+ * This version supports the following:
+ *
+ * - direct grayscaling
+ * - sub-banding
+ * - drop-out modes 4 and 5
+ * - second pass for complete drop-out control (bitmap only)
+ * - variable precision
+ *
+ * Changes between 1.5 and 1.3:
+ *
+ * Mainly performance tunings:
+ *
+ * - Line_Down() and Bezier_Down() now use the functions Line_Up()
+ * and Bezier_Up() to do their work.
+ * - optimized Split_Bezier()
+ * - optimized linked lists used during sweeps
+ *
+ ******************************************************************/
+
+#include "ttraster.h"
+#include "ttdebug.h"
+#include "tttypes.h"
+#include "ttengine.h"
+#include "ttcalc.h" /* for TT_MulDiv only */
+
+#include "ttmemory.h" /* only used to allocate memory on engine init */
+
+/* required by the tracing mode */
+#undef TT_COMPONENT
+#define TT_COMPONENT trace_raster
+
+
+/* The default render pool size */
+#define RASTER_RENDER_POOL 64000
+
+/* The size of the two-lines intermediate bitmap used */
+/* for anti-aliasing */
+#define RASTER_GRAY_LINES 2048
+
+
+#define Raster_Err_None TT_Err_Ok
+#define Raster_Err_Not_Ini TT_Err_Raster_Not_Initialized
+#define Raster_Err_Overflow TT_Err_Raster_Pool_Overflow
+#define Raster_Err_Neg_Height TT_Err_Raster_Negative_Height
+#define Raster_Err_Invalid TT_Err_Raster_Invalid_Value
+#define Raster_Err_Gray_Unsupported TT_Err_Raster_Gray_Unsupported
+
+
+/* FMulDiv means "Fast MulDiv", it is uses in case where 'b' is typically */
+/* a small value and the result of (a*b) is known to fit in 32 bits. */
+#define FMulDiv( a, b, c ) ( (a) * (b) / (c) )
+
+/* On the other hand, SMulDiv is for "Slow MulDiv", and is used typically */
+/* for clipping computations. It simply uses the TT_MulDiv() function */
+/* defined in "ttcalc.h" */
+/* */
+/* So, the following definition fits the bill nicely, and we don't need */
+/* to use the one in 'ttcalc' anymore, even for 16-bit systems... */
+#define SMulDiv TT_MulDiv
+
+
+/* Define DEBUG_RASTER if you want to generate a debug version of the */
+/* rasterizer. This will progressively draw the glyphs while all the */
+/* computation are done directly on the graphics screen (the glyphs */
+/* will be inverted). */
+
+/* Note that DEBUG_RASTER should only be used for debugging with b/w */
+/* rendering, not with gray levels. */
+
+/* The definition of DEBUG_RASTER should appear in the file */
+/* "ttconfig.h". */
+
+#ifdef DEBUG_RASTER
+ extern Char* Vio; /* A pointer to VRAM or display buffer */
+#endif
+
+
+/* The rasterizer is a very general purpose component, please leave */
+/* the following redefinitions there (you never know your target */
+/* environment). */
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+#define MaxBezier 32 /* The maximum number of stacked Bezier curves. */
+ /* Setting this constant to more than 32 is a */
+ /* pure waste of space. */
+
+#define Pixel_Bits 6 /* fractional bits of *input* coordinates */
+
+ /* States of each line, arc and profile */
+ enum TStates_
+ {
+ Unknown,
+ Ascending,
+ Descending,
+ Flat
+ };
+
+ typedef enum TStates_ TStates;
+
+ struct TProfile_;
+ typedef struct TProfile_ TProfile;
+ typedef TProfile* PProfile;
+
+ struct TProfile_
+ {
+ TT_F26Dot6 X; /* current coordinate during sweep */
+ PProfile link; /* link to next profile - various purpose */
+ PStorage offset; /* start of profile's data in render pool */
+ Int flow; /* Profile orientation: Asc/Descending */
+ Long height; /* profile's height in scanlines */
+ Long start; /* profile's starting scanline */
+
+ UShort countL; /* number of lines to step before this */
+ /* profile becomes drawable */
+
+ PProfile next; /* next profile in same contour, used */
+ /* during drop-out control */
+ };
+
+ typedef PProfile TProfileList;
+ typedef PProfile* PProfileList;
+
+
+ /* I use the classic trick of two dummy records for the head and tail */
+ /* of a linked list; this reduces tests in insertion/deletion/sorting. */
+ /* NOTE: used during sweeps only. */
+
+ /* Simple record used to implement a stack of bands, required */
+ /* by the sub-banding mechanism */
+
+ struct TBand_
+ {
+ Short y_min; /* band's minimum */
+ Short y_max; /* band's maximum */
+ };
+
+ typedef struct TBand_ TBand;
+
+
+#define AlignProfileSize \
+ (( sizeof(TProfile)+sizeof(long)-1 ) / sizeof(long))
+
+
+ /* Left fill bitmask */
+ static const Byte LMask[8] =
+ { 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 };
+
+ /* Right fill bitmask */
+ static const Byte RMask[8] =
+ { 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF };
+
+ /* prototypes used for sweep function dispatch */
+ typedef void Function_Sweep_Init( RAS_ARGS Short* min,
+ Short* max );
+
+ typedef void Function_Sweep_Span( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right );
+
+ typedef void Function_Sweep_Step( RAS_ARG );
+
+
+/* NOTE: These operations are only valid on 2's complement processors */
+
+#define FLOOR( x ) ( (x) & -ras.precision )
+#define CEILING( x ) ( ((x) + ras.precision - 1) & -ras.precision )
+#define TRUNC( x ) ( (signed long)(x) >> ras.precision_bits )
+#define FRAC( x ) ( (x) & (ras.precision - 1) )
+#define SCALED( x ) ( ((x) << ras.scale_shift) - ras.precision_half )
+
+#ifdef DEBUG_RASTER
+#define DEBUG_PSET Pset()
+#else
+#define DEBUG_PSET
+#endif
+
+ struct TPoint_
+ {
+ Long x, y;
+ };
+
+ typedef struct TPoint_ TPoint;
+
+
+ /* Note that I have moved the location of some fields in the */
+ /* structure to ensure that the most used variables are used */
+ /* at the top. Thus, their offset can be coded with less */
+ /* opcodes, and it results in a smaller executable. */
+
+ struct TRaster_Instance_
+ {
+ Int precision_bits; /* precision related variables */
+ Int precision;
+ Int precision_half;
+ Long precision_mask;
+ Int precision_shift;
+ Int precision_step;
+ Int precision_jitter;
+
+ Int scale_shift; /* == precision_shift for bitmaps */
+ /* == precision_shift+1 for pixmaps */
+
+ PStorage buff; /* The profiles buffer */
+ PStorage sizeBuff; /* Render pool size */
+ PStorage maxBuff; /* Profiles buffer size */
+ PStorage top; /* Current cursor in buffer */
+
+ TT_Error error;
+
+ PByte flags; /* current flags table */
+ PUShort outs; /* current outlines table */
+
+ UShort nPoints; /* number of points in current glyph */
+ Short nContours; /* number of contours in current glyph */
+ Int numTurns; /* number of Y-turns in outline */
+
+ TPoint* arc; /* current Bezier arc pointer */
+
+ UShort bWidth; /* target bitmap width */
+ PByte bTarget; /* target bitmap buffer */
+ PByte gTarget; /* target pixmap buffer */
+
+ Long lastX, lastY, minY, maxY;
+
+ UShort num_Profs; /* current number of profiles */
+
+ Bool fresh; /* signals a fresh new profile which */
+ /* 'start' field must be completed */
+ Bool joint; /* signals that the last arc ended */
+ /* exactly on a scanline. Allows */
+ /* removal of doublets */
+ PProfile cProfile; /* current profile */
+ PProfile fProfile; /* head of linked list of profiles */
+ PProfile gProfile; /* contour's first profile in case */
+ /* of impact */
+ TStates state; /* rendering state */
+
+ TT_Raster_Map target; /* description of target bit/pixmap */
+
+ Long traceOfs; /* current offset in target bitmap */
+ Long traceG; /* current offset in target pixmap */
+
+ Short traceIncr; /* sweep's increment in target bitmap */
+
+ Short gray_min_x; /* current min x during gray rendering */
+ Short gray_max_x; /* current max x during gray rendering */
+
+ /* dispatch variables */
+
+ Function_Sweep_Init* Proc_Sweep_Init;
+ Function_Sweep_Span* Proc_Sweep_Span;
+ Function_Sweep_Span* Proc_Sweep_Drop;
+ Function_Sweep_Step* Proc_Sweep_Step;
+
+ TT_Vector* coords;
+
+ Byte dropOutControl; /* current drop_out control method */
+
+ Byte grays[5]; /* Palette of gray levels used for render */
+
+ Byte* gray_lines; /* Intermediate table used to render the */
+ /* graylevels pixmaps. */
+ /* gray_lines is a buffer holding two */
+ /* monochrome scanlines */
+ Short gray_width; /* width in bytes of one monochrome */
+ /* intermediate scanline of gray_lines. */
+ /* Each gray pixel takes 2 bits long there */
+
+ /* The gray_lines must hold 2 lines, thus with size */
+ /* in bytes of at least 'gray_width*2' */
+
+ Bool second_pass; /* indicates wether a horizontal pass */
+ /* should be performed to control drop-out */
+ /* accurately when calling Render_Glyph. */
+ /* Note that there is no horizontal pass */
+ /* during gray rendering. */
+ TPoint arcs[2 * MaxBezier + 1]; /* The Bezier stack */
+
+ TBand band_stack[16]; /* band stack used for sub-banding */
+ Int band_top; /* band stack top */
+
+ Int count_table[256]; /* Look-up table used to quickly count */
+ /* set bits in a gray 2x2 cell */
+ };
+
+
+#ifdef TT_CONFIG_OPTION_STATIC_RASTER
+
+ static TRaster_Instance cur_ras;
+#define ras cur_ras
+
+#else
+
+#define ras (*raster)
+
+#endif /* TT_STATIC_RASTER */
+
+
+#ifdef DEBUG_RASTER
+
+ /************************************************/
+ /* */
+ /* Pset: */
+ /* */
+ /* Used for debugging only. Plots a point */
+ /* in VRAM during rendering (not afterwards). */
+ /* */
+ /* NOTE: This procedure relies on the value */
+ /* of cProfile->start, which may not */
+ /* be set when Pset is called sometimes. */
+ /* This will usually result in a dot */
+ /* plotted on the first screen scanline */
+ /* (far away its original position). */
+ /* */
+ /* This "bug" reflects nothing wrong */
+ /* in the current implementation, and */
+ /* the bitmap is rendered correctly, */
+ /* so don't panic if you see 'flying' */
+ /* dots in debugging mode. */
+ /* */
+ /* - David */
+ /* */
+ /************************************************/
+
+ static void Pset( RAS_ARG )
+ {
+ Long o;
+ Long x;
+
+
+ x = ras.top[-1];
+
+ switch ( ras.cProfile->flow )
+ {
+ case TT_Flow_Up:
+ o = Vio_ScanLineWidth *
+ ( ras.top-ras.cProfile->offset + ras.cProfile->start ) +
+ ( x / (ras.precision*8) );
+ break;
+
+ case TT_Flow_Down:
+ o = Vio_ScanLineWidth *
+ ( ras.cProfile->start-ras.top + ras.cProfile->offset ) +
+ ( x / (ras.precision*8) );
+ break;
+ }
+
+ if ( o > 0 )
+ Vio[o] |= (unsigned)0x80 >> ( (x/ras.precision) & 7 );
+ }
+
+
+ static void Clear_Band( RAS_ARGS Int y1, Int y2 )
+ {
+ MEM_Set( Vio + y1*Vio_ScanLineWidth, (y2-y1+1)*Vio_ScanLineWidth, 0 );
+ }
+
+#endif /* DEBUG_RASTER */
+
+
+/************************************************************************/
+/* */
+/* Function: Set_High_Precision */
+/* */
+/* Description: Sets precision variables according to param flag. */
+/* */
+/* Input: High set to True for high precision (typically for */
+/* ppem < 18), false otherwise. */
+/* */
+/************************************************************************/
+
+ static void Set_High_Precision( RAS_ARGS Bool High )
+ {
+ if ( High )
+ {
+ ras.precision_bits = 10;
+ ras.precision_step = 128;
+ ras.precision_jitter = 24;
+ }
+ else
+ {
+ ras.precision_bits = 6;
+ ras.precision_step = 32;
+ ras.precision_jitter = 2;
+ }
+
+ PTRACE7(( "Set_High_Precision(%s)\n", High ? "true" : "false" ));
+
+ ras.precision = 1 << ras.precision_bits;
+ ras.precision_half = ras.precision / 2;
+ ras.precision_shift = ras.precision_bits - Pixel_Bits;
+ ras.precision_mask = -ras.precision;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: New_Profile */
+/* */
+/* Description: Creates a new Profile in the render pool. */
+/* */
+/* Input: aState state/orientation of the new Profile */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE in case of overflow or of incoherent Profile. */
+/* */
+/****************************************************************************/
+
+ static Bool New_Profile( RAS_ARGS TStates aState )
+ {
+ if ( !ras.fProfile )
+ {
+ ras.cProfile = (PProfile)ras.top;
+ ras.fProfile = ras.cProfile;
+ ras.top += AlignProfileSize;
+ }
+
+ if ( ras.top >= ras.maxBuff )
+ {
+ ras.error = Raster_Err_Overflow;
+ return FAILURE;
+ }
+
+ switch ( aState )
+ {
+ case Ascending:
+ ras.cProfile->flow = TT_Flow_Up;
+ PTRACE7(( "New ascending profile = %lx\n", (long)ras.cProfile ));
+ break;
+
+ case Descending:
+ ras.cProfile->flow = TT_Flow_Down;
+ PTRACE7(( "New descending profile = %lx\n", (long)ras.cProfile ));
+ break;
+
+ default:
+ PTRACE0(( "Invalid profile direction in Raster:New_Profile !!\n" ));
+ ras.error = Raster_Err_Invalid;
+ return FAILURE;
+ }
+
+ ras.cProfile->start = 0;
+ ras.cProfile->height = 0;
+ ras.cProfile->offset = ras.top;
+ ras.cProfile->link = (PProfile)0;
+ ras.cProfile->next = (PProfile)0;
+
+ if ( !ras.gProfile )
+ ras.gProfile = ras.cProfile;
+
+ ras.state = aState;
+ ras.fresh = TRUE;
+ ras.joint = FALSE;
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: End_Profile */
+/* */
+/* Description: Finalizes the current Profile. */
+/* */
+/* Input: None */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE in case of overflow or incoherency. */
+/* */
+/****************************************************************************/
+
+ static Bool End_Profile( RAS_ARG )
+ {
+ Long h;
+ PProfile oldProfile;
+
+
+ h = ras.top - ras.cProfile->offset;
+
+ if ( h < 0 )
+ {
+ PTRACE0(( "Negative height encountered in End_Profile!\n" ));
+ ras.error = Raster_Err_Neg_Height;
+ return FAILURE;
+ }
+
+ if ( h > 0 )
+ {
+ PTRACE1(( "Ending profile %lx, start = %ld, height = %ld\n",
+ (long)ras.cProfile, ras.cProfile->start, h ));
+
+ oldProfile = ras.cProfile;
+ ras.cProfile->height = h;
+ ras.cProfile = (PProfile)ras.top;
+
+ ras.top += AlignProfileSize;
+
+ ras.cProfile->height = 0;
+ ras.cProfile->offset = ras.top;
+ oldProfile->next = ras.cProfile;
+ ras.num_Profs++;
+ }
+
+ if ( ras.top >= ras.maxBuff )
+ {
+ PTRACE1(( "overflow in End_Profile\n" ));
+ ras.error = Raster_Err_Overflow;
+ return FAILURE;
+ }
+
+ ras.joint = FALSE;
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Insert_Y_Turn */
+/* */
+/* Description: Insert a salient into the sorted list placed on top */
+/* of the render pool */
+/* */
+/* Input: New y scanline position */
+/* */
+/****************************************************************************/
+
+ static
+ Bool Insert_Y_Turn( RAS_ARGS Int y )
+ {
+ PStorage y_turns;
+ Int y2, n;
+
+ n = ras.numTurns-1;
+ y_turns = ras.sizeBuff - ras.numTurns;
+
+ /* look for first y value that is <= */
+ while ( n >= 0 && y < y_turns[n] )
+ n--;
+
+ /* if it is <, simply insert it, ignore if == */
+ if ( n >= 0 && y > y_turns[n] )
+ while ( n >= 0 )
+ {
+ y2 = y_turns[n];
+ y_turns[n] = y;
+ y = y2;
+ n--;
+ }
+
+ if ( n < 0 )
+ {
+ if (ras.maxBuff <= ras.top)
+ {
+ ras.error = Raster_Err_Overflow;
+ return FAILURE;
+ }
+ ras.maxBuff--;
+ ras.numTurns++;
+ ras.sizeBuff[-ras.numTurns] = y;
+ }
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Finalize_Profile_Table */
+/* */
+/* Description: Adjusts all links in the Profiles list. */
+/* */
+/* Input: None */
+/* */
+/* Returns: None. */
+/* */
+/****************************************************************************/
+
+ static
+ Bool Finalize_Profile_Table( RAS_ARG )
+ {
+ Long bottom, top;
+ UShort n;
+ PProfile p;
+
+
+ n = ras.num_Profs;
+
+ if ( n > 1 )
+ {
+ p = ras.fProfile;
+ while ( n > 0 )
+ {
+ if ( n > 1 )
+ p->link = (PProfile)( p->offset + p->height );
+ else
+ p->link = NULL;
+
+ switch ( p->flow )
+ {
+ case TT_Flow_Down:
+ bottom = p->start - p->height+1;
+ top = p->start;
+ p->start = bottom;
+ p->offset += p->height-1;
+ break;
+
+ case TT_Flow_Up:
+ default:
+ bottom = p->start;
+ top = p->start + p->height-1;
+ }
+
+ if ( Insert_Y_Turn( RAS_VARS bottom ) ||
+ Insert_Y_Turn( RAS_VARS top+1 ) )
+ return FAILURE;
+
+ p = p->link;
+ n--;
+ }
+ }
+ else
+ ras.fProfile = NULL;
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Split_Bezier */
+/* */
+/* Description: Subdivides one Bezier arc into two joint */
+/* sub-arcs in the Bezier stack. */
+/* */
+/* Input: None (subdivided bezier is taken from the top of the */
+/* stack). */
+/* */
+/* Returns: None. */
+/* */
+/* */
+/* Note: This routine is the 'beef' of this component. It is _the_ */
+/* inner loop that should be optimized to hell to get the */
+/* best performance. */
+/* */
+/****************************************************************************/
+
+ static void Split_Bezier( TPoint* base )
+ {
+ Long a, b;
+
+
+ base[4].x = base[2].x;
+ b = base[1].x;
+ a = base[3].x = ( base[2].x + b ) / 2;
+ b = base[1].x = ( base[0].x + b ) / 2;
+ base[2].x = ( a + b ) / 2;
+
+ base[4].y = base[2].y;
+ b = base[1].y;
+ a = base[3].y = ( base[2].y + b ) / 2;
+ b = base[1].y = ( base[0].y + b ) / 2;
+ base[2].y = ( a + b ) / 2;
+
+ /* hand optimized. gcc doesn't seem too good at common expression */
+ /* substitution and instruction scheduling ;-) */
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Push_Bezier */
+/* */
+/* Description: Clears the Bezier stack and pushes a new arc on top of it. */
+/* */
+/* Input: x1,y1 x2,y2 x3,y3 new Bezier arc */
+/* */
+/* Returns: None. */
+/* */
+/****************************************************************************/
+
+ static void Push_Bezier( RAS_ARGS Long x1, Long y1,
+ Long x2, Long y2,
+ Long x3, Long y3 )
+ {
+ ras.arc = ras.arcs;
+ ras.arc[2].x = x1; ras.arc[2].y = y1;
+ ras.arc[1].x = x2; ras.arc[1].y = y2;
+ ras.arc[0].x = x3; ras.arc[0].y = y3;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Line_Up */
+/* */
+/* Description: Computes the x-coordinates of an ascending line segment */
+/* and stores them in the render pool. */
+/* */
+/* Input: x1,y1,x2,y2 Segment start (x1,y1) and end (x2,y2) points */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE on Render Pool overflow. */
+/* */
+/****************************************************************************/
+
+ static Bool Line_Up( RAS_ARGS Long x1, Long y1,
+ Long x2, Long y2,
+ Long miny, Long maxy )
+ {
+ Long Dx, Dy;
+ Int e1, e2, f1, f2, size; /* XXX: is `Short' sufficient? */
+ Long Ix, Rx, Ax;
+
+ PStorage top;
+
+
+ Dx = x2 - x1;
+ Dy = y2 - y1;
+
+ if ( Dy <= 0 || y2 < miny || y1 > maxy )
+ return SUCCESS;
+
+ if ( y1 < miny )
+ {
+ /* Take care : miny-y1 can be a very large value, we use */
+ /* a slow MulDiv function to avoid clipping bugs */
+ x1 += SMulDiv( Dx, miny - y1, Dy );
+ e1 = TRUNC( miny );
+ f1 = 0;
+ }
+ else
+ {
+ e1 = TRUNC( y1 );
+ f1 = FRAC( y1 );
+ }
+
+ if ( y2 > maxy )
+ {
+ /* x2 += FMulDiv( Dx, maxy - y2, Dy ); UNNECESSARY */
+ e2 = TRUNC( maxy );
+ f2 = 0;
+ }
+ else
+ {
+ e2 = TRUNC( y2 );
+ f2 = FRAC( y2 );
+ }
+
+ if ( f1 > 0 )
+ {
+ if ( e1 == e2 ) return SUCCESS;
+ else
+ {
+ x1 += FMulDiv( Dx, ras.precision - f1, Dy );
+ e1 += 1;
+ }
+ }
+ else
+ if ( ras.joint )
+ {
+ ras.top--;
+ ras.joint = FALSE;
+ }
+
+ ras.joint = ( f2 == 0 );
+
+ if ( ras.fresh )
+ {
+ ras.cProfile->start = e1;
+ ras.fresh = FALSE;
+ }
+
+ size = e2 - e1 + 1;
+ if ( ras.top + size >= ras.maxBuff )
+ {
+ ras.error = Raster_Err_Overflow;
+ return FAILURE;
+ }
+
+ if ( Dx > 0 )
+ {
+ Ix = (ras.precision*Dx) / Dy;
+ Rx = (ras.precision*Dx) % Dy;
+ Dx = 1;
+ }
+ else
+ {
+ Ix = -( (ras.precision*-Dx) / Dy );
+ Rx = (ras.precision*-Dx) % Dy;
+ Dx = -1;
+ }
+
+ Ax = -Dy;
+ top = ras.top;
+
+ while ( size > 0 )
+ {
+ *top++ = x1;
+
+ DEBUG_PSET;
+
+ x1 += Ix;
+ Ax += Rx;
+ if ( Ax >= 0 )
+ {
+ Ax -= Dy;
+ x1 += Dx;
+ }
+ size--;
+ }
+
+ ras.top = top;
+ return SUCCESS;
+ }
+
+
+ static Bool Line_Down( RAS_ARGS Long x1, Long y1,
+ Long x2, Long y2,
+ Long miny, Long maxy )
+ {
+ Bool result, fresh;
+
+
+ fresh = ras.fresh;
+
+ result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
+
+ if ( fresh && !ras.fresh )
+ ras.cProfile->start = -ras.cProfile->start;
+
+ return result;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Bezier_Up */
+/* */
+/* Description: Computes thes x-coordinates of an ascending bezier arc */
+/* and stores them in the render pool. */
+/* */
+/* Input: None. The arc is taken from the top of the Bezier stack. */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE on Render Pool overflow. */
+/* */
+/****************************************************************************/
+
+ static Bool Bezier_Up( RAS_ARGS Long miny, Long maxy )
+ {
+ Long y1, y2, e, e2, e0;
+ Short f1;
+
+ TPoint* arc;
+ TPoint* start_arc;
+
+ PStorage top;
+
+
+ arc = ras.arc;
+ y1 = arc[2].y;
+ y2 = arc[0].y;
+ top = ras.top;
+
+ if ( y2 < miny || y1 > maxy )
+ goto Fin;
+
+ e2 = FLOOR( y2 );
+
+ if ( e2 > maxy )
+ e2 = maxy;
+
+ e0 = miny;
+
+ if ( y1 < miny )
+ e = miny;
+ else
+ {
+ e = CEILING( y1 );
+ f1 = FRAC( y1 );
+ e0 = e;
+
+ if ( f1 == 0 )
+ {
+ if ( ras.joint )
+ {
+ top--;
+ ras.joint = FALSE;
+ }
+
+ *top++ = arc[2].x;
+
+ DEBUG_PSET;
+
+ e += ras.precision;
+ }
+ }
+
+ if ( ras.fresh )
+ {
+ ras.cProfile->start = TRUNC( e0 );
+ ras.fresh = FALSE;
+ }
+
+ if ( e2 < e )
+ goto Fin;
+
+ if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
+ {
+ ras.top = top;
+ ras.error = Raster_Err_Overflow;
+ return FAILURE;
+ }
+
+ start_arc = arc;
+
+ while ( arc >= start_arc && e <= e2 )
+ {
+ ras.joint = FALSE;
+
+ y2 = arc[0].y;
+
+ if ( y2 > e )
+ {
+ y1 = arc[2].y;
+ if ( y2 - y1 >= ras.precision_step )
+ {
+ Split_Bezier( arc );
+ arc += 2;
+ }
+ else
+ {
+ *top++ = arc[2].x + FMulDiv( arc[0].x - arc[2].x,
+ e - y1,
+ y2 - y1 );
+ DEBUG_PSET;
+
+ arc -= 2;
+ e += ras.precision;
+ }
+ }
+ else
+ {
+ if ( y2 == e )
+ {
+ ras.joint = TRUE;
+ *top++ = arc[0].x;
+
+ DEBUG_PSET;
+
+ e += ras.precision;
+ }
+ arc -= 2;
+ }
+ }
+
+ Fin:
+ ras.top = top;
+ ras.arc -= 2;
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Bezier_Down */
+/* */
+/* Description: Computes the x-coordinates of a descending bezier arc */
+/* and stores them in the render pool. */
+/* */
+/* Input: None. Arc is taken from the top of the Bezier stack. */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE on Render Pool overflow. */
+/* */
+/****************************************************************************/
+
+ static Bool Bezier_Down( RAS_ARGS Long miny, Long maxy )
+ {
+ TPoint* arc = ras.arc;
+ Bool result, fresh;
+
+
+ arc[0].y = -arc[0].y;
+ arc[1].y = -arc[1].y;
+ arc[2].y = -arc[2].y;
+
+ fresh = ras.fresh;
+
+ result = Bezier_Up( RAS_VARS -maxy, -miny );
+
+ if ( fresh && !ras.fresh )
+ ras.cProfile->start = -ras.cProfile->start;
+
+ arc[0].y = -arc[0].y;
+ return result;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Line_To */
+/* */
+/* Description: Injects a new line segment and adjusts Profiles list. */
+/* */
+/* Input: x, y : segment endpoint (start point in LastX,LastY) */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE on Render Pool overflow or Incorrect Profile. */
+/* */
+/****************************************************************************/
+
+ static Bool Line_To( RAS_ARGS Long x, Long y )
+ {
+ /* First, detect a change of direction */
+
+ switch ( ras.state )
+ {
+ case Unknown:
+ if ( y > ras.lastY )
+ {
+ if ( New_Profile( RAS_VARS Ascending ) ) return FAILURE;
+ }
+ else
+ {
+ if ( y < ras.lastY )
+ if ( New_Profile( RAS_VARS Descending ) ) return FAILURE;
+ }
+ break;
+
+ case Ascending:
+ if ( y < ras.lastY )
+ {
+ if ( End_Profile( RAS_VAR ) ||
+ New_Profile( RAS_VARS Descending ) ) return FAILURE;
+ }
+ break;
+
+ case Descending:
+ if ( y > ras.lastY )
+ {
+ if ( End_Profile( RAS_VAR ) ||
+ New_Profile( RAS_VARS Ascending ) ) return FAILURE;
+ }
+ break;
+
+ default:
+ ;
+ }
+
+ /* Then compute the lines */
+
+ switch ( ras.state )
+ {
+ case Ascending:
+ if ( Line_Up ( RAS_VARS ras.lastX, ras.lastY,
+ x, y, ras.minY, ras.maxY ) )
+ return FAILURE;
+ break;
+
+ case Descending:
+ if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
+ x, y, ras.minY, ras.maxY ) )
+ return FAILURE;
+ break;
+
+ default:
+ ;
+ }
+
+ ras.lastX = x;
+ ras.lastY = y;
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Bezier_To */
+/* */
+/* Description: Injects a new bezier arc and adjusts the profile list. */
+/* */
+/* Input: x, y : arc endpoint (start point in LastX, LastY) */
+/* Cx, Cy : control point */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE on Render Pool overflow or Incorrect Profile. */
+/* */
+/****************************************************************************/
+
+ static Bool Bezier_To( RAS_ARGS Long x,
+ Long y,
+ Long cx,
+ Long cy )
+ {
+ Long y1, y2, y3, x3;
+ TStates state_bez;
+
+
+ Push_Bezier( RAS_VARS ras.lastX, ras.lastY, cx, cy, x, y );
+
+ do
+ {
+ y1 = ras.arc[2].y;
+ y2 = ras.arc[1].y;
+ y3 = ras.arc[0].y;
+ x3 = ras.arc[0].x;
+
+ /* first, categorize the bezier arc */
+
+ if ( y1 == y2 )
+ {
+ if ( y2 == y3 )
+ state_bez = Flat;
+ else if ( y2 > y3 )
+ state_bez = Descending;
+ else
+ state_bez = Ascending;
+ }
+ else if ( y1 > y2 )
+ {
+ if ( y2 >= y3 )
+ state_bez = Descending;
+ else
+ state_bez = Unknown;
+ }
+ else if ( y2 <= y3 )
+ state_bez = Ascending;
+ else
+ state_bez = Unknown;
+
+ /* split non-monotonic arcs, ignore flat ones, or */
+ /* computes the up and down ones */
+
+ switch ( state_bez )
+ {
+ case Flat:
+ ras.arc -= 2;
+ break;
+
+ case Unknown:
+ Split_Bezier( ras.arc );
+ ras.arc += 2;
+ break;
+
+ default:
+ /* detect a change of direction */
+
+ if ( ras.state != state_bez )
+ {
+ if ( ras.state != Unknown )
+ if ( End_Profile( RAS_VAR ) ) return FAILURE;
+
+ if ( New_Profile( RAS_VARS state_bez ) ) return FAILURE;
+ }
+
+ /* compute */
+
+ switch ( ras.state )
+ {
+ case Ascending:
+ if ( Bezier_Up ( RAS_VARS ras.minY, ras.maxY ) )
+ return FAILURE;
+ break;
+
+ case Descending:
+ if ( Bezier_Down( RAS_VARS ras.minY, ras.maxY ) )
+ return FAILURE;
+ break;
+
+ default:
+ ;
+ }
+ }
+ } while ( ras.arc >= ras.arcs );
+
+ ras.lastX = x3;
+ ras.lastY = y3;
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Decompose_Curve */
+/* */
+/* Description: Scans the outline arays in order to emit individual */
+/* segments and beziers by calling Line_To() and Bezier_To(). */
+/* It handles all weird cases, like when the first point */
+/* is off the curve, or when there are simply no 'on' */
+/* points in the contour! */
+/* */
+/* Input: first, last : indexes of first and last point in */
+/* contour. */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE on error. */
+/* */
+/****************************************************************************/
+
+#undef SWAP_
+#define SWAP_(x,y) { Long swap = x; x = y; y = swap; }
+
+ static Bool Decompose_Curve( RAS_ARGS UShort first,
+ UShort last,
+ Bool flipped )
+ {
+ Long x, y; /* current point */
+ Long cx, cy; /* current Bezier control point */
+ Long mx, my; /* current middle point */
+
+ Long x_first, y_first; /* first point's coordinates */
+ Long x_last, y_last; /* last point's coordinates */
+
+ UShort index; /* current point's index */
+ Bool on_curve; /* current point's state */
+
+ x_first = SCALED( ras.coords[first].x );
+ y_first = SCALED( ras.coords[first].y );
+
+ if ( flipped ) SWAP_( x_first,y_first );
+
+ x_last = SCALED( ras.coords[last].x );
+ y_last = SCALED( ras.coords[last].y );
+
+ if ( flipped ) SWAP_( x_last,y_last );
+
+ ras.lastX = cx = x_first;
+ ras.lastY = cy = y_first;
+
+ on_curve = (ras.flags[first] & 1);
+ index = first;
+
+ /* check first point to determine origin */
+ if ( !on_curve )
+ {
+ /* first point is off the curve. Yes, this happens... */
+ if ( ras.flags[last] & 1 )
+ {
+ ras.lastX = x_last; /* start at last point if it */
+ ras.lastY = y_last; /* is on the curve */
+ }
+ else
+ {
+ /* if both first and last points are off the curve, */
+ /* start at their middle and record its position */
+ /* for closure */
+ ras.lastX = (ras.lastX + x_last)/2;
+ ras.lastY = (ras.lastY + y_last)/2;
+
+ x_last = ras.lastX;
+ y_last = ras.lastY;
+ }
+ }
+
+ /* now process each contour point individually */
+ while ( index < last )
+ {
+ index++;
+ x = SCALED( ras.coords[index].x );
+ y = SCALED( ras.coords[index].y );
+
+ if ( flipped ) SWAP_( x, y );
+
+ if ( on_curve )
+ {
+ /* the previous point was on the curve */
+ on_curve = ( ras.flags[index] & 1 );
+ if ( on_curve )
+ {
+ /* two successive on points => emit segment */
+ if ( Line_To( RAS_VARS x, y ) ) return FAILURE;
+ }
+ else
+ {
+ /* else, keep current control point for next bezier */
+ cx = x;
+ cy = y;
+ }
+ }
+ else
+ {
+ /* the previous point was off the curve */
+ on_curve = ( ras.flags[index] & 1 );
+ if ( on_curve )
+ {
+ /* reaching an `on' point */
+ if ( Bezier_To( RAS_VARS x, y, cx, cy ) ) return FAILURE;
+ }
+ else
+ {
+ /* two successive `off' points => create middle point */
+ mx = ( cx + x ) / 2;
+ my = ( cy + y ) / 2;
+
+ if ( Bezier_To( RAS_VARS mx, my, cx, cy ) ) return FAILURE;
+
+ cx = x;
+ cy = y;
+ }
+ }
+ }
+
+ /* end of contour, close curve cleanly */
+ if ( ras.flags[first] & 1 )
+ {
+ if ( on_curve )
+ return Line_To( RAS_VARS x_first, y_first );
+ else
+ return Bezier_To( RAS_VARS x_first, y_first, cx, cy );
+ }
+ else
+ if ( !on_curve )
+ return Bezier_To( RAS_VARS x_last, y_last, cx, cy );
+
+ return SUCCESS;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Convert_Glyph */
+/* */
+/* Description: Converts a glyph into a series of segments and arcs */
+/* and makes a Profiles list with them. */
+/* */
+/* Input: _xCoord, _yCoord : coordinates tables. */
+/* */
+/* Uses the 'Flag' table too. */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE if any error was encountered during rendering. */
+/* */
+/****************************************************************************/
+
+ static Bool Convert_Glyph( RAS_ARGS int flipped )
+ {
+ Short i;
+ UShort start;
+
+ PProfile lastProfile;
+
+
+ ras.fProfile = NULL;
+ ras.joint = FALSE;
+ ras.fresh = FALSE;
+
+ ras.maxBuff = ras.sizeBuff - AlignProfileSize;
+
+ ras.numTurns = 0;
+
+ ras.cProfile = (PProfile)ras.top;
+ ras.cProfile->offset = ras.top;
+ ras.num_Profs = 0;
+
+ start = 0;
+
+ for ( i = 0; i < ras.nContours; i++ )
+ {
+ ras.state = Unknown;
+ ras.gProfile = NULL;
+
+ if ( Decompose_Curve( RAS_VARS start, ras.outs[i], flipped ) )
+ return FAILURE;
+
+ start = ras.outs[i] + 1;
+
+ /* We must now see if the extreme arcs join or not */
+ if ( ( FRAC( ras.lastY ) == 0 &&
+ ras.lastY >= ras.minY &&
+ ras.lastY <= ras.maxY ) )
+ if ( ras.gProfile && ras.gProfile->flow == ras.cProfile->flow )
+ ras.top--;
+ /* Note that ras.gProfile can be nil if the contour was too small */
+ /* to be drawn. */
+
+ lastProfile = ras.cProfile;
+ if ( End_Profile( RAS_VAR ) ) return FAILURE;
+
+ /* close the 'next profile in contour' linked list */
+ if ( ras.gProfile )
+ lastProfile->next = ras.gProfile;
+ }
+
+ if (Finalize_Profile_Table( RAS_VAR ))
+ return FAILURE;
+
+ return (ras.top < ras.maxBuff ? SUCCESS : FAILURE );
+ }
+
+
+/************************************************/
+/* */
+/* Init_Linked */
+/* */
+/* Inits an empty linked list. */
+/* */
+/************************************************/
+
+ static void Init_Linked( TProfileList* l )
+ {
+ *l = NULL;
+ }
+
+
+/************************************************/
+/* */
+/* InsNew : */
+/* */
+/* Inserts a new Profile in a linked list. */
+/* */
+/************************************************/
+
+ static void InsNew( PProfileList list,
+ PProfile profile )
+ {
+ PProfile *old, current;
+ Long x;
+
+
+ old = list;
+ current = *old;
+ x = profile->X;
+
+ while ( current )
+ {
+ if ( x < current->X )
+ break;
+ old = &current->link;
+ current = *old;
+ }
+
+ profile->link = current;
+ *old = profile;
+ }
+
+
+/*************************************************/
+/* */
+/* DelOld : */
+/* */
+/* Removes an old Profile from a linked list. */
+/* */
+/*************************************************/
+
+ static void DelOld( PProfileList list,
+ PProfile profile )
+ {
+ PProfile *old, current;
+
+
+ old = list;
+ current = *old;
+
+ while ( current )
+ {
+ if ( current == profile )
+ {
+ *old = current->link;
+ return;
+ }
+
+ old = &current->link;
+ current = *old;
+ }
+
+ /* we should never get there, unless the Profile was not part of */
+ /* the list. */
+ }
+
+
+/************************************************/
+/* */
+/* Update : */
+/* */
+/* Update all X offsets of a drawing list */
+/* */
+/************************************************/
+
+ static void Update( PProfile first )
+ {
+ PProfile current = first;
+
+
+ while ( current )
+ {
+ current->X = *current->offset;
+ current->offset += current->flow;
+ current->height--;
+ current = current->link;
+ }
+ }
+
+
+/************************************************/
+/* */
+/* Sort : */
+/* */
+/* Sorts a trace list. In 95%, the list */
+/* is already sorted. We need an algorithm */
+/* which is fast in this case. Bubble sort */
+/* is enough and simple. */
+/* */
+/************************************************/
+
+ static void Sort( PProfileList list )
+ {
+ PProfile *old, current, next;
+
+
+ /* First, set the new X coordinate of each profile */
+ Update( *list );
+
+ /* Then sort them */
+ old = list;
+ current = *old;
+
+ if ( !current )
+ return;
+
+ next = current->link;
+
+ while ( next )
+ {
+ if ( current->X <= next->X )
+ {
+ old = &current->link;
+ current = *old;
+
+ if ( !current )
+ return;
+ }
+ else
+ {
+ *old = next;
+ current->link = next->link;
+ next->link = current;
+
+ old = list;
+ current = *old;
+ }
+
+ next = current->link;
+ }
+ }
+
+
+/***********************************************************************/
+/* */
+/* Vertical Sweep Procedure Set : */
+/* */
+/* These three routines are used during the vertical black/white */
+/* sweep phase by the generic Draw_Sweep() function. */
+/* */
+/***********************************************************************/
+
+ static void Vertical_Sweep_Init( RAS_ARGS Short* min, Short* max )
+ {
+ switch ( ras.target.flow )
+ {
+ case TT_Flow_Up:
+ ras.traceOfs = *min * ras.target.cols;
+ ras.traceIncr = ras.target.cols;
+ break;
+
+ default:
+ ras.traceOfs = ( ras.target.rows - 1 - *min ) * ras.target.cols;
+ ras.traceIncr = -ras.target.cols;
+ }
+
+ ras.gray_min_x = 0;
+ ras.gray_max_x = 0;
+ }
+
+
+ static void Vertical_Sweep_Span( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right )
+ {
+ Long e1, e2;
+ Short c1, c2;
+ Short f1, f2;
+ Byte* target;
+
+
+ /* Drop-out control */
+
+ e1 = TRUNC( CEILING( x1 ) );
+
+ if ( x2-x1-ras.precision <= ras.precision_jitter )
+ e2 = e1;
+ else
+ e2 = TRUNC( FLOOR( x2 ) );
+
+ if ( e2 >= 0 && e1 < ras.bWidth )
+ {
+ if ( e1 < 0 ) e1 = 0;
+ if ( e2 >= ras.bWidth ) e2 = ras.bWidth-1;
+
+ c1 = (Short)(e1 >> 3);
+ c2 = (Short)(e2 >> 3);
+
+ f1 = e1 & 7;
+ f2 = e2 & 7;
+
+ if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
+ if ( ras.gray_max_x < c2 ) ras.gray_max_x = c2;
+
+ target = ras.bTarget + ras.traceOfs + c1;
+
+ if ( c1 != c2 )
+ {
+ *target |= LMask[f1];
+
+ if ( c2 > c1 + 1 )
+ MEM_Set( target + 1, 0xFF, c2 - c1 - 1 );
+
+ target[c2 - c1] |= RMask[f2];
+ }
+ else
+ *target |= ( LMask[f1] & RMask[f2] );
+ }
+ }
+
+
+ static void Vertical_Sweep_Drop( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right )
+ {
+ Long e1, e2;
+ Short c1, f1;
+
+
+ /* Drop-out control */
+
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+
+ if ( e1 > e2 )
+ {
+ if ( e1 == e2 + ras.precision )
+ {
+ switch ( ras.dropOutControl )
+ {
+ case 1:
+ e1 = e2;
+ break;
+
+ case 4:
+ e1 = CEILING( (x1 + x2 + 1) / 2 );
+ break;
+
+ case 2:
+ case 5:
+ /* Drop-out Control Rule #4 */
+
+ /* The spec is not very clear regarding rule #4. It */
+ /* presents a method that is way too costly to implement */
+ /* while the general idea seems to get rid of 'stubs'. */
+ /* */
+ /* Here, we only get rid of stubs recognized when: */
+ /* */
+ /* upper stub: */
+ /* */
+ /* - P_Left and P_Right are in the same contour */
+ /* - P_Right is the successor of P_Left in that contour */
+ /* - y is the top of P_Left and P_Right */
+ /* */
+ /* lower stub: */
+ /* */
+ /* - P_Left and P_Right are in the same contour */
+ /* - P_Left is the successor of P_Right in that contour */
+ /* - y is the bottom of P_Left */
+ /* */
+
+ /* FIXXXME : uncommenting this line solves the disappearing */
+ /* bit problem in the '7' of verdana 10pts, but */
+ /* makes a new one in the 'C' of arial 14pts */
+
+ /* if ( x2-x1 < ras.precision_half ) */
+ {
+ /* upper stub test */
+
+ if ( left->next == right && left->height <= 0 ) return;
+
+ /* lower stub test */
+
+ if ( right->next == left && left->start == y ) return;
+ }
+
+ /* check that the rightmost pixel isn't set */
+
+ e1 = TRUNC( e1 );
+
+ c1 = (Short)(e1 >> 3);
+ f1 = e1 & 7;
+
+ if ( e1 >= 0 && e1 < ras.bWidth &&
+ ras.bTarget[ras.traceOfs + c1] & (0x80 >> f1) )
+ return;
+
+ if ( ras.dropOutControl == 2 )
+ e1 = e2;
+ else
+ e1 = CEILING( (x1 + x2 + 1) / 2 );
+
+ break;
+
+ default:
+ return; /* unsupported mode */
+ }
+ }
+ else
+ return;
+ }
+
+ e1 = TRUNC( e1 );
+
+ if ( e1 >= 0 && e1 < ras.bWidth )
+ {
+ c1 = (Short)(e1 >> 3);
+ f1 = e1 & 7;
+
+ if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1;
+ if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1;
+
+ ras.bTarget[ras.traceOfs + c1] |= (Char)(0x80 >> f1);
+ }
+ }
+
+
+ static void Vertical_Sweep_Step( RAS_ARG )
+ {
+ ras.traceOfs += ras.traceIncr;
+ }
+
+
+/***********************************************************************/
+/* */
+/* Horizontal Sweep Procedure Set : */
+/* */
+/* These three routines are used during the horizontal black/white */
+/* sweep phase by the generic Draw_Sweep() function. */
+/* */
+/***********************************************************************/
+
+ static void Horizontal_Sweep_Init( RAS_ARGS Short* min, Short* max )
+ {
+ /* nothing, really */
+ }
+
+
+ static void Horizontal_Sweep_Span( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right )
+ {
+ Long e1, e2;
+ PByte bits;
+ Byte f1;
+
+
+ if ( x2-x1 < ras.precision )
+ {
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+
+ if ( e1 == e2 )
+ {
+ bits = ras.bTarget + (y >> 3);
+ f1 = (Byte)(0x80 >> (y & 7));
+
+ e1 = TRUNC( e1 );
+
+ if ( e1 >= 0 && e1 < ras.target.rows )
+ {
+ if ( ras.target.flow == TT_Flow_Down )
+ bits[(ras.target.rows-1 - e1) * ras.target.cols] |= f1;
+ else
+ bits[e1 * ras.target.cols] |= f1;
+ }
+ }
+ }
+#if 0
+ e2 = TRUNC( e2 );
+
+ if ( e2 >= 0 && e2 < ras.target.rows )
+ if ( ras.target.flow == TT_Flow_Down )
+ bits[(ras.target.rows-1-e2) * ras.target.cols] |= f1;
+ else
+ bits[e2 * ras.target.cols] |= f1;
+#endif
+ }
+
+
+ static void Horizontal_Sweep_Drop( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right )
+ {
+ Long e1, e2;
+ PByte bits;
+ Byte f1;
+
+
+ /* During the horizontal sweep, we only take care of drop-outs */
+
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+
+ if ( e1 > e2 )
+ {
+ if ( e1 == e2 + ras.precision )
+ {
+ switch ( ras.dropOutControl )
+ {
+ case 1:
+ e1 = e2;
+ break;
+
+ case 4:
+ e1 = CEILING( (x1 + x2 + 1) / 2 );
+ break;
+
+ case 2:
+ case 5:
+
+ /* Drop-out Control Rule #4 */
+
+ /* The spec is not very clear regarding rule #4. It */
+ /* presents a method that is way too costly to implement */
+ /* while the general idea seems to get rid of 'stubs'. */
+ /* */
+
+ /* rightmost stub test */
+
+ if ( left->next == right && left->height <= 0 ) return;
+
+ /* leftmost stub test */
+
+ if ( right->next == left && left->start == y ) return;
+
+ /* check that the rightmost pixel isn't set */
+
+ e1 = TRUNC( e1 );
+
+ bits = ras.bTarget + (y >> 3);
+ f1 = (Byte)(0x80 >> (y & 7));
+
+ if ( ras.target.flow == TT_Flow_Down )
+ bits += (ras.target.rows-1-e1) * ras.target.cols;
+ else
+ bits += e1 * ras.target.cols;
+
+ if ( e1 >= 0 &&
+ e1 < ras.target.rows &&
+ *bits & f1 )
+ return;
+
+ if ( ras.dropOutControl == 2 )
+ e1 = e2;
+ else
+ e1 = CEILING( (x1 + x2 + 1) / 2 );
+
+ break;
+
+ default:
+ return; /* unsupported mode */
+ }
+ }
+ else
+ return;
+ }
+
+ bits = ras.bTarget + (y >> 3);
+ f1 = (Byte)(0x80 >> (y & 7));
+
+ e1 = TRUNC( e1 );
+
+ if ( e1 >= 0 && e1 < ras.target.rows )
+ {
+ if (ras.target.flow==TT_Flow_Down)
+ bits[(ras.target.rows-1-e1) * ras.target.cols] |= f1;
+ else
+ bits[e1 * ras.target.cols] |= f1;
+ }
+ }
+
+
+ static void Horizontal_Sweep_Step( RAS_ARG )
+ {
+ /* Nothing, really */
+ }
+
+
+#ifdef TT_CONFIG_OPTION_GRAY_SCALING
+
+/***********************************************************************/
+/* */
+/* Vertical Gray Sweep Procedure Set: */
+/* */
+/* These two routines are used during the vertical gray-levels */
+/* sweep phase by the generic Draw_Sweep() function. */
+/* */
+/* */
+/* NOTES: */
+/* */
+/* - The target pixmap's width *must* be a multiple of 4. */
+/* */
+/* - you have to use the function Vertical_Sweep_Span() for */
+/* the gray span call. */
+/* */
+/***********************************************************************/
+
+ static void Vertical_Gray_Sweep_Init( RAS_ARGS Short* min, Short* max )
+ {
+ *min = *min & -2;
+ *max = ( *max + 3 ) & -2;
+
+ ras.traceOfs = 0;
+
+ switch ( ras.target.flow )
+ {
+ case TT_Flow_Up:
+ ras.traceG = (*min / 2) * ras.target.cols;
+ ras.traceIncr = ras.target.cols;
+ break;
+
+ default:
+ ras.traceG = (ras.target.rows-1 - *min/2) * ras.target.cols;
+ ras.traceIncr = -ras.target.cols;
+ }
+
+ ras.gray_min_x = ras.target.cols;
+ ras.gray_max_x = -ras.target.cols;
+ }
+
+
+ static void Vertical_Gray_Sweep_Step( RAS_ARG )
+ {
+ Int c1, c2;
+ PByte pix, bit, bit2;
+ Int* count = ras.count_table;
+ Byte* grays;
+
+
+ ras.traceOfs += ras.gray_width;
+
+ if ( ras.traceOfs > ras.gray_width )
+ {
+ pix = ras.gTarget + ras.traceG + ras.gray_min_x * 4;
+ grays = ras.grays;
+
+ if ( ras.gray_max_x >= 0 )
+ {
+ if ( ras.gray_max_x >= ras.target.width )
+ ras.gray_max_x = ras.target.width-1;
+
+ if ( ras.gray_min_x < 0 )
+ ras.gray_min_x = 0;
+
+ bit = ras.bTarget + ras.gray_min_x;
+ bit2 = bit + ras.gray_width;
+
+ c1 = ras.gray_max_x - ras.gray_min_x;
+
+ while ( c1 >= 0 )
+ {
+ c2 = count[*bit] + count[*bit2];
+
+ if ( c2 )
+ {
+ pix[0] = grays[(c2 & 0xF000) >> 12];
+ pix[1] = grays[(c2 & 0x0F00) >> 8];
+ pix[2] = grays[(c2 & 0x00F0) >> 4];
+ pix[3] = grays[(c2 & 0x000F) ];
+
+ *bit = 0;
+ *bit2 = 0;
+ }
+
+ bit ++;
+ bit2++;
+ pix += 4;
+ c1 --;
+ }
+ }
+
+ ras.traceOfs = 0;
+ ras.traceG += ras.traceIncr;
+
+ ras.gray_min_x = ras.target.cols;
+ ras.gray_max_x = -ras.target.cols;
+ }
+ }
+
+
+ static void Horizontal_Gray_Sweep_Span( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right )
+ {
+ /* nothing, really */
+ }
+
+ static void Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y,
+ TT_F26Dot6 x1,
+ TT_F26Dot6 x2,
+ PProfile left,
+ PProfile right )
+ {
+ Long e1, e2;
+ PByte pixel;
+ Byte color;
+
+
+ /* During the horizontal sweep, we only take care of drop-outs */
+ e1 = CEILING( x1 );
+ e2 = FLOOR ( x2 );
+
+ if ( e1 > e2 )
+ {
+ if ( e1 == e2 + ras.precision )
+ {
+ switch ( ras.dropOutControl )
+ {
+ case 1:
+ e1 = e2;
+ break;
+
+ case 4:
+ e1 = CEILING( (x1 + x2 + 1) / 2 );
+ break;
+
+ case 2:
+ case 5:
+
+ /* Drop-out Control Rule #4 */
+
+ /* The spec is not very clear regarding rule #4. It */
+ /* presents a method that is way too costly to implement */
+ /* while the general idea seems to get rid of 'stubs'. */
+ /* */
+
+ /* rightmost stub test */
+ if ( left->next == right && left->height <= 0 ) return;
+
+ /* leftmost stub test */
+ if ( right->next == left && left->start == y ) return;
+
+ if ( ras.dropOutControl == 2 )
+ e1 = e2;
+ else
+ e1 = CEILING( (x1 + x2 + 1) / 2 );
+
+ break;
+
+ default:
+ return; /* unsupported mode */
+ }
+ }
+ else
+ return;
+ }
+
+ if ( e1 >= 0 )
+ {
+ if ( x2 - x1 >= ras.precision_half )
+ color = ras.grays[2];
+ else
+ color = ras.grays[1];
+
+ e1 = TRUNC( e1 ) / 2;
+ if ( e1 < ras.target.rows )
+ {
+ if ( ras.target.flow == TT_Flow_Down )
+ pixel = ras.gTarget +
+ (ras.target.rows - 1 - e1) * ras.target.cols + y / 2;
+ else
+ pixel = ras.gTarget +
+ e1 * ras.target.cols + y / 2;
+
+ if (pixel[0] == ras.grays[0])
+ pixel[0] = color;
+ }
+ }
+ }
+
+#endif /* TT_CONFIG_OPTION_GRAY_SCALING */
+
+
+/********************************************************************/
+/* */
+/* Generic Sweep Drawing routine */
+/* */
+/********************************************************************/
+
+ static Bool Draw_Sweep( RAS_ARG )
+ {
+ Short y, y_change, y_height;
+
+ PProfile P, Q, P_Left, P_Right;
+
+ Short min_Y, max_Y, top, bottom, dropouts;
+
+ Long x1, x2, xs, e1, e2;
+
+ TProfileList wait;
+ TProfileList draw_left, draw_right;
+
+
+ /* Init empty linked lists */
+
+ Init_Linked( &wait );
+
+ Init_Linked( &draw_left );
+ Init_Linked( &draw_right );
+
+ /* first, compute min and max Y */
+
+ P = ras.fProfile;
+ max_Y = (short)TRUNC( ras.minY );
+ min_Y = (short)TRUNC( ras.maxY );
+
+ while ( P )
+ {
+ Q = P->link;
+
+ bottom = P->start;
+ top = P->start + P->height-1;
+
+ if ( min_Y > bottom ) min_Y = bottom;
+ if ( max_Y < top ) max_Y = top;
+
+ P->X = 0;
+ InsNew( &wait, P );
+
+ P = Q;
+ }
+
+ /* Check the Y-turns */
+ if ( ras.numTurns == 0 )
+ {
+ ras.error = Raster_Err_Invalid;
+ return FAILURE;
+ }
+
+ /* Now inits the sweep */
+
+ ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y );
+
+ /* Then compute the distance of each profile from min_Y */
+
+ P = wait;
+
+ while ( P )
+ {
+ P->countL = P->start - min_Y;
+ P = P->link;
+ }
+
+ /* Let's go */
+
+ y = min_Y;
+ y_height = 0;
+
+ if ( ras.numTurns > 0 &&
+ ras.sizeBuff[-ras.numTurns] == min_Y )
+ ras.numTurns--;
+
+ while ( ras.numTurns > 0 )
+ {
+ /* look in the wait list for new activations */
+
+ P = wait;
+
+ while ( P )
+ {
+ Q = P->link;
+ P->countL -= y_height;
+ if ( P->countL == 0 )
+ {
+ DelOld( &wait, P );
+
+ switch ( P->flow )
+ {
+ case TT_Flow_Up: InsNew( &draw_left, P ); break;
+ case TT_Flow_Down: InsNew( &draw_right, P ); break;
+ }
+ }
+
+ P = Q;
+ }
+
+ /* Sort the drawing lists */
+
+ Sort( &draw_left );
+ Sort( &draw_right );
+
+ y_change = (Short)ras.sizeBuff[-ras.numTurns--];
+ y_height = y_change - y;
+
+ while ( y < y_change )
+ {
+
+ /* Let's trace */
+
+ dropouts = 0;
+
+ P_Left = draw_left;
+ P_Right = draw_right;
+
+ while ( P_Left )
+ {
+ x1 = P_Left ->X;
+ x2 = P_Right->X;
+
+ if ( x1 > x2 )
+ {
+ xs = x1;
+ x1 = x2;
+ x2 = xs;
+ }
+
+ if ( x2-x1 <= ras.precision )
+ {
+ e1 = FLOOR( x1 );
+ e2 = CEILING( x2 );
+
+ if ( ras.dropOutControl != 0 &&
+ (e1 > e2 || e2 == e1 + ras.precision) )
+ {
+ /* a drop out was detected */
+
+ P_Left ->X = x1;
+ P_Right->X = x2;
+
+ /* mark profile for drop-out processing */
+ P_Left->countL = 1;
+ dropouts++;
+
+ goto Skip_To_Next;
+ }
+ }
+
+ ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );
+
+ Skip_To_Next:
+
+ P_Left = P_Left->link;
+ P_Right = P_Right->link;
+ }
+
+ /* now perform the dropouts _after_ the span drawing */
+ /* drop-outs processing has been moved out of the loop */
+ /* for performance tuning */
+ if (dropouts > 0)
+ goto Scan_DropOuts;
+
+ Next_Line:
+
+ ras.Proc_Sweep_Step( RAS_VAR );
+
+ y++;
+
+ if ( y < y_change )
+ {
+ Sort( &draw_left );
+ Sort( &draw_right );
+ }
+
+ }
+
+ /* Now finalize the profiles that needs it */
+
+ {
+ PProfile Q, P;
+ P = draw_left;
+ while ( P )
+ {
+ Q = P->link;
+ if ( P->height == 0 )
+ DelOld( &draw_left, P );
+ P = Q;
+ }
+ }
+
+ {
+ PProfile Q, P = draw_right;
+ while ( P )
+ {
+ Q = P->link;
+ if ( P->height == 0 )
+ DelOld( &draw_right, P );
+ P = Q;
+ }
+ }
+ }
+
+ /* for gray-scaling, flushes the bitmap scanline cache */
+ while ( y <= max_Y )
+ {
+ ras.Proc_Sweep_Step( RAS_VAR );
+ y++;
+ }
+
+ return SUCCESS;
+
+Scan_DropOuts :
+
+ P_Left = draw_left;
+ P_Right = draw_right;
+
+ while ( P_Left )
+ {
+ if ( P_Left->countL )
+ {
+ P_Left->countL = 0;
+ /* dropouts--; -- this is useful when debugging only */
+ ras.Proc_Sweep_Drop( RAS_VARS y,
+ P_Left->X,
+ P_Right->X,
+ P_Left,
+ P_Right );
+ }
+
+ P_Left = P_Left->link;
+ P_Right = P_Right->link;
+ }
+
+ goto Next_Line;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Render_Single_Pass */
+/* */
+/* Description: Performs one sweep with sub-banding. */
+/* */
+/* Input: _XCoord, _YCoord : x and y coordinates arrays */
+/* */
+/* Returns: SUCCESS on success */
+/* FAILURE if any error was encountered during render. */
+/* */
+/****************************************************************************/
+
+ static TT_Error Render_Single_Pass( RAS_ARGS Bool flipped )
+ {
+ Short i, j, k;
+
+
+ while ( ras.band_top >= 0 )
+ {
+ ras.maxY = (Long)ras.band_stack[ras.band_top].y_max * ras.precision;
+ ras.minY = (Long)ras.band_stack[ras.band_top].y_min * ras.precision;
+
+ ras.top = ras.buff;
+
+ ras.error = Raster_Err_None;
+
+ if ( Convert_Glyph( RAS_VARS flipped ) )
+ {
+ if ( ras.error != Raster_Err_Overflow ) return FAILURE;
+
+ ras.error = Raster_Err_None;
+
+ /* sub-banding */
+
+#ifdef DEBUG_RASTER
+ ClearBand( RAS_VARS TRUNC( ras.minY ), TRUNC( ras.maxY ) );
+#endif
+
+ i = ras.band_stack[ras.band_top].y_min;
+ j = ras.band_stack[ras.band_top].y_max;
+
+ k = ( i + j ) / 2;
+
+ if ( ras.band_top >= 7 || k < i )
+ {
+ ras.band_top = 0;
+ ras.error = Raster_Err_Invalid;
+ return ras.error;
+ }
+
+ ras.band_stack[ras.band_top+1].y_min = k;
+ ras.band_stack[ras.band_top+1].y_max = j;
+
+ ras.band_stack[ras.band_top].y_max = k - 1;
+
+ ras.band_top++;
+ }
+ else
+ {
+ if ( ras.fProfile )
+ if ( Draw_Sweep( RAS_VAR ) ) return ras.error;
+ ras.band_top--;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/****************************************************************************/
+/* */
+/* Function: Render_Glyph */
+/* */
+/* Description: Renders a glyph in a bitmap. Sub-banding if needed. */
+/* */
+/* Input: AGlyph Glyph record */
+/* */
+/* Returns: SUCCESS on success. */
+/* FAILURE if any error was encountered during rendering. */
+/* */
+/****************************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Render_Glyph( RAS_ARGS TT_Outline* glyph,
+ TT_Raster_Map* target_map )
+ {
+ TT_Error error;
+
+
+ if ( glyph->n_points == 0 || glyph->n_contours <= 0 )
+ return TT_Err_Ok;
+
+ if ( !ras.buff )
+ {
+ ras.error = Raster_Err_Not_Ini;
+ return ras.error;
+ }
+
+ if ( glyph->n_points < glyph->contours[glyph->n_contours - 1] )
+ {
+ ras.error = TT_Err_Too_Many_Points;
+ return ras.error;
+ }
+
+ if ( target_map )
+ ras.target = *target_map;
+
+ ras.outs = glyph->contours;
+ ras.flags = glyph->flags;
+ ras.nPoints = glyph->n_points;
+ ras.nContours = glyph->n_contours;
+ ras.coords = glyph->points;
+
+ Set_High_Precision( RAS_VARS glyph->high_precision );
+ ras.scale_shift = ras.precision_shift;
+ ras.dropOutControl = glyph->dropout_mode;
+ ras.second_pass = glyph->second_pass;
+
+
+ /* Vertical Sweep */
+ ras.Proc_Sweep_Init = Vertical_Sweep_Init;
+ ras.Proc_Sweep_Span = Vertical_Sweep_Span;
+ ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
+ ras.Proc_Sweep_Step = Vertical_Sweep_Step;
+
+ ras.band_top = 0;
+ ras.band_stack[0].y_min = 0;
+ ras.band_stack[0].y_max = ras.target.rows - 1;
+
+ ras.bWidth = ras.target.width;
+ ras.bTarget = (Byte*)ras.target.bitmap;
+
+ if ( (error = Render_Single_Pass( RAS_VARS 0 )) != 0 )
+ return error;
+
+ /* Horizontal Sweep */
+
+ if ( ras.second_pass && ras.dropOutControl != 0 )
+ {
+ ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
+ ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
+ ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
+ ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
+
+ ras.band_top = 0;
+ ras.band_stack[0].y_min = 0;
+ ras.band_stack[0].y_max = ras.target.width - 1;
+
+ if ( (error = Render_Single_Pass( RAS_VARS 1 )) != 0 )
+ return error;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_GRAY_SCALING
+
+/****************************************************************************/
+/* */
+/* Function: Render_Gray_Glyph */
+/* */
+/* Description: Renders a glyph with grayscaling. Sub-banding if needed. */
+/* */
+/* Input: AGlyph Glyph record */
+/* */
+/* Returns: SUCCESS on success */
+/* FAILURE if any error was encountered during rendering. */
+/* */
+/****************************************************************************/
+
+ FT_INTERNAL_FUNC( TT_Error )
+ Render_Gray_Glyph( RAS_ARGS TT_Outline* glyph,
+ TT_Raster_Map* target_map,
+ Byte* palette )
+ {
+ Int i;
+ TT_Error error;
+
+ if ( !ras.buff )
+ {
+ ras.error = Raster_Err_Not_Ini;
+ return ras.error;
+ }
+
+ if ( glyph->n_points == 0 || glyph->n_contours <= 0 )
+ return TT_Err_Ok;
+
+ if ( glyph->n_points < glyph->contours[glyph->n_contours - 1] )
+ {
+ ras.error = TT_Err_Too_Many_Points;
+ return ras.error;
+ }
+
+ if ( palette )
+ {
+ for ( i = 0; i < 5; i++ )
+ ras.grays[i] = palette[i];
+ }
+
+ if ( target_map )
+ ras.target = *target_map;
+
+ ras.outs = glyph->contours;
+ ras.flags = glyph->flags;
+ ras.nPoints = glyph->n_points;
+ ras.nContours = glyph->n_contours;
+ ras.coords = glyph->points;
+
+ Set_High_Precision( RAS_VARS glyph->high_precision );
+ ras.scale_shift = ras.precision_shift+1;
+ ras.dropOutControl = glyph->dropout_mode;
+ ras.second_pass = glyph->second_pass;
+
+
+ /* Vertical Sweep */
+
+ ras.band_top = 0;
+ ras.band_stack[0].y_min = 0;
+ ras.band_stack[0].y_max = 2 * ras.target.rows - 1;
+
+ ras.bWidth = ras.gray_width;
+ if ( ras.bWidth > ras.target.cols/4 )
+ ras.bWidth = ras.target.cols/4;
+
+ ras.bWidth = ras.bWidth * 8;
+ ras.bTarget = (Byte*)ras.gray_lines;
+ ras.gTarget = (Byte*)ras.target.bitmap;
+
+ ras.Proc_Sweep_Init = Vertical_Gray_Sweep_Init;
+ ras.Proc_Sweep_Span = Vertical_Sweep_Span;
+ ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
+ ras.Proc_Sweep_Step = Vertical_Gray_Sweep_Step;
+
+ error = Render_Single_Pass( RAS_VARS 0 );
+ if (error)
+ return error;
+
+ /* Horizontal Sweep */
+
+ if ( ras.second_pass && ras.dropOutControl != 0 )
+ {
+ ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
+ ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
+ ras.Proc_Sweep_Drop = Horizontal_Gray_Sweep_Drop;
+ ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
+
+ ras.band_top = 0;
+ ras.band_stack[0].y_min = 0;
+ ras.band_stack[0].y_max = ras.target.width * 2 - 1;
+
+ error = Render_Single_Pass( RAS_VARS 1 );
+ if (error)
+ return error;
+ }
+
+ return TT_Err_Ok;
+ }
+
+#endif /* TT_CONFIG_OPTION_GRAY_SCALING */
+
+
+/************************************************/
+/* */
+/* InitRasterizer */
+/* */
+/* Raster Initialization. */
+/* Gets the bitmap description and render pool */
+/* addresses. */
+/* */
+/************************************************/
+
+#undef ras
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTRaster_Done( PEngine_Instance engine )
+ {
+ TRaster_Instance* ras = (TRaster_Instance*)engine->raster_component;
+
+
+ if ( !ras )
+ return TT_Err_Ok;
+
+ FREE( ras->buff );
+ FREE( ras->gray_lines );
+
+#ifndef TT_CONFIG_OPTION_STATIC_RASTER
+ FREE( engine->raster_component );
+#endif
+
+ return TT_Err_Ok;
+ }
+
+
+ FT_INTERNAL_FUNC( TT_Error )
+ TTRaster_Init( PEngine_Instance engine )
+ {
+ TT_Error error;
+
+ Int i, l, j, c;
+
+ TRaster_Instance* ras;
+
+
+#ifdef TT_CONFIG_OPTION_STATIC_RASTER
+ ras = engine->raster_component = &cur_ras;
+#else
+ if ( ALLOC( engine->raster_component, sizeof ( TRaster_Instance ) ) )
+ return error;
+
+ ras = (TRaster_Instance*)engine->raster_component;
+#endif
+
+ if ( ALLOC( ras->buff, RASTER_RENDER_POOL ) ||
+ ALLOC( ras->gray_lines, RASTER_GRAY_LINES ) )
+ return error;
+
+ ras->sizeBuff = ras->buff + ( RASTER_RENDER_POOL/sizeof(long) );
+ ras->gray_width = RASTER_GRAY_LINES/2;
+
+ MUTEX_Create( engine->raster_lock );
+
+ /* Initialization of Count_Table */
+
+ for ( i = 0; i < 256; i++ )
+ {
+ l = 0;
+ j = i;
+
+ for ( c = 0; c < 4; c++ )
+ {
+ l <<= 4;
+
+ if ( j & 0x80 ) l++;
+ if ( j & 0x40 ) l++;
+
+ j = ( j << 2 ) & 0xFF;
+ }
+
+ ras->count_table[i] = l;
+ }
+
+ ras->dropOutControl = 2;
+ ras->error = Raster_Err_None;
+
+ return TT_Err_Ok;
+ }
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/ttraster.h b/Build/source/libs/freetype/lib/ttraster.h
new file mode 100644
index 00000000000..f6c4149589c
--- /dev/null
+++ b/Build/source/libs/freetype/lib/ttraster.h
@@ -0,0 +1,127 @@
+/*******************************************************************
+ *
+ * ttraster.h v 1.4
+ *
+ * The FreeType glyph rasterizer.
+ *
+ * Copyright 1996-2000 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.
+ *
+ * NOTES:
+ *
+ * This version supports the following:
+ *
+ * - direct grayscaling
+ * - sub-banding
+ * - drop-out modes 4 and 5
+ * - second pass for complete drop-out control (bitmap only)
+ * - variable precision
+ *
+ *
+ * Changes between 1.5 and 1.3:
+ *
+ * Mainly performance tunings:
+ *
+ * - Line_Down() and Bezier_Down() now use the functions Line_Up()
+ * and Bezier_Up() to do their work.
+ * - optimized Split_Bezier()
+ * - optimized linked lists used during sweeps
+ *
+ * Changes between 1.2 and 1.3:
+ *
+ * - made the engine optionaly re-entrant. Saves a lot
+ * of code for a moderate performance hit.
+ *
+ ******************************************************************/
+
+#ifndef TTRASTER_H
+#define TTRASTER_H
+
+#include "ttconfig.h"
+#include "freetype.h" /* for TT_Outline */
+#include "ttengine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* We provide two different builds of the scan-line converter */
+ /* The static build uses global variables and isn't */
+ /* re-entrant. */
+ /* The indirect build is re-entrant but accesses all variables */
+ /* indirectly. */
+ /* */
+ /* As a consequence, the indirect build is about 10% slower */
+ /* than the static one on a _Pentium_ (this could get worse */
+ /* on older processors), but the code size is reduced by */
+ /* more than 30% ! */
+ /* */
+ /* The indirect build is now the default, defined in */
+ /* ttconfig.h. Be careful if you experiment with this. */
+
+ /* Note also that, though its code can be re-entrant, the */
+ /* component is always used in thread-safe mode. This is */
+ /* simply due to the fact that we want to use a single */
+ /* render pool (of 64 Kb), and not to waste memory. */
+
+#ifdef TT_STATIC_RASTER
+
+#define RAS_ARGS /* void */
+#define RAS_ARG /* void */
+
+#define RAS_VARS /* void */
+#define RAS_VAR /* void */
+
+#else
+
+#define RAS_ARGS TRaster_Instance* raster,
+#define RAS_ARG TRaster_Instance* raster
+
+#define RAS_VARS raster,
+#define RAS_VAR raster
+
+#endif
+
+
+ struct TRaster_Instance_;
+ typedef struct TRaster_Instance_ TRaster_Instance;
+
+ /* Render one glyph in the target bitmap, using drop-out control */
+ /* mode 'scan'. */
+ FT_INTERNAL_DEF( TT_Error )
+ Render_Glyph( RAS_ARGS TT_Outline* glyph,
+ TT_Raster_Map* target );
+
+#ifdef TT_CONFIG_OPTION_GRAY_SCALING
+ /* Render one gray-level glyph in the target pixmap. */
+ /* Palette points to an array of 5 colors used for the rendering. */
+ /* Use NULL to reuse the last palette. Default is VGA graylevels. */
+ FT_INTERNAL_DEF( TT_Error )
+ Render_Gray_Glyph( RAS_ARGS TT_Outline* glyph,
+ TT_Raster_Map* target,
+ Byte* palette );
+#endif
+
+ /* Initialize rasterizer */
+ FT_INTERNAL_DEF( TT_Error )
+ TTRaster_Init( PEngine_Instance engine );
+
+ /* Finalize it */
+ FT_INTERNAL_DEF( TT_Error )
+ TTRaster_Done( PEngine_Instance engine );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TTRASTER_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/tttables.h b/Build/source/libs/freetype/lib/tttables.h
new file mode 100644
index 00000000000..9c3c4b50fe6
--- /dev/null
+++ b/Build/source/libs/freetype/lib/tttables.h
@@ -0,0 +1,216 @@
+/*******************************************************************
+ *
+ * tttables.h 1.1
+ *
+ * TrueType Tables structures and handling (specification)
+ * (this spec has no associated 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.
+ *
+ ******************************************************************/
+
+#ifndef TTTABLES_H
+#define TTTABLES_H
+
+#include "ttconfig.h"
+#include "tttypes.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /***********************************************************************/
+ /* */
+ /* TrueType Table Types */
+ /* */
+ /***********************************************************************/
+
+ /* TrueType Collection Header */
+
+ struct TTTCHeader_
+ {
+ ULong Tag;
+ TT_Fixed version;
+ ULong DirCount;
+ PULong TableDirectory;
+ };
+
+ typedef struct TTTCHeader_ TTTCHeader;
+ typedef TTTCHeader* PTTCHeader;
+
+
+ /* TrueType Table Directory type */
+
+ struct TTableDir_
+ {
+ TT_Fixed version; /* should be 0x10000 */
+ UShort numTables; /* number of tables */
+
+ UShort searchRange; /* These parameters are only used */
+ UShort entrySelector; /* for a dichotomy search in the */
+ UShort rangeShift; /* directory. We ignore them. */
+ };
+
+ typedef struct TTableDir_ TTableDir;
+ typedef TTableDir* PTableDir;
+
+
+ /* The 'TableDir' is followed by 'numTables' TableDirEntries */
+
+ struct TTableDirEntry_
+ {
+ ULong Tag; /* table type */
+ ULong CheckSum; /* table checksum */
+ ULong Offset; /* table file offset */
+ ULong Length; /* table length */
+ };
+
+ typedef struct TTableDirEntry_ TTableDirEntry;
+ typedef TTableDirEntry* PTableDirEntry;
+
+
+ /* 'cmap' tables */
+
+ struct TCMapDir_
+ {
+ UShort tableVersionNumber;
+ UShort numCMaps;
+ };
+
+ typedef struct TCMapDir_ TCMapDir;
+ typedef TCMapDir* PCMapDir;
+
+ struct TCMapDirEntry_
+ {
+ UShort platformID;
+ UShort platformEncodingID;
+ Long offset;
+ };
+
+ typedef struct TCMapDirEntry_ TCMapDirEntry;
+ typedef TCMapDirEntry* PCMapDirEntries;
+
+
+ /* 'maxp' Maximum Profiles table */
+
+ struct TMaxProfile_
+ {
+ TT_Fixed version;
+ UShort numGlyphs,
+ maxPoints,
+ maxContours,
+ maxCompositePoints,
+ maxCompositeContours,
+ maxZones,
+ maxTwilightPoints,
+ maxStorage,
+ maxFunctionDefs,
+ maxInstructionDefs,
+ maxStackElements,
+ maxSizeOfInstructions,
+ maxComponentElements,
+ maxComponentDepth;
+ };
+
+ typedef struct TMaxProfile_ TMaxProfile;
+ typedef TMaxProfile* PMaxProfile;
+
+
+ /* table "gasp" */
+
+#define GASP_GRIDFIT 0x01
+#define GASP_DOGRAY 0x02
+
+ struct GaspRange_
+ {
+ UShort maxPPEM;
+ UShort gaspFlag;
+ };
+
+ typedef struct GaspRange_ GaspRange;
+
+
+ struct TGasp_
+ {
+ UShort version;
+ UShort numRanges;
+ GaspRange* gaspRanges;
+ };
+
+ typedef struct TGasp_ TGasp;
+
+
+ /* table "head" - now defined in freetype.h */
+ /* table "hhea" - now defined in freetype.h */
+
+
+ /* tables "HMTX" and "VMTX" */
+
+ struct TLongMetrics_
+ {
+ UShort advance;
+ Short bearing;
+ };
+
+ typedef struct TLongMetrics_ TLongMetrics, *PLongMetrics;
+
+ typedef Short TShortMetrics, *PShortMetrics;
+
+ /* 'loca' location table type */
+
+ struct TLoca_
+ {
+ UShort Size;
+ PStorage Table;
+ };
+
+ typedef struct TLoca_ TLoca;
+
+
+ /* table "name" */
+
+ struct TNameRec_
+ {
+ UShort platformID;
+ UShort encodingID;
+ UShort languageID;
+ UShort nameID;
+ UShort stringLength;
+ UShort stringOffset;
+
+ /* this last field is not defined in the spec */
+ /* but used by the FreeType engine */
+
+ PByte string;
+ };
+
+ typedef struct TNameRec_ TNameRec;
+
+
+ struct TName_Table_
+ {
+ UShort format;
+ UShort numNameRecords;
+ UShort storageOffset;
+ TNameRec* names;
+ PByte storage;
+ };
+
+ typedef struct TName_Table_ TName_Table;
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TTTABLES_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/tttags.h b/Build/source/libs/freetype/lib/tttags.h
new file mode 100644
index 00000000000..7194461a74a
--- /dev/null
+++ b/Build/source/libs/freetype/lib/tttags.h
@@ -0,0 +1,61 @@
+/*******************************************************************
+ *
+ * tttags.h
+ *
+ * tags for TrueType tables (specification only).
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef TTAGS_H
+#define TTAGS_H
+
+#include "ttconfig.h"
+#include "freetype.h" /* for MAKE_TT_TAG() */
+
+#define TTAG_BASE MAKE_TT_TAG( 'B', 'A', 'S', 'E' )
+#define TTAG_bloc MAKE_TT_TAG( 'b', 'l', 'o', 'c' )
+#define TTAG_bdat MAKE_TT_TAG( 'b', 'd', 'a', 't' )
+#define TTAG_cmap MAKE_TT_TAG( 'c', 'm', 'a', 'p' )
+#define TTAG_cvt MAKE_TT_TAG( 'c', 'v', 't', ' ' )
+#define TTAG_EBDT MAKE_TT_TAG( 'E', 'B', 'D', 'T' )
+#define TTAG_EBLC MAKE_TT_TAG( 'E', 'B', 'L', 'C' )
+#define TTAG_EBSC MAKE_TT_TAG( 'E', 'B', 'S', 'C' )
+#define TTAG_fpgm MAKE_TT_TAG( 'f', 'p', 'g', 'm' )
+#define TTAG_gasp MAKE_TT_TAG( 'g', 'a', 's', 'p' )
+#define TTAG_glyf MAKE_TT_TAG( 'g', 'l', 'y', 'f' )
+#define TTAG_GDEF MAKE_TT_TAG( 'G', 'D', 'E', 'F' )
+#define TTAG_GPOS MAKE_TT_TAG( 'G', 'P', 'O', 'S' )
+#define TTAG_GSUB MAKE_TT_TAG( 'G', 'S', 'U', 'B' )
+#define TTAG_hdmx MAKE_TT_TAG( 'h', 'd', 'm', 'x' )
+#define TTAG_head MAKE_TT_TAG( 'h', 'e', 'a', 'd' )
+#define TTAG_hhea MAKE_TT_TAG( 'h', 'h', 'e', 'a' )
+#define TTAG_hmtx MAKE_TT_TAG( 'h', 'm', 't', 'x' )
+#define TTAG_JSTF MAKE_TT_TAG( 'J', 'S', 'T', 'F' )
+#define TTAG_kern MAKE_TT_TAG( 'k', 'e', 'r', 'n' )
+#define TTAG_loca MAKE_TT_TAG( 'l', 'o', 'c', 'a' )
+#define TTAG_LTSH MAKE_TT_TAG( 'L', 'T', 'S', 'H' )
+#define TTAG_maxp MAKE_TT_TAG( 'm', 'a', 'x', 'p' )
+#define TTAG_name MAKE_TT_TAG( 'n', 'a', 'm', 'e' )
+#define TTAG_OS2 MAKE_TT_TAG( 'O', 'S', '/', '2' )
+#define TTAG_PCLT MAKE_TT_TAG( 'P', 'C', 'L', 'T' )
+#define TTAG_post MAKE_TT_TAG( 'p', 'o', 's', 't' )
+#define TTAG_prep MAKE_TT_TAG( 'p', 'r', 'e', 'p' )
+#define TTAG_ttc MAKE_TT_TAG( 't', 't', 'c', ' ' )
+#define TTAG_ttcf MAKE_TT_TAG( 't', 't', 'c', 'f' )
+#define TTAG_VDMX MAKE_TT_TAG( 'V', 'D', 'M', 'X' )
+#define TTAG_vhea MAKE_TT_TAG( 'v', 'h', 'e', 'a' )
+#define TTAG_vmtx MAKE_TT_TAG( 'v', 'm', 't', 'x' )
+
+#endif /* TTAGS_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/tttypes.h b/Build/source/libs/freetype/lib/tttypes.h
new file mode 100644
index 00000000000..3750c4ee2f7
--- /dev/null
+++ b/Build/source/libs/freetype/lib/tttypes.h
@@ -0,0 +1,151 @@
+/*******************************************************************
+ *
+ * tttypes.h
+ *
+ * Freetype engine's common types specification
+ * (this spec has no associated 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.
+ *
+ * NOTE:
+ *
+ * All these declarations are library internals, and *not* part
+ * of the high-level interface. See also 'freetype.h'.
+ *
+ ******************************************************************/
+
+#ifndef TTTYPES_H
+#define TTTYPES_H
+
+#include "ttconfig.h"
+#include "freetype.h"
+
+#ifdef __MACTYPES__
+#error "<MacTypes.h> have been included, and this prevents the proper\
+ compilation of this library. Please remove the precompiled headers."
+#endif
+
+ typedef char String;
+ typedef signed char Char;
+ typedef unsigned char Byte;
+
+ typedef unsigned short UShort;
+ typedef signed short Short;
+
+ typedef unsigned long ULong;
+ typedef signed long Long;
+
+ typedef TT_Int32 Fixed;
+
+ typedef unsigned int UInt;
+ typedef int Int;
+
+ /* Simple access types: pointers and tables */
+
+ typedef Byte* PByte;
+ typedef UShort* PUShort;
+ typedef Short* PShort;
+ typedef ULong* PULong;
+ typedef Long* PLong;
+
+ typedef Fixed* PFixed;
+
+ typedef Int* PInt;
+
+ typedef void* Pointer;
+
+ typedef TT_F26Dot6* PCoordinates;
+ typedef unsigned char* PTouchTable;
+
+
+#ifndef Bool
+ typedef int Bool; /* No boolean type in C */
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+ typedef Long Storage;
+ typedef Storage* PStorage;
+
+
+/* Rounding mode constants */
+
+#define TT_Round_Off 5
+#define TT_Round_To_Half_Grid 0
+#define TT_Round_To_Grid 1
+#define TT_Round_To_Double_Grid 2
+#define TT_Round_Up_To_Grid 4
+#define TT_Round_Down_To_Grid 3
+#define TT_Round_Super 6
+#define TT_Round_Super_45 7
+
+
+/* Touch flag masks */
+
+#define TT_Flag_On_Curve 1
+#define TT_Flag_Touched_X 2
+#define TT_Flag_Touched_Y 4
+#define TT_Flag_Touched_Both 6
+
+
+/* Error management constants :) */
+
+#define SUCCESS 0
+#define FAILURE -1
+
+
+/* The min and max functions missing in C. As usual, be careful not to */
+/* write things like MIN( a++, b++ ) to avoid side effects. */
+
+#ifndef MIN
+#define MIN( a, b ) ( (a) < (b) ? (a) : (b) )
+#endif
+
+#ifndef MAX
+#define MAX( a, b ) ( (a) > (b) ? (a) : (b) )
+#endif
+
+#ifndef ABS
+#define ABS( a ) ( (a) < 0 ? -(a) : (a) )
+#endif
+
+/* conversion macros for the handles defined in freetype.h */
+
+#define HANDLE_Val( handle ) ((handle).z)
+
+#define HANDLE_Engine( handle ) ((PEngine_Instance)HANDLE_Val( handle ))
+
+#define HANDLE_Face( handle ) ((PFace)HANDLE_Val( handle ))
+
+#define HANDLE_Instance( handle ) ((PInstance)HANDLE_Val( handle ))
+
+/* HANDLE_Stream( handle ) must be defined in ttfile.c */
+
+#define HANDLE_Glyph( handle ) ((PGlyph)HANDLE_Val( handle ))
+
+#define HANDLE_CharMap( handle ) ((PCMapTable)HANDLE_Val( handle ))
+
+#define HANDLE_Set( handle, val ) ((handle).z = (void*)(val))
+
+
+#endif /* TTTYPES_H */
+
+
+/* END */
diff --git a/Build/source/libs/freetype/lib/win32.mak b/Build/source/libs/freetype/lib/win32.mak
new file mode 100644
index 00000000000..22bba6b0d5d
--- /dev/null
+++ b/Build/source/libs/freetype/lib/win32.mak
@@ -0,0 +1,75 @@
+################################################################################
+#
+# Makefile : Freetype / src
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <03/08/12 23:08:48 popineau>
+#
+################################################################################
+root_srcdir=..\..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+USE_GNUW32 = 1
+USE_ZLIB = 1
+USE_FREETYPE = 1
+MAKE_FREETYPE = 1
+
+!include <msvc/common.mak>
+
+programs = $(freetypedll)
+libfiles = $(freetypelib)
+includefiles =
+manfiles =
+objects = \
+ $(objdir)\ttapi.obj \
+ $(objdir)\ttcache.obj \
+ $(objdir)\ttcalc.obj \
+ $(objdir)\ttcmap.obj \
+ $(objdir)\ttdebug.obj \
+ $(objdir)\ttextend.obj \
+ $(objdir)\ttfile.obj \
+ $(objdir)\ttgload.obj \
+ $(objdir)\ttinterp.obj \
+ $(objdir)\ttload.obj \
+ $(objdir)\ttmemory.obj \
+ $(objdir)\ttmutex.obj \
+ $(objdir)\ttobjs.obj \
+ $(objdir)\ttraster.obj
+
+default: all
+
+all: $(objdir) $(freetype)
+
+lib: $(objdir) $(freetypelib)
+
+!ifdef FREETYPE_DLL
+DEFS = $(DEFS) -I.\arch\win32 -DMAKE_FREETYPE_DLL
+
+$(freetypelib): $(objects)
+ $(archive) /DEF $(objects)
+
+$(freetypedll): $(objects) $(gnuw32lib)
+ $(link_dll) $(objects) $(freetypelib:.lib=.exp) $(conlibs) $(gnuw32lib)
+!else
+$(freetypelib): $(objects)
+ $(archive) $(objects)
+!endif
+
+!include <msvc/config.mak>
+!include <msvc/install.mak>
+
+install:: install-exec install-lib install-include
+
+!include <msvc/clean.mak>
+
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+#
+# Local Variables:
+# mode: makefile
+# End:
diff --git a/Build/source/libs/freetype/license.txt b/Build/source/libs/freetype/license.txt
new file mode 100644
index 00000000000..b46b9ddd695
--- /dev/null
+++ b/Build/source/libs/freetype/license.txt
@@ -0,0 +1,7 @@
+
+FreeType comes with two licenses from which you can choose the one which
+fits your needs best:
+
+ . The FreeType License, in file `docs/FTL.txt';
+
+ . The GNU Public License, in file `docs/GPL.txt'.
diff --git a/Build/source/libs/freetype/ltconfig b/Build/source/libs/freetype/ltconfig
new file mode 100755
index 00000000000..a01334f9212
--- /dev/null
+++ b/Build/source/libs/freetype/ltconfig
@@ -0,0 +1,3078 @@
+#! /bin/sh
+
+# ltconfig - Create a system-specific libtool.
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A lot of this script is taken from autoconf-2.10.
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+echo=echo
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec "$SHELL" "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) PATH_SEPARATOR=';' ;;
+ *) PATH_SEPARATOR=':' ;;
+ esac
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
+ test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH /usr/ucb; do
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running ltconfig again with it.
+ ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf "%s\n"'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# The name of this program.
+progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
+
+# Constants:
+PROGRAM=ltconfig
+PACKAGE=libtool
+VERSION=1.3.4
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+rm="rm -f"
+
+help="Try \`$progname --help' for more information."
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+enable_shared=yes
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+enable_static=yes
+enable_fast_install=yes
+enable_dlopen=unknown
+enable_win32_dll=no
+ltmain=
+silent=
+srcdir=
+ac_config_guess=
+ac_config_sub=
+host=
+nonopt=
+ofile="$default_ofile"
+verify_host=yes
+with_gcc=no
+with_gnu_ld=no
+need_locks=yes
+ac_ext=c
+objext=o
+libext=a
+exeext=
+cache_file=
+
+old_AR="$AR"
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+old_CPPFLAGS="$CPPFLAGS"
+old_LDFLAGS="$LDFLAGS"
+old_LD="$LD"
+old_LN_S="$LN_S"
+old_LIBS="$LIBS"
+old_NM="$NM"
+old_RANLIB="$RANLIB"
+old_DLLTOOL="$DLLTOOL"
+old_OBJDUMP="$OBJDUMP"
+old_AS="$AS"
+
+# Parse the command line options.
+args=
+prev=
+for option
+do
+ case "$option" in
+ -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ eval "$prev=\$option"
+ prev=
+ continue
+ fi
+
+ case "$option" in
+ --help) cat <<EOM
+Usage: $progname [OPTION]... [HOST [LTMAIN]]
+
+Generate a system-specific libtool script.
+
+ --debug enable verbose shell tracing
+ --disable-shared do not build shared libraries
+ --disable-static do not build static libraries
+ --disable-fast-install do not optimize for fast installation
+ --enable-dlopen enable dlopen support
+ --enable-win32-dll enable building dlls on win32 hosts
+ --help display this help and exit
+ --no-verify do not verify that HOST is a valid host type
+-o, --output=FILE specify the output file [default=$default_ofile]
+ --quiet same as \`--silent'
+ --silent do not print informational messages
+ --srcdir=DIR find \`config.guess' in DIR
+ --version output version information and exit
+ --with-gcc assume that the GNU C compiler will be used
+ --with-gnu-ld assume that the C compiler uses the GNU linker
+ --disable-lock disable file locking
+ --cache-file=FILE configure cache file
+
+LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
+that provides basic libtool functionality.
+
+HOST is the canonical host system name [default=guessed].
+EOM
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --disable-shared) enable_shared=no ;;
+
+ --disable-static) enable_static=no ;;
+
+ --disable-fast-install) enable_fast_install=no ;;
+
+ --enable-dlopen) enable_dlopen=yes ;;
+
+ --enable-win32-dll) enable_win32_dll=yes ;;
+
+ --quiet | --silent) silent=yes ;;
+
+ --srcdir) prev=srcdir ;;
+ --srcdir=*) srcdir="$optarg" ;;
+
+ --no-verify) verify_host=no ;;
+
+ --output | -o) prev=ofile ;;
+ --output=*) ofile="$optarg" ;;
+
+ --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
+
+ --with-gcc) with_gcc=yes ;;
+ --with-gnu-ld) with_gnu_ld=yes ;;
+
+ --disable-lock) need_locks=no ;;
+
+ --cache-file=*) cache_file="$optarg" ;;
+
+ -*)
+ echo "$progname: unrecognized option \`$option'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ if test -z "$ltmain"; then
+ ltmain="$option"
+ elif test -z "$host"; then
+# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
+# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
+# echo "$progname: warning \`$option' is not a valid host type" 1>&2
+# fi
+ host="$option"
+ else
+ echo "$progname: too many arguments" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+done
+
+if test -z "$ltmain"; then
+ echo "$progname: you must specify a LTMAIN file" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+if test ! -f "$ltmain"; then
+ echo "$progname: \`$ltmain' does not exist" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+# Quote any args containing shell metacharacters.
+ltconfig_args=
+for arg
+do
+ case "$arg" in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ltconfig_args="$ltconfig_args '$arg'" ;;
+ *) ltconfig_args="$ltconfig_args $arg" ;;
+ esac
+done
+
+# A relevant subset of AC_INIT.
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 compiler messages saved in config.log
+# 6 checking for... messages and results
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>>./config.log
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
+if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
+
+if test -n "$cache_file" && test -r "$cache_file"; then
+ echo "loading cache $cache_file within ltconfig"
+ . $cache_file
+fi
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+if test -z "$srcdir"; then
+ # Assume the source directory is the same one as the path to LTMAIN.
+ srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
+ test "$srcdir" = "$ltmain" && srcdir=.
+fi
+
+trap "$rm conftest*; exit 1" 1 2 15
+if test "$verify_host" = yes; then
+ # Check for config.guess and config.sub.
+ ac_aux_dir=
+ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/config.guess; then
+ ac_aux_dir=$ac_dir
+ break
+ fi
+ done
+ if test -z "$ac_aux_dir"; then
+ echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+ ac_config_guess=$ac_aux_dir/config.guess
+ ac_config_sub=$ac_aux_dir/config.sub
+
+ # Make sure we can run config.sub.
+ if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else
+ echo "$progname: cannot run $ac_config_sub" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+ host_alias=$host
+ case "$host_alias" in
+ "")
+ if host_alias=`$SHELL $ac_config_guess`; then :
+ else
+ echo "$progname: cannot guess host type; you must specify one" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+ host=`$SHELL $ac_config_sub $host_alias`
+ echo "$ac_t$host" 1>&6
+
+ # Make sure the host verified.
+ test -z "$host" && exit 1
+
+elif test -z "$host"; then
+ echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+else
+ host_alias=$host
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host_os" in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+case "$host_os" in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
+# Set a sane default for `OBJDUMP'.
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+# If RANLIB is not set, then run the test.
+if test "${RANLIB+set}" != "set"; then
+ result=no
+
+ echo $ac_n "checking for ranlib... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
+ RANLIB="ranlib"
+ result="ranlib"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ echo "$ac_t$result" 1>&6
+fi
+
+if test -n "$RANLIB"; then
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+fi
+
+# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$AS" && AS=as
+
+# Check to see if we are using GCC.
+if test "$with_gcc" != yes || test -z "$CC"; then
+ # If CC is not set, then try to find GCC or a usable CC.
+ if test -z "$CC"; then
+ echo $ac_n "checking for gcc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
+ CC="gcc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+ fi
+
+ # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
+ if test -z "$CC"; then
+ echo $ac_n "checking for cc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ cc_rejected=no
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
+ if test "$dir/cc" = "/usr/ucb/cc"; then
+ cc_rejected=yes
+ continue
+ fi
+ CC="cc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test $cc_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same name, so the bogon will be chosen
+ # first if we set CC to just the name; use the full file name.
+ shift
+ set dummy "$dir/cc" "$@"
+ shift
+ CC="$@"
+ fi
+ fi
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$CC"; then
+ echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
+ exit 1
+ fi
+ fi
+
+ # Now see if the compiler is really GCC.
+ with_gcc=no
+ echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
+ echo "$progname:581: checking whether we are using GNU C" >&5
+
+ $rm conftest.c
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ with_gcc=yes
+ fi
+ $rm conftest.c
+ echo "$ac_t$with_gcc" 1>&6
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for object suffix... $ac_c" 1>&6
+$rm conftest*
+echo 'int i = 1;' > conftest.c
+echo "$progname:603: checking for object suffix" >& 5
+if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+ *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+fi
+$rm conftest*
+echo "$ac_t$objext" 1>&6
+
+echo $ac_n "checking for executable suffix... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_exeext="no"
+ $rm conftest*
+ echo 'main () { return 0; }' > conftest.c
+ echo "$progname:629: checking for executable suffix" >& 5
+ if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c | *.err | *.$objext ) ;;
+ *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+ else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest*
+fi
+if test "X$ac_cv_exeext" = Xno; then
+ exeext=""
+else
+ exeext="$ac_cv_exeext"
+fi
+echo "$ac_t$ac_cv_exeext" 1>&6
+
+echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
+pic_flag=
+special_shlib_compile_flags=
+wl=
+link_static_flag=
+no_builtin_flag=
+
+if test "$with_gcc" = yes; then
+ wl='-Wl,'
+ link_static_flag='-static'
+
+ case "$host_os" in
+ beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ aix*)
+ # Below there is a dirty hack to force normal static linking with -ldl
+ # The problem is because libdl dynamically linked with both libc and
+ # libC (AIX C++ library), which obviously doesn't included in libraries
+ # list by gcc. This cause undefined symbols with -static flags.
+ # This hack allows C programs to be linked with "-static -ldl", but
+ # we not sure about C++ programs.
+ link_static_flag="$link_static_flag ${wl}-lC"
+ ;;
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ pic_flag='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ pic_flag=-Kconform_pic
+ fi
+ ;;
+ *)
+ pic_flag='-fPIC'
+ ;;
+ esac
+else
+ # PORTME Check for PIC flags for the system compiler.
+ case "$host_os" in
+ aix3* | aix4*)
+ # All AIX code is PIC.
+ link_static_flag='-bnso -bI:/lib/syscalls.exp'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ # Is there a better link_static_flag that works with the bundled CC?
+ wl='-Wl,'
+ link_static_flag="${wl}-a ${wl}archive"
+ pic_flag='+Z'
+ ;;
+
+ irix5* | irix6*)
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+
+ osf3* | osf4* | osf5*)
+ # All OSF/1 code is PIC.
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ pic_flag='-Kpic'
+ link_static_flag='-dn'
+ special_shlib_compile_flags='-belf'
+ ;;
+
+ solaris*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ sunos4*)
+ pic_flag='-PIC'
+ link_static_flag='-Bstatic'
+ wl='-Qoption ld '
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ uts4*)
+ pic_flag='-pic'
+ link_static_flag='-Bstatic'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ pic_flag='-Kconform_pic'
+ link_static_flag='-Bstatic'
+ fi
+ ;;
+ *)
+ can_build_shared=no
+ ;;
+ esac
+fi
+
+if test -n "$pic_flag"; then
+ echo "$ac_t$pic_flag" 1>&6
+
+ # Check to make sure the pic_flag actually works.
+ echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $pic_flag -DPIC"
+ echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
+ if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ case "$host_os" in
+ hpux9* | hpux10* | hpux11*)
+ # On HP-UX, both CC and GCC only warn that PIC is supported... then they
+ # create non-PIC objects. So, if there were any warnings, we assume that
+ # PIC is not supported.
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ can_build_shared=no
+ pic_flag=
+ else
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ fi
+ ;;
+ *)
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ ;;
+ esac
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ can_build_shared=no
+ pic_flag=
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ echo "$ac_t"none 1>&6
+fi
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+$rm conftest*
+echo "int some_variable = 0;" > conftest.c
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory. Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.o"
+echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
+if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_c_o=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat out/conftest.err 1>&5
+ compiler_c_o=no
+ echo "$ac_t"no 1>&6
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
+if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_o_lo=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_o_lo=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_o_lo=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$ac_t$hard_links" 1>&6
+ $rm conftest*
+ if test "$hard_links" = no; then
+ echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+if test "$with_gcc" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
+ echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+ if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_rtti_exceptions=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_rtti_exceptions=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_rtti_exceptions=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+
+ if test "$compiler_rtti_exceptions" = "yes"; then
+ no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+ else
+ no_builtin_flag=' -fno-builtin'
+ fi
+
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$special_shlib_compile_flags"; then
+ echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
+ if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
+ else
+ echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
+ can_build_shared=no
+ fi
+fi
+
+echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
+$rm conftest*
+echo 'main(){return(0);}' > conftest.c
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $link_static_flag"
+echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
+if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ echo "$ac_t$link_static_flag" 1>&6
+else
+ echo "$ac_t"none 1>&6
+ link_static_flag=
+fi
+LDFLAGS="$save_LDFLAGS"
+$rm conftest*
+
+if test -z "$LN_S"; then
+ # Check to see if we can use ln -s, or we need hard links.
+ echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
+ $rm conftest.dat
+ if ln -s X conftest.dat 2>/dev/null; then
+ $rm conftest.dat
+ LN_S="ln -s"
+ else
+ LN_S=ln
+ fi
+ if test "$LN_S" = "ln -s"; then
+ echo "$ac_t"yes 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+fi
+
+# Make sure LD is an absolute path.
+if test -z "$LD"; then
+ ac_prog=ld
+ if test "$with_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
+ echo "$progname:991: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we are not using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld... $ac_c" 1>&6
+ echo "$progname:1015: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+ echo "$progname:1018: checking for non-GNU ld" >&5
+ fi
+
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ fi
+
+ if test -n "$LD"; then
+ echo "$ac_t$LD" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$LD"; then
+ echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
+ exit 1
+ fi
+fi
+
+# Check to see if it really is or is not GNU ld.
+echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
+# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+echo "$ac_t$with_gnu_ld" 1>&6
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced. Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+
+case "$host_os" in
+cygwin* | mingw*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$with_gcc" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case "$host_os" in
+ aix3* | aix4*)
+ # On AIX, the GNU linker is very broken
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+
+ # Extract the symbol export list from an `--export-all' def file,
+ # then regenerate the def file from the symbol export list, so that
+ # the compiled dll only exports the symbol export list.
+ export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~
+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols'
+
+ archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+ _lt_hint=1;
+ for symbol in `cat $export_symbols`; do
+ echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def;
+ _lt_hint=`expr 1 + \$_lt_hint`;
+ done~
+ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
+
+ old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
+ # can we support soname and/or expsyms with a.out? -oliva
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = yes; then
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ case $host_os in
+ cygwin* | mingw*)
+ # dlltool doesn't understand --whole-archive et. al.
+ whole_archive_flag_spec=
+ ;;
+ *)
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ ;;
+ esac
+ fi
+else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case "$host_os" in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4*)
+ hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+ hardcode_libdir_separator=':'
+ if test "$with_gcc" = yes; then
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ shared_flag='-shared'
+ else
+ shared_flag='${wl}-bM:SRE'
+ hardcode_direct=yes
+ fi
+ allow_undefined_flag=' ${wl}-berok'
+ archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+ archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+ case "$host_os" in aix4.[01]|aix4.[01].*)
+ # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+ always_export_symbols=yes ;;
+ esac
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ cygwin* | mingw*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs'
+ fix_srcfile_path='`cygpath -w $srcfile`'
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ case "$host_os" in
+ hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
+ esac
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_minus_L=yes # Not in the search PATH, but as the default
+ # location of the library.
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ irix5* | irix6*)
+ if test "$with_gcc" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
+ fi
+ hardcode_libdir_flag_spec='${wl}-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # As osf3* with the addition of the -msym flag
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ sco3.2v5*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case "$host_os" in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv5*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec=
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ unixware7*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+echo "$ac_t$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+if test -z "$NM"; then
+ echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+ case "$NM" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -p"
+ break
+ else
+ NM=${NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$NM" && NM=nm
+ ;;
+ esac
+ echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
+ ;;
+irix*)
+ symcode='[BCDEGRST]'
+ ;;
+solaris*)
+ symcode='[BDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+ global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+ $rm conftest*
+ cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ echo "$progname:1635: checking if global_symbol_pipe works" >&5
+ if { (eval echo $progname:1636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { echo "$progname:1639: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.c
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
+
+ cat <<EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
+ cat <<\EOF >> conftest.c
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$objext conftstm.$objext
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+ if { (eval echo $progname:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ LIBS="$save_LIBS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ global_symbol_pipe=
+ fi
+done
+if test "$pipe_works" = yes; then
+ echo "${ac_t}ok" 1>&6
+else
+ echo "${ac_t}failed" 1>&6
+fi
+
+if test -z "$global_symbol_pipe"; then
+ global_symbol_to_cdecl=
+fi
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$hardcode_shlibpath_var" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+echo "$ac_t$hardcode_action" 1>&6
+
+
+reload_flag=
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
+# PORTME Some linkers may need a different reload flag.
+reload_flag='-r'
+echo "$ac_t$reload_flag" 1>&6
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+# PORTME Fill in your ld.so characteristics
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+file_magic_cmd=
+file_magic_test_file=
+deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
+case "$host_os" in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}.so$major'
+ ;;
+
+aix4*)
+ version_type=linux
+ # AIX has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ # We preserve .a as extension for shared libraries though AIX4.2
+ # and later linker supports .so
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
+ shlibpath_var=LIBPATH
+ deplibs_check_method=pass_all
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}.so'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ deplibs_check_method=pass_all
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ export_dynamic_flag_spec=-rdynamic
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw*)
+ version_type=windows
+ need_version=no
+ need_lib_prefix=no
+ if test "$with_gcc" = yes; then
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+ else
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+ fi
+ dynamic_linker='Win32 ld.exe'
+ deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ file_magic_cmd='${OBJDUMP} -f'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case "$version_type" in
+ freebsd-elf*)
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ deplibs_check_method=unknown
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_os" in
+ freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ *) # from 3.2 on
+ shlibpath_overrides_runpath=no
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ dynamic_linker="$host_os dld.sl"
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+ soname_spec='${libname}${release}.sl$major'
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+irix5* | irix6*)
+ version_type=irix
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}.so.$major'
+ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
+ case "$host_os" in
+ irix5*)
+ libsuff= shlibsuff=
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case "$LD" in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ deplibs_check_method='pass_all'
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+
+ if test -f /lib/ld.so.1; then
+ dynamic_linker='GNU ld.so'
+ else
+ # Only the GNU ld.so supports shared libraries on MkLinux.
+ case "$host_cpu" in
+ powerpc*) dynamic_linker=no ;;
+ *) dynamic_linker='Linux ld.so' ;;
+ esac
+ fi
+ ;;
+
+netbsd*)
+ version_type=sunos
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+openbsd*)
+ version_type=sunos
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ need_version=no
+ fi
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+os2*)
+ libname_spec='$name'
+ need_lib_prefix=no
+ library_names_spec='$libname.dll $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_version=no
+ soname_spec='${libname}${release}.so'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method='file_magic COFF format alpha shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ deplibs_check_method='pass_all'
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/lib/libc.so
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_vendor" in
+ ncr)
+ deplibs_check_method='pass_all'
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+ soname_spec='$libname.so.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$ac_t$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
+
+# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
+# configure.in, otherwise build static only libraries.
+case "$host_os" in
+cygwin* | mingw* | os2*)
+ if test x$can_build_shared = xyes; then
+ test x$enable_win32_dll = xno && can_build_shared=no
+ echo "checking if package supports dlls... $can_build_shared" 1>&6
+ fi
+;;
+esac
+
+if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
+ case "$deplibs_check_method" in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+fi
+
+echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ test "$enable_shared" = yes && enable_static=no
+ ;;
+esac
+
+echo "$ac_t$enable_shared" 1>&6
+
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+
+echo "checking whether to build static libraries... $enable_static" 1>&6
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
+ lt_cv_dlopen=no lt_cv_dlopen_libs=
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "$progname:2212: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2220 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo $progname:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "$progname:2252: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2257 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "$progname:2299: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2307 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo $progname:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "$progname:2339: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2344 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "$progname:2387: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2395 "ltconfig"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo $progname:2409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+fi
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ fi
+
+ case "$lt_cv_dlopen" in
+ dlopen)
+for ac_hdr in dlfcn.h; do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "$progname:2452: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2457 "ltconfig"
+#include <$ac_hdr>
+int fnord = 0;
+EOF
+ac_try="$ac_compile >/dev/null 2>conftest.out"
+{ (eval echo $progname:2462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ if test "x$ac_cv_header_dlfcn_h" = xyes; then
+ CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+ fi
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2490: checking whether a program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self=cross
+ else
+ cat > conftest.c <<EOF
+#line 2498 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+ if test "$lt_cv_dlopen_self" = yes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2563: checking whether a statically linked program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self_static=cross
+ else
+ cat > conftest.c <<EOF
+#line 2571 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self_static=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self_static=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+fi
+ ;;
+ esac
+
+ case "$lt_cv_dlopen_self" in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case "$lt_cv_dlopen_self_static" in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+# Copy echo and quote the copy, instead of the original, because it is
+# used later.
+ltecho="$echo"
+if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ltecho="$CONFIG_SHELL \$0 --fallback-echo"
+fi
+LTSHELL="$SHELL"
+
+LTCONFIG_VERSION="$VERSION"
+
+# Only quote variables if we're using ltmain.sh.
+case "$ltmain" in
+*.sh)
+ # Now quote all the things that may contain metacharacters.
+ for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
+ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+ reload_flag reload_cmds wl \
+ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+ library_names_spec soname_spec \
+ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
+ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ hardcode_libdir_flag_spec hardcode_libdir_separator \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+ case "$var" in
+ reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case "$ltecho" in
+ *'\$0 --fallback-echo"')
+ ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+ trap "$rm \"$ofile\"; exit 1" 1 2 15
+ echo "creating $ofile"
+ $rm "$ofile"
+ cat <<EOF > "$ofile"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+### BEGIN LIBTOOL CONFIG
+EOF
+ cfgfile="$ofile"
+ ;;
+
+*)
+ # Double-quote the variables that need it (for aesthetics).
+ for var in old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
+ eval "$var=\\\"\$var\\\""
+ done
+
+ # Just create a config file.
+ cfgfile="$ofile.cfg"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ echo "creating $cfgfile"
+ $rm "$cfgfile"
+ cat <<EOF > "$cfgfile"
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+EOF
+ ;;
+esac
+
+cat <<EOF >> "$cfgfile"
+# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
+# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
+# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
+# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
+# $0$ltconfig_args
+#
+# Compiler and other test output produced by $progname, useful for
+# debugging $progname, is in ./config.log if it exists.
+
+# The version of $progname that generated this script.
+LTCONFIG_VERSION=$LTCONFIG_VERSION
+
+# Shell to use when invoking shell scripts.
+SHELL=$LTSHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$ltecho
+
+# The archiver.
+AR=$AR
+
+# The default C compiler.
+CC=$CC
+
+# The linker used to build libraries.
+LD=$LD
+
+# Whether we need hard or soft links.
+LN_S=$LN_S
+
+# A BSD-compatible nm program.
+NM=$NM
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$reload_flag
+reload_cmds=$reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$wl
+
+# Object file suffix (normally "o").
+objext="$objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$pic_flag
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$RANLIB
+old_archive_cmds=$old_archive_cmds
+old_postinstall_cmds=$old_postinstall_cmds
+old_postuninstall_cmds=$old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$old_archive_from_new_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$archive_cmds
+archive_expsym_cmds=$archive_expsym_cmds
+postinstall_cmds=$postinstall_cmds
+postuninstall_cmds=$postuninstall_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$global_symbol_to_cdecl
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$include_expsyms
+
+EOF
+
+case "$ltmain" in
+*.sh)
+ echo '### END LIBTOOL CONFIG' >> "$ofile"
+ echo >> "$ofile"
+ case "$host_os" in
+ aix3*)
+ cat <<\EOF >> "$ofile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # Append the ltmain.sh script.
+ sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+
+ chmod +x "$ofile"
+ ;;
+
+*)
+ # Compile the libtool program.
+ echo "FIXME: would compile $ltmain"
+ ;;
+esac
+
+test -n "$cache_file" || exit 0
+
+# AC_CACHE_SAVE
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/Build/source/libs/freetype/ltmain.sh b/Build/source/libs/freetype/ltmain.sh
new file mode 100755
index 00000000000..ab65054f17a
--- /dev/null
+++ b/Build/source/libs/freetype/ltmain.sh
@@ -0,0 +1,4012 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun ltconfig.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.3.4
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+SP2NL='tr \040 \012'
+NL2SP='tr \015\012 \040\040'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+if test "$LTCONFIG_VERSION" != "$VERSION"; then
+ echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case "$arg" in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ execute_dlfiles)
+ eval "$prev=\"\$$prev \$arg\""
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case "$arg" in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case "$nonopt" in
+ *cc | *++ | gcc* | *-gcc*)
+ mode=link
+ for arg
+ do
+ case "$arg" in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case "$mode" in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ # Accept any command-line options.
+ case "$arg" in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+ esac
+
+ case "$user_target" in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly in scan
+ # sets, so we specify it separately.
+ case "$lastarg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case "$user_target" in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case "$libobj" in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case "$libobj" in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if test -z "$pic_flag" && test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ command="$base_compile $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link)
+ modename="$modename: link"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# */
+#
+# #include <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (!dll)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ linkopts=
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ lib_search_path=
+ fi
+ # now prepend the system-specific ones
+ eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ link_against_libtool_libs=
+ ltlibs=
+ module=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case "$arg" in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case "$prev" in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case "$arg" in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case "$arg" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi
+
+ prevarg="$arg"
+
+ case "$arg" in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: not more than one -exported-symbols argument allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case " $deplibs " in
+ *" $arg "*) ;;
+ *) deplibs="$deplibs $arg";;
+ esac
+ case " $lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir";;
+ esac
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ case ":$dllsearchpath:" in
+ ::) dllsearchpath="$dllsearchdir";;
+ *":$dllsearchdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
+ esac
+ ;;
+ esac
+ ;;
+
+ -l*)
+ if test "$arg" = "-lc"; then
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # These systems don't actually have c library (as such)
+ continue
+ ;;
+ esac
+ elif test "$arg" = "-lm"; then
+ case "$host" in
+ *-*-cygwin* | *-*-beos*)
+ # These systems don't actually have math library (as such)
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # If we have no pic_flag, then this is the same as -all-static.
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.o | *.obj | *.a | *.lib)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A library object.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ fi
+ libobjs="$libobjs $arg"
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ dlname=
+ libdir=
+ library_names=
+ old_library=
+
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ # If there is no directory component, then add one.
+ case "$arg" in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Find the relevant object directory and library name.
+ name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+
+ if test "X$installed" = Xyes; then
+ dir="$libdir"
+ else
+ dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$arg"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ fi
+
+ if test -n "$dependency_libs"; then
+ # Extract -R and -L from dependency_libs
+ temp_deplibs=
+ for deplib in $dependency_libs; do
+ case "$deplib" in
+ -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ case " $rpath $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ -L*) case "$compile_command $temp_deplibs " in
+ *" $deplib "*) ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ case " $lib_search_path " in
+ *" $temp_dir "*) ;;
+ *) lib_search_path="$lib_search_path $temp_dir";;
+ esac
+ ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ if test -z "$libdir"; then
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$deplibs$dependency_libs"
+ compile_command="$compile_command $dir/$old_library$dependency_libs"
+ finalize_command="$finalize_command $dir/$old_library$dependency_libs"
+ continue
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking statically,
+ # we need to preload.
+ prev=dlprefiles
+ else
+ # We should not create a dependency on this library, but we
+ # may need any libraries it requires.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ prev=
+ continue
+ fi
+ fi
+
+ # The library was specified with -dlpreopen.
+ if test "$prev" = dlprefiles; then
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ dlprefiles="$dlprefiles $dir/$old_library"
+ else
+ dlprefiles="$dlprefiles $dir/$linklib"
+ fi
+ prev=
+ fi
+
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ link_against_libtool_libs="$link_against_libtool_libs $arg"
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+
+ # We need an absolute path.
+ case "$dir" in
+ [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+
+ # This is the magic to use -rpath.
+ # Skip directories that are in the system default run-time
+ # search path, unless they have been requested with -R.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+
+ lib_linked=yes
+ case "$hardcode_action" in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ compile_command="$compile_command $dir/$linklib"
+ deplibs="$deplibs $dir/$linklib"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ if test -n "$dllsearchpath"; then
+ dllsearchpath="$dllsearchpath:$dllsearchdir"
+ else
+ dllsearchpath="$dllsearchdir"
+ fi
+ ;;
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case "$host" in
+ *-*-sunos*)
+ compile_shlibpath="$compile_shlibpath$dir:"
+ ;;
+ esac
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$dir -l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ case ":$compile_shlibpath:" in
+ *":$dir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$dir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ relink)
+ if test "$hardcode_direct" = yes; then
+ compile_command="$compile_command $absdir/$linklib"
+ deplibs="$deplibs $absdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$compile_command " in
+ *" -L$absdir "*) ;;
+ *) compile_command="$compile_command -L$absdir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$absdir -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$compile_shlibpath:" in
+ *":$absdir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$absdir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ *)
+ lib_linked=no
+ ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ finalize_command="$finalize_command $libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$finalize_command " in
+ *" -L$libdir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$finalize_shlibpath:" in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ else
+ # Transform directly to old archives if we don't build new libraries.
+ if test -n "$pic_flag" && test -z "$old_library"; then
+ $echo "$modename: cannot find static library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_command="$compile_command $dir/$linklib"
+ finalize_command="$finalize_command $dir/$linklib"
+ else
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$dir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ fi
+
+ # Add in any libraries that this one depends upon.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ case "$output" in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *.a | *.lib)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ ;;
+
+ *.la)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case "$outputname" in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ if test -n "$objs"; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
+ exit 1
+ fi
+
+ # How the heck are we supposed to write a wrapper for a shared library?
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
+ exit 1
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+ dependency_libs="$deplibs"
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case "$current" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$revision" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$age" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case "$version_type" in
+ none) ;;
+
+ irix)
+ major=`expr $current - $age + 1`
+ versuffix="$major.$revision"
+ verstring="sgi$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="sgi$major.$iface:$verstring"
+ done
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ windows)
+ # Like Linux, but with '-' rather than '.', since we only
+ # want one extension on Windows 95.
+ major=`expr $current - $age`
+ versuffix="-$major-$age-$revision"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ dependency_libs="$deplibs"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *)
+ # Add libc to deplibs on all other systems.
+ deplibs="$deplibs -lc"
+ ;;
+ esac
+ fi
+
+ # Create the output directory, or remove our outputs if we need to.
+ if test -d $output_objdir; then
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ else
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ if test "$build_libtool_libs" = yes; then
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case "$deplibs_check_method" in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage the situation:
+ # Compile a seperate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | sed 's/.* -> //'`
+ case "$potliblink" in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | sed 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linkopts="$linkopts $flag"
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ *.lo | *.o | *.obj)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case "$output" in
+ *.lo)
+ if test -n "$objs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag"; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ # Anything else should be a program.
+ *)
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$compile_rpath " in
+ *" $libdir "*) ;;
+ *) compile_rpath="$compile_rpath $libdir" ;;
+ esac
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ # Create the binary in the object directory, then wrap it.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case "$dlsyms" in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | sed -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
+ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
+ < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr_t) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case "$host" in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case "$0" in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ link_against_libtool_libs='$link_against_libtool_libs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if (cd \"\$thisdir\" && eval \$relink_command); then :
+ else
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ *-*-cygwin* | *-*-mingw | *-*-os2*)
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case "$output" in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ if test -n "$xrpath"; then
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ done
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ fi
+ $rm $output
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$dlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'\
+"
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case "$arg" in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case "$file" in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case "$file" in
+ *.a | *.lib)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$realname $destdir/$realname"
+ $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case "$destfile" in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.o | *.obj)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ link_against_libtool_libs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$link_against_libtool_libs"; then
+ $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $link_against_libtool_libs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec $SHELL $0 --finish$current_libdirs
+ exit 1
+ fi
+
+ exit 0
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case "$file" in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case "$file" in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now actually exec the command.
+ eval "exec \$cmd$args"
+
+ $echo "$modename: cannot exec \$cmd$args"
+ exit 1
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool uninstall mode
+ uninstall)
+ modename="$modename: uninstall"
+ rm="$nonopt"
+ files=
+
+ for arg
+ do
+ case "$arg" in
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ rmfiles="$file"
+
+ case "$name" in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $dir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+
+ *)
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+ esac
+ done
+ exit 0
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+fi # test -z "$show_help"
+
+# We need to display help for each of the modes.
+case "$mode" in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/Build/source/libs/freetype/mkinstalldirs b/Build/source/libs/freetype/mkinstalldirs
new file mode 100755
index 00000000000..d005d49834d
--- /dev/null
+++ b/Build/source/libs/freetype/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.2 1998/09/01 16:52:17 werner Exp $
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/Build/source/libs/freetype/net.m4 b/Build/source/libs/freetype/net.m4
new file mode 100644
index 00000000000..254473be86f
--- /dev/null
+++ b/Build/source/libs/freetype/net.m4
@@ -0,0 +1,55 @@
+dnl
+dnl The following was written by jhawk@mit.edu
+dnl
+dnl AC_LIBRARY_NET: Id: net.m4,v 1.4 1997/10/25 20:49:53 jhawk Exp
+dnl
+dnl This test is for network applications that need socket() and
+dnl gethostbyname() -ish functions. Under Solaris, those applications need to
+dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
+dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
+dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
+dnl IRIX).
+dnl
+dnl Unfortunately, many application developers are not aware of this, and
+dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
+dnl also easy to write tests that cause -lnsl to be used under operating
+dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
+dnl uses -lnsl for TLI.
+dnl
+dnl This test exists so that every application developer does not test this in
+dnl a different, and subtly broken fashion.
+dnl
+dnl It has been argued that this test should be broken up into two seperate
+dnl tests, one for the resolver libraries, and one for the libraries necessary
+dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
+dnl allowing the autoconf user to use them independantly potentially results in
+dnl unfortunate ordering dependancies -- as such, such component macros would
+dnl have to carefully use indirection and be aware if the other components were
+dnl executed. Since other autoconf macros do not go to this trouble, and almost
+dnl no applications use sockets without the resolver, this complexity has not
+dnl been implemented.
+dnl
+dnl The check for libresolv is in case you are attempting to link statically
+dnl and happen to have a libresolv.a lying around (and no libnsl.a).
+dnl
+AC_DEFUN(AC_LIBRARY_NET, [
+ # Most operating systems have gethostbyname() in the default searched
+ # libraries (i.e. libc):
+ AC_CHECK_FUNC(gethostbyname, ,
+ # Some OSes (eg. Solaris) place it in libnsl:
+ AC_CHECK_LIB(nsl, gethostbyname, ,
+ # Some strange OSes (SINIX) have it in libsocket:
+ AC_CHECK_LIB(socket, gethostbyname, ,
+ # Unfortunately libsocket sometimes depends on libnsl.
+ # AC_CHECK_LIB's API is essentially broken so the following
+ # ugliness is necessary:
+ AC_CHECK_LIB(socket, gethostbyname,
+ LIBS="-lsocket -lnsl $LIBS",
+ AC_CHECK_LIB(resolv, gethostbyname),
+ -lnsl)
+ )
+ )
+ )
+ AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
+ AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
+ ])
diff --git a/Build/source/libs/freetype/pascal/README b/Build/source/libs/freetype/pascal/README
new file mode 100644
index 00000000000..e8c197ac579
--- /dev/null
+++ b/Build/source/libs/freetype/pascal/README
@@ -0,0 +1,10 @@
+In previous releases of Freetype v.1.x, this directory hold a Pascal
+version of the FreeType library. Since it has proven to be difficult
+to keep the Pascal version in sync with the C version, we decided to
+split the two projects, making the Pascal version of the Freetype
+1.5 library available separately.
+
+If you are interested in the Pascal version, please visit
+http://www.freetype.org for more information.
+
+--- end of pascal/README ---
diff --git a/Build/source/libs/freetype/po/.cvsignore b/Build/source/libs/freetype/po/.cvsignore
new file mode 100644
index 00000000000..2c6880244fe
--- /dev/null
+++ b/Build/source/libs/freetype/po/.cvsignore
@@ -0,0 +1,8 @@
+*.gmo
+*.mo
+Makefile
+Makefile.in
+POTFILES
+cat-id-tbl.c
+freetype.pot
+stamp-cat-id
diff --git a/Build/source/libs/freetype/po/.cvsignore.delete b/Build/source/libs/freetype/po/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/po/.cvsignore.delete
diff --git a/Build/source/libs/freetype/po/Makefile.in.in b/Build/source/libs/freetype/po/Makefile.in.in
new file mode 100644
index 00000000000..f16ad4dcbbc
--- /dev/null
+++ b/Build/source/libs/freetype/po/Makefile.in.in
@@ -0,0 +1,220 @@
+#
+#
+# Makefile for freetype I18n,
+# based on the Makefile.in.in that comes with gettext
+#
+# Erwin Dieterich, 20. 1. 1998 Erwin.Dieterich.ED@Bayer-AG.de
+#
+#
+#
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+PACKAGE = freetype
+VERSION = @freetype_version@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = $(prefix)/@DATADIRNAME@
+localedir = @LOCALEDIR@
+gnulocaledir = @LOCALEDIR@
+subdir = po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+CC = @CC@
+GMSGFMT = @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = @XGETTEXT@
+MSGMERGE = @MSGMERGE@
+
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I..
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+DISTFILES = Makefile.in.in POTFILES.in $(PACKAGE).pot
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg
+
+.c.o:
+ $(COMPILE) $<
+
+.po.pox:
+ $(MAKE) $(PACKAGE).pot
+ $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
+
+.po.mo:
+ $(MSGFMT) -o $@ $<
+
+.po.gmo:
+ file=`echo $* | sed 's,.*/,,'`.gmo \
+ && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+
+
+all: all-@USE_NLS@
+
+all-yes: $(PACKAGE).pot $(CATALOGS)
+all-no:
+ @echo "No support for NLS requested"
+
+$(PACKAGE).pot: $(POTFILES)
+ if test -n "$(XGETTEXT)"; then \
+ $(XGETTEXT) --default-domain=freetype --directory=$(srcdir)/.. \
+ --keyword=_ --files-from=$(srcdir)/POTFILES.in; \
+ mv freetype.po freetype.pot; \
+ else \
+ echo "xgettext not available: $(PACKAGE).pot not updated" 1>&2; \
+ fi
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+install-data-no: all
+install-data-yes: all
+ $(top_srcdir)/mkinstalldirs $(datadir); \
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ case "$$cat" in \
+ *.gmo) destdir=$(gnulocaledir);; \
+ *) destdir=$(localedir);; \
+ esac; \
+ lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
+ dir=$$destdir/$$lang/LC_MESSAGES; \
+ $(top_srcdir)/mkinstalldirs $$dir; \
+ if test -r $$cat; then \
+ $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+ echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+ else \
+ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+ fi; \
+ if test -r $$cat.m; then \
+ $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ if test -r $(srcdir)/$$cat.m ; then \
+ $(INSTALL_DATA) $(srcdir)/$$cat.m \
+ $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ true; \
+ fi; \
+ fi; \
+ done
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
+ rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ done
+ rm -f $(gettextsrcdir)/po-Makefile.in.in
+
+check: all
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+ rm -f core core.* *.pox $(PACKAGE).po *.old.po
+ rm -fr *.o *~
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile Makefile.in POTFILES *.mo *.gmo *.msg *.cat.m
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+ dists="$(DISTFILES)"; \
+ for file in $$dists; do \
+ ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+ || cp -p $(srcdir)/$$file $(distdir); \
+ done
+
+update-po: Makefile
+ $(MAKE) $(PACKAGE).pot
+ PATH=`pwd`/../src:$$PATH; \
+ cd $(srcdir); \
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \
+ mv $$lang.po $$lang.old.po; \
+ echo "$$lang:"; \
+ if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
+ rm -f $$lang.old.po; \
+ else \
+ echo "msgmerge for $$cat failed!"; \
+ rm -f $$lang.po; \
+ mv $$lang.old.po $$lang.po; \
+ fi; \
+ done
+
+POTFILES: POTFILES.in
+ ( if test 'x$(srcdir)' != 'x.'; then \
+ posrcprefix='$(top_srcdir)/'; \
+ else \
+ posrcprefix="../"; \
+ fi; \
+ sed -e '/^#/d' -e '/^[ ]*$$/d' \
+ -e "s@.*@ $$posrcprefix& \\\\@" \
+ -e '$$s/\(.*\) \\/\1/' < $(srcdir)/POTFILES.in > POTFILES )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+ cd .. \
+ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+ $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+.PHONY: all all-yes all-no install install-exec install-data install-data-no \
+ install-data-yes installcheck uninstall check mostlyclean clean \
+ distclean maintainer-clean dist distdir update-po
diff --git a/Build/source/libs/freetype/po/POTFILES.in b/Build/source/libs/freetype/po/POTFILES.in
new file mode 100644
index 00000000000..71ce09d9ca1
--- /dev/null
+++ b/Build/source/libs/freetype/po/POTFILES.in
@@ -0,0 +1,10 @@
+#
+# List of source files containing translatable strings
+#
+#
+lib/extend/ftxerr18.c
+test/fterror.c
+test/ftdump.c
+test/ftlint.c
+test/ftmetric.c
+test/ftsbit.c
diff --git a/Build/source/libs/freetype/po/cs.po b/Build/source/libs/freetype/po/cs.po
new file mode 100644
index 00000000000..34de4178404
--- /dev/null
+++ b/Build/source/libs/freetype/po/cs.po
@@ -0,0 +1,883 @@
+# Czech messages for FreeType
+# Copyright (C) 1998-2002 Pavel Kaòkovský
+# Pavel Kaòkovský <peak@argo.troja.mff.cuni.cz>, 1998-2002
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FreeType 1.5\n"
+"POT-Creation-Date: 2002-11-08 18:11+0000\n"
+"PO-Revision-Date: 2002-12-25\n"
+"Last-Translator: Pavel Kaòkovský <peak@argo.troja.mff.cuni.cz>, 2002\n"
+"Language-Team: Czech\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-2\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/extend/ftxerr18.c:40
+msgid ""
+"Welcome to the translation of the Freetype v.1 library!\n"
+"\n"
+"This message is not really part of the library (it is bracketed by\n"
+" #if 0 / #endif), but is really intended to be the first one in the .po\n"
+"file, and the first one that a new translator should see, to give hints.\n"
+"\n"
+"First, while this .po might seems big, the real interesting part of it\n"
+"is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+"messages are part of the demonstration programs, and are more intended\n"
+"to help grasping how to use i18n with the Freetype library. So the real\n"
+"work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+"\n"
+"A difficulty is that there are some specialized vocabulary, about\n"
+"``faces'', ``glyph'' and similar things. These are typographical things,\n"
+"and this should be researched before attempting to translate the whole\n"
+"thing. A quick look across the TrueType documentation might help to\n"
+"understand many things, too.\n"
+"\n"
+"Best wiches for your translation!\n"
+"Antoine Leca - 2002-11-08"
+msgstr ""
+"(Read)"
+
+#: lib/extend/ftxerr18.c:77
+msgid "Successful function call, no error."
+msgstr "Úspì¹né volání funkce, ¾ádná chyba."
+
+#: lib/extend/ftxerr18.c:80
+msgid "Invalid face handle."
+msgstr "Neplatný manipulátor písma."
+
+#: lib/extend/ftxerr18.c:82
+msgid "Invalid instance handle."
+msgstr "Neplatný manipulátor instance."
+
+#: lib/extend/ftxerr18.c:84
+msgid "Invalid glyph handle."
+msgstr "Neplatný manipulátor litery."
+
+#: lib/extend/ftxerr18.c:86
+msgid "Invalid charmap handle."
+msgstr "Neplatný manipulátor znakové mapy."
+
+#: lib/extend/ftxerr18.c:88
+msgid "Invalid result address."
+msgstr "Neplatná adresa výsledku."
+
+#: lib/extend/ftxerr18.c:90
+msgid "Invalid glyph index."
+msgstr "Neplatný index litery."
+
+#: lib/extend/ftxerr18.c:92
+msgid "Invalid argument."
+msgstr "Neplatný argument."
+
+#: lib/extend/ftxerr18.c:94
+msgid "Could not open file."
+msgstr "Nelze otevøít soubor."
+
+#: lib/extend/ftxerr18.c:96
+msgid "File is not a TrueType collection."
+msgstr "Soubor není kolekce písem TrueType."
+
+#: lib/extend/ftxerr18.c:98
+msgid "Mandatory table missing."
+msgstr "Nìkterá z povinných tabulek chybí."
+
+#: lib/extend/ftxerr18.c:100
+msgid "Invalid horizontal metrics (hmtx table broken)."
+msgstr "Neplatná horizontální metrika (tabulka HMTX po¹kozena)."
+
+#: lib/extend/ftxerr18.c:102
+msgid "Invalid charmap format."
+msgstr "Neplatný formát znakové mapy."
+
+#: lib/extend/ftxerr18.c:104
+msgid "Invalid ppem value."
+msgstr "Neplatné rozmìry liter (ppem)."
+
+#: lib/extend/ftxerr18.c:106
+msgid "Invalid vertical metrics (vmtx table broken)."
+msgstr "Neplatná vertikální metrika (tabulka VMTX po¹kozena)."
+
+#: lib/extend/ftxerr18.c:109
+msgid "Invalid file format."
+msgstr "Neplatný formát souboru."
+
+#: lib/extend/ftxerr18.c:112
+msgid "Invalid engine."
+msgstr "Neplatná globální data knihovny."
+
+#: lib/extend/ftxerr18.c:114
+msgid "Too many extensions."
+msgstr "Pøíli¹ mnoho roz¹íøení."
+
+#: lib/extend/ftxerr18.c:116
+msgid "Extensions unsupported."
+msgstr "Roz¹íøení není podporováno."
+
+#: lib/extend/ftxerr18.c:118
+msgid "Invalid extension id."
+msgstr "Neplatný identifikátor roz¹íøení."
+
+#: lib/extend/ftxerr18.c:121
+msgid "No vertical data in font."
+msgstr "V písmu nejsou obsa¾ena ¾ádná vertikální data."
+
+#: lib/extend/ftxerr18.c:124
+msgid "Maximum Profile (maxp) table missing."
+msgstr "Chybìjící tabulka maximálních hodnot (MAXP)."
+
+#: lib/extend/ftxerr18.c:126
+msgid "Font Header (head) table missing."
+msgstr "Chybìjící tabulka hlavièky písma (HEAD)."
+
+#: lib/extend/ftxerr18.c:128
+msgid "Horizontal Header (hhea) table missing."
+msgstr "Chybìjící tabulka horizontální hlavièky (HHEA)."
+
+#: lib/extend/ftxerr18.c:130
+msgid "Index to Location (loca) table missing."
+msgstr "Chybìjící tabulka adres liter (LOCA)."
+
+#: lib/extend/ftxerr18.c:132
+msgid "Naming (name) table missing."
+msgstr "Chybìjící tabulka jmen (NAME)."
+
+#: lib/extend/ftxerr18.c:134
+msgid "Character to Glyph Index Mapping (cmap) tables missing."
+msgstr "Chybìjící tabulky znakových map (CMAP)."
+
+#: lib/extend/ftxerr18.c:136
+msgid "Horizontal Metrics (hmtx) table missing."
+msgstr "Chybìjící tabulka horizontálních metrik (HTMX)."
+
+#: lib/extend/ftxerr18.c:138
+msgid "OS/2 table missing."
+msgstr "Chybìjící tabulka OS/2."
+
+#: lib/extend/ftxerr18.c:140
+msgid "PostScript (post) table missing."
+msgstr "Chybìjící tabulka dat pro PostScript (POST)."
+
+#: lib/extend/ftxerr18.c:142
+msgid "Glyph (glyf) table missing."
+msgstr "Chybìjící tabulka liter (GLYF)."
+
+#: lib/extend/ftxerr18.c:147
+msgid "Out of memory."
+msgstr "Nedostatek pamìti."
+
+#: lib/extend/ftxerr18.c:152
+msgid "Invalid file offset."
+msgstr "Neplatná adresa v souboru."
+
+#: lib/extend/ftxerr18.c:154
+msgid "Invalid file read."
+msgstr "Neplatné ètení ze souboru."
+
+#: lib/extend/ftxerr18.c:156
+msgid "Invalid frame access."
+msgstr "Neplatný pøístup k úseku souboru."
+
+#: lib/extend/ftxerr18.c:161
+msgid "Too many points."
+msgstr "Pøíli¹ mnoho bodù."
+
+#: lib/extend/ftxerr18.c:163
+msgid "Too many contours."
+msgstr "Pøíli¹ mnoho kontur."
+
+#: lib/extend/ftxerr18.c:165
+msgid "Invalid composite glyph."
+msgstr "Neplatná kompozitní litera."
+
+#: lib/extend/ftxerr18.c:167
+msgid "Too many instructions."
+msgstr "Pøíli¹ mnoho instrukcí."
+
+#: lib/extend/ftxerr18.c:169
+msgid "Too many function definitions (FDEF)."
+msgstr "Pøíli¹ mnoho definic funkcí (FDEF)."
+
+#: lib/extend/ftxerr18.c:174
+msgid "Invalid opcode."
+msgstr "Neplatný kód operace."
+
+#: lib/extend/ftxerr18.c:176
+msgid "Too few arguments."
+msgstr "Pøíli¹ málo argumentù."
+
+#: lib/extend/ftxerr18.c:178
+msgid "Stack overflow."
+msgstr "Pøeteèení zásobníku."
+
+#: lib/extend/ftxerr18.c:180
+msgid "Code overflow."
+msgstr "Pøeteèení oblasti instrukcí."
+
+#: lib/extend/ftxerr18.c:182
+msgid "Bad argument."
+msgstr "©patný argument."
+
+#: lib/extend/ftxerr18.c:184
+msgid "Divide by zero."
+msgstr "Dìlení nulou."
+
+#: lib/extend/ftxerr18.c:186
+msgid "Storage overflow."
+msgstr "Pøeteèení oblasti pro ukládání dat."
+
+#: lib/extend/ftxerr18.c:188
+msgid "Control Value (cvt) table overflow."
+msgstr "Pøeteèení tabulky øídících hodnot (CVT)."
+
+#: lib/extend/ftxerr18.c:190
+msgid "Invalid reference."
+msgstr "Neplatný odkaz."
+
+#: lib/extend/ftxerr18.c:192
+msgid "Invalid distance."
+msgstr "Neplatná vzdálenost."
+
+#: lib/extend/ftxerr18.c:194
+msgid "Interpolate twilight points."
+msgstr "Interpolace mezi body v \"soumraèné zónì\"."
+
+#: lib/extend/ftxerr18.c:196
+msgid "`DEBUG' opcode found."
+msgstr "Ladící operace."
+
+#: lib/extend/ftxerr18.c:198
+msgid "`ENDF' in byte-code stream."
+msgstr "Operace ENDF nalezena na ¹patném místì."
+
+#: lib/extend/ftxerr18.c:200
+msgid "Out of code ranges."
+msgstr "Mimo oblasti instrukcí."
+
+#: lib/extend/ftxerr18.c:202
+msgid "Nested function definitions."
+msgstr "Vnoøené definice funkcí."
+
+#: lib/extend/ftxerr18.c:204
+msgid "Invalid code range."
+msgstr "Neplatná oblast instrukcí."
+
+#: lib/extend/ftxerr18.c:206
+msgid "Invalid displacement."
+msgstr "Neplatné posunutí."
+
+#: lib/extend/ftxerr18.c:208
+msgid "Endless loop encountered while executing instructions."
+msgstr "Do¹lo k zacyklení bìhem vykonávání instrukcí."
+
+#: lib/extend/ftxerr18.c:213
+msgid "Nested frame access."
+msgstr "Vnoøené pøístupy k úseku souboru."
+
+#: lib/extend/ftxerr18.c:215
+msgid "Invalid cache list."
+msgstr "Neplatný seznam vyrovnávací pamìti."
+
+#: lib/extend/ftxerr18.c:217
+msgid "Could not find context."
+msgstr "Nelze najít kontext."
+
+#: lib/extend/ftxerr18.c:219
+msgid "Unlisted object."
+msgstr "Objekt není v seznamu."
+
+#: lib/extend/ftxerr18.c:224
+msgid "Raster pool overflow."
+msgstr "Pøeteèení pamìti rasterizéru."
+
+#: lib/extend/ftxerr18.c:226
+msgid "Raster: negative height encountered."
+msgstr "Rasterizér: záporná vý¹ka."
+
+#: lib/extend/ftxerr18.c:228
+msgid "Raster: invalid value."
+msgstr "Rasterizér: neplatná hodnota."
+
+#: lib/extend/ftxerr18.c:230
+msgid "Raster not initialized."
+msgstr "Rasterizér není incializován."
+
+#: lib/extend/ftxerr18.c:235
+msgid "Invalid kerning (kern) table format."
+msgstr "Neplatný formát tabulky kernù (KERN)."
+
+#: lib/extend/ftxerr18.c:237
+msgid "Invalid kerning (kern) table."
+msgstr "Neplatná tabulka kernù (KERN)."
+
+#: lib/extend/ftxerr18.c:240
+msgid "Invalid PostScript (post) table format."
+msgstr "Neplatný formát tabulky PostScript (POST)."
+
+#: lib/extend/ftxerr18.c:242
+msgid "Invalid PostScript (post) table."
+msgstr "Neplatná tabulka PostScript (POST)."
+
+#: lib/extend/ftxerr18.c:247
+msgid "Invalid TrueType Open subtable format."
+msgstr "Neplatný formát podtabulky TrueType Open."
+
+#: lib/extend/ftxerr18.c:249
+msgid "Invalid TrueType Open subtable."
+msgstr "Neplatná podtabulka TrueType Open."
+
+#: lib/extend/ftxerr18.c:251
+msgid "Glyph(s) not covered by lookup."
+msgstr "Jedna èi více liter bìhem prohledávání nenalezena."
+
+#: lib/extend/ftxerr18.c:253
+msgid "Too many nested context substitutions."
+msgstr "Pøíli¹ mnoho vnoøených kontextových substitucí."
+
+#: lib/extend/ftxerr18.c:255
+msgid "No MM (Adobe MultipleMaster) interpreter available."
+msgstr "®ádný interpreter MM (Adobe MultipleMaster) není k dispozici."
+
+#: lib/extend/ftxerr18.c:258
+msgid "Invalid glyph substitution (GSUB) table format."
+msgstr "Neplatný formát tabulky substitucí liter (GSUB)."
+
+#: lib/extend/ftxerr18.c:260
+msgid "Invalid glyph substitution (GSUB) table."
+msgstr "Neplatná tabulka substitucí liter (GSUB)."
+
+#: lib/extend/ftxerr18.c:263
+msgid "Invalid glyph positioning (GPOS) table format."
+msgstr "Neplatný formát tabulky umís»ování liter (GPOS)."
+
+#: lib/extend/ftxerr18.c:265
+msgid "Invalid glyph positioning (GPOS) table."
+msgstr "Neplatná tabulka umís»ování liter (GPOS)."
+
+#: lib/extend/ftxerr18.c:268
+msgid "Invalid glyph definition (GDEF) table format."
+msgstr "Neplatný formát tabulky definic liter (GDEF)."
+
+#: lib/extend/ftxerr18.c:270
+msgid "Invalid glyph definition (GDEF) table."
+msgstr "Neplatná tabulka definic liter (GDEF)."
+
+#: lib/extend/ftxerr18.c:277
+msgid "Invalid Error Number."
+msgstr "Neznámý kód chyby."
+
+#: test/fterror.c:49
+msgid ""
+"fterror: test TT_ErrToString18 functionality\n"
+"\n"
+msgstr ""
+"fterror: test funkce TT_ErrToString18\n"
+"\n"
+
+#: test/fterror.c:50
+msgid ""
+" with an optional numerical argument, dumps the associated message.\n"
+"\n"
+msgstr ""
+" pøi zadání èíselného argumentu vypí¹e odpovídající hlá¹ení.\n"
+"\n"
+
+#: test/fterror.c:73
+msgid "Start of fterror.\n"
+msgstr "Zaèátek fterror.\n"
+
+#: test/fterror.c:81
+msgid "End of fterror.\n"
+msgstr "Konec fterror.\n"
+
+#: test/fterror.c:96
+#, c-format
+msgid "Freetype error code 0x%04lX (%lu): %s\n"
+msgstr "Chybové hlá¹ení FreeType 0x%04lX (%lu): %s\n"
+
+#: test/ftdump.c:169 test/ftlint.c:207 test/ftmetric.c:294
+msgid "Could not create glyph container.\n"
+msgstr "Nelze vytvoøit kontejner liter.\n"
+
+#: test/ftdump.c:179 test/ftlint.c:215 test/ftmetric.c:303 test/ftsbit.c:214
+msgid "Could not create instance.\n"
+msgstr "Nelze vytvoøit instanci.\n"
+
+#: test/ftdump.c:188
+msgid "Could not create second instance.\n"
+msgstr "Nelze vytvoøit druhou instanci.\n"
+
+#: test/ftdump.c:194
+msgid "Memory footprint statistics:\n"
+msgstr "Statistika pamì»ových nárokù:\n"
+
+#: test/ftdump.c:202
+msgid "face object"
+msgstr "objekt písma"
+
+#: test/ftdump.c:203
+msgid "glyph object"
+msgstr "objekt litery"
+
+#: test/ftdump.c:204
+msgid "instance object"
+msgstr "objekt instance"
+
+#: test/ftdump.c:208
+msgid "exec. context object"
+msgstr "objekt provádìcího kontextu"
+
+#: test/ftdump.c:215
+msgid "total memory usage"
+msgstr "celková spotøeba pamìti"
+
+#: test/ftdump.c:223 test/ftdump.c:579 test/ftdump.c:789 test/ftdump.c:993
+#: test/ftdump.c:1139 test/ftlint.c:274 test/ftlint.c:287 test/ftmetric.c:390
+#: test/ftsbit.c:286
+#, c-format
+msgid "FreeType error message: %s\n"
+msgstr "Chybové hlá¹ení FreeType: %s\n"
+
+#: test/ftdump.c:300
+msgid "font name table entries\n"
+msgstr "polo¾ky v tabulce jmen\n"
+
+#: test/ftdump.c:310
+#, c-format
+msgid ""
+"PostScript name: %s\n"
+"\n"
+msgstr ""
+"PostScriptové jméno: %s\n"
+"\n"
+
+#: test/ftdump.c:333
+msgid "character map encodings\n"
+msgstr "kódování map znakù\n"
+
+#: test/ftdump.c:340 test/ftdump.c:488
+msgid "The file doesn't seem to have any encoding table.\n"
+msgstr "Soubor zøejmì neobsahuje ¾ádnou mapu znakù.\n"
+
+#: test/ftdump.c:344 test/ftdump.c:492
+#, c-format
+msgid ""
+"There are %hu encodings:\n"
+"\n"
+msgstr ""
+"%hu kódování:\n"
+"\n"
+
+#: test/ftdump.c:349
+#, c-format
+msgid "encoding %2u: "
+msgstr "kódování %2u: "
+
+#: test/ftdump.c:376 test/ftdump.c:385 test/ftdump.c:452
+#, c-format
+msgid "Unknown value %hu"
+msgstr "Neznámá hodnota %hu"
+
+#: test/ftdump.c:459
+msgid "Unknown"
+msgstr "Neznámé"
+
+#: test/ftdump.c:481
+msgid "ftxcmap test\n"
+msgstr "test roz¹íøení ftxcmap\n"
+
+#: test/ftdump.c:498
+#, c-format
+msgid "encoding %2u:\n"
+msgstr "kódování %2u:\n"
+
+#: test/ftdump.c:503
+#, c-format
+msgid "first: glyph index %hu, character code 0x%lx\n"
+msgstr "první: index litery %hu, kód znaku 0x%lx\n"
+
+#: test/ftdump.c:507
+#, c-format
+msgid "next: glyph index %hu, character code 0x%lx\n"
+msgstr "dal¹í: index litery %hu, kód znaku 0x%lx\n"
+
+#: test/ftdump.c:511
+#, c-format
+msgid "last: glyph index %hu, character code 0x%lx\n"
+msgstr "poslední: index litery %hu, kód znaku 0x%lx\n"
+
+#: test/ftdump.c:533 test/ftmetric.c:284
+msgid "Error while retrieving embedded bitmaps table.\n"
+msgstr "Chyba bìhem naèítání tabulky vlo¾ených bitmap.\n"
+
+#: test/ftdump.c:537
+msgid "embedded bitmap table\n"
+msgstr "tabulka vlo¾ených bitmap\n"
+
+#: test/ftdump.c:540
+#, c-format
+msgid " version of embedded bitmap table: 0x%lx\n"
+msgstr " verze tabulky vlo¾ených bitmap: 0x%lx\n"
+
+#: test/ftdump.c:542
+#, c-format
+msgid " number of embedded bitmap strikes: %lu\n"
+msgstr " poèet blokù vlo¾ených bitmap: %lu\n"
+
+#: test/ftdump.c:552
+#, c-format
+msgid " bitmap strike %hu/%lu: "
+msgstr " blok vlo¾ených bitmap %hu/%lu: "
+
+#: test/ftdump.c:555
+#, c-format
+msgid "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n"
+msgstr "%hux%hu pixelù, bitová hloubka %hu, litery [%hu..%hu]\n"
+
+#: test/ftdump.c:564
+#, c-format
+msgid " range format (%hu:%hu) glyphs %hu..%hu\n"
+msgstr " úsek formátu (%hu:%hu) litery %hu..%hu\n"
+
+#: test/ftdump.c:615
+msgid "Error while loading GSUB table.\n"
+msgstr "Chyba bìhem naèítání tabulky GSUB.\n"
+
+#: test/ftdump.c:619
+msgid "GSUB table\n"
+msgstr "tabulka GSUB\n"
+
+#: test/ftdump.c:626
+msgid "Error while querying GSUB script list.\n"
+msgstr "Chyba bìhem prohledávání seznamu GSUB skriptù.\n"
+
+#: test/ftdump.c:639
+#, c-format
+msgid "Error while selecting GSUB script `%4.4s'.\n"
+msgstr "Chyba pøi pokusu vybrat GSUB skript \"%4.4s\".\n"
+
+#: test/ftdump.c:644 test/ftdump.c:848
+#, c-format
+msgid " script `%4.4s' (index %hu):\n"
+msgstr " skript \"%4.4s\" (index %hu):\n"
+
+#: test/ftdump.c:652
+#, c-format
+msgid "Error while querying GSUB default language system for script `%4.4s'.\n"
+msgstr ""
+"Chyba bìhem zkoumání bì¾ného GSUB jazykového systému pro skript \"%4.4s\".\n"
+
+#: test/ftdump.c:657 test/ftdump.c:861
+msgid " default language system:\n"
+msgstr " bì¾ný jazykový systém:\n"
+
+#: test/ftdump.c:670
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Chyba pøi výbìru GSUB vlastnosti \"%4.4s\"\n"
+"pro bì¾ný jazykový systém skriptu \"%4.4s\".\n"
+
+#: test/ftdump.c:676 test/ftdump.c:757 test/ftdump.c:880 test/ftdump.c:961
+#, c-format
+msgid " feature `%4.4s' (index %hu; lookup "
+msgstr " vlastnost \"%4.4s\" (index %hu; vyhledávání "
+
+#: test/ftdump.c:692
+#, c-format
+msgid "Error while querying GSUB language list for script `%4.4s'.\n"
+msgstr "Chyba bìhem zkoumání GSUB seznamu jazykù pro skript \"%4.4s\".\n"
+
+#: test/ftdump.c:709
+#, c-format
+msgid "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n"
+msgstr "Chyba bìhem výbìru GSUB jazyka \"%4.4s\" pro skript \"%4.4s\".\n"
+
+#: test/ftdump.c:714 test/ftdump.c:918
+#, c-format
+msgid " language `%4.4s' (index %hu):\n"
+msgstr " jazyk \"%4.4s\" (index %hu):\n"
+
+#: test/ftdump.c:719 test/ftdump.c:923
+#, c-format
+msgid " required feature index %hu (lookup "
+msgstr " po¾adovaná vlastnost (index %hu; vyhledávání "
+
+#: test/ftdump.c:734
+#, c-format
+msgid ""
+"Error while querying GSUB feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Chyba bìhem zkoumání seznamu GSUB vlastností\n"
+"pro skript \"%4.4s\", jazyk \"%4.4s\".\n"
+
+#: test/ftdump.c:751
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Chyba bìhem výbìru GSUB vlastnosti \"%4.4s\"\n"
+"pro skript \"%4.4s\", jazyk \"%4.4s\".\n"
+
+#: test/ftdump.c:776 test/ftdump.c:980
+msgid ""
+"Lookups:\n"
+"\n"
+msgstr ""
+"Vyhledávací údaje:\n"
+"\n"
+
+#: test/ftdump.c:779 test/ftdump.c:983
+#, c-format
+msgid " %hu: type %hu, flag 0x%x\n"
+msgstr " %hu: typ %hu, pøíznaky 0x%x\n"
+
+#: test/ftdump.c:819
+msgid "Error while loading GPOS table.\n"
+msgstr "Chyba bìhem naèítání tabulky GPOS.\n"
+
+#: test/ftdump.c:823
+msgid "GPOS table\n"
+msgstr "tabulka GPOS\n"
+
+#: test/ftdump.c:830
+msgid "Error while querying GPOS script list.\n"
+msgstr "Chyba bìhem prohledávání seznamu GPOS skriptù.\n"
+
+#: test/ftdump.c:843
+#, c-format
+msgid "Error while selecting GPOS script `%4.4s'.\n"
+msgstr "Chyba pøi pokusu vybrat GPOS skript \"%4.4s\".\n"
+
+#: test/ftdump.c:856
+#, c-format
+msgid "Error while querying GPOS default language system for script `%4.4s'.\n"
+msgstr ""
+"Chyba bìhem zkoumání bì¾ného GPOS jazykového systému pro skript \"%4.4s\".\n"
+
+#: test/ftdump.c:874
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Chyba pøi výbìru GPOS vlastnosti \"%4.4s\"\n"
+"pro bì¾ný jazykový systém skriptu \"%4.4s\".\n"
+
+#: test/ftdump.c:896
+#, c-format
+msgid "Error while querying GPOS language list for script `%4.4s'.\n"
+msgstr "Chyba bìhem zkoumání GPOS seznamu jazykù pro skript \"%4.4s\".\n"
+
+#: test/ftdump.c:913
+#, c-format
+msgid "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n"
+msgstr "Chyba bìhem výbìru GPOS jazyka \"%4.4s\" pro skript \"%4.4s\".\n"
+
+#: test/ftdump.c:938
+#, c-format
+msgid ""
+"Error while querying GPOS feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Chyba bìhem zkoumání seznamu GPOS vlastností\n"
+"pro skript \"%4.4s\", jazyk \"%4.4s\".\n"
+
+#: test/ftdump.c:955
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Chyba bìhem výbìru GPOS vlastnosti \"%4.4s\"\n"
+"pro skript \"%4.4s\", jazyk \"%4.4s\".\n"
+
+#: test/ftdump.c:1018
+msgid "ftdump: Simple TrueType Dumper -- part of the FreeType project"
+msgstr ""
+"ftdump: jednoduchý výpis obsahu písma TrueType -- souèást projektu FreeType"
+
+#: test/ftdump.c:1022
+#, c-format
+msgid ""
+"Usage: %s fontname[.ttf|.ttc]\n"
+"\n"
+msgstr ""
+"Pou¾ití: %s název-písma[.ttf|.ttc]\n"
+"\n"
+
+#: test/ftdump.c:1054 test/ftlint.c:134 test/ftmetric.c:228 test/ftsbit.c:127
+msgid "Error while initializing engine.\n"
+msgstr "Chyba bìhem inicializace knihovny.\n"
+
+#: test/ftdump.c:1061 test/ftmetric.c:236 test/ftsbit.c:134
+msgid "Error while initializing embedded bitmap extension.\n"
+msgstr "Chyba bìhem inicializace roz¹íøení pro vlo¾ené bitmapy.\n"
+
+#: test/ftdump.c:1068
+msgid "Error while initializing GSUB extension.\n"
+msgstr "Chyba bìhem inicializace roz¹íøení pro substituce liter (GSUB).\n"
+
+#: test/ftdump.c:1075
+msgid "Error while initializing GPOS extension.\n"
+msgstr "Chyba bìhem inicializace roz¹íøení pro umís»ování liter (GPOS).\n"
+
+#: test/ftdump.c:1091 test/ftlint.c:187 test/ftmetric.c:251 test/ftsbit.c:182
+#, c-format
+msgid "Could not find or open %s.\n"
+msgstr "Nelze nalézt nebo otevøít soubor %s.\n"
+
+#: test/ftdump.c:1094 test/ftlint.c:193 test/ftmetric.c:254 test/ftsbit.c:188
+#, c-format
+msgid "Error while opening %s.\n"
+msgstr "Chyba bìhem otevírání souboru %s.\n"
+
+#: test/ftlint.c:94
+msgid ""
+"ftlint: Simple TrueType instruction tester -- part of the FreeType project"
+msgstr "ftlint: test instrukcí písma TrueType -- souèást projektu FreeType"
+
+#: test/ftlint.c:99
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
+"\n"
+msgstr ""
+"Pou¾ití: %s ppem název-písma[.ttf|.ttc] [název-dal¹ího-písma...]\n"
+"\n"
+
+#: test/ftlint.c:226 test/ftsbit.c:225
+#, c-format
+msgid "Could not set point size to %d.\n"
+msgstr "Nelze nastavit velikost písma na %d bodù.\n"
+
+#: test/ftlint.c:239
+msgid ""
+"Error with\n"
+" "
+msgstr ""
+"Výskyt chyb\n"
+" "
+
+#: test/ftlint.c:240
+#, c-format
+msgid "glyph %4u: %s\n"
+msgstr "litera %4d: %s\n"
+
+#: test/ftlint.c:253
+msgid "1 fail.\n"
+msgstr "poèet chyb: 1\n"
+
+#: test/ftlint.c:255
+#, c-format
+msgid "%d fails.\n"
+msgstr "poèet chyb: %d\n"
+
+#: test/ftmetric.c:70
+msgid ""
+"ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project"
+msgstr "ftmetric: výpis metrik písma TrueType -- souèást projektu FreeType"
+
+#: test/ftmetric.c:74
+#, c-format
+msgid ""
+"Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+"\n"
+" -B show sbit's metrics (default: none)\n"
+" -c C use C'th font index of TrueType collection (default: 0)\n"
+" -i index glyph index (default: 0)\n"
+" -r R use resolution R dpi (default: 72)\n"
+"\n"
+msgstr ""
+"Pou¾ití: %s [volby (viz ní¾e)] bodová-velikost název-písma[.ttf|.ttc]\n"
+"\n"
+" -B zobraz rozmìry bitmapy (std: nezobrazuj)\n"
+" -c C pou¾ij písmo indexu C z kolekce písem (std: 0)\n"
+" -i index index litery (std: 0)\n"
+" -r R rozli¹ení R bodù na palec (std: 72 dpi)\n"
+"\n"
+
+#: test/ftmetric.c:261
+#, c-format
+msgid "There are %d fonts in this collection.\n"
+msgstr "Poèet písem v kolekci: %d.\n"
+
+#: test/ftmetric.c:266
+#, c-format
+msgid "There is no collection with index %d in this font file.\n"
+msgstr "V kolekci není ¾ádné písmo s indexem %d.\n"
+
+#: test/ftmetric.c:280
+msgid "There is no embedded bitmap data in the font.\n"
+msgstr "V souboru písma nejsou vlo¾eny ¾ádné bitmapy.\n"
+
+#: test/ftmetric.c:310
+msgid "Could not set device resolutions.\n"
+msgstr "Nelze nastavit rozli¹ení zaøízení.\n"
+
+#: test/ftmetric.c:317
+msgid "Could not reset instance.\n"
+msgstr "Nelze inicializovat instanci.\n"
+
+#: test/ftmetric.c:323
+#, c-format
+msgid "Instance metrics: ppemX %d, ppemY %d\n"
+msgstr "Rozmìry instance: ppemX %d, ppemY %d\n"
+
+#: test/ftmetric.c:333 test/ftsbit.c:234
+msgid "Could not allocate glyph bitmap container.\n"
+msgstr "Nelze vytvoøit kontejner vlo¾ených bitmap.\n"
+
+#: test/ftmetric.c:341 test/ftsbit.c:258
+#, c-format
+msgid "Can't load bitmap for glyph %d.\n"
+msgstr "Nelze naèíst bitmapu pro literu %d.\n"
+
+#: test/ftmetric.c:368
+msgid "Outline's metrics"
+msgstr "Rozmìry obrysu"
+
+#: test/ftmetric.c:370
+msgid "Outline glyph\n"
+msgstr "Obrys litery\n"
+
+#: test/ftsbit.c:90
+msgid "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project"
+msgstr ""
+"ftsbit: výpis bitmap vlo¾ených do písma TrueType -- souèást projektu FreeType"
+
+#: test/ftsbit.c:95
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+msgstr ""
+"Pou¾ití: %s ppem název-písma[.ttf|.ttc] index-litery [index-dal¹í-litery...]\n"
+"\n"
+
+#: test/ftsbit.c:200
+msgid "Could not find embedded bitmaps in this font.\n"
+msgstr "V souboru písma nelze nalézt ¾ádné vlo¾ené bitmapy.\n"
+
+#: test/ftsbit.c:206
+msgid "Error while loading embedded bitmaps.\n"
+msgstr "Chyba bìhem naèítání vlo¾ených bitmap.\n"
+
+#: test/ftsbit.c:252
+#, c-format
+msgid " no bitmap for glyph %d.\n"
+msgstr " litera %d nemá ¾ádnou vlo¾enou bitmapu.\n"
+
+#: test/ftsbit.c:264
+#, c-format
+msgid "glyph index %d = %dx%d pixels, "
+msgstr "litera %d = %dx%d pixelù, "
+
+#: test/ftsbit.c:267
+#, c-format
+msgid "advance = %ld, minBearing = [%ld,%ld]\n"
+msgstr "posun = %ld, minBearing = [%ld,%ld]\n"
diff --git a/Build/source/libs/freetype/po/de.po b/Build/source/libs/freetype/po/de.po
new file mode 100644
index 00000000000..de1c08d1492
--- /dev/null
+++ b/Build/source/libs/freetype/po/de.po
@@ -0,0 +1,885 @@
+# German messages for FreeType.
+# Copyright (C) 1997-2000 Erwin Dieterich
+# Erwin Dieterich <Erwin.Dieterich.ED@Bayer-AG.de>, 1997-2000.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FreeType 1.5\n"
+"POT-Creation-Date: 2002-11-08 18:11+0000\n"
+"PO-Revision-Date: 2002-11-10\n"
+"Last-Translator: Werner Lemberg <wl@gnu.org>\n"
+"Language-Team: German\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/extend/ftxerr18.c:40
+msgid ""
+"Welcome to the translation of the Freetype v.1 library!\n"
+"\n"
+"This message is not really part of the library (it is bracketed by\n"
+" #if 0 / #endif), but is really intended to be the first one in the .po\n"
+"file, and the first one that a new translator should see, to give hints.\n"
+"\n"
+"First, while this .po might seems big, the real interesting part of it\n"
+"is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+"messages are part of the demonstration programs, and are more intended\n"
+"to help grasping how to use i18n with the Freetype library. So the real\n"
+"work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+"\n"
+"A difficulty is that there are some specialized vocabulary, about\n"
+"``faces'', ``glyph'' and similar things. These are typographical things,\n"
+"and this should be researched before attempting to translate the whole\n"
+"thing. A quick look across the TrueType documentation might help to\n"
+"understand many things, too.\n"
+"\n"
+"Best wiches for your translation!\n"
+"Antoine Leca - 2002-11-08"
+msgstr "no translation needed"
+
+#: lib/extend/ftxerr18.c:77
+msgid "Successful function call, no error."
+msgstr "Funktionsaufruf erfolgreich."
+
+#: lib/extend/ftxerr18.c:80
+msgid "Invalid face handle."
+msgstr "Ungültiges Schriftobjekt."
+
+#: lib/extend/ftxerr18.c:82
+msgid "Invalid instance handle."
+msgstr "Ungültiges Instanzenobjekt."
+
+#: lib/extend/ftxerr18.c:84
+msgid "Invalid glyph handle."
+msgstr "Ungültiges Glyphobjekt."
+
+#: lib/extend/ftxerr18.c:86
+msgid "Invalid charmap handle."
+msgstr "Ungültiges Objekt für Zeichenkodierungstabelle (charmap)."
+
+#: lib/extend/ftxerr18.c:88
+msgid "Invalid result address."
+msgstr "Ungültige Ergebnisadresse."
+
+#: lib/extend/ftxerr18.c:90
+msgid "Invalid glyph index."
+msgstr "Ungültiger Glyphindex."
+
+#: lib/extend/ftxerr18.c:92
+msgid "Invalid argument."
+msgstr "Ungültiger Übergabeparameter"
+
+#: lib/extend/ftxerr18.c:94
+msgid "Could not open file."
+msgstr "Datei konnte nicht geöffnet werden."
+
+#: lib/extend/ftxerr18.c:96
+msgid "File is not a TrueType collection."
+msgstr "Datei ist keine TrueType-Collection."
+
+#: lib/extend/ftxerr18.c:98
+msgid "Mandatory table missing."
+msgstr "Eine obligatorische Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:100
+msgid "Invalid horizontal metrics (hmtx table broken)."
+msgstr "Ungültige horizontale Metrik (`hmtx'-Tabelle defekt)."
+
+#: lib/extend/ftxerr18.c:102
+msgid "Invalid charmap format."
+msgstr "Ungültiges Format der Zeichenkodierungstabelle (charmap)."
+
+#: lib/extend/ftxerr18.c:104
+msgid "Invalid ppem value."
+msgstr "Ungültiger ppem-Wert."
+
+#: lib/extend/ftxerr18.c:106
+msgid "Invalid vertical metrics (vmtx table broken)."
+msgstr "Ungültige vertikale Metrik (`vmtx'-Tabelle defekt)."
+
+#: lib/extend/ftxerr18.c:109
+msgid "Invalid file format."
+msgstr "Ungültiges Dateiformat."
+
+#: lib/extend/ftxerr18.c:112
+msgid "Invalid engine."
+msgstr "Ungültige FreeType-Maschine (engine)."
+
+#: lib/extend/ftxerr18.c:114
+msgid "Too many extensions."
+msgstr "Zu viele Erweiterungen."
+
+#: lib/extend/ftxerr18.c:116
+msgid "Extensions unsupported."
+msgstr "Erweiterungen nicht unterstützt."
+
+#: lib/extend/ftxerr18.c:118
+msgid "Invalid extension id."
+msgstr "Ungültige Erweiterungs-ID."
+
+#: lib/extend/ftxerr18.c:121
+msgid "No vertical data in font."
+msgstr "Keine vertikale Informationen in der Schrift."
+
+#: lib/extend/ftxerr18.c:124
+msgid "Maximum Profile (maxp) table missing."
+msgstr "`Maximum Profile (maxp)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:126
+msgid "Font Header (head) table missing."
+msgstr "`Font Header (head)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:128
+msgid "Horizontal Header (hhea) table missing."
+msgstr "`Horizontal Header (hhea)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:130
+msgid "Index to Location (loca) table missing."
+msgstr "`Index to Location (loca)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:132
+msgid "Naming (name) table missing."
+msgstr "`Naming (name)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:134
+msgid "Character to Glyph Index Mapping (cmap) tables missing."
+msgstr "`Character to Glyph Index Mapping (cmap)'-Tabellen fehlen."
+
+#: lib/extend/ftxerr18.c:136
+msgid "Horizontal Metrics (hmtx) table missing."
+msgstr "`Horizontal Metrics (hmtx)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:138
+msgid "OS/2 table missing."
+msgstr "`OS/2'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:140
+msgid "PostScript (post) table missing."
+msgstr "`PostScript (post)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:142
+msgid "Glyph (glyf) table missing."
+msgstr "`Glyph (glyf)'-Tabelle fehlt."
+
+#: lib/extend/ftxerr18.c:147
+msgid "Out of memory."
+msgstr "Zu wenig Speicher."
+
+#: lib/extend/ftxerr18.c:152
+msgid "Invalid file offset."
+msgstr "Ungültiger Dateioffset."
+
+#: lib/extend/ftxerr18.c:154
+msgid "Invalid file read."
+msgstr "Ungültiger Lesezugriff auf Datei."
+
+#: lib/extend/ftxerr18.c:156
+msgid "Invalid frame access."
+msgstr "Ungültiger Zugriff auf Speicherfenster (frame)."
+
+#: lib/extend/ftxerr18.c:161
+msgid "Too many points."
+msgstr "Zu viele Punkte."
+
+#: lib/extend/ftxerr18.c:163
+msgid "Too many contours."
+msgstr "Zu viele Konturen."
+
+#: lib/extend/ftxerr18.c:165
+msgid "Invalid composite glyph."
+msgstr "Ungültiger zusammengesetzter Glyph."
+
+#: lib/extend/ftxerr18.c:167
+msgid "Too many instructions."
+msgstr "Zu viele Programminstruktionen."
+
+#: lib/extend/ftxerr18.c:169
+msgid "Too many function definitions (FDEF)."
+msgstr "Zu viele Funktionsdefinitionen (FDEF)."
+
+#: lib/extend/ftxerr18.c:174
+msgid "Invalid opcode."
+msgstr "Ungültiger Opcode."
+
+#: lib/extend/ftxerr18.c:176
+msgid "Too few arguments."
+msgstr "Zu wenig Übergabeparameter."
+
+#: lib/extend/ftxerr18.c:178
+msgid "Stack overflow."
+msgstr "Stack-Überlauf."
+
+#: lib/extend/ftxerr18.c:180
+msgid "Code overflow."
+msgstr "Code-Überlauf."
+
+#: lib/extend/ftxerr18.c:182
+msgid "Bad argument."
+msgstr "Falscher Übergabeparameter."
+
+#: lib/extend/ftxerr18.c:184
+msgid "Divide by zero."
+msgstr "Division durch Null."
+
+#: lib/extend/ftxerr18.c:186
+msgid "Storage overflow."
+msgstr "Speicherüberlauf."
+
+#: lib/extend/ftxerr18.c:188
+msgid "Control Value (cvt) table overflow."
+msgstr "Überlauf der `Control Value (cvt)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:190
+msgid "Invalid reference."
+msgstr "Ungültige Referenz."
+
+#: lib/extend/ftxerr18.c:192
+msgid "Invalid distance."
+msgstr "Ungültiger Abstand."
+
+#: lib/extend/ftxerr18.c:194
+msgid "Interpolate twilight points."
+msgstr "Interpolation von Punkten der Zwielichtzone."
+
+#: lib/extend/ftxerr18.c:196
+msgid "`DEBUG' opcode found."
+msgstr "`DEBUG'-Opcode gefunden."
+
+#: lib/extend/ftxerr18.c:198
+msgid "`ENDF' in byte-code stream."
+msgstr "`ENDF' in Bytecode-Strom."
+
+#: lib/extend/ftxerr18.c:200
+msgid "Out of code ranges."
+msgstr "Außerhalb der Code-Bereiche."
+
+#: lib/extend/ftxerr18.c:202
+msgid "Nested function definitions."
+msgstr "Verschachtelte Funktionsdefinitionen."
+
+#: lib/extend/ftxerr18.c:204
+msgid "Invalid code range."
+msgstr "Ungültiger Codebereich."
+
+#: lib/extend/ftxerr18.c:206
+msgid "Invalid displacement."
+msgstr "Ungültige Verschiebung."
+
+#: lib/extend/ftxerr18.c:208
+msgid "Endless loop encountered while executing instructions."
+msgstr ""
+"Unendliche Schleife beim Ausführen\n"
+"der Programminstruktionen entdeckt."
+
+#: lib/extend/ftxerr18.c:213
+msgid "Nested frame access."
+msgstr "Verschachtelter Zugriff auf Speicherfenster (frame)."
+
+#: lib/extend/ftxerr18.c:215
+msgid "Invalid cache list."
+msgstr "Ungütlige Cacheliste."
+
+#: lib/extend/ftxerr18.c:217
+msgid "Could not find context."
+msgstr "Der Kontext konnte nicht gefunden werden."
+
+#: lib/extend/ftxerr18.c:219
+msgid "Unlisted object."
+msgstr "Objekt ist nicht aufgeführt."
+
+#: lib/extend/ftxerr18.c:224
+msgid "Raster pool overflow."
+msgstr "Überlauf des Rasterpools."
+
+#: lib/extend/ftxerr18.c:226
+msgid "Raster: negative height encountered."
+msgstr "Raster: Negative Höhe gefunden."
+
+#: lib/extend/ftxerr18.c:228
+msgid "Raster: invalid value."
+msgstr "Raster: Ungültiger Wert."
+
+#: lib/extend/ftxerr18.c:230
+msgid "Raster not initialized."
+msgstr "Raster nicht initialisiert."
+
+#: lib/extend/ftxerr18.c:235
+msgid "Invalid kerning (kern) table format."
+msgstr "Ungültiges Format der `Kerning (kern)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:237
+msgid "Invalid kerning (kern) table."
+msgstr "Ungültige `Kerning (kern)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:240
+msgid "Invalid PostScript (post) table format."
+msgstr "Ungültiges Format der `PostScript (post)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:242
+msgid "Invalid PostScript (post) table."
+msgstr "Ungültige `PostScript (post)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:247
+msgid "Invalid TrueType Open subtable format."
+msgstr "Ungültiges Format einer TrueType-Open-Subtabelle."
+
+#: lib/extend/ftxerr18.c:249
+msgid "Invalid TrueType Open subtable."
+msgstr "Ungültige TrueType-Open-Subtabelle."
+
+#: lib/extend/ftxerr18.c:251
+msgid "Glyph(s) not covered by lookup."
+msgstr "Glyph(en) von Lookup-Prozedur nicht erfaßt."
+
+#: lib/extend/ftxerr18.c:253
+msgid "Too many nested context substitutions."
+msgstr "Zu viele verschachtelte Kontext-Substitutionen."
+
+#: lib/extend/ftxerr18.c:255
+msgid "No MM (Adobe MultipleMaster) interpreter available."
+msgstr "Kein MM-Interpreter (für Adobe MultipleMaster Fonts) verfügbar."
+
+#: lib/extend/ftxerr18.c:258
+msgid "Invalid glyph substitution (GSUB) table format."
+msgstr "Ungültiges Format der `glyph substitution (GSUB)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:260
+msgid "Invalid glyph substitution (GSUB) table."
+msgstr "Ungültige `glyph substitution (GSUB)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:263
+msgid "Invalid glyph positioning (GPOS) table format."
+msgstr "Ungültiges Format der `glyph positioning (GPOS)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:265
+msgid "Invalid glyph positioning (GPOS) table."
+msgstr "Ungültige `glyph positioning (GPOS)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:268
+msgid "Invalid glyph definition (GDEF) table format."
+msgstr "Ungültiges Format der `glyph definition (GDEF)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:270
+msgid "Invalid glyph definition (GDEF) table."
+msgstr "Ungültige `glyph definition (GDEF)'-Tabelle."
+
+#: lib/extend/ftxerr18.c:277
+msgid "Invalid Error Number."
+msgstr "Ungültige Fehler-ID."
+
+#: test/fterror.c:49
+msgid ""
+"fterror: test TT_ErrToString18 functionality\n"
+"\n"
+msgstr ""
+"fterror: Teste Funktionalität von TT_ErrToString18\n"
+"\n"
+
+#: test/fterror.c:50
+msgid ""
+" with an optional numerical argument, dumps the associated message.\n"
+"\n"
+msgstr ""
+" ein optionales numerisches Argument liefert die assoziierte Meldung.\n"
+"\n"
+
+#: test/fterror.c:73
+msgid "Start of fterror.\n"
+msgstr "Beginn von fterror.\n"
+
+#: test/fterror.c:81
+msgid "End of fterror.\n"
+msgstr "Ende von fterror.\n"
+
+#: test/fterror.c:96
+msgid "Freetype error code 0x%04lX (%lu): %s\n"
+msgstr "FreeType Fehlercode 0x%04lX (%lu): %s\n"
+
+#: test/ftdump.c:169 test/ftlint.c:207 test/ftmetric.c:294
+msgid "Could not create glyph container.\n"
+msgstr "Konnte den Glyphcontainer nicht erzeugen.\n"
+
+#: test/ftdump.c:179 test/ftlint.c:215 test/ftmetric.c:303 test/ftsbit.c:214
+msgid "Could not create instance.\n"
+msgstr "Konnte die Instanz nicht erzeugen.\n"
+
+#: test/ftdump.c:188
+msgid "Could not create second instance.\n"
+msgstr "Konnte die zweite Instanz nicht erzeugen.\n"
+
+#: test/ftdump.c:194
+msgid "Memory footprint statistics:\n"
+msgstr "Speicherabdruck-Statistik:\n"
+
+#: test/ftdump.c:202
+msgid "face object"
+msgstr "Schriftobjekt"
+
+#: test/ftdump.c:203
+msgid "glyph object"
+msgstr "Glyphobjekt"
+
+#: test/ftdump.c:204
+msgid "instance object"
+msgstr "Instanzobjekt"
+
+#: test/ftdump.c:208
+msgid "exec. context object"
+msgstr "Ausführbares Kontextobjekt"
+
+#: test/ftdump.c:215
+msgid "total memory usage"
+msgstr "Gesamtverbrauch an Speicher"
+
+#: test/ftdump.c:223 test/ftdump.c:579 test/ftdump.c:789 test/ftdump.c:993
+#: test/ftdump.c:1139 test/ftlint.c:274 test/ftlint.c:287 test/ftmetric.c:390
+#: test/ftsbit.c:286
+#, c-format
+msgid "FreeType error message: %s\n"
+msgstr "FreeType Fehlermeldung: %s\n"
+
+#: test/ftdump.c:300
+msgid "font name table entries\n"
+msgstr "Einträge in der `name'-Tabelle der Schrift\n"
+
+#: test/ftdump.c:310
+#, c-format
+msgid ""
+"PostScript name: %s\n"
+"\n"
+msgstr ""
+"PostScript-Name: %s\n"
+"\n"
+
+#: test/ftdump.c:333
+msgid "character map encodings\n"
+msgstr "Zeichenkodierungstabellen (cmaps)\n"
+
+#: test/ftdump.c:340 test/ftdump.c:488
+msgid "The file doesn't seem to have any encoding table.\n"
+msgstr "Diese Datei enthält anscheinend keine `cmap'-Tabelle.\n"
+
+#: test/ftdump.c:344 test/ftdump.c:492
+#, c-format
+msgid ""
+"There are %hu encodings:\n"
+"\n"
+msgstr ""
+"Es gibt %hu Kodierungen:\n"
+"\n"
+
+#: test/ftdump.c:349
+#, c-format
+msgid "encoding %2u: "
+msgstr "Kodierung %2u: "
+
+#: test/ftdump.c:376 test/ftdump.c:385 test/ftdump.c:452
+#, c-format
+msgid "Unknown value %hu"
+msgstr "Unbekannter Wert %hu"
+
+#: test/ftdump.c:459
+msgid "Unknown"
+msgstr "Unbekannt"
+
+#: test/ftdump.c:481
+msgid "ftxcmap test\n"
+msgstr "Test von ftxcmap\n"
+
+#: test/ftdump.c:498
+#, c-format
+msgid "encoding %2u:\n"
+msgstr "Kodierung %2u:\n"
+
+#: test/ftdump.c:503
+#, c-format
+msgid "first: glyph index %hu, character code 0x%lx\n"
+msgstr "Erster Eintrag: Glyphindex %hu, Zeichenkode 0x%lx\n"
+
+#: test/ftdump.c:507
+#, c-format
+msgid "next: glyph index %hu, character code 0x%lx\n"
+msgstr "Nächster Eintrag: Glyphindex %hu, Zeichenkode 0x%lx\n"
+
+#: test/ftdump.c:511
+#, c-format
+msgid "last: glyph index %hu, character code 0x%lx\n"
+msgstr "Letzter Eintrag: Glyphindex %hu, Zeichenkode 0x%lx\n"
+
+#: test/ftdump.c:533 test/ftmetric.c:284
+msgid "Error while retrieving embedded bitmaps table.\n"
+msgstr "Fehler beim Laden der `embedded bitmaps'-Tabelle.\n"
+
+#: test/ftdump.c:537
+msgid "embedded bitmap table\n"
+msgstr "`embedded bitmap'-Tabelle\n"
+
+#: test/ftdump.c:540
+#, c-format
+msgid " version of embedded bitmap table: 0x%lx\n"
+msgstr " Version der `embedded bitmap'-Tabelle: 0x%lx\n"
+
+#: test/ftdump.c:542
+#, c-format
+msgid " number of embedded bitmap strikes: %lu\n"
+msgstr " Anzahl der eingebetteten Bitmapsätze: %lu\n"
+
+#: test/ftdump.c:552
+#, c-format
+msgid " bitmap strike %hu/%lu: "
+msgstr " Bitmapsatz %hu/%hu: "
+
+#: test/ftdump.c:555
+#, c-format
+msgid "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n"
+msgstr "%hux%hu Pixel, Tiefe %hu Bit, Glyphbereich [%hu-%hu]\n"
+
+#: test/ftdump.c:564
+#, c-format
+msgid " range format (%hu:%hu) glyphs %hu..%hu\n"
+msgstr " Bereichsformat (%hu:%hu) Glyphen %hu-%hu\n"
+
+#: test/ftdump.c:615
+msgid "Error while loading GSUB table.\n"
+msgstr "Fehler beim Laden der `GSUB'-Tabelle.\n"
+
+#: test/ftdump.c:619
+msgid "GSUB table\n"
+msgstr "`GSUB'-Tabelle\n"
+
+#: test/ftdump.c:626
+msgid "Error while querying GSUB script list.\n"
+msgstr "Fehler bei Abfrage der GSUB Schriftenliste.\n"
+
+#: test/ftdump.c:639
+#, c-format
+msgid "Error while selecting GSUB script `%4.4s'.\n"
+msgstr "Fehler bei Auswahl der GSUB Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:644 test/ftdump.c:848
+#, c-format
+msgid " script `%4.4s' (index %hu):\n"
+msgstr " Schrift `%4.4s' (Index %hu):\n"
+
+#: test/ftdump.c:652
+#, c-format
+msgid "Error while querying GSUB default language system for script `%4.4s'.\n"
+msgstr ""
+"Fehler bei Abfrage der GSUB-Standardsprachenwerte für Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:657 test/ftdump.c:861
+msgid " default language system:\n"
+msgstr " Standardsprachenwerte:\n"
+
+#: test/ftdump.c:670
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Fehler bei Auswahl des GSUB-Merkmals `%4.4s'\n"
+"für Standardsprachenwert der Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:676 test/ftdump.c:757 test/ftdump.c:880 test/ftdump.c:961
+#, c-format
+msgid " feature `%4.4s' (index %hu; lookup "
+msgstr " Merkmal `%4.4s' (Index %hu; Lookup "
+
+#: test/ftdump.c:692
+#, c-format
+msgid "Error while querying GSUB language list for script `%4.4s'.\n"
+msgstr "Fehler bei Abfrage der GSUB-Sprachenliste für Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:709
+#, c-format
+msgid "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n"
+msgstr "Fehler bei Auswahl der GSUB-Sprache `%4.4s' für Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:714 test/ftdump.c:918
+#, c-format
+msgid " language `%4.4s' (index %hu):\n"
+msgstr " Sprache `%4.4s' (Index %hu):\n"
+
+#: test/ftdump.c:719 test/ftdump.c:923
+#, c-format
+msgid " required feature index %hu (lookup "
+msgstr " Benötigtes Merkmal: Index %hu (Lookup "
+
+#: test/ftdump.c:734
+#, c-format
+msgid ""
+"Error while querying GSUB feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fehler bei Abfrage der GSUB-Merkmaltabelle\n"
+"für Schrift `%4.4s', Sprache `%4.4s'.\n"
+
+#: test/ftdump.c:751
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fehler bei Auswahl des GSUB-Merkmals `%4.4s'\n"
+"für Schrift `%4.4s', Sprache `%4.4s'.\n"
+
+#: test/ftdump.c:776 test/ftdump.c:980
+msgid ""
+"Lookups:\n"
+"\n"
+msgstr ""
+"Lookups:\n"
+"\n"
+
+#: test/ftdump.c:779 test/ftdump.c:983
+#, c-format
+msgid " %hu: type %hu, flag 0x%x\n"
+msgstr " %hu: Typ %hu, Flag 0x%x\n"
+
+#: test/ftdump.c:819
+msgid "Error while loading GPOS table.\n"
+msgstr "Fehler beim Laden der `GPOS'-Tabelle.\n"
+
+#: test/ftdump.c:823
+msgid "GPOS table\n"
+msgstr "`GPOS'-Tabelle\n"
+
+#: test/ftdump.c:830
+msgid "Error while querying GPOS script list.\n"
+msgstr "Fehler bei Abfrage der GPOS Schriftenliste.\n"
+
+#: test/ftdump.c:843
+#, c-format
+msgid "Error while selecting GPOS script `%4.4s'.\n"
+msgstr "Fehler bei Auswahl der GPOS Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:856
+#, c-format
+msgid "Error while querying GPOS default language system for script `%4.4s'.\n"
+msgstr ""
+"Fehler bei Abfrage der GPOS-Standardsprachenwerte für Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:874
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Fehler bei Auswahl des GPOS-Merkmals `%4.4s'\n"
+"für Standardsprachenwert der Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:896
+#, c-format
+msgid "Error while querying GPOS language list for script `%4.4s'.\n"
+msgstr "Fehler bei Abfrage der GPOS-Sprachenliste für Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:913
+#, c-format
+msgid "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n"
+msgstr "Fehler bei Auswahl der GPOS-Sprache `%4.4s' für Schrift `%4.4s'.\n"
+
+#: test/ftdump.c:938
+#, c-format
+msgid ""
+"Error while querying GPOS feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fehler bei Abfrage der GPOS-Merkmaltabelle\n"
+"für Schrift `%4.4s', Sprache `%4.4s'.\n"
+
+#: test/ftdump.c:955
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fehler bei Auswahl des GPOS-Merkmals `%4.4s'\n"
+"für Schrift `%4.4s', Sprache `%4.4s'.\n"
+
+#: test/ftdump.c:1018
+msgid "ftdump: Simple TrueType Dumper -- part of the FreeType project"
+msgstr "ftdump: Ein einfacher TrueType Dumper -- Teil des FreeType-Projekts"
+
+#: test/ftdump.c:1022
+#, c-format
+msgid ""
+"Usage: %s fontname[.ttf|.ttc]\n"
+"\n"
+msgstr ""
+"Verwendung: %s Fontname[.ttf|.ttc]\n"
+"\n"
+
+#: test/ftdump.c:1054 test/ftlint.c:134 test/ftmetric.c:228 test/ftsbit.c:127
+msgid "Error while initializing engine.\n"
+msgstr "Fehler beim Starten von FreeType.\n"
+
+#: test/ftdump.c:1061 test/ftmetric.c:236 test/ftsbit.c:134
+msgid "Error while initializing embedded bitmap extension.\n"
+msgstr "Fehler bei Initialisierung der Erweiterung für eingebettete Bitmaps.\n"
+
+#: test/ftdump.c:1068
+msgid "Error while initializing GSUB extension.\n"
+msgstr "Fehler beim Starten der GSUB-Erweiterung.\n"
+
+#: test/ftdump.c:1075
+msgid "Error while initializing GPOS extension.\n"
+msgstr "Fehler beim Starten der GPOS-Erweiterung.\n"
+
+#: test/ftdump.c:1091 test/ftlint.c:187 test/ftmetric.c:251 test/ftsbit.c:182
+#, c-format
+msgid "Could not find or open %s.\n"
+msgstr "Datei `%s' konnte nicht gefunden oder geöffnet werden.\n"
+
+#: test/ftdump.c:1094 test/ftlint.c:193 test/ftmetric.c:254 test/ftsbit.c:188
+#, c-format
+msgid "Error while opening %s.\n"
+msgstr "Fehler beim Öffnen von %s.\n"
+
+#: test/ftlint.c:94
+msgid ""
+"ftlint: Simple TrueType instruction tester -- part of the FreeType project"
+msgstr ""
+"ftlint: Ein einfacher TTF Instruktionen-Tester -- Teil des FreeType-Projekts"
+
+#: test/ftlint.c:99
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
+"\n"
+msgstr ""
+"Verwendung: %s ppem Fontname[.ttf|.ttc] [Fontname2..]\n"
+"\n"
+
+#: test/ftlint.c:226 test/ftsbit.c:225
+#, c-format
+msgid "Could not set point size to %d.\n"
+msgstr "Konnte die Schriftgröße nicht auf %d Punkt setzen.\n"
+
+#: test/ftlint.c:239
+msgid ""
+"Error with\n"
+" "
+msgstr ""
+"Fehler bei\n"
+" "
+
+#: test/ftlint.c:240
+#, c-format
+msgid "glyph %4u: %s\n"
+msgstr "Glyph %4u: %s\n"
+
+#: test/ftlint.c:253
+msgid "1 fail.\n"
+msgstr "einmal gescheitert.\n"
+
+#: test/ftlint.c:255
+#, c-format
+msgid "%d fails.\n"
+msgstr "%d mal gescheitert.\n"
+
+#: test/ftmetric.c:70
+msgid ""
+"ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project"
+msgstr ""
+"ftmetric: Ein einfacher TTF Metrik/Glyph-Dumper -- Teil des FreeType-Projekts"
+
+#: test/ftmetric.c:74
+#, c-format
+msgid ""
+"Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+"\n"
+" -B show sbit's metrics (default: none)\n"
+" -c C use C'th font index of TrueType collection (default: 0)\n"
+" -i index glyph index (default: 0)\n"
+" -r R use resolution R dpi (default: 72)\n"
+"\n"
+msgstr ""
+"Verwendung: %s [Optionen s.u.] Punktgröße Fontname[.ttf|.ttc]\n"
+"\n"
+" -B zeige Metriken von eingebetteten Bitmaps (Standardwert: nein)\n"
+" -c C verwende den `C'ten Fontindex der TrueType-Collection\n"
+" (Standardwert: 0)\n"
+" -i Index Glyphindex (Standardwert: 0)\n"
+" -r R verwende Auflösung `R' dpi (Standardwert: 72)\n"
+"\n"
+
+#: test/ftmetric.c:261
+#, c-format
+msgid "There are %d fonts in this collection.\n"
+msgstr "Es gibt %d Fonts in dieser TrueType-Collection.\n"
+
+#: test/ftmetric.c:266
+#, c-format
+msgid "There is no collection with index %d in this font file.\n"
+msgstr "In dieser Fontdatei gibt es keine Collection mit Index %d.\n"
+
+#: test/ftmetric.c:280
+msgid "There is no embedded bitmap data in the font.\n"
+msgstr "Konnte keine eingebetteten Bitmaps in Fontdatei finden.\n"
+
+#: test/ftmetric.c:310
+msgid "Could not set device resolutions.\n"
+msgstr "Konnte die Geräteauflösung nicht setzen.\n"
+
+#: test/ftmetric.c:317
+msgid "Could not reset instance.\n"
+msgstr "Konnte die Instanz nicht neu setzen.\n"
+
+#: test/ftmetric.c:323
+#, c-format
+msgid "Instance metrics: ppemX %d, ppemY %d\n"
+msgstr "Instanzmetriken: ppemX %d, ppemY %d\n"
+
+#: test/ftmetric.c:333 test/ftsbit.c:234
+msgid "Could not allocate glyph bitmap container.\n"
+msgstr "Konnte den Glyphcontainer für Bitmaps nicht erzeugen.\n"
+
+#: test/ftmetric.c:341 test/ftsbit.c:258
+#, c-format
+msgid "Can't load bitmap for glyph %d.\n"
+msgstr "Kann Bitmap für Glyph %d nicht laden.\n"
+
+#: test/ftmetric.c:368
+msgid "Outline's metrics"
+msgstr "Vektormetriken"
+
+#: test/ftmetric.c:370
+msgid "Outline glyph\n"
+msgstr "Vektorglyph\n"
+
+#: test/ftsbit.c:90
+msgid "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project"
+msgstr ""
+"ftsbit: Ein einfacher TrueType `sbit' Dumper -- Teil des FreeType-Projekts"
+
+#: test/ftsbit.c:95
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+msgstr ""
+"Verwendung: %s ppem Fontname[.ttf|.ttc] Glyphindex [Glyphindex2..]\n"
+"\n"
+
+#: test/ftsbit.c:200
+msgid "Could not find embedded bitmaps in this font.\n"
+msgstr "Konnte keine eingebetteten Bitmaps in Fontdatei finden.\n"
+
+#: test/ftsbit.c:206
+msgid "Error while loading embedded bitmaps.\n"
+msgstr "Fehler beim Laden von eingebettete Bitmaps.\n"
+
+#: test/ftsbit.c:252
+#, c-format
+msgid " no bitmap for glyph %d.\n"
+msgstr " keine Bitmap für Glyph %d.\n"
+
+#: test/ftsbit.c:264
+#, c-format
+msgid "glyph index %d = %dx%d pixels, "
+msgstr "Glyphindex %d = %dx%d Pixel, "
+
+#: test/ftsbit.c:267
+#, c-format
+msgid "advance = %ld, minBearing = [%ld,%ld]\n"
+msgstr "Vorschubbreite = %ld, `minBearing' = [%ld,%ld]\n"
diff --git a/Build/source/libs/freetype/po/es.po b/Build/source/libs/freetype/po/es.po
new file mode 100644
index 00000000000..0ff48e5b9be
--- /dev/null
+++ b/Build/source/libs/freetype/po/es.po
@@ -0,0 +1,888 @@
+# Spanish messages for FreeType.
+# Copyright (C) 1998-2002 Miguel A. Pérez Valdenebro
+# Miguel A. Pérez Valdenebro <map@fujitsu.es>, 1998.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FreeType 1.5\n"
+"POT-Creation-Date: 2002-11-08 18:11+0000\n"
+"PO-Revision-Date: 2002-11-08 18:30+0100\n"
+"Last-Translator: \n"
+"Language-Team: Spanish\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/extend/ftxerr18.c:40
+msgid ""
+"Welcome to the translation of the Freetype v.1 library!\n"
+"\n"
+"This message is not really part of the library (it is bracketed by\n"
+" #if 0 / #endif), but is really intended to be the first one in the .po\n"
+"file, and the first one that a new translator should see, to give hints.\n"
+"\n"
+"First, while this .po might seems big, the real interesting part of it\n"
+"is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+"messages are part of the demonstration programs, and are more intended\n"
+"to help grasping how to use i18n with the Freetype library. So the real\n"
+"work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+"\n"
+"A difficulty is that there are some specialized vocabulary, about\n"
+"``faces'', ``glyph'' and similar things. These are typographical things,\n"
+"and this should be researched before attempting to translate the whole\n"
+"thing. A quick look across the TrueType documentation might help to\n"
+"understand many things, too.\n"
+"\n"
+"Best wiches for your translation!\n"
+"Antoine Leca - 2002-11-08"
+msgstr ""
+
+#: lib/extend/ftxerr18.c:77
+msgid "Successful function call, no error."
+msgstr "Éxito en la llamada a función."
+
+#: lib/extend/ftxerr18.c:80
+msgid "Invalid face handle."
+msgstr "Ticket de diseño inválido."
+
+#: lib/extend/ftxerr18.c:82
+msgid "Invalid instance handle."
+msgstr "Ticket de instancia inválido."
+
+#: lib/extend/ftxerr18.c:84
+msgid "Invalid glyph handle."
+msgstr "Ticket de glifo inválido."
+
+#: lib/extend/ftxerr18.c:86
+msgid "Invalid charmap handle."
+msgstr "Ticket de codificación inválido."
+
+#: lib/extend/ftxerr18.c:88
+msgid "Invalid result address."
+msgstr "Dirección del resultado inválida."
+
+#: lib/extend/ftxerr18.c:90
+msgid "Invalid glyph index."
+msgstr "Índice de glifo inválido."
+
+#: lib/extend/ftxerr18.c:92
+msgid "Invalid argument."
+msgstr "Argumento inválido."
+
+#: lib/extend/ftxerr18.c:94
+msgid "Could not open file."
+msgstr "No se puedo abrir el fichero."
+
+#: lib/extend/ftxerr18.c:96
+msgid "File is not a TrueType collection."
+msgstr "El fichero no es una colección TrueType."
+
+#: lib/extend/ftxerr18.c:98
+msgid "Mandatory table missing."
+msgstr "No se encuentra une tabla obligatoria."
+
+#: lib/extend/ftxerr18.c:100
+msgid "Invalid horizontal metrics (hmtx table broken)."
+msgstr "Dimensiones horizontales (tabla `hmtx') incorrectas."
+
+#: lib/extend/ftxerr18.c:102
+msgid "Invalid charmap format."
+msgstr "Formato de codificación inválido."
+
+#: lib/extend/ftxerr18.c:104
+msgid "Invalid ppem value."
+msgstr "Tamaño en pixel invalido."
+
+#: lib/extend/ftxerr18.c:106
+msgid "Invalid vertical metrics (vmtx table broken)."
+msgstr "Dimensiones verticales (tabla `vmtx') incorrectas."
+
+#: lib/extend/ftxerr18.c:109
+msgid "Invalid file format."
+msgstr "Formato de fichero inválido."
+
+#: lib/extend/ftxerr18.c:112
+msgid "Invalid engine."
+msgstr "Instancia de la biblioteca incorrecta."
+
+#: lib/extend/ftxerr18.c:114
+msgid "Too many extensions."
+msgstr "Demasiadas extensiones (max:8)."
+
+#: lib/extend/ftxerr18.c:116
+msgid "Extensions unsupported."
+msgstr "Extensión no soportada."
+
+#: lib/extend/ftxerr18.c:118
+msgid "Invalid extension id."
+msgstr "Identificador de extensión inválido."
+
+#: lib/extend/ftxerr18.c:121
+msgid "No vertical data in font."
+msgstr "Placa sin datos verticales."
+
+#: lib/extend/ftxerr18.c:124
+msgid "Maximum Profile (maxp) table missing."
+msgstr "No se encuentra la tabla `maxp'."
+
+#: lib/extend/ftxerr18.c:126
+msgid "Font Header (head) table missing."
+msgstr "No se encuentra la cabecera (head) de la placa."
+
+#: lib/extend/ftxerr18.c:128
+msgid "Horizontal Header (hhea) table missing."
+msgstr "No se encuentra la cabecera para la horizontal (hhea)."
+
+#: lib/extend/ftxerr18.c:130
+msgid "Index to Location (loca) table missing."
+msgstr "No se encuentra la tabla de los posiciones (loca)."
+
+#: lib/extend/ftxerr18.c:132
+msgid "Naming (name) table missing."
+msgstr "No se encuentra la tabla de los nombres (name)."
+
+#: lib/extend/ftxerr18.c:134
+msgid "Character to Glyph Index Mapping (cmap) tables missing."
+msgstr ""
+"No se encuentra la tabla de correspondencia de carácter a glifo (cmap)."
+
+#: lib/extend/ftxerr18.c:136
+msgid "Horizontal Metrics (hmtx) table missing."
+msgstr "No se encuentra la tabla de dimensiones horizontales (hmtx)."
+
+#: lib/extend/ftxerr18.c:138
+msgid "OS/2 table missing."
+msgstr "No se encuentra la tabla `OS/2'."
+
+#: lib/extend/ftxerr18.c:140
+msgid "PostScript (post) table missing."
+msgstr "No se encuentra la tabla PostScript (post)."
+
+#: lib/extend/ftxerr18.c:142
+msgid "Glyph (glyf) table missing."
+msgstr "No se encuentra los glifos (tabla `glyf')."
+
+#: lib/extend/ftxerr18.c:147
+msgid "Out of memory."
+msgstr "No hay suficiente memoria."
+
+#: lib/extend/ftxerr18.c:152
+msgid "Invalid file offset."
+msgstr "Dirección en el fichero inválido."
+
+#: lib/extend/ftxerr18.c:154
+msgid "Invalid file read."
+msgstr "Lectura de fichero incorrecta."
+
+#: lib/extend/ftxerr18.c:156
+msgid "Invalid frame access."
+msgstr "Ventana de acceso inválida."
+
+#: lib/extend/ftxerr18.c:161
+msgid "Too many points."
+msgstr "Demasiados puntos de control."
+
+#: lib/extend/ftxerr18.c:163
+msgid "Too many contours."
+msgstr "Demasiados contornos."
+
+#: lib/extend/ftxerr18.c:165
+msgid "Invalid composite glyph."
+msgstr "Glifo compuesto inválido."
+
+#: lib/extend/ftxerr18.c:167
+msgid "Too many instructions."
+msgstr "Demasiadas instrucciones."
+
+#: lib/extend/ftxerr18.c:169
+msgid "Too many function definitions (FDEF)."
+msgstr "Demasiadas definiciones de funciones (FDEF)."
+
+#: lib/extend/ftxerr18.c:174
+msgid "Invalid opcode."
+msgstr "Código de operación inválido."
+
+#: lib/extend/ftxerr18.c:176
+msgid "Too few arguments."
+msgstr "Hace falta más argumentos."
+
+#: lib/extend/ftxerr18.c:178
+msgid "Stack overflow."
+msgstr "Desbordamiento de pila."
+
+#: lib/extend/ftxerr18.c:180
+msgid "Code overflow."
+msgstr "Desbordamiento de código."
+
+#: lib/extend/ftxerr18.c:182
+msgid "Bad argument."
+msgstr "Argumento incorrecto."
+
+#: lib/extend/ftxerr18.c:184
+msgid "Divide by zero."
+msgstr "División por cero."
+
+#: lib/extend/ftxerr18.c:186
+msgid "Storage overflow."
+msgstr "Desbordamiento de capacidad en el almacen."
+
+#: lib/extend/ftxerr18.c:188
+msgid "Control Value (cvt) table overflow."
+msgstr "Desbordamiento de capacidad (tabla CVT)."
+
+#: lib/extend/ftxerr18.c:190
+msgid "Invalid reference."
+msgstr "Referencia incorrecta."
+
+#: lib/extend/ftxerr18.c:192
+msgid "Invalid distance."
+msgstr "Distancia incorrecta."
+
+#: lib/extend/ftxerr18.c:194
+msgid "Interpolate twilight points."
+msgstr "Interpolación de marcas (puntos de referencia)."
+
+#: lib/extend/ftxerr18.c:196
+msgid "`DEBUG' opcode found."
+msgstr "Se ha encontrado la instrucción `DEBUG'."
+
+#: lib/extend/ftxerr18.c:198
+msgid "`ENDF' in byte-code stream."
+msgstr "Se ha encontrado `ENDF' en el programa de un glifo."
+
+#: lib/extend/ftxerr18.c:200
+msgid "Out of code ranges."
+msgstr "Demasiados espacios de ejecución (code ranges)."
+
+#: lib/extend/ftxerr18.c:202
+msgid "Nested function definitions."
+msgstr "Definiciones de funciones encajadas."
+
+#: lib/extend/ftxerr18.c:204
+msgid "Invalid code range."
+msgstr "Espacio de ejecución (code range) incorrecto."
+
+#: lib/extend/ftxerr18.c:206
+msgid "Invalid displacement."
+msgstr "Desplazamiento inválido."
+
+#: lib/extend/ftxerr18.c:208
+msgid "Endless loop encountered while executing instructions."
+msgstr ""
+"Se ha encontrado bucle sin fin durante la ejecución de las instrucciones."
+
+#: lib/extend/ftxerr18.c:213
+msgid "Nested frame access."
+msgstr "Ventanas de acceso encajadas."
+
+#: lib/extend/ftxerr18.c:215
+msgid "Invalid cache list."
+msgstr "Lista de `cache' inválida."
+
+#: lib/extend/ftxerr18.c:217
+msgid "Could not find context."
+msgstr "No se puede encontrar el contexto."
+
+#: lib/extend/ftxerr18.c:219
+msgid "Unlisted object."
+msgstr "Este objeto no es encadenado en el `cache'."
+
+#: lib/extend/ftxerr18.c:224
+msgid "Raster pool overflow."
+msgstr "Tramador: Desbordamiento de memoria."
+
+#: lib/extend/ftxerr18.c:226
+msgid "Raster: negative height encountered."
+msgstr "Tramador: altura negativa."
+
+#: lib/extend/ftxerr18.c:228
+msgid "Raster: invalid value."
+msgstr "Tramador: valor erroneo."
+
+#: lib/extend/ftxerr18.c:230
+msgid "Raster not initialized."
+msgstr "Tramador no inicializado."
+
+#: lib/extend/ftxerr18.c:235
+msgid "Invalid kerning (kern) table format."
+msgstr "Formato de la tabla `kern' incorrecto."
+
+#: lib/extend/ftxerr18.c:237
+msgid "Invalid kerning (kern) table."
+msgstr "Tabla `kern' inválida."
+
+#: lib/extend/ftxerr18.c:240
+msgid "Invalid PostScript (post) table format."
+msgstr "Formato de tabla PostScript (post) incorrecto."
+
+#: lib/extend/ftxerr18.c:242
+msgid "Invalid PostScript (post) table."
+msgstr "Tabla PostScript (post) inválida."
+
+#: lib/extend/ftxerr18.c:247
+msgid "Invalid TrueType Open subtable format."
+msgstr "Formato de la tabla TrueType Open incorrecto."
+
+#: lib/extend/ftxerr18.c:249
+msgid "Invalid TrueType Open subtable."
+msgstr "Tabla TrueType Open inválida."
+
+#: lib/extend/ftxerr18.c:251
+msgid "Glyph(s) not covered by lookup."
+msgstr "Estos glifos no existen en las tablas de busqueda (lookups)."
+
+#: lib/extend/ftxerr18.c:253
+msgid "Too many nested context substitutions."
+msgstr "Demasiados cambios contextuales encajados."
+
+#: lib/extend/ftxerr18.c:255
+msgid "No MM (Adobe MultipleMaster) interpreter available."
+msgstr "No encontrado el intérprete per MM (Adobe MultipleMaster)."
+
+#: lib/extend/ftxerr18.c:258
+msgid "Invalid glyph substitution (GSUB) table format."
+msgstr "Formato de la tabla de cambios de glifos (GSUB) incorrecto."
+
+#: lib/extend/ftxerr18.c:260
+msgid "Invalid glyph substitution (GSUB) table."
+msgstr "Tabla de cambios de glifos (GSUB) inválida."
+
+#: lib/extend/ftxerr18.c:263
+msgid "Invalid glyph positioning (GPOS) table format."
+msgstr "Formato de la tabla de posiciones de los glifos (GPOS) incorrecto."
+
+#: lib/extend/ftxerr18.c:265
+msgid "Invalid glyph positioning (GPOS) table."
+msgstr "Tabla de posiciones de los glifos (GPOS) inválida."
+
+#: lib/extend/ftxerr18.c:268
+msgid "Invalid glyph definition (GDEF) table format."
+msgstr "Formato de la tabla de definiciones de los glifos (GDEF) incorrecto."
+
+#: lib/extend/ftxerr18.c:270
+msgid "Invalid glyph definition (GDEF) table."
+msgstr "Tabla de definiciones de los glifos (GDEF) inválida."
+
+#: lib/extend/ftxerr18.c:277
+msgid "Invalid Error Number."
+msgstr "Número de Error Inválido."
+
+#: test/fterror.c:49
+msgid ""
+"fterror: test TT_ErrToString18 functionality\n"
+"\n"
+msgstr "fterror: ensayo si funcciona TT_ErrToString18\n\n"
+
+#: test/fterror.c:50
+msgid ""
+" with an optional numerical argument, dumps the associated message.\n"
+"\n"
+msgstr " con un argumento númerico opcional, escribe el mensaje asociado.\n\n"
+
+#: test/fterror.c:73
+msgid "Start of fterror.\n"
+msgstr "Inicio de fterror.\n"
+
+#: test/fterror.c:81
+msgid "End of fterror.\n"
+msgstr "Fin de fterror.\n"
+
+#: test/fterror.c:96
+#, c-format
+msgid "Freetype error code 0x%04lX (%lu): %s\n"
+msgstr "Código de error FreeType 0x%04lX (%lu):\n"
+
+#: test/ftdump.c:169 test/ftlint.c:207 test/ftmetric.c:294
+msgid "Could not create glyph container.\n"
+msgstr "No se puede crear una caja de glifo.\n"
+
+#: test/ftdump.c:179 test/ftlint.c:215 test/ftmetric.c:303 test/ftsbit.c:214
+msgid "Could not create instance.\n"
+msgstr "No se puede crear una instancia.\n"
+
+#: test/ftdump.c:188
+msgid "Could not create second instance.\n"
+msgstr "No se puede crear una segunda instancia.\n"
+
+#: test/ftdump.c:194
+msgid "Memory footprint statistics:\n"
+msgstr "Estadísticas de asignación de memoria:\n"
+
+#: test/ftdump.c:202
+msgid "face object"
+msgstr "objeto diseño"
+
+#: test/ftdump.c:203
+msgid "glyph object"
+msgstr "objeto glifo"
+
+#: test/ftdump.c:204
+msgid "instance object"
+msgstr "objeto instancia"
+
+#: test/ftdump.c:208
+msgid "exec. context object"
+msgstr "objeto contexto de calculo"
+
+#: test/ftdump.c:215
+msgid "total memory usage"
+msgstr "uso total de memoria"
+
+#: test/ftdump.c:223 test/ftdump.c:579 test/ftdump.c:789 test/ftdump.c:993
+#: test/ftdump.c:1139 test/ftlint.c:274 test/ftlint.c:287 test/ftmetric.c:390
+#: test/ftsbit.c:286
+#, c-format
+msgid "FreeType error message: %s\n"
+msgstr "Mensaje de error FreeType: %s\n"
+
+#: test/ftdump.c:300
+msgid "font name table entries\n"
+msgstr "Entradas en la tabla de nombres\n"
+
+#: test/ftdump.c:310
+#, c-format
+msgid ""
+"PostScript name: %s\n"
+"\n"
+msgstr ""
+"Nombre PostScript: %s\n"
+"\n"
+
+#: test/ftdump.c:333
+msgid "character map encodings\n"
+msgstr "Codificaciones del mapa de caracteres\n"
+
+#: test/ftdump.c:340 test/ftdump.c:488
+msgid "The file doesn't seem to have any encoding table.\n"
+msgstr "La placa no parece tener ninguna tabla de codificación.\n"
+
+#: test/ftdump.c:344 test/ftdump.c:492
+#, c-format
+msgid ""
+"There are %hu encodings:\n"
+"\n"
+msgstr ""
+"Hay %hu codificaciones:\n"
+"\n"
+
+#: test/ftdump.c:349
+#, c-format
+msgid "encoding %2u: "
+msgstr " codificación %2u: "
+
+#: test/ftdump.c:376 test/ftdump.c:385 test/ftdump.c:452
+#, c-format
+msgid "Unknown value %hu"
+msgstr "Desconocido %hu"
+
+#: test/ftdump.c:459
+msgid "Unknown"
+msgstr "Desconocido"
+
+#: test/ftdump.c:481
+msgid "ftxcmap test\n"
+msgstr "Muestra de ftxcmap\n"
+
+#: test/ftdump.c:498
+#, c-format
+msgid "encoding %2u:\n"
+msgstr "Codificación %2u:\n"
+
+#: test/ftdump.c:503
+#, c-format
+msgid "first: glyph index %hu, character code 0x%lx\n"
+msgstr "primero: glifo índice %hu, codigo de carácter 0x%lx\n"
+
+#: test/ftdump.c:507
+#, c-format
+msgid "next: glyph index %hu, character code 0x%lx\n"
+msgstr "siguiente: glifo índice %hu, codigo de carácter 0x%lx\n"
+
+#: test/ftdump.c:511
+#, c-format
+msgid "last: glyph index %hu, character code 0x%lx\n"
+msgstr "ultimo: glifo índice %hu, codigo de carácter 0x%lx\n"
+
+#: test/ftdump.c:533 test/ftmetric.c:284
+msgid "Error while retrieving embedded bitmaps table.\n"
+msgstr "Error durante la recuperación de los bitmaps.\n"
+
+#: test/ftdump.c:537
+msgid "embedded bitmap table\n"
+msgstr "Tabla de bitmaps\n"
+
+#: test/ftdump.c:540
+#, c-format
+msgid " version of embedded bitmap table: 0x%lx\n"
+msgstr " version de la tabla de bitmap: 0x%lx\n"
+
+#: test/ftdump.c:542
+#, c-format
+msgid " number of embedded bitmap strikes: %lu\n"
+msgstr " número de tamaños de bitmaps: %lu\n"
+
+#: test/ftdump.c:552
+#, c-format
+msgid " bitmap strike %hu/%lu: "
+msgstr " tamaño %hu en %lu: "
+
+#: test/ftdump.c:555
+#, c-format
+msgid "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n"
+msgstr "%hux%hu pixels, en %hu bits, glifos [%hu...%hu]\n"
+
+#: test/ftdump.c:564
+#, c-format
+msgid " range format (%hu:%hu) glyphs %hu..%hu\n"
+msgstr " formato intervalo (%hu:%hu) glifos %hu...%hu\n"
+
+#: test/ftdump.c:615
+msgid "Error while loading GSUB table.\n"
+msgstr "Error durante la creación de la tabla GSUB.\n"
+
+#: test/ftdump.c:619
+msgid "GSUB table\n"
+msgstr "Table de cambios de glifos (GSUB)\n"
+
+#: test/ftdump.c:626
+msgid "Error while querying GSUB script list.\n"
+msgstr "Error durante la busqueda de la lista de las escrituras en GSUB.\n"
+
+#: test/ftdump.c:639
+#, c-format
+msgid "Error while selecting GSUB script `%4.4s'.\n"
+msgstr "Error durante la selección de la escritura `%4.4s' en GSUB.\n"
+
+#: test/ftdump.c:644 test/ftdump.c:848
+#, c-format
+msgid " script `%4.4s' (index %hu):\n"
+msgstr " escritura `%4.4s' (índice %hu):\n"
+
+#: test/ftdump.c:652
+#, c-format
+msgid "Error while querying GSUB default language system for script `%4.4s'.\n"
+msgstr ""
+"Error durante la busqueda en GSUB de las informaciones\n"
+"relativas a las lenguas estandar de la escritura `%4.4s'.\n"
+
+#: test/ftdump.c:657 test/ftdump.c:861
+msgid " default language system:\n"
+msgstr " lenguas estandar:\n"
+
+#: test/ftdump.c:670
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Error durante la selección de la información `%4.4s' en GSUB\n"
+"para las lenguas estandar de la escritura `%4.4s'.\n"
+
+#: test/ftdump.c:676 test/ftdump.c:757 test/ftdump.c:880 test/ftdump.c:961
+#, c-format
+msgid " feature `%4.4s' (index %hu; lookup "
+msgstr " información `%4.4s' (índice %hu: tabla de busqueda "
+
+#: test/ftdump.c:692
+#, c-format
+msgid "Error while querying GSUB language list for script `%4.4s'.\n"
+msgstr ""
+"Error durante la busqueda de las lenguas para la escritura `%4.4s' en GSUB.\n"
+
+#: test/ftdump.c:709
+#, c-format
+msgid "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n"
+msgstr ""
+"Error durante la selección de la lengua `%4.4s' para la escritura `%4.4s' en "
+"GSUB.\n"
+
+#: test/ftdump.c:714 test/ftdump.c:918
+#, c-format
+msgid " language `%4.4s' (index %hu):\n"
+msgstr " lengua `%4.4s' (índice %hu):\n"
+
+#: test/ftdump.c:719 test/ftdump.c:923
+#, c-format
+msgid " required feature index %hu (lookup "
+msgstr " información obligatoria índice %hu (tabla de busqueda "
+
+#: test/ftdump.c:734
+#, c-format
+msgid ""
+"Error while querying GSUB feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Error durante la busqueda en GSUB de las informaciones\n"
+"relativas a la escritura `%4.4s', lengua `%4.4s'.\n"
+
+#: test/ftdump.c:751
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Error durante la selección de la información `%4.4s'\n"
+"relativa a la escritura `%4.4s', lengua `%4.4s' en GSUB.\n"
+
+#: test/ftdump.c:776 test/ftdump.c:980
+msgid ""
+"Lookups:\n"
+"\n"
+msgstr "Tabla de busqueda:\n"
+
+#: test/ftdump.c:779 test/ftdump.c:983
+#, c-format
+msgid " %hu: type %hu, flag 0x%x\n"
+msgstr " %hu: tipo %hu, indicador 0x%x\n"
+
+#: test/ftdump.c:819
+msgid "Error while loading GPOS table.\n"
+msgstr "Error durante la creación de la tabla GPOS.\n"
+
+#: test/ftdump.c:823
+msgid "GPOS table\n"
+msgstr "Table de posición de glifos (GPOS)\n"
+
+#: test/ftdump.c:830
+msgid "Error while querying GPOS script list.\n"
+msgstr "Error durante la busqueda de la lista de las escrituras en GPOS.\n"
+
+#: test/ftdump.c:843
+#, c-format
+msgid "Error while selecting GPOS script `%4.4s'.\n"
+msgstr "Error durante la selección de la escritura `%4.4s' en GPOS.\n"
+
+#: test/ftdump.c:856
+#, c-format
+msgid "Error while querying GPOS default language system for script `%4.4s'.\n"
+msgstr ""
+"Error durante la busqueda en GPOS de las informaciones\n"
+"relativas a las lenguas estandar de la escritura `%4.4s'.\n"
+
+#: test/ftdump.c:874
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Error durante la selección de la información `%4.4s' en GPOS\n"
+"para las lenguas estandar de la escritura `%4.4s'.\n"
+
+#: test/ftdump.c:896
+#, c-format
+msgid "Error while querying GPOS language list for script `%4.4s'.\n"
+msgstr ""
+"Error durante la busqueda de las lenguas para la escritura `%4.4s' en GPOS.\n"
+
+#: test/ftdump.c:913
+#, c-format
+msgid "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n"
+msgstr ""
+"Error durante la selección de la lengua `%4.4s' para la escritura `%4.4s' en "
+"GPOS.\n"
+
+#: test/ftdump.c:938
+#, c-format
+msgid ""
+"Error while querying GPOS feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Error durante la busqueda en GPOS de las informaciones\n"
+"relativas a la escritura `%4.4s', lengua `%4.4s'.\n"
+
+#: test/ftdump.c:955
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Error durante la selección de la información `%4.4s'\n"
+"relativa a la escritura `%4.4s', lengua `%4.4s' en GPOS.\n"
+
+#: test/ftdump.c:1018
+msgid "ftdump: Simple TrueType Dumper -- part of the FreeType project"
+msgstr ""
+"ftdump: información sobre placas TrueType -- parte del proyecto FreeType"
+
+#: test/ftdump.c:1022
+#, c-format
+msgid ""
+"Usage: %s fontname[.ttf|.ttc]\n"
+"\n"
+msgstr ""
+"Uso: %s nombre_de_la_placa[.ttf|.ttc]\n"
+"\n"
+
+#: test/ftdump.c:1054 test/ftlint.c:134 test/ftmetric.c:228 test/ftsbit.c:127
+msgid "Error while initializing engine.\n"
+msgstr "Error durante la inicialización de la biblioteca.\n"
+
+#: test/ftdump.c:1061 test/ftmetric.c:236 test/ftsbit.c:134
+msgid "Error while initializing embedded bitmap extension.\n"
+msgstr "Error durante la inicialización de la extensión `bitmap'.\n"
+
+#: test/ftdump.c:1068
+msgid "Error while initializing GSUB extension.\n"
+msgstr "Error durante la inicialización de la extensión `GSUB'.\n"
+
+#: test/ftdump.c:1075
+msgid "Error while initializing GPOS extension.\n"
+msgstr "Error durante la inicialización de la extensión `GPOS'.\n"
+
+#: test/ftdump.c:1091 test/ftlint.c:187 test/ftmetric.c:251 test/ftsbit.c:182
+#, c-format
+msgid "Could not find or open %s.\n"
+msgstr "No se puede encontrar o abrir el fichero %s.\n"
+
+#: test/ftdump.c:1094 test/ftlint.c:193 test/ftmetric.c:254 test/ftsbit.c:188
+#, c-format
+msgid "Error while opening %s.\n"
+msgstr "Error abriendo %s.\n"
+
+#: test/ftlint.c:94
+msgid ""
+"ftlint: Simple TrueType instruction tester -- part of the FreeType project"
+msgstr ""
+"ftlint: verificador de instrucciones TrueType -- parte del proyecto FreeType"
+
+#: test/ftlint.c:99
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
+"\n"
+msgstr ""
+"Uso: %s ppem nombre_de_la_placa[.ttf|.ttc] [nombre2...]\n"
+"\n"
+
+#: test/ftlint.c:226 test/ftsbit.c:225
+#, c-format
+msgid "Could not set point size to %d.\n"
+msgstr "No se puede asignar el tamaño del punto a %d.\n"
+
+#: test/ftlint.c:239
+msgid ""
+"Error with\n"
+" "
+msgstr ""
+"Error con\n"
+" "
+
+#: test/ftlint.c:240
+#, c-format
+msgid "glyph %4u: %s\n"
+msgstr "glifo %4u: %s\n"
+
+#: test/ftlint.c:253
+msgid "1 fail.\n"
+msgstr "1 error.\n"
+
+#: test/ftlint.c:255
+#, c-format
+msgid "%d fails.\n"
+msgstr "%d errores.\n"
+
+#: test/ftmetric.c:70
+msgid ""
+"ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project"
+msgstr ""
+"ftmetric: información sobre dimensiones TrueType -- parte del proyecto "
+"FreeType"
+
+#: test/ftmetric.c:74
+#, c-format
+msgid ""
+"Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+"\n"
+" -B show sbit's metrics (default: none)\n"
+" -c C use C'th font index of TrueType collection (default: 0)\n"
+" -i index glyph index (default: 0)\n"
+" -r R use resolution R dpi (default: 72)\n"
+"\n"
+msgstr ""
+"Uso: %s [optiones] ppem nombre_de_la_placa[.ttf|.ttc]\n"
+"\n"
+" -B muestra dimensiones de los sbit's (default: no)\n"
+" -c C usa (C+1)ª placa de la collección TrueType (default: 1ª)\n"
+" -i index muestra esto glifo (default: primero glifo)\n"
+" -r R usa resolución R en dpi (default: 72)\n"
+"\n"
+
+#: test/ftmetric.c:261
+#, c-format
+msgid "There are %d fonts in this collection.\n"
+msgstr "Hay %d placas en esta collección.\n"
+
+#: test/ftmetric.c:266
+#, c-format
+msgid "There is no collection with index %d in this font file.\n"
+msgstr "No hay placa con índice %d en esto fichero.\n"
+
+#: test/ftmetric.c:280
+msgid "There is no embedded bitmap data in the font.\n"
+msgstr "No hay bitmaps en esto fichero.\n"
+
+#: test/ftmetric.c:310
+msgid "Could not set device resolutions.\n"
+msgstr "No se puede poner esta resolución.\n"
+
+#: test/ftmetric.c:317
+msgid "Could not reset instance.\n"
+msgstr "No se puede inicializar la instancia.\n"
+
+#: test/ftmetric.c:323
+#, c-format
+msgid "Instance metrics: ppemX %d, ppemY %d\n"
+msgstr "Dimensiones: ppemX %d, ppemY %d\n"
+
+#: test/ftmetric.c:333 test/ftsbit.c:234
+msgid "Could not allocate glyph bitmap container.\n"
+msgstr "No se puede crear un contenedor de bitmap.\n"
+
+#: test/ftmetric.c:341 test/ftsbit.c:258
+#, c-format
+msgid "Can't load bitmap for glyph %d.\n"
+msgstr "Ne se puede crear un bitmap para el glifo %d.\n"
+
+#: test/ftmetric.c:368
+msgid "Outline's metrics"
+msgstr "Dimensiones del contorno"
+
+#: test/ftmetric.c:370
+msgid "Outline glyph\n"
+msgstr "Glifo utilizando el contorno\n"
+
+#: test/ftsbit.c:90
+msgid "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project"
+msgstr "ftsbit: bitmaps de una placa TrueType -- parte del proyecto FreeType"
+
+#: test/ftsbit.c:95
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+msgstr ""
+"Uso: %s ppem nombre_de_font[.ttf|.ttc] índice_de_glifo [índice2...]\n"
+"\n"
+
+#: test/ftsbit.c:200
+msgid "Could not find embedded bitmaps in this font.\n"
+msgstr "No se puede encontrar bitmaps en esto fichero.\n"
+
+#: test/ftsbit.c:206
+msgid "Error while loading embedded bitmaps.\n"
+msgstr "Error durante la lectura de los bitmaps.\n"
+
+#: test/ftsbit.c:252
+#, c-format
+msgid " no bitmap for glyph %d.\n"
+msgstr " no bitmap para el glifo %d.\n"
+
+#: test/ftsbit.c:264
+#, c-format
+msgid "glyph index %d = %dx%d pixels, "
+msgstr "glifo índice %d = %dx%d pixels, "
+
+#: test/ftsbit.c:267
+#, c-format
+msgid "advance = %ld, minBearing = [%ld,%ld]\n"
+msgstr "`advance' = %ld, `bearings' = [%ld,%ld]\n"
diff --git a/Build/source/libs/freetype/po/fr.po b/Build/source/libs/freetype/po/fr.po
new file mode 100644
index 00000000000..f88bc2b022f
--- /dev/null
+++ b/Build/source/libs/freetype/po/fr.po
@@ -0,0 +1,883 @@
+# French messages for FreeType, without accents.
+# Copyright (C) 1998-2002 David Turner
+# David Turner <david.turner@freetype.org>, 1998
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FreeType 1.5\n"
+"POT-Creation-Date: 2002-11-08 18:11+0000\n"
+"PO-Revision-Date: 2002-11-08 18:20+0100\n"
+"Last-Translator: Antoine Leca <Antoine-Freetype@Leca-Marti.org>\n"
+"Language-Team: French\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=us-ascii\n"
+"Content-Transfer-Encoding: 7bit\n"
+
+#: lib/extend/ftxerr18.c:40
+msgid ""
+"Welcome to the translation of the Freetype v.1 library!\n"
+"\n"
+"This message is not really part of the library (it is bracketed by\n"
+" #if 0 / #endif), but is really intended to be the first one in the .po\n"
+"file, and the first one that a new translator should see, to give hints.\n"
+"\n"
+"First, while this .po might seems big, the real interesting part of it\n"
+"is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+"messages are part of the demonstration programs, and are more intended\n"
+"to help grasping how to use i18n with the Freetype library. So the real\n"
+"work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+"\n"
+"A difficulty is that there are some specialized vocabulary, about\n"
+"``faces'', ``glyph'' and similar things. These are typographical things,\n"
+"and this should be researched before attempting to translate the whole\n"
+"thing. A quick look across the TrueType documentation might help to\n"
+"understand many things, too.\n"
+"\n"
+"Best wiches for your translation!\n"
+"Antoine Leca - 2002-11-08"
+msgstr "(Lu - Antoine Leca, 2002-11-08)"
+
+#: lib/extend/ftxerr18.c:77
+msgid "Successful function call, no error."
+msgstr "Appel de fonction reussi, pas d'erreur."
+
+#: lib/extend/ftxerr18.c:80
+msgid "Invalid face handle."
+msgstr "Mauvais handle d'oeil (face)."
+
+#: lib/extend/ftxerr18.c:82
+msgid "Invalid instance handle."
+msgstr "Mauvais handle d'instance."
+
+#: lib/extend/ftxerr18.c:84
+msgid "Invalid glyph handle."
+msgstr "Mauvais handle de glyphe."
+
+#: lib/extend/ftxerr18.c:86
+msgid "Invalid charmap handle."
+msgstr "Mauvais handle d'encodage (charmap)."
+
+#: lib/extend/ftxerr18.c:88
+msgid "Invalid result address."
+msgstr "Mauvaise adresse de resultat."
+
+#: lib/extend/ftxerr18.c:90
+msgid "Invalid glyph index."
+msgstr "Numero de glyphe incorrect."
+
+#: lib/extend/ftxerr18.c:92
+msgid "Invalid argument."
+msgstr "Argument incorrect."
+
+#: lib/extend/ftxerr18.c:94
+msgid "Could not open file."
+msgstr "Le fichier n'a pas pu etre ouvert."
+
+#: lib/extend/ftxerr18.c:96
+msgid "File is not a TrueType collection."
+msgstr "Ce fichier n'est pas une collection."
+
+#: lib/extend/ftxerr18.c:98
+msgid "Mandatory table missing."
+msgstr "Il manque une table critique."
+
+#: lib/extend/ftxerr18.c:100
+msgid "Invalid horizontal metrics (hmtx table broken)."
+msgstr "Metriques horizontales (table `hmtx') incorrectes."
+
+#: lib/extend/ftxerr18.c:102
+msgid "Invalid charmap format."
+msgstr "Format d'encodage (charmap) invalide."
+
+#: lib/extend/ftxerr18.c:104
+msgid "Invalid ppem value."
+msgstr "Taille en pixels incorrecte."
+
+#: lib/extend/ftxerr18.c:106
+msgid "Invalid vertical metrics (vmtx table broken)."
+msgstr "Metriques verticales (table `vmtx') incorrectes."
+
+#: lib/extend/ftxerr18.c:109
+msgid "Invalid file format."
+msgstr "Format de fichier invalide."
+
+#: lib/extend/ftxerr18.c:112
+msgid "Invalid engine."
+msgstr "Mauvaise instance de bibliotheque (engine)"
+
+#: lib/extend/ftxerr18.c:114
+msgid "Too many extensions."
+msgstr "Trop d'extensions utilisees (max: 8)."
+
+#: lib/extend/ftxerr18.c:116
+msgid "Extensions unsupported."
+msgstr "Extensions non disponibles."
+
+#: lib/extend/ftxerr18.c:118
+msgid "Invalid extension id."
+msgstr "Mauvais numero d'extension."
+
+#: lib/extend/ftxerr18.c:121
+msgid "No vertical data in font."
+msgstr "Pas de donnees verticales dans cette police."
+
+#: lib/extend/ftxerr18.c:124
+msgid "Maximum Profile (maxp) table missing."
+msgstr "Il manque la table `maxp'."
+
+#: lib/extend/ftxerr18.c:126
+msgid "Font Header (head) table missing."
+msgstr "Il manque l'en-tete de police (head)."
+
+#: lib/extend/ftxerr18.c:128
+msgid "Horizontal Header (hhea) table missing."
+msgstr "Il manque l'en-tete pour l'horizontale (hhea)."
+
+#: lib/extend/ftxerr18.c:130
+msgid "Index to Location (loca) table missing."
+msgstr "Il manque les index de glyphes (table `loca')."
+
+#: lib/extend/ftxerr18.c:132
+msgid "Naming (name) table missing."
+msgstr "Il manque la table des noms (name)."
+
+#: lib/extend/ftxerr18.c:134
+msgid "Character to Glyph Index Mapping (cmap) tables missing."
+msgstr "Il manque la table des encodages (cmap)."
+
+#: lib/extend/ftxerr18.c:136
+msgid "Horizontal Metrics (hmtx) table missing."
+msgstr "Il manque les metriques horizontales (hmtx)."
+
+#: lib/extend/ftxerr18.c:138
+msgid "OS/2 table missing."
+msgstr "Il manque la table `OS/2'."
+
+#: lib/extend/ftxerr18.c:140
+msgid "PostScript (post) table missing."
+msgstr "Il manque la table Postscript (post)."
+
+#: lib/extend/ftxerr18.c:142
+msgid "Glyph (glyf) table missing."
+msgstr "Il manque les glyphes (table `glyf')."
+
+#: lib/extend/ftxerr18.c:147
+msgid "Out of memory."
+msgstr "Pas assez de memoire."
+
+#: lib/extend/ftxerr18.c:152
+msgid "Invalid file offset."
+msgstr "Adresse dans le fichier incorrecte."
+
+#: lib/extend/ftxerr18.c:154
+msgid "Invalid file read."
+msgstr "Lecture du fichier impossible."
+
+#: lib/extend/ftxerr18.c:156
+msgid "Invalid frame access."
+msgstr "Fenetre d'access incorrecte."
+
+#: lib/extend/ftxerr18.c:161
+msgid "Too many points."
+msgstr "Trop de points."
+
+#: lib/extend/ftxerr18.c:163
+msgid "Too many contours."
+msgstr "Trop de contours."
+
+#: lib/extend/ftxerr18.c:165
+msgid "Invalid composite glyph."
+msgstr "Glyphe compose invalide."
+
+#: lib/extend/ftxerr18.c:167
+msgid "Too many instructions."
+msgstr "Trop d'instructions."
+
+#: lib/extend/ftxerr18.c:169
+msgid "Too many function definitions (FDEF)."
+msgstr "Trop de definitions de fonctions (FDEF)."
+
+#: lib/extend/ftxerr18.c:174
+msgid "Invalid opcode."
+msgstr "Code-operation invalide."
+
+#: lib/extend/ftxerr18.c:176
+msgid "Too few arguments."
+msgstr "Il manque un ou des arguments."
+
+#: lib/extend/ftxerr18.c:178
+msgid "Stack overflow."
+msgstr "Debordement de la pile."
+
+#: lib/extend/ftxerr18.c:180
+msgid "Code overflow."
+msgstr "Debordement dans le code."
+
+#: lib/extend/ftxerr18.c:182
+msgid "Bad argument."
+msgstr "Mauvais argument."
+
+#: lib/extend/ftxerr18.c:184
+msgid "Divide by zero."
+msgstr "Division par zero."
+
+#: lib/extend/ftxerr18.c:186
+msgid "Storage overflow."
+msgstr "Depassement de capacite (stockage)."
+
+#: lib/extend/ftxerr18.c:188
+msgid "Control Value (cvt) table overflow."
+msgstr "Depassement de capacite (tableau cvt)."
+
+#: lib/extend/ftxerr18.c:190
+msgid "Invalid reference."
+msgstr "Reference incorrecte."
+
+#: lib/extend/ftxerr18.c:192
+msgid "Invalid distance."
+msgstr "Distance incorrecte."
+
+#: lib/extend/ftxerr18.c:194
+msgid "Interpolate twilight points."
+msgstr "Interpolation de points de repere."
+
+#: lib/extend/ftxerr18.c:196
+msgid "`DEBUG' opcode found."
+msgstr "Le code `DEBUG' a ete rencontre."
+
+#: lib/extend/ftxerr18.c:198
+msgid "`ENDF' in byte-code stream."
+msgstr "'ENDF' invalide dans les instructions d'un glyphe."
+
+#: lib/extend/ftxerr18.c:200
+msgid "Out of code ranges."
+msgstr "Pas assez d'espace d'execution (code ranges)."
+
+#: lib/extend/ftxerr18.c:202
+msgid "Nested function definitions."
+msgstr "Definitions imbriquees de fonction."
+
+#: lib/extend/ftxerr18.c:204
+msgid "Invalid code range."
+msgstr "Espace d'execution (code range) incorrect."
+
+#: lib/extend/ftxerr18.c:206
+msgid "Invalid displacement."
+msgstr "Deplacement invalide."
+
+#: lib/extend/ftxerr18.c:208
+msgid "Endless loop encountered while executing instructions."
+msgstr "Arret force d'une boucle infinie."
+
+#: lib/extend/ftxerr18.c:213
+msgid "Nested frame access."
+msgstr "Fenetres d'acces imbriquees."
+
+#: lib/extend/ftxerr18.c:215
+msgid "Invalid cache list."
+msgstr "(Mauvaise liste chainee de caches)."
+
+#: lib/extend/ftxerr18.c:217
+msgid "Could not find context."
+msgstr "Contexte introuvable."
+
+#: lib/extend/ftxerr18.c:219
+msgid "Unlisted object."
+msgstr "Objet non chaine dans le cache."
+
+#: lib/extend/ftxerr18.c:224
+msgid "Raster pool overflow."
+msgstr "Debordement de memoire de la trameuse."
+
+#: lib/extend/ftxerr18.c:226
+msgid "Raster: negative height encountered."
+msgstr "Trameuse: hauteur negative."
+
+#: lib/extend/ftxerr18.c:228
+msgid "Raster: invalid value."
+msgstr "Trameuse: valeur incorrecte."
+
+#: lib/extend/ftxerr18.c:230
+msgid "Raster not initialized."
+msgstr "Trameuse: non initialisee."
+
+#: lib/extend/ftxerr18.c:235
+msgid "Invalid kerning (kern) table format."
+msgstr "Format de table de crenage (kern) invalide."
+
+#: lib/extend/ftxerr18.c:237
+msgid "Invalid kerning (kern) table."
+msgstr "Table de crenage (kern) incorrecte."
+
+#: lib/extend/ftxerr18.c:240
+msgid "Invalid PostScript (post) table format."
+msgstr "Format de table Postscript (post) invalide."
+
+#: lib/extend/ftxerr18.c:242
+msgid "Invalid PostScript (post) table."
+msgstr "Table Postscript (post) incorrecte."
+
+#: lib/extend/ftxerr18.c:247
+msgid "Invalid TrueType Open subtable format."
+msgstr "Format de table TrueType Open invalide."
+
+#: lib/extend/ftxerr18.c:249
+msgid "Invalid TrueType Open subtable."
+msgstr "Sous-table TrueType Open incorrecte."
+
+#: lib/extend/ftxerr18.c:251
+msgid "Glyph(s) not covered by lookup."
+msgstr "Des glyphes sont absents d'une table de recherche (lookup)."
+
+#: lib/extend/ftxerr18.c:253
+msgid "Too many nested context substitutions."
+msgstr "Substitutions contextuelles imbriquees trop profondement."
+
+#: lib/extend/ftxerr18.c:255
+msgid "No MM (Adobe MultipleMaster) interpreter available."
+msgstr "Pas d'interpreteur MM (Adobe MultipleMaster) disponible."
+
+#: lib/extend/ftxerr18.c:258
+msgid "Invalid glyph substitution (GSUB) table format."
+msgstr "Format de la table de substitution de glyphes (GSUB) invalide."
+
+#: lib/extend/ftxerr18.c:260
+msgid "Invalid glyph substitution (GSUB) table."
+msgstr "Table de substitution de glyphes (GSUB) incorrecte."
+
+#: lib/extend/ftxerr18.c:263
+msgid "Invalid glyph positioning (GPOS) table format."
+msgstr "Format de table de positionnement des glyphes (GPOS) invalide."
+
+#: lib/extend/ftxerr18.c:265
+msgid "Invalid glyph positioning (GPOS) table."
+msgstr "Table de positionnement des glyphes (GPOS) incorrecte."
+
+#: lib/extend/ftxerr18.c:268
+msgid "Invalid glyph definition (GDEF) table format."
+msgstr "Format de table de definition des glyphes (GDEF) invalide."
+
+#: lib/extend/ftxerr18.c:270
+msgid "Invalid glyph definition (GDEF) table."
+msgstr "Table de definition des glyphes (GDEF) incorrecte."
+
+#: lib/extend/ftxerr18.c:277
+msgid "Invalid Error Number."
+msgstr "Numero d'erreur inconnu ?"
+
+#: test/fterror.c:49
+msgid ""
+"fterror: test TT_ErrToString18 functionality\n"
+"\n"
+msgstr ""
+"fterror: teste la fonctionnalite TT_ErrToString18\n"
+"\n"
+
+#: test/fterror.c:50
+msgid ""
+" with an optional numerical argument, dumps the associated message.\n"
+"\n"
+msgstr ""
+" avec un argument numerique optionnel, ecrit le message associe.\n"
+"\n"
+
+#: test/fterror.c:73
+msgid "Start of fterror.\n"
+msgstr "Debut de fterror.\n"
+
+#: test/fterror.c:81
+msgid "End of fterror.\n"
+msgstr "Fin de fterror.\n"
+
+#: test/fterror.c:96
+#, c-format
+msgid "Freetype error code 0x%04lX (%lu): %s\n"
+msgstr "Code d'erreur FreeType 0x%04lX (%lu) : %s\n"
+
+#: test/ftdump.c:169 test/ftlint.c:207 test/ftmetric.c:294
+msgid "Could not create glyph container.\n"
+msgstr "Impossible de creer un conteneur de glyphe.\n"
+
+#: test/ftdump.c:179 test/ftlint.c:215 test/ftmetric.c:303 test/ftsbit.c:214
+msgid "Could not create instance.\n"
+msgstr "Impossible de creer une instance\n"
+
+#: test/ftdump.c:188
+msgid "Could not create second instance.\n"
+msgstr "Impossible de creer une deuxieme instance.\n"
+
+#: test/ftdump.c:194
+msgid "Memory footprint statistics:\n"
+msgstr "Statistiques de consommation de la memoire:\n"
+
+#: test/ftdump.c:202
+msgid "face object"
+msgstr "objet oeil"
+
+#: test/ftdump.c:203
+msgid "glyph object"
+msgstr "objet glyphe"
+
+#: test/ftdump.c:204
+msgid "instance object"
+msgstr "objet instance"
+
+#: test/ftdump.c:208
+msgid "exec. context object"
+msgstr "objet contexte"
+
+#: test/ftdump.c:215
+msgid "total memory usage"
+msgstr "consommation totale de memoire"
+
+#: test/ftdump.c:223 test/ftdump.c:579 test/ftdump.c:789 test/ftdump.c:993
+#: test/ftdump.c:1139 test/ftlint.c:274 test/ftlint.c:287 test/ftmetric.c:390
+#: test/ftsbit.c:286
+#, c-format
+msgid "FreeType error message: %s\n"
+msgstr "Message d'erreur FreeType : %s\n"
+
+#: test/ftdump.c:300
+msgid "font name table entries\n"
+msgstr "Elements du tableau des noms\n"
+
+#: test/ftdump.c:310
+#, c-format
+msgid "PostScript name: %s\n\n"
+msgstr "Nom Postscript : %s\n\n"
+
+#: test/ftdump.c:333
+msgid "character map encodings\n"
+msgstr "Encodages des caracteres\n"
+
+#: test/ftdump.c:340 test/ftdump.c:488
+msgid "The file doesn't seem to have any encoding table.\n"
+msgstr "Cette police ne semble pas avoir de table d'encodage.\n"
+
+#: test/ftdump.c:344 test/ftdump.c:492
+#, c-format
+msgid ""
+"There are %hu encodings:\n"
+"\n"
+msgstr ""
+"Il y a %hu encodage(s) :\n"
+"\n"
+
+#: test/ftdump.c:349
+#, c-format
+msgid "encoding %2u: "
+msgstr "encodage %2u : "
+
+#: test/ftdump.c:376 test/ftdump.c:385 test/ftdump.c:452
+#, c-format
+msgid "Unknown value %hu"
+msgstr "(valeur inconnue %hu)"
+
+#: test/ftdump.c:459
+msgid "Unknown"
+msgstr "(inconnu)"
+
+#: test/ftdump.c:481
+msgid "ftxcmap test\n"
+msgstr "Test de ftxcmap\n"
+
+#: test/ftdump.c:498
+#, c-format
+msgid "encoding %2u:\n"
+msgstr "encodage %2u :\n"
+
+#: test/ftdump.c:503
+#, c-format
+msgid "first: glyph index %hu, character code 0x%lx\n"
+msgstr "premier : glyphe numero %hu, caractere code 0x%lx\n"
+
+#: test/ftdump.c:507
+#, c-format
+msgid "next: glyph index %hu, character code 0x%lx\n"
+msgstr "suivant : glyphe numero %hu, caractere code 0x%lx\n"
+
+#: test/ftdump.c:511
+#, c-format
+msgid "last: glyph index %hu, character code 0x%lx\n"
+msgstr "dernier : glyphe numero %hu, caractere code 0x%lx\n"
+
+#: test/ftdump.c:533 test/ftmetric.c:284
+msgid "Error while retrieving embedded bitmaps table.\n"
+msgstr "Erreur pendant la recuperation de la table des bitmaps.\n"
+
+#: test/ftdump.c:537
+msgid "embedded bitmap table\n"
+msgstr "Table des bitmaps incorpores\n"
+
+#: test/ftdump.c:540
+#, c-format
+msgid " version of embedded bitmap table: 0x%lx\n"
+msgstr " version de la table de bitmaps : 0x%lx\n"
+
+#: test/ftdump.c:542
+#, c-format
+msgid " number of embedded bitmap strikes: %lu\n"
+msgstr " nombre de tailles de bitmaps : %lu\n"
+
+#: test/ftdump.c:552
+#, c-format
+msgid " bitmap strike %hu/%lu: "
+msgstr " taille de bitmap %hu sur %lu : "
+
+#: test/ftdump.c:555
+#, c-format
+msgid "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n"
+msgstr "%hux%hu pixels par %hu bit(s), glyphes de %hu a %hu\n"
+
+#: test/ftdump.c:564
+#, c-format
+msgid " range format (%hu:%hu) glyphs %hu..%hu\n"
+msgstr " format intervalle (%hu:%hu) glyphes %hu a %hu\n"
+
+#: test/ftdump.c:615
+msgid "Error while loading GSUB table.\n"
+msgstr "Erreur en chargeant la table GSUB.\n"
+
+#: test/ftdump.c:619
+msgid "GSUB table\n"
+msgstr "Table des substitutions de glyphes (GSUB)\n"
+
+#: test/ftdump.c:626
+msgid "Error while querying GSUB script list.\n"
+msgstr "Erreur en demandant la liste des ecritures dans GSUB.\n"
+
+#: test/ftdump.c:639
+#, c-format
+msgid "Error while selecting GSUB script `%4.4s'.\n"
+msgstr "Erreur en selectionnant l'ecriture `%4.4s' dans GSUB.\n"
+
+#: test/ftdump.c:644 test/ftdump.c:848
+#, c-format
+msgid " script `%4.4s' (index %hu):\n"
+msgstr " Ecriture `%4.4s' (numero %hu)\n"
+
+#: test/ftdump.c:652
+#, c-format
+msgid "Error while querying GSUB default language system for script `%4.4s'.\n"
+msgstr ""
+"Erreur en cherchant les informations pour les langues standards de `%4.4s' "
+"dans GSUB.\n"
+
+#: test/ftdump.c:657 test/ftdump.c:861
+msgid " default language system:\n"
+msgstr " langue standard :\n"
+
+#: test/ftdump.c:670
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Erreur en selectionnant dans GSUB l'information `%4.4s'\n"
+"pour la langue standard de l'ecriture `%4.4s'.\n"
+
+#: test/ftdump.c:676 test/ftdump.c:757 test/ftdump.c:880 test/ftdump.c:961
+#, c-format
+msgid " feature `%4.4s' (index %hu; lookup "
+msgstr " information `%4.4s' (numero %hu ; table(s) de recherche "
+
+#: test/ftdump.c:692
+#, c-format
+msgid "Error while querying GSUB language list for script `%4.4s'.\n"
+msgstr ""
+"Erreur en demandant la liste des langues pour l'ecriture `%4.4s' dans GSUB.\n"
+
+#: test/ftdump.c:709
+#, c-format
+msgid "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n"
+msgstr ""
+"Erreur en selectionnant la langue `%4.4s' pour l'ecriture `%4.4s' dans "
+"GSUB.\n"
+
+#: test/ftdump.c:714 test/ftdump.c:918
+#, c-format
+msgid " language `%4.4s' (index %hu):\n"
+msgstr " langue `%4.4s' (numero %hu) :\n"
+
+#: test/ftdump.c:719 test/ftdump.c:923
+#, c-format
+msgid " required feature index %hu (lookup "
+msgstr " information requise (table(s) de recherche "
+
+#: test/ftdump.c:734
+#, c-format
+msgid ""
+"Error while querying GSUB feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Erreur en recherchant dans GSUB la liste des informations\n"
+"pour l'ecriture `%4.4s', langue `%4.4s'.\n"
+
+#: test/ftdump.c:751
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Erreur en selectionnant dans GSUB l'information `%4.4s'\n"
+"pour l'ecriture `%4.4s', langue `%4.4s'.\n"
+
+#: test/ftdump.c:776 test/ftdump.c:980
+msgid ""
+"Lookups:\n"
+"\n"
+msgstr " Tables de recherche :\n"
+
+#: test/ftdump.c:779 test/ftdump.c:983
+#, c-format
+msgid " %hu: type %hu, flag 0x%x\n"
+msgstr "%4hu : type %hu, drapeaux 0x%x\n"
+
+#: test/ftdump.c:819
+msgid "Error while loading GPOS table.\n"
+msgstr "Erreur en chargeant la table GPOS.\n"
+
+#: test/ftdump.c:823
+msgid "GPOS table\n"
+msgstr "Table des repositionnement de glyphes (GPOS)\n"
+
+#: test/ftdump.c:830
+msgid "Error while querying GPOS script list.\n"
+msgstr "Erreur en demandant la liste des ecritures dans GPOS.\n"
+
+#: test/ftdump.c:843
+#, c-format
+msgid "Error while selecting GPOS script `%4.4s'.\n"
+msgstr "Erreur en selectionnant l'ecriture `%4.4s' dans GPOS.\n"
+
+#: test/ftdump.c:856
+#, c-format
+msgid "Error while querying GPOS default language system for script `%4.4s'.\n"
+msgstr ""
+"Erreur en cherchant les informations pour les langues standards de `%4.4s' "
+"dans GPOS.\n"
+
+#: test/ftdump.c:874
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Erreur en selectionnant dans GPOS l'information `%4.4s'\n"
+"pour la langue standard de l'ecriture `%4.4s'.\n"
+
+#: test/ftdump.c:896
+#, c-format
+msgid "Error while querying GPOS language list for script `%4.4s'.\n"
+msgstr ""
+"Erreur en demandant la liste des langues pour l'ecriture `%4.4s' dans GPOS.\n"
+
+#: test/ftdump.c:913
+#, c-format
+msgid "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n"
+msgstr ""
+"Erreur en selectionnant la langue `%4.4s' pour l'ecriture `%4.4s' dans "
+"GPOS.\n"
+
+#: test/ftdump.c:938
+#, c-format
+msgid ""
+"Error while querying GPOS feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Erreur en recherchant dans GPOS la liste des informations\n"
+"pour l'ecriture `%4.4s', langue `%4.4s'.\n"
+
+#: test/ftdump.c:955
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Erreur en selectionnant dans GPOS l'information `%4.4s'\n"
+"pour l'ecriture `%4.4s', langue `%4.4s'.\n"
+
+#: test/ftdump.c:1018
+msgid "ftdump: Simple TrueType Dumper -- part of the FreeType project"
+msgstr "ftdump : utilitaire d'informations TrueType -- www.freetype.org"
+
+#: test/ftdump.c:1022
+#, c-format
+msgid ""
+"Usage: %s fontname[.ttf|.ttc]\n"
+"\n"
+msgstr ""
+"Utilisation : %s nompolice[.ttf|.ttc]\n"
+"\n"
+
+#: test/ftdump.c:1054 test/ftlint.c:134 test/ftmetric.c:228 test/ftsbit.c:127
+msgid "Error while initializing engine.\n"
+msgstr "Erreur lors de l'initialisation de FreeType.\n"
+
+#: test/ftdump.c:1061 test/ftmetric.c:236 test/ftsbit.c:134
+msgid "Error while initializing embedded bitmap extension.\n"
+msgstr "Erreur lors de l'initialisation de l'extension `bitmaps'.\n"
+
+#: test/ftdump.c:1068
+msgid "Error while initializing GSUB extension.\n"
+msgstr "Erreur lors de l'initialisation de l'extension `GSUB'.\n"
+
+#: test/ftdump.c:1075
+msgid "Error while initializing GPOS extension.\n"
+msgstr "Erreur lors de l'initialisation de l'extension `GPOS'.\n"
+
+#: test/ftdump.c:1091 test/ftlint.c:187 test/ftmetric.c:251 test/ftsbit.c:182
+#, c-format
+msgid "Could not find or open %s.\n"
+msgstr "Impossible de trouver ou d'ouvrir %s.\n"
+
+#: test/ftdump.c:1094 test/ftlint.c:193 test/ftmetric.c:254 test/ftsbit.c:188
+#, c-format
+msgid "Error while opening %s.\n"
+msgstr "Erreur lors de l'ouverture de %s.\n"
+
+#: test/ftlint.c:94
+msgid ""
+"ftlint: Simple TrueType instruction tester -- part of the FreeType project"
+msgstr ""
+"ftlint : verificateur simple d'instructions TrueType - www.freetype.org"
+
+#: test/ftlint.c:99
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
+"\n"
+msgstr ""
+"Utilisation : %s ppem nompolice[.ttf|.ttc] [nompolice2...]\n"
+"\n"
+
+#: test/ftlint.c:226 test/ftsbit.c:225
+#, c-format
+msgid "Could not set point size to %d.\n"
+msgstr "Impossible de selectionner la taille %d.\n"
+
+#: test/ftlint.c:239
+msgid ""
+"Error with\n"
+" "
+msgstr ""
+"Erreur avec\n"
+" "
+
+#: test/ftlint.c:240
+#, c-format
+msgid "glyph %4u: %s\n"
+msgstr "glyphe %4u : %s\n"
+
+#: test/ftlint.c:253
+msgid "1 fail.\n"
+msgstr "1 echec.\n"
+
+#: test/ftlint.c:255
+#, c-format
+msgid "%d fails.\n"
+msgstr "%d echecs.\n"
+
+#: test/ftmetric.c:70
+msgid ""
+"ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project"
+msgstr "ftmetric : affichage des metriques TrueType -- www.freetype.org"
+
+#: test/ftmetric.c:74
+#, c-format
+msgid ""
+"Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+"\n"
+" -B show sbit's metrics (default: none)\n"
+" -c C use C'th font index of TrueType collection (default: 0)\n"
+" -i index glyph index (default: 0)\n"
+" -r R use resolution R dpi (default: 72)\n"
+"\n"
+msgstr ""
+"Utilisation : %s [options] point nompolice[.ttf|.ttc]\n"
+"\n"
+" -B montrer les metriques des bitmaps (defaut : non)\n"
+" -c C utilise la police numero C d'une collection (defaut : 0)\n"
+" -i index numero du glyphe (default : 0)\n"
+" -r R resolution en dpi (defaut : 72)\n"
+"\n"
+
+#: test/ftmetric.c:261
+#, c-format
+msgid "There are %d fonts in this collection.\n"
+msgstr "Il y a %d polices dans cette collection.\n"
+
+#: test/ftmetric.c:266
+#, c-format
+msgid "There is no collection with index %d in this font file.\n"
+msgstr "Il n'y a aucune police d'indice %d dans cette collection.\n"
+
+#: test/ftmetric.c:280
+msgid "There is no embedded bitmap data in the font.\n"
+msgstr "Il n'y a pas de bitmaps dans cette police.\n"
+
+#: test/ftmetric.c:310
+msgid "Could not set device resolutions.\n"
+msgstr "Impossible de changer la resolution.\n"
+
+#: test/ftmetric.c:317
+msgid "Could not reset instance.\n"
+msgstr "Impossible de changer la taile.\n"
+
+#: test/ftmetric.c:323
+#, c-format
+msgid "Instance metrics: ppemX %d, ppemY %d\n"
+msgstr "Metriques de l'instance : ppemX %d ppemY %d\n"
+
+#: test/ftmetric.c:333 test/ftsbit.c:234
+msgid "Could not allocate glyph bitmap container.\n"
+msgstr "Impossible d'allouer un conteneur de glyphe.\n"
+
+#: test/ftmetric.c:341 test/ftsbit.c:258
+#, c-format
+msgid "Can't load bitmap for glyph %d.\n"
+msgstr "Impossible de charger le bitmap du glyphe %d.\n"
+
+#: test/ftmetric.c:368
+msgid "Outline's metrics"
+msgstr "Metriques du dessin vectorise"
+
+#: test/ftmetric.c:370
+msgid "Outline glyph\n"
+msgstr "glyphe du dessin vectorise\n"
+
+#: test/ftsbit.c:90
+msgid "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project"
+msgstr "ftsbit : affichage des `sbit' TrueType -- www.freetype.org"
+
+#: test/ftsbit.c:95
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+msgstr ""
+"Utilisation : %s ppm nompolice[.ttf|.ttc] numero_glyphe [numero_glyphe2...]\n"
+"\n"
+
+#: test/ftsbit.c:200
+msgid "Could not find embedded bitmaps in this font.\n"
+msgstr "Pas de bitmaps dans cette police.\n"
+
+#: test/ftsbit.c:206
+msgid "Error while loading embedded bitmaps.\n"
+msgstr "Erreur lors du chargement des bitmaps.\n"
+
+#: test/ftsbit.c:252
+#, c-format
+msgid " no bitmap for glyph %d.\n"
+msgstr " pas de bitmap pour le glyphe %d.\n"
+
+#: test/ftsbit.c:264
+#, c-format
+msgid "glyph index %d = %dx%d pixels, "
+msgstr "glyphe numero %d = %dx%d pixels, "
+
+#: test/ftsbit.c:267
+#, c-format
+msgid "advance = %ld, minBearing = [%ld,%ld]\n"
+msgstr "chasse = %ld, approches = [%ld,%ld]\n"
diff --git a/Build/source/libs/freetype/po/freetype.pot b/Build/source/libs/freetype/po/freetype.pot
new file mode 100644
index 00000000000..51758ba2cf8
--- /dev/null
+++ b/Build/source/libs/freetype/po/freetype.pot
@@ -0,0 +1,842 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2002-11-08 18:11+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/extend/ftxerr18.c:40
+msgid ""
+"Welcome to the translation of the Freetype v.1 library!\n"
+"\n"
+"This message is not really part of the library (it is bracketed by\n"
+" #if 0 / #endif), but is really intended to be the first one in the .po\n"
+"file, and the first one that a new translator should see, to give hints.\n"
+"\n"
+"First, while this .po might seems big, the real interesting part of it\n"
+"is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+"messages are part of the demonstration programs, and are more intended\n"
+"to help grasping how to use i18n with the Freetype library. So the real\n"
+"work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+"\n"
+"A difficulty is that there are some specialized vocabulary, about\n"
+"``faces'', ``glyph'' and similar things. These are typographical things,\n"
+"and this should be researched before attempting to translate the whole\n"
+"thing. A quick look across the TrueType documentation might help to\n"
+"understand many things, too.\n"
+"\n"
+"Best wiches for your translation!\n"
+"Antoine Leca - 2002-11-08"
+msgstr ""
+
+#: lib/extend/ftxerr18.c:77
+msgid "Successful function call, no error."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:80
+msgid "Invalid face handle."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:82
+msgid "Invalid instance handle."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:84
+msgid "Invalid glyph handle."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:86
+msgid "Invalid charmap handle."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:88
+msgid "Invalid result address."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:90
+msgid "Invalid glyph index."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:92
+msgid "Invalid argument."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:94
+msgid "Could not open file."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:96
+msgid "File is not a TrueType collection."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:98
+msgid "Mandatory table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:100
+msgid "Invalid horizontal metrics (hmtx table broken)."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:102
+msgid "Invalid charmap format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:104
+msgid "Invalid ppem value."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:106
+msgid "Invalid vertical metrics (vmtx table broken)."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:109
+msgid "Invalid file format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:112
+msgid "Invalid engine."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:114
+msgid "Too many extensions."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:116
+msgid "Extensions unsupported."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:118
+msgid "Invalid extension id."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:121
+msgid "No vertical data in font."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:124
+msgid "Maximum Profile (maxp) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:126
+msgid "Font Header (head) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:128
+msgid "Horizontal Header (hhea) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:130
+msgid "Index to Location (loca) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:132
+msgid "Naming (name) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:134
+msgid "Character to Glyph Index Mapping (cmap) tables missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:136
+msgid "Horizontal Metrics (hmtx) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:138
+msgid "OS/2 table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:140
+msgid "PostScript (post) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:142
+msgid "Glyph (glyf) table missing."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:147
+msgid "Out of memory."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:152
+msgid "Invalid file offset."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:154
+msgid "Invalid file read."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:156
+msgid "Invalid frame access."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:161
+msgid "Too many points."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:163
+msgid "Too many contours."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:165
+msgid "Invalid composite glyph."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:167
+msgid "Too many instructions."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:169
+msgid "Too many function definitions (FDEF)."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:174
+msgid "Invalid opcode."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:176
+msgid "Too few arguments."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:178
+msgid "Stack overflow."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:180
+msgid "Code overflow."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:182
+msgid "Bad argument."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:184
+msgid "Divide by zero."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:186
+msgid "Storage overflow."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:188
+msgid "Control Value (cvt) table overflow."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:190
+msgid "Invalid reference."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:192
+msgid "Invalid distance."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:194
+msgid "Interpolate twilight points."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:196
+msgid "`DEBUG' opcode found."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:198
+msgid "`ENDF' in byte-code stream."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:200
+msgid "Out of code ranges."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:202
+msgid "Nested function definitions."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:204
+msgid "Invalid code range."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:206
+msgid "Invalid displacement."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:208
+msgid "Endless loop encountered while executing instructions."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:213
+msgid "Nested frame access."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:215
+msgid "Invalid cache list."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:217
+msgid "Could not find context."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:219
+msgid "Unlisted object."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:224
+msgid "Raster pool overflow."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:226
+msgid "Raster: negative height encountered."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:228
+msgid "Raster: invalid value."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:230
+msgid "Raster not initialized."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:235
+msgid "Invalid kerning (kern) table format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:237
+msgid "Invalid kerning (kern) table."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:240
+msgid "Invalid PostScript (post) table format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:242
+msgid "Invalid PostScript (post) table."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:247
+msgid "Invalid TrueType Open subtable format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:249
+msgid "Invalid TrueType Open subtable."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:251
+msgid "Glyph(s) not covered by lookup."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:253
+msgid "Too many nested context substitutions."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:255
+msgid "No MM (Adobe MultipleMaster) interpreter available."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:258
+msgid "Invalid glyph substitution (GSUB) table format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:260
+msgid "Invalid glyph substitution (GSUB) table."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:263
+msgid "Invalid glyph positioning (GPOS) table format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:265
+msgid "Invalid glyph positioning (GPOS) table."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:268
+msgid "Invalid glyph definition (GDEF) table format."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:270
+msgid "Invalid glyph definition (GDEF) table."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:277
+msgid "Invalid Error Number."
+msgstr ""
+
+#: test/fterror.c:49
+msgid ""
+"fterror: test TT_ErrToString18 functionality\n"
+"\n"
+msgstr ""
+
+#: test/fterror.c:50
+msgid ""
+" with an optional numerical argument, dumps the associated message.\n"
+"\n"
+msgstr ""
+
+#: test/fterror.c:73
+msgid "Start of fterror.\n"
+msgstr ""
+
+#: test/fterror.c:81
+msgid "End of fterror.\n"
+msgstr ""
+
+#: test/fterror.c:96
+#, c-format
+msgid "Freetype error code 0x%04lX (%lu): %s\n"
+msgstr ""
+
+#: test/ftdump.c:169 test/ftlint.c:207 test/ftmetric.c:294
+msgid "Could not create glyph container.\n"
+msgstr ""
+
+#: test/ftdump.c:179 test/ftlint.c:215 test/ftmetric.c:303 test/ftsbit.c:214
+msgid "Could not create instance.\n"
+msgstr ""
+
+#: test/ftdump.c:188
+msgid "Could not create second instance.\n"
+msgstr ""
+
+#: test/ftdump.c:194
+msgid "Memory footprint statistics:\n"
+msgstr ""
+
+#: test/ftdump.c:202
+msgid "face object"
+msgstr ""
+
+#: test/ftdump.c:203
+msgid "glyph object"
+msgstr ""
+
+#: test/ftdump.c:204
+msgid "instance object"
+msgstr ""
+
+#: test/ftdump.c:208
+msgid "exec. context object"
+msgstr ""
+
+#: test/ftdump.c:215
+msgid "total memory usage"
+msgstr ""
+
+#: test/ftdump.c:223 test/ftdump.c:579 test/ftdump.c:789 test/ftdump.c:993
+#: test/ftdump.c:1139 test/ftlint.c:274 test/ftlint.c:287 test/ftmetric.c:390
+#: test/ftsbit.c:286
+#, c-format
+msgid "FreeType error message: %s\n"
+msgstr ""
+
+#: test/ftdump.c:300
+msgid "font name table entries\n"
+msgstr ""
+
+#: test/ftdump.c:310
+#, c-format
+msgid ""
+"PostScript name: %s\n"
+"\n"
+msgstr ""
+
+#: test/ftdump.c:333
+msgid "character map encodings\n"
+msgstr ""
+
+#: test/ftdump.c:340 test/ftdump.c:488
+msgid "The file doesn't seem to have any encoding table.\n"
+msgstr ""
+
+#: test/ftdump.c:344 test/ftdump.c:492
+#, c-format
+msgid ""
+"There are %hu encodings:\n"
+"\n"
+msgstr ""
+
+#: test/ftdump.c:349
+#, c-format
+msgid "encoding %2u: "
+msgstr ""
+
+#: test/ftdump.c:376 test/ftdump.c:385 test/ftdump.c:452
+#, c-format
+msgid "Unknown value %hu"
+msgstr ""
+
+#: test/ftdump.c:459
+msgid "Unknown"
+msgstr ""
+
+#: test/ftdump.c:481
+msgid "ftxcmap test\n"
+msgstr ""
+
+#: test/ftdump.c:498
+#, c-format
+msgid "encoding %2u:\n"
+msgstr ""
+
+#: test/ftdump.c:503
+#, c-format
+msgid "first: glyph index %hu, character code 0x%lx\n"
+msgstr ""
+
+#: test/ftdump.c:507
+#, c-format
+msgid "next: glyph index %hu, character code 0x%lx\n"
+msgstr ""
+
+#: test/ftdump.c:511
+#, c-format
+msgid "last: glyph index %hu, character code 0x%lx\n"
+msgstr ""
+
+#: test/ftdump.c:533 test/ftmetric.c:284
+msgid "Error while retrieving embedded bitmaps table.\n"
+msgstr ""
+
+#: test/ftdump.c:537
+msgid "embedded bitmap table\n"
+msgstr ""
+
+#: test/ftdump.c:540
+#, c-format
+msgid " version of embedded bitmap table: 0x%lx\n"
+msgstr ""
+
+#: test/ftdump.c:542
+#, c-format
+msgid " number of embedded bitmap strikes: %lu\n"
+msgstr ""
+
+#: test/ftdump.c:552
+#, c-format
+msgid " bitmap strike %hu/%lu: "
+msgstr ""
+
+#: test/ftdump.c:555
+#, c-format
+msgid "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n"
+msgstr ""
+
+#: test/ftdump.c:564
+#, c-format
+msgid " range format (%hu:%hu) glyphs %hu..%hu\n"
+msgstr ""
+
+#: test/ftdump.c:615
+msgid "Error while loading GSUB table.\n"
+msgstr ""
+
+#: test/ftdump.c:619
+msgid "GSUB table\n"
+msgstr ""
+
+#: test/ftdump.c:626
+msgid "Error while querying GSUB script list.\n"
+msgstr ""
+
+#: test/ftdump.c:639
+#, c-format
+msgid "Error while selecting GSUB script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:644 test/ftdump.c:848
+#, c-format
+msgid " script `%4.4s' (index %hu):\n"
+msgstr ""
+
+#: test/ftdump.c:652
+#, c-format
+msgid "Error while querying GSUB default language system for script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:657 test/ftdump.c:861
+msgid " default language system:\n"
+msgstr ""
+
+#: test/ftdump.c:670
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:676 test/ftdump.c:757 test/ftdump.c:880 test/ftdump.c:961
+#, c-format
+msgid " feature `%4.4s' (index %hu; lookup "
+msgstr ""
+
+#: test/ftdump.c:692
+#, c-format
+msgid "Error while querying GSUB language list for script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:709
+#, c-format
+msgid "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:714 test/ftdump.c:918
+#, c-format
+msgid " language `%4.4s' (index %hu):\n"
+msgstr ""
+
+#: test/ftdump.c:719 test/ftdump.c:923
+#, c-format
+msgid " required feature index %hu (lookup "
+msgstr ""
+
+#: test/ftdump.c:734
+#, c-format
+msgid ""
+"Error while querying GSUB feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:751
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:776 test/ftdump.c:980
+msgid ""
+"Lookups:\n"
+"\n"
+msgstr ""
+
+#: test/ftdump.c:779 test/ftdump.c:983
+#, c-format
+msgid " %hu: type %hu, flag 0x%x\n"
+msgstr ""
+
+#: test/ftdump.c:819
+msgid "Error while loading GPOS table.\n"
+msgstr ""
+
+#: test/ftdump.c:823
+msgid "GPOS table\n"
+msgstr ""
+
+#: test/ftdump.c:830
+msgid "Error while querying GPOS script list.\n"
+msgstr ""
+
+#: test/ftdump.c:843
+#, c-format
+msgid "Error while selecting GPOS script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:856
+#, c-format
+msgid "Error while querying GPOS default language system for script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:874
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:896
+#, c-format
+msgid "Error while querying GPOS language list for script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:913
+#, c-format
+msgid "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:938
+#, c-format
+msgid ""
+"Error while querying GPOS feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:955
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+
+#: test/ftdump.c:1018
+msgid "ftdump: Simple TrueType Dumper -- part of the FreeType project"
+msgstr ""
+
+#: test/ftdump.c:1022
+#, c-format
+msgid ""
+"Usage: %s fontname[.ttf|.ttc]\n"
+"\n"
+msgstr ""
+
+#: test/ftdump.c:1054 test/ftlint.c:134 test/ftmetric.c:228 test/ftsbit.c:127
+msgid "Error while initializing engine.\n"
+msgstr ""
+
+#: test/ftdump.c:1061 test/ftmetric.c:236 test/ftsbit.c:134
+msgid "Error while initializing embedded bitmap extension.\n"
+msgstr ""
+
+#: test/ftdump.c:1068
+msgid "Error while initializing GSUB extension.\n"
+msgstr ""
+
+#: test/ftdump.c:1075
+msgid "Error while initializing GPOS extension.\n"
+msgstr ""
+
+#: test/ftdump.c:1091 test/ftlint.c:187 test/ftmetric.c:251 test/ftsbit.c:182
+#, c-format
+msgid "Could not find or open %s.\n"
+msgstr ""
+
+#: test/ftdump.c:1094 test/ftlint.c:193 test/ftmetric.c:254 test/ftsbit.c:188
+#, c-format
+msgid "Error while opening %s.\n"
+msgstr ""
+
+#: test/ftlint.c:94
+msgid ""
+"ftlint: Simple TrueType instruction tester -- part of the FreeType project"
+msgstr ""
+
+#: test/ftlint.c:99
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
+"\n"
+msgstr ""
+
+#: test/ftlint.c:226 test/ftsbit.c:225
+#, c-format
+msgid "Could not set point size to %d.\n"
+msgstr ""
+
+#: test/ftlint.c:239
+msgid ""
+"Error with\n"
+" "
+msgstr ""
+
+#: test/ftlint.c:240
+#, c-format
+msgid "glyph %4u: %s\n"
+msgstr ""
+
+#: test/ftlint.c:253
+msgid "1 fail.\n"
+msgstr ""
+
+#: test/ftlint.c:255
+#, c-format
+msgid "%d fails.\n"
+msgstr ""
+
+#: test/ftmetric.c:70
+msgid ""
+"ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project"
+msgstr ""
+
+#: test/ftmetric.c:74
+#, c-format
+msgid ""
+"Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+"\n"
+" -B show sbit's metrics (default: none)\n"
+" -c C use C'th font index of TrueType collection (default: 0)\n"
+" -i index glyph index (default: 0)\n"
+" -r R use resolution R dpi (default: 72)\n"
+"\n"
+msgstr ""
+
+#: test/ftmetric.c:261
+#, c-format
+msgid "There are %d fonts in this collection.\n"
+msgstr ""
+
+#: test/ftmetric.c:266
+#, c-format
+msgid "There is no collection with index %d in this font file.\n"
+msgstr ""
+
+#: test/ftmetric.c:280
+msgid "There is no embedded bitmap data in the font.\n"
+msgstr ""
+
+#: test/ftmetric.c:310
+msgid "Could not set device resolutions.\n"
+msgstr ""
+
+#: test/ftmetric.c:317
+msgid "Could not reset instance.\n"
+msgstr ""
+
+#: test/ftmetric.c:323
+#, c-format
+msgid "Instance metrics: ppemX %d, ppemY %d\n"
+msgstr ""
+
+#: test/ftmetric.c:333 test/ftsbit.c:234
+msgid "Could not allocate glyph bitmap container.\n"
+msgstr ""
+
+#: test/ftmetric.c:341 test/ftsbit.c:258
+#, c-format
+msgid "Can't load bitmap for glyph %d.\n"
+msgstr ""
+
+#: test/ftmetric.c:368
+msgid "Outline's metrics"
+msgstr ""
+
+#: test/ftmetric.c:370
+msgid "Outline glyph\n"
+msgstr ""
+
+#: test/ftsbit.c:90
+msgid "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project"
+msgstr ""
+
+#: test/ftsbit.c:95
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+msgstr ""
+
+#: test/ftsbit.c:200
+msgid "Could not find embedded bitmaps in this font.\n"
+msgstr ""
+
+#: test/ftsbit.c:206
+msgid "Error while loading embedded bitmaps.\n"
+msgstr ""
+
+#: test/ftsbit.c:252
+#, c-format
+msgid " no bitmap for glyph %d.\n"
+msgstr ""
+
+#: test/ftsbit.c:264
+#, c-format
+msgid "glyph index %d = %dx%d pixels, "
+msgstr ""
+
+#: test/ftsbit.c:267
+#, c-format
+msgid "advance = %ld, minBearing = [%ld,%ld]\n"
+msgstr ""
diff --git a/Build/source/libs/freetype/po/nl.po b/Build/source/libs/freetype/po/nl.po
new file mode 100644
index 00000000000..56314f498c1
--- /dev/null
+++ b/Build/source/libs/freetype/po/nl.po
@@ -0,0 +1,883 @@
+# Dutch messages for FreeType.
+# Copyright (C) 1998-2000 Gertjan de Back
+# Gertjan de Back <gertjan.de.back@planet.nl>, 1999.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FreeType 1.5\n"
+"POT-Creation-Date: 2002-11-08 18:11+0000\n"
+"PO-Revision-Date: 2000-01-05\n"
+"Last-Translator: Gertjan de Back <gertjan.de.back@planet.nl>\n"
+"Language-Team: Dutch\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/extend/ftxerr18.c:40
+msgid ""
+"Welcome to the translation of the Freetype v.1 library!\n"
+"\n"
+"This message is not really part of the library (it is bracketed by\n"
+" #if 0 / #endif), but is really intended to be the first one in the .po\n"
+"file, and the first one that a new translator should see, to give hints.\n"
+"\n"
+"First, while this .po might seems big, the real interesting part of it\n"
+"is only the messages in this file, lib/extend/ftxerr18.c. The other\n"
+"messages are part of the demonstration programs, and are more intended\n"
+"to help grasping how to use i18n with the Freetype library. So the real\n"
+"work is the about 65 first ones. Unfortunately they are the harder ones!\n"
+"\n"
+"A difficulty is that there are some specialized vocabulary, about\n"
+"``faces'', ``glyph'' and similar things. These are typographical things,\n"
+"and this should be researched before attempting to translate the whole\n"
+"thing. A quick look across the TrueType documentation might help to\n"
+"understand many things, too.\n"
+"\n"
+"Best wiches for your translation!\n"
+"Antoine Leca - 2002-11-08"
+msgstr ""
+
+#: lib/extend/ftxerr18.c:77
+msgid "Successful function call, no error."
+msgstr "Functieaanroep succesvol."
+
+#: lib/extend/ftxerr18.c:80
+msgid "Invalid face handle."
+msgstr "Ongeldige Face handle."
+
+#: lib/extend/ftxerr18.c:82
+msgid "Invalid instance handle."
+msgstr "Ongeldige Instance handle."
+
+#: lib/extend/ftxerr18.c:84
+msgid "Invalid glyph handle."
+msgstr "Ongeldige Glyph handle."
+
+#: lib/extend/ftxerr18.c:86
+msgid "Invalid charmap handle."
+msgstr "Ongeldige Charmap handle."
+
+#: lib/extend/ftxerr18.c:88
+msgid "Invalid result address."
+msgstr "Ongeldig resultaat adres."
+
+#: lib/extend/ftxerr18.c:90
+msgid "Invalid glyph index."
+msgstr "Ongeldige Glyph index."
+
+#: lib/extend/ftxerr18.c:92
+msgid "Invalid argument."
+msgstr "Ongeldig argument."
+
+#: lib/extend/ftxerr18.c:94
+msgid "Could not open file."
+msgstr "Bestand kon niet geopend worden."
+
+#: lib/extend/ftxerr18.c:96
+msgid "File is not a TrueType collection."
+msgstr "Bestand is geen TrueType collectie."
+
+#: lib/extend/ftxerr18.c:98
+msgid "Mandatory table missing."
+msgstr "Vereiste tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:100
+msgid "Invalid horizontal metrics (hmtx table broken)."
+msgstr "Ongeldige horizontale metriek (hmtx tabel defect)."
+
+#: lib/extend/ftxerr18.c:102
+msgid "Invalid charmap format."
+msgstr "Ongeldige Charmap opmaak."
+
+#: lib/extend/ftxerr18.c:104
+msgid "Invalid ppem value."
+msgstr "Ongeldige ppem waarde."
+
+#: lib/extend/ftxerr18.c:106
+msgid "Invalid vertical metrics (vmtx table broken)."
+msgstr "Ongeldige vertikale metriek (vmtx tabel defect)."
+
+#: lib/extend/ftxerr18.c:109
+msgid "Invalid file format."
+msgstr "Ongeldige bestandsopmaak."
+
+#: lib/extend/ftxerr18.c:112
+msgid "Invalid engine."
+msgstr "Ongeldige engine."
+
+#: lib/extend/ftxerr18.c:114
+msgid "Too many extensions."
+msgstr "Te veel uitbreidingen."
+
+#: lib/extend/ftxerr18.c:116
+msgid "Extensions unsupported."
+msgstr "Uitbreidingen niet ondersteund."
+
+#: lib/extend/ftxerr18.c:118
+msgid "Invalid extension id."
+msgstr "Ongeldige uitbreiding id."
+
+#: lib/extend/ftxerr18.c:121
+msgid "No vertical data in font."
+msgstr "Geen vertikale informatie in lettertype."
+
+#: lib/extend/ftxerr18.c:124
+msgid "Maximum Profile (maxp) table missing."
+msgstr "`Maximum Profile (maxp)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:126
+msgid "Font Header (head) table missing."
+msgstr "`Font Header (head)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:128
+msgid "Horizontal Header (hhea) table missing."
+msgstr "`Horizontal Header (hhea)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:130
+msgid "Index to Location (loca) table missing."
+msgstr "`Index to Location (loca)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:132
+msgid "Naming (name) table missing."
+msgstr "`Naming (name)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:134
+msgid "Character to Glyph Index Mapping (cmap) tables missing."
+msgstr "`Character to Glyph Index Mapping (cmap)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:136
+msgid "Horizontal Metrics (hmtx) table missing."
+msgstr "`Horizontal Metrics (hmtx)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:138
+msgid "OS/2 table missing."
+msgstr "OS/2 tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:140
+msgid "PostScript (post) table missing."
+msgstr "`PostScript (post)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:142
+msgid "Glyph (glyf) table missing."
+msgstr "`Naming (glyf)' tabel ontbreekt."
+
+#: lib/extend/ftxerr18.c:147
+msgid "Out of memory."
+msgstr "Onvoldoende geheugen."
+
+#: lib/extend/ftxerr18.c:152
+msgid "Invalid file offset."
+msgstr "Bestand positie ongeldig."
+
+#: lib/extend/ftxerr18.c:154
+msgid "Invalid file read."
+msgstr "Lezen van bestand ongeldig."
+
+#: lib/extend/ftxerr18.c:156
+msgid "Invalid frame access."
+msgstr "Toegang tot frame ongeldig."
+
+#: lib/extend/ftxerr18.c:161
+msgid "Too many points."
+msgstr "Te veel punten."
+
+#: lib/extend/ftxerr18.c:163
+msgid "Too many contours."
+msgstr "Te veel contouren."
+
+#: lib/extend/ftxerr18.c:165
+msgid "Invalid composite glyph."
+msgstr "Samengestelde Glyph ongeldig."
+
+#: lib/extend/ftxerr18.c:167
+msgid "Too many instructions."
+msgstr "Te veel instructies."
+
+#: lib/extend/ftxerr18.c:169
+#, fuzzy
+msgid "Too many function definitions (FDEF)."
+msgstr "Functiedefinities genest."
+
+#: lib/extend/ftxerr18.c:174
+msgid "Invalid opcode."
+msgstr "Ongeldige opcode."
+
+#: lib/extend/ftxerr18.c:176
+msgid "Too few arguments."
+msgstr "Te weinig argumenten."
+
+#: lib/extend/ftxerr18.c:178
+msgid "Stack overflow."
+msgstr "Stack overloop."
+
+#: lib/extend/ftxerr18.c:180
+msgid "Code overflow."
+msgstr "Code overloop."
+
+#: lib/extend/ftxerr18.c:182
+msgid "Bad argument."
+msgstr "Foutief argument."
+
+#: lib/extend/ftxerr18.c:184
+msgid "Divide by zero."
+msgstr "Deling door nul."
+
+#: lib/extend/ftxerr18.c:186
+msgid "Storage overflow."
+msgstr "Opslag overloop."
+
+#: lib/extend/ftxerr18.c:188
+msgid "Control Value (cvt) table overflow."
+msgstr "`Control Value (cvt)' tabel overloop."
+
+#: lib/extend/ftxerr18.c:190
+msgid "Invalid reference."
+msgstr "Ongeldige referentie."
+
+#: lib/extend/ftxerr18.c:192
+msgid "Invalid distance."
+msgstr "Ongeldige afstand."
+
+#: lib/extend/ftxerr18.c:194
+msgid "Interpolate twilight points."
+msgstr "Interpolatie van schemer (twilight) punten."
+
+#: lib/extend/ftxerr18.c:196
+msgid "`DEBUG' opcode found."
+msgstr "`DEBUG'-opcode gevonden."
+
+#: lib/extend/ftxerr18.c:198
+msgid "`ENDF' in byte-code stream."
+msgstr "`ENDF' in bytecode-stroom."
+
+#: lib/extend/ftxerr18.c:200
+msgid "Out of code ranges."
+msgstr "Onvoldoende codegebieden."
+
+#: lib/extend/ftxerr18.c:202
+msgid "Nested function definitions."
+msgstr "Functiedefinities genest."
+
+#: lib/extend/ftxerr18.c:204
+msgid "Invalid code range."
+msgstr "Ongeldig codegebied."
+
+#: lib/extend/ftxerr18.c:206
+msgid "Invalid displacement."
+msgstr "Ongeldige verplaatsing."
+
+#: lib/extend/ftxerr18.c:208
+msgid "Endless loop encountered while executing instructions."
+msgstr "Oneindige loop aangetrofffen tijdens het uitvoeren van instructies."
+
+#: lib/extend/ftxerr18.c:213
+msgid "Nested frame access."
+msgstr "Frame toegang genest."
+
+#: lib/extend/ftxerr18.c:215
+msgid "Invalid cache list."
+msgstr "Ongeldige cachelijst."
+
+#: lib/extend/ftxerr18.c:217
+msgid "Could not find context."
+msgstr "Context niet gevonden."
+
+#: lib/extend/ftxerr18.c:219
+msgid "Unlisted object."
+msgstr "Object niet aanwezig."
+
+#: lib/extend/ftxerr18.c:224
+msgid "Raster pool overflow."
+msgstr "Overloop van Raster pool."
+
+#: lib/extend/ftxerr18.c:226
+msgid "Raster: negative height encountered."
+msgstr "Raster: negatieve hoogte aangetroffen."
+
+#: lib/extend/ftxerr18.c:228
+msgid "Raster: invalid value."
+msgstr "Raster: ongeldige waarde."
+
+#: lib/extend/ftxerr18.c:230
+msgid "Raster not initialized."
+msgstr "Raster niet geinitialiseerd."
+
+#: lib/extend/ftxerr18.c:235
+msgid "Invalid kerning (kern) table format."
+msgstr "Ongeldige `Kerning (kern)' tabel opmaak."
+
+#: lib/extend/ftxerr18.c:237
+msgid "Invalid kerning (kern) table."
+msgstr "Ongeldige `Kerning (kern)' tabel."
+
+#: lib/extend/ftxerr18.c:240
+msgid "Invalid PostScript (post) table format."
+msgstr "Ongeldige `PostScript (post)' tabel opmaak."
+
+#: lib/extend/ftxerr18.c:242
+msgid "Invalid PostScript (post) table."
+msgstr "Ongeldige `PostScript (post)' tabel."
+
+#: lib/extend/ftxerr18.c:247
+msgid "Invalid TrueType Open subtable format."
+msgstr "Ongeldige opmaak van TrueType Open subtabel."
+
+#: lib/extend/ftxerr18.c:249
+msgid "Invalid TrueType Open subtable."
+msgstr "Ongeldige TrueType Open subtabel."
+
+#: lib/extend/ftxerr18.c:251
+msgid "Glyph(s) not covered by lookup."
+msgstr "Glyph(s) niet door opgenomen in Lookup."
+
+#: lib/extend/ftxerr18.c:253
+msgid "Too many nested context substitutions."
+msgstr "Te veel geneste context vervangingen."
+
+#: lib/extend/ftxerr18.c:255
+msgid "No MM (Adobe MultipleMaster) interpreter available."
+msgstr ""
+
+#: lib/extend/ftxerr18.c:258
+msgid "Invalid glyph substitution (GSUB) table format."
+msgstr "Ongeldige Glyph vervanging (GSUB) tabel opmaak."
+
+#: lib/extend/ftxerr18.c:260
+msgid "Invalid glyph substitution (GSUB) table."
+msgstr "Ongeldige Glyph vervanging (GSUB) tabel."
+
+#: lib/extend/ftxerr18.c:263
+msgid "Invalid glyph positioning (GPOS) table format."
+msgstr "Ongeldige Glyph plaatsing (GPOS) tabel opmaak."
+
+#: lib/extend/ftxerr18.c:265
+msgid "Invalid glyph positioning (GPOS) table."
+msgstr "Ongeldige Glyph plaatsing (GPOS) tabel."
+
+#: lib/extend/ftxerr18.c:268
+#, fuzzy
+msgid "Invalid glyph definition (GDEF) table format."
+msgstr "Ongeldige Glyph plaatsing (GPOS) tabel opmaak."
+
+#: lib/extend/ftxerr18.c:270
+#, fuzzy
+msgid "Invalid glyph definition (GDEF) table."
+msgstr "Ongeldige Glyph plaatsing (GPOS) tabel."
+
+#: lib/extend/ftxerr18.c:277
+msgid "Invalid Error Number."
+msgstr "Ongeldig foutnummer."
+
+#: test/fterror.c:49
+msgid ""
+"fterror: test TT_ErrToString18 functionality\n"
+"\n"
+msgstr ""
+
+#: test/fterror.c:50
+msgid ""
+" with an optional numerical argument, dumps the associated message.\n"
+"\n"
+msgstr ""
+
+#: test/fterror.c:73
+msgid "Start of fterror.\n"
+msgstr "Begin van fterror.\n"
+
+#: test/fterror.c:81
+msgid "End of fterror.\n"
+msgstr "Einde van fterror.\n"
+
+#: test/fterror.c:96
+#, fuzzy, c-format
+msgid "Freetype error code 0x%04lX (%lu): %s\n"
+msgstr "FreeType foutmelding: %s\n"
+
+#: test/ftdump.c:169 test/ftlint.c:207 test/ftmetric.c:294
+msgid "Could not create glyph container.\n"
+msgstr "Aanmaken Glyph container mislukt.\n"
+
+#: test/ftdump.c:179 test/ftlint.c:215 test/ftmetric.c:303 test/ftsbit.c:214
+msgid "Could not create instance.\n"
+msgstr "Aanmaken Instance mislukt.\n"
+
+#: test/ftdump.c:188
+msgid "Could not create second instance.\n"
+msgstr "Aanmaken tweede Instance mislukt.\n"
+
+#: test/ftdump.c:194
+msgid "Memory footprint statistics:\n"
+msgstr "Statistieken geheugengebruik:\n"
+
+#: test/ftdump.c:202
+msgid "face object"
+msgstr "Face object"
+
+#: test/ftdump.c:203
+msgid "glyph object"
+msgstr "Glyph object"
+
+#: test/ftdump.c:204
+msgid "instance object"
+msgstr "Instance object"
+
+#: test/ftdump.c:208
+msgid "exec. context object"
+msgstr "uitv. context object"
+
+#: test/ftdump.c:215
+msgid "total memory usage"
+msgstr "totaal geheugengebruik"
+
+#: test/ftdump.c:223 test/ftdump.c:579 test/ftdump.c:789 test/ftdump.c:993
+#: test/ftdump.c:1139 test/ftlint.c:274 test/ftlint.c:287 test/ftmetric.c:390
+#: test/ftsbit.c:286
+#, c-format
+msgid "FreeType error message: %s\n"
+msgstr "FreeType foutmelding: %s\n"
+
+#: test/ftdump.c:300
+msgid "font name table entries\n"
+msgstr "lettertypen in namentabel\n"
+
+#: test/ftdump.c:310
+#, c-format
+msgid ""
+"PostScript name: %s\n"
+"\n"
+msgstr ""
+"PostScript naam: %s\n"
+"\n"
+
+#: test/ftdump.c:333
+msgid "character map encodings\n"
+msgstr "tekencodering tabellen\n"
+
+#: test/ftdump.c:340 test/ftdump.c:488
+msgid "The file doesn't seem to have any encoding table.\n"
+msgstr "Het bestand schijnt geen codering tabellen te bevatten.\n"
+
+#: test/ftdump.c:344 test/ftdump.c:492
+#, c-format
+msgid ""
+"There are %hu encodings:\n"
+"\n"
+msgstr ""
+"Er zijn %hu coderingen:\n"
+"\n"
+
+#: test/ftdump.c:349
+#, c-format
+msgid "encoding %2u: "
+msgstr "codering %2u: "
+
+#: test/ftdump.c:376 test/ftdump.c:385 test/ftdump.c:452
+#, c-format
+msgid "Unknown value %hu"
+msgstr "Waarde %hu onbekend"
+
+#: test/ftdump.c:459
+msgid "Unknown"
+msgstr "Onbekend"
+
+#: test/ftdump.c:481
+msgid "ftxcmap test\n"
+msgstr "ftxcmap test\n"
+
+#: test/ftdump.c:498
+#, c-format
+msgid "encoding %2u:\n"
+msgstr "codering %2u:\n"
+
+#: test/ftdump.c:503
+#, c-format
+msgid "first: glyph index %hu, character code 0x%lx\n"
+msgstr "eerste: Glyph index %hu, karakter code 0x%lx\n"
+
+#: test/ftdump.c:507
+#, c-format
+msgid "next: glyph index %hu, character code 0x%lx\n"
+msgstr "volgende: Glyph index %hu, karakter code 0x%lx\n"
+
+#: test/ftdump.c:511
+#, c-format
+msgid "last: glyph index %hu, character code 0x%lx\n"
+msgstr "laatste: Glyph index %hu, karakter code 0x%lx\n"
+
+#: test/ftdump.c:533 test/ftmetric.c:284
+msgid "Error while retrieving embedded bitmaps table.\n"
+msgstr "Fout bij het ophalen van ingebedde bitmap tabel.\n"
+
+#: test/ftdump.c:537
+msgid "embedded bitmap table\n"
+msgstr "ingebedde bitmap tabel\n"
+
+#: test/ftdump.c:540
+#, c-format
+msgid " version of embedded bitmap table: 0x%lx\n"
+msgstr " versie van ingebedde bitmap tabel: 0x%lx\n"
+
+#: test/ftdump.c:542
+#, c-format
+msgid " number of embedded bitmap strikes: %lu\n"
+msgstr " aantal ingebedde bitmap treffers: %lu\n"
+
+#: test/ftdump.c:552
+#, c-format
+msgid " bitmap strike %hu/%lu: "
+msgstr " bitmap treffer %hu/%lu: "
+
+#: test/ftdump.c:555
+#, c-format
+msgid "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n"
+msgstr "%hux%hu pixels, %hu-bit diepte, Glyphs [%hu..%hu]\n"
+
+#: test/ftdump.c:564
+#, c-format
+msgid " range format (%hu:%hu) glyphs %hu..%hu\n"
+msgstr " bereik formaat (%hu:%hu) Glyphs %hu..%hu\n"
+
+#: test/ftdump.c:615
+msgid "Error while loading GSUB table.\n"
+msgstr "Fout bij het laden van GSUB tabel.\n"
+
+#: test/ftdump.c:619
+msgid "GSUB table\n"
+msgstr "GSUB tabel\n"
+
+#: test/ftdump.c:626
+msgid "Error while querying GSUB script list.\n"
+msgstr "Fout bij het opvragen van GSUB script lijst.\n"
+
+#: test/ftdump.c:639
+#, c-format
+msgid "Error while selecting GSUB script `%4.4s'.\n"
+msgstr "Fout bij het selecteren van GSUB script `%4.4s'.\n"
+
+#: test/ftdump.c:644 test/ftdump.c:848
+#, c-format
+msgid " script `%4.4s' (index %hu):\n"
+msgstr " script `%4.4s' (index %hu):\n"
+
+#: test/ftdump.c:652
+#, c-format
+msgid "Error while querying GSUB default language system for script `%4.4s'.\n"
+msgstr ""
+"Fout bij het opvragen van GSUB standaard taal systeem voor script `%4.4s'.\n"
+
+#: test/ftdump.c:657 test/ftdump.c:861
+msgid " default language system:\n"
+msgstr " standaard taal systeem:\n"
+
+#: test/ftdump.c:670
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Fout bij het selecteren van GSUB kenmerk `%4.4s'\n"
+"voor standaard taal systeem van script `%4.4s'.\n"
+
+#: test/ftdump.c:676 test/ftdump.c:757 test/ftdump.c:880 test/ftdump.c:961
+#, c-format
+msgid " feature `%4.4s' (index %hu; lookup "
+msgstr " kenmerk `%4.4s' (index %hu; lookup "
+
+#: test/ftdump.c:692
+#, c-format
+msgid "Error while querying GSUB language list for script `%4.4s'.\n"
+msgstr "Fout bij het opvragen van GSUB taal lijst voor script `%4.4s'.\n"
+
+#: test/ftdump.c:709
+#, c-format
+msgid "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n"
+msgstr "Fout bij het selecteren van GSUB taal `%4.4s' voor script `%4.4s'.\n"
+
+#: test/ftdump.c:714 test/ftdump.c:918
+#, c-format
+msgid " language `%4.4s' (index %hu):\n"
+msgstr " taal `%4.4s' (index %hu):\n"
+
+#: test/ftdump.c:719 test/ftdump.c:923
+#, c-format
+msgid " required feature index %hu (lookup "
+msgstr " benodigde kenmerk index %hu (lookup "
+
+#: test/ftdump.c:734
+#, c-format
+msgid ""
+"Error while querying GSUB feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fout bij het opvragen van GSUB kenmerken lijst\n"
+"voor script `%4.4s', taal `%4.4s'.\n"
+
+#: test/ftdump.c:751
+#, c-format
+msgid ""
+"Error while selecting GSUB feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fout bij het selecteren van GSUB kenmerk `%4.4s'\n"
+"voor script `%4.4s', taal `%4.4s'.\n"
+
+#: test/ftdump.c:776 test/ftdump.c:980
+msgid ""
+"Lookups:\n"
+"\n"
+msgstr ""
+"Lookups:\n"
+"\n"
+
+#: test/ftdump.c:779 test/ftdump.c:983
+#, c-format
+msgid " %hu: type %hu, flag 0x%x\n"
+msgstr " %hu: type %hu, vlag 0x%x\n"
+
+#: test/ftdump.c:819
+msgid "Error while loading GPOS table.\n"
+msgstr "Fout bij het laden van GPOS tabel.\n"
+
+#: test/ftdump.c:823
+msgid "GPOS table\n"
+msgstr "GPOS tabel\n"
+
+#: test/ftdump.c:830
+msgid "Error while querying GPOS script list.\n"
+msgstr "Fout bij het opvragen van GPOS script lijst.\n"
+
+#: test/ftdump.c:843
+#, c-format
+msgid "Error while selecting GPOS script `%4.4s'.\n"
+msgstr "Fout bij het selecteren van GPOS script `%4.4s'.\n"
+
+#: test/ftdump.c:856
+#, c-format
+msgid "Error while querying GPOS default language system for script `%4.4s'.\n"
+msgstr ""
+"Fout bij het opvragen van GPOS standaard taal systeem voor script `%4.4s'.\n"
+
+#: test/ftdump.c:874
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for default language system of script `%4.4s'.\n"
+msgstr ""
+"Fout bij het selecteren van GPOS kenmerk `%4.4s'\n"
+"voor standaard taal systeem van script `%4.4s'.\n"
+
+#: test/ftdump.c:896
+#, c-format
+msgid "Error while querying GPOS language list for script `%4.4s'.\n"
+msgstr "Fout bij het opvragen van GPOS taal lijst voor script `%4.4s'.\n"
+
+#: test/ftdump.c:913
+#, c-format
+msgid "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n"
+msgstr "Fout bij het selecteren van GPOS taal `%4.4s' voor script `%4.4s'.\n"
+
+#: test/ftdump.c:938
+#, c-format
+msgid ""
+"Error while querying GPOS feature list\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fout bij het opvragen van GPOS kenmerken lijst\n"
+"voor script `%4.4s', taal `%4.4s'.\n"
+
+#: test/ftdump.c:955
+#, c-format
+msgid ""
+"Error while selecting GPOS feature `%4.4s'\n"
+"for script `%4.4s', language `%4.4s'.\n"
+msgstr ""
+"Fout bij het selecteren van GPOS kenmerk `%4.4s'\n"
+"voor script `%4.4s', taal `%4.4s'.\n"
+
+#: test/ftdump.c:1018
+msgid "ftdump: Simple TrueType Dumper -- part of the FreeType project"
+msgstr ""
+"ftdump: eenvoudige TrueType dumper -- onderdeel van het FreeType project"
+
+#: test/ftdump.c:1022
+#, c-format
+msgid ""
+"Usage: %s fontname[.ttf|.ttc]\n"
+"\n"
+msgstr ""
+"Gebruik: %s lettertype[.ttf|.ttc]\n"
+"\n"
+
+#: test/ftdump.c:1054 test/ftlint.c:134 test/ftmetric.c:228 test/ftsbit.c:127
+msgid "Error while initializing engine.\n"
+msgstr "Fout bij het starten van de FreeType engine.\n"
+
+#: test/ftdump.c:1061 test/ftmetric.c:236 test/ftsbit.c:134
+msgid "Error while initializing embedded bitmap extension.\n"
+msgstr "Fout bij het starten de ingebedde bitmap toevoeging.\n"
+
+#: test/ftdump.c:1068
+msgid "Error while initializing GSUB extension.\n"
+msgstr "Fout bij het starten van de GSUB toevoeging.\n"
+
+#: test/ftdump.c:1075
+msgid "Error while initializing GPOS extension.\n"
+msgstr "Fout bij het starten van de GPOS toevoeging.\n"
+
+#: test/ftdump.c:1091 test/ftlint.c:187 test/ftmetric.c:251 test/ftsbit.c:182
+#, c-format
+msgid "Could not find or open %s.\n"
+msgstr "Kan %s niet vinden of openen.\n"
+
+#: test/ftdump.c:1094 test/ftlint.c:193 test/ftmetric.c:254 test/ftsbit.c:188
+#, c-format
+msgid "Error while opening %s.\n"
+msgstr "Fout bij het openen van %s.\n"
+
+#: test/ftlint.c:94
+msgid ""
+"ftlint: Simple TrueType instruction tester -- part of the FreeType project"
+msgstr ""
+"ftlint: TrueType instructie tester -- onderdeel van het FreeType project"
+
+#: test/ftlint.c:99
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n"
+"\n"
+msgstr ""
+"Gebruik: %s ppem lettertype[.ttf|.ttc] [lettertype2..]\n"
+"\n"
+
+#: test/ftlint.c:226 test/ftsbit.c:225
+#, c-format
+msgid "Could not set point size to %d.\n"
+msgstr "Instellen van puntgrootte %d mislukt.\n"
+
+#: test/ftlint.c:239
+msgid ""
+"Error with\n"
+" "
+msgstr ""
+"Fout met\n"
+" "
+
+#: test/ftlint.c:240
+#, c-format
+msgid "glyph %4u: %s\n"
+msgstr "Glyph %4u: %s\n"
+
+#: test/ftlint.c:253
+msgid "1 fail.\n"
+msgstr "1 misser.\n"
+
+#: test/ftlint.c:255
+#, c-format
+msgid "%d fails.\n"
+msgstr "%d missers.\n"
+
+#: test/ftmetric.c:70
+msgid ""
+"ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project"
+msgstr ""
+"ftmetric: TTF metriek/Glyph dumper -- onderdeel van het FreeType project"
+
+#: test/ftmetric.c:74
+#, c-format
+msgid ""
+"Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+"\n"
+" -B show sbit's metrics (default: none)\n"
+" -c C use C'th font index of TrueType collection (default: 0)\n"
+" -i index glyph index (default: 0)\n"
+" -r R use resolution R dpi (default: 72)\n"
+"\n"
+msgstr ""
+"Gebruik: %s [opties hieronder] punt lettertype[.ttf|.ttc]\n"
+"\n"
+" -B toon sbit's metriek (standaard: geen)\n"
+" -c C gebruik 'C'e lettertype index van TrueType collectie (standaard: "
+"0)\n"
+" -i index Glyph index (standaard: 0)\n"
+" -r R gebruik resolutie van R dpi (standaard: 72)\n"
+"\n"
+
+#: test/ftmetric.c:261
+#, c-format
+msgid "There are %d fonts in this collection.\n"
+msgstr "Er zijn %d lettertypen in deze collectie.\n"
+
+#: test/ftmetric.c:266
+#, c-format
+msgid "There is no collection with index %d in this font file.\n"
+msgstr "Er is geen collectie met index %d in dit lettertype.\n"
+
+#: test/ftmetric.c:280
+msgid "There is no embedded bitmap data in the font.\n"
+msgstr "Er is geen ingebedde bitmap informatie in het lettertype.\n"
+
+#: test/ftmetric.c:310
+msgid "Could not set device resolutions.\n"
+msgstr "Instellen van resolutie is mislukt.\n"
+
+#: test/ftmetric.c:317
+msgid "Could not reset instance.\n"
+msgstr "Her-instellen van Instance mislukt.\n"
+
+#: test/ftmetric.c:323
+#, c-format
+msgid "Instance metrics: ppemX %d, ppemY %d\n"
+msgstr "Instance metriek: ppemX %d, ppemY %d\n"
+
+#: test/ftmetric.c:333 test/ftsbit.c:234
+msgid "Could not allocate glyph bitmap container.\n"
+msgstr "Toewijzen van Glyph bitmap container mislukt.\n"
+
+#: test/ftmetric.c:341 test/ftsbit.c:258
+#, c-format
+msgid "Can't load bitmap for glyph %d.\n"
+msgstr "Laden van bitmap voor Glyph %d mislukt.\n"
+
+#: test/ftmetric.c:368
+msgid "Outline's metrics"
+msgstr "Omtrek metriek"
+
+#: test/ftmetric.c:370
+msgid "Outline glyph\n"
+msgstr "Omtrek Glyph\n"
+
+#: test/ftsbit.c:90
+msgid "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project"
+msgstr "ftsbit: TrueType `sbit' dumper -- onderdeel van het FreeType project"
+
+#: test/ftsbit.c:95
+#, c-format
+msgid ""
+"Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+msgstr ""
+"Gebruik: %s ppem lettertype[.ttf|.ttc] glyph_index [glyph_index2..]\n"
+"\n"
+
+#: test/ftsbit.c:200
+msgid "Could not find embedded bitmaps in this font.\n"
+msgstr "Ingebedde bitmaps niet gevonden in dit lettertype.\n"
+
+#: test/ftsbit.c:206
+msgid "Error while loading embedded bitmaps.\n"
+msgstr "Fout bij het laden van ingebedde bitmaps.\n"
+
+#: test/ftsbit.c:252
+#, c-format
+msgid " no bitmap for glyph %d.\n"
+msgstr " geen bitmap voor Glyph %d.\n"
+
+#: test/ftsbit.c:264
+#, c-format
+msgid "glyph index %d = %dx%d pixels, "
+msgstr "Glyph index %d = %dx%d pixels, "
+
+#: test/ftsbit.c:267
+#, c-format
+msgid "advance = %ld, minBearing = [%ld,%ld]\n"
+msgstr "advance = %ld, minBearing = [%ld,%ld]\n"
diff --git a/Build/source/libs/freetype/readme.1st b/Build/source/libs/freetype/readme.1st
new file mode 100644
index 00000000000..ad87630be1c
--- /dev/null
+++ b/Build/source/libs/freetype/readme.1st
@@ -0,0 +1,10 @@
+
+ DISCLAIMER
+
+
+ PLEASE READ THE FILE `PATENTS' BEFORE ANYTHING ELSE! IT
+ CONTAINS *CRITICAL* INFORMATION REGARDING THE FREE USE OF THIS
+ LIBRARY.
+
+
+--- end of readme.1st ---
diff --git a/Build/source/libs/freetype/test/.cvsignore b/Build/source/libs/freetype/test/.cvsignore
new file mode 100644
index 00000000000..0f0d08671e4
--- /dev/null
+++ b/Build/source/libs/freetype/test/.cvsignore
@@ -0,0 +1,12 @@
+.libs
+ftview
+fttimer
+ftlint
+ftdump
+ftzoom
+ftstring
+ftstrpnm
+fterror
+ftsbit
+ftmetric
+ftstrtto
diff --git a/Build/source/libs/freetype/test/.cvsignore.delete b/Build/source/libs/freetype/test/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/test/.cvsignore.delete
diff --git a/Build/source/libs/freetype/test/README b/Build/source/libs/freetype/test/README
new file mode 100644
index 00000000000..364b1eb586a
--- /dev/null
+++ b/Build/source/libs/freetype/test/README
@@ -0,0 +1,6 @@
+
+The instructions how to use the test programs can be found in the
+main `README' file located in the parent directory.
+
+
+--- end of README ---
diff --git a/Build/source/libs/freetype/test/arabic.c b/Build/source/libs/freetype/test/arabic.c
new file mode 100644
index 00000000000..37715ff7447
--- /dev/null
+++ b/Build/source/libs/freetype/test/arabic.c
@@ -0,0 +1,386 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2000 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* arabic -- An implementation of the contextual algorithm given in the */
+/* Unicode 2.0 book to assign the `isolated', `initial', `medial', and */
+/* `final' properties to an input string of character codes for the Arabic */
+/* script. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "arabic.h"
+#include "freetype.h"
+#include "ftxopen.h"
+
+
+ /*
+
+ Here a table of the joining classes for characters in the range
+ U+0620 - U+06FF.
+
+ The following character also has a joining class:
+
+ U+200C ZERO WIDTH NON-JOINER -> causing
+
+ All other characters are given the joining class `none'.
+
+ */
+
+ joining_class arabic[] =
+ {
+ /* U+0620 */
+ none, none, right, right,
+ right, right, dual, right,
+ dual, right, dual, dual,
+ dual, dual, dual, right,
+
+ /* U+0630 */
+ right, right, right, dual,
+ dual, dual, dual, dual,
+ dual, dual, dual, none,
+ none, none, none, none,
+
+ /* U+0640 */
+ causing, dual, dual, dual,
+ dual, dual, dual, dual,
+ right, right, dual, transparent,
+ transparent, transparent, transparent, transparent,
+
+ /* U+0650 */
+ transparent, transparent, transparent, none,
+ none, none, none, none,
+ none, none, none, none,
+ none, none, none, none,
+
+ /* U+0660 */
+ none, none, none, none,
+ none, none, none, none,
+ none, none, none, none,
+ none, none, none, none,
+
+ /* U+0670 */
+ transparent, none, right, right,
+ none, right, right, right,
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+
+ /* U+0680 */
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+ right, right, right, right,
+ right, right, right, right,
+
+ /* U+0690 */
+ right, right, right, right,
+ right, right, right, right,
+ right, right, dual, dual,
+ dual, dual, dual, dual,
+
+ /* U+06A0 */
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+
+ /* U+06B0 */
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+ dual, dual, dual, dual,
+
+ /* U+06C0 */
+ right, dual, right, right,
+ right, right, right, right,
+ right, right, right, right,
+ dual, right, dual, right,
+
+ /* U+06D0 */
+ dual, dual, right, right,
+ none, none, none, transparent,
+ transparent, transparent, transparent, transparent,
+ transparent, transparent, transparent, transparent,
+
+ /* U+06E0 */
+ transparent, transparent, transparent, transparent,
+ transparent, none, none, transparent,
+ transparent, none, transparent, transparent,
+ transparent, transparent, none, none,
+
+ /* U+06F0 */
+ none, none, none, none,
+ none, none, none, none,
+ none, none, dual, dual,
+ dual, none, none, none
+ };
+
+
+ struct cgc_
+ {
+ TT_UShort char_code;
+ TT_UShort glyph_index;
+ TT_UShort class;
+ };
+
+ typedef struct cgc_ cgc;
+
+
+ int compare_cgc( const void* a,
+ const void* b )
+ {
+ return ( ((cgc*)a)->glyph_index > ((cgc*)b)->glyph_index ) ?
+ 1 : ( ( ((cgc*)a)->glyph_index == ((cgc*)b)->glyph_index ) ?
+ 0 : -1 );
+ }
+
+
+ TT_Error Build_Arabic_Glyph_Properties( TT_CharMap char_map,
+ TT_UShort max_glyphs,
+ TTO_GDEFHeader** gdef )
+ {
+ TT_UShort i, j, num_glyphs;
+
+ cgc Arabic[0x0700 - 0x0620];
+
+ TT_UShort glyph_indices[0x700 - 0x0620];
+ TT_UShort classes[0x700 - 0x0620];
+
+
+ if ( !gdef )
+ return TT_Err_Invalid_Argument;
+
+ j = 0;
+
+ for ( i = 0x0620; i < 0x0700; i++ )
+ {
+ Arabic[j].char_code = i;
+ Arabic[j].class = ( arabic[i - 0x0620] == transparent ) ?
+ MARK_GLYPH : SIMPLE_GLYPH;
+ Arabic[j].glyph_index = TT_Char_Index( char_map, i );
+ if ( Arabic[j].glyph_index )
+ j++;
+ }
+ num_glyphs = j;
+
+ if ( !num_glyphs )
+ {
+ /* no Arabic font */
+ *gdef = NULL;
+ return TT_Err_Ok;
+ }
+
+ /* sort it */
+
+ qsort( Arabic, num_glyphs, sizeof ( cgc ), compare_cgc );
+
+ /* write it to the arrays, removing duplicates */
+
+ glyph_indices[0] = Arabic[0].glyph_index;
+ classes[0] = Arabic[0].class;
+
+ j = 1;
+
+ for ( i = 1; i < num_glyphs; i++ )
+ {
+ glyph_indices[j] = Arabic[i].glyph_index;
+ classes[j] = Arabic[i].class;
+
+ if ( glyph_indices[j - 1] != glyph_indices[j] )
+ j++;
+ }
+ num_glyphs = j;
+
+ TT_GDEF_Build_ClassDefinition( *gdef, max_glyphs, num_glyphs,
+ glyph_indices, classes );
+
+ return TT_Err_Ok;
+ }
+
+
+ /* The joining rules as given in the Unicode 2.0 book (characters are
+ here specified as appearing in the byte stream, i.e. *not* in
+ visual order). Joining classes are given in angle brackets, glyph
+ forms in square brackets. Glyphs affected by a specific rule are
+ enclosed with vertical bars.
+
+ Note: The description of the joining algorithm in the book is
+ severely broken. You can get a corrected version from
+ www.unicode.org (as of 29-Jun-1999, this hasn't appeared).
+
+ R1: <anything1> <transparent> <anything2>
+
+ apply joining rules for
+ <anything1> <anything2> -> [shape1] [shape2]
+
+ -> [shape1] [isolated] [shape2]
+
+ R2: <causing|left|dual> |<right>|
+
+ -> [final]
+
+ R3: |<left>| <causing|right|dual>
+
+ -> [initial]
+
+ R4: <causing|left|dual> |<dual>| <causing|right|dual>
+
+ -> [medial]
+
+ R5: <causing|left|dual> |<dual>| <!(causing|right|dual)>
+
+ -> [final]
+
+ R6: <!(causing|left|dual)> |<dual>| <causing|right|dual>
+
+ -> [initial]
+
+ R7: If R1-R6 fail:
+
+ <anything> -> [isolated] */
+
+
+ /* `direction' can be -1, 0, or 1 to indicate the last non-transparent
+ glyph, the current glyph, and the next non-transparent glyph,
+ respectively. */
+
+ static joining_class Get_Joining_Class( TT_ULong* string,
+ TT_UShort pos,
+ TT_UShort length,
+ int direction )
+ {
+ joining_class j;
+
+
+ while ( 1 )
+ {
+ if ( pos == 0 && direction < 0 )
+ return none;
+
+ pos += direction;
+
+ if ( pos >= length )
+ return none;
+
+ if ( string[pos] < 0x0620 ||
+ string[pos] >= 0x0700 )
+ {
+ if ( string[pos] == 0x200C )
+ return causing;
+ else
+ return none;
+ }
+ else
+ j = arabic[string[pos] - 0x0620];
+
+ if ( !direction || j != transparent )
+ return j;
+ }
+ }
+
+
+ TT_Error Assign_Arabic_Properties( TT_ULong* string,
+ TT_UShort* properties,
+ TT_UShort length )
+ {
+ joining_class previous, current, next;
+
+ TT_UShort i;
+
+
+ if ( !string || !properties || length == 0 )
+ return TT_Err_Invalid_Argument;
+
+ for ( i = 0; i < length; i++ )
+ {
+ previous = Get_Joining_Class( string, i, length, -1 );
+ current = Get_Joining_Class( string, i, length, 0 );
+ next = Get_Joining_Class( string, i, length, 1 );
+
+ /* R1 */
+
+ if ( current == transparent )
+ {
+ properties[i] |= isolated_p;
+ continue;
+ }
+
+ /* R2 */
+
+ if ( previous == causing ||
+ previous == left ||
+ previous == dual )
+ if ( current == right )
+ {
+ properties[i] |= final_p;
+ continue;
+ }
+
+ /* R3 */
+
+ if ( current == left )
+ if ( next == causing ||
+ next == right ||
+ next == dual )
+ {
+ properties[i] |= initial_p;
+ continue;
+ }
+
+ /* R4 */
+
+ if ( previous == causing ||
+ previous == left ||
+ previous == dual )
+ if ( current == dual )
+ if ( next == causing ||
+ next == right ||
+ next == dual )
+ {
+ properties[i] |= medial_p;
+ continue;
+ }
+
+ /* R5 */
+
+ if ( previous == causing ||
+ previous == left ||
+ previous == dual )
+ if ( current == dual )
+ if ( !( next == causing ||
+ next == right ||
+ next == dual ) )
+ {
+ properties[i] |= final_p;
+ continue;
+ }
+
+ /* R6 */
+
+ if ( !( previous == causing ||
+ previous == left ||
+ previous == dual ) )
+ if ( current == dual )
+ if ( next == causing ||
+ next == right ||
+ next == dual )
+ {
+ properties[i] |= initial_p;
+ continue;
+ }
+
+ /* R7 */
+
+ properties[i] |= isolated_p;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arabic.h b/Build/source/libs/freetype/test/arabic.h
new file mode 100644
index 00000000000..af7f63279fd
--- /dev/null
+++ b/Build/source/libs/freetype/test/arabic.h
@@ -0,0 +1,66 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2000 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* arabic -- An implementation of the contextual algorithm given in the */
+/* Unicode 2.0 book to assign the `isolated', `initial', `medial', and */
+/* `final' properties to an input string of character codes for the Arabic */
+/* script. */
+/* */
+/****************************************************************************/
+
+
+#include "freetype.h"
+#include "ftxopen.h"
+
+
+ enum joining_type_
+ {
+ isolated = 1, /* nominal */
+ final = 2, /* right_joining */
+ initial = 4, /* left_joining */
+ medial = 8 /* double_joining */
+ };
+
+ typedef enum joining_type_ joining_type;
+
+
+ /* A glyph's property value as needed by e.g. TT_GSUB_Apply_String()
+ specifies which features should *not* be applied */
+
+ enum arabic_glyph_property_
+ {
+ isolated_p = final | initial | medial,
+ final_p = isolated | initial | medial,
+ initial_p = isolated | final | medial,
+ medial_p = isolated | final | initial
+ };
+
+ typedef enum arabic_glyph_property_ arabic_glyph_property;
+
+
+ enum joining_class_
+ {
+ right,
+ left, /* not used */
+ dual,
+ causing,
+ none,
+ transparent
+ };
+
+ typedef enum joining_class_ joining_class;
+
+
+ TT_Error Assign_Arabic_Properties( TT_ULong* string,
+ TT_UShort* properties,
+ TT_UShort length );
+ TT_Error Build_Arabic_Glyph_Properties( TT_CharMap char_map,
+ TT_UShort max_glyphs,
+ TTO_GDEFHeader** gdef );
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/amigaos/Makefile.gcc b/Build/source/libs/freetype/test/arch/amigaos/Makefile.gcc
new file mode 100644
index 00000000000..1cb828baa2d
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/amigaos/Makefile.gcc
@@ -0,0 +1,118 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for amiga using ADE.
+#
+# You will need GNU make.
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# make -f arch/amigaos/Makefile.gcc
+#
+#
+# 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.
+
+ARCH = arch/amigaos
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+CC = gcc
+
+LIBDIR = ../lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend
+
+CFLAGS = -ansi -Wall -g -noixemul $(INCDIRS)
+# CFLAGS = -Wall -noixemul -O2 -Ilib $(INCDIRS)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+GSRC = gmain.c display.c blitter.c $(ARCH)/gw_amiga.c
+GOBJ = $(GSRC:.c=.o)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.exe:
+ $(CC) $(CFLAGS) -o $@ @^
+
+
+EXEFILES = ftdump \
+ fterror \
+ ftlint \
+ ftmetric \
+ ftsbit \
+ ftstring \
+ ftstrpnm \
+ ftstrtto \
+ fttimer \
+ ftview \
+ ftzoom
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all
+
+freetype_debug:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug
+
+ftzoom: $(GOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview: $(GOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump: ftdump.o common.o $(LIBDIR)/libttf.a
+ftstring: $(GOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+fttimer: $(GOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftsbit: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrpnm: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+ftmetric: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto: $(GOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+fterror: fterror.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean
+
+distclean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
+ -rm dep.end core
+ -rm $(EXE)
+
+do_clean:
+ -rm *.o
+ -rm arch/amigaos/*.o
+
+
+depend:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
+ $(CC) -E -M $(INCDIRS) $(SRC) $(GSRC) > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/test/arch/amigaos/TODO b/Build/source/libs/freetype/test/arch/amigaos/TODO
new file mode 100644
index 00000000000..49e53a1b243
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/amigaos/TODO
@@ -0,0 +1,16 @@
+
+ * To test the window oriented driver.
+
+ * To improve the window oriented driver to use ROM functions like
+ WriteChunkyPixel() (or similar) instead of the current routine.
+
+ * To build a truetype.library from libttf.a
+
+ * truetype.datatype.
+
+ * Program to convert truetype fonts in Amiga fonts.
+
+ Suggestions, bug reports, code improvements, support for other compilers,
+ ... are welcome !
+
+ Send them to: map@medusa.es or to freetype@freetype.org
diff --git a/Build/source/libs/freetype/test/arch/amigaos/gfsamiga.c b/Build/source/libs/freetype/test/arch/amigaos/gfsamiga.c
new file mode 100644
index 00000000000..8a680a1774d
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/amigaos/gfsamiga.c
@@ -0,0 +1,428 @@
+/*******************************************************************
+ *
+ * gfsamiga.c graphics utility fullscreen Amiga driver. 1.0
+ *
+ * This is the driver for fullscreen Amiga display, used by the
+ * graphics utility of the FreeType test suite.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+/* standard includes */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* AmigaOS includes */
+
+#include <exec/types.h>
+#include <exec/memory.h>
+#include <intuition/intuition.h>
+#include <intuition/screens.h>
+
+#ifdef __GNUC__
+
+#include <inline/exec.h>
+#include <inline/intuition.h>
+#include <inline/graphics.h>
+#include <inline/dos.h>
+
+#else
+
+#include <clib/exec_protos.h>
+#include <clib/intuition_protos.h>
+#include <clib/graphics_protos.h>
+#include <clib/dos_protos.h>
+
+#endif
+
+/* FreeType includes */
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+/* some screen definitions */
+
+#define MONO_SCREEN_WIDTH 640
+#define MONO_SCREEN_HEIGHT 512
+#define MONO_SCREEN_DEPTH 1
+
+#define GRAY_SCREEN_WIDTH 320
+#define GRAY_SCREEN_HEIGHT 256
+#define GRAY_SCREEN_DEPTH 3
+
+#define DISPLAY_MEM ( 1024 * 64 )
+
+
+ /* external variables */
+
+ extern struct Library* SysBase;
+ extern struct Library* DOSBase;
+
+ extern int vio_ScanLineWidth;
+ extern char* Vio;
+ extern char gray_palette[5];
+
+ /* global variables */
+
+ struct Library* IntuitionBase = NULL;
+ struct Library* GfxBase = NULL;
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+
+ /* local variables */
+
+ static struct Screen* fts = NULL;
+ static struct Window* ftw = NULL;
+
+ static int graphx_mode;
+
+
+ /* exit gracefully */
+
+ static void AmigaCleanUp( void )
+ {
+ if ( ftw )
+ CloseWindow( ftw );
+
+ if ( fts )
+ CloseScreen( fts );
+
+ if ( IntuitionBase )
+ CloseLibrary( IntuitionBase );
+
+ if ( GfxBase )
+ CloseLibrary( GfxBase );
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ if ( Vio )
+ FreeMem( Vio, DISPLAY_MEM );
+ }
+
+
+ static void SetPalette( void )
+ {
+ short color[] = { 0x0000,
+ 0x0333,
+ 0x0777,
+ 0x0BBB,
+ 0x0FFF,
+ 0x0A00,
+ 0x00A0,
+ 0x000A
+ };
+ short i;
+
+
+ for ( i = 0; i < 8; i++ )
+ {
+ if ( i < 5 )
+ gray_palette[i] = i;
+
+ SetRGB4( &fts->ViewPort, i, (UBYTE)(color[i] >> 8 & 0x0f),
+ (UBYTE)(color[i] >> 4 & 0x0f),
+ (UBYTE)(color[i] & 0x0f ) );
+ }
+ }
+
+
+ /* open libraries & custom screen */
+
+ static int AmigaInit( void )
+ {
+ /* cleanup at exit */
+ if ( atexit( AmigaCleanUp ) )
+ {
+ PutStr( "atexit() failed\n" );
+ return -1;
+ }
+
+ /* open intuition library */
+
+ IntuitionBase = (struct Library*)OpenLibrary( "intuition.library", 37L );
+ if ( IntuitionBase == NULL )
+ {
+ PutStr( "Could not open intuition library\n" );
+ return -1;
+ }
+
+ /* Open graphics library */
+
+ GfxBase = OpenLibrary( "graphics.library", 37L );
+ if ( GfxBase == NULL )
+ {
+ PutStr( "Could not open graphics library\n" );
+ return -1;
+ }
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ /* open custom screen */
+ fts = (struct Screen*)OpenScreenTags(
+ NULL,
+ SA_DisplayID, (PAL_MONITOR_ID | LORES_KEY),
+ SA_Width, GRAY_SCREEN_WIDTH,
+ SA_Height, GRAY_SCREEN_HEIGHT,
+ SA_Depth, GRAY_SCREEN_DEPTH,
+ SA_ShowTitle, FALSE,
+ TAG_DONE );
+
+ if ( fts == NULL )
+ {
+ PutStr( "Could not open custom screen\n" );
+ return -1;
+ }
+
+ /* set gray palette */
+ SetPalette();
+ }
+ else
+ {
+ /* open custom screen */
+ fts = (struct Screen*)OpenScreenTags(
+ NULL,
+ SA_DisplayID, (PAL_MONITOR_ID | HIRESLACE_KEY),
+ SA_Width, MONO_SCREEN_WIDTH,
+ SA_Height, MONO_SCREEN_HEIGHT,
+ SA_Depth, MONO_SCREEN_DEPTH,
+ SA_ShowTitle, FALSE,
+ TAG_DONE );
+
+ if ( fts == NULL )
+ {
+ PutStr( "Could not open custom screen\n" );
+ return -1;
+ }
+ }
+
+ /* open intuition window */
+ ftw = OpenWindowTags(
+ NULL,
+ WA_Left, 0,
+ WA_Width, fts->Width,
+ WA_Top, 0,
+ WA_Height, fts->Height,
+ WA_IDCMP, IDCMP_VANILLAKEY | IDCMP_MOUSEBUTTONS,
+ WA_Flags, WFLG_BACKDROP | WFLG_BORDERLESS |
+ WFLG_RMBTRAP | WFLG_ACTIVATE,
+ WA_Gadgets, NULL,
+ WA_Title, NULL,
+ WA_CustomScreen, fts,
+ TAG_DONE );
+
+ if ( ftw == NULL )
+ {
+ PutStr( "Could not open intuition window\n" );
+ return -1;
+ }
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ Vio = (char*)AllocMem( DISPLAY_MEM, MEMF_ANY );
+
+ if ( !Vio )
+ {
+ PutStr( "Cannot AllocMem() display memory\n" );
+ return -1;
+ }
+
+ vio_Width = vio_ScanLineWidth = GRAY_SCREEN_WIDTH;
+ vio_Height = GRAY_SCREEN_HEIGHT;
+ }
+ else
+ {
+ Vio = (char*)fts->BitMap.Planes[0];
+ vio_ScanLineWidth = fts->BitMap.BytesPerRow;
+ vio_Width = MONO_SCREEN_WIDTH;
+ vio_Height = MONO_SCREEN_HEIGHT;
+ }
+
+ return 0;
+ }
+
+
+ /* get events in the window */
+
+ static char Get_Intuition_Event( void )
+ {
+ struct IntuiMessage* msg;
+ ULONG class;
+ USHORT code;
+
+
+ WaitPort( ftw->UserPort );
+
+ while ( ( msg = (struct IntuiMessage*)GetMsg( ftw->UserPort ) ) )
+ {
+ class = msg->Class;
+ code = msg->Code;
+
+ ReplyMsg( (struct Message*)msg );
+
+ switch ( class )
+ {
+ case IDCMP_MOUSEBUTTONS:
+ return (char)27;
+
+ case IDCMP_VANILLAKEY:
+ return (char)code;
+ }
+ }
+
+ return '\0';
+ }
+
+
+ /* set Amiga graphics mode */
+
+ int Driver_Set_Graphics( int mode )
+ {
+ graphx_mode = mode;
+
+
+ if ( AmigaInit() == -1 )
+ return 0; /* failure */
+
+ return 1; /* success */
+ }
+
+
+ /* restore screen to its original state */
+
+ int Driver_Restore_Mode( void )
+ {
+ /* do nothing */
+
+ return 1; /* success */
+ }
+
+
+ /* display bitmap */
+
+ int Driver_Display_Bitmap( char* buffer, int line, int col )
+ {
+ int y, z;
+ char* target;
+ char old = -1;
+
+
+ target = Vio + ( line - 1 ) * vio_ScanLineWidth;
+
+ for ( y = 0; y < line; y++ )
+ {
+ CopyMem( buffer, target, col );
+ target -= vio_ScanLineWidth;
+ buffer += col;
+ }
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ /* clear screen */
+ SetRast( &fts->RastPort, 0 );
+
+ /* draw glyph */
+ for ( y = 0; y < line; y++ )
+ {
+ for ( z = 0; z < col; z++ )
+ {
+ int c = Vio[y * vio_ScanLineWidth + z];
+
+ if ( c != 0 )
+ {
+ if ( old != c )
+ {
+ if ( c < 0 || c > 5 )
+ {
+ PutStr( "Unexpected value!\n" );
+ SetAPen( &fts->RastPort, 7 );
+ }
+ else
+ {
+ old = c;
+ SetAPen( &fts->RastPort, c );
+ }
+ }
+
+ WritePixel( &fts->RastPort, z, y );
+ }
+ }
+ }
+ }
+
+ return 1; /* success */
+ }
+
+
+ void Get_Event( TEvent* event )
+ {
+ int i;
+ char c;
+
+
+ c = Get_Intuition_Event();
+
+ if ( c != '\0' )
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ event->what = trans[i].event_class;
+ event->info = trans[i].event_info;
+ return;
+ }
+ }
+
+ /* unrecognized keystroke */
+
+ event->what = event_Keyboard;
+ event->info = (int)c;
+
+ return;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/amigaos/gw_amiga.c b/Build/source/libs/freetype/test/arch/amigaos/gw_amiga.c
new file mode 100644
index 00000000000..3704d96f999
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/amigaos/gw_amiga.c
@@ -0,0 +1,519 @@
+/*******************************************************************
+ *
+ * gw_amiga.c graphics utility Intuition Amiga driver.
+ *
+ * This is the driver for windowed display under Amiga WorkBench,
+ * used by the graphics utility of the FreeType test suite.
+ *
+ * Copyright 1996-2000, 2002 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.
+ *
+ ******************************************************************/
+
+/* modified by Richard Griffith
+ open largest window we can, and adapt accordingly
+ gray and mono both appear black on white
+ display Header message in Window title
+ add simple menus
+ */
+
+/* standard includes */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* AmigaOS includes */
+
+#include <exec/types.h>
+#include <exec/memory.h>
+#include <intuition/intuition.h>
+#include <intuition/screens.h>
+#include <libraries/gadtools.h>
+
+#include <clib/exec_protos.h>
+#include <clib/intuition_protos.h>
+#include <clib/graphics_protos.h>
+#include <clib/dos_protos.h>
+#include <clib/gadtools_protos.h>
+
+/* FreeType includes */
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+/* some screen definitions */
+
+#define MONO_WINDOW_WIDTH 0xFFFF
+#define MONO_WINDOW_HEIGHT 0xFFFF
+
+#define GRAY_WINDOW_WIDTH 0xFFFF
+#define GRAY_WINDOW_HEIGHT 0xFFFF
+
+#define DISPLAY_MEM ( 1024 * 64 )
+
+
+ /* external variables */
+ extern struct Library* SysBase;
+ extern struct Library* DOSBase;
+
+ extern int vio_ScanLineWidth;
+ extern char* Vio;
+/* extern char gray_palette[5]; */
+
+ /* global variables */
+ struct Library* IntuitionBase = NULL;
+ struct Library* GfxBase = NULL;
+ struct Library* GadToolsBase = NULL;
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+
+ /* local variables */
+ static struct Screen* fts = NULL;
+ static struct Window* ftw = NULL;
+ static APTR VisualInfo = NULL;
+ static struct Menu *ftmenus = NULL;
+
+ static int graphx_mode;
+
+ static ULONG vio_allocsize;
+
+ static struct NewMenu ftNewMenu[] = {
+ {NM_TITLE, (STRPTR)"File", NULL, 0, NULL, NULL},
+ {NM_ITEM, (STRPTR)"Next", (STRPTR)"n", 0, 0L, (APTR)'n'},
+ {NM_ITEM, (STRPTR)"Previous",(STRPTR)"p", 0, 0L, (APTR)'p'},
+ {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL},
+ {NM_ITEM, (STRPTR)"Quit", (STRPTR)"q", 0, 0L, (APTR)'q'},
+ {NM_TITLE, (STRPTR)"Options", NULL, 0, NULL, NULL},
+ {NM_ITEM, (STRPTR)"Scale Up", NULL, 0, NULL, NULL},
+ {NM_SUB, (STRPTR)"Fine", (STRPTR)"u", 0, 0L, (APTR)'u'},
+ {NM_SUB, (STRPTR)"Fast", (STRPTR)"+", 0, 0L, (APTR)'+'},
+ {NM_ITEM, (STRPTR)"Scale Down", NULL, 0, NULL, NULL},
+ {NM_SUB, (STRPTR)"Fine", (STRPTR)"j", 0, 0L, (APTR)'j'},
+ {NM_SUB, (STRPTR)"Fast", (STRPTR)"-", 0, 0L, (APTR)'-'},
+ {NM_ITEM, (STRPTR)"Toggle Hinting", (STRPTR)"h", 0, 0L, (APTR)'h'},
+ {NM_ITEM, (STRPTR)"Toggle Kerning", (STRPTR)"K", 0, 0L, (APTR)'K'},
+ {NM_ITEM, (STRPTR)"Toggle sbit", (STRPTR)"B", 0, 0L, (APTR)'B'},
+ {NM_ITEM, (STRPTR)"Toggle GSUB", (STRPTR)"S", 0, 0L, (APTR)'S'},
+ {NM_ITEM, (STRPTR)"Toggle GPOS", (STRPTR)"P", 0, 0L, (APTR)'P'},
+ {NM_TITLE, (STRPTR)"Glyph", NULL, 0, NULL, NULL},
+ {NM_ITEM, (STRPTR)"Next", NULL, 0, NULL, NULL},
+ {NM_SUB, (STRPTR)"1", (STRPTR)"l", 0, 0L, (APTR)'l'},
+ {NM_SUB, (STRPTR)"10", (STRPTR)"o", 0, 0L, (APTR)'o'},
+ {NM_SUB, (STRPTR)"100", (STRPTR)"0", 0, 0L, (APTR)'0'},
+ {NM_SUB, (STRPTR)"1000", (STRPTR)")", 0, 0L, (APTR)')'},
+ {NM_SUB, (STRPTR)"10000",(STRPTR)"}", 0, 0L, (APTR)'}'},
+ {NM_ITEM, (STRPTR)"Previous", NULL, 0, NULL, NULL},
+ {NM_SUB, (STRPTR)"1", (STRPTR)"k", 0, 0L, (APTR)'k'},
+ {NM_SUB, (STRPTR)"10", (STRPTR)"i", 0, 0L, (APTR)'i'},
+ {NM_SUB, (STRPTR)"100", (STRPTR)"9", 0, 0L, (APTR)'9'},
+ {NM_SUB, (STRPTR)"1000", (STRPTR)"(", 0, 0L, (APTR)'('},
+ {NM_SUB, (STRPTR)"10000",(STRPTR)"{", 0, 0L, (APTR)'{'},
+ {NM_TITLE, (STRPTR)"Rotate", NULL, 0, NULL, NULL},
+ {NM_ITEM, (STRPTR)"Clockwise", NULL, 0, NULL, NULL},
+ {NM_SUB, (STRPTR)"Fine", (STRPTR)"c", 0, 0L, (APTR)'c'},
+ {NM_SUB, (STRPTR)"Fast", (STRPTR)"b", 0, 0L, (APTR)'b'},
+ {NM_ITEM, (STRPTR)"Counter-clockwise", NULL, 0, NULL, NULL},
+ {NM_SUB, (STRPTR)"Fine", (STRPTR)"x", 0, 0L, (APTR)'x'},
+ {NM_SUB, (STRPTR)"Fast", (STRPTR)"v", 0, 0L, (APTR)'v'},
+ {NM_END, NULL, NULL, 0, 0L, NULL} };
+
+
+ /* Exit gracefully */
+ static void AmigaCleanUp( void )
+ {
+ if ( Vio )
+ FreeMem( Vio, vio_allocsize );
+
+ ReleasePen( fts->ViewPort.ColorMap, gray_palette[0] );
+ ReleasePen( fts->ViewPort.ColorMap, gray_palette[1] );
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ ReleasePen( fts->ViewPort.ColorMap, gray_palette[2] );
+ ReleasePen( fts->ViewPort.ColorMap, gray_palette[3] );
+ ReleasePen( fts->ViewPort.ColorMap, gray_palette[4] );
+ }
+
+ if ( ftmenus )
+ {
+ ClearMenuStrip( ftw );
+ FreeMenus( ftmenus );
+ }
+
+ if ( ftw )
+ CloseWindow( ftw );
+
+ if ( VisualInfo )
+ FreeVisualInfo( VisualInfo );
+
+ if ( GfxBase )
+ CloseLibrary( GfxBase );
+
+ if ( GadToolsBase )
+ CloseLibrary( GadToolsBase );
+
+ if ( IntuitionBase )
+ CloseLibrary( IntuitionBase );
+ }
+
+
+ /* open libraries & custom screen */
+ static int AmigaInit( void )
+ {
+ /* cleanup at exit */
+ if ( atexit( AmigaCleanUp ) )
+ {
+ PutStr( "atexit() failed\n" );
+ return -1;
+ }
+
+ /* open intuition library */
+ IntuitionBase = (struct Library*)OpenLibrary( "intuition.library", 39L );
+ if ( IntuitionBase == NULL )
+ {
+ PutStr( "Could not open intuition library\n" );
+ return -1;
+ }
+
+ /* open gaadtools library */
+ GadToolsBase = (struct Library*)OpenLibrary( "gadtools.library", 39L );
+ if ( GadToolsBase == NULL )
+ {
+ PutStr( "Could not open gadtools library\n" );
+ return -1;
+ }
+
+ /* open graphics library */
+ GfxBase = OpenLibrary( "graphics.library", 39L );
+ if ( GfxBase == NULL )
+ {
+ PutStr( "Could not open graphics library\n" );
+ return -1;
+ }
+
+ /* get public screen */
+ fts = LockPubScreen( NULL );
+
+ if ( fts == NULL )
+ {
+ PutStr( "Could not lock public screen\n" );
+ return -1;
+ }
+
+ if ( ! ( VisualInfo = GetVisualInfo( fts, TAG_DONE )))
+ {
+ PutStr( "Could not get VisualInfo\n" );
+ return -1;
+ }
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ vio_ScanLineWidth = GRAY_WINDOW_WIDTH;
+ vio_Width = GRAY_WINDOW_WIDTH;
+ vio_Height = GRAY_WINDOW_HEIGHT;
+
+ gray_palette[4] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0x00000000, 0x00000000, 0x00000000, NULL );
+ gray_palette[3] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0x33333300, 0x33333300, 0x33333300, NULL );
+ gray_palette[2] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0x77777700, 0x77777700, 0x77777700, NULL );
+ gray_palette[1] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0xBBBBBB00, 0xBBBBBB00, 0xBBBBBB00, NULL );
+ gray_palette[0] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, NULL );
+ }
+ else
+ {
+ vio_ScanLineWidth = MONO_WINDOW_WIDTH / 8;
+ vio_Width = MONO_WINDOW_WIDTH;
+ vio_Height = MONO_WINDOW_HEIGHT;
+
+ gray_palette[0] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, NULL );
+ gray_palette[1] = ObtainBestPenA( fts->ViewPort.ColorMap,
+ 0x00000000, 0x00000000, 0x00000000, NULL );
+ }
+
+ if ( !( ftmenus = CreateMenus( ftNewMenu, GTMN_FrontPen, 0L, TAG_DONE ) ) )
+ {
+ PutStr( "Could not create menus\n" );
+ return -1;
+ }
+
+ LayoutMenus( ftmenus, VisualInfo, GTMN_NewLookMenus, TRUE, TAG_DONE );
+
+ /* open intuition window */
+ ftw = OpenWindowTags(
+ NULL,
+ WA_InnerWidth, vio_Width,
+ WA_InnerHeight, vio_Height,
+ WA_IDCMP, IDCMP_MENUPICK |
+ IDCMP_VANILLAKEY |
+ IDCMP_CLOSEWINDOW,
+ /* WA_AutoAdjust, TRUE, */
+ WA_CloseGadget, TRUE,
+ WA_Activate, TRUE,
+ WA_DragBar, TRUE,
+ WA_SmartRefresh, TRUE,
+ WA_Gadgets, NULL,
+ WA_Flags, WFLG_DEPTHGADGET | WFLG_SMART_REFRESH,
+ WA_Title, (UBYTE*)"FreeType Project",
+ WA_NewLookMenus, TRUE,
+ WA_PubScreen, fts,
+ TAG_DONE );
+
+ if ( ftw == NULL )
+ {
+ PutStr( "Could not open intuition window\n" );
+ return -1;
+ }
+
+ SetMenuStrip( ftw, ftmenus );
+
+ UnlockPubScreen( NULL, fts );
+
+ vio_Height = ftw->Height - ftw->BorderTop - ftw->BorderBottom - 2;
+ vio_Width = (ftw->Width - ftw->BorderLeft - ftw->BorderRight) & 0xFFFFFC;
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ vio_ScanLineWidth = vio_Width;
+ }
+ else
+ {
+ vio_ScanLineWidth = vio_Width / 8;
+ }
+ vio_allocsize = vio_Height * vio_ScanLineWidth;
+
+ Vio = (char*)AllocMem( vio_allocsize, MEMF_ANY );
+ if ( Vio == NULL )
+ {
+ PutStr( "Could not allocate memory\n" );
+ return -1;
+ }
+
+ return 0;
+ }
+
+
+ /* get events in the window */
+ static char Get_Intuition_Event( void )
+ {
+ struct IntuiMessage* msg;
+ ULONG class;
+ USHORT code;
+ int rc;
+ struct MenuItem *n;
+
+
+ WaitPort( ftw->UserPort );
+
+ while ( ( msg = (struct IntuiMessage*)GetMsg( ftw->UserPort ) ) )
+ {
+ class = msg->Class;
+ code = msg->Code;
+
+ ReplyMsg( (struct Message*)msg );
+
+ switch( class )
+ {
+ case IDCMP_REFRESHWINDOW:
+ GT_BeginRefresh( ftw );
+ GT_EndRefresh( ftw, TRUE );
+ break;
+
+ case IDCMP_CLOSEWINDOW:
+ return (char)27;
+
+ case IDCMP_VANILLAKEY:
+ return (char)code;
+
+ case IDCMP_MENUPICK:
+ while( code != MENUNULL )
+ {
+ n = ItemAddress( ftmenus, code );
+ rc = (int)GTMENUITEM_USERDATA( n );
+ code = n->NextSelect;
+ } /* despite loop, we only do one */
+ return (char)rc;
+ }
+ }
+
+ return '\0';
+ }
+
+
+ /* Set Amiga graphics mode */
+ int Driver_Set_Graphics( int mode )
+ {
+ graphx_mode = mode;
+
+ if ( AmigaInit() == -1 )
+ return 0; /* failure */
+
+ return 1; /* success */
+ }
+
+
+ /* restore screen to its original state */
+ int Driver_Restore_Mode( void )
+ {
+ /* Do nothing */
+
+ return 1; /* success */
+ }
+
+
+ /* display bitmap */
+ int Driver_Display_Bitmap( char* buffer, int line, int col )
+ {
+ int y, z;
+ char* target;
+ char old = 0;
+ extern char Header[];
+
+
+ SetWindowTitles(ftw,Header,Header);
+
+ target = Vio + ( line - 1 ) * vio_ScanLineWidth;
+
+ for ( y = 0; y < line; y++ )
+ {
+ CopyMem( buffer, target, col );
+ target -= vio_ScanLineWidth;
+ buffer += col;
+ }
+
+ /* clear window */
+ /* SetRast( ftw->RPort, gray_palette[0] ); */
+
+ SetAPen( ftw->RPort, gray_palette[0] );
+
+ RectFill( ftw->RPort, ftw->BorderLeft, ftw->BorderTop,
+ ftw->Width - ftw->BorderRight - 1,
+ ftw->Height - ftw->BorderBottom - 1 );
+
+ if ( graphx_mode != Graphics_Mode_Gray )
+ {
+ SetAPen( ftw->RPort, gray_palette[1] );
+ old = 1;
+ }
+
+ /* Draw glyph */
+ for ( y = 0; y < line; y++ )
+ {
+ for ( z = 0; z < col; z++ )
+ {
+ int c = Vio[y * vio_ScanLineWidth + z];
+
+
+ if ( graphx_mode == Graphics_Mode_Gray )
+ {
+ if ( c != 0 && c != gray_palette[0] )
+ {
+ if ( old != c )
+ {
+ old = c;
+ /* printf("x = %d, y = %d, color = %d\n", z, y, c ); */
+ SetAPen( ftw->RPort, c );
+ }
+
+ WritePixel( ftw->RPort, ftw->BorderLeft + z, ftw->BorderTop + y );
+ }
+ }
+ else
+ {
+ int mask = 0x80;
+ int counter = 0;
+
+
+ while ( mask )
+ {
+ if ( mask & c )
+ WritePixel( ftw->RPort, ftw->BorderLeft + z * 8 + counter,
+ ftw->BorderTop + y );
+
+ counter++;
+ mask >>= 1;
+ }
+ }
+ }
+ }
+
+ return 1; /* success */
+ }
+
+
+ void Get_Event( TEvent* event )
+ {
+ int i;
+ char c;
+
+
+ c = Get_Intuition_Event();
+
+ if ( c != '\0' )
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ event->what = trans[i].event_class;
+ event->info = trans[i].event_info;
+ return;
+ }
+ }
+
+ /* unrecognized keystroke */
+
+ event->what = event_Keyboard;
+ event->info = (int)c;
+
+ return;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/amigaos/smakefile b/Build/source/libs/freetype/test/arch/amigaos/smakefile
new file mode 100644
index 00000000000..07f0ed50fc2
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/amigaos/smakefile
@@ -0,0 +1,195 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for amiga using SAS/C
+# and smake
+#
+# Use this file while in the 'test/arch/amigaos' directory with
+# the following statements:
+#
+# smake assign
+# smake
+#
+# the 'assign' step creates an assignment to simplify referencing
+# the core library module, as smake has quite a few limitations in
+# dealing with multi-directory projects.
+#
+#
+# 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.
+
+OBJB = ttapi.o ttcache.o ttcalc.o ttcmap.o ttdebug.o \
+ ttextend.o ttfile.o ttgload.o ttinterp.o ttload.o \
+ ttmemory.o ttmutex.o ttobjs.o ttraster.o
+
+OBJS = freetype.o
+
+OBJX = ftxgasp.o ftxkern.o ftxpost.o ftxcmap.o ftxwidth.o \
+ ftxsbit.o ftxgsub.o ftxgpos.o ftxgdef.o ftxopen.o
+
+CORE = FT:lib/
+COREXT = $(CORE)extend/
+TST = FT:test/
+
+OPTIMIZER = optimize optcomp=5 optdep=4 optinlocal optrdep=4
+
+SCFLAGS = idlen=40 idir=$(CORE)arch/amigaos idir=$(CORE) idir=$(COREXT)
+
+TSCFLAGS = $(SCFLAGS) idir=$(TST)
+
+LIB=ttf.lib
+TOPTS=$(TSCFLAGS) link lib=$(LIB) lib=lib:scm.lib \
+ lib=lib:sc.lib lib=lib:amiga.lib
+
+EXE = ftzoom ftlint ftview fttimer ftmetric \
+ ftdump ftstring ftstrpnm ftsbit ftstrtto
+
+TOBJ = gw_amiga.o gmain.o common.o textdisp.o blitter.o display.o
+
+all: ttf.lib $(EXE)
+
+assign:
+ assign FT: ///
+
+ttf.lib: $(OBJS) $(OBJX)
+ oml $@ r $(OBJS) $(OBJX)
+
+ttfdbg.lib: $(OBJB) $(OBJX)
+ oml $@ r $(OBJB) $(OBJX)
+
+clean:
+ -delete \#?.o
+ -delete //\#?.o
+ -delete \#?.lib
+ -delete $(EXE)
+
+
+#
+# freetype library core single object
+#
+freetype.o: $(CORE)arch/amigaos/freetype.c
+ sc $(SCFLAGS) code=far $(OPTIMIZER) objname=$@ $<
+
+#
+# freetype library core as separate objects
+#
+ttapi.o: $(CORE)ttapi.c
+ sc $(SCFLAGS) objname=$@ $<
+ttcache.o: $(CORE)ttcache.c
+ sc $(SCFLAGS) objname=$@ $<
+ttcalc.o: $(CORE)ttcalc.c
+ sc $(SCFLAGS) objname=$@ $<
+ttcmap.o: $(CORE)ttcmap.c
+ sc $(SCFLAGS) objname=$@ $<
+ttdebug.o: $(CORE)ttdebug.c
+ sc $(SCFLAGS) objname=$@ $<
+ttextend.o: $(CORE)ttextend.c
+ sc $(SCFLAGS) objname=$@ $<
+ttfile.o: $(CORE)ttfile.c
+ sc $(SCFLAGS) objname=$@ $<
+ttgload.o: $(CORE)ttgload.c
+ sc $(SCFLAGS) objname=$@ $<
+ttinterp.o: $(CORE)ttinterp.c
+ sc $(SCFLAGS) objname=$@ $<
+ttload.o: $(CORE)ttload.c
+ sc $(SCFLAGS) objname=$@ $<
+ttmemory.o: $(CORE)ttmemory.c
+ sc $(SCFLAGS) objname=$@ $<
+ttmutex.o: $(CORE)ttmutex.c
+ sc $(SCFLAGS) objname=$@ $<
+ttobjs.o: $(CORE)ttobjs.c
+ sc $(SCFLAGS) objname=$@ $<
+ttraster.o: $(CORE)ttraster.c
+ sc $(SCFLAGS) objname=$@ $<
+
+#
+# library extentions
+#
+ftxgasp.o: $(COREXT)ftxgasp.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxkern.o: $(COREXT)ftxkern.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxpost.o: $(COREXT)ftxpost.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxcmap.o: $(COREXT)ftxcmap.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxwidth.o: $(COREXT)ftxwidth.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxsbit.o: $(COREXT)ftxsbit.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxgsub.o: $(COREXT)ftxgsub.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxgpos.o: $(COREXT)ftxgpos.c
+ sc $(SCFLAGS) objname=$@ $< code=far
+ftxgdef.o: $(COREXT)ftxgdef.c
+ sc $(SCFLAGS) objname=$@ $<
+ftxopen.o: $(COREXT)ftxopen.c
+ sc $(SCFLAGS) objname=$@ $<
+
+#
+# Test programs
+#
+ftzoom: $(TST)ftzoom.c $(TOBJ) $(LIB)
+ sc $(TST)ftzoom.c programname=$@ $(TOBJ) $(TOPTS)
+
+ftlint: $(TST)ftlint.c common.o $(LIB)
+ sc $(TST)ftlint.c programname=$@ common.o $(TOPTS)
+
+ftdump: $(TST)ftdump.c common.o $(LIB)
+ sc $(TST)ftdump.c programname=$@ common.o $(TOPTS)
+
+# use unsigned char so full latin1 encoding may be used in string argument
+ftstring: $(TST)ftstring.c $(TOBJ) $(LIB)
+ sc $(TST)ftstring.c uchar programname=$@ $(TOBJ) $(TOPTS)
+
+ftview: $(TST)ftview.c $(TOBJ) $(LIB)
+ sc $(TST)ftview.c programname=$@ $(TOBJ) $(TOPTS)
+
+fttimer: $(TST)fttimer.c $(TOBJ) $(LIB)
+ sc $(TST)fttimer.c programname=$@ $(TOBJ) $(TOPTS)
+
+ftstrpnm: $(TST)ftstrpnm.c common.o $(LIB)
+ sc $(TST)ftstrpnm.c uchar programname=$@ common.o $(TOPTS)
+
+ftsbit: $(TST)ftsbit.c common.o textdisp.o $(LIB)
+ sc $(TST)ftsbit.c programname=$@ common.o textdisp.o $(TOPTS)
+
+ftmetric: $(TST)ftmetric.c common.o textdisp.o $(LIB)
+ sc $(TST)ftmetric.c programname=$@ common.o textdisp.o $(TOPTS)
+
+# use unsigned char so full latin1/UTF8 encoding may be used in argument
+ftstrtto: $(TST)ftstrtto.c $(TOBJ) arabic.o $(LIB)
+ sc $(TST)ftstrtto.c uchar programname=$@ $(TOBJ) \
+ arabic.o $(TOPTS)
+
+#
+# Test program support modules
+#
+
+gw_amiga.o: gw_amiga.c
+ sc gw_amiga.c $(TSCFLAGS)
+
+common.o: $(TST)common.c
+ sc $(TSCFLAGS) objname=$@ $<
+
+textdisp.o: $(TST)textdisp.c
+ sc $(TSCFLAGS) objname=$@ $<
+
+blitter.o: $(TST)blitter.c
+ sc $(TSCFLAGS) objname=$@ $<
+
+display.o: $(TST)display.c
+ sc $(TSCFLAGS) objname=$@ $<
+
+gmain.o: $(TST)gmain.c
+ sc $(TSCFLAGS) objname=$@ $<
+
+arabic.o: $(TST)arabic.c
+ sc $(TSCFLAGS) objname=$@ $<
+
+# end of smakefile
diff --git a/Build/source/libs/freetype/test/arch/debugger/Makefile b/Build/source/libs/freetype/test/arch/debugger/Makefile
new file mode 100644
index 00000000000..4de2f61c654
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/debugger/Makefile
@@ -0,0 +1,110 @@
+# This file is part of the FreeType project.
+#
+# It builds the debugger for emx-gcc under OS/2 resp. under Unix.
+#
+# You will need GNU make.
+#
+# Use this file while in the `test' directory with the following statements:
+#
+# make -f arch/debugger/Makefile depend
+# make -f arch/debugger/Makefile
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/debugger
+FT_MAKEFILE = $(ARCH)/Makefile
+
+CC = gcc
+
+LIBDIR = ../lib
+LIBTTF = $(LIBDIR)/$(ARCH)/libttf.a
+
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/extend -I$(LIBDIR)/$(ARCH) -I.
+
+# Note: The debugger uses non-ANSI functions to read the keyboard
+# on OS/2 -- do not set the `-ansi flag here.
+#
+CFLAGS = -Wall -O0 -g $(INCDIRS)
+
+
+SRC = fdebug.c common.c
+
+ALLSRC = $(SRC)
+ALLOBJ = $(ALLSRC:.c=.o)
+
+# on OS/2, do not use the curses library
+#
+ifdef OS2_SHELL
+EXE := fdebug.exe
+OS := OS2
+EFENCE :=
+EXTRAFLAGS :=
+RM := del
+else
+EXE := fdebug
+OS := UNIX
+EFENCE := -lefence
+RM := rm -f
+#
+# POSIX TERMIOS: Do not define if you use OLD U*ix like 4.2BSD.
+#
+EXTRAFLAGS := HAVE_POSIX_TERMIOS
+endif
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $< -D$(OS) -D$(EXTRAFLAGS)
+
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $^
+
+
+
+EXEFILES = $(EXE)
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+$(EXE): fdebug.o common.o $(LIBTTF)
+$(EXE):
+ $(CC) $(CFLAGS) -o $@ $^ $(EFENCE)
+
+freetype:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all
+
+freetype_debug:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug
+
+
+clean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean
+
+distclean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
+ -$(RM) dep.end $(EXEFILES) core
+
+do_clean:
+ -$(RM) $(subst /,\,$(ALLOBJ))
+
+
+depend: $(ALLSRC)
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
+ $(CC) -E -MM $(INCDIRS) $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.emx
diff --git a/Build/source/libs/freetype/test/arch/msdos/Makefile.BC b/Build/source/libs/freetype/test/arch/msdos/Makefile.BC
new file mode 100644
index 00000000000..1dc04a39d7c
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/Makefile.BC
@@ -0,0 +1,191 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for BC++ under MSDOS, large model.
+#
+# Tested with Borland C++ v.3.1, 4.02, 5.0
+# You will need Borland MAKE (v.3.6 and above should be OK, for oldest
+# versions refer to the instructions below).
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# make -farch\msdos\Makefile.BC
+#
+#
+# Debug versions can be obtained with
+#
+# make -DDEBUG -farch\msdos\Makefile.BC
+#
+# A special version enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# make -DBIGFONTS -farch\msdos\Makefile.BC
+#
+#
+# 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.
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.BC
+
+CC = bcc
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR);$(LIBDIR)\$(ARCH);.;$(LIBDIR)\extend
+SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -w-pia
+
+# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
+# Borland compilers (from BC++ 3.1 on) can increase the limit of
+# the length of identifiers.
+!if ! $d(DEBUG)
+CFLAGS = -ml -A -O2 -3 -i40 $(INCDIRS) $(SPURIOUS_WARNINGS)
+LDFLAGS = -ml
+!else
+CFLAGS = -v -N -ml -A -i40 $(INCDIRS) $(SPURIOUS_WARNINGS)
+LDFLAGS = -v -ml
+!endif
+
+
+# full-screen MSDOS driver
+GDRIVER = $(ARCH)\.\gfs_dos.c
+
+DISPLAY = display.c
+
+G1SRC = gmain.c blitter.c $(GDRIVER)
+GSRC = $(DISPLAY) $(G1SRC)
+
+GOBJ = $(GSRC:.c=.obj)
+G1OBJ = $(G1SRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) $<
+|
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!if !$d(DEBUG)
+# Skipped if DEBUG build
+all: freetype $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+!if $d(BIGFONTS)
+MAKEBIG = -DBIGFONTS
+!endif
+
+freetype:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) $(MAKEBIG) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDEBUG $(MAKEBIG) debug
+ cd ..\test
+
+
+# Borland C compilers are unable to include <dos.h> in ANSI mode.
+# So we have a special rule for this file, to build it outside ANSI.
+$(GDRIVER:.c=.obj):
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) -A- $*.c
+|
+
+.obj.exe:
+ $(CC) -e$* @&&|
+ $(LDFLAGS) $**
+|
+
+# Borland versions of make are unable to use the $** variable inside
+# implicit rules (like .obj.exe:). The job has to be done by hand. :-(
+ftzoom.exe: $(G1OBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftzoom.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftview.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstring.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrtto.obj $(GOBJ) common.obj arabic.obj \
+ $(LIBDIR)\libttf.lib
+
+fttimer.exe: $(G1OBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fttimer.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftlint.obj common.obj $(LIBDIR)\libttf.lib
+
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftdump.obj common.obj $(LIBDIR)\libttf.lib
+
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+
+ftsbit.exe: $(TDOBJ) ftsbit.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftsbit.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+ftmetric.exe: $(TDOBJ) ftmetric.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftmetric.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+ del time.h # clean the ugly hack for Turbo C...
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/test/arch/msdos/Makefile.MS b/Build/source/libs/freetype/test/arch/msdos/Makefile.MS
new file mode 100644
index 00000000000..f0e32a3da76
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/Makefile.MS
@@ -0,0 +1,152 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for Microsoft C for MS-DOS,
+# large model. It also works for Visual C++ 1.x 16-bits compiler, but
+# you should instead use the Makefile customized for it, Makefile.VC.
+#
+# You will need NMAKE.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# nmake /f arch\msdos\Makefile.MS
+#
+#
+# Debug versions can be obtained with
+#
+# nmake DEBUG=1 /f arch\msdos\Makefile.MS
+#
+# A special version enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# nmake BIGFONTS=1 /f arch\msdos\Makefile.MS
+#
+#
+# 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.
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.MS
+FT_MAKE = $(MAKE) /nologo
+
+CC = cl /nologo
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\$(ARCH) -I. -I$(LIBDIR)\extend
+
+!ifndef DEBUG
+CFLAGS = /Ox /AL /Za /W2 /G2 $(INCDIRS)
+LDFLAGS = /AL
+!else
+CFLAGS = /Zi /AL /Za /W2 /G2 $(INCDIRS)
+LDFLAGS = /Zi /AL
+!endif
+
+
+# full-screen MSDOS driver
+GDRIVER = $(ARCH)\gfs_dos.c
+
+GSRC = display.c gmain.c blitter.c $(GDRIVER)
+
+GOBJ = $(GSRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) $<
+<<
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!ifndef DEBUG
+# Skiped if DEBUG build
+all: freetype $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+!ifdef BIGFONTS
+MAKEBIG = BIGFONTS=1
+!endif
+
+freetype:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) $(MAKEBIG) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 $(MAKEBIG) debug
+ cd ..\test
+
+.obj.exe:
+ $(CC) /Fe$* @<<
+ $(LDFLAGS) $**
+<<
+
+ftzoom.exe: $(GOBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+fttimer.exe: $(GOBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ftsbit.exe: ftsbit.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+ftmetric.exe: ftmetric.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile.MS
diff --git a/Build/source/libs/freetype/test/arch/msdos/Makefile.TC b/Build/source/libs/freetype/test/arch/msdos/Makefile.TC
new file mode 100644
index 00000000000..6640e577c0e
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/Makefile.TC
@@ -0,0 +1,267 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for Turbo C under MSDOS, large model.
+#
+# You will need Borland MAKE.
+# Tested with Turbo C v.1.5, v.2.0, Turbo C++ v.1.0, v.3.0
+# Turbo C v.1.0 (May '87) is too old (lack of structure assignment)
+# to compile FreeType. Update your compiler. ;-)
+# See below for notes regarding the various versions.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# make -farch\msdos\Makefile.TC
+#
+#
+# Debug versions can be obtained (except for TC 1.5, see below) with
+#
+# make -DDEBUG -farch\msdos\Makefile.TC
+#
+# The main difference is with the compiler options, because due to size
+# constraints, the modules of the library are always compiled separately.
+#
+#
+# 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.
+#
+#
+#
+# Various notes about specific versions...
+#
+# The lack of space in the command line prevents us to turn off the
+# -w-use warning (when TCC.CFG file had enabled it).
+#
+# Due to lack of space in the command line, we are not able to
+# switch off all the irrelevant warnings for the demo program.
+# Under the default settings, only one warning should be shown.
+# If more of the ``verbose'' warnings are enabled, much more can
+# appear. However, rest assured that any of them have been dealt
+# with, and they are just that, warnings, not indicating real
+# problems.
+#
+# NOTE: Turbo C++ v. 3.0
+#
+# The Makefile.TC for this version is common with the older versions.
+# Alternatively, you can consider using Makefile.BC instead, changing
+# the name of the compiler from BCC to TCC!
+#
+# NOTE 2: Turbo C v. 2.0
+#
+# This version lacks an ANSI compliant <time.h> header, so it causes
+# problems when compiling the demo program fttimer. We worked around
+# this difficulty in a very hacky way.
+# The detection is based on the version of make used, so if you use
+# a more recent version, please take a closer look at the Makefile.
+#
+# NOTE 3: Turbo C v. 1.5
+#
+# Yes, this old compiler is able to compile the FreeType library, even
+# if it predates the ANSI standard by months! However, this is a
+# huge piece for such a small compiler, and several things are not
+# possible. First, as always with real-mode compilers, you need a lot
+# of available memory, probably more than 512KB at the C> prompt.
+# Also, compiling for debug is ardeous: both Makefile.TC assume the
+# -v option, which was not available in this version.
+#
+# The hack for <time.h> is used there too, as with v.2.0.
+
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.TC
+
+CC = tcc
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR);$(LIBDIR)\$(ARCH);.;$(LIBDIR)\extend
+SPURIOUS_WARNINGS = -w-pia -w-par -w-use -w-aus -w-rng
+
+!if ! $d(DEBUG)
+CFLAGS_LEAN = -ml -A -O -Z -G -a $(INCDIRS)
+# The lack of space in the command line prevents us to turn off the
+# warnings, when the TCC.CFG file had enable it with -w.
+# With the normal settings, it should not complain.
+LDFLAGS = -ml
+!else
+# For Turbo C v.1.5, replace the -v option below by -y (2 occurences).
+# You should have applied the same change in the lib Makefile, too.
+CFLAGS_LEAN = -v -N -ml -w-pia -A $(INCDIRS)
+LDFLAGS = -v -ml
+!endif
+
+CFLAGS = $(CFLAGS_LEAN) $(SPURIOUS_WARNINGS)
+
+
+# full-screen MSDOS driver
+GDRIVER = $(ARCH)\.\gfs_dos.obj
+
+# the line below does not work with these old versions of make...
+# GOBJ = $(GSRC:.c=.o)
+
+DISPLAY = display.obj
+
+G1OBJ = gmain.obj blitter.obj $(GDRIVER)
+GOBJ = $(DISPLAY) $(G1OBJ)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = arabic.obj \
+ common.obj \
+ ftdump.obj \
+ fterror.obj \
+ ftlint.obj \
+ ftmetric.obj \
+ ftsbit.obj \
+ ftstring.obj \
+ ftstrpnm.obj \
+ ftstrtto.obj \
+ fttimer.obj \
+ ftview.obj \
+ ftzoom.obj
+
+
+.c.obj:
+ $(CC) $(CFLAGS) -c -o$* $<
+
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+
+!if !$d(DEBUG)
+# Skipped if DEBUG build
+all: freetype $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDEBUG debug
+ cd ..\test
+
+
+# Borland C compilers are unable to include <dos.h> in ANSI mode.
+# So we have a special rule for this file, to build it outside ANSI.
+# Furthermore, this line exceeds the 128-character limit of COMMAND.COM;
+# as a result, we drop the warnings...
+$(GDRIVER):
+ $(CC) $(CFLAGS_LEAN) -A- -c -o$* $*.c
+
+
+# This old gr... make is unable to have a $ variable to name all the
+# dependencies. :-( So the job have to be done by hand...
+ftzoom.exe: $(G1OBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftzoom.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftview.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstring.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrtto.obj $(GOBJ) common.obj \
+ arabic.obj $(LIBDIR)\libttf.lib
+
+
+# fttimer.exe... Well, there is an additional problem here...
+
+!if $(__MAKE__) < 0x0300
+
+# Also, Turbo C v.1.5 and v.2.0 are not fully ANSI compliant with regard to
+# <time.h>, particularly the clock() function.
+# So we use an ugly hack here: a modified version of time.h, with the
+# necessary machinery, is included in the arch\msdos directory.
+time.h: $(ARCH)\time_tc.h
+ copy $(ARCH)\time_tc.h time.h
+
+# Below is the special rule for forcing recompilation of fttimer.obj
+# using our <time.h>, without using the rule that is pulled in by
+# !include "$(ARCH)\depend.dos" at the end of the Makefile...
+fttimer.exe: $(G1OBJ) fttimer.c time.h common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) -c -o$* $*.c
+ $(CC) $(LDFLAGS) fttimer.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+# Yes, all of this is really dirty...
+
+!else
+# Normal behaviour
+fttimer.exe: $(G1OBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fttimer.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+!endif
+
+
+
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftlint.obj common.obj $(LIBDIR)\libttf.lib
+
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftdump.obj common.obj $(LIBDIR)\libttf.lib
+
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+
+ftsbit.exe: $(TDOBJ) ftsbit.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftsbit.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+ftmetric.exe: $(TDOBJ) ftmetric.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftmetric.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+ del time.h # clean the ugly hack for Turbo C...
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/test/arch/msdos/Makefile.VC b/Build/source/libs/freetype/test/arch/msdos/Makefile.VC
new file mode 100644
index 00000000000..60d03fff311
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/Makefile.VC
@@ -0,0 +1,153 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for Microsoft Visual C++ 1.x
+# and Microsoft C/C++ v.7.0 16-bit compilers for MS-DOS, large model.
+#
+# You will need NMAKE.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# nmake /f arch\msdos\Makefile.VC
+#
+#
+# Debug versions can be obtained with
+#
+# nmake DEBUG=1 /f arch\msdos\Makefile.VC
+#
+# A special version enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# nmake BIGFONTS=1 /f arch\msdos\Makefile.VC
+#
+#
+# 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.
+
+ARCH = arch\msdos
+FT_MAKEFILE = $(ARCH)\Makefile.VC
+FT_MAKE = $(MAKE) /nologo
+
+CC = cl /nologo
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\$(ARCH) -I. -I$(LIBDIR)\extend
+
+# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
+# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
+!ifndef DEBUG
+CFLAGS = /Ox /AL /Za /W2 /G3 $(INCDIRS)
+LDFLAGS = /AL
+!else
+CFLAGS = /Zi /Ge /AL /Za /W2 /G3 $(INCDIRS)
+LDFLAGS = /Zi /AL
+!endif
+
+
+# full-screen MSDOS driver
+GDRIVER = $(ARCH)\gfs_dos.c
+
+GSRC = display.c gmain.c blitter.c $(GDRIVER)
+
+GOBJ = $(GSRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) $<
+<<
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!ifndef DEBUG
+# Skiped if DEBUG build
+all: freetype $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+!ifdef BIGFONTS
+MAKEBIG = BIGFONTS=1
+!endif
+
+freetype:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) $(MAKEBIG) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 $(MAKEBIG) debug
+ cd ..\test
+
+.obj.exe:
+ $(CC) /Fe$* @<<
+ $(LDFLAGS) $**
+<<
+
+ftzoom.exe: $(GOBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+fttimer.exe: $(GOBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ftsbit.exe: ftsbit.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+ftmetric.exe: ftmetric.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+
+
+!include "$(ARCH)\depend.dos"
+
+# end of Makefile.VC
diff --git a/Build/source/libs/freetype/test/arch/msdos/Makefile.dm b/Build/source/libs/freetype/test/arch/msdos/Makefile.dm
new file mode 100644
index 00000000000..cce7c9e9368
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/Makefile.dm
@@ -0,0 +1,156 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc and djgpp under MSDOS.
+#
+# You will need dmake.
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# dmake -r -f arch/msdos/Makefile.dm
+#
+#
+# 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.
+
+ARCH = arch/msdos
+FT_MAKEFILE = $(ARCH)/Makefile.dm
+FT_MAKE = dmake -r
+
+.IMPORT: COMSPEC
+SHELL := $(COMSPEC)
+SHELLFLAGS := /c
+GROUPSHELL := $(SHELL)
+GROUPFLAGS := $(SHELLFLAGS)
+GROUPSUFFIX := .bat
+SHELLMETAS := *"?<>&|
+
+CC = gcc
+
+LIBDIR = ../lib
+LIBDIR_DOS = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend
+
+CFLAGS = -Wall -ansi -O2 -g $(INCDIRS)
+# CFLAGS = -ansi -Wall -O2 -s $(INCDIRS)
+
+# full-screen MSDOS driver
+GDRIVER = $(ARCH)/gfs_dos.c
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+GSRC = gmain.c display.c blitter.c $(GDRIVER)
+GOBJ = $(GSRC:.c=.o)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.exe:
+ $(CC) $(CFLAGS) -o $@ @$(mktmp $(&:t"\n")\n)
+
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean do_distclean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+[
+ cd $(LIBDIR_DOS)
+ $(FT_MAKE) -f $(FT_MAKEFILE) all
+ cd $(MAKEDIR)
+]
+
+freetype_debug:
+[
+ cd $(LIBDIR_DOS)
+ $(FT_MAKE) -f $(FT_MAKEFILE) debug
+ cd $(MAKEDIR)
+]
+
+ftzoom.exe: $(GOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview.exe: $(GOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint.exe: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump.exe: ftdump.o common.o $(LIBDIR)/libttf.a
+ftstring.exe: $(GOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+fttimer.exe: $(GOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftstrpnm.exe: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+ftsbit.exe: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftmetric.exe: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto.exe: $(GOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+[
+ cd $(LIBDIR_DOS)
+ $(FT_MAKE) -f $(FT_MAKEFILE) clean
+ cd $(MAKEDIR)
+]
+
+distclean: do_clean do_distclean
+[
+ cd $(LIBDIR_DOS)
+ $(FT_MAKE) -f $(FT_MAKEFILE) distclean
+ cd $(MAKEDIR)
+]
+
+do_distclean:
+-[
+ del dep.end
+ del *.exe
+ del core
+]
+
+do_clean:
+-[
+ del *.o
+ del $(ARCH)\gfs_dos.o
+]
+
+#depend: $(SRC) $(GSRC)
+#[
+# cd $(LIBDIR_DOS)
+# $(FT_MAKE) -f $(FT_MAKEFILE) depend
+# cd $(MAKEDIR)
+# $(CC) -E -M $(INCDIRS) @$(mktmp $(<:t"\n")\n) > dep.end
+#]
+#
+#ifeq (dep.end,$(wildcard dep.end))
+# include dep.end
+#endif
+
+# end of Makefile.dm
diff --git a/Build/source/libs/freetype/test/arch/msdos/Makefile.gcc b/Build/source/libs/freetype/test/arch/msdos/Makefile.gcc
new file mode 100644
index 00000000000..64a9dd35279
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/Makefile.gcc
@@ -0,0 +1,151 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc and djgpp under MSDOS.
+#
+# You will need a recent GNU make DOS port.
+#
+# Use this file while in the 'test' directory with the following statements:
+#
+# make -f arch/msdos/Makefile.gcc depend
+# make -f arch/msdos/Makefile.gcc
+#
+#
+# If you have the GNU gettext package installed with DJGPP, you can also try
+#
+# make -f arch/msdos/Makefile.gcc HAVE_GETTEXT
+#
+# Note that this version takes in account new versions of GNU gettext,
+# which in turn requires the iconv library. If you have an old version
+# of gettext and don't have the iconv library, just erase the `-l iconv'.
+#
+# Also take a look at the lib Makefile (at ../lib/arch/msdos/Makefile.gcc),
+# about the need to have the path to the *.mo files correct.
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/msdos
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+CC = gcc
+
+LIBDIR = ../lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend
+
+ifndef GETTEXT
+GETTEXT=NO_GETTEXT
+endif
+
+CFLAGS = -Wall -ansi -O2 -g $(INCDIRS) -D$(GETTEXT)
+# CFLAGS = -ansi -Wall -O2 -s $(INCDIRS) -D$(GETTEXT)
+
+
+# full-screen MSDOS driver
+GDRIVER = $(ARCH)/gfs_dos.c $(ARCH)/gmain_dj.c
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+GSRC = display.c blitter.c $(GDRIVER)
+GOBJ = $(GSRC:.c=.o)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+
+ifeq ($(GETTEXT),HAVE_GETTEXT)
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $^ -lintl -liconv
+# Remove `-l iconv' above if you have an old version
+# of GNU gettext (like 0.10.35) and no iconv library.
+else
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $^
+endif
+
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+HAVE_GETTEXT:
+ $(MAKE) -f $(FT_MAKEFILE) GETTEXT=HAVE_GETTEXT all
+
+freetype:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all
+
+freetype_debug:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug
+
+ftzoom.exe: $(GOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview.exe: $(GOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint.exe: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump.exe: ftdump.o common.o $(LIBDIR)/libttf.a
+fterror.exe: fterror.o common.o $(LIBDIR)/libttf.a
+ftstring.exe: $(GOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+fttimer.exe: $(GOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftstrpnm.exe: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+ftsbit.exe: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftmetric.exe: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto.exe: $(GOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean
+
+distclean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
+ -del dep.end
+ -del *.exe
+ -del core
+
+do_clean:
+ -del *.o
+ -del response
+ -del $(ARCH)\gfs_dos.o
+
+depend: $(SRC) $(GSRC)
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
+ $(CC) -E -MM $(INCDIRS) $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/test/arch/msdos/depend.dos b/Build/source/libs/freetype/test/arch/msdos/depend.dos
new file mode 100644
index 00000000000..09809f45f38
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/depend.dos
@@ -0,0 +1,76 @@
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in `makedep'...
+#
+# This dependency file to be used with various MS-DOS compilers
+# has been generated automatically with the script `makedep' on
+# 2002-02-19.
+
+arabic.obj: arabic.c arabic.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxopen.h ..\lib\extend\ftxgdef.h \
+ ..\lib\extend\ftxgsub.h ..\lib\extend\ftxgpos.h
+blitter.obj: blitter.c blitter.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+common.obj: common.c common.h
+display.obj: display.c display.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gmain.h
+fdebug.obj: fdebug.c ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\tttypes.h ..\lib\ttconfig.h \
+ ..\lib\arch\msdos\ft_conf.h ..\lib\ttdebug.h \
+ ..\lib\ttobjs.h ..\lib\ttengine.h \
+ ..\lib\ttmutex.h ..\lib\ttcache.h \
+ ..\lib\tttables.h ..\lib\ttcmap.h
+ftdump.obj: ftdump.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxcmap.h ..\lib\extend\ftxopen.h \
+ ..\lib\extend\ftxgdef.h ..\lib\extend\ftxgsub.h \
+ ..\lib\extend\ftxgpos.h ..\lib\extend\ftxsbit.h \
+ ..\lib\ttobjs.h ..\lib\ttconfig.h \
+ ..\lib\arch\msdos\ft_conf.h ..\lib\ttengine.h \
+ ..\lib\tttypes.h ..\lib\ttmutex.h \
+ ..\lib\ttcache.h ..\lib\tttables.h \
+ ..\lib\ttcmap.h ..\lib\ttmemory.h
+fterror.obj: fterror.c ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxerr18.h \
+ ..\lib\arch\msdos\ft_conf.h
+ftlint.obj: ftlint.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\arch\msdos\ft_conf.h
+ftmetric.obj: ftmetric.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxsbit.h textdisp.h \
+ ..\lib\arch\msdos\ft_conf.h
+ftsbit.obj: ftsbit.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxsbit.h textdisp.h \
+ ..\lib\arch\msdos\ft_conf.h
+ftstring.obj: ftstring.c common.h display.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gevents.h \
+ gdriver.h gmain.h
+ftstrpnm.obj: ftstrpnm.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+ftstrtto.obj: ftstrtto.c arabic.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxopen.h ..\lib\extend\ftxgdef.h \
+ ..\lib\extend\ftxgsub.h ..\lib\extend\ftxgpos.h \
+ blitter.h common.h display.h ..\lib\extend\ftxkern.h \
+ ..\lib\extend\ftxsbit.h gdriver.h gevents.h gmain.h \
+ ..\lib\ttmemory.h ..\lib\ttconfig.h \
+ ..\lib\arch\msdos\ft_conf.h ..\lib\tttypes.h
+fttimer.obj: fttimer.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gdriver.h \
+ gevents.h gmain.h
+ftview.obj: ftview.c blitter.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h common.h \
+ display.h ..\lib\extend\ftxsbit.h gdriver.h gevents.h \
+ gmain.h
+ftzoom.obj: ftzoom.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxpost.h gdriver.h gevents.h gmain.h
+gmain.obj: gmain.c gdriver.h gmain.h
+textdisp.obj: textdisp.c textdisp.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+arch\msdos\gfs_dos.obj: arch\msdos\gfs_dos.c gdriver.h gevents.h gmain.h
diff --git a/Build/source/libs/freetype/test/arch/msdos/gfs_dos.c b/Build/source/libs/freetype/test/arch/msdos/gfs_dos.c
new file mode 100644
index 00000000000..ce61c526796
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/gfs_dos.c
@@ -0,0 +1,374 @@
+/*******************************************************************
+ *
+ * gfs_dos.c graphics utility fullscreen Dos driver. 1.0
+ *
+ * This is the driver for fullscreen Dos display, used by the
+ * graphics utility of the FreeType test suite.
+ *
+ * Copyright 1996-2002 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.
+ *
+ ******************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#if defined( __STDC__ ) || defined( __TURBOC__ )
+#include <string.h>
+#else
+#include <memory.h>
+#endif
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+/* The following #ifdef are used to define the following macros : */
+/* */
+/* - int86 : function to call an interrupt */
+/* - reg_ax : the 'ax' register as stored in the REGS struct */
+/* */
+
+/* ---- DJGPP dos compiler support --------------------------------------- */
+
+#if defined( __DJGPP__ ) || defined( __DJGPP ) || defined( __GO32__ )
+
+#undef __STRICT_ANSI__
+#ifndef DJGPP
+#define DJGPP
+#endif
+
+#include <dos.h>
+#include <conio.h>
+#include <go32.h>
+
+#if !defined( __DJGPP__ )
+/* DJGPP v1.x */
+
+const int djgpp_use_nearpointers = 0; /* V.1 did not know about them */
+
+#else
+/* DJGPP v2.x */
+
+#ifdef DJGPP_NEAR_POINTERS
+#include <sys/nearptr.h>
+int djgpp_use_nearpointers = -1; /* to be tested if they works */
+#else
+const int djgpp_use_nearpointers = 0; /* don't even try */
+#endif
+
+#endif /* DJGPP v.? */
+
+#define int86( a, b, c ) int86( a, b, c )
+#define reg_ax regs.x.ax
+
+#endif
+
+/* ---- Microsoft C compilers support ------------------------------------ */
+
+#if defined( M_I86 ) || defined( _M_I86 )
+
+#include <dos.h>
+#include <conio.h>
+
+#define reg_ax regs.x.ax
+
+#ifdef _M_I86 /* a recent compiler, which do not pollute name spaces */
+#define getch() _getch()
+#define REGS _REGS
+#define int86( a, b, c ) _int86( a, b, c )
+#else
+#define int86( a, b, c ) int86( a, b, c )
+#endif
+
+#ifndef MK_FP
+#ifdef _MK_FP
+#define MK_FP( seg, ofs ) _MK_FP( seg, ofs )
+#else
+#ifndef _M_I86 /* old versions */
+#define __far _far
+#endif
+#define MK_FP( seg, offset ) (void __far *)( ((unsigned long)seg << 16) + \
+ (unsigned long)(unsigned)offset )
+#endif /* _MK_FP */
+#endif /* MK_FP */
+
+#endif /* Microsoft compilers */
+
+/* ---- Borland C compiler support --------------------------------------- */
+
+#ifdef __TURBOC__
+#ifdef __STDC__
+#error "MK_FP is incompatible with ANSI mode. Use the `-A-' switch."
+#endif
+
+#include <dos.h> /* Includes the declaration of int86 */
+#include <conio.h> /* for getch */
+
+#define reg_ax regs.x.ax
+#define int86( a, b, c ) int86( a, b, c )
+
+#endif
+
+/* ---- Phar Lap 286|DOS extender support -------------------------------- */
+
+#ifdef DOSX286
+/* The symbol DOSX286 must be specified on the command line. */
+
+#include <phapi.h>
+
+#ifndef FP_SEG
+#define FP_SEG(fp) (*((unsigned __far *)&(fp) + 1))
+#endif
+
+#endif
+
+/* ---- EMX/Dos compiler support ----------------------------------------- */
+
+#ifdef __EMX__
+
+#include <dos.h>
+#include <sys/hw.h>
+#include <conio.h> /* for getch */
+ extern _read_kbd(); /* to avoid an ANSI warning during compilation */
+
+#define int86 _int86
+#define reg_ax regs.x.ax
+
+#endif
+
+/* ---- WATCOM Dos/16 & Dos/32 support ----------------------------------- */
+
+#ifdef __WATCOMC__
+
+#include <i86.h>
+
+#define reg_ax regs.w.ax
+
+#ifdef __386__
+#define int86 int386
+#endif
+
+#endif
+
+
+#if !defined( reg_ax ) || !defined( int86 )
+#error "Your compiler is not (yet) supported. Check the source file!"
+#endif
+
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+
+ /* Set Graphics Mode */
+
+ int Driver_Set_Graphics( int mode )
+ {
+ union REGS regs;
+
+
+ switch ( mode )
+ {
+ case Graphics_Mode_Mono: /* Standard VGA 640x480x16 mode */
+ reg_ax = 0x12;
+ int86( 0x10, &regs, &regs );
+
+ vio_ScanLineWidth = 80;
+ vio_Width = 640;
+ vio_Height = 480;
+ break;
+
+ case Graphics_Mode_Gray: /* Standard VGA 320x200x256 mode */
+ reg_ax = 0x13;
+ int86( 0x10, &regs, &regs );
+
+ vio_ScanLineWidth = 320;
+ vio_Width = 320;
+ vio_Height = 200;
+
+ /* default gray_palette takes the gray levels of the standard VGA */
+ /* 256 colors mode */
+
+ gray_palette[0] = 0;
+ gray_palette[1] = 23;
+ gray_palette[2] = 27;
+ gray_palette[3] = 29;
+ gray_palette[4] = 31;
+ break;
+
+ default:
+ return 0; /* failure */
+ }
+
+#if defined( __EMX__ )
+ Vio = _memaccess( 0xA0000, 0xAFFFF, 1 );
+#elif defined( DJGPP )
+ Vio = (char *)0xA0000;
+#elif defined( __WATCOMC__ ) && defined( __386__ )
+ Vio = (char *)0xA0000;
+#elif defined( DOSX286 )
+ {
+ unsigned short sel;
+
+
+ if ( DosMapRealSeg( 0xA000, (long)vio_ScanLineWidth*vio_Height, &sel ) )
+ return 0; /* failure */
+
+ Vio = (char*)MK_FP( sel, 0 );
+ }
+#else
+ Vio = (char*)MK_FP( 0xA000, 0 );
+#endif
+
+ return 1; /* success */
+ }
+
+
+ /* Revert to text mode */
+
+ int Driver_Restore_Mode()
+ {
+ union REGS regs;
+
+
+ reg_ax = 0x3;
+ int86( 0x10, &regs, &regs );
+
+#ifdef DOSX286
+ DosFreeSeg( FP_SEG( Vio ) );
+#endif
+
+ return 1; /* success */
+ }
+
+
+ int Driver_Display_Bitmap( char* buffer, int line, int col )
+ {
+ int y, used_col;
+ char* target;
+
+#ifdef DJGPP
+ char cbuf = 0;
+ int i;
+#endif
+
+#ifdef DJGPP_USE_NEAR_POINTERS
+ if( djgpp_use_nearpointers )
+ if( ! __djgpp_nearptr_enable() )
+ /* doesn't work, probably under some real OS like NT or dosemu! */
+ djgpp_use_nearpointers = 0;
+ else
+ Vio += __djgpp_conventional_base;
+#endif
+
+#ifdef DJGPP
+ if( !djgpp_use_nearpointers )
+ for( i = 0; i < vio_Height*vio_ScanLineWidth; i++ )
+ dosmemput( &cbuf, 1, (unsigned long) Vio+i );
+ else
+ /*FALLTHROUGH*/
+#endif
+ memset( Vio, 0, vio_Height * vio_ScanLineWidth );
+
+ if ( line > vio_Height )
+ line = vio_Height;
+ if ( col > vio_ScanLineWidth )
+ used_col = vio_ScanLineWidth;
+ else
+ used_col = col;
+
+ target = Vio + ( line - 1 ) * vio_ScanLineWidth;
+
+ for ( y = 0; y < line; y++ )
+ {
+#ifdef DJGPP
+ if( !djgpp_use_nearpointers )
+ dosmemput( buffer, used_col, (unsigned long)target );
+ else
+ /*FALLTHROUGH*/
+#endif
+ memcpy( target, buffer, used_col );
+
+ target -= vio_ScanLineWidth;
+ buffer += col;
+ }
+
+#ifdef DJGPP_USE_NEAR_POINTERS
+ if( djgpp_use_nearpointers )
+ {
+ Vio -= __djgpp_conventional_base;
+ __djgpp_nearptr_disable();
+ }
+#endif
+
+ return 1; /* success */
+ }
+
+
+ void Get_Event( TEvent* event )
+ {
+ int i;
+ int c;
+
+
+ c = getch();
+
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ event->what = trans[i].event_class;
+ event->info = trans[i].event_info;
+ return;
+ }
+ }
+
+ /* unrecognized keystroke */
+
+ event->what = event_Keyboard;
+ event->info = (int)c;
+ return;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/msdos/gmain_dj.c b/Build/source/libs/freetype/test/arch/msdos/gmain_dj.c
new file mode 100644
index 00000000000..01206cfb21c
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/gmain_dj.c
@@ -0,0 +1,470 @@
+/*******************************************************************
+ *
+ * gmain_dj.c graphics utility main body, specific DJGPP version
+ *
+ * This file defines a specific implementation of the generic
+ * graphics utility used by the FreeType test programs. It is
+ * provided because the management of the video memory under DJGPP
+ * extender is rather specific...
+ *
+ * Copyright 1996-2002 by Antoine Leca,
+ * 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.
+ *
+ ******************************************************************/
+
+#include "gdriver.h"
+#include "gmain.h"
+
+#undef __STRICT_ANSI__
+#include <go32.h>
+
+#ifndef FAILURE
+#define FAILURE 0
+#endif
+
+#ifndef SUCCESS
+#define SUCCESS 1
+#endif
+
+ char* Vio; /* pointer to VRAM or display buffer */
+
+ int vio_ScanLineWidth; /* scan line width in bytes */
+
+ int vio_Width;
+ int vio_Height;
+
+ int gcursor_x = 0;
+ int gcursor_y = 0;
+
+ int gwindow_width = 0;
+ int gwindow_height = 0;
+
+ unsigned char gray_palette[5];
+
+
+ typedef void TFunction_Print_8x8_Char( int x,
+ int y,
+ unsigned char c );
+
+ TFunction_Print_8x8_Char* Print_8x8_Char;
+
+ /* font characters */
+
+ unsigned char font_8x8[2048] =
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E,
+ 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E,
+ 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00,
+ 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00,
+ 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x92, 0x10, 0x7C,
+ 0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C,
+ 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00,
+ 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF,
+ 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00,
+ 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF,
+ 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78,
+ 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18,
+ 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0,
+ 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0,
+ 0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99,
+ 0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00,
+ 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00,
+ 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00,
+ 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00,
+ 0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0x86, 0xFC,
+ 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00,
+ 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF,
+ 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00,
+ 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00,
+ 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00,
+ 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00,
+ 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00,
+ 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00,
+ 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00,
+ 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00,
+ 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00,
+ 0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00,
+ 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00,
+ 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00,
+ 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00,
+ 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
+ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,
+ 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30,
+ 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
+ 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00,
+ 0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00,
+ 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00,
+ 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00,
+ 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00,
+ 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00,
+ 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00,
+ 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00,
+ 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00,
+ 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00,
+ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00,
+ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30,
+ 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00,
+ 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00,
+ 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00,
+ 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00,
+ 0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00,
+ 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00,
+ 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00,
+ 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00,
+ 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00,
+ 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00,
+ 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00,
+ 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00,
+ 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00,
+ 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00,
+ 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00,
+ 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00,
+ 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00,
+ 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00,
+ 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00,
+ 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
+ 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00,
+ 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00,
+ 0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00,
+ 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
+ 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00,
+ 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00,
+ 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00,
+ 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00,
+ 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
+ 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00,
+ 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
+ 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
+ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00,
+ 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00,
+ 0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00,
+ 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
+ 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00,
+ 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78,
+ 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00,
+ 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00,
+ 0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
+ 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0,
+ 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E,
+ 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00,
+ 0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00,
+ 0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00,
+ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
+ 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00,
+ 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00,
+ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
+ 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00,
+ 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00,
+ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
+ 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00,
+ 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00,
+ 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x0C, 0x06, 0x7C,
+ 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0x7E, 0x81, 0x3C, 0x06, 0x3E, 0x66, 0x3B, 0x00,
+ 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x78, 0x0C, 0x38,
+ 0x7E, 0x81, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00,
+ 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x7C, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00,
+ 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0xC6, 0x10, 0x7C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00,
+ 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
+ 0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00,
+ 0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00,
+ 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00,
+ 0x78, 0x84, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x78, 0x84, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
+ 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00,
+ 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00,
+ 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18,
+ 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00,
+ 0xCC, 0xCC, 0x78, 0x30, 0xFC, 0x30, 0xFC, 0x30,
+ 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC3,
+ 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70,
+ 0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0xF8, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0x00,
+ 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00,
+ 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00,
+ 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00,
+ 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3C, 0x00,
+ 0x00, 0x00, 0x00, 0xFC, 0xC0, 0xC0, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00,
+ 0xC6, 0xCC, 0xD8, 0x36, 0x6B, 0xC2, 0x84, 0x0F,
+ 0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6D, 0xCF, 0x03,
+ 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00,
+ 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00,
+ 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00,
+ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88,
+ 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
+ 0xDB, 0xF6, 0xDB, 0x6F, 0xDB, 0x7E, 0xD7, 0xED,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18,
+ 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18,
+ 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00,
+ 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36,
+ 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36,
+ 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00,
+ 0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0,
+ 0x00, 0xFC, 0xCC, 0xC0, 0xC0, 0xC0, 0xC0, 0x00,
+ 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x00,
+ 0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00,
+ 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00,
+ 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0,
+ 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00,
+ 0xFC, 0x30, 0x78, 0xCC, 0xCC, 0x78, 0x30, 0xFC,
+ 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00,
+ 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00,
+ 0x1C, 0x30, 0x18, 0x7C, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00,
+ 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0,
+ 0x38, 0x60, 0xC0, 0xF8, 0xC0, 0x60, 0x38, 0x00,
+ 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
+ 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00,
+ 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00,
+ 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00,
+ 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00,
+ 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70,
+ 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00,
+ 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00,
+ 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C,
+ 0x58, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00,
+ 0x70, 0x98, 0x30, 0x60, 0xF8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+
+ void Print_8x8_Mono( int x, int y, unsigned char c )
+ {
+ int offset, i;
+ unsigned char* bitm;
+
+ if ( !Vio )
+ return;
+
+ offset = x + y * vio_ScanLineWidth * 8;
+ bitm = font_8x8 + (int)c * 8;
+
+ for ( i = 0; i < 8; i++ )
+ {
+ dosmemput( bitm, 1, (unsigned long)(Vio+offset) );
+ bitm++;
+ offset += vio_ScanLineWidth;
+ }
+ }
+
+
+ void Print_8x8_Gray( int x, int y, unsigned char c )
+ {
+ int offset, i, bit;
+ unsigned char * bitm, black = 0, white = 0xF;
+
+ if ( !Vio )
+ return;
+
+ offset = x * 8 + y * vio_ScanLineWidth * 8;
+ bitm = font_8x8 + (int)c * 8;
+
+ for ( i = 0; i < 8; i++ )
+ {
+ bit = 0x80;
+ while ( bit > 0 )
+ {
+ if ( bit & *bitm )
+ dosmemput( &white, 1, (unsigned long)(Vio+offset) );
+ else
+ dosmemput( &black, 1, (unsigned long)(Vio+offset) );
+
+ bit >>= 1;
+ offset++;
+ }
+ offset += vio_ScanLineWidth - 8;
+ bitm++;
+ }
+ }
+
+
+ int SetGraphScreen( int mode )
+ {
+ gcursor_x = 0;
+ gcursor_y = 0;
+
+ switch( mode )
+ {
+ case Graphics_Mode_Mono:
+ if ( !Driver_Set_Graphics( mode ) )
+ return FAILURE;
+
+ gwindow_width = vio_ScanLineWidth;
+ gwindow_height = vio_Height / 8;
+
+ Print_8x8_Char = Print_8x8_Mono;
+ break;
+
+ case Graphics_Mode_Gray:
+ if ( !Driver_Set_Graphics( mode ) )
+ return FAILURE;
+
+ gwindow_width = vio_ScanLineWidth / 8;
+ gwindow_height = vio_Height / 8;
+
+ Print_8x8_Char = Print_8x8_Gray;
+ break;
+
+ default:
+ /* Invalid function call */
+ return FAILURE;
+ }
+
+ return SUCCESS;
+ }
+
+
+ /* restore previous (or text) video mode */
+
+ int RestoreScreen( void )
+ {
+ gcursor_x = 0;
+ gcursor_y = 0;
+ gwindow_height = 0;
+ gwindow_height = 0;
+
+ return Driver_Restore_Mode();
+ }
+
+
+ void Display_Bitmap_On_Screen( char* buffer, int line, int col )
+ {
+ Driver_Display_Bitmap( buffer, line, col );
+ }
+
+
+ void Goto_XY( int x, int y )
+ {
+ gcursor_x = x;
+ gcursor_y = y;
+ }
+
+
+ void Print_Str( char* string )
+ {
+ if ( !string ) return;
+
+ while ( *string )
+ {
+ switch ( *string )
+ {
+ case '\n':
+ gcursor_x = 0;
+ gcursor_y++;
+ if ( gcursor_y > gwindow_height ) gcursor_y = 0;
+ break;
+
+ default:
+ (*Print_8x8_Char)( gcursor_x, gcursor_y, *string );
+
+ gcursor_x++;
+
+ if ( gcursor_x >= gwindow_width )
+ {
+ gcursor_x = 0;
+ gcursor_y++;
+
+ if ( gcursor_y >= gwindow_height ) gcursor_y = 0;
+ }
+ }
+ string++;
+ }
+ }
+
+
+ void Print_XY( int x, int y, char* string )
+ {
+ Goto_XY( x, y );
+ Print_Str( string );
+ }
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/msdos/makedep b/Build/source/libs/freetype/test/arch/msdos/makedep
new file mode 100755
index 00000000000..cb1aabbaeb7
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/makedep
@@ -0,0 +1,35 @@
+# makedep
+#
+# This shell script creates a dependency file necessary for older compilers
+# on the MS-DOS platform.
+#
+# Copyright 1996-2002 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.
+
+echo "\
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in \`makedep'...
+#
+# This dependency file to be used with various MS-DOS compilers
+# has been generated automatically with the script \`makedep' on
+# `date +%Y-%m-%d`.
+" > depend.dos
+
+(cd ../..
+ gcc -MM -I../lib/arch/msdos -I../lib -I../lib/extend -I. *.c | \
+ sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.dos
+
+(cd ../..
+ gcc -MM -I../lib/arch/msdos -I../lib -I../lib/extend -I. \
+ -Dreg_ax -Dint86 arch/msdos/*.c | \
+ sed -e "s/^\(.*\)\.o:/arch\\\\msdos\\\\\1.obj:/" \
+ -e "s:/:\\\\:g") >> depend.dos
+
+# eof
diff --git a/Build/source/libs/freetype/test/arch/msdos/time_tc.h b/Build/source/libs/freetype/test/arch/msdos/time_tc.h
new file mode 100644
index 00000000000..cef288aec2d
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/msdos/time_tc.h
@@ -0,0 +1,124 @@
+/*******************************************************************
+ *
+ * time.h Replacement for buggy <time.h> of old Turbo C compilers
+ *
+ * This file is a hack! It replaces <time.h> when compiling with
+ * old versions of Borland Turbo C compilers that lack clock(),
+ * and provide its own version.
+ *
+ * Written by Antoine Leca
+ * Copyright 1999-2000 Antoine Leca,
+ * 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.
+ *
+ ******************************************************************/
+
+#if !defined __TURBOC__ || !defined __MSDOS__ || __TURBOC__>0x220
+/*
+ * We are not running on a Borland compiler, or either on
+ * a recent version that does not need the hack.
+ * Certainly the user does not clean up the directory.
+ * Stop the compilation.
+ */
+#error Remove the file time.h in directory test
+
+#endif
+
+#ifndef _TIME_H_DEFINED
+#define _TIME_H_DEFINED
+
+#if defined _TM_DEFINED || defined _TIME_T
+#error Another version of <time.h> seems to have been already included
+#endif
+
+#ifndef __TIME_T
+#define __TIME_T
+typedef long time_t;
+#endif
+
+#ifndef __CLOCK_T
+#define __CLOCK_T
+typedef long clock_t;
+#define CLK_TCK 18.2
+#endif
+
+#define CLOCKS_PER_SEC CLK_TCK
+
+struct tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+};
+
+
+clock_t clock (void);
+double difftime(time_t time2, time_t time1);
+time_t time (time_t *timer);
+
+char *asctime (const struct tm *tblock);
+char *ctime (const time_t *time);
+struct tm *gmtime (const time_t *timer);
+struct tm *localtime(const time_t *timer);
+
+
+#if __TURBOC__ <= 0x0150
+
+/*******************************************************************
+ *
+ * Function : clock
+ *
+ * Description : Turbo C v.1.x lacks the clock() function that is
+ * needed for at least fttimer.
+ * So this is a replacement that does more or less
+ * the functionnality of clock(), using the BIOS.
+ * Since we do not know exactly when the process
+ * started (as clock() is supposed to do), we cheat
+ * a little here.
+ *
+ * Input : None
+ *
+ * Output : None
+ *
+ * Notes : Use two static objects.
+ * NEED_CLOCK_HERE is a macro that should be defined
+ * in only ONE module (otherwise, the linker will complain).
+ *
+ ******************************************************************/
+
+extern long biostime(int cmd, long newtime);
+
+static long CountOfTicks;
+static long DateOfReference = 0;
+
+clock_t clock (void)
+{
+
+ if (DateOfReference == 0) /* this is the first call */
+ {
+ DateOfReference = time(NULL) / 86400L;
+ CountOfTicks = biostime(0,0L) - CLOCKS_PER_SEC;
+ /* pretend we start one second ago */
+ return CLOCKS_PER_SEC; /* to avoid returning 0 */
+ }
+
+ return (time(NULL) / 86400L - DateOfReference) * 0x1800B0L
+ + biostime(0,0L) - CountOfTicks;
+}
+
+#endif /* Turbo C v.1.x */
+
+#endif /* defined __TIME_H_DEFINED */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/os2/Makefile.dm b/Build/source/libs/freetype/test/arch/os2/Makefile.dm
new file mode 100644
index 00000000000..9c5c0cce689
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/Makefile.dm
@@ -0,0 +1,153 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc under OS/2
+#
+# You will need dmake.
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# dmake -r -f arch/os2/Makefile.dm
+#
+#
+# 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.
+
+ARCH = arch/os2
+FT_MAKEFILE = $(ARCH)/Makefile.dm
+FT_MAKE = dmake -r
+
+.IMPORT: COMSPEC
+SHELL := $(COMSPEC)
+SHELLFLAGS := /c
+GROUPSHELL := $(SHELL)
+GROUPFLAGS := $(SHELLFLAGS)
+GROUPSUFFIX := .cmd
+SHELLMETAS := *"?<>&|
+
+CC = gcc
+
+LIBDIR = ../lib
+LIBDIR_OS2 = $(subst,/,\ $(LIBDIR))
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend
+
+# CFLAGS = -Wall -ansi -O2 -g $(INCDIRS)
+CFLAGS = -ansi -Wall -O2 -s -Zcrtdll $(INCDIRS)
+
+# full-screen MSDOS driver
+GFSDRIVER = $(ARCH)/gfs_os2.c
+GPMDRIVER = $(ARCH)/gpm_os2.c
+GPM_DEF = $(ARCH)/gpm_os2.def
+
+DISPLAY = display.c
+
+SRC = ftlint.c fttimer.c ftview.c ftzoom.c ftdump.c ftstring.c ftstrpnm.c \
+ ftsbit.c common.c blitter.c ftmetric.c ftstrtto.c arabic.c textdisp.c
+
+GSRC = gmain.c display.c blitter.c
+GFSSRC = $(GSRC) $(GFSDRIVER)
+GPMSRC = $(GSRC) $(GPMDRIVER)
+
+GFSOBJ = $(GFSSRC:.c=.o)
+GPMOBJ = $(GPMSRC:.c=.o)
+
+ALLSRC = $(SRC) $(GSRC) $(GFSDRIVER) $(GPMDRIVER)
+ALLOBJ = $(ALLSRC:.c=.o)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.exe:
+ $(CC) $(CFLAGS) -o $@ @$(mktmp $(&:t"\n")\n)
+
+
+EXEFILES = ftview.exe ftviewfs.exe \
+ ftlint.exe \
+ fttimer.exe fttimefs.exe \
+ ftdump.exe \
+ ftstring.exe ftstrfs.exe \
+ ftzoom.exe ftzoomfs.exe \
+ ftstrpnm.exe \
+ ftsbit.exe \
+ ftmetric.exe \
+ ftstrtto.exe ftstrtfs.exe
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean do_distclean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+
+freetype:
+[
+ cd $(LIBDIR_OS2)
+ $(FT_MAKE) -f $(FT_MAKEFILE) all
+ cd $(MAKEDIR)
+]
+
+freetype_debug:
+[
+ cd $(LIBDIR_OS2)
+ $(FT_MAKE) -f $(FT_MAKEFILE) debug
+ cd $(MAKEDIR)
+]
+
+ftzoom.exe: $(GPMOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+ftzoomfs.exe: $(GFSOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview.exe: $(GPMOBJ) ftview.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+ftviewfs.exe: $(GFSOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint.exe: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump.exe: ftdump.o common.o $(LIBDIR)/libttf.a
+ftstring.exe: $(GPMOBJ) ftstring.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+ftstrfs.exe: $(GFSOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+ftstrpnm.exe: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+fttimer.exe: $(GPMOBJ) fttimer.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+fttimefs.exe: $(GFSOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftsbit.exe: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftmetric.exe: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto.exe: $(GPMOBJ) ftstrtto.o common.o arabic.o \
+ $(LIBDIR)/libttf.a $(GPM_DEF)
+ftstrtfs.exe: $(GFSOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+[
+ cd $(LIBDIR_OS2)
+ $(FT_MAKE) -f $(FT_MAKEFILE) clean
+ cd $(MAKEDIR)
+]
+
+distclean: do_clean do_distclean
+[
+ cd $(LIBDIR_OS2)
+ $(FT_MAKE) -f $(FT_MAKEFILE) distclean
+ cd $(MAKEDIR)
+]
+
+do_distclean:
+ -+del dep.end $(EXEFILES) core
+
+do_clean:
+ -+del $(subst,/,\ $(ALLOBJ))
+
+# depend: $(ALLSRC)
+#[
+# cd $(LIBDIR_OS2)
+# $(FT_MAKE) -f $(FT_MAKEFILE) depend
+# cd $(MAKEDIR)
+# $(CC) -E -M $(INCDIRS) @$(mktmp $(<:t"\n")\n) > dep.end
+#]
+#
+# ifeq (dep.end,$(wildcard dep.end))
+# include dep.end
+# endif
+
+# end of Makefile.dm
diff --git a/Build/source/libs/freetype/test/arch/os2/Makefile.emx b/Build/source/libs/freetype/test/arch/os2/Makefile.emx
new file mode 100644
index 00000000000..b7382f7d9a1
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/Makefile.emx
@@ -0,0 +1,119 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for emx-gcc under OS/2.
+#
+# You will need GNU make.
+#
+# Use this file while in the 'test' directory with the following statements:
+#
+# make -f arch/os2/Makefile.emx depend
+# make -f arch/os2/Makefile.emx
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/os2
+FT_MAKEFILE = $(ARCH)/Makefile.emx
+
+CC = gcc
+
+LIBDIR = ../lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/extend -I$(LIBDIR)/$(ARCH) -I.
+
+CFLAGS = -Wall -ansi -O0 -g $(INCDIRS)
+# CFLAGS = -ansi -Wall -O2 -s -Zcrtdll $(INCDIRS)
+
+GFSDRIVER = $(ARCH)/gfs_os2.c
+GPMDRIVER = $(ARCH)/gpm_os2.c
+GPM_DEF = $(ARCH)/gpm_os2.def
+
+SRC = fttimer.c ftview.c ftlint.c ftzoom.c ftdump.c ftstring.c ftstrpnm.c \
+ ftsbit.c common.c blitter.c ftmetric.c ftstrtto.c arabic.c textdisp.o
+
+GSRC = gmain.c display.c blitter.c
+GFSSRC = $(GSRC) $(GFSDRIVER)
+GPMSRC = $(GSRC) $(GPMDRIVER)
+GFSOBJ = $(GFSSRC:.c=.o)
+GPMOBJ = $(GPMSRC:.c=.o)
+
+ALLSRC = $(SRC) $(GSRC) $(GFSDRIVER) $(GPMDRIVER)
+ALLOBJ = $(ALLSRC:.c=.o)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $^
+
+
+EXEFILES = ftview.exe ftviewfs.exe \
+ fttimer.exe fttimefs.exe \
+ ftlint.exe \
+ ftstring.exe ftstrfs.exe \
+ ftstrpnm.exe \
+ ftzoom.exe ftzoomfs.exe \
+ ftsbit.exe \
+ ftdump.exe \
+ ftmetric.exe \
+ ftstrtto.exe ftstrtfs.exe
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all
+
+freetype_debug:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug
+
+ftzoom.exe: $(GPMOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+ftzoomfs.exe: $(GFSOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview.exe: $(GPMOBJ) ftview.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+ftviewfs.exe: $(GFSOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint.exe: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump.exe: ftdump.o common.o $(LIBDIR)/libttf.a
+ftstring.exe: $(GPMOBJ) ftstring.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+ftstrfs.exe: $(GFSOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+ftstrpnm.exe: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+fttimer.exe: $(GPMOBJ) fttimer.o common.o $(LIBDIR)/libttf.a $(GPM_DEF)
+fttimefs.exe: $(GFSOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftsbit.exe: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftmetric.exe: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto.exe: $(GPMOBJ) ftstrtto.o common.o arabic.o \
+ $(LIBDIR)/libttf.a $(GPM_DEF)
+ftstrtfs.exe: $(GFSOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean
+
+distclean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
+ -del dep.end $(EXEFILES) core
+
+do_clean:
+ -del $(subst /,\,$(ALLOBJ))
+
+
+depend: $(ALLSRC)
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
+ $(CC) -E -MM $(INCDIRS) $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.emx
diff --git a/Build/source/libs/freetype/test/arch/os2/Makefile.icc b/Build/source/libs/freetype/test/arch/os2/Makefile.icc
new file mode 100644
index 00000000000..8e772b475ed
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/Makefile.icc
@@ -0,0 +1,157 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for IBM VisualAge C++ under OS/2.
+#
+# You will need nmake.
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# nmake -f arch\os2\Makefile.icc
+#
+#
+# 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.
+
+ARCH = arch\os2
+FT_MAKEFILE = $(ARCH)\Makefile.icc
+FT_MAKE = $(MAKE) -nologo
+
+CC = icc
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\extend -I$(LIBDIR)\$(ARCH) -I.
+CFLAGS = -O+ -Gd+ -Gn+ -Gl+ -Ti- -Tm- -Q+ -Wpro- -Wcnd- $(INCDIRS)
+
+# Fullscreen OS/2 driver
+GFSDRIVER_SRC = $(ARCH)\gfs_os2.c
+GFSDRIVER = $(ARCH)\gfs_os2.obj
+
+# PM OS/2 Driver
+GPMDRIVER = $(ARCH)\gpm_os2.obj
+GPMDRIVER_SRC = $(ARCH)\gpm_os2.c
+GPM_DEF = $(ARCH)\gpm_os2.def
+
+SRC = gmain.c display.c common.c arabic.c textdisp.c \
+ ftzoom.c ftview.c fttimer.c ftlint.c ftdump.c ftstring.c \
+ ftstrpnm.c ftsbit.c ftmetric.c ftstrtto.c \
+ $(GFSDRIVER_SRC)
+
+COMMON = common.obj
+GFSOBJS = gmain.obj display.obj $(GFSDRIVER) $(COMMON) blitter.obj
+GPMOBJS = gmain.obj display.obj $(GPMDRIVER) $(COMMON) blitter.obj
+OBJ1 = ftzoom.obj
+OBJ2 = fttimer.obj
+OBJ3 = ftview.obj
+OBJ4 = ftlint.obj
+OBJ5 = ftdump.obj
+OBJ6 = ftstring.obj
+OBJ7 = ftstrpnm.obj
+OBJ8 = ftsbit.obj
+OBJ9 = ftmetric.obj
+OBJ10 = ftstrtto.obj
+OBJ11 = arabic.obj
+OBJ12 = textdisp.obj
+
+
+EXEFILES = fttimefs.exe fttimer.exe \
+ ftzoom.exe ftzoomfs.exe \
+ ftviewfs.exe ftview.exe \
+ ftlint.exe \
+ ftdump.exe \
+ ftstring.exe ftstrfs.exe \
+ ftstrpnm.exe \
+ ftsbit.exe \
+ ftmetric.exe \
+ ftstrtto.exe ftstrtfs.exe
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+
+freetype:
+ cd $(LIBDIR)
+ $(FT_MAKE) -f $(FT_MAKEFILE) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ $(FT_MAKE) -f $(FT_MAKEFILE) debug
+ cd ..\test
+
+$(GFSDRIVER): $(GFSDRIVER_SRC)
+ $(CC) $(CFLAGS) /c /Fo$@ $** -I.
+
+$(GPMDRIVER): $(GPMDRIVER_SRC)
+ $(CC) $(CFLAGS) /c /Fo$@ $** -I.
+
+ftzoomfs.exe: $(GFSOBJS) $(OBJ1) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftzoom.exe: $(GPMOBJS) $(OBJ1) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) $(GPM_DEF) /Fe$@ $**
+
+fttimefs.exe: $(GFSOBJS) $(OBJ2) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+fttimer.exe: $(GPMOBJS) $(OBJ2) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) $(GPM_DEF) /Fe$@ $**
+
+ftviewfs.exe: $(GFSOBJS) $(OBJ3) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftview.exe: $(GPMOBJS) $(OBJ3) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) $(GPM_DEF) /Fe$@ $**
+
+ftlint.exe: $(OBJ4) $(LIBDIR)\libttf.lib $(COMMON)
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftdump.exe: $(OBJ5) $(LIBDIR)\libttf.lib $(COMMON)
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftstrfs.exe: $(GFSOBJS) $(OBJ6) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftstring.exe: $(GPMOBJS) $(OBJ6) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) $(GPM_DEF) /Fe$@ $**
+
+ftstrpnm.exe: $(OBJ7) $(LIBDIR)\libttf.lib $(COMMON)
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftsbit.exe: $(OBJ8) $(OBJ12) $(LIBDIR)\libttf.lib $(COMMON)
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftmetric.exe: $(OBJ9) $(OBJ12) $(LIBDIR)\libttf.lib $(COMMON)
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftstrtfs.exe: $(GFSOBJS) $(OBJ10) $(OBJ11) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) /Fe$@ $**
+
+ftstrtto.exe: $(GPMOBJS) $(OBJ10) $(OBJ11) $(LIBDIR)\libttf.lib
+ $(CC) $(CFLAGS) $(GPM_DEF) /Fe$@ $**
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) -f $(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) -f $(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+
+do_clean:
+ -del *.obj
+ -del $(GFSDRIVER)
+ -del $(GPMDRIVER)
+
+# end of Makefile.icc
diff --git a/Build/source/libs/freetype/test/arch/os2/Makefile.wat b/Build/source/libs/freetype/test/arch/os2/Makefile.wat
new file mode 100644
index 00000000000..4b9fe07277c
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/Makefile.wat
@@ -0,0 +1,172 @@
+# This file is part of the FreeType project
+#
+# This builds the test programs with the Watcom compiler
+#
+# You'll need Watcom's wmake
+#
+# Invoke by "wmake -f arch\os2\Makefile.wat" when in the "test" directory
+#
+#
+# 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 compiler did compile early versions of the FreeType package.
+# While we tried our best to maintain the makefiles, the development team
+# does not have currently access to a copy of this compiler, and we did not
+# receive notices of successful builts since many years. So be prepared
+# to have some problems; and if it works for you, or if you can upgrade the
+# package in any way, please notify us!
+
+ARCH = arch\os2
+FT_MAKEFILE = $(ARCH)\Makefile.wat
+FT_MAKE = wmake -h
+
+.EXTENSIONS:
+.EXTENSIONS: .exe .obj .c .h
+.obj:.
+.c:.
+.h:.;..\lib
+
+CC = wcl386
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\$(ARCH) -I$(LIBDIR)\extend
+LIBFILE = $(LIBDIR)\libttf.lib
+
+LINK_OPTS =
+
+OBJ_CFLAGS = /c /otexanl+ /s /w4 /zq $(INCDIRS)
+
+CCFLAGS = /otexanl+ /s /w4 /zq $(INCDIRS)
+
+GFSDRIVER = $(ARCH)\gfs_os2.obj
+GFSDRIVER_SRC = $(ARCH)\gfs_os2.c
+
+GPMDRIVER = $(ARCH)\gpm_os2.obj
+GPMDRIVER_SRC = $(ARCH)\gpm_os2.c
+GPMDRIVER_DEF = $(ARCH)\gpm_os2.def
+
+SRC = gmain.c display.c blitter.c textdisp.c &
+ fttimer.c ftview.c ftlint.c ftzoom.c ftdump.c ftstring.c &
+ ftstrpnm.c ftsbit.c ftmetric.c ftstrtto.c &
+ $(GPMDRIVER_SRC) $(GFSDRIVER_SRC)
+
+GFSOBJ = gmain.obj $(GFSDRIVER) blitter.obj display.obj
+GPMOBJ = gmain.obj $(GPMDRIVER) blitter.obj display.obj
+
+PM = $(LIBFILE) $(GPMOBJ) common.obj
+FS = $(LIBFILE) $(GFSOBJ) common.obj
+
+
+# graphics utility and test driver
+
+EXEFILES = ftview.exe ftviewfs.exe &
+ fttimer.exe fttimefs.exe &
+ ftlint.exe &
+ ftdump.exe &
+ ftstring.exe ftstrfs.exe &
+ ftzoom.exe ftzoomfs.exe &
+ ftstrpnm.exe &
+ ftsbit.exe &
+ ftmetric.exe &
+ ftstrtto.exe ftstrtfs.exe
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+
+freetype: .symbolic
+ cd ..\lib
+ $(FT_MAKE) -f $(FT_MAKEFILE) all
+ cd ..\test
+
+freetype_debug: .symbolic
+ cd ..\lib
+ $(FT_MAKE) -f $(FT_MAKEFILE) debug
+ cd ..\test
+
+# implicit rules
+#
+.c.obj :
+ $(CC) $(OBJ_CFLAGS) $[* /fo=$[*.obj
+
+
+# the full-screen graphics driver
+#
+$(GFSDRIVER): $(GFSDRIVER_SRC)
+ $(CC) $(OBJ_CFLAGS) $[*.c /fo=$[*.obj
+
+# the pm graphics driver
+#
+$(GPMDRIVER): $(GPMDRIVER_SRC)
+ $(CC) $(OBJ_CFLAGS) $[*.c /fo=$[*.obj
+
+ftzoom.exe : ftzoom.obj $(LIBFILE) $(PM) $(GPMDRIVER_DEF)
+ $(CC) $(CCFLAGS) -l=os2v2_pm $(PM) $[*.c /fe=$[*.exe
+
+ftzoomfs.exe : ftzoom.obj $(LIBFILE) $(FS)
+ $(CC) $(CCFLAGS) $(FS) $[@ /fe=ftzoomfs.exe
+
+ftview.exe : ftview.obj $(LIBFILE) $(PM) $(GPMDRIVER_DEF)
+ $(CC) $(CCFLAGS) -l=os2v2_pm $(PM) $[*.c /fe=$[*.exe
+
+ftviewfs.exe : ftview.obj $(LIBFILE) $(FS)
+ $(CC) $(CCFLAGS) $(FS) $[*.c /fe=ftviewfs.exe
+
+ftstring.exe : ftstring.obj $(LIBFILE) $(PM) $(GPMDRIVER_DEF)
+ $(CC) $(CCFLAGS) -l=os2v2_pm $(PM) $[*.c /fe=$[*.exe
+
+ftstrfs.exe : ftstring.obj $(LIBFILE) $(FS)
+ $(CC) $(CCFLAGS) $(FS) $[*.c /fe=ftstrfs.exe
+
+fttimer.exe: fttimer.obj $(LIBFILE) $(PM) $(GPMDRIVER_DEF)
+ $(CC) $(CCFLAGS) -l=os2v2_pm $(PM) $[*.c /fe=$[*.exe
+
+fttimefs.exe: fttimer.obj $(LIBFILE) $(FS)
+ $(CC) $(CCFLAGS) $(FS) $[*.c /fe=fttimefs.exe
+
+ftlint.exe: ftlint.obj $(LIBFILE)
+ $(CC) $(CCFLAGS) $(LIBFILE) common.obj $[*.c /fe=$[*.exe
+
+ftdump.exe: ftdump.obj $(LIBFILE)
+ $(CC) $(CCFLAGS) $(LIBFILE) common.obj $[*.c /fe=$[*.exe
+
+ftstrpnm.exe: ftstrpnm.obj $(LIBFILE)
+ $(CC) $(CCFLAGS) $(LIBFILE) common.obj $[*.c /fe=$[*.exe
+
+ftsbit.exe: ftsbit.obj textdisp.obj $(LIBFILE)
+ $(CC) $(CCFLAGS) $(LIBFILE) common.obj textdisp.obj $[*.c /fe=$[*.exe
+
+ftmetric.exe: ftmetric.obj textdisp.obj $(LIBFILE)
+ $(CC) $(CCFLAGS) $(LIBFILE) common.obj textdisp.obj $[*.c /fe=$[*.exe
+
+ftstrtto.exe : ftstrtto.obj arabic.obj $(LIBFILE) $(PM) $(GPMDRIVER_DEF)
+ $(CC) $(CCFLAGS) -l=os2v2_pm $(PM) $[*.c /fe=$[*.exe
+
+ftstrtfs.exe : ftstrtto.obj arabic.obj $(LIBFILE) $(FS)
+ $(CC) $(CCFLAGS) $(FS) $[*.c /fe=ftstrtfs.exe
+
+
+clean: .symbolic
+ @-erase *.obj
+ @-erase $(ARCH)\*.obj
+
+distclean: .symbolic clean
+ @-erase *.exe
+ @-erase *.err
+ cd ..\lib
+ $(FT_MAKE) -f $(FT_MAKEFILE) distclean
+ cd ..\test
+
+new: .symbolic
+ @-wtouch *.c
+
+# end of Makefile.wat
diff --git a/Build/source/libs/freetype/test/arch/os2/gfs_os2.c b/Build/source/libs/freetype/test/arch/os2/gfs_os2.c
new file mode 100644
index 00000000000..954cf1b06ae
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/gfs_os2.c
@@ -0,0 +1,219 @@
+/*******************************************************************
+ *
+ * gfs_os2.c graphics utility fullscreen OS/2 driver. 1.0
+ *
+ * This is the driver for fullscreen OS/2 display, used by the
+ * graphics utility of the FreeType test suite.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define INCL_SUB
+#include <os2.h>
+
+#ifdef __EMX__
+#include <os2thunk.h>
+#endif
+
+#if defined(__EMX__)||defined(__IBMC__)
+#include <conio.h> /* for getch */
+ extern _read_kbd(); /* to avoid an ANSI warning during compilation */
+#endif
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+
+ static VIOMODEINFO OrgMode;
+ static long VioBufOfs;
+
+
+ /* BIOS video modes */
+
+ static VIOMODEINFO VioMode_640x480x16 =
+ {
+ sizeof ( VIOMODEINFO ),
+ VGMT_OTHER + VGMT_GRAPHICS,
+ COLORS_16,
+ 80,
+ 35,
+ 640,
+ 480
+ };
+
+ static VIOMODEINFO VioMode_320x200x256 =
+ {
+ sizeof ( VIOMODEINFO ),
+ VGMT_OTHER + VGMT_GRAPHICS,
+ 8,
+ 40,
+ 25,
+ 320,
+ 200
+ };
+
+ static VIOPHYSBUF VioBuf =
+ {
+ (void*)0xA0000L,
+ 64*1024
+ };
+
+
+ /* Restores screen to its original state */
+
+ int Driver_Restore_Mode()
+ {
+ VioSetMode( &OrgMode, 0 );
+ return 1;
+ }
+
+
+ /* Sets graphics mode */
+
+ int Driver_Set_Graphics( int mode )
+ {
+ int rc;
+
+
+ OrgMode.cb = sizeof ( VIOMODEINFO );
+ VioGetMode( &OrgMode, 0 );
+
+ switch ( mode )
+ {
+ case Graphics_Mode_Mono:
+ rc = VioSetMode( &VioMode_640x480x16, 0 );
+ vio_ScanLineWidth = 80;
+ vio_Width = 640;
+ vio_Height = 480;
+ break;
+
+ case Graphics_Mode_Gray:
+ rc = VioSetMode( &VioMode_320x200x256, 0 );
+ vio_ScanLineWidth = 320;
+ vio_Width = 320;
+ vio_Height = 200;
+
+ /* default gray_palette takes the gray levels of the standard VGA */
+ /* 256 colors mode */
+
+ gray_palette[0] = 0;
+ gray_palette[1] = 23;
+ gray_palette[2] = 27;
+ gray_palette[3] = 29;
+ gray_palette[4] = 31;
+ break;
+
+ default:
+ rc = -1;
+ break;
+ }
+
+ if ( rc ) return 0; /* failure */
+
+ if ( VioGetPhysBuf( &VioBuf, 0 ) ) return 0; /* Could not access VRAM */
+
+ VioBufOfs = (long)MAKEP( VioBuf.asel[0], 0 );
+
+ memset( (void*)VioBufOfs, 0, 64 * 1024 );
+
+ Vio = (char*)VioBufOfs;
+
+ return 1; /* success */
+ }
+
+
+ int Driver_Display_Bitmap( char* buffer, int line, int col )
+ {
+ int y;
+ char* target;
+
+ target = Vio + ( line - 1 ) * vio_ScanLineWidth;
+
+ for ( y = 0; y < line; y++ )
+ {
+ memcpy( target, buffer, col );
+ target -= vio_ScanLineWidth;
+ buffer += col;
+ }
+
+ return 1; /* success */
+ }
+
+
+ void Get_Event( TEvent* event )
+ {
+ int i;
+ char c;
+
+
+ c = getch();
+
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ event->what = trans[i].event_class;
+ event->info = trans[i].event_info;
+ return;
+ }
+ }
+
+ /* unrecognized keystroke */
+
+ event->what = event_Keyboard;
+ event->info = (int)c;
+ return;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/os2/gpm_os2.c b/Build/source/libs/freetype/test/arch/os2/gpm_os2.c
new file mode 100644
index 00000000000..22ed397363f
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/gpm_os2.c
@@ -0,0 +1,654 @@
+/*******************************************************************
+ *
+ * gpm_os2.c graphics OS/2 Presentation Manager Window driver. 0.2
+ *
+ * This is the driver for windowed OS/2 display, used by the
+ * graphics utility of the FreeType test suite.
+ *
+ * written by Eric Olson (eolson@imag.net)
+ *
+ * Borrowing liberally from the other FreeType drivers.
+ * Some bitmap manipulations are derived from fastgpi.c,
+ * a sample program written by Donald Graft (dgraft@gate.net).
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define INCL_DOS
+#define INCL_WIN
+#define INCL_GPI
+#define INCL_SUB
+
+#include <os2.h>
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+#define VIO_WIDTH 640u /* these can be changed but VIO_WIDTH should remain */
+#define VIO_HEIGHT 360u /* for now a multiple of 32 to avoid padding issues */
+#define MAG_WIDTH VIO_WIDTH
+#define MAG_HEIGHT 120u
+#define MAX_MAG 16 /* should be less than Min(MAG_WIDTH, MAG_HEIGHT) */
+
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+
+ static HAB habt;
+ static HAB hab;
+ static HWND hwndFrame, hwndClient;
+ static HWND hwndTitle;
+ static HDC hdcMemory;
+ static HPS hpsMemory = (HPS) NULL;
+
+ /* Threads and semaphores */
+ TID MessageThread;
+ HMTX hmtxPSMemoryLock;
+ HEV hevKeyLock;
+
+ /* Bitmap information */
+ static PBITMAPINFO2 pbmi;
+ static HBITMAP hbm;
+ BYTE Bitmap[VIO_WIDTH * VIO_HEIGHT];
+ BOOL ready = FALSE;
+
+ /* Coordinates for the bitblt of whole graphic area */
+ POINTL aptlFull[4] = {{ 0u, MAG_HEIGHT },
+ { VIO_WIDTH, VIO_HEIGHT + MAG_HEIGHT },
+ { 0u, 0u },
+ { VIO_WIDTH, VIO_HEIGHT }};
+
+ /* Coordinates for the magnification bitblt */
+ POINTL aptlMagd[4] = {{ 0u, 0u },
+ { MAG_WIDTH, MAG_HEIGHT }, /* target */
+ { 0u, 0u },
+ { VIO_WIDTH, VIO_HEIGHT }}; /* source */
+
+ /* level of magnification and center of magnification window */
+ static int magnification=1;
+ static POINTL view_target = {0, 0};
+ static SIZEL mag_win_size;
+
+ /* local event to pass on */
+ TEvent ourevent = { event_Rotate_Glyph, 0 };
+
+ /* grayscale vs b/w mode */
+ int Colourmode;
+
+ /* array defined in the test programs */
+ extern char Header[];
+
+
+ void RunPMWindow( ULONG );
+ MRESULT EXPENTRY Message_Process( HWND, ULONG, MPARAM, MPARAM );
+
+
+
+ /* restores screen to its original state */
+
+ int Driver_Restore_Mode()
+ {
+ /* PMWindow has probably already destroyed itself */
+ if ( hwndFrame )
+ WinDestroyWindow( hwndFrame );
+
+ WinReleasePS( hpsMemory );
+ WinTerminate( habt );
+
+ return 1;
+ }
+
+
+ /* set graphics mode */
+
+ int Driver_Set_Graphics( int mode )
+ {
+ LONG palette[5];
+ int x;
+ POINTL coords;
+ SIZEL sizl = { 0, 0 };
+
+ PTIB thread_block;
+ PPIB process_block;
+
+ /* XXX : This is a very nasty hack, it fools OS/2 and let the program */
+ /* call PM functions, even though stdin/stdout/stderr are still */
+ /* directed to the standard i/o streams.. */
+ /* The program must be compiled with WINDOWCOMPAT */
+ /* */
+ /* Credits go to Michal for finding this !! */
+ /* */
+ DosGetInfoBlocks( &thread_block, &process_block );
+ process_block->pib_ultype = 3;
+
+ /* save mono vs grayscale status */
+ Colourmode = mode;
+
+ /* event semaphore to signal reraster event */
+ DosCreateEventSem( NULL, &hevKeyLock, 0, TRUE );
+
+ /* mutex semaphore for access to the presentation space */
+ DosCreateMutexSem( NULL, &hmtxPSMemoryLock, 0, FALSE );
+
+ /* Start thread with Presentation Manager window */
+ DosCreateThread( &MessageThread, (PFNTHREAD)RunPMWindow, 0UL, 0UL, 32920 );
+
+ /* open anchor block to permit Gpi calls from this thread */
+ habt = WinInitialize( 0 );
+
+ /* create device context and presentation space for our graphic */
+ hdcMemory = DevOpenDC( hab, OD_MEMORY, (PSZ)"*", 0L, 0L, 0L );
+
+ DosRequestMutexSem( hmtxPSMemoryLock, SEM_INDEFINITE_WAIT );
+ hpsMemory = GpiCreatePS(
+ habt, hdcMemory, &sizl,
+ PU_PELS | GPIT_MICRO | GPIA_ASSOC | GPIF_DEFAULT );
+ GpiSetBackMix( hpsMemory, BM_OVERPAINT );
+
+ /* create bitmap for raster image of graphic */
+
+ /* find some memory for the bitmap header */
+ DosAllocMem( (PPVOID)&pbmi,
+ sizeof ( BITMAPINFO2 ) + sizeof ( RGB2 ) * 256,
+ PAG_COMMIT | PAG_READ | PAG_WRITE);
+ /* 256 should really be 2 if not grayscale */
+
+ /* initialize the header to appropriate values */
+ memset( pbmi, 0, sizeof ( BITMAPINFO2 ) + sizeof ( RGB2 ) * 256 );
+
+ pbmi->cbFix = sizeof ( BITMAPINFOHEADER2 );
+ pbmi->cx = VIO_WIDTH;
+ pbmi->cy = VIO_HEIGHT;
+ pbmi->cPlanes = 1;
+
+ switch ( mode )
+ {
+ case Graphics_Mode_Mono:
+ pbmi->cBitCount = 1;
+ break;
+
+ case Graphics_Mode_Gray:
+ pbmi->cBitCount = 8;
+ break;
+ }
+
+ hbm = GpiCreateBitmap( hpsMemory, (PBITMAPINFOHEADER2)pbmi,
+ 0L, NULL, NULL );
+
+ /* associate it with the presentation space */
+ GpiSetBitmap( hpsMemory, hbm );
+ pbmi->cbFix = sizeof ( BITMAPINFOHEADER2 );
+ GpiQueryBitmapInfoHeader( hbm, (PBITMAPINFOHEADER2) pbmi );
+
+ switch ( mode )
+ {
+ case Graphics_Mode_Mono:
+ DosReleaseMutexSem( hmtxPSMemoryLock );
+
+ vio_ScanLineWidth = VIO_WIDTH / 8;
+ vio_Width = VIO_WIDTH;
+ vio_Height = VIO_HEIGHT;
+
+ gray_palette[0] = 0; /* to avoid testing for grayscale... */
+ break;
+
+ case Graphics_Mode_Gray:
+ vio_ScanLineWidth = VIO_WIDTH;
+ vio_Width = VIO_WIDTH;
+ vio_Height = VIO_HEIGHT;
+
+ /* set gray_palette by convoluted procedure */
+
+ /* create logical color palette */
+ palette[0] = 0xffffffL; /* White */
+ palette[1] = 0xbbbbbbL;
+ palette[2] = 0x777777L; /* Gray */
+ palette[3] = 0x333333L;
+ palette[4] = 0L; /* Black */
+
+ GpiCreateLogColorTable( hpsMemory, (ULONG)LCOL_PURECOLOR,
+ (LONG)LCOLF_CONSECRGB, (LONG)0L,
+ (LONG)5L, (PLONG)palette );
+
+ /* plot to presentation space in all five gray shades */
+ for (x = 0 ; x < 5 ; x++)
+ {
+ GpiSetColor( hpsMemory, (LONG)x );
+ coords.x = x;
+ coords.y = 0;
+ GpiSetPel( hpsMemory, &coords );
+ }
+
+ /* retrieve the 5 pixels as gray_palette */
+ GpiQueryBitmapInfoHeader( hbm, (PBITMAPINFOHEADER2) pbmi );
+ GpiQueryBitmapBits( hpsMemory, 0L, (LONG)VIO_HEIGHT - 2,
+ &Bitmap[0], pbmi );
+ for ( x = 0; x < 5; x++ )
+ {
+ gray_palette[x] = Bitmap[x];
+ }
+
+ /* initialization in case we paint before Driver_Display is called */
+ memset( &Bitmap[0], gray_palette[0], vio_Height * vio_ScanLineWidth );
+ DosReleaseMutexSem( hmtxPSMemoryLock );
+ break;
+
+ default:
+ return 0; /* Unknown mode */
+ }
+
+ return 1; /* success even if windows were not setup right */
+ }
+
+
+ int Driver_Display_Bitmap( char* buffer, int lines, int cols )
+ {
+ int y, target;
+
+
+ /* copy the bitmap and blt to presentation space */
+ if ( (lines == vio_Height) & (cols == vio_ScanLineWidth) )
+ memcpy( &Bitmap[0], buffer, lines * cols );
+ else
+ {
+ memset( &Bitmap[0], gray_palette[0], vio_Height * vio_ScanLineWidth );
+ /* temporary hack to center any bitmap */
+ target = ( vio_Height - lines ) / 2 * vio_ScanLineWidth +
+ ( vio_ScanLineWidth - cols ) / 2;
+
+ for ( y = 0 ; y < lines ; y++ )
+ {
+ memcpy( &Bitmap[target], buffer, cols );
+ target += vio_ScanLineWidth;
+ buffer += cols;
+ }
+ }
+
+ /* Get permission and write to in-memory ps */
+ DosRequestMutexSem( hmtxPSMemoryLock, SEM_INDEFINITE_WAIT );
+ GpiSetBitmapBits( hpsMemory, 0L, (LONG)VIO_HEIGHT - 2, &Bitmap[0], pbmi );
+ DosReleaseMutexSem( hmtxPSMemoryLock );
+ ready = TRUE;
+
+ /* Invalidate and ask for redraw now */
+ WinInvalidateRect( hwndClient, NULL, FALSE );
+ WinUpdateWindow( hwndFrame );
+
+ return 1; /* success */
+ }
+
+
+ void Get_Event( TEvent* event )
+ {
+ ULONG ulRequestCount;
+
+
+ /* the Get_Event function blocks until there is an event to process */
+ DosWaitEventSem( hevKeyLock, SEM_INDEFINITE_WAIT );
+ DosQueryEventSem( hevKeyLock, &ulRequestCount );
+ DosResetEventSem( hevKeyLock, &ulRequestCount );
+ event->what = ourevent.what;
+ event->info = ourevent.info;
+ return;
+ }
+
+
+ void RunPMWindow( ULONG dummy )
+ {
+ unsigned char classname[] = "DisplayClass";
+ ULONG flClassFlags;
+ static HMQ hmq;
+ QMSG qmsg;
+
+
+ if ( (hab = WinInitialize( 0 )) == 0 )
+ {
+ printf( "Error doing WinInitialize()\n" );
+ return;
+ }
+
+ if ( (hmq = WinCreateMsgQueue( hab, 0 )) == (HMQ)NULL )
+ {
+ printf( "Error doing WinCreateMsgQueue()\n" );
+ return;
+ }
+
+ if ( !WinRegisterClass( hab, (PSZ)classname, (PFNWP)Message_Process,
+ CS_SIZEREDRAW, 0 ) )
+ {
+ printf( "Error doing WinRegisterClass()\n" );
+ return;
+ }
+
+ flClassFlags = FCF_TITLEBAR | FCF_MINBUTTON | FCF_DLGBORDER |
+ FCF_TASKLIST | FCF_SYSMENU;
+ if ( (hwndFrame = WinCreateStdWindow( HWND_DESKTOP,
+ WS_VISIBLE,
+ &flClassFlags,
+ (PSZ)classname,
+ (PSZ)"FreeType PM Graphics",
+ WS_VISIBLE,
+ 0, 0, &hwndClient )) == 0 )
+ {
+ printf( "Error doing WinCreateStdWindow()\n" );
+ return;
+ }
+
+ /* find the title window handle */
+ hwndTitle = WinWindowFromID( hwndFrame, FID_TITLEBAR );
+
+ /* set Window size and position */
+ WinSetWindowPos(
+ hwndFrame, 0L,
+ (SHORT)60,
+ (SHORT)WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) -
+ ( VIO_HEIGHT + MAG_HEIGHT + 100 ),
+ (SHORT)WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME ) * 2 +
+ VIO_WIDTH,
+ (SHORT)WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) +
+ WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME ) * 2 +
+ VIO_HEIGHT + MAG_HEIGHT,
+ SWP_SIZE | SWP_MOVE ) ;
+
+ /* run the message queue till the end */
+ while ( WinGetMsg( hab, &qmsg, (HWND)NULL, 0, 0 ) )
+ WinDispatchMsg( hab, &qmsg );
+
+ /* clean-up */
+ WinDestroyWindow( hwndFrame );
+ hwndFrame = (HWND)NULL;
+ WinDestroyMsgQueue( hmq );
+ WinTerminate( hab );
+
+ /* await death... */
+ while ( 1 )
+ DosSleep( 100 );
+ }
+
+
+ void Adjust_Mag_Rectangle( void )
+ {
+ SIZEL source,
+ target;
+
+
+ /* Step 1, find optimal source size for this mag and window size */
+ source.cx = mag_win_size.cx / magnification;
+ if (source.cx > vio_Width) source.cx = vio_Width;
+ source.cy = mag_win_size.cy / magnification;
+ if (source.cy > vio_Height) source.cy = vio_Height;
+
+ target.cx = source.cx * magnification;
+ target.cy = source.cy * magnification;
+
+ aptlMagd[0].x = (mag_win_size.cx - target.cx) / 2;
+ aptlMagd[0].y = (mag_win_size.cy - target.cy) / 2;
+ aptlMagd[1].x = aptlMagd[0].x + target.cx - 1;
+ aptlMagd[1].y = aptlMagd[0].x + target.cy - 1;
+
+ /* Step 2, try crosshairs point dependent coordinates */
+ aptlMagd[2].x = view_target.x - source.cx / 2;
+ aptlMagd[2].y = view_target.y - source.cy / 2;
+ if (aptlMagd[2].x < 0 ) aptlMagd[2].x = 0;
+ if (aptlMagd[2].y < 0 ) aptlMagd[2].y = 0;
+ if (aptlMagd[2].x > vio_Width - source.cx)
+ aptlMagd[2].x = vio_Width - source.cx;
+ if (aptlMagd[2].y > vio_Height - source.cy)
+ aptlMagd[2].y = vio_Height - source.cy;
+
+ aptlMagd[3].x = aptlMagd[2].x + source.cx - 1;
+ aptlMagd[3].y = aptlMagd[2].y + source.cy - 1;
+
+ } /* End of Adjust_Mag_Rectangle; */
+
+
+ /* Message processing for our PM Window class */
+ MRESULT EXPENTRY Message_Process( HWND handle, ULONG mess,
+ MPARAM parm1, MPARAM parm2 )
+ {
+ static HDC hdc;
+ static HPS hps;
+ static BOOL minimized;
+
+ POINTL top_corner, bottom_corner;
+ SWP swp;
+ int i;
+
+
+ switch( mess )
+ {
+ case WM_DESTROY:
+ /* warn the main thread to quit if it didn't know */
+ ourevent.what = event_Quit;
+ ourevent.info = 0;
+ DosPostEventSem( hevKeyLock );
+ break;
+
+ case WM_CREATE:
+ /* set original magnification */
+ magnification = 4;
+ minimized = FALSE;
+
+ /* create Device Context and Presentation Space for screen. */
+ /* could we use a cached one ? */
+ hdc = WinOpenWindowDC( handle );
+ mag_win_size.cx = 0;
+ mag_win_size.cy = 0;
+ hps = GpiCreatePS( hab, hdc, &mag_win_size,
+ PU_PELS | GPIT_MICRO | GPIA_ASSOC | GPIF_DEFAULT );
+
+ /* Set to size of magnifier window */
+ mag_win_size.cx = MAG_WIDTH;
+ mag_win_size.cy = MAG_HEIGHT;
+ Adjust_Mag_Rectangle();
+
+ /* take the input focus */
+ WinFocusChange( HWND_DESKTOP, handle, 0L );
+ break;
+
+ case WM_BUTTON1DOWN:
+ if ( MOUSEMSG( &mess )->y >= MAG_HEIGHT )
+ {
+ view_target.x = MOUSEMSG( &mess )->x;
+ view_target.y = MOUSEMSG( &mess )->y - MAG_HEIGHT;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( hwndClient, NULL, FALSE );
+ }
+
+ return WinDefWindowProc( handle, mess, parm1, parm2 );
+ break;
+
+ case WM_MINMAXFRAME:
+ /* to update minimized if changed */
+ swp = *((PSWP) parm1);
+ if ( swp.fl & SWP_MINIMIZE )
+ minimized = TRUE;
+ if ( swp.fl & SWP_RESTORE )
+ minimized = FALSE;
+ return WinDefWindowProc( handle, mess, parm1, parm2 );
+ break;
+
+ case WM_ERASEBACKGROUND:
+ case WM_PAINT:
+ /* reset the window title only if not minimized */
+ if ( !minimized )
+ WinSetWindowText( hwndTitle, Header );
+
+ /* copy the memory image of the screen out to the real screen */
+ DosRequestMutexSem( hmtxPSMemoryLock, SEM_INDEFINITE_WAIT );
+ WinBeginPaint( handle, hps, NULL );
+
+ /* main image and magnified picture */
+ GpiBitBlt( hps, hpsMemory, 4L, aptlFull, ROP_SRCCOPY, BBO_AND );
+ GpiBitBlt( hps, hpsMemory, 4L, aptlMagd, ROP_SRCCOPY, BBO_AND );
+
+ /* double-dash the magnifing bounding box. Paint the mag liner? */
+ if ( magnification != 1 )
+ {
+ GpiSetLineType( hps, LINETYPE_LONGDASH );
+
+ bottom_corner.x = aptlMagd[2].x - 1;
+ bottom_corner.y = aptlMagd[2].y + MAG_HEIGHT - 1;
+ top_corner.x = aptlMagd[3].x ;
+ top_corner.y = aptlMagd[3].y + MAG_HEIGHT;
+
+ GpiMove( hps, &bottom_corner );
+ GpiBox( hps, DRO_OUTLINE, &top_corner, 0L, 0L );
+
+#if 0
+ GpiSetClipRegion();
+ GpiErase();
+#endif
+ }
+
+ WinEndPaint( hps );
+ DosReleaseMutexSem( hmtxPSMemoryLock );
+ break;
+
+ case WM_CHAR:
+ if ( CHARMSG( &mess )->fs & KC_KEYUP )
+ break;
+
+ switch ( CHARMSG( &mess )->vkey )
+ {
+ case VK_ESC:
+ ourevent.what = event_Quit;
+ ourevent.info = 0;
+ DosPostEventSem( hevKeyLock );
+ break;
+
+ case VK_PAGEDOWN:
+ if ( magnification < MAX_MAG )
+ {
+ magnification += 1;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( handle, NULL, FALSE );
+ }
+ break;
+
+ case VK_PAGEUP:
+ if ( magnification > 1 )
+ {
+ magnification -= 1;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( handle, NULL, FALSE );
+ }
+ break;
+
+ case VK_LEFT:
+ if ( view_target.x > 0 )
+ {
+ view_target.x -= 1;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( handle, NULL, FALSE );
+ }
+ break;
+
+ case VK_RIGHT:
+ if ( view_target.x < VIO_WIDTH - 1 )
+ {
+ view_target.x += 1;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( handle, NULL, FALSE );
+ }
+ break;
+
+ case VK_DOWN:
+ if ( view_target.y > 0 )
+ {
+ view_target.y -= 1;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( handle, NULL, FALSE );
+ }
+ break;
+
+ case VK_UP:
+ if ( view_target.y < VIO_HEIGHT - 1 )
+ {
+ view_target.y += 1;
+ Adjust_Mag_Rectangle();
+ WinInvalidateRect( handle, NULL, FALSE );
+ }
+ break;
+
+ case VK_F1: /* bring up help and about dialog window */
+ break;
+ }
+
+ if ( CHARMSG( &mess )->fs & KC_CHAR )
+ {
+ char c = (CHAR)CHARMSG( &mess )->chr ;
+
+
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ ourevent.what = trans[i].event_class;
+ ourevent.info = trans[i].event_info;
+ DosPostEventSem( hevKeyLock );
+ return (MRESULT)TRUE;
+ }
+ }
+
+ /* unrecognized keystroke */
+ ourevent.what = event_Keyboard;
+ ourevent.info = (int)c;
+ DosPostEventSem( hevKeyLock );
+ }
+ break;
+
+ default:
+ return WinDefWindowProc( handle, mess, parm1, parm2 );
+ }
+
+ return (MRESULT) FALSE;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/os2/gpm_os2.def b/Build/source/libs/freetype/test/arch/os2/gpm_os2.def
new file mode 100644
index 00000000000..4a77c632c03
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/os2/gpm_os2.def
@@ -0,0 +1,5 @@
+NAME WINDOWCOMPAT
+
+DESCRIPTION 'FreeType Graphics'
+HEAPSIZE 8192
+STACKSIZE 40888
diff --git a/Build/source/libs/freetype/test/arch/unix/.cvsignore b/Build/source/libs/freetype/test/arch/unix/.cvsignore
new file mode 100644
index 00000000000..f3c7a7c5da6
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/unix/.cvsignore
@@ -0,0 +1 @@
+Makefile
diff --git a/Build/source/libs/freetype/test/arch/unix/.cvsignore.delete b/Build/source/libs/freetype/test/arch/unix/.cvsignore.delete
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/unix/.cvsignore.delete
diff --git a/Build/source/libs/freetype/test/arch/unix/Makefile.in b/Build/source/libs/freetype/test/arch/unix/Makefile.in
new file mode 100644
index 00000000000..887ee57f2e8
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/unix/Makefile.in
@@ -0,0 +1,184 @@
+# This file is part of the FreeType project.
+#
+# test/arch/unix/Makefile.in
+#
+#
+# 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.
+
+ARCH = arch/unix
+
+top_builddir=..
+
+VPATH = @srcdir@/../..
+srcdir = @srcdir@/../..
+
+RM = @RM@
+RMF = @RM@ -f
+RMDIR = @RMDIR@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+
+CC = @CC@
+CPP = @CPP@
+
+LIBTOOL = $(top_builddir)/libtool
+MKINSTALLDIRS = $(srcdir)/../mkinstalldirs
+
+include $(top_builddir)/MakeSub
+
+FT_LIBDIR = $(srcdir)/../lib
+INCDIRS = -I. -I$(srcdir) -I$(top_builddir) \
+ -I$(FT_LIBDIR) -I$(FT_LIBDIR)/extend
+
+CFLAGS = @CFLAGS@ @X_CFLAGS@ @XX_CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+FT_CFLAGS = $(INCDIRS) $(CFLAGS) $(CPPFLAGS) -DX11 -DLOCALEDIR='"@LOCALEDIR@"'
+
+FT_LIBS = @X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ @LIBS@
+
+SRC = $(srcdir)/arabic.c \
+ $(srcdir)/common.c \
+ $(srcdir)/textdisp.c \
+ $(srcdir)/ftdump.c \
+ $(srcdir)/fterror.c \
+ $(srcdir)/ftlint.c \
+ $(srcdir)/ftmetric.c \
+ $(srcdir)/ftsbit.c \
+ $(srcdir)/ftstring.c \
+ $(srcdir)/ftstrpnm.c \
+ $(srcdir)/fttimer.c \
+ $(srcdir)/ftview.c \
+ $(srcdir)/ftzoom.c \
+ $(srcdir)/ftstrtto.c \
+ $(srcdir)/gmain.c \
+ $(srcdir)/$(ARCH)/gwin_x11.c
+
+DISPOBJS = common.o gmain.o display.o gwin_x11.o blitter.o
+
+PROGRAMS = ftdump fterror ftlint ftmetric ftsbit ftstrpnm
+X_PROGRAMS = ftstring ftstrtto fttimer ftview ftzoom
+
+ALL_PROGRAMS = $(PROGRAMS) @X_PROGRAMS@
+
+# set this variable to nil if you don't need to use Electric-Fence
+EFENCE =
+#EFENCE = -lefence
+
+
+# variables used to compile either with libtool or not
+#
+PROCESS = $(LIBTOOL) --mode=link $(CC) $(FT_CFLAGS)
+#PROCESS = $(CC) $(FT_CFLAGS)
+
+LIBTTF = $(top_builddir)/lib/libttf.la
+#LIBTTF =$(top_builddir)/lib/libttf.a
+
+.c.o:
+ $(CC) -c $(FT_CFLAGS) $<
+
+
+all: $(ALL_PROGRAMS)
+
+
+gwin_x11.o: $(srcdir)/$(ARCH)/gwin_x11.c
+ $(CC) -c $(FT_CFLAGS) $(srcdir)/$(ARCH)/gwin_x11.c
+
+ftzoom: ftzoom.o $(DISPOBJS) $(LIBTTF)
+ $(PROCESS) -o ftzoom ftzoom.o $(DISPOBJS) \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS) -lX11
+
+fttimer: fttimer.o $(DISPOBJS) $(LIBTTF)
+ $(PROCESS) -o fttimer fttimer.o $(DISPOBJS) \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS) -lX11
+
+ftview: ftview.o $(DISPOBJS) $(LIBTTF)
+ $(PROCESS) -o ftview ftview.o $(DISPOBJS) \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS) -lX11
+
+ftlint: ftlint.o common.o $(LIBTTF)
+ $(PROCESS) -o ftlint ftlint.o common.o \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS)
+
+ftdump: ftdump.o common.o $(LIBTTF)
+ $(PROCESS) -o ftdump ftdump.o common.o \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS)
+
+ftmetric: ftmetric.o common.o textdisp.o $(LIBTTF)
+ $(PROCESS) -o ftmetric ftmetric.o common.o textdisp.o \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS)
+
+ftsbit: ftsbit.o common.o textdisp.o $(LIBTTF)
+ $(PROCESS) -o ftsbit ftsbit.o common.o textdisp.o \
+ $(EFENCE) $(LIBTTF)
+
+ftstring: ftstring.o $(DISPOBJS) $(LIBTTF)
+ $(PROCESS) -o ftstring ftstring.o $(DISPOBJS) \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS) -lX11
+
+ftstrpnm: ftstrpnm.o common.o $(LIBTTF)
+ $(PROCESS) -o ftstrpnm ftstrpnm.o common.o \
+ $(EFENCE) $(LIBTTF)
+
+fterror: fterror.o common.o $(LIBTTF)
+ $(PROCESS) -o fterror fterror.o common.o \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS)
+
+ftstrtto: ftstrtto.o $(DISPOBJS) arabic.o $(LIBTTF)
+ $(PROCESS) -o ftstrtto ftstrtto.o $(DISPOBJS) arabic.o \
+ $(EFENCE) $(LIBTTF) $(FT_LIBS) -lX11
+
+
+install: $(ALL_PROGRAMS)
+ $(MKINSTALLDIRS) $(bindir)
+ for P in $(ALL_PROGRAMS) ; do \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$P $(bindir)/$$P ; \
+ done
+
+uninstall:
+ -for P in $(ALL_PROGRAMS) ; do \
+ $(LIBTOOL) --mode=uninstall $(RM) $(bindir)/$$P ; \
+ done
+
+clean: do_clean
+
+distclean: do_clean
+ -$(RMF) $(ALL_PROGRAMS)
+ -$(RMF) *~ *.orig core *.core
+ -$(RMF) config.cache config.log config.status
+ -$(RMF) $(ARCH)/Makefile
+ -$(RMF) .libs/*
+ -$(RMDIR) .libs
+
+do_clean:
+ -$(RMF) *.o
+
+depend:
+ (echo '/^#.* PUT NO STUFF BELOW/,$$d' ; echo w ; echo q) | \
+ ed - $(ARCH)/Makefile
+ echo '# Dependencies generated by make depend: PUT NO STUFF BELOW' \
+ >> $(ARCH)/Makefile
+ for file in $(SRC) ; do \
+ $(CPP) $(CPPFLAGS) $(INCDIRS) $$file | \
+ sed -n -e 's|^# [1-9][0-9]* "\([^/].*\.h\)".*|\1|p' \
+ -e 's|^# [1-9][0-9]* "\($(srcdir)/.*\.h\)".*|\1|p' | \
+ sed -e 's|/\./|.|g' -e "s/^/`basename $$file .c`.o: /" ; \
+ done | \
+ sort -u | \
+ awk '{ if (LINE == 1) \
+ { line = last = $$1 } \
+ else if ($$1 != last) \
+ { print line ; line = last = $$1 } \
+ line = line " " $$2 } \
+ END { print line }' >> $(ARCH)/Makefile
+
+.PHONY: all install uninstall clean distclean do_clean depend
+
+# Dependencies generated by make depend: PUT NO STUFF BELOW
diff --git a/Build/source/libs/freetype/test/arch/unix/gwin_x11.c b/Build/source/libs/freetype/test/arch/unix/gwin_x11.c
new file mode 100644
index 00000000000..965c1f60784
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/unix/gwin_x11.c
@@ -0,0 +1,451 @@
+/*******************************************************************
+ *
+ * gwin_x11.c graphics utility X-Window driver. 1.0
+ *
+ * This is the driver for windowed display under X11, used by the
+ * graphics utility of the FreeType test suite.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+
+#include "common.h" /* for Panic() */
+#include "freetype.h"
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+ /* Translator added to ease changes to control keys */
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+ /* End of translators addition. See Get_Event() below */
+
+ extern char Header[]; /* defined in the test programs */
+
+ static Window win;
+ static GC gcblack;
+ static XColor color[5];
+
+ Display* display;
+ static char* displayname = "";
+
+ static XImage* image;
+
+ static Visual* visual;
+ static Colormap colormap;
+ static int depth;
+ static Bool gray;
+
+ static Cursor idle;
+ static Cursor busy;
+
+ static int win_origin_x, win_origin_y,
+ win_width, win_height;
+ static int image_width, image_height;
+
+ long vioBufOfs;
+
+
+
+ /* restore acreen to its original state */
+
+ int Driver_Restore_Mode( void )
+ {
+ XUnmapWindow( display, win );
+ XCloseDisplay( display );
+
+ return 1; /* success */
+ }
+
+
+ /* set graphics mode */
+
+ void x11init( void )
+ {
+ int screen_num, i;
+ XTextProperty xtp;
+ XSizeHints xsh;
+ XSetWindowAttributes xswa;
+
+#if 1
+ unsigned short colors[5] = { 0, 16, 32, 48, 63 }; /* gamma = 1.0 */
+#else
+ unsigned short colors[5] = { 0, 34, 46, 55, 63 }; /* gamma = 2.2 */
+#endif
+
+
+ XrmInitialize();
+
+ if( !( display = XOpenDisplay( displayname ) ) )
+ Panic( "ERROR: cannot open display\n" );
+
+ screen_num = DefaultScreen ( display );
+ colormap = DefaultColormap( display, screen_num );
+ depth = DefaultDepth ( display, screen_num );
+ visual = DefaultVisual ( display, screen_num );
+
+ idle = XCreateFontCursor( display, XC_left_ptr );
+ busy = XCreateFontCursor( display, XC_watch );
+
+ if ( gray )
+ {
+ int count;
+ XPixmapFormatValues* formats;
+
+
+ formats = XListPixmapFormats( display, &count );
+ vio_ScanLineWidth = 0;
+
+ while ( count > 0 )
+ {
+ --count;
+ if ( formats[count].depth == depth )
+ {
+ int bits;
+
+ bits = win_width * formats[count].bits_per_pixel;
+ if ( bits % formats[count].scanline_pad )
+ {
+ bits -= bits % formats[count].scanline_pad;
+ bits += formats[count].scanline_pad;
+ }
+
+ vio_ScanLineWidth = bits / 8;
+ break;
+ }
+ }
+ if ( !vio_ScanLineWidth )
+ Panic( "ERROR: the display doesn't offer a suitable pixmap format\n" );
+
+ XFree( formats );
+ }
+
+ Vio = (char*)malloc( win_height * vio_ScanLineWidth );
+
+ if ( !Vio )
+ Panic( "ERROR: cannot malloc display memory\n" );
+
+ xswa.border_pixel = BlackPixel( display, screen_num );
+ xswa.background_pixel = WhitePixel( display, screen_num );
+ xswa.cursor = busy;
+
+ xswa.event_mask = KeyPressMask | ExposureMask;
+
+ win = XCreateWindow( display,
+ RootWindow( display, screen_num ),
+ win_origin_x,
+ win_origin_y,
+ win_width,
+ win_height,
+ 10,
+ depth,
+ InputOutput,
+ visual,
+ CWBackPixel | CWBorderPixel | CWEventMask | CWCursor,
+ &xswa );
+
+ XMapWindow( display, win );
+
+ gcblack = XCreateGC( display, RootWindow( display, screen_num ),
+ 0L, NULL );
+ XSetForeground( display, gcblack, BlackPixel( display, screen_num ) );
+ XSetBackground( display, gcblack, WhitePixel( display, screen_num ) );
+
+ /* allocate colors */
+
+ if ( gray )
+ for ( i = 0; i < 5; i++ )
+ {
+ gray_palette[i] = i;
+
+ color[i].red =
+ color[i].green =
+ color[i].blue = 65535 - ( colors[i] * 65535 ) / 63;
+
+ if ( !XAllocColor( display, colormap, &color[i] ) )
+ Panic( "ERROR: cannot allocate Color\n" );
+ }
+
+ image = XCreateImage( display,
+ visual,
+ gray ? depth : 1,
+ gray ? ZPixmap : XYBitmap,
+ 0,
+ (char*)Vio,
+ win_width,
+ win_height,
+ 8,
+ 0 );
+ if ( !image )
+ Panic( "ERROR: cannot create image\n" );
+
+ if ( !gray )
+ {
+ image->byte_order = MSBFirst;
+ image->bitmap_bit_order = MSBFirst;
+ }
+
+ /* make window manager happy :-) */
+ xtp.value = (unsigned char*)"FreeType";
+ xtp.encoding = 31;
+ xtp.format = 8;
+ xtp.nitems = strlen( (char*)xtp.value );
+
+ xsh.x = win_origin_x;
+ xsh.y = win_origin_y;
+
+ xsh.width = win_width;
+ xsh.height = win_height;
+ xsh.flags = (PPosition | PSize);
+ xsh.flags = 0;
+
+ XSetWMProperties( display, win, &xtp, &xtp, NULL, 0, &xsh, NULL, NULL );
+ }
+
+
+ int Driver_Set_Graphics( int mode )
+ {
+ if ( mode == Graphics_Mode_Gray )
+ {
+ gray = 1;
+ vio_ScanLineWidth = 320;
+
+ win_origin_x = 0;
+ win_origin_y = 0;
+ win_width = 320;
+ win_height = 200;
+ }
+ else if ( mode == Graphics_Mode_Mono )
+ {
+ gray = 0;
+ vio_ScanLineWidth = 80;
+
+ win_origin_x = 0;
+ win_origin_y = 0;
+ win_width = 640;
+ win_height = 450;
+ }
+ else
+ Panic( "ERROR: mode %d not supported\n", mode );
+
+ vio_Width = win_width;
+ vio_Height = win_height;
+
+ x11init();
+
+ return 1; /* success */
+ }
+
+
+ void Put_Image( int x, int y, int w, int h )
+ {
+ XPutImage( display, win, gcblack, image, x, y, x, y, w, h );
+ }
+
+
+ int Driver_Display_Bitmap( char* buffer, int line, int col )
+ {
+ int z, y, used_col;
+ char* target;
+
+
+ XClearWindow( display, win );
+
+ /* this displays the Header string in the window title */
+ XStoreName( display, win, Header );
+
+ if ( line > win_height )
+ line = win_height;
+
+ if ( !gray )
+ {
+ if ( col > vio_ScanLineWidth )
+ used_col = vio_ScanLineWidth;
+ else
+ used_col = col;
+
+ target = Vio + ( line - 1 ) * vio_ScanLineWidth;
+
+ for ( y = 0; y < line; y++ )
+ {
+ memcpy( (char*)target, buffer, used_col );
+ target -= vio_ScanLineWidth;
+ buffer += col;
+ }
+
+ Put_Image( 0, 0, used_col * 8, line );
+ image_width = used_col * 8;
+ image_height = line;
+ }
+ else
+ {
+ if ( col > win_width )
+ used_col = win_width;
+ else
+ used_col = col;
+
+ for ( y = line - 1; y >= 0; y-- )
+ {
+ char* bufp;
+
+
+ bufp = buffer;
+
+ for ( z = 0; z < used_col; z++ )
+ {
+ int c;
+
+
+ c = *bufp++;
+
+ if ( c < 0 || c >= 5 ) /* security check */
+ {
+ /* Message( "weird grayshade: %d\n", c ); */
+ c = 0;
+ }
+ XPutPixel( image, z, y, color[c].pixel );
+ }
+
+ buffer += col;
+ }
+
+ Put_Image( 0, 0, used_col, line );
+ image_width = used_col;
+ image_height = line;
+ }
+
+ return 1;
+ }
+
+
+ /* This function maps X keystrokes into GEvents. Note that */
+ /* currently only keystrokes events exit this function. */
+
+ void Get_Event( TEvent* event )
+ {
+ static char key_buffer[10];
+ static int key_cursor = 0;
+ static int key_number = 0;
+ static XEvent x_event;
+ KeySym key;
+
+ int i, bool_exit;
+ char c;
+
+ XComposeStatus compose;
+
+
+ bool_exit = key_cursor < key_number;
+
+ XDefineCursor( display, win, idle );
+
+ while ( !bool_exit )
+ {
+ XNextEvent( display, &x_event );
+
+ switch ( x_event.type )
+ {
+ case KeyPress:
+ key_number = XLookupString( &x_event.xkey,
+ key_buffer,
+ sizeof ( key_buffer ),
+ &key,
+ &compose );
+ key_cursor = 0;
+
+ if ( key_number > 0 )
+ bool_exit = 1;
+ break;
+
+ case MappingNotify:
+ XRefreshKeyboardMapping( &x_event.xmapping );
+ break;
+
+ case Expose:
+#if 0
+ Put_Image( x_event.xexpose.x,
+ x_event.xexpose.y,
+ x_event.xexpose.width,
+ x_event.xexpose.height );
+#else
+ /* we always redraw the whole image */
+ Put_Image( 0, 0, image_width, image_height );
+#endif
+ break;
+
+ /* You should add more cases to handle mouse events, etc. */
+ }
+ }
+
+ XDefineCursor( display, win, busy );
+ XFlush ( display );
+
+ c = key_buffer[key_cursor++];
+
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ event->what = trans[i].event_class;
+ event->info = trans[i].event_info;
+ return;
+ }
+ }
+
+ event->what = event_Keyboard;
+ event->info = (int)c;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/win16/Makefile.BC b/Build/source/libs/freetype/test/arch/win16/Makefile.BC
new file mode 100644
index 00000000000..7eaf19811b6
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win16/Makefile.BC
@@ -0,0 +1,222 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for BC++ for 16-bit Windows,
+# using large model, and using Easy-Win to display console outputs.
+#
+# Tested with Borland C++ v.4.02, 5.0
+# You will need Borland MAKE (v.3.6 and above should be OK, for oldest
+# versions refer to the instructions below).
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# make -farch\win16\Makefile.BC
+#
+#
+# A DLL version of the library can be built and then used with
+#
+# make -DDLL -farch/win16/Makefile.BC dll
+#
+# (do not forget to define DLL, otherwise the link phase will fail).
+#
+#
+# Debug versions can be obtained with
+#
+# make -DDEBUG -farch\win16\Makefile.BC
+#
+# Special versions enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# make -DBIGFONTS -farch\msdos\Makefile.BC
+#
+#
+# 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.
+
+ARCH = arch\win16
+FT_MAKEFILE = $(ARCH)\Makefile.BC
+FT_DLL = ft15_16.dll
+
+CC = bcc
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR);$(LIBDIR)\$(ARCH);.;$(LIBDIR)\extend
+SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -w-pia
+
+# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
+# Borland compilers (from BC++ 3.1 on) can increase the limit of
+# the length of identifiers.
+CFLAGS = -WSE -ml -A -i40 $(INCDIRS) $(SPURIOUS_WARNINGS)
+
+!if ! $d(DEBUG)
+CFLAGS = $(CFLAGS) -O2 -3
+LDFLAGS = -ml -W -lC
+!else
+CFLAGS = $(CFLAGS) -v -N
+LDFLAGS = -v -ml -W -lC
+!endif
+
+!if $d(DLL)
+CFLAGS = $(CFLAGS) -DFREETYPE_DLL
+!endif
+
+
+# Windows graphic driver
+GDRIVER = $(ARCH)\gw_win16.c
+
+DISPLAY = display.c
+
+G1SRC = gmain.c blitter.c $(GDRIVER)
+GSRC = $(DISPLAY) $(G1SRC)
+
+GOBJ = $(GSRC:.c=.obj)
+G1OBJ = $(G1SRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) $<
+|
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!if !$d(DEBUG)
+# Skipped if DEBUG build
+all: freetype $(EXEFILES)
+
+dll: the_dll $(EXEFILES)
+
+!else
+# Skipped if non-DEBUG build
+default_target: debug
+dll: the_debug_dll $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+
+!if $d(BIGFONTS)
+MAKEBIG = -DBIGFONTS
+!endif
+
+freetype:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) $(MAKEBIG) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDEBUG $(MAKEBIG) debug
+ cd ..\test
+
+the_dll:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDLL $(MAKEBIG) dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+the_debug_dll:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDEBUG -DDLL $(MAKEBIG) dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+
+# C compilers are unable to include 16-bit <windows.h> in ANSI mode.
+# So we have a special rule for this file, to build it outside ANSI.
+$(GDRIVER:.c=.obj):
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) -A- $*.c
+|
+
+
+# Borland versions of make are unable to use the $** variable inside
+# implicit rules (like .obj.exe:). The job have to be done by hand. :-(
+ftzoom.exe: $(G1OBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftzoom.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftview.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstring.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrtto.obj $(GOBJ) common.obj arabic.obj \
+ $(LIBDIR)\libttf.lib
+
+fttimer.exe: $(G1OBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fttimer.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftlint.obj common.obj $(LIBDIR)\libttf.lib
+
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftdump.obj common.obj $(LIBDIR)\libttf.lib
+
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+
+ftsbit.exe: $(TDOBJ) ftsbit.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftsbit.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+ftmetric.exe: $(TDOBJ) ftmetric.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftmetric.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+ -del *.dll
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/test/arch/win16/Makefile.MS b/Build/source/libs/freetype/test/arch/win16/Makefile.MS
new file mode 100644
index 00000000000..d9dd2d107a4
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win16/Makefile.MS
@@ -0,0 +1,155 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for Microsoft C compilers
+# for 16-bit Windows, large model, using QuickWin to display console
+# outputs. It also works for Visual C++ 1.x 16-bits compiler, but
+# you should instead use the Makefile customized for it, Makefile.VC.
+#
+# You will need NMAKE.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# nmake /f arch\win16\Makefile.MS
+#
+#
+# A debug version can be obtained with
+#
+# nmake DEBUG=1 /f arch\win16\Makefile.MS
+#
+#
+# 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.
+
+ARCH = arch\win16
+FT_MAKEFILE = $(ARCH)\Makefile.MS
+FT_MAKE = $(MAKE) /nologo
+
+CC = cl /nologo
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\$(ARCH) -I. -I$(LIBDIR)\extend
+
+!ifndef DEBUG
+CFLAGS = /Ox /AL /Za /W2 /G2 $(INCDIRS)
+LDFLAGS = /AL
+!else
+CFLAGS = /Zi /AL /Za /W2 /G2 $(INCDIRS)
+LDFLAGS = /Zi /AL
+!endif
+
+CFLAGS = $(CFLAGS) /GA /Mq
+LDFLAGS = $(LDFLAGS) /GA /Mq
+
+
+# Windows graphic driver
+GDRIVER = $(ARCH)\gw_win16.c
+
+GSRC = display.c gmain.c blitter.c $(GDRIVER)
+
+GOBJ = $(GSRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) $<
+<<
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!ifndef DEBUG
+# Skiped if DEBUG build
+all: freetype $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 debug
+ cd ..\test
+
+
+# C compilers are unable to include 16-bit <windows.h> in ANSI mode.
+# So we have a special rule for this file, to build it outside ANSI.
+$(GDRIVER:.c=.obj):
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) /Ze $(GDRIVER)
+<<
+
+.obj.exe:
+ $(CC) /Fe$* @<<
+ $(LDFLAGS) $**
+<<
+
+ftzoom.exe: $(GOBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+fttimer.exe: $(GOBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ftsbit.exe: ftsbit.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+ftmetric.exe: ftmetric.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile.MS
diff --git a/Build/source/libs/freetype/test/arch/win16/Makefile.VC b/Build/source/libs/freetype/test/arch/win16/Makefile.VC
new file mode 100644
index 00000000000..078c2ea3d8a
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win16/Makefile.VC
@@ -0,0 +1,197 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for Microsoft Visual C++ 1.x
+# and Microsoft C/C++ v.7.0 compilers for 16-bit Windows, large model,
+# using QuickWin to display console outputs.
+#
+# You will need NMAKE.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# nmake /f arch\win16\Makefile.VC
+#
+# A DLL version of the library can be built and then used with
+#
+# nmake DLL=1 /f arch\win16\Makefile.VC dll
+#
+# (do not forget to define DLL, otherwise the link phase will fail).
+#
+#
+# Debug versions can be obtained with
+#
+# nmake DEBUG=1 /f arch\win16\Makefile.VC
+#
+# Special versions enabled to handle big fonts (with more than 16,384
+# glyphs) can be obtained with
+#
+# nmake BIGFONTS=1 /f arch\win16\Makefile.VC
+#
+#
+# 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.
+
+ARCH = arch\win16
+FT_MAKEFILE = $(ARCH)\Makefile.VC
+FT_MAKE = $(MAKE) /nologo
+FT_DLL = ft15_16.dll
+
+CC = cl /nologo
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\$(ARCH) -I. -I$(LIBDIR)\extend
+
+# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
+# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
+!ifndef DEBUG
+CFLAGS = /Ox /AL /Za /W2 /G3 $(INCDIRS)
+LDFLAGS = /AL
+!else
+CFLAGS = /Zi /Ge /AL /Za /W2 /G3 $(INCDIRS)
+LDFLAGS = /Zi /AL
+!endif
+
+CFLAGS = $(CFLAGS) /Mq
+LDFLAGS = $(LDFLAGS) /Mq
+
+!ifdef DLL
+CFLAGS = $(CFLAGS) /DFREETYPE_DLL
+!endif
+
+
+# Windows graphic driver
+GDRIVER = $(ARCH)\gw_win16.c
+
+GSRC = display.c gmain.c blitter.c $(GDRIVER)
+
+GOBJ = $(GSRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) $<
+<<
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!ifndef DEBUG
+# Skiped if DEBUG build
+all: freetype $(EXEFILES)
+
+dll: the_dll $(EXEFILES)
+
+!else
+# Skipped if non-DEBUG build
+default_target: debug
+dll: the_debug_dll $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+!ifdef BIGFONTS
+MAKEBIG = BIGFONTS=1
+!endif
+
+freetype:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) $(MAKEBIG) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 $(MAKEBIG) debug
+ cd ..\test
+
+the_dll:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DLL=1 $(MAKEBIG) dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+the_debug_dll:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 DLL=1 $(MAKEBIG) dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+
+# C compilers are unable to include 16-bit <windows.h> in ANSI mode.
+# So we have a special rule for this file, to build it outside ANSI.
+$(GDRIVER:.c=.obj):
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) /Ze $(GDRIVER)
+<<
+
+.obj.exe:
+ $(CC) /Fe$* @<<
+ $(LDFLAGS) $**
+<<
+
+ftzoom.exe: $(GOBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+fttimer.exe: $(GOBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ftsbit.exe: ftsbit.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+ftmetric.exe: ftmetric.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+ -del *.dll
+ -del *.pdb
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile.VC
diff --git a/Build/source/libs/freetype/test/arch/win16/depend.win b/Build/source/libs/freetype/test/arch/win16/depend.win
new file mode 100644
index 00000000000..facb75c19b5
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win16/depend.win
@@ -0,0 +1,78 @@
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in `makedep'...
+#
+# This dependency file to be used with various Windows compilers
+# has been generated automatically with the script `makedep' on
+# 2002-02-19.
+
+arabic.obj: arabic.c arabic.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxopen.h ..\lib\extend\ftxgdef.h \
+ ..\lib\extend\ftxgsub.h ..\lib\extend\ftxgpos.h
+blitter.obj: blitter.c blitter.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+common.obj: common.c common.h
+display.obj: display.c display.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gmain.h
+fdebug.obj: fdebug.c ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\tttypes.h ..\lib\ttconfig.h \
+ ..\lib\arch\win16\ft_conf.h ..\lib\ttdebug.h \
+ ..\lib\ttobjs.h ..\lib\ttengine.h \
+ ..\lib\ttmutex.h ..\lib\ttcache.h \
+ ..\lib\tttables.h ..\lib\ttcmap.h
+ftdump.obj: ftdump.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxcmap.h ..\lib\extend\ftxopen.h \
+ ..\lib\extend\ftxgdef.h ..\lib\extend\ftxgsub.h \
+ ..\lib\extend\ftxgpos.h ..\lib\extend\ftxsbit.h \
+ ..\lib\ttobjs.h ..\lib\ttconfig.h \
+ ..\lib\arch\win16\ft_conf.h ..\lib\ttengine.h \
+ ..\lib\tttypes.h ..\lib\ttmutex.h \
+ ..\lib\ttcache.h ..\lib\tttables.h \
+ ..\lib\ttcmap.h ..\lib\ttmemory.h
+fterror.obj: fterror.c ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxerr18.h \
+ ..\lib\arch\win16\ft_conf.h
+ftlint.obj: ftlint.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\arch\win16\ft_conf.h
+ftmetric.obj: ftmetric.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxsbit.h textdisp.h \
+ ..\lib\arch\win16\ft_conf.h
+ftsbit.obj: ftsbit.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxsbit.h textdisp.h \
+ ..\lib\arch\win16\ft_conf.h
+ftstring.obj: ftstring.c common.h display.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gevents.h \
+ gdriver.h gmain.h
+ftstrpnm.obj: ftstrpnm.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+ftstrtto.obj: ftstrtto.c arabic.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxopen.h ..\lib\extend\ftxgdef.h \
+ ..\lib\extend\ftxgsub.h ..\lib\extend\ftxgpos.h \
+ blitter.h common.h display.h ..\lib\extend\ftxkern.h \
+ ..\lib\extend\ftxsbit.h gdriver.h gevents.h gmain.h \
+ ..\lib\ttmemory.h ..\lib\ttconfig.h \
+ ..\lib\arch\win16\ft_conf.h ..\lib\tttypes.h
+fttimer.obj: fttimer.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gdriver.h \
+ gevents.h gmain.h
+ftview.obj: ftview.c blitter.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h common.h \
+ display.h ..\lib\extend\ftxsbit.h gdriver.h gevents.h \
+ gmain.h
+ftzoom.obj: ftzoom.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxpost.h gdriver.h gevents.h gmain.h
+gmain.obj: gmain.c gdriver.h gmain.h
+textdisp.obj: textdisp.c textdisp.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+!ifndef __MAKE__
+arch\win16\gw_win16.obj: arch\win16\gw_win16.c gdriver.h gevents.h gmain.h
+!endif
diff --git a/Build/source/libs/freetype/test/arch/win16/gw_win16.c b/Build/source/libs/freetype/test/arch/win16/gw_win16.c
new file mode 100644
index 00000000000..33332203a37
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win16/gw_win16.c
@@ -0,0 +1,431 @@
+/*******************************************************************
+ *
+ * gw_win16.c graphics driver for 16-bit Windows platform. 0.1
+ *
+ * This is the driver for displaying inside a window under 16-bit
+ * Microsoft Windows, used by the graphics utility of the
+ * FreeType test suite.
+ *
+ * Written by Antoine Leca.
+ * Copyright 1999-2001 by Antoine Leca,
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * Borrowing liberally from the other FreeType drivers.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include <windows.h> /* should be #included before everything else */
+ /* because it #defines NULL in a peculiar way */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+/* The following #ifdef are used to define the following macros : */
+/* */
+/* - hInst : variable containing the handle of the current instance. */
+/* - hPrev : variable containing the handle of the previous instance. */
+/* */
+
+/* ---- Microsoft C compilers support ------------------------------------ */
+
+#if defined( M_I86 ) || defined( _M_I86 )
+
+extern HINSTANCE _hInstance, _hPrevInstance;
+#define hInst _hInstance
+#define hPrev _hPrevInstance
+
+#endif
+
+/* ---- Borland C compiler support --------------------------------------- */
+
+#ifdef __TURBOC__
+
+#pragma option -A-
+
+extern HINSTANCE _hInstance, _hPrev;
+#define hInst _hInstance
+#define hPrev _hPrev
+
+#endif
+
+
+#if !defined ( hInst ) || !defined ( hPrev )
+#error Your compiler is not (yet) supported. Check the source file!
+#endif
+
+/* ---- Common initialisations ------------------------------------------- */
+
+/* Size of the window. */
+#define WIN_WIDTH 640u
+#define WIN_HEIGHT 400u
+/* The values will be divided by 2 for gray-scale rendering. */
+
+/* These values can be changed, but WIN_WIDTH should remain for now a */
+/* multiple of 32 to avoid padding issues. */
+
+/* Also, to avoid 16-bit overflowing issues, the product */
+/* WIN_WIDTH * WIN_HEIGHT should not excess 512K for monochrome */
+/* rendering, and 256K for gray-scale rendering. */
+
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+ /* handle of the window. */
+ static HWND hwndGraphic;
+
+ /* bitmap information */
+ static LPBITMAPINFO pbmi;
+ static HBITMAP hbm;
+
+ /* local event to pass on */
+ static TEvent ourevent = { event_Quit, 0 };
+ static int eventToProcess = 0;
+
+ /* array defined in the test programs */
+ extern char Header[];
+
+
+/* restores screen to its original state */
+
+int Driver_Restore_Mode()
+ {
+ /* The graphical window has perhaps already destroyed itself */
+ if ( hwndGraphic ) {
+ DestroyWindow ( hwndGraphic );
+ PostMessage ( hwndGraphic, WM_QUIT, 0, 0 );
+ }
+
+ if ( pbmi ) free ( pbmi );
+
+ return 1;
+ }
+
+
+/*
+ * set graphics mode
+ * and create the window class and the message handling.
+ */
+
+/* Declarations of the Windows-specific functions that are below. */
+static BOOL RegisterTheClass ( void );
+static BOOL CreateTheWindow ( int width, int height );
+
+
+int Driver_Set_Graphics ( int mode )
+ {
+ int i;
+ static const RGBQUAD gray_scale[5] = {
+ { 0xFF, 0xFF, 0xFF, 0 }, /* white */
+ { 0xC0, 0xC0, 0xC0, 0 },
+ { 0x80, 0x80, 0x80, 0 },
+ { 0x40, 0x40, 0x40, 0 },
+ { 0, 0, 0, 0 } }; /* black */
+
+ if( ! RegisterTheClass() ) return 0; /* if already running, fails. */
+
+ /* find some memory for the bitmap header */
+ if ( (pbmi = malloc ( sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 ) )
+ /* 256 should really be 2 if not grayscale */
+ == NULL )
+ /* lack of memory; fails the process */
+ return 0;
+
+ /* initialize the header to appropriate values */
+ memset( pbmi, 0, sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 );
+
+ switch ( mode )
+ {
+ case Graphics_Mode_Mono:
+ pbmi->bmiHeader.biBitCount = 1;
+ pbmi->bmiColors[0] = gray_scale[0];
+ pbmi->bmiColors[1] = gray_scale[4];
+
+ vio_ScanLineWidth = WIN_WIDTH / 8;
+ vio_Width = WIN_WIDTH;
+ vio_Height = WIN_HEIGHT;
+
+ break;
+
+ case Graphics_Mode_Gray:
+ pbmi->bmiHeader.biBitCount = 8;
+ pbmi->bmiHeader.biClrUsed = 5;
+
+ memcpy ( &pbmi->bmiColors[0], gray_scale, sizeof gray_scale );
+
+ vio_ScanLineWidth = WIN_WIDTH / 2;
+ vio_Width = WIN_WIDTH / 2;
+ vio_Height = WIN_HEIGHT/ 2;
+
+ for ( i = 0; i < 5; ++i )
+ gray_palette[i] = i;
+
+ break;
+
+ default:
+
+ free ( pbmi );
+ return 0; /* Unknown mode */
+ }
+
+ pbmi->bmiHeader.biSize = sizeof ( BITMAPINFOHEADER );
+ pbmi->bmiHeader.biWidth = vio_Width;
+ pbmi->bmiHeader.biHeight = vio_Height;
+ pbmi->bmiHeader.biPlanes = 1;
+
+ if ( (long) vio_Height * vio_ScanLineWidth > 0xFFE0ul )
+ /* too big to work on 16-bit; fails the process */
+ {
+ free ( pbmi );
+ return 0;
+ }
+
+ if( ! CreateTheWindow ( vio_Width, vio_Height ) )
+ {
+ free ( pbmi );
+ return 0;
+ }
+
+ return 1; /* success even if the window was not built. */
+ }
+
+
+int Driver_Display_Bitmap ( char* buffer, int lines, int cols )
+ {
+ HDC hDC;
+
+ if ( cols * 8 != pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount )
+ pbmi->bmiHeader.biWidth = cols * 8 / pbmi->bmiHeader.biBitCount;
+
+ hDC = GetDC ( hwndGraphic );
+ SetDIBits ( hDC, hbm, 0, lines, buffer, pbmi, DIB_RGB_COLORS );
+ ReleaseDC ( hwndGraphic, hDC );
+
+ ShowWindow( hwndGraphic, SW_SHOW );
+ InvalidateRect ( hwndGraphic, NULL, FALSE );
+ UpdateWindow ( hwndGraphic );
+
+ return 1; /* success */
+ }
+
+
+void Get_Event( TEvent* event )
+ {
+ MSG msg;
+
+ if ( hwndGraphic )
+ {
+ SetWindowText ( hwndGraphic, Header );
+ }
+
+ do {
+ while ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ) {
+ TranslateMessage ( &msg );
+ DispatchMessage ( &msg );
+ }
+ if ( ! eventToProcess )
+ WaitMessage();
+ } while ( ! eventToProcess );
+
+ event->what = ourevent.what;
+ event->info = ourevent.info;
+ eventToProcess = 0;
+ return;
+ }
+
+
+/* ---- Windows-specific stuff ------------------------------------------- */
+
+LRESULT CALLBACK Message_Process( HWND, UINT, WPARAM, LPARAM );
+
+static
+BOOL RegisterTheClass ( void )
+ {
+ WNDCLASS ourClass = {
+ /* UINT style */ 0,
+ /* WNDPROC lpfnWndProc */ Message_Process,
+ /* int cbClsExtra */ 0,
+ /* int cbWndExtra */ 0,
+ /* HANDLE hInstance */ 0,
+ /* HICON hIcon */ 0,
+ /* HCURSOR hCursor */ 0,
+ /* HBRUSH hbrBackground*/ 0,
+ /* LPCTSTR lpszMenuName */ NULL,
+ /* LPCTSTR lpszClassName*/ "FreeTypeTestGraphicDriver16"
+ };
+
+ if( hPrev )
+ /* There is another instance of the same program. */
+ /* No need to register the class. */
+ return 1;
+
+ ourClass.hInstance = hInst;
+ ourClass.hIcon = LoadIcon(0, IDI_APPLICATION);
+ ourClass.hCursor = LoadCursor(0, IDC_ARROW);
+ ourClass.hbrBackground= GetStockObject(BLACK_BRUSH);
+
+ return RegisterClass(&ourClass) != 0; /* return False if it fails. */
+ }
+
+static
+BOOL CreateTheWindow ( int width, int height )
+ {
+ if ( ! (hwndGraphic = CreateWindow(
+ /* LPCSTR lpszClassName; */ "FreeTypeTestGraphicDriver16",
+ /* LPCSTR lpszWindowName; */ "FreeType Test Graphic Driver",
+ /* DWORD dwStyle; */ WS_OVERLAPPED | WS_SYSMENU,
+ /* int x; */ CW_USEDEFAULT,
+ /* int y; */ CW_USEDEFAULT,
+ /* int nWidth; */ width + 2*GetSystemMetrics(SM_CXBORDER),
+ /* int nHeight; */ height+ GetSystemMetrics(SM_CYBORDER)
+ + GetSystemMetrics(SM_CYCAPTION),
+ /* HWND hwndParent; */ HWND_DESKTOP,
+ /* HMENU hmenu; */ 0,
+ /* HINSTANCE hinst; */ hInst,
+ /* void FAR* lpvParam; */ NULL))
+ )
+ /* creation failed... */
+ return 0;
+
+ return 1;
+ }
+
+ /* Message processing for our Windows class */
+LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
+ WPARAM wParam, LPARAM lParam )
+ {
+
+ switch( mess )
+ {
+ case WM_DESTROY:
+ /* warn the main thread to quit if it didn't know */
+ ourevent.what = event_Quit;
+ ourevent.info = 0;
+ eventToProcess = 1;
+ hwndGraphic = 0;
+ PostQuitMessage ( 0 );
+ DeleteObject ( hbm );
+ break;
+
+ case WM_CREATE:
+ {
+ HDC hDC;
+
+ hDC = GetDC ( handle );
+ hbm = CreateDIBitmap (
+ /* HDC hdc; handle of device context */ hDC,
+ /* BITMAPINFOHEADER FAR* lpbmih; addr.of header*/ &pbmi->bmiHeader,
+ /* DWORD dwInit; CBM_INIT to initialize bitmap */ 0,
+ /* const void FAR* lpvBits; address of values */ NULL,
+ /* BITMAPINFO FAR* lpbmi; addr.of bitmap data */ pbmi,
+ /* UINT fnColorUse; RGB or palette indices */ DIB_RGB_COLORS);
+ ReleaseDC ( handle, hDC );
+ break;
+ }
+
+ case WM_PAINT:
+ {
+ HDC hDC, memDC;
+ HANDLE oldbm;
+ PAINTSTRUCT ps;
+
+ hDC = BeginPaint ( handle, &ps );
+ memDC = CreateCompatibleDC(hDC);
+ oldbm = SelectObject(memDC, hbm);
+ BitBlt ( hDC, 0, 0, vio_Width, vio_Height, memDC, 0, 0, SRCCOPY);
+ ReleaseDC ( handle, hDC );
+ SelectObject ( memDC, oldbm );
+ DeleteObject ( memDC );
+ EndPaint ( handle, &ps );
+ }
+
+ case WM_KEYDOWN:
+ switch ( wParam )
+ {
+ case VK_ESCAPE:
+ ourevent.what = event_Quit;
+ ourevent.info = 0;
+ eventToProcess = 1;
+ break;
+
+ case VK_F1: /* bring up help and about dialog window */
+ break;
+ }
+ break;
+
+ case WM_CHAR:
+ {
+ char c = wParam ;
+ int i;
+
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ ourevent.what = trans[i].event_class;
+ ourevent.info = trans[i].event_info;
+ eventToProcess = 1;
+ return 0;
+ }
+ }
+
+ /* unrecognized keystroke */
+ ourevent.what = event_Keyboard;
+ ourevent.info = (int)c;
+ eventToProcess = 1;
+ }
+ break;
+
+ default:
+ return DefWindowProc( handle, mess, wParam, lParam );
+ }
+
+ return 0;
+ }
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/win16/makedep b/Build/source/libs/freetype/test/arch/win16/makedep
new file mode 100755
index 00000000000..6e8812cb07a
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win16/makedep
@@ -0,0 +1,43 @@
+# makedep
+#
+# This shell script creates a dependency file necessary for older compilers
+# on the Windows 16-bit platform.
+#
+# If you run this script under non-Windows operating systems, expect
+# warnings that `windows.h' can't be found.
+#
+# Copyright 1996-2002 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.
+
+echo "\
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in \`makedep'...
+#
+# This dependency file to be used with various Windows compilers
+# has been generated automatically with the script \`makedep' on
+# `date +%Y-%m-%d`.
+" > depend.win
+
+(cd ../..
+ gcc -MM -I../lib/arch/win16 -I../lib -I../lib/extend -I. \
+ *.c | \
+ sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.win
+
+echo "!ifndef __MAKE__" >> depend.win
+
+(cd ../..
+ gcc -MM -I../lib/arch/win16 -I../lib -I../lib/extend -I. \
+ -DhInst -DhPrev arch/win16/*.c | \
+ sed -e "s/^\(.*\)\.o:/arch\\\\win16\\\\\1.obj:/" \
+ -e "s:/:\\\\:g") >> depend.win
+
+echo "!endif" >> depend.win
+
+# eof
diff --git a/Build/source/libs/freetype/test/arch/win32/Makefile.BC b/Build/source/libs/freetype/test/arch/win32/Makefile.BC
new file mode 100644
index 00000000000..7e6ddd46b2f
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/Makefile.BC
@@ -0,0 +1,207 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for BC++ for Win32.
+#
+# Tested with Borland C++ v.4.02, 5.0, and Borland C++ builder 4.
+# You will need Borland MAKE.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# make -farch\win32\Makefile.BC
+#
+#
+# A DLL version of the library can be built and then used with
+#
+# make -DDLL -farch/win16/Makefile.BC dll
+#
+# (do not forget to define DLL, otherwise the link phase will fail).
+#
+#
+# A debug version can be obtained with
+#
+# make -DDEBUG -farch\win32\Makefile.BC
+#
+#
+# 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.
+
+ARCH = arch\win32
+FT_MAKEFILE = $(ARCH)\Makefile.BC
+FT_DLL = ft15_32.dll
+
+CC = bcc32
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR);$(LIBDIR)\$(ARCH);.;$(LIBDIR)\extend
+SPURIOUS_WARNINGS = -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -w-pia
+CFLAGS = -i64 $(INCDIRS) $(SPURIOUS_WARNINGS)
+
+!ifndef DEBUG
+CFLAGS = $(CFLAGS) -O2 -A
+LDFLAGS = -WC
+!else
+CFLAGS = $(CFLAGS) -v
+LDFLAGS = -v -WC
+!endif
+
+!ifdef DLL
+CFLAGS = $(CFLAGS) -DFREETYPE_DLL
+!endif
+
+# Windows graphic driver
+GDRIVER = $(ARCH)\gw_win32.c
+
+DISPLAY = display.c
+
+G1SRC = gmain.c blitter.c $(GDRIVER)
+GSRC = $(DISPLAY) $(G1SRC)
+
+GOBJ = $(GSRC:.c=.obj)
+G1OBJ = $(G1SRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) $<
+|
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!ifndef DEBUG
+# Skipped if DEBUG build
+all: freetype $(EXEFILES)
+
+dll: the_dll $(EXEFILES)
+
+!else
+# Skipped if non-DEBUG build
+default_target: debug
+dll: the_debug_dll $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDEBUG debug
+ cd ..\test
+
+the_dll:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDLL dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+the_debug_dll:
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) -DDEBUG -DDLL dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+
+# C compilers are unable to include <windows.h> in ANSI mode,
+# because of the // comments...
+# So we have a special rule for this file, to build it outside ANSI.
+$(GDRIVER:.c=.obj):
+ $(CC) -c -o$* @&&|
+ $(CFLAGS) -A- $*.c
+|
+
+
+# Borland versions of make are unable to use the $** variable inside
+# implicit rules (like .obj.exe:). The job have to be done by hand. :-(
+ftzoom.exe: $(G1OBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftzoom.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftview.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstring.obj $(GOBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrtto.obj $(GOBJ) common.obj arabic.obj \
+ $(LIBDIR)\libttf.lib
+
+fttimer.exe: $(G1OBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fttimer.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
+
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftlint.obj common.obj $(LIBDIR)\libttf.lib
+
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftdump.obj common.obj $(LIBDIR)\libttf.lib
+
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+
+ftsbit.exe: $(TDOBJ) ftsbit.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftsbit.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+ftmetric.exe: $(TDOBJ) ftmetric.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) ftmetric.obj textdisp.obj common.obj $(LIBDIR)\libttf.lib
+
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+ $(CC) $(LDFLAGS) fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ make -f$(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+ -del *.dll
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+ -del *.tds
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile
diff --git a/Build/source/libs/freetype/test/arch/win32/Makefile.CL b/Build/source/libs/freetype/test/arch/win32/Makefile.CL
new file mode 100644
index 00000000000..18d8477c3cf
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/Makefile.CL
@@ -0,0 +1,185 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for Microsoft Visual C++.
+#
+# You will need NMAKE.
+#
+#
+# Use this file while in the 'test' directory with the following statement:
+#
+# nmake /f arch\win32\Makefile.CL
+#
+# A DLL version of the library can be built and then used with
+#
+# nmake DLL=1 /f arch\win32\Makefile.CL dll
+#
+# (do not forget to define DLL, otherwise the link phase will fail).
+#
+#
+# Debug versions can be obtained with
+#
+# nmake DEBUG=1 /f arch\win32\Makefile.CL
+#
+#
+# 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.
+
+ARCH = arch\win32
+FT_MAKEFILE = $(ARCH)\Makefile.CL
+FT_MAKE = $(MAKE) /nologo
+FT_DLL = ft15_32.dll
+
+CC = cl /nologo
+
+LIBDIR = ..\lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)\$(ARCH) -I. -I$(LIBDIR)\extend
+
+CFLAGS_ANSI = /Za
+!ifndef DEBUG
+CFLAGS = /Ox /W2 $(INCDIRS)
+LDFLAGS =
+!else
+CFLAGS = /Zi /Ge /W2 $(INCDIRS)
+LDFLAGS = /Zi
+!endif
+
+!ifdef DLL
+CFLAGS = $(CFLAGS) /DEXPORT_DEF=__declspec(dllexport) /DFREETYPE_DLL
+!endif
+
+
+# Windows graphic driver
+GDRIVER = $(ARCH)\gw_win32.c
+
+GSRC = display.c gmain.c blitter.c $(GDRIVER)
+
+GOBJ = $(GSRC:.c=.obj)
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+OBJ = $(SRC:.c=.obj)
+
+
+.c.obj:
+ @$(CC) /c /Fo$* @<<
+ $(CFLAGS) $(CFLAGS_ANSI) $<
+<<
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+!ifndef DEBUG
+# Skiped if DEBUG build
+all: freetype $(EXEFILES)
+
+dll: the_dll $(EXEFILES)
+
+!else
+# Skipped if non-DEBUG build
+default_target: debug
+dll: the_debug_dll $(EXEFILES)
+
+!endif
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) all
+ cd ..\test
+
+freetype_debug:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 debug
+ cd ..\test
+
+the_dll:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DLL=1 dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+the_debug_dll:
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) DEBUG=1 DLL=1 dll
+ cd ..\test
+ -copy $(LIBDIR)\$(FT_DLL)
+
+
+# C compilers are unable to include 32-bit <windows.h> in ANSI mode.
+# So we have a special rule for this file, to build it outside ANSI.
+$(GDRIVER:.c=.obj):
+ $(CC) /c /Fo$* @<<
+ $(CFLAGS) /Ze $(GDRIVER)
+<<
+
+.obj.exe:
+ $(CC) /Fe$* @<<
+ $(LDFLAGS) $** GDI32.LIB USER32.LIB
+<<
+
+ftzoom.exe: $(GOBJ) ftzoom.obj common.obj $(LIBDIR)\libttf.lib
+ftview.exe: $(GOBJ) ftview.obj common.obj $(LIBDIR)\libttf.lib
+ftstring.exe: $(GOBJ) ftstring.obj common.obj $(LIBDIR)\libttf.lib
+ftstrtto.exe: $(GOBJ) ftstrtto.obj common.obj arabic.obj $(LIBDIR)\libttf.lib
+fttimer.exe: $(GOBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
+ftlint.exe: ftlint.obj common.obj $(LIBDIR)\libttf.lib
+ftdump.exe: ftdump.obj common.obj $(LIBDIR)\libttf.lib
+ftstrpnm.exe: ftstrpnm.obj common.obj $(LIBDIR)\libttf.lib
+ftsbit.exe: ftsbit.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+ftmetric.exe: ftmetric.obj common.obj textdisp.obj $(LIBDIR)\libttf.lib
+fterror.exe: fterror.obj common.obj $(LIBDIR)\libttf.lib
+
+
+clean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) clean
+ cd ..\test
+
+distclean: do_clean
+ cd $(LIBDIR)
+ $(FT_MAKE) /f $(FT_MAKEFILE) distclean
+ cd ..\test
+ -del *.exe
+ -del *.dll
+ -del *.pdb
+
+do_clean:
+ -del *.obj
+ -del $(ARCH)\*.obj
+ -del *.ilk
+ -del *.pch
+ -del *.exp
+
+
+!include "$(ARCH)\depend.win"
+
+# end of Makefile.CL
diff --git a/Build/source/libs/freetype/test/arch/win32/Makefile.Min b/Build/source/libs/freetype/test/arch/win32/Makefile.Min
new file mode 100644
index 00000000000..3e0552c7942
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/Makefile.Min
@@ -0,0 +1,134 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for MinGW32 gcc under Win9x.
+#
+# You will need a port of GNU make; the MingW32 port works.
+#
+# Use this file while in the 'test' directory with the following statements:
+#
+# make -f arch/win32/Makefile.min depend
+# make -f arch/win32/Makefile.min
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/win32
+FT_MAKEFILE = $(ARCH)/Makefile.min
+
+CC = gcc
+
+LIBDIR = ../lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend
+
+ifdef DEBUG
+
+CFLAGS = -ansi -pedantic -Wall -O2 -g $(INCDIRS)
+LDFLAGS = -g -luser32 -lgdi32
+
+else
+
+CFLAGS = -ansi -pedantic -Wall -O2 -s $(INCDIRS)
+LDFLAGS = -s -luser32 -lgdi32
+
+endif
+
+
+# graphic Windows driver
+GDRIVER = $(ARCH)/gw_win32.c
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+GSRC = gmain.c display.c blitter.c $(GDRIVER)
+GOBJ = $(GSRC:.c=.o)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+
+%.exe:
+ $(CC) $(LDFLAGS) -o $@ $^
+
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+freetype:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all
+
+freetype_debug:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug
+
+ftzoom.exe: $(GOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview.exe: $(GOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint.exe: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump.exe: ftdump.o common.o $(LIBDIR)/libttf.a
+fterror.exe: fterror.o common.o $(LIBDIR)/libttf.a
+ftstring.exe: $(GOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+fttimer.exe: $(GOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftstrpnm.exe: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+ftsbit.exe: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftmetric.exe: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto.exe: $(GOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean
+
+distclean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
+ -del dep.end
+ -del *.exe
+ -del core
+
+do_clean:
+ -del *.o
+ -del response
+ -del $(subst /,\,$(GDRIVER:.c=.o))
+
+depend: $(SRC) $(GSRC)
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
+ $(CC) -E -MM $(INCDIRS) $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/test/arch/win32/Makefile.gcc b/Build/source/libs/freetype/test/arch/win32/Makefile.gcc
new file mode 100644
index 00000000000..58b7eb22f79
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/Makefile.gcc
@@ -0,0 +1,143 @@
+# This file is part of the FreeType project.
+#
+# It builds the library and test programs for gcc under Win32.
+#
+# You will need GNU make.
+#
+# Use this file while in the 'test' directory with the following statements:
+#
+# make -f arch/win32/Makefile.gcc depend
+# make -f arch/win32/Makefile.gcc
+#
+#
+# If you have the GNU gettext package installed, you can also try
+#
+# make -f arch/win32/Makefile.gcc HAVE_GETTEXT
+#
+#
+# Copyright 1996-2002 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.
+
+ARCH = arch/win32
+FT_MAKEFILE = $(ARCH)/Makefile.gcc
+
+CC = gcc
+
+LIBDIR = ../lib
+INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend
+
+ifndef GETTEXT
+GETTEXT=NO_GETTEXT
+endif
+
+CFLAGS = -Wall -ansi -O2 -g $(INCDIRS)
+# -D$(GETTEXT)
+# CFLAGS = -ansi -Wall -O2 -s $(INCDIRS) -D$(GETTEXT)
+
+
+# graphic Windows driver
+GDRIVER = $(ARCH)/gw_win32.c
+
+SRC = arabic.c \
+ common.c \
+ textdisp.c \
+ ftdump.c \
+ fterror.c \
+ ftlint.c \
+ ftmetric.c \
+ ftsbit.c \
+ ftstring.c \
+ ftstrpnm.c \
+ ftstrtto.c \
+ fttimer.c \
+ ftview.c \
+ ftzoom.c
+
+GSRC = gmain.c display.c blitter.c $(GDRIVER)
+GOBJ = $(GSRC:.c=.o)
+
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+
+ifeq ($(GETTEXT),HAVE_GETTEXT)
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $^ -lintl
+else
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $^ -luser32 -lgdi32
+endif
+
+
+EXEFILES = ftdump.exe \
+ fterror.exe \
+ ftlint.exe \
+ ftmetric.exe \
+ ftsbit.exe \
+ ftstring.exe \
+ ftstrpnm.exe \
+ ftstrtto.exe \
+ fttimer.exe \
+ ftview.exe \
+ ftzoom.exe
+
+.PHONY: all debug freetype freetype_debug \
+ clean distclean do_clean depend
+
+
+all: freetype $(EXEFILES)
+
+debug: freetype_debug $(EXEFILES)
+
+HAVE_GETTEXT:
+ $(MAKE) -f $(FT_MAKEFILE) GETTEXT=HAVE_GETTEXT all
+
+freetype:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all
+
+freetype_debug:
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug
+
+ftzoom.exe: $(GOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
+ftview.exe: $(GOBJ) ftview.o common.o $(LIBDIR)/libttf.a
+ftlint.exe: ftlint.o common.o $(LIBDIR)/libttf.a
+ftdump.exe: ftdump.o common.o $(LIBDIR)/libttf.a
+fterror.exe: fterror.o common.o $(LIBDIR)/libttf.a
+ftstring.exe: $(GOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
+fttimer.exe: $(GOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
+ftstrpnm.exe: ftstrpnm.o common.o $(LIBDIR)/libttf.a
+ftsbit.exe: ftsbit.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftmetric.exe: ftmetric.o common.o textdisp.o $(LIBDIR)/libttf.a
+ftstrtto.exe: $(GOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a
+
+
+clean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean
+
+distclean: do_clean
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
+ -del dep.end
+ -del *.exe
+ -del core
+
+do_clean:
+ -del *.o
+ -del response
+ -del $(GDRIVER:.c=.o)
+
+depend: $(SRC) $(GSRC)
+ $(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
+ $(CC) -E -MM $(INCDIRS) $^ > dep.end
+
+ifeq (dep.end,$(wildcard dep.end))
+ include dep.end
+endif
+
+# end of Makefile.gcc
diff --git a/Build/source/libs/freetype/test/arch/win32/depend.win b/Build/source/libs/freetype/test/arch/win32/depend.win
new file mode 100644
index 00000000000..193f4af6d31
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/depend.win
@@ -0,0 +1,78 @@
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in `makedep'...
+#
+# This dependency file to be used with various Windows compilers
+# has been generated automatically with the script `makedep' on
+# 2002-02-19.
+
+arabic.obj: arabic.c arabic.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxopen.h ..\lib\extend\ftxgdef.h \
+ ..\lib\extend\ftxgsub.h ..\lib\extend\ftxgpos.h
+blitter.obj: blitter.c blitter.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+common.obj: common.c common.h
+display.obj: display.c display.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gmain.h
+fdebug.obj: fdebug.c ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\tttypes.h ..\lib\ttconfig.h \
+ ..\lib\arch\win32\ft_conf.h ..\lib\ttdebug.h \
+ ..\lib\ttobjs.h ..\lib\ttengine.h \
+ ..\lib\ttmutex.h ..\lib\ttcache.h \
+ ..\lib\tttables.h ..\lib\ttcmap.h
+ftdump.obj: ftdump.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxcmap.h ..\lib\extend\ftxopen.h \
+ ..\lib\extend\ftxgdef.h ..\lib\extend\ftxgsub.h \
+ ..\lib\extend\ftxgpos.h ..\lib\extend\ftxsbit.h \
+ ..\lib\ttobjs.h ..\lib\ttconfig.h \
+ ..\lib\arch\win32\ft_conf.h ..\lib\ttengine.h \
+ ..\lib\tttypes.h ..\lib\ttmutex.h \
+ ..\lib\ttcache.h ..\lib\tttables.h \
+ ..\lib\ttcmap.h ..\lib\ttmemory.h
+fterror.obj: fterror.c ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxerr18.h \
+ ..\lib\arch\win32\ft_conf.h
+ftlint.obj: ftlint.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\arch\win32\ft_conf.h
+ftmetric.obj: ftmetric.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxsbit.h textdisp.h \
+ ..\lib\arch\win32\ft_conf.h
+ftsbit.obj: ftsbit.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxsbit.h textdisp.h \
+ ..\lib\arch\win32\ft_conf.h
+ftstring.obj: ftstring.c common.h display.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gevents.h \
+ gdriver.h gmain.h
+ftstrpnm.obj: ftstrpnm.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+ftstrtto.obj: ftstrtto.c arabic.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxopen.h ..\lib\extend\ftxgdef.h \
+ ..\lib\extend\ftxgsub.h ..\lib\extend\ftxgpos.h \
+ blitter.h common.h display.h ..\lib\extend\ftxkern.h \
+ ..\lib\extend\ftxsbit.h gdriver.h gevents.h gmain.h \
+ ..\lib\ttmemory.h ..\lib\ttconfig.h \
+ ..\lib\arch\win32\ft_conf.h ..\lib\tttypes.h
+fttimer.obj: fttimer.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h gdriver.h \
+ gevents.h gmain.h
+ftview.obj: ftview.c blitter.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h common.h \
+ display.h ..\lib\extend\ftxsbit.h gdriver.h gevents.h \
+ gmain.h
+ftzoom.obj: ftzoom.c common.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h \
+ ..\lib\extend\ftxpost.h gdriver.h gevents.h gmain.h
+gmain.obj: gmain.c gdriver.h gmain.h
+textdisp.obj: textdisp.c textdisp.h ..\lib\freetype.h \
+ ..\lib\fterrid.h ..\lib\ftnameid.h
+!ifndef __MAKE__
+arch\win32\gw_win32.obj: arch\win32\gw_win32.c gdriver.h gevents.h gmain.h
+!endif
diff --git a/Build/source/libs/freetype/test/arch/win32/gw_win32.c b/Build/source/libs/freetype/test/arch/win32/gw_win32.c
new file mode 100644
index 00000000000..e11c63ca1ff
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/gw_win32.c
@@ -0,0 +1,378 @@
+/*******************************************************************
+ *
+ * gw_win32.c graphics driver for Win32 platform. 0.1
+ *
+ * This is the driver for displaying inside a window under Win32,
+ * used by the graphics utility of the FreeType test suite.
+ *
+ * Written by Antoine Leca.
+ * Copyright 1999-2000 Antoine Leca,
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * Borrowing liberally from the other FreeType drivers.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+
+/* Size of the window. */
+#define WIN_WIDTH 640u
+#define WIN_HEIGHT 450u
+
+/* These values can be changed, but WIN_WIDTH should remain for now a */
+/* multiple of 32 to avoid padding issues. */
+
+
+ typedef struct _Translator
+ {
+ char key;
+ GEvent event_class;
+ int event_info;
+ } Translator;
+
+#define NUM_Translators 20
+
+ static const Translator trans[NUM_Translators] =
+ {
+ { (char)27, event_Quit, 0 },
+ { 'q', event_Quit, 0 },
+
+ { 'x', event_Rotate_Glyph, -1 },
+ { 'c', event_Rotate_Glyph, 1 },
+ { 'v', event_Rotate_Glyph, -16 },
+ { 'b', event_Rotate_Glyph, 16 },
+
+ { '{', event_Change_Glyph, -10000 },
+ { '}', event_Change_Glyph, 10000 },
+ { '(', event_Change_Glyph, -1000 },
+ { ')', event_Change_Glyph, 1000 },
+ { '9', event_Change_Glyph, -100 },
+ { '0', event_Change_Glyph, 100 },
+ { 'i', event_Change_Glyph, -10 },
+ { 'o', event_Change_Glyph, 10 },
+ { 'k', event_Change_Glyph, -1 },
+ { 'l', event_Change_Glyph, 1 },
+
+ { '+', event_Scale_Glyph, 10 },
+ { '-', event_Scale_Glyph, -10 },
+ { 'u', event_Scale_Glyph, 1 },
+ { 'j', event_Scale_Glyph, -1 }
+ };
+
+ /* handle of the window. */
+ static HWND hwndGraphic;
+
+ /* bitmap information */
+ static LPBITMAPINFO pbmi;
+ static HBITMAP hbm;
+
+ /* local event to pass on */
+ static TEvent ourevent = { event_Quit, 0 };
+ static int eventToProcess = 0;
+
+ /* array defined in the test programs */
+ extern char Header[];
+
+
+/* restores screen to its original state */
+
+int Driver_Restore_Mode()
+ {
+ /* The graphical window has perhaps already destroyed itself */
+ if ( hwndGraphic ) {
+ DestroyWindow ( hwndGraphic );
+ PostMessage( hwndGraphic, WM_QUIT, 0, 0 );
+ }
+
+ if ( pbmi ) free ( pbmi );
+
+ return 1;
+ }
+
+
+/*
+ * set graphics mode
+ * and create the window class and the message handling.
+ */
+
+/* Declarations of the Windows-specific functions that are below. */
+static BOOL RegisterTheClass ( void );
+static BOOL CreateTheWindow ( int width, int height );
+
+
+int Driver_Set_Graphics ( int mode )
+ {
+ int i;
+ static RGBQUAD gray_scale[5] = {
+ { 0xFF, 0xFF, 0xFF, 0 }, /* white */
+ { 0xC0, 0xC0, 0xC0, 0 },
+ { 0x80, 0x80, 0x80, 0 },
+ { 0x40, 0x40, 0x40, 0 },
+ { 0, 0, 0, 0 } }; /* black */
+
+ if( ! RegisterTheClass() ) return 0; /* if already running, fails. */
+
+ /* find some memory for the bitmap header */
+ if ( (pbmi = malloc ( sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 ) )
+ /* 256 should really be 2 if not grayscale */
+ == NULL )
+ /* lack of memory; fails the process */
+ return 0;
+
+ /* initialize the header to appropriate values */
+ memset( pbmi, 0, sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 );
+
+ switch ( mode )
+ {
+ case Graphics_Mode_Mono:
+ pbmi->bmiHeader.biBitCount = 1;
+ pbmi->bmiColors[0] = gray_scale[0];
+ pbmi->bmiColors[1] = gray_scale[4];
+
+ vio_ScanLineWidth = WIN_WIDTH / 8;
+ vio_Width = WIN_WIDTH;
+ vio_Height = WIN_HEIGHT;
+
+ break;
+
+ case Graphics_Mode_Gray:
+ pbmi->bmiHeader.biBitCount = 8;
+ pbmi->bmiHeader.biClrUsed = 5;
+
+ memcpy ( &pbmi->bmiColors[0], gray_scale, sizeof gray_scale );
+
+ vio_ScanLineWidth = WIN_WIDTH;
+ vio_Width = WIN_WIDTH;
+ vio_Height = WIN_HEIGHT;
+
+ for ( i = 0; i < 5; ++i )
+ gray_palette[i] = i;
+
+ break;
+
+ default:
+ free ( pbmi );
+ return 0; /* Unknown mode */
+ }
+
+ pbmi->bmiHeader.biSize = sizeof ( BITMAPINFOHEADER );
+ pbmi->bmiHeader.biWidth = vio_Width;
+ pbmi->bmiHeader.biHeight = vio_Height;
+ pbmi->bmiHeader.biPlanes = 1;
+
+ if( ! CreateTheWindow(vio_Width, vio_Height) )
+ {
+ free ( pbmi );
+ return 0;
+ }
+
+ return 1; /* success even if the window was not built. */
+ }
+
+
+int Driver_Display_Bitmap ( char* buffer, int lines, int cols )
+ {
+ HDC hDC;
+
+ if ( cols * 8 != pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount )
+ pbmi->bmiHeader.biWidth = cols * 8 / pbmi->bmiHeader.biBitCount;
+
+ hDC = GetDC ( hwndGraphic );
+ SetDIBits ( hDC, hbm, 0, lines, buffer, pbmi, DIB_RGB_COLORS );
+ ReleaseDC ( hwndGraphic, hDC );
+
+ ShowWindow( hwndGraphic, SW_SHOW );
+ InvalidateRect ( hwndGraphic, NULL, FALSE );
+ UpdateWindow ( hwndGraphic );
+
+ return 1; /* success */
+ }
+
+
+void Get_Event( TEvent* event )
+ {
+ MSG msg;
+
+ if ( hwndGraphic )
+ {
+ SetWindowText ( hwndGraphic, Header );
+ }
+
+ do {
+ while ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ) {
+ TranslateMessage ( &msg );
+ DispatchMessage ( &msg );
+ }
+ if ( ! eventToProcess )
+ WaitMessage();
+ } while ( ! eventToProcess );
+
+ event->what = ourevent.what;
+ event->info = ourevent.info;
+ eventToProcess = 0;
+ return;
+ }
+
+
+/* ---- Windows-specific stuff ------------------------------------------- */
+
+LRESULT CALLBACK Message_Process( HWND, UINT, WPARAM, LPARAM );
+
+static
+BOOL RegisterTheClass ( void )
+ {
+ WNDCLASS ourClass = {
+ /* UINT style */ 0,
+ /* WNDPROC lpfnWndProc */ Message_Process,
+ /* int cbClsExtra */ 0,
+ /* int cbWndExtra */ 0,
+ /* HANDLE hInstance */ 0,
+ /* HICON hIcon */ 0,
+ /* HCURSOR hCursor */ 0,
+ /* HBRUSH hbrBackground*/ 0,
+ /* LPCTSTR lpszMenuName */ NULL,
+ /* LPCTSTR lpszClassName*/ "FreeTypeTestGraphicDriver"
+ };
+
+ ourClass.hInstance = GetModuleHandle( NULL );
+ ourClass.hIcon = LoadIcon(0, IDI_APPLICATION);
+ ourClass.hCursor = LoadCursor(0, IDC_ARROW);
+ ourClass.hbrBackground= GetStockObject(BLACK_BRUSH);
+
+ return RegisterClass(&ourClass) != 0; /* return False if it fails. */
+ }
+
+static
+BOOL CreateTheWindow ( int width, int height )
+ {
+
+ if ( ! (hwndGraphic = CreateWindow(
+ /* LPCSTR lpszClassName; */ "FreeTypeTestGraphicDriver",
+ /* LPCSTR lpszWindowName; */ "FreeType Test Graphic Driver",
+ /* DWORD dwStyle; */ WS_OVERLAPPED | WS_SYSMENU,
+ /* int x; */ CW_USEDEFAULT,
+ /* int y; */ CW_USEDEFAULT,
+ /* int nWidth; */ width + 2*GetSystemMetrics(SM_CXBORDER),
+ /* int nHeight; */ height+ GetSystemMetrics(SM_CYBORDER)
+ + GetSystemMetrics(SM_CYCAPTION),
+ /* HWND hwndParent; */ HWND_DESKTOP,
+ /* HMENU hmenu; */ 0,
+ /* HINSTANCE hinst; */ GetModuleHandle( NULL ),
+ /* void FAR* lpvParam; */ NULL))
+ )
+ /* creation failed... */
+ return 0;
+
+ return 1;
+ }
+
+ /* Message processing for our Windows class */
+LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
+ WPARAM wParam, LPARAM lParam )
+ {
+
+ switch( mess )
+ {
+ case WM_DESTROY:
+ /* warn the main thread to quit if it didn't know */
+ ourevent.what = event_Quit;
+ ourevent.info = 0;
+ eventToProcess = 1;
+ hwndGraphic = 0;
+ PostQuitMessage ( 0 );
+ DeleteObject ( hbm );
+ break;
+
+ case WM_CREATE:
+ {
+ HDC hDC;
+
+ hDC = GetDC ( handle );
+ hbm = CreateDIBitmap (
+ /* HDC hdc; handle of device context */ hDC,
+ /* BITMAPINFOHEADER FAR* lpbmih; addr.of header*/ &pbmi->bmiHeader,
+ /* DWORD dwInit; CBM_INIT to initialize bitmap */ 0,
+ /* const void FAR* lpvBits; address of values */ NULL,
+ /* BITMAPINFO FAR* lpbmi; addr.of bitmap data */ pbmi,
+ /* UINT fnColorUse; RGB or palette indices */ DIB_RGB_COLORS);
+ ReleaseDC ( handle, hDC );
+ break;
+ }
+
+ case WM_PAINT:
+ {
+ HDC hDC, memDC;
+ HANDLE oldbm;
+ PAINTSTRUCT ps;
+
+ hDC = BeginPaint ( handle, &ps );
+ memDC = CreateCompatibleDC(hDC);
+ oldbm = SelectObject(memDC, hbm);
+ BitBlt ( hDC, 0, 0, vio_Width, vio_Height, memDC, 0, 0, SRCCOPY);
+ ReleaseDC ( handle, hDC );
+ SelectObject ( memDC, oldbm );
+ DeleteObject ( memDC );
+ EndPaint ( handle, &ps );
+ }
+
+ case WM_KEYDOWN:
+ switch ( wParam )
+ {
+ case VK_ESCAPE:
+ ourevent.what = event_Quit;
+ ourevent.info = 0;
+ eventToProcess = 1;
+ break;
+
+ case VK_F1: /* bring up help and about dialog window */
+ break;
+ }
+ break;
+
+ case WM_CHAR:
+ {
+ char c = wParam ;
+ int i;
+
+ for ( i = 0; i < NUM_Translators; i++ )
+ {
+ if ( c == trans[i].key )
+ {
+ ourevent.what = trans[i].event_class;
+ ourevent.info = trans[i].event_info;
+ eventToProcess = 1;
+ return 0;
+ }
+ }
+
+ /* unrecognized keystroke */
+ ourevent.what = event_Keyboard;
+ ourevent.info = (int)c;
+ eventToProcess = 1;
+ }
+ break;
+
+ default:
+ return DefWindowProc( handle, mess, wParam, lParam );
+ }
+
+ return 0;
+ }
+
+/* End */
diff --git a/Build/source/libs/freetype/test/arch/win32/makedep b/Build/source/libs/freetype/test/arch/win32/makedep
new file mode 100755
index 00000000000..7f3f19ffdc5
--- /dev/null
+++ b/Build/source/libs/freetype/test/arch/win32/makedep
@@ -0,0 +1,42 @@
+# makedep
+#
+# This shell script creates a dependency file necessary for some compilers
+# on the Windows 32-bit platform.
+#
+# If you run this script under non-Windows operating systems, expect
+# warnings that `windows.h' can't be found.
+#
+# Copyright 1996-2002 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.
+
+echo "\
+# This file is part of the FreeType project.
+# Automatically generated, but you can customize to fit your needs.
+# However, changes will be erased if not made in \`makedep'...
+#
+# This dependency file to be used with various Windows compilers
+# has been generated automatically with the script \`makedep' on
+# `date +%Y-%m-%d`.
+" > depend.win
+
+(cd ../..
+ gcc -MM -I../lib/arch/win32 -I../lib -I../lib/extend -I. *.c | \
+ sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.win
+
+echo "!ifndef __MAKE__" >> depend.win
+
+(cd ../..
+ gcc -MM -I../lib/arch/win32 -I../lib -I../lib/extend -I. \
+ arch/win32/*.c | \
+ sed -e "s/^\(.*\)\.o:/arch\\\\win32\\\\\1.obj:/" \
+ -e "s:/:\\\\:g") >> depend.win
+
+echo "!endif" >> depend.win
+
+# eof
diff --git a/Build/source/libs/freetype/test/blitter.c b/Build/source/libs/freetype/test/blitter.c
new file mode 100644
index 00000000000..66926e1ee46
--- /dev/null
+++ b/Build/source/libs/freetype/test/blitter.c
@@ -0,0 +1,492 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2000 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* blitter.c: Support for blitting of bitmaps with various depth. */
+/* */
+/****************************************************************************/
+
+#include "blitter.h"
+
+
+ typedef struct TBlitter_
+ {
+ int width; /* width in pixels of the written area */
+ int height; /* height in pixels of the written area */
+
+ int xread; /* x position of start point in read area */
+ int yread; /* y position of start point in read area */
+
+ int xwrite; /* x position of start point in write area */
+ int ywrite; /* y position of start point in write area */
+
+ int right_clip; /* amount of right clip */
+
+ char* read; /* top left corner of source map */
+ char* write; /* top left corner of target map */
+
+ int read_line; /* byte increment to go down one row in read area */
+ int write_line; /* byte increment to go down one row in write area */
+
+ TT_Raster_Map source;
+ TT_Raster_Map target;
+
+ int source_depth;
+ int target_depth;
+
+ } TBlitter;
+
+
+ static
+ int compute_clips( TBlitter* blit,
+ int x_offset,
+ int y_offset )
+ {
+ int xmin, ymin, xmax, ymax, width, height, target_width;
+
+
+ /* perform clipping and setup variables */
+ width = blit->source.width;
+ height = blit->source.rows;
+
+ switch ( blit->source_depth )
+ {
+ case 1:
+ width = (width + 7) & -8;
+ break;
+
+ case 4:
+ width = (width + 1) & -2;
+ break;
+ }
+
+ xmin = x_offset;
+ ymin = y_offset;
+ xmax = xmin + width-1;
+ ymax = ymin + height-1;
+
+ /* clip if necessary */
+ if ( width == 0 || height == 0 ||
+ xmax < 0 || xmin >= blit->target.width ||
+ ymax < 0 || ymin >= blit->target.rows )
+ return 1;
+
+ /* set up clipping and cursors */
+ blit->yread = 0;
+ if ( ymin < 0 )
+ {
+ blit->yread -= ymin;
+ height += ymin;
+ blit->ywrite = 0;
+ }
+ else
+ blit->ywrite = ymin;
+
+ if ( ymax >= blit->target.rows )
+ height -= ymax - blit->target.rows + 1;
+
+ blit->xread = 0;
+ if ( xmin < 0 )
+ {
+ blit->xread -= xmin;
+ width += xmin;
+ blit->xwrite = 0;
+ }
+ else
+ blit->xwrite = xmin;
+
+ target_width = blit->target.width;
+
+ switch ( blit->target_depth )
+ {
+ case 1:
+ target_width = (target_width + 7) & -8;
+ break;
+ case 4:
+ target_width = (target_width + 1) & -2;
+ break;
+ }
+
+ blit->right_clip = xmax - target_width + 1;
+ if ( blit->right_clip > 0 )
+ width -= blit->right_clip;
+ else
+ blit->right_clip = 0;
+
+ blit->width = width;
+ blit->height = height;
+
+ /* set read and write to the top-left corner of the the read */
+ /* and write area before clipping. */
+
+ blit->read = (char*)blit->source.bitmap;
+ blit->write = (char*)blit->target.bitmap;
+
+ if ( blit->source.flow == TT_Flow_Up )
+ {
+ blit->read_line = -blit->source.cols;
+ blit->read += (blit->source.rows-1) * blit->source.cols;
+ }
+ else
+ blit->read_line = blit->source.cols;
+
+ if ( blit->target.flow == TT_Flow_Up )
+ {
+ blit->write_line = -blit->target.cols;
+ blit->write += (blit->target.rows-1) * blit->target.cols;
+ }
+ else
+ blit->write_line = blit->target.cols;
+
+ /* now go to the start line. Note that we do not move the */
+ /* x position yet, as this is dependent on the pixel format */
+ blit->read += blit->yread * blit->read_line;
+ blit->write += blit->ywrite * blit->write_line;
+
+ return 0;
+ }
+
+
+/**************************************************************************/
+/* */
+/* <Function> blit_bitmap_to_bitmap */
+/* */
+/**************************************************************************/
+
+ static
+ void blit_bitmap_to_bitmap( TBlitter* blit )
+ {
+ int shift, left_clip, x, y;
+ unsigned char* read;
+ unsigned char* write;
+
+
+ left_clip = ( blit->xread > 0 );
+ shift = ( blit->xwrite - blit->xread ) & 7;
+
+ read = (unsigned char*)blit->read + (blit->xread >> 3);
+ write = (unsigned char*)blit->write + (blit->xwrite >> 3);
+
+ if ( shift == 0 )
+ {
+ y = blit->height;
+ do
+ {
+ unsigned char* _read = read;
+ unsigned char* _write = write;
+
+
+ x = blit->width;
+
+ do
+ {
+ *_write++ |= *_read++;
+ x -= 8;
+ } while ( x > 0 );
+
+ read += blit->read_line;
+ write += blit->write_line;
+ y--;
+ } while ( y > 0 );
+ }
+ else
+ {
+ int first, last, count;
+
+
+ first = blit->xwrite >> 3;
+ last = (blit->xwrite + blit->width-1) >> 3;
+
+ count = last - first;
+
+ if ( blit->right_clip )
+ count++;
+
+ y = blit->height;
+
+ do
+ {
+ unsigned char* _read = read;
+ unsigned char* _write = write;
+ unsigned char old;
+ int shift2 = (8-shift);
+
+
+ if ( left_clip )
+ old = (*_read++) << shift2;
+ else
+ old = 0;
+
+ x = count;
+ while ( x > 0 )
+ {
+ unsigned char val;
+
+
+ val = *_read++;
+ *_write++ |= ( (val >> shift) | old );
+ old = val << shift2;
+ x--;
+ }
+
+ if ( !blit->right_clip )
+ *_write |= old;
+
+ read += blit->read_line;
+ write += blit->write_line;
+ y--;
+
+ } while ( y > 0 );
+ }
+ }
+
+
+/**************************************************************************/
+/* */
+/* <Function> blit_bitmap_to_pixmap8 */
+/* */
+/**************************************************************************/
+
+ static
+ void blit_bitmap_to_pixmap8( TBlitter* blit,
+ unsigned char color )
+ {
+ int x, y;
+ unsigned int left_mask;
+ unsigned char* read;
+ unsigned char* write;
+
+
+ read = (unsigned char*)blit->read + (blit->xread >> 3);
+ write = (unsigned char*)blit->write + blit->xwrite;
+
+ left_mask = 0x80 >> (blit->xread & 7);
+
+ y = blit->height;
+ do
+ {
+ unsigned char* _read = read;
+ unsigned char* _write = write;
+ unsigned int mask = left_mask;
+ unsigned int val = 0;
+
+
+ x = blit->width;
+ do
+ {
+ if ( mask == 0x80 )
+ val = *_read++;
+
+ if ( val & mask )
+ *_write = (unsigned char)color;
+
+ mask >>= 1;
+ if ( mask == 0 )
+ mask = 0x80;
+
+ _write++;
+ x--;
+ } while ( x > 0 );
+
+ read += blit->read_line;
+ write += blit->write_line;
+ y--;
+ } while ( y > 0 );
+ }
+
+
+/**************************************************************************/
+/* */
+/* <Function> blit_bitmap_to_pixmap4 */
+/* */
+/**************************************************************************/
+
+ static
+ void blit_bitmap_to_pixmap4( TBlitter* blit,
+ unsigned char color )
+ {
+ int x, y, phase;
+ unsigned int left_mask;
+ unsigned char* read;
+ unsigned char* write;
+
+
+ color = color & 15;
+
+ read = (unsigned char*)blit->read + (blit->xread >> 3);
+ write = (unsigned char*)blit->write + (blit->xwrite >> 1);
+
+ /* now begin blit */
+ left_mask = 0x80 >> (blit->xread & 7);
+ phase = blit->xwrite & 1;
+
+ y = blit->height;
+ do
+ {
+ unsigned char* _read = read;
+ unsigned char* _write = write;
+ unsigned int mask = left_mask;
+ int _phase = phase;
+ unsigned int val = 0;
+
+ x = blit->width;
+ do
+ {
+ if ( mask == 0x80 )
+ val = *_read++;
+
+ if ( val & mask )
+ {
+ if ( _phase )
+ *_write = (*_write & 0xF0) | color;
+ else
+ *_write = (*_write & 0x0F) | (color << 4);
+ }
+
+ mask >>= 1;
+ if ( mask == 0 )
+ mask = 0x80;
+
+ _write += _phase;
+ _phase ^= 1;
+ x--;
+ } while ( x > 0 );
+
+ read += blit->read_line;
+ write += blit->write_line;
+ y--;
+ } while ( y > 0 );
+ }
+
+
+/**************************************************************************/
+/* */
+/* <Function> blit_bitmap_to_pixmap16 */
+/* */
+/**************************************************************************/
+
+ static
+ void blit_bitmap_to_pixmap16( TBlitter* blit,
+ unsigned short color )
+ {
+ int x, y;
+ unsigned int left_mask;
+ unsigned char* read;
+ unsigned short* write;
+
+
+ read = (unsigned char*)blit->read + (blit->xread >> 3);
+ write = (unsigned short*)(blit->write + blit->xwrite*2);
+
+ left_mask = 0x80 >> (blit->xread & 7);
+
+ y = blit->height;
+ do
+ {
+ unsigned char* _read = read;
+ unsigned short* _write = write;
+ unsigned int mask = left_mask;
+ unsigned int val = 0;
+
+ x = blit->width;
+ do
+ {
+ if ( mask == 0x80 )
+ val = *_read++;
+
+ if ( val & mask )
+ *_write = color;
+
+ mask >>= 1;
+ if ( mask == 0 )
+ mask = 0x80;
+
+ _write++;
+ x--;
+ } while ( x > 0 );
+
+ read += blit->read_line;
+ write += blit->write_line;
+ y--;
+ } while ( y > 0 );
+ }
+
+
+ /* <Function> */
+ /* Blit_Bitmap */
+ /* */
+ /* <Description> */
+ /* blit a source bitmap to a target bitmap or pixmap */
+ /* */
+ /* <Input> */
+ /* target :: target bitmap or pixmap */
+ /* source :: source bitmap (depth must be 1) */
+ /* target_depth :: pixel bit depth of target map */
+ /* x_offset :: horizontal offset of source in target */
+ /* y_offset :: vertical offset of source in target */
+ /* color :: color to use when blitting to color pixmap */
+ /* */
+ /* <Return> */
+ /* error code. 0 means success */
+ /* */
+ /* <Note> */
+ /* an error occurs when the target bit depth isn't supported, or */
+ /* if the source's bit depth isn't 1. */
+ /* */
+ /* the offsets are relative to the top-left corner of the target */
+ /* map. Positive y are downwards. */
+ /* */
+ extern
+ int Blit_Bitmap( TT_Raster_Map* target,
+ TT_Raster_Map* source,
+ int target_depth,
+ int x_offset,
+ int y_offset,
+ int color )
+ {
+ TBlitter blit;
+
+
+ if ( !target || !source )
+ return -1;
+
+ blit.source = *source;
+ blit.target = *target;
+ blit.source_depth = 1;
+ blit.target_depth = target_depth;
+
+ /* set up blitter and compute clipping. Return immediately if needed */
+ if ( compute_clips( &blit, x_offset, y_offset ) )
+ return 0;
+
+ /* now perform the blit */
+ switch ( target_depth )
+ {
+ case 1:
+ blit_bitmap_to_bitmap( &blit );
+ break;
+
+ case 4:
+ blit_bitmap_to_pixmap4( &blit, (unsigned char)color );
+ break;
+
+ case 8:
+ blit_bitmap_to_pixmap8( &blit, (unsigned char)color );
+ break;
+
+ case 16:
+ blit_bitmap_to_pixmap16( &blit, (unsigned short)color );
+ break;
+
+ default:
+ return -2;
+ }
+
+ return 0;
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/blitter.h b/Build/source/libs/freetype/test/blitter.h
new file mode 100644
index 00000000000..9fe749afa34
--- /dev/null
+++ b/Build/source/libs/freetype/test/blitter.h
@@ -0,0 +1,52 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* blitter.h: Support for blitting of bitmaps with various depth. */
+/* */
+/****************************************************************************/
+
+#ifndef BLITTER_H
+#define BLITTER_H
+
+#include "freetype.h"
+
+ /* <Function> */
+ /* Blit_Bitmap */
+ /* */
+ /* <Description> */
+ /* blit a source bitmap to a target bitmap or pixmap */
+ /* */
+ /* <Input> */
+ /* target :: target bitmap or pixmap */
+ /* source :: source bitmap (depth must be 1) */
+ /* target_depth :: pixel bit depth of target map */
+ /* x_offset :: horizontal offset of source in target */
+ /* y_offset :: vertical offset of source in target */
+ /* color :: color to use when blitting to color pixmap */
+ /* */
+ /* <Return> */
+ /* error code. 0 means success */
+ /* */
+ /* <Note> */
+ /* an error occurs when the target bit depth isn't supported, or */
+ /* if the source's bit depth isn't 1. */
+ /* */
+ /* the offsets are relative to the top-left corner of the target */
+ /* map. Positive y are downwards. */
+ /* */
+ extern
+ int Blit_Bitmap( TT_Raster_Map* target,
+ TT_Raster_Map* source,
+ int target_depth,
+ int x_offset,
+ int y_offset,
+ int color );
+
+#endif
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/common.c b/Build/source/libs/freetype/test/common.c
new file mode 100644
index 00000000000..9976293dac0
--- /dev/null
+++ b/Build/source/libs/freetype/test/common.c
@@ -0,0 +1,276 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* common.c: Various utility functions. */
+/* */
+/****************************************************************************/
+
+
+/*
+ * This is a cheap replacement for getopt() because that routine is not
+ * available on some platforms and behaves differently on other platforms.
+ * This code was written from scratch without looking at any other
+ * implementation.
+ *
+ * This code is hereby expressly placed in the public domain.
+ * mleisher@crl.nmsu.edu (Mark Leisher)
+ * 10 October 1997
+ */
+
+#ifndef lint
+#ifdef __GNUC__
+ static char rcsid[] __attribute__ ((unused)) = "$Id: common.c,v 1.16 2001/12/25 20:13:04 antoineL Exp $";
+#else
+ static char rcsid[] = "$Id: common.c,v 1.16 2001/12/25 20:13:04 antoineL Exp $";
+#endif
+#endif
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+
+ /*
+ * Externals visible to programs.
+ */
+
+ int ft_opterr = 1;
+ int ft_optind = 1;
+ char* ft_optarg;
+
+ /*
+ * Internal variables that are used to detect when the global values
+ * need to be reset.
+ */
+
+ static int cmdac;
+#ifdef __STDC__
+ static const char* cmdname;
+ static char* const* cmdav;
+#else
+ static char* cmdname;
+ static char** cmdav;
+#endif
+
+
+ int
+#ifdef __STDC__
+ ft_getopt( int ac, char* const* av, const char* pat )
+#else
+ ft_getopt( ac, av, pat )
+ int ac;
+ char** av;
+ char* pat;
+#endif
+ {
+ int opt;
+#ifdef __STDC__
+ const char* p;
+ const char* pp;
+#else
+ char* p;
+ char* pp;
+#endif
+
+
+ /*
+ * If there is no pattern, indicate the parsing is done.
+ */
+ if ( pat == 0 || *pat == 0 )
+ return -1;
+
+ /*
+ * Always reset the option argument to NULL.
+ */
+ ft_optarg = 0;
+
+ /*
+ * If the number of arguments or argument list do not match the last
+ * values seen, reset the internal pointers and the globals.
+ */
+ if ( ac != cmdac || av != cmdav )
+ {
+ ft_optind = 1;
+ cmdac = ac;
+ cmdav = av;
+
+ /*
+ * Determine the command name in case it is needed for warning
+ * messages.
+ */
+ for ( cmdname = 0, p = av[0]; *p; p++ )
+ {
+ if ( *p == '/' || *p == '\\' )
+ cmdname = p;
+ }
+
+ /*
+ * Skip the path separator if the name was assigned.
+ */
+ if ( cmdname )
+ cmdname++;
+ else
+ cmdname = av[0];
+ }
+
+ /*
+ * If the next index is greater than or equal to the number of
+ * arguments, then the command line is done.
+ */
+ if ( ft_optind >= ac )
+ return -1;
+
+ /*
+ * Test the next argument for one of three cases:
+ * 1. The next argument does not have an initial '-'.
+ * 2. The next argument is '-'.
+ * 3. The next argument is '--'.
+ *
+ * In either of these cases, command line processing is done.
+ */
+ if ( av[ft_optind][0] != '-' ||
+ strcmp( av[ft_optind], "-" ) == 0 ||
+ strcmp( av[ft_optind], "--" ) == 0 )
+ return -1;
+
+ /*
+ * Point at the next command line argument and increment the
+ * command line index.
+ */
+ p = av[ft_optind++];
+
+ /*
+ * Look for the first character of the command line option.
+ */
+ for ( opt = *(p + 1), pp = pat; *pp && *pp != opt; pp++ )
+ ;
+
+ /*
+ * If nothing in the pattern was recognized, then issue a warning
+ * and return a '?'.
+ */
+ if ( *pp == 0 )
+ {
+ if ( ft_opterr )
+ fprintf( stderr, "%s: illegal option -- %c\n", cmdname, opt );
+ return '?';
+ }
+
+ /*
+ * If the option expects an argument, get it.
+ */
+ if ( *(pp + 1) == ':' && (ft_optarg = av[ft_optind]) == 0 )
+ {
+ /*
+ * If the option argument is NULL, issue a warning and return a '?'.
+ */
+ if ( ft_opterr )
+ fprintf( stderr, "%s: option requires an argument -- %c\n",
+ cmdname, opt );
+ opt = '?';
+ }
+ else if ( ft_optarg )
+ /*
+ * Increment the option index past the argument.
+ */
+ ft_optind++;
+
+ /*
+ * Return the option character.
+ */
+ return opt;
+ }
+
+
+/****************************************************************************/
+/* */
+/* ft_basename(): */
+/* */
+/* a stupid but useful function... */
+/* */
+/* rewritten by DavidT to get rid of GPLed programs in the FreeType engine. */
+/* */
+/****************************************************************************/
+
+ char*
+#ifdef __STDC__
+ ft_basename( const char* name )
+#else
+ ft_basename( name )
+ char* name;
+#endif
+ {
+#ifdef __STDC__
+ const char* base;
+ const char* current;
+#else
+ char* base;
+ char* current;
+#endif
+ char c;
+
+
+ base = name;
+ current = name;
+
+ c = *current;
+
+ while ( c )
+ {
+ if ( c == '/' || c == '\\' )
+ base = current + 1;
+
+ current++;
+ c = *current;
+ }
+
+ return (char*)base;
+ }
+
+/****************************************************************************/
+
+ void
+#ifdef __STDC__
+ Panic( const char* fmt, ... )
+#else
+ Panic( fmt )
+ const char* fmt;
+#endif
+ {
+ va_list ap;
+
+
+ va_start( ap, fmt );
+ vprintf( fmt, ap );
+ va_end( ap );
+
+ exit( EXIT_FAILURE );
+ }
+
+/****************************************************************************/
+
+ void
+#ifdef __STDC__
+ separator_line( FILE* out, const int length )
+#else
+ separator_line( out, length )
+ FILE* out;
+ int length;
+#endif
+ {
+ int i;
+
+
+ for ( i = 0; i < length; i++ )
+ fputc( '-', out );
+ fprintf( out, "\n\n" );
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/common.h b/Build/source/libs/freetype/test/common.h
new file mode 100644
index 00000000000..16e42416890
--- /dev/null
+++ b/Build/source/libs/freetype/test/common.h
@@ -0,0 +1,81 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* common.h: Various utility functions. */
+/* */
+/****************************************************************************/
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#include <stdio.h>
+
+
+/*
+ * This is a cheap replacement for getopt() because that routine is not
+ * available on some platforms and behaves differently on other platforms.
+ *
+ * This code is hereby expressly placed in the public domain.
+ * mleisher@crl.nmsu.edu (Mark Leisher)
+ * 10 October 1997
+ */
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ extern int ft_opterr;
+ extern int ft_optind;
+ extern char* ft_optarg;
+
+ extern int ft_getopt(
+#ifdef __STDC__
+ int argc,
+ char* const* argv,
+ const char* pattern
+#endif
+ );
+
+
+/****************************************************************************/
+/* */
+/* Stupid but useful functions... */
+/* */
+/* rewritten by DavidT to get rid of GPLed programs in the FreeType engine. */
+
+
+ extern char* ft_basename(
+#ifdef __STDC__
+ const char* name
+#endif
+ );
+
+
+ /* print a message and exit */
+ extern void Panic(
+#ifdef __STDC__
+ const char* fmt, ...
+#endif
+ );
+
+
+ extern void separator_line(
+#ifdef __STDC__
+ FILE* out,
+ const int length
+#endif
+ );
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* COMMON_H */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/display.c b/Build/source/libs/freetype/test/display.c
new file mode 100644
index 00000000000..7711b33ccdc
--- /dev/null
+++ b/Build/source/libs/freetype/test/display.c
@@ -0,0 +1,299 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2000 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* display.c: Display component used by all test programs. */
+/* */
+/* This file is used to display glyphs and strings in a target window */
+/* using the graphics drivers provided by gmain.c, gevents.h, etc. */
+/* */
+/* Its role is to be shared and heavely commented to let people understand */
+/* how we do the job... */
+/* */
+/****************************************************************************/
+
+#include <stdlib.h> /* malloc() and free() */
+#include <string.h> /* memset() */
+
+#include "display.h"
+#include "freetype.h"
+#include "gmain.h"
+
+ /* The target bitmap or pixmap -- covering the full display window/screen */
+ TT_Raster_Map Bit;
+
+ /* A smaller intermediate bitmap used to render individual glyphs when */
+ /* font smoothing mode is activated. It is then or-ed to `Bit'. */
+ TT_Raster_Map Small_Bit;
+
+/* The magic of or-ing gray-levels: */
+/* */
+/* When gray-level mode (a.k.a. font-smoothing) is on, `Bit' is an 8-bit */
+/* pixmap of the size of the display window or screen. */
+/* */
+/* The gray-level palette to use for display is system-dependent, and */
+/* given by the "gray_palette" variable defined in 'gmain.c'. It is */
+/* set up by the graphics driver, and we cannot assume anything about its */
+/* values. */
+/* */
+/* The function TT_Get_Glyph_Pixmap() can use any palette to render each */
+/* individual glyph, however we'll later need to "or" the glyph to */
+/* the display pixmap `Bit' to be able to form strings of text by */
+/* juxtaposing several glyphs together. */
+/* */
+/* If we use the gray_palette directly, we'll encounter trouble doing */
+/* the "or". Example: */
+/* */
+/* Suppose that gray_palette = { 0, 32, 64, 128, 255 } */
+/* */
+/* Let's render a glyph with this palette and "or" it to */
+/* the `Bit' pixmap. If, by chance, we superpose two distinct non-zero */
+/* colors, we will get strange results, like 32+64 = 96, which isn't in */
+/* our gray palette! */
+/* */
+/* There are two ways to solve this problem: */
+/* */
+/* - perform a "slow or" where we check all possible combinations */
+/* and solve conflicts. */
+/* */
+/* - render all pixmaps using a special "virtual" palette that eases */
+/* the "oring" process, then convert the whole display pixmap to */
+/* "display" colors at once. */
+/* */
+/* We choose the second solution, of course; this means that: */
+/* */
+/* - the virtual palette used is simply = { 0, 1, 2, 3, 4 }, defined in */
+/* the variable "palette" below. The `Bit' and `Small_Bit' pixmaps will */
+/* always contain pixels within these values, with the exception of */
+/* post-render display, where `Bit' will be converted to display values */
+/* by the Convert_To_Display_Palette() function. */
+/* */
+/* - as or-ing values between 0 and 4 will give us values between */
+/* 0 and 7, we use a second palette, called "bounding_palette" */
+/* to maintain all values within the virtual palette. */
+/* */
+/* in effect bounding_palette = { 0, 1, 2, 3, 4, 4, 4, 4 } */
+/* */
+/* which means that (3|4) == 7 => 4 after bounding */
+/* */
+
+ /* the virtual palette */
+ unsigned char virtual_palette[5] = { 0, 1, 2, 3, 4 };
+
+ /* Or-ing the possible palette values gets us from 0 to 7 */
+ /* We must bound check these... */
+ unsigned char bounded_palette[8] = { 0, 1, 2, 3, 4, 4, 4, 4 };
+
+
+ /* Clears the Bit bitmap/pixmap */
+ void Clear_Display( void )
+ {
+ memset( Bit.bitmap, 0, Bit.size );
+ }
+
+
+ /* Clears the Small_Bit pixmap */
+ void Clear_Small( void )
+ {
+ memset( Small_Bit.bitmap, 0, Small_Bit.size );
+ }
+
+
+ /* Initialize the display bitmap named Bit */
+ int Init_Display( int font_smoothing )
+ {
+ Bit.rows = vio_Height; /* the whole window */
+ Bit.width = vio_Width;
+ Bit.flow = TT_Flow_Up;
+
+ if ( font_smoothing )
+ Bit.cols = (Bit.width+3) & -4; /* must be 32-bits aligned */
+ else
+ Bit.cols = (Bit.width+7) >> 3;
+
+ Bit.size = (long)Bit.cols * Bit.rows;
+
+ if ( Bit.bitmap )
+ free( Bit.bitmap );
+ Bit.bitmap = malloc( (int)Bit.size );
+ if ( !Bit.bitmap )
+ return -1;
+
+ Clear_Display();
+ return 0;
+ }
+
+
+ /* Convert the display pixmap from virtual to display palette */
+ void Convert_To_Display_Palette( void )
+ {
+ unsigned char* p;
+ long i;
+
+ p = Bit.bitmap;
+ for ( i = 0; i < Bit.size; i++ )
+ {
+ *p = gray_palette[(int)*p];
+ p++;
+ }
+ }
+
+
+ /* Init Small Bitmap */
+ int Init_Small( int x_ppem, int y_ppem )
+ {
+ if ( Small_Bit.bitmap )
+ free( Small_Bit.bitmap );
+
+ Small_Bit.rows = y_ppem + 32;
+ Small_Bit.width = x_ppem + 32;
+ Small_Bit.cols = ( Small_Bit.width+3 ) & -4; /* pad to 32-bits */
+ Small_Bit.flow = TT_Flow_Up;
+ Small_Bit.size = (long)Small_Bit.rows * Small_Bit.cols;
+
+ Small_Bit.bitmap = malloc( (int)Small_Bit.size );
+ if ( Small_Bit.bitmap )
+ return -1;
+
+ Clear_Small();
+ return 0;
+ }
+
+
+ /* Render a single glyph into the display bit/pixmap */
+ /* */
+ /* Note that in b/w mode, we simply render the glyph directly into */
+ /* the display map, as the scan-line converter or-es the glyph into */
+ /* the target bitmap. */
+ /* */
+ /* In gray mode, however, the glyph is first rendered indivdually in */
+ /* the Small_Bit map, then 'or-ed' with bounding into the display */
+ /* pixmap. */
+ /* */
+
+ TT_Error Render_Single_Glyph( int font_smoothing,
+ TT_Glyph glyph,
+ int x_offset,
+ int y_offset )
+ {
+ if ( !font_smoothing )
+ return TT_Get_Glyph_Bitmap( glyph, &Bit,
+ (long)x_offset*64, (long)y_offset*64 );
+ else
+ {
+ TT_Glyph_Metrics metrics;
+
+ TT_Error error;
+ TT_F26Dot6 x, y, xmin, ymin, xmax, ymax;
+ int ioff, iread;
+ char *off, *read, *_off, *_read;
+
+
+ /* font-smoothing mode */
+
+ /* we begin by grid-fitting the bounding box */
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+
+ xmin = metrics.bbox.xMin & -64;
+ ymin = metrics.bbox.yMin & -64;
+ xmax = (metrics.bbox.xMax+63) & -64;
+ ymax = (metrics.bbox.yMax+63) & -64;
+
+ /* now render the glyph in the small pixmap */
+
+ /* IMPORTANT NOTE: the offset parameters passed to the function */
+ /* TT_Get_Glyph_Bitmap() must be integer pixel values, i.e., */
+ /* multiples of 64. HINTING WILL BE RUINED IF THIS ISN'T THE CASE! */
+ /* This is why we _did_ grid-fit the bounding box, especially xmin */
+ /* and ymin. */
+
+ Clear_Small();
+ error = TT_Get_Glyph_Pixmap( glyph, &Small_Bit, -xmin, -ymin );
+ if ( error )
+ return error;
+
+ /* Blit-or the resulting small pixmap into the biggest one */
+ /* We do that by hand, and provide also clipping. */
+
+ xmin = (xmin >> 6) + x_offset;
+ ymin = (ymin >> 6) + y_offset;
+ xmax = (xmax >> 6) + x_offset;
+ ymax = (ymax >> 6) + y_offset;
+
+ /* Take care of comparing xmin and ymin with signed values! */
+ /* This was the cause of strange misplacements when Bit.rows */
+ /* was unsigned. */
+
+ if ( xmin >= (int)Bit.width ||
+ ymin >= (int)Bit.rows ||
+ xmax < 0 ||
+ ymax < 0 )
+ return TT_Err_Ok; /* nothing to do */
+
+ /* Note that the clipping check is performed _after_ rendering */
+ /* the glyph in the small bitmap to let this function return */
+ /* potential error codes for all glyphs, even hidden ones. */
+
+ /* In exotic glyphs, the bounding box may be larger than the */
+ /* size of the small pixmap. Take care of that here. */
+
+ if ( xmax-xmin + 1 > Small_Bit.width )
+ xmax = xmin + Small_Bit.width - 1;
+
+ if ( ymax-ymin + 1 > Small_Bit.rows )
+ ymax = ymin + Small_Bit.rows - 1;
+
+ /* set up clipping and cursors */
+
+ iread = 0;
+ if ( ymin < 0 )
+ {
+ iread -= ymin * Small_Bit.cols;
+ ioff = 0;
+ ymin = 0;
+ }
+ else
+ ioff = ymin * Bit.cols;
+
+ if ( ymax >= Bit.rows )
+ ymax = Bit.rows-1;
+
+ if ( xmin < 0 )
+ {
+ iread -= xmin;
+ xmin = 0;
+ }
+ else
+ ioff += xmin;
+
+ if ( xmax >= Bit.width )
+ xmax = Bit.width - 1;
+
+ _read = (char*)Small_Bit.bitmap + iread;
+ _off = (char*)Bit.bitmap + ioff;
+
+ for ( y = ymin; y <= ymax; y++ )
+ {
+ read = _read;
+ off = _off;
+
+ for ( x = xmin; x <= xmax; x++ )
+ {
+ *off = bounded_palette[*off | *read];
+ off++;
+ read++;
+ }
+ _read += Small_Bit.cols;
+ _off += Bit.cols;
+ }
+
+ return TT_Err_Ok;
+ }
+ }
+
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/display.h b/Build/source/libs/freetype/test/display.h
new file mode 100644
index 00000000000..d4c00f87df5
--- /dev/null
+++ b/Build/source/libs/freetype/test/display.h
@@ -0,0 +1,73 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2000 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* display.h: Display component interface used by test programs */
+/* */
+/* This file is used to display glyphs and strings in a target window */
+/* using the graphics drivers provided by gmain.c, gevents.h, etc. */
+/* */
+/* Its role is to be shared and heavely commented to let people understand */
+/* how we do the job... */
+/* */
+/* See comments in display.c for a full description! */
+/* */
+/****************************************************************************/
+
+#ifndef DISPLAY_H
+#define DISPLAY_H
+
+#include "freetype.h" /* TT_Raster_Map */
+
+ /* The target bitmap or pixmap -- covering the full display window/screen */
+ extern TT_Raster_Map Bit;
+
+ /* A smaller intermediate bitmap used to render individual glyphs when */
+ /* font smoothing mode is activated. It is then or-ed to `Bit'. */
+ extern TT_Raster_Map Small_Bit;
+
+ /* the virtual palette */
+ extern unsigned char virtual_palette[5];
+
+ /* Or-ing the possible palette values gets us from 0 to 7 */
+ /* We must bound check these... */
+ extern unsigned char bounded_palette[8];
+
+
+ /* Clears the Bit bitmap/pixmap */
+ void Clear_Display( void );
+
+ /* Clears the Small_Bit pixmap */
+ void Clear_Small( void );
+
+ /* Initialize the display bitmap named Bit */
+ int Init_Display( int font_smoothing );
+
+ /* Initialize Small Bitmap */
+ int Init_Small( int x_ppem, int y_ppem );
+
+ /* Convert the display pixmap from virtual to display palette */
+ void Convert_To_Display_Palette( void );
+
+ /* Render a single glyph into the display bit/pixmap. */
+ /* */
+ /* Note that in b/w mode, we simply render the glyph directly into */
+ /* the display map, as the scan-line converter or-es the glyph into */
+ /* the target bitmap. */
+ /* */
+ /* In gray mode, however, the glyph is first rendered individually in */
+ /* the Small_Bit map, then 'or-ed' with bounding into the display */
+ /* pixmap. */
+ /* */
+ TT_Error Render_Single_Glyph( int font_smoothing,
+ TT_Glyph glyph,
+ int x_offset,
+ int y_offset );
+
+#endif /* DISPLAY_H */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/fdebug.c b/Build/source/libs/freetype/test/fdebug.c
new file mode 100644
index 00000000000..f2abd1ec904
--- /dev/null
+++ b/Build/source/libs/freetype/test/fdebug.c
@@ -0,0 +1,286 @@
+/****************************************************************************}
+{* *}
+{* The FreeType project - a Free and Portable Quality TrueType Renderer. *}
+{* *}
+{* Copyright 1996-2001 by *}
+{* D. Turner, R.Wilhelm, and W. Lemberg *}
+{* *}
+{* fdebug : A very simple TrueType bytecode debugger. *}
+{* *}
+{* NOTE : You must compile the interpreter with the DEBUG_INTERPRETER *}
+{* macro defined in order to link this program! *}
+{* *}
+{****************************************************************************/
+
+#include <math.h> /* libc ANSI */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "freetype.h"
+#include "tttypes.h"
+#include "ttdebug.h"
+#include "ttobjs.h"
+
+
+#ifdef UNIX
+#ifndef HAVE_POSIX_TERMIOS
+#include <sys/ioctl.h>
+#include <termio.h>
+#else
+#ifndef HAVE_TCGETATTR
+#define HAVE_TCGETATTR
+#endif /* HAVE_TCGETATTR */
+#ifndef HAVE_TCSETATTR
+#define HAVE_TCSETATTR
+#endif /* HAVE_TCSETATTR */
+#include <termios.h>
+#endif /* HAVE_POSIX_TERMIOS */
+#endif
+
+ /* MAGIC: This variable is only defined in ttinterp.c if the */
+ /* macro DEBUG_INTERPRETER is set. It specifies the code */
+ /* range to debug. By default, it is TT_CodeRange_Glyph. */
+ /* */
+ extern
+ int debug_coderange;
+
+
+#define Font_Buff_Size 256000 /* this buffer holds all */
+ /* font specific data. */
+
+ TT_Engine engine;
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+ TT_Error error;
+
+ TT_Face_Properties properties;
+
+ int num_glyphs;
+ int ptsize;
+
+ Int Fail;
+ Int Num;
+ int mode = 2;
+ unsigned char autorun;
+
+/*********************************************************************
+ *
+ * Usage : print usage message
+ *
+ *********************************************************************/
+
+ static
+ void Usage( const char* execname )
+ {
+ TT_Message( "fdebug: a simple TrueType bytecode debugger - part of the FreeType project\n" );
+ TT_Message( "--------------------------------------------------------------------------\n\n");
+ TT_Message( "Usage: %s glyphnum ppem fontname[.ttf]\n", execname );
+ TT_Message( " or %s --cvt ppem fontname[.ttf]\n", execname );
+ TT_Message( " or %s --font fontname[.ttf]\n\n", execname );
+ exit( EXIT_FAILURE );
+ }
+
+
+/*********************************************************************
+ *
+ * Init_Keyboard : set the input file descriptor to char-by-char
+ * mode on Unix..
+ *
+ *********************************************************************/
+
+#ifdef UNIX
+
+ struct termios old_termio;
+
+ static
+ void Init_Keyboard( void )
+ {
+ struct termios termio;
+
+
+#ifndef HAVE_TCGETATTR
+ ioctl( 0, TCGETS, &old_termio );
+#else
+ tcgetattr( 0, &old_termio );
+#endif
+
+ termio = old_termio;
+
+ termio.c_lflag &= ~(ICANON+ECHO+ECHOE+ECHOK+ECHONL+ECHOKE);
+
+#ifndef HAVE_TCSETATTR
+ ioctl( 0, TCSETS, &termio );
+#else
+ tcsetattr( 0, TCSANOW, &termio );
+#endif
+ }
+
+ static
+ void Reset_Keyboard( voi )
+ {
+#ifndef HAVE_TCSETATTR
+ ioctl( 0, TCSETS, &old_termio );
+#else
+ tcsetattr( 0, TCSANOW, &old_termio );
+#endif
+
+ }
+
+#else
+
+ static
+ void Init_Keyboard( void )
+ {
+ }
+
+ static
+ void Reset_Keyboard( voi )
+ {
+ }
+
+#endif
+
+ static
+ void Print_Banner( void )
+ {
+ TT_Message( "fdebug - a simple TrueType bytecode debugger for FreeType\n" );
+ TT_Message( "------------------------------------------------------------\n" );
+ TT_Message( "type '?' for help - copyright 1996-2000 the FreeType Project\n\n" );
+ }
+
+
+ static
+ void Error( const char* message,
+ const char* filename )
+ {
+ static char tempstr[256];
+
+ sprintf( tempstr, "ERROR (%s): %s\n", filename, message );
+ TT_Message( tempstr );
+
+ sprintf( tempstr, " code = 0x%04lx\n", error );
+ TT_Message( tempstr );
+
+ Reset_Keyboard();
+ exit( EXIT_FAILURE );
+ }
+
+
+ static
+ void Init_Face( const char* filename )
+ {
+ error = TT_Init_FreeType(&engine);
+ if (error) Error( "could not initialise FreeType", filename );
+
+ /* open face object */
+ error = TT_Open_Face( engine, filename, &face );
+ if (error) Error( "could not find or open file", filename );
+
+ /* get properties */
+ TT_Get_Face_Properties( face, &properties );
+ num_glyphs = properties.num_Glyphs;
+
+ /* create instance */
+ error = TT_New_Instance( face, &instance );
+ if (error) Error( "could not create instance", filename );
+
+ error = TT_New_Glyph( face, &glyph );
+ if (error) Error( "could not create glyph container", filename );
+
+ TT_Set_Instance_Resolutions( instance, 96, 96 );
+
+ error = TT_Set_Instance_CharSize( instance, ptsize << 6 );
+ if (error) Error( "could not set text size", filename );
+ }
+
+
+ int main( int argc, char** argv )
+ {
+ int i;
+ char filename[128+4];
+ char* execname;
+
+
+ execname = argv[0];
+ if ( argc < 2 )
+ Usage( execname );
+
+ if ( strcmp( argv[1], "--font" ) == 0 )
+ {
+ debug_coderange = TT_CodeRange_Font;
+ mode = 0;
+ argc--;
+ argv++;
+ }
+ else if ( strcmp( argv[1], "--cvt" ) == 0 )
+ {
+ debug_coderange = TT_CodeRange_Cvt;
+ argv++;
+ argc--;
+ mode = 1;
+ }
+ else if ( sscanf( argv[1], "%d", &Num ) == 1 )
+ {
+ mode = 2;
+ argv++;
+ argc--;
+ }
+ else
+ Usage( execname );
+
+ /* read the point size for cvt and glyph modes */
+ if (mode > 0)
+ {
+ if ( sscanf( argv[1], "%d", &ptsize ) != 1 )
+ Usage( execname );
+ argc--;
+ argv++;
+ }
+
+ if ( argc != 2 )
+ Usage(execname);
+
+ i = strlen( argv[1] );
+ while ( i > 0 && argv[1][i] != '\\' )
+ {
+ if ( argv[1][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = 0;
+
+ strncpy( filename, argv[1], 128 );
+ if ( i >= 0 )
+ strncpy( filename + strlen(filename), ".ttf", 4 );
+
+ Init_Keyboard();
+
+ if (mode == 2)
+ {
+ Init_Face( filename );
+ Print_Banner();
+
+ error = TT_Load_Glyph( instance, glyph, Num, TTLOAD_DEFAULT );
+ if (error) Error( "Error during bytecode execution", filename );
+ }
+ else
+ {
+ Print_Banner();
+ Init_Face( filename );
+ }
+
+ TT_Close_Face( face );
+ TT_Done_FreeType(engine);
+
+ Reset_Keyboard();
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftdump.c b/Build/source/libs/freetype/test/ftdump.c
new file mode 100644
index 00000000000..2ff73dc4d4c
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftdump.c
@@ -0,0 +1,1146 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftdump: Simple TrueType font file resource profiler. */
+/* */
+/* This program dumps various properties of a given font file. */
+/* */
+/* */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+#include "ftxcmap.h"
+#include "ftxopen.h" /* TrueType Open support */
+#include "ftxsbit.h" /* embedded bitmap support */
+
+/*
+ * The following comment should be ignored. The "ttobjs.h" file does
+ * already include ft_conf.h.
+ *
+ * ------------------------------------------------------------------
+ *
+ * IGNORE> Basically, an external program using FreeType shouldn't depend on an
+ * IGNORE> internal file of the FreeType library, especially not on ft_conf.h -- but
+ * IGNORE> to avoid another configure script which tests for the existence of the
+ * IGNORE> i18n stuff we include ft_conf.h here since we can be sure that our test
+ * IGNORE> programs use the same configuration options as the library itself.
+ */
+
+#include "ttobjs.h" /* We're going to access internal tables directly */
+#include "ttmemory.h" /* We use FREE() to satisfy -DDEBUG_MEMORY */
+
+#ifdef HAVE_LIBINTL_H
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include "ftxerr18.h"
+#include <libintl.h>
+#else
+#define gettext( x ) ( x )
+#endif
+
+
+ TT_Error error;
+
+ TT_Engine engine;
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+
+ TT_Instance_Metrics imetrics;
+ TT_Outline outline;
+ TT_Glyph_Metrics metrics;
+
+ TT_Face_Properties properties;
+
+ int num_glyphs;
+ int ptsize;
+
+ int Fail;
+ int Num;
+
+ int flag_memory = 1;
+ int flag_names = 1;
+ int flag_encodings = 1;
+ int flag_cmap = 1;
+ int flag_sbits = 1;
+ int flag_ttopen = 1;
+
+#if defined( FREETYPE_DLL ) || defined( TT_CONFIG_OPTION_THREAD_SAFE )
+
+ /* If the library is linked as a DLL, TTMemory_Allocated() */
+ /* (which is not exported) cannot be accessed. */
+ /* In this case, some compilers report an error because */
+ /* they try to link against a non-existing symbol. */
+ /* */
+ /* We thus avoid the external reference on these compilers. */
+
+ #define TTMemory_Allocated 0L
+
+#else
+ extern long TTMemory_Allocated;
+#endif
+
+ long org_memory, old_memory, cur_memory;
+
+ const char* Apple_Encodings[33] =
+ {
+ "Roman", "Japanese", "Chinese", "Korean", "Arabic", "Hebrew",
+ "Greek", "Russian", "RSymbol", "Devanagari", "Gurmukhi",
+ "Gujarati", "Oriya", "Bengali", "Tamil", "Telugu", "Kannada",
+ "Malayalam", "Sinhalese", "Burmese", "Khmer", "Tai", "Laotian",
+ "Georgian", "Armenian", "Maldivian/Simplif. Chinese", "Tibetan",
+ "Mongolian", "Geez", "Slavic", "Vietnamese", "Sindhi", "Uninterpreted"
+ };
+
+ struct
+ {
+ long initial_overhead;
+ long face_object;
+ long glyph_object;
+ long first_instance;
+ long second_instance;
+
+ } memory_footprint;
+
+
+ /* We ignore error message strings with this function */
+
+#ifndef HAVE_LIBINTL_H
+ static char*
+ TT_ErrToString18( TT_Error error )
+ {
+ static char temp[32];
+
+
+ sprintf( temp, "0x%04lx", error );
+ return temp;
+ }
+#endif
+
+
+ void
+ Save_Memory( long* var )
+ {
+ *var = TTMemory_Allocated - old_memory;
+ old_memory += *var;
+ }
+
+#define FOOTPRINT( field ) Save_Memory( &memory_footprint.field )
+
+
+ static void
+ Print_Mem( long val, char* string )
+ {
+ printf( "%6ld Bytes (%4ld kByte): %s\n",
+ val,
+ ( val + 1023L ) / 1024,
+ string );
+ }
+
+#define PRINT_MEM( field, string ) \
+ Print_Mem( memory_footprint.field, string )
+
+
+ /* Print the memory footprint */
+
+ void
+ Print_Memory( void )
+ {
+ /* create glyph */
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create glyph container.\n" ) );
+ goto Failure;
+ }
+
+ FOOTPRINT( glyph_object );
+
+ /* create instance */
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create instance.\n" ) );
+ goto Failure;
+ }
+
+ FOOTPRINT( first_instance );
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create second instance.\n" ) );
+ goto Failure;
+ }
+
+ FOOTPRINT( second_instance );
+
+ printf( gettext( "Memory footprint statistics:\n" ) );
+ separator_line( stdout, 78 );
+
+ /* NOTE: In our current implementation, the face's execution */
+ /* context object is created lazily with the first */
+ /* instance. However, all later instances share the */
+ /* the same context. */
+
+ PRINT_MEM( face_object, gettext( "face object" ) );
+ PRINT_MEM( glyph_object, gettext( "glyph object" ) );
+ PRINT_MEM( second_instance, gettext( "instance object" ) );
+
+ Print_Mem( memory_footprint.first_instance -
+ memory_footprint.second_instance,
+ gettext( "exec. context object" ) );
+
+ separator_line( stdout, 78 );
+
+ Print_Mem( memory_footprint.face_object +
+ memory_footprint.glyph_object +
+ memory_footprint.first_instance,
+ gettext( "total memory usage" ) );
+
+ printf( "\n" );
+
+ return;
+
+ Failure:
+ fprintf( stderr, " " );
+ Panic( gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+ }
+
+
+ static char name_buffer[257];
+ static int name_len = 0;
+
+
+ static char*
+ LookUp_Name( int index )
+ {
+ unsigned short i, n;
+
+ unsigned short platform, encoding, language, id;
+ char* string;
+ unsigned short string_len;
+
+ int j, found;
+
+
+ n = properties.num_Names;
+
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_Name_ID( face, i, &platform, &encoding, &language, &id );
+ TT_Get_Name_String( face, i, &string, &string_len );
+
+ if ( id == index )
+ {
+
+ /* The following code was inspired from Mark Leisher's */
+ /* ttf2bdf package */
+
+ found = 0;
+
+ /* Try to find a Microsoft English name */
+
+ if ( platform == 3 )
+ for ( j = 1; j >= 0; j-- )
+ if ( encoding == j ) /* Microsoft ? */
+ if ( (language & 0x3FF) == 0x009 ) /* English language */
+ {
+ found = 1;
+ break;
+ }
+
+ if ( !found && platform == 0 && language == 0 )
+ found = 1;
+
+ /* Found a Unicode Name. */
+
+ if ( found )
+ {
+ if ( string_len > 512 )
+ string_len = 512;
+
+ name_len = 0;
+
+ for ( i = 1; i < string_len; i += 2 )
+ name_buffer[name_len++] = string[i];
+
+ name_buffer[name_len] = '\0';
+
+ return name_buffer;
+ }
+ }
+ }
+
+ /* Not found */
+ return NULL;
+ }
+
+
+ static void
+ Print_Names( void )
+ {
+ printf( gettext( "font name table entries\n" ) );
+ separator_line( stdout, 78 );
+
+ if ( LookUp_Name( 4 ) )
+ printf( "%s - ", name_buffer );
+
+ if ( LookUp_Name( 5 ) )
+ printf( "%s\n\n", name_buffer );
+
+ if ( LookUp_Name( 6 ) )
+ printf( gettext( "PostScript name: %s\n\n" ), name_buffer );
+
+ if ( LookUp_Name( 0 ) )
+ printf( "%s\n\n", name_buffer );
+
+ if ( LookUp_Name( 7 ) )
+ printf( name_buffer );
+
+ printf( "\n" );
+ separator_line( stdout, 78 );
+ }
+
+
+ static void
+ Print_Encodings( void )
+ {
+ unsigned short n, i;
+ unsigned short platform, encoding;
+ char* platStr, *encoStr;
+
+ char tempStr[128];
+
+
+ printf( gettext( "character map encodings\n" ) );
+ separator_line( stdout, 78 );
+
+ n = properties.num_CharMaps;
+ if ( n == 0 )
+ {
+ printf( gettext(
+ "The file doesn't seem to have any encoding table.\n" ) );
+ return;
+ }
+
+ printf( gettext( "There are %hu encodings:\n\n" ), n );
+
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ printf( gettext( "encoding %2u: " ), i );
+
+ platStr = encoStr = NULL;
+
+ switch ( platform )
+ {
+ case TT_PLATFORM_APPLE_UNICODE:
+ platStr = "Apple Unicode";
+ switch ( encoding )
+ {
+ case TT_APPLE_ID_DEFAULT:
+ encoStr = "";
+ break;
+
+ case TT_APPLE_ID_UNICODE_1_1:
+ encoStr = "(v.1.1)";
+ break;
+
+ case TT_APPLE_ID_ISO_10646:
+ encoStr = "(ISO 10646-1:1993)";
+ break;
+
+ case TT_APPLE_ID_UNICODE_2_0:
+ encoStr = "(v.2.0)";
+ break;
+
+ default:
+ sprintf( tempStr, gettext( "Unknown value %hu" ), encoding );
+ encoStr = tempStr;
+ }
+ break;
+
+ case TT_PLATFORM_MACINTOSH:
+ platStr = "Apple";
+ if ( encoding > 32 )
+ {
+ sprintf( tempStr, gettext( "Unknown value %hu" ), encoding );
+ encoStr = tempStr;
+ }
+ else
+ encoStr = (char*)Apple_Encodings[encoding];
+ break;
+
+ case TT_PLATFORM_ISO:
+ platStr = "Iso";
+ switch ( encoding )
+ {
+ case TT_ISO_ID_7BIT_ASCII:
+ platStr = "Ascii";
+ encoStr = "7-bit";
+ break;
+
+ case TT_ISO_ID_10646:
+ encoStr = "10646";
+ break;
+
+ case TT_ISO_ID_8859_1:
+ encoStr = "8859-1";
+ break;
+
+ default:
+ sprintf( tempStr, "%hu", encoding );
+ encoStr = tempStr;
+ }
+ break;
+
+ case TT_PLATFORM_MICROSOFT:
+ platStr = "Windows";
+ switch ( encoding )
+ {
+ case TT_MS_ID_SYMBOL_CS:
+ encoStr = "Symbol";
+ break;
+
+ case TT_MS_ID_UNICODE_CS:
+ encoStr = "Unicode";
+ break;
+
+ case TT_MS_ID_SJIS:
+ encoStr = "Shift-JIS";
+ break;
+
+ case TT_MS_ID_GB2312:
+ encoStr = "GB2312";
+ break;
+
+ case TT_MS_ID_BIG_5:
+ encoStr = "Big 5";
+ break;
+
+ case TT_MS_ID_WANSUNG:
+ encoStr = "WanSung";
+ break;
+
+ case TT_MS_ID_JOHAB:
+ encoStr = "Johab";
+ break;
+
+ case TT_MS_ID_UCS_4:
+ encoStr = "UCS-4";
+ break;
+
+ default:
+ sprintf( tempStr, gettext( "Unknown value %hu" ), encoding );
+ encoStr = tempStr;
+ }
+ break;
+
+ default:
+ sprintf( tempStr, "%hu - %hu", platform, encoding );
+ platStr = gettext( "Unknown" );
+ encoStr = tempStr;
+ }
+
+ printf( "%s %s\n", platStr, encoStr );
+ }
+
+ printf( "\n" );
+ separator_line( stdout, 78 );
+ }
+
+
+ static void
+ Print_Cmap( void )
+ {
+ TT_CharMap charmap;
+ TT_UShort glyph_index;
+ TT_Long char_index;
+ unsigned short n, i;
+ unsigned short platform, encoding;
+
+
+ printf( gettext( "ftxcmap test\n" ) );
+ separator_line( stdout, 78 );
+
+ n = properties.num_CharMaps;
+ if ( n == 0 )
+ {
+ printf( gettext(
+ "The file doesn't seem to have any encoding table.\n" ) );
+ return;
+ }
+
+ printf( gettext( "There are %hu encodings:\n\n" ), n );
+
+ for ( i = 0; i < n; i++ )
+ {
+
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ printf( gettext( "encoding %2u:\n" ), i );
+
+ TT_Get_CharMap( face, i, &charmap);
+
+ char_index = TT_CharMap_First( charmap, &glyph_index );
+ printf( gettext( "first: glyph index %hu, character code 0x%lx\n" ),
+ glyph_index, char_index );
+
+ char_index = TT_CharMap_Next( charmap, char_index, &glyph_index );
+ printf( gettext( "next: glyph index %hu, character code 0x%lx\n" ),
+ glyph_index, char_index );
+
+ char_index = TT_CharMap_Last( charmap, &glyph_index );
+ printf( gettext( "last: glyph index %hu, character code 0x%lx\n" ),
+ glyph_index, char_index );
+ }
+
+ printf( "\n" );
+ separator_line( stdout, 78 );
+ }
+
+
+ static void
+ Print_SBits( void )
+ {
+ TT_EBLC eblc;
+ TT_Error error;
+
+
+ error = TT_Get_Face_Bitmaps( face, &eblc );
+ if ( error == TT_Err_Table_Missing )
+ return;
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while retrieving embedded bitmaps table.\n" ) );
+ goto Failure;
+ }
+
+ printf( gettext( "embedded bitmap table\n" ) );
+ separator_line( stdout, 78 );
+
+ printf( gettext( " version of embedded bitmap table: 0x%lx\n" ),
+ eblc.version );
+ printf( gettext( " number of embedded bitmap strikes: %lu\n" ),
+ eblc.num_strikes );
+
+ {
+ TT_SBit_Strike* strike = eblc.strikes;
+ int count = 0;
+
+
+ for ( ; count < eblc.num_strikes; count++, strike++ )
+ {
+ printf( gettext( " bitmap strike %hu/%lu: " ),
+ count + 1, eblc.num_strikes );
+
+ printf( gettext( "%hux%hu pixels, %hu-bit depth, glyphs [%hu..%hu]\n" ),
+ strike->x_ppem, strike->y_ppem, strike->bit_depth,
+ strike->start_glyph, strike->end_glyph );
+ {
+ TT_SBit_Range* range = strike->sbit_ranges;
+ TT_SBit_Range* limit = range + strike->num_ranges;
+
+
+ for ( ; range < limit; range++ )
+ printf( gettext( " range format (%hu:%hu) glyphs %hu..%hu\n" ),
+ range->index_format,
+ range->image_format,
+ range->first_glyph,
+ range->last_glyph );
+ }
+ }
+ }
+ printf( "\n" );
+ separator_line( stdout, 78 );
+
+ return;
+
+ Failure:
+ fprintf( stderr, " " );
+ Panic( gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+ }
+
+
+#define TAG2STRING( t, s ) s[0] = (char)(t >> 24), \
+ s[1] = (char)(t >> 16), \
+ s[2] = (char)(t >> 8), \
+ s[3] = (char)(t )
+
+
+ static void
+ Print_GSUB( void )
+ {
+ TTO_GSUBHeader gsub;
+ TT_Error error;
+
+ TT_UShort i;
+ TTO_Feature f;
+ TTO_Lookup* lo;
+
+ TT_ULong *script_tag_list, *stl;
+ TT_ULong *language_tag_list, *ltl;
+ TT_ULong *feature_tag_list, *ftl;
+
+ TT_UShort script_index, language_index,
+ feature_index, req_feature_index;
+
+ char script_tag[4], language_tag[4], feature_tag[4];
+
+
+ error = TT_Load_GSUB_Table( face, &gsub, NULL );
+ if ( error == TT_Err_Table_Missing )
+ return;
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while loading GSUB table.\n" ) );
+ goto Failure;
+ }
+
+ printf( gettext( "GSUB table\n" ) );
+ separator_line( stdout, 78 );
+
+ error = TT_GSUB_Query_Scripts( &gsub, &script_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GSUB script list.\n" ) );
+ goto Failure;
+ }
+
+ stl = script_tag_list;
+ for ( ; *stl; stl++ )
+ {
+ TAG2STRING( *stl, script_tag );
+
+ error = TT_GSUB_Select_Script( &gsub, *stl, &script_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GSUB script `%4.4s'.\n" ),
+ script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " script `%4.4s' (index %hu):\n" ),
+ script_tag, script_index );
+
+ error = TT_GSUB_Query_Features( &gsub, script_index, 0xFFFF,
+ &feature_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GSUB default language system for script `%4.4s'.\n" ),
+ script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " default language system:\n" ) );
+
+ ftl = feature_tag_list;
+ for ( ; *ftl; ftl++ )
+ {
+ TAG2STRING( *ftl, feature_tag );
+
+ error = TT_GSUB_Select_Feature( &gsub, *ftl,
+ script_index, 0xFFFF,
+ &feature_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GSUB feature `%4.4s'\n"
+ "for default language system of script `%4.4s'.\n" ),
+ feature_tag, script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " feature `%4.4s' (index %hu; lookup " ),
+ feature_tag, feature_index );
+
+ f = gsub.FeatureList.FeatureRecord[feature_index].Feature;
+
+ for ( i = 0; i < f.LookupListCount - 1; i++ )
+ printf( "%hu, ", f.LookupListIndex[i] );
+ printf( "%hu)\n", f.LookupListIndex[i] );
+ }
+ FREE( feature_tag_list );
+
+ error = TT_GSUB_Query_Languages( &gsub, script_index,
+ &language_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GSUB language list for script `%4.4s'.\n" ),
+ script_tag );
+ goto Failure;
+ }
+
+ ltl = language_tag_list;
+ for ( ; *ltl; ltl++ )
+ {
+ TAG2STRING( *ltl, language_tag );
+
+ error = TT_GSUB_Select_Language( &gsub, *ltl,
+ script_index,
+ &language_index,
+ &req_feature_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GSUB language `%4.4s' for script `%4.4s'.\n" ),
+ language_tag, script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " language `%4.4s' (index %hu):\n" ),
+ language_tag, language_index );
+
+ if ( req_feature_index != 0xFFFF )
+ {
+ printf( gettext( " required feature index %hu (lookup " ),
+ req_feature_index );
+
+ f = gsub.FeatureList.FeatureRecord[req_feature_index].Feature;
+
+ for ( i = 0; i < f.LookupListCount - 1; i++ )
+ printf( "%hu, ", f.LookupListIndex[i] );
+ printf( "%hu)\n", f.LookupListIndex[i] );
+ }
+
+ error = TT_GSUB_Query_Features( &gsub, script_index, language_index,
+ &feature_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GSUB feature list\n"
+ "for script `%4.4s', language `%4.4s'.\n" ),
+ script_tag, language_tag );
+ goto Failure;
+ }
+
+ ftl = feature_tag_list;
+ for ( ; *ftl; ftl++ )
+ {
+ TAG2STRING( *ftl, feature_tag );
+
+ error = TT_GSUB_Select_Feature( &gsub, *ftl,
+ script_index, language_index,
+ &feature_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GSUB feature `%4.4s'\n"
+ "for script `%4.4s', language `%4.4s'.\n" ),
+ feature_tag, script_tag, language_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " feature `%4.4s' (index %hu; lookup " ),
+ feature_tag, feature_index );
+
+ f = gsub.FeatureList.FeatureRecord[feature_index].Feature;
+
+ for ( i = 0; i < f.LookupListCount - 1; i++ )
+ printf( "%hu, ", f.LookupListIndex[i] );
+ printf( "%hu)\n", f.LookupListIndex[i] );
+ }
+ FREE( feature_tag_list );
+ }
+ FREE( language_tag_list );
+ }
+ FREE( script_tag_list );
+
+ printf( "\n" );
+
+ lo = gsub.LookupList.Lookup;
+
+ printf( gettext( "Lookups:\n\n" ) );
+
+ for ( i = 0; i < gsub.LookupList.LookupCount; i++ )
+ printf( gettext( " %hu: type %hu, flag 0x%x\n" ),
+ i, lo[i].LookupType, lo[i].LookupFlag );
+
+ printf( "\n" );
+ separator_line( stdout, 78 );
+
+ return;
+
+ Failure:
+ fprintf( stderr, " " );
+ Panic( gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+ }
+
+
+ static void
+ Print_GPOS( void )
+ {
+ TTO_GPOSHeader gpos;
+ TT_Error error;
+
+ TT_UShort i;
+ TTO_Feature f;
+ TTO_Lookup* lo;
+
+ TT_ULong *script_tag_list, *stl;
+ TT_ULong *language_tag_list, *ltl;
+ TT_ULong *feature_tag_list, *ftl;
+
+ TT_UShort script_index, language_index,
+ feature_index, req_feature_index;
+
+ char script_tag[4], language_tag[4], feature_tag[4];
+
+
+ error = TT_Load_GPOS_Table( face, &gpos, NULL );
+ if ( error == TT_Err_Table_Missing )
+ return;
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while loading GPOS table.\n" ) );
+ goto Failure;
+ }
+
+ printf( gettext( "GPOS table\n" ) );
+ separator_line( stdout, 78 );
+
+ error = TT_GPOS_Query_Scripts( &gpos, &script_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GPOS script list.\n" ) );
+ goto Failure;
+ }
+
+ stl = script_tag_list;
+ for ( ; *stl; stl++ )
+ {
+ TAG2STRING( *stl, script_tag );
+
+ error = TT_GPOS_Select_Script( &gpos, *stl, &script_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GPOS script `%4.4s'.\n" ),
+ script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " script `%4.4s' (index %hu):\n" ),
+ script_tag, script_index );
+
+ error = TT_GPOS_Query_Features( &gpos, script_index, 0xFFFF,
+ &feature_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GPOS default language system for script `%4.4s'.\n" ),
+ script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " default language system:\n" ) );
+
+ ftl = feature_tag_list;
+ for ( ; *ftl; ftl++ )
+ {
+ TAG2STRING( *ftl, feature_tag );
+
+ error = TT_GPOS_Select_Feature( &gpos, *ftl,
+ script_index, 0xFFFF,
+ &feature_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GPOS feature `%4.4s'\n"
+ "for default language system of script `%4.4s'.\n" ),
+ feature_tag, script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " feature `%4.4s' (index %hu; lookup " ),
+ feature_tag, feature_index );
+
+ f = gpos.FeatureList.FeatureRecord[feature_index].Feature;
+
+ for ( i = 0; i < f.LookupListCount - 1; i++ )
+ printf( "%hu, ", f.LookupListIndex[i] );
+ printf( "%hu)\n", f.LookupListIndex[i] );
+ }
+ FREE( feature_tag_list );
+
+ error = TT_GPOS_Query_Languages( &gpos, script_index,
+ &language_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GPOS language list for script `%4.4s'.\n" ),
+ script_tag );
+ goto Failure;
+ }
+
+ ltl = language_tag_list;
+ for ( ; *ltl; ltl++ )
+ {
+ TAG2STRING( *ltl, language_tag );
+
+ error = TT_GPOS_Select_Language( &gpos, *ltl,
+ script_index,
+ &language_index,
+ &req_feature_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GPOS language `%4.4s' for script `%4.4s'.\n" ),
+ language_tag, script_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " language `%4.4s' (index %hu):\n" ),
+ language_tag, language_index );
+
+ if ( req_feature_index != 0xFFFF )
+ {
+ printf( gettext( " required feature index %hu (lookup " ),
+ req_feature_index );
+
+ f = gpos.FeatureList.FeatureRecord[req_feature_index].Feature;
+
+ for ( i = 0; i < f.LookupListCount - 1; i++ )
+ printf( "%hu, ", f.LookupListIndex[i] );
+ printf( "%hu)\n", f.LookupListIndex[i] );
+ }
+
+ error = TT_GPOS_Query_Features( &gpos, script_index, language_index,
+ &feature_tag_list );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while querying GPOS feature list\n"
+ "for script `%4.4s', language `%4.4s'.\n" ),
+ script_tag, language_tag );
+ goto Failure;
+ }
+
+ ftl = feature_tag_list;
+ for ( ; *ftl; ftl++ )
+ {
+ TAG2STRING( *ftl, feature_tag );
+
+ error = TT_GPOS_Select_Feature( &gpos, *ftl,
+ script_index, language_index,
+ &feature_index );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while selecting GPOS feature `%4.4s'\n"
+ "for script `%4.4s', language `%4.4s'.\n" ),
+ feature_tag, script_tag, language_tag );
+ goto Failure;
+ }
+
+ printf( gettext( " feature `%4.4s' (index %hu; lookup " ),
+ feature_tag, feature_index );
+
+ f = gpos.FeatureList.FeatureRecord[feature_index].Feature;
+
+ for ( i = 0; i < f.LookupListCount - 1; i++ )
+ printf( "%hu, ", f.LookupListIndex[i] );
+ printf( "%hu)\n", f.LookupListIndex[i] );
+ }
+ FREE( feature_tag_list );
+ }
+ FREE( language_tag_list );
+ }
+ FREE( script_tag_list );
+
+ printf( "\n" );
+
+ lo = gpos.LookupList.Lookup;
+
+ printf( gettext( "Lookups:\n\n" ) );
+
+ for ( i = 0; i < gpos.LookupList.LookupCount; i++ )
+ printf( gettext( " %hu: type %hu, flag 0x%x\n" ),
+ i, lo[i].LookupType, lo[i].LookupFlag );
+
+ printf( "\n" );
+ separator_line( stdout, 78 );
+
+ return;
+
+ Failure:
+ fprintf( stderr, " " );
+ Panic( gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+ }
+
+
+ int
+ main( int argc, char** argv )
+ {
+ int i;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ char* gt;
+
+
+#ifdef HAVE_LIBINTL_H
+ setlocale( LC_ALL, "" );
+ bindtextdomain( "freetype", LOCALEDIR );
+ textdomain( "freetype" );
+#endif
+
+ execname = argv[0];
+
+ if ( argc != 2 )
+ {
+ gt = gettext( "ftdump: Simple TrueType Dumper -- part of the FreeType project" );
+ fprintf( stderr, "%s\n", gt );
+ separator_line( stderr, strlen( gt ) );
+
+ fprintf( stderr, gettext( "Usage: %s fontname[.ttf|.ttc]\n\n" ),
+ execname );
+
+ exit( EXIT_FAILURE );
+ }
+
+ i = strlen( argv[1] );
+ while ( i > 0 && argv[1][i] != '\\' )
+ {
+ if ( argv[1][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[1], 128 );
+ strncpy( alt_filename, argv[1], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Initialize engine */
+
+ old_memory = 0;
+
+ if ( (error = TT_Init_FreeType( &engine )) )
+ {
+ fprintf( stderr, gettext( "Error while initializing engine.\n" ) );
+ goto Failure;
+ }
+
+ if ( (error = TT_Init_SBit_Extension( engine )) )
+ {
+ fprintf( stderr, gettext(
+ "Error while initializing embedded bitmap extension.\n" ) );
+ goto Failure;
+ }
+
+ if ( (error = TT_Init_GSUB_Extension( engine )) )
+ {
+ fprintf( stderr, gettext(
+ "Error while initializing GSUB extension.\n" ) );
+ goto Failure;
+ }
+
+ if ( (error = TT_Init_GPOS_Extension( engine )) )
+ {
+ fprintf( stderr, gettext(
+ "Error while initializing GPOS extension.\n" ) );
+ goto Failure;
+ }
+
+ FOOTPRINT( initial_overhead );
+
+ /* Open and Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( gettext( "Could not find or open %s.\n" ), filename );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while opening %s.\n" ), filename );
+ goto Failure;
+ }
+
+ FOOTPRINT( face_object );
+
+ /* get face properties and allocate preload arrays */
+
+ TT_Get_Face_Properties( face, &properties );
+ num_glyphs = properties.num_Glyphs;
+
+ /* Now do various dumps */
+
+ if ( flag_names )
+ Print_Names();
+
+ if ( flag_encodings )
+ Print_Encodings();
+
+ if ( flag_cmap )
+ Print_Cmap();
+
+ if ( flag_sbits )
+ Print_SBits();
+
+ if ( flag_ttopen )
+ {
+ Print_GSUB();
+ Print_GPOS();
+ }
+
+#ifndef FREETYPE_DLL /* the statistics are meaningless if we use a DLL. */
+ if ( flag_memory )
+ Print_Memory();
+#endif
+
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+
+ Failure:
+ fprintf( stderr, " " );
+ Panic( gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+
+ return 0; /* never reached */
+}
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/fterror.c b/Build/source/libs/freetype/test/fterror.c
new file mode 100644
index 00000000000..017654d562a
--- /dev/null
+++ b/Build/source/libs/freetype/test/fterror.c
@@ -0,0 +1,107 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2002 by E. Dieterich, A.Leca, */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* fterror: test TT_ErrToString18 functionality. */
+/* */
+/* This program dumps locale-sensitive error messages. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "freetype.h"
+#include "ftxerr18.h"
+
+/*
+ * Basically, an external program using FreeType shouldn't depend on an
+ * internal file of the FreeType library, especially not on ft_conf.h -- but
+ * to avoid another configure script which tests for the existence of the
+ * i18n stuff we include ft_conf.h here since we can be sure that our test
+ * programs use the same configuration options as the library itself.
+ */
+
+#include "ft_conf.h"
+
+
+#ifdef HAVE_LIBINTL_H
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <libintl.h>
+
+#else /* HAVE_LIBINTL_H */
+
+#define gettext( x ) ( x )
+
+#endif /* HAVE_LIBINTL_H */
+
+
+ static void
+ Usage( void )
+ {
+ fprintf(stderr, gettext( "fterror: test TT_ErrToString18 functionality\n\n" ) );
+ fprintf(stderr, gettext( " with an optional numerical argument, dumps the associated message.\n\n" ) );
+ exit( EXIT_FAILURE );
+ }
+
+
+ int
+ main( int argc, char** argv )
+ {
+#ifdef HAVE_LIBINTL_H
+ char* domain;
+
+
+ setlocale( LC_ALL, "" );
+ bindtextdomain( "freetype", LOCALEDIR );
+ domain = textdomain( "freetype" );
+#endif
+
+ if( argc <= 1 )
+ {
+ int i;
+#if 0
+ printf( "domain: %s\n", domain = textdomain( "" ) );
+#endif
+ printf( gettext( "Start of fterror.\n" ) );
+
+ for ( i = 0; i < 10; i++ )
+ printf( "Code: %i, %s\n", i, TT_ErrToString18( i ) );
+
+#if 0
+ printf( "domain: %s\n", domain = textdomain( "" ) );
+#endif
+ printf( gettext( "End of fterror.\n" ) );
+ }
+ else
+ {
+ int arg;
+ unsigned long cod;
+ char *end;
+
+
+ for ( arg = 1; arg < argc; ++arg )
+ {
+ cod = strtoul(argv[arg], &end, 0);
+
+ if( *end != '\0' || cod < 0 )
+ Usage();
+ printf( gettext( "Freetype error code 0x%04lX (%lu): %s\n" ),
+ cod, cod, TT_ErrToString18( cod ) );
+ }
+ }
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftlint.c b/Build/source/libs/freetype/test/ftlint.c
new file mode 100644
index 00000000000..ed240a5aea8
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftlint.c
@@ -0,0 +1,296 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2000 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftlint: a simple TrueType instruction tester. */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+
+/*
+ * Basically, an external program using FreeType shouldn't depend on an
+ * internal file of the FreeType library, especially not on ft_conf.h -- but
+ * to avoid another configure script which tests for the existence of the
+ * i18n stuff we include ft_conf.h here since we can be sure that our test
+ * programs use the same configuration options as the library itself.
+ */
+
+#include "ft_conf.h"
+
+
+#ifdef HAVE_LIBINTL_H
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <libintl.h>
+#include "ftxerr18.h"
+
+#else /* !HAVE_LIBINTL_H */
+
+#define gettext( x ) ( x )
+
+ /* We ignore error message strings with this function */
+
+ static char*
+ TT_ErrToString18( TT_Error error )
+ {
+ static char temp[32];
+
+
+ sprintf( temp, "0x%04lx", error );
+ return temp;
+ }
+
+#endif /* !HAVE_LIBINTL_H */
+
+
+ TT_Error error;
+
+ TT_Engine engine;
+
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+
+ TT_Outline outline;
+ TT_Glyph_Metrics metrics;
+
+ TT_Face_Properties properties;
+
+ unsigned int num_glyphs;
+ int ptsize;
+
+ int Fail;
+ int Num;
+
+
+ static TT_Error
+ LoadTrueTypeChar( int idx )
+ {
+ return TT_Load_Glyph( instance, glyph, idx, TTLOAD_DEFAULT );
+ }
+
+
+ static void
+ Usage( char* name )
+ {
+ char* gt;
+
+
+ gt = gettext( "ftlint: Simple TrueType instruction tester -- part of the FreeType project" );
+ fprintf( stderr, "%s\n", gt );
+ separator_line( stderr, strlen( gt ) );
+
+ fprintf( stderr, gettext(
+ "Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n\n" ), name );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ int
+ main( int argc, char** argv )
+ {
+ int i, file_index;
+ unsigned int id;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ char* fname;
+
+
+#ifdef HAVE_LIBINTL_H
+ setlocale( LC_ALL, "" );
+ bindtextdomain( "freetype", LOCALEDIR );
+ textdomain( "freetype" );
+#endif
+
+ execname = argv[0];
+
+ if ( argc < 3 )
+ Usage( execname );
+
+ if ( sscanf( argv[1], "%d", &ptsize ) != 1 )
+ Usage( execname );
+
+ /* Initialize engine */
+ if ( (error = TT_Init_FreeType( &engine )) )
+ {
+ fprintf( stderr,
+ gettext( "Error while initializing engine.\n" ) );
+ goto Failure;
+ }
+
+ /* Now check all files */
+ for ( file_index = 2; file_index < argc; file_index++ )
+ {
+ fname = argv[file_index];
+ i = strlen( fname );
+ while ( i > 0 && fname[i] != '\\' && fname[i] != '/' )
+ {
+ if ( fname[i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, fname, 128 );
+ strncpy( alt_filename, fname, 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Load face */
+ error = TT_Open_Face( engine, filename, &face );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ i = strlen( filename );
+ fname = filename;
+
+ while ( i >= 0 )
+ if ( filename[i] == '/' || filename[i] == '\\' )
+ {
+ fname = filename + i + 1;
+ i = -1;
+ }
+ else
+ i--;
+
+ fprintf( stderr, "%s: ", fname );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ fprintf( stderr, gettext( "Could not find or open %s.\n" ),
+ filename );
+ goto Fail_Face;
+ }
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while opening %s.\n" ), filename );
+ goto Fail_Face;
+ }
+
+ /* get face properties */
+
+ TT_Get_Face_Properties( face, &properties );
+ num_glyphs = properties.num_Glyphs;
+
+ /* create glyph */
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ {
+ fprintf( stderr,
+ gettext( "Could not create glyph container.\n" ) );
+ goto Fail_Glyph;
+ }
+
+ /* create instance */
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create instance.\n" ) );
+ goto Fail_Instance;
+ }
+
+ error = TT_Set_Instance_PixelSizes( instance,
+ ptsize,
+ ptsize,
+ ptsize*3/4 );
+ if ( error )
+ {
+ fprintf( stderr,
+ gettext( "Could not set point size to %d.\n" ),
+ ptsize );
+ goto Fail_Set;
+ }
+
+ Fail = 0;
+
+ for ( id = 0; id < num_glyphs; id++ )
+ {
+ if ( (error = LoadTrueTypeChar( id )) )
+ {
+ if ( Fail < 10 )
+ {
+ fprintf( stderr, !Fail ? gettext( "Error with\n " ) : " " );
+ fprintf( stderr, gettext( "glyph %4u: %s\n" ),
+ id, TT_ErrToString18( error ) );
+ }
+ Fail++;
+ }
+ }
+
+ if ( Fail == 0 )
+ fprintf( stderr, "OK.\n" );
+ else
+ {
+ fprintf( stderr, " " );
+ if ( Fail == 1 )
+ fprintf( stderr, gettext( "1 fail.\n" ) );
+ else
+ fprintf( stderr, gettext( "%d fails.\n" ), Fail );
+ }
+
+ /* hush complaints at the end of the loop */
+ error = 0;
+
+ Fail_Set:
+ TT_Done_Instance( instance );
+ Fail_Instance:
+ TT_Done_Glyph( glyph );
+ Fail_Glyph:
+ TT_Close_Face( face );
+ Fail_Face:
+ ;
+
+
+ if ( error )
+ {
+ fprintf( stderr, " " );
+ fprintf( stderr, gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+ }
+ }
+
+ TT_Done_FreeType( engine );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+
+ Failure:
+ fprintf( stderr, " " );
+ fprintf( stderr, gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+
+ exit( EXIT_FAILURE );
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftmetric.c b/Build/source/libs/freetype/test/ftmetric.c
new file mode 100644
index 00000000000..58c98e32fee
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftmetric.c
@@ -0,0 +1,399 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1999-2001 by */
+/* Yamano'uchi H. and W. Lemberg */
+/* */
+/* ftmetric: dump metrics and a glyph. */
+/* */
+/* NOTE: This is just a test program that is used to debug */
+/* the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+#include "ftxsbit.h"
+
+#include "textdisp.h"
+
+/*
+ * Basically, an external program using FreeType shouldn't depend on an
+ * internal file of the FreeType library, especially not on ft_conf.h -- but
+ * to avoid another configure script which tests for the existence of the
+ * i18n stuff we include ft_conf.h here since we can be sure that our test
+ * programs use the same configuration options as the library itself.
+ */
+
+#include "ft_conf.h"
+
+
+#ifdef HAVE_LIBINTL_H
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <libintl.h>
+#include "ftxerr18.h"
+
+#else /* !HAVE_LIBINTL_H */
+
+#define gettext( x ) ( x )
+
+ /* We ignore error message strings with this function */
+
+ static char*
+ TT_ErrToString18( TT_Error error )
+ {
+ static char temp[32];
+
+
+ sprintf( temp, "0x%04lx", error );
+ return temp;
+ }
+
+#endif /* !HAVE_LIBINTL_H */
+
+ static void
+ usage( char* execname )
+ {
+ char* gt;
+
+
+ fprintf( stderr, "\n" );
+ gt = gettext( "ftmetric: Simple TTF metrics/glyph dumper -- part of the FreeType project" );
+ fprintf( stderr, "%s\n", gt );
+ separator_line( stderr, strlen( gt ) );
+ fprintf( stderr, gettext(
+ "Usage: %s [options below] point fontname[.ttf|.ttc]\n"
+ "\n"
+ " -B show sbit's metrics (default: none)\n"
+ " -c C use C'th font index of TrueType collection (default: 0)\n"
+ " -i index glyph index (default: 0)\n"
+ " -r R use resolution R dpi (default: 72)\n"
+ "\n" ), execname );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ static void
+ Show_Metrics( TT_Big_Glyph_Metrics metrics,
+ char* title )
+ {
+ int show_advance = 1;
+
+
+ printf("%s: xMin %d, xMax %d, yMin %d, yMax %d",
+ title,
+ (int)(metrics.bbox.xMin / 64),
+ (int)(metrics.bbox.xMax / 64),
+ (int)(metrics.bbox.yMin / 64),
+ (int)(metrics.bbox.yMax / 64));
+
+
+ if ( show_advance )
+ printf( ", advance width %d", (int)(metrics.horiAdvance / 64) );
+
+ printf("\n");
+ return;
+ }
+
+
+ int
+ main( int argc, char** argv )
+ {
+ int i, orig_ptsize, file;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ int option;
+
+ int ptsize;
+ int num_Faces = 0;
+ int glyph_index = 0;
+ int load_flags = TTLOAD_DEFAULT;
+
+ int force_sbit = 0;
+
+ TT_Engine engine;
+
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+
+ TT_Raster_Map map;
+
+ TT_Big_Glyph_Metrics metrics;
+ TT_Face_Properties properties;
+ TT_Instance_Metrics imetrics;
+
+ TT_EBLC eblc;
+ TT_SBit_Image* bitmap = NULL;
+
+ TT_Error error;
+
+
+ int res = 72;
+
+#ifdef HAVE_LIBINTL_H
+ setlocale( LC_ALL, "" );
+ bindtextdomain( "freetype", LOCALEDIR );
+ textdomain( "freetype" );
+#endif
+
+ execname = ft_basename( argv[0] );
+
+ while ( 1 )
+ {
+ option = ft_getopt( argc, argv, "c:r:i:B" );
+
+ if ( option == -1 )
+ break;
+
+ switch ( option )
+ {
+ case 'r':
+ res = atoi( ft_optarg );
+ if ( res < 1 )
+ usage( execname );
+ break;
+
+ case 'c':
+ num_Faces = atoi( ft_optarg );
+ if ( num_Faces < 0 )
+ usage( execname );
+ break;
+
+ case 'i':
+ glyph_index = atoi( ft_optarg );
+ if ( glyph_index < 0 )
+ usage( execname );
+ break;
+
+ case 'B':
+ force_sbit = 1;
+ break;
+
+ default:
+ usage( execname );
+ break;
+ }
+ }
+
+ argc -= ft_optind;
+ argv += ft_optind;
+
+ if ( argc <= 1 )
+ usage( execname );
+
+ if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 )
+ orig_ptsize = 64;
+
+ file = 1;
+
+ ptsize = orig_ptsize;
+
+ i = strlen( argv[file] );
+ while ( i > 0 && argv[file][i] != '\\' && argv[file][i] != '/' )
+ {
+ if ( argv[file][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[file], 128 );
+ strncpy( alt_filename, argv[file], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Initialize engine */
+
+ error = TT_Init_FreeType( &engine );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while initializing engine.\n" ) );
+ goto Failure;
+ }
+
+ error = TT_Init_SBit_Extension( engine );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while initializing embedded bitmap extension.\n" ) );
+ goto Failure;
+ }
+
+ /* Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( gettext( "Could not find or open %s.\n" ), filename );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while opening %s.\n" ),
+ filename );
+ goto Failure;
+ }
+
+ TT_Get_Face_Properties( face, &properties );
+
+ printf( gettext( "There are %d fonts in this collection.\n" ),
+ (int)(properties.num_Faces) );
+
+ if ( num_Faces >= properties.num_Faces )
+ Panic( gettext(
+ "There is no collection with index %d in this font file.\n" ),
+ num_Faces );
+
+ TT_Close_Face( face );
+
+ error = TT_Open_Collection( engine, filename, num_Faces, &face );
+
+ /* get face properties and eblc */
+
+ TT_Get_Face_Properties( face, &properties );
+ if ( force_sbit )
+ {
+ error = TT_Get_Face_Bitmaps( face, &eblc );
+ if ( error == TT_Err_Table_Missing )
+ Panic( gettext( "There is no embedded bitmap data in the font.\n" ) );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while retrieving embedded bitmaps table.\n" ) );
+ goto Failure;
+ }
+ }
+
+ /* create glyph */
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create glyph container.\n" ) );
+ goto Failure;
+ }
+
+ /* create instance */
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create instance.\n" ) );
+ goto Failure;
+ }
+
+ error = TT_Set_Instance_Resolutions( instance, res, res );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not set device resolutions.\n" ) );
+ goto Failure;
+ }
+
+ error = TT_Set_Instance_CharSize( instance, ptsize*64 );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not reset instance.\n" ) );
+ goto Failure;
+ }
+
+ TT_Get_Instance_Metrics( instance, &imetrics );
+
+ printf( gettext( "Instance metrics: ppemX %d, ppemY %d\n" ),
+ imetrics.x_ppem,
+ imetrics.y_ppem );
+
+ if ( force_sbit )
+ {
+ error = TT_New_SBit_Image( &bitmap );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Could not allocate glyph bitmap container.\n" ) );
+ goto Failure;
+ }
+
+ error = TT_Load_Glyph_Bitmap( face, instance, glyph_index, bitmap );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Can't load bitmap for glyph %d.\n" ), glyph_index );
+ goto Failure;
+ }
+
+ Show_Metrics( bitmap->metrics, "SBit's metrics" );
+
+ printf( "SBit glyph:\n" );
+ Show_Single_Glyph( &bitmap->map );
+ }
+ else
+ {
+ TT_Load_Glyph( instance, glyph, glyph_index, load_flags );
+ TT_Get_Glyph_Big_Metrics( glyph, &metrics );
+
+ map.width = ( metrics.bbox.xMax - metrics.bbox.xMin ) / 64;
+ map.rows = ( metrics.bbox.yMax - metrics.bbox.yMin ) / 64;
+ map.cols = ( map.width + 7 ) / 8;
+ map.size = map.cols * map.rows;
+ map.bitmap = malloc( map.size );
+ map.flow = TT_Flow_Down;
+
+ memset( map.bitmap, 0, map.size );
+
+ error = TT_Get_Glyph_Bitmap( glyph, &map,
+ -metrics.bbox.xMin,
+ -metrics.bbox.yMin );
+
+ Show_Metrics( metrics, gettext( "Outline's metrics" ) );
+
+ printf( gettext( "Outline glyph\n" ) );
+ Show_Single_Glyph( &map );
+ }
+
+ free( map.bitmap );
+
+ if ( bitmap )
+ TT_Done_SBit_Image( bitmap );
+
+ TT_Done_Instance( instance );
+ TT_Done_Glyph( glyph );
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+
+ Failure:
+ fprintf( stderr, " " );
+ fprintf( stderr, gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+
+ exit( EXIT_FAILURE );
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftsbit.c b/Build/source/libs/freetype/test/ftsbit.c
new file mode 100644
index 00000000000..be3af357d0d
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftsbit.c
@@ -0,0 +1,295 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftsbit: a _very_ simple embedded bitmap dumper for FreeType 1.x. */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+#include "ftxsbit.h"
+
+#include "textdisp.h"
+
+/*
+ * Basically, an external program using FreeType shouldn't depend on an
+ * internal file of the FreeType library, especially not on ft_conf.h -- but
+ * to avoid another configure script which tests for the existence of the
+ * i18n stuff we include ft_conf.h here since we can be sure that our test
+ * programs use the same configuration options as the library itself.
+ */
+
+#include "ft_conf.h"
+
+
+#ifdef HAVE_LIBINTL_H
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <libintl.h>
+#include "ftxerr18.h"
+
+#else /* !HAVE_LIBINTL_H */
+
+#define gettext( x ) ( x )
+
+ /* We ignore error message strings with this function */
+
+ static char* TT_ErrToString18( TT_Error error )
+ {
+ static char temp[32];
+
+
+ sprintf( temp, "0x%04lx", error );
+ return temp;
+ }
+
+#endif /* !HAVE_LIBINTL_H */
+
+
+ TT_Error error;
+
+ TT_Engine engine;
+
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+
+ TT_Outline outline;
+ TT_Glyph_Metrics metrics;
+
+ TT_Face_Properties properties;
+ TT_EBLC eblc;
+ TT_SBit_Image* bitmap;
+
+ unsigned int num_glyphs;
+ int ptsize;
+
+ int Fail;
+ int Num;
+
+
+ static void Usage( char* name )
+ {
+ char* gt;
+
+
+ gt = gettext( "ftsbit: Simple TrueType `sbit' dumper -- part of the FreeType project" );
+ fprintf( stderr, "%s\n", gt );
+ separator_line( stderr, strlen( gt ) );
+
+ fprintf( stderr, gettext(
+ "Usage: %s ppem fontname[.ttf|.ttc] glyph_index [glyph_index2..]\n\n" ), name );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ int main( int argc, char** argv )
+ {
+ int i;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ char* fname;
+
+
+#ifdef HAVE_LIBINTL_H
+ setlocale( LC_ALL, "" );
+ bindtextdomain( "freetype", LOCALEDIR );
+ textdomain( "freetype" );
+#endif
+
+ execname = argv[0];
+
+ if ( argc < 3 )
+ Usage( execname );
+
+ if ( sscanf( argv[1], "%d", &ptsize ) != 1 )
+ Usage( execname );
+
+ /* Initialize engine */
+ if ( (error = TT_Init_FreeType( &engine )) )
+ {
+ fprintf( stderr, gettext( "Error while initializing engine.\n" ) );
+ goto Failure;
+ }
+
+ if ( (error = TT_Init_SBit_Extension( engine )) )
+ {
+ fprintf( stderr, gettext(
+ "Error while initializing embedded bitmap extension.\n" ) );
+ goto Failure;
+ }
+
+ /* Now check all files */
+ fname = argv[2];
+ i = strlen( fname );
+ while ( i > 0 && fname[i] != '\\' && fname[i] != '/' )
+ {
+ if ( fname[i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, fname, 128 );
+ strncpy( alt_filename, fname, 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Load face */
+ error = TT_Open_Face( engine, filename, &face );
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ i = strlen( filename );
+ fname = filename;
+
+ while ( i >= 0 )
+ if ( filename[i] == '/' || filename[i] == '\\' )
+ {
+ fname = filename + i + 1;
+ i = -1;
+ }
+ else
+ i--;
+
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not find or open %s.\n" ),
+ filename );
+ goto Failure;
+ }
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Error while opening %s.\n" ), filename );
+ goto Failure;
+ }
+
+ /* get face properties */
+ TT_Get_Face_Properties( face, &properties );
+ num_glyphs = properties.num_Glyphs;
+
+ error = TT_Get_Face_Bitmaps( face, &eblc );
+ if ( error == TT_Err_Table_Missing )
+ {
+ fprintf( stderr, gettext(
+ "Could not find embedded bitmaps in this font.\n" ) );
+ goto Failure;
+ }
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Error while loading embedded bitmaps.\n" ) );
+ goto Failure;
+ }
+
+ /* create instance */
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ {
+ fprintf( stderr, gettext( "Could not create instance.\n" ) );
+ goto Failure;
+ }
+
+ error = TT_Set_Instance_PixelSizes( instance,
+ ptsize,
+ ptsize,
+ ptsize*3/4 );
+ if ( error )
+ {
+ fprintf( stderr,
+ gettext( "Could not set point size to %d.\n" ),
+ ptsize );
+ goto Failure;
+ }
+
+ error = TT_New_SBit_Image( &bitmap );
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Could not allocate glyph bitmap container.\n" ) );
+ goto Failure;
+ }
+
+ for ( i = 3; i < argc; i++ )
+ {
+ unsigned short glyph_index;
+
+
+ /* we use %i to allow the prefixes `0x' and `0' */
+ if ( sscanf( argv[i], "%hi", &glyph_index ) != 1 )
+ Usage( execname );
+
+ error = TT_Load_Glyph_Bitmap( face, instance, glyph_index, bitmap );
+
+ if ( error == TT_Err_Invalid_Glyph_Index )
+ {
+ fprintf( stderr, gettext(
+ " no bitmap for glyph %d.\n" ), glyph_index );
+ continue;
+ }
+ if ( error )
+ {
+ fprintf( stderr, gettext(
+ "Can't load bitmap for glyph %d.\n" ), glyph_index );
+ goto Failure;
+ }
+
+ /* Dump the resulting bitmap */
+ {
+ printf( gettext( "glyph index %d = %dx%d pixels, " ),
+ glyph_index, bitmap->map.rows, bitmap->map.width );
+
+ printf( gettext( "advance = %ld, minBearing = [%ld,%ld]\n" ),
+ (long)(bitmap->metrics.horiAdvance / 64),
+ (long)(bitmap->metrics.horiBearingX / 64),
+ (long)(bitmap->metrics.horiBearingY / 64));
+
+ Show_Single_Glyph( &bitmap->map );
+ }
+ }
+
+ TT_Done_SBit_Image( bitmap );
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+
+ Failure:
+ fprintf( stderr, " " );
+ fprintf( stderr, gettext( "FreeType error message: %s\n" ),
+ TT_ErrToString18( error ) );
+
+ exit( EXIT_FAILURE );
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftstring.c b/Build/source/libs/freetype/test/ftstring.c
new file mode 100644
index 00000000000..b60e81187e8
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftstring.c
@@ -0,0 +1,484 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftstring: Making string text from individual glyph information. */
+/* */
+/* Keys: */
+/* */
+/* + : fast scale up */
+/* - : fast scale down */
+/* u : fine scale down */
+/* j : fine scale up */
+/* */
+/* h : toggle hinting */
+/* */
+/* ESC : exit */
+/* */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "display.h"
+#include "freetype.h"
+
+#include "gevents.h"
+#include "gdriver.h"
+#include "gmain.h"
+
+#define Pi 3.1415926535
+
+#define MAXPTSIZE 500 /* dtp */
+#define Center_X ( Bit.width / 2 ) /* dtp */
+#define Center_Y ( Bit.rows / 2 ) /* dtp */
+
+ TT_Engine engine;
+
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+ TT_CharMap char_map;
+
+ TT_Glyph_Metrics metrics;
+ TT_Face_Properties properties;
+ TT_Instance_Metrics imetrics;
+
+ int num_glyphs;
+
+ int ptsize;
+ int hinted;
+
+ char Header[128];
+ int Fail;
+ int Num;
+
+ int gray_render;
+
+ short glyph_code[128];
+ int num_codes;
+
+
+/* Convert an ASCII string to a string of glyph indexes. */
+/* */
+/* IMPORTANT NOTE: */
+/* */
+/* There is no portable way to convert from any system's char. code */
+/* to Unicode. This function simply takes a char. string as argument */
+/* and "interprets" each character as a Unicode char. index with no */
+/* further check. */
+/* */
+/* This mapping is only valid for the ASCII character set (i.e., */
+/* codes 32 to 127); all other codes (like accentuated characters) */
+/* will produce more or less random results, depending on the system */
+/* being run. */
+
+ static void CharToUnicode( char* source )
+ {
+ unsigned short i, n;
+ unsigned short platform, encoding;
+
+ /* First, look for a Unicode charmap */
+
+ n = properties.num_CharMaps;
+
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ if ( (platform == 3 && encoding == 1 ) ||
+ (platform == 0 && encoding == 0 ) )
+ {
+ TT_Get_CharMap( face, i, &char_map );
+ i = n + 1;
+ }
+ }
+
+ if ( i == n )
+ Panic( "Sorry, but this font doesn't contain any Unicode mapping table\n" );
+
+ for ( n = 0; n < 128 && source[n]; n++ )
+#if 1
+ glyph_code[n] = TT_Char_Index( char_map, (short)source[n] );
+#else
+ /* Note, if you have a function, say ToUnicode(), to convert from */
+ /* char codes to Unicode, use the following line instead: */
+
+ glyph_code[n] = TT_Char_Index( char_map, ToUnicode( source[n] ) );
+#endif
+
+ num_codes = n;
+ }
+
+
+ static TT_Error Reset_Scale( int pointSize )
+ {
+ TT_Error error;
+
+
+ if ( (error = TT_Set_Instance_PointSize( instance, pointSize )) )
+ {
+ RestoreScreen();
+ fprintf( stderr, "Error = 0x%x.\n", (unsigned)error );
+ Panic( "Could not reset instance.\n" );
+ }
+
+ TT_Get_Instance_Metrics( instance, &imetrics );
+
+ /* now re-allocates the small bitmap */
+ if ( gray_render )
+ {
+ Init_Small( imetrics.x_ppem, imetrics.y_ppem );
+ Clear_Small();
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error LoadTrueTypeChar( int idx, int hint )
+ {
+ int flags;
+
+
+ flags = TTLOAD_SCALE_GLYPH;
+ if ( hint )
+ flags |= TTLOAD_HINT_GLYPH;
+
+ return TT_Load_Glyph( instance, glyph, idx, flags );
+ }
+
+
+ static TT_Error Render_All( void )
+ {
+ TT_F26Dot6 x, y, z, minx, miny, maxx, maxy;
+ int i;
+
+ TT_Error error;
+
+
+ /* On the first pass, we compute the compound bounding box */
+
+ x = y = 0;
+
+ minx = miny = maxx = maxy = 0;
+
+ for ( i = 0; i < num_codes; i++ )
+ {
+ if ( !(error = LoadTrueTypeChar( glyph_code[i], hinted )) )
+ {
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+
+ z = x + metrics.bbox.xMin;
+ if ( minx > z )
+ minx = z;
+
+ z = x + metrics.bbox.xMax;
+ if ( maxx < z )
+ maxx = z;
+
+ z = y + metrics.bbox.yMin;
+ if ( miny > z )
+ miny = z;
+
+ z = y + metrics.bbox.yMax;
+ if ( maxy < z )
+ maxy = z;
+
+ x += metrics.advance & -64;
+ }
+ else
+ Fail++;
+ }
+
+ /* We now center the bbox inside the target bitmap */
+
+ minx = ( minx & -64 ) >> 6;
+ miny = ( miny & -64 ) >> 6;
+
+ maxx = ( (maxx+63) & -64 ) >> 6;
+ maxy = ( (maxy+63) & -64 ) >> 6;
+
+ maxx -= minx;
+ maxy -= miny;
+
+ minx = (Bit.width - maxx)/2;
+ miny = (Bit.rows + miny)/2;
+
+ maxx += minx;
+ maxy += maxy;
+
+ /* On the second pass, we render each glyph to its centered position. */
+ /* This is slow, because we reload each glyph to render it! */
+
+ x = minx;
+ y = miny;
+
+ for ( i = 0; i < num_codes; i++ )
+ {
+ if ( !(error = LoadTrueTypeChar( glyph_code[i], hinted )) )
+ {
+ TT_Get_Glyph_Metrics( glyph, &metrics );
+
+ Render_Single_Glyph( gray_render, glyph, (int)x, (int)y );
+
+ x += metrics.advance/64;
+ }
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static int Process_Event( TEvent* event )
+ {
+ switch ( event->what )
+ {
+ case event_Quit: /* ESC or q */
+ return 0;
+
+ case event_Keyboard:
+ if ( event->info == 'h' ) /* Toggle hinting */
+ hinted = !hinted;
+ break;
+
+ case event_Rotate_Glyph:
+ break;
+
+ case event_Scale_Glyph:
+ ptsize += event->info;
+ if ( ptsize < 1 ) ptsize = 1;
+ if ( ptsize > MAXPTSIZE ) ptsize = MAXPTSIZE;
+ break;
+
+ case event_Change_Glyph:
+ break;
+ }
+
+ return 1;
+ }
+
+
+ static void usage( char* execname )
+ {
+ fprintf( stderr,
+ "\n"
+ "ftstring: simple String Test Display -- part of the FreeType project\n"
+ "--------------------------------------------------------------------\n"
+ "\n"
+ "Usage: %s [options below] ppem fontname[.ttf|.ttc] [string]\n",
+ execname );
+ fprintf( stderr,
+ "\n"
+ " -g gray-level rendering (default: none)\n"
+ " -r R use resolution R dpi (default: 96)\n"
+ "\n" );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ int main( int argc, char** argv )
+ {
+ int i, old_ptsize, orig_ptsize, file;
+ int XisSetup = 0;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ int option;
+ int res = 96;
+
+ TT_Error error;
+ TEvent event;
+
+
+ execname = ft_basename( argv[0] );
+
+ while ( 1 )
+ {
+ option = ft_getopt( argc, argv, "gr:" );
+
+ if ( option == -1 )
+ break;
+
+ switch ( option )
+ {
+ case 'g':
+ gray_render = 1;
+ break;
+
+ case 'r':
+ res = atoi( ft_optarg );
+ if ( res < 1 )
+ usage( execname );
+ break;
+
+ default:
+ usage( execname );
+ break;
+ }
+ }
+
+ argc -= ft_optind;
+ argv += ft_optind;
+
+ if ( argc <= 1 )
+ usage( execname );
+
+ if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 )
+ orig_ptsize = 64;
+
+ file = 1;
+
+ /* Initialize engine */
+
+ if ( (error = TT_Init_FreeType( &engine )) )
+ Panic( "Error while initializing engine, code = 0x%x.\n", error );
+
+ ptsize = orig_ptsize;
+ hinted = 1;
+
+ i = strlen( argv[file] );
+ while ( i > 0 && argv[file][i] != '\\' && argv[file][i] != '/' )
+ {
+ if ( argv[file][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[file], 128 );
+ strncpy( alt_filename, argv[file], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( "Could not find/open %s.\n", filename );
+ else if (error)
+ Panic( "Error while opening %s, error code = 0x%x.\n",
+ filename, error );
+
+ /* get face properties and allocate preload arrays */
+
+ TT_Get_Face_Properties( face, &properties );
+
+ num_glyphs = properties.num_Glyphs;
+
+ /* create glyph */
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ Panic( "Could not create glyph container.\n" );
+
+ /* create instance */
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ Panic( "Could not create instance for %s.\n", filename );
+
+ error = TT_Set_Instance_Resolutions( instance, res, res );
+ if ( error )
+ Panic( "Could not set device resolutions." );
+
+ if ( !XisSetup )
+ {
+ XisSetup = 1;
+
+ if ( gray_render )
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Gray ) )
+ Panic( "Could not set up grayscale graphics mode.\n" );
+
+ TT_Set_Raster_Gray_Palette( engine, virtual_palette );
+ }
+ else
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Mono ) )
+ Panic( "Could not set up mono graphics mode.\n" );
+ }
+ }
+
+ Init_Display( gray_render );
+
+ Reset_Scale( ptsize );
+
+ old_ptsize = ptsize;
+
+ Fail = 0;
+ Num = 0;
+
+ CharToUnicode( ( argv[2] ? argv[2] :
+ "The quick brown fox jumps over the lazy dog" ) );
+
+ for ( ;; )
+ {
+ Clear_Display();
+ Render_All();
+ if ( gray_render )
+ Convert_To_Display_Palette();
+
+ sprintf( Header, "%s: ptsize: %4d hinting: %s",
+ ft_basename( filename ), ptsize,
+ hinted ? "on" : "off" );
+
+ Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols );
+
+#ifndef X11
+#ifndef OS2
+ Print_XY( 0, 0, Header );
+#endif
+#endif
+
+ Get_Event( &event );
+ if ( !( Process_Event( &event ) ) )
+ goto End;
+
+ if ( ptsize != old_ptsize )
+ {
+ if ( Reset_Scale( ptsize ) )
+ Panic( "Could not resize font.\n" );
+
+ old_ptsize = ptsize;
+ }
+ }
+
+ End:
+ RestoreScreen();
+
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ printf( "Execution completed successfully.\n" );
+ printf( "Fails = %d.\n", Fail );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+}
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftstrpnm.c b/Build/source/libs/freetype/test/ftstrpnm.c
new file mode 100644
index 00000000000..73b42ea1c1e
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftstrpnm.c
@@ -0,0 +1,534 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftstrpnm: convert text to image (in PGM or PBM format) */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#define PROGNAME "ftstrpnm"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+
+#define TT_VALID( handle ) ( ( handle ).z != NULL )
+
+
+ /* Global variables */
+
+ TT_Engine engine;
+ TT_Face face;
+ TT_Instance instance;
+
+ TT_Face_Properties properties;
+
+ TT_Raster_Map bit;
+ TT_Raster_Map small_bit; /* used when font-smoothing is enabled */
+
+ int pnm_width, pnm_height;
+ int pnm_x_shift, pnm_y_shift;
+
+
+ /* Loaded glyphs for all characters */
+
+ TT_Glyph *glyphs = NULL;
+
+
+ /* Options */
+
+ int dpi = 96;
+ int ptsize = 12;
+ int hinted = 1;
+ int smooth = 0;
+ int border = 0;
+
+ /* color for text in RGB format */
+ unsigned short int textclr[3] = { 0, 0, 0 };
+
+ /* raster map management */
+
+ static void Init_Raster_Map( TT_Raster_Map* bit, int width, int height )
+ {
+ bit->rows = height;
+ bit->width = ( width + 3 ) & -4;
+ bit->flow = TT_Flow_Down;
+
+ if ( smooth )
+ {
+ bit->cols = bit->width;
+ bit->size = bit->rows * bit->width;
+ }
+ else
+ {
+ bit->cols = ( bit->width + 7 ) / 8; /* convert to # of bytes */
+ bit->size = bit->rows * bit->cols; /* number of bytes in buffer */
+ }
+
+ bit->bitmap = (void *) malloc( bit->size );
+ if ( !bit->bitmap )
+ Panic( "Not enough memory to allocate bitmap!\n" );
+ }
+
+
+ static void Done_Raster_Map( TT_Raster_Map *bit )
+ {
+ free( bit->bitmap );
+ bit->bitmap = NULL;
+ }
+
+
+ static void Clear_Raster_Map( TT_Raster_Map* bit )
+ {
+ memset( bit->bitmap, 0, bit->size );
+ }
+
+
+ static void Blit_Or( TT_Raster_Map* dst, TT_Raster_Map* src,
+ int x_off, int y_off )
+ {
+ int x, y;
+ int x1, x2, y1, y2;
+ char *s, *d;
+
+
+ /* clipping */
+
+ x1 = x_off < 0 ? -x_off : 0;
+ y1 = y_off < 0 ? -y_off : 0;
+
+ x2 = (int)dst->cols - x_off;
+ if ( x2 > src->cols )
+ x2 = src->cols;
+
+ y2 = (int)dst->rows - y_off;
+ if ( y2 > src->rows )
+ y2 = src->rows;
+
+ if ( x1 >= x2 )
+ return;
+
+ /* do the real work now */
+
+ for ( y = y1; y < y2; ++y )
+ {
+ s = ( (char*)src->bitmap ) + y * src->cols + x1;
+ d = ( (char*)dst->bitmap ) + ( y + y_off ) * dst->cols + x1 + x_off;
+
+ for ( x = x1; x < x2; ++x )
+ *d++ |= *s++;
+ }
+ }
+
+
+ static void Dump_Raster_Map( TT_Raster_Map* bit, FILE* file )
+ {
+ /* kudos for this code snippet go to Norman Walsh */
+
+ char* bmap;
+ int i, j;
+ unsigned short int colors[3][5];
+
+ bmap = (char *)bit->bitmap;
+
+ if ( smooth ) /* anti-aliasing */
+ {
+ fprintf( file, "P6\n%d %d\n255\n", pnm_width, pnm_height );
+
+ /* calculate colors for anti-aliasing */
+ for (i = 0; i < 3; i++ )
+ for (j = 0; j < 5; j++)
+ colors[i][j] = (255 - textclr[i]) * j / 4 + textclr[i];
+
+ for ( i = 0; i < bit->size; i++ ) /* iterate pixels */
+ bmap[i] = bmap[i] > 4 ? 0 : 4 - bmap[i];
+
+ for ( i = pnm_height; i > 0; i--, bmap += bit->cols )
+ for ( j = 0; j < pnm_width; j++ )
+ fprintf( file, "%c%c%c", colors[0][(unsigned int) bmap[j]],\
+ colors[1][(unsigned int) bmap[j]],\
+ colors[2][(unsigned int) bmap[j]]);
+ }
+ else /* no anti-aliasing */
+ {
+ fprintf( file, "P6\n%d %d\n255\n", pnm_width, pnm_height );
+
+ for ( i = 0; i < pnm_height; i++, bmap += bit->cols ) /* iterate rows */
+ for ( j = 0; j < pnm_width; j++ ) /* iterate bits(=columns) in row */
+ if ( bmap[j / 8] >> ( 7 - j % 8 ) & 1 ) /* bit set? */
+ fprintf( file, "%c%c%c", textclr[0], textclr[1], textclr[2] );
+ else
+ fprintf( file, "%c%c%c", 255, 255, 255 );
+ }
+ fflush( file );
+ }
+
+
+ /* glyph management */
+
+ static void Load_Glyphs( char* txt, int txtlen )
+ {
+ unsigned short i, n, code, load_flags;
+ unsigned short num_glyphs = 0, no_cmap = 0;
+ unsigned short platform, encoding;
+ TT_Error error;
+ TT_CharMap char_map;
+
+
+ /* First, look for a Unicode charmap */
+
+ n = properties.num_CharMaps;
+
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ if ( (platform == 3 && encoding == 1 ) ||
+ (platform == 0 && encoding == 0 ) )
+ {
+ TT_Get_CharMap( face, i, &char_map );
+ break;
+ }
+ }
+
+ if ( i == n )
+ {
+ TT_Face_Properties properties;
+
+
+ TT_Get_Face_Properties( face, &properties );
+
+ no_cmap = 1;
+ num_glyphs = properties.num_Glyphs;
+ }
+
+
+ /* Second, allocate the array */
+
+ glyphs = (TT_Glyph*)malloc( 256 * sizeof ( TT_Glyph ) );
+ memset( glyphs, 0, 256 * sizeof ( TT_Glyph ) );
+
+ /* Finally, load the glyphs you need */
+
+ load_flags = TTLOAD_SCALE_GLYPH;
+ if ( hinted )
+ load_flags |= TTLOAD_HINT_GLYPH;
+
+ for ( i = 0; i < txtlen; ++i )
+ {
+ unsigned char j = txt[i];
+
+
+ if ( TT_VALID( glyphs[j] ) )
+ continue;
+
+ if ( no_cmap )
+ {
+ code = (j - ' ' + 1) < 0 ? 0 : (j - ' ' + 1);
+ if ( code >= num_glyphs )
+ code = 0;
+ }
+ else
+ code = TT_Char_Index( char_map, j );
+
+ (void)(
+ ( error = TT_New_Glyph( face, &glyphs[j] ) ) ||
+ ( error = TT_Load_Glyph( instance, glyphs[j], code, load_flags ) )
+ );
+
+ if ( error )
+ Panic( "Cannot allocate and load glyph: error 0x%x.\n", error );
+ }
+ }
+
+
+ static void Done_Glyphs( void )
+ {
+ int i;
+
+
+ if ( !glyphs )
+ return;
+
+ for ( i = 0; i < 256; ++i )
+ TT_Done_Glyph( glyphs[i] );
+
+ free( glyphs );
+
+ glyphs = NULL;
+ }
+
+
+ /* face & instance management */
+
+ static void Init_Face( const char* filename )
+ {
+ TT_Error error;
+
+
+ /* load the typeface */
+
+ error = TT_Open_Face( engine, filename, &face );
+ if ( error )
+ {
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( "Could not find/open %s.\n", filename );
+ else
+ Panic( "Error while opening %s, error code = 0x%x.\n",
+ filename, error );
+ }
+
+ TT_Get_Face_Properties( face, &properties );
+
+ /* create and initialize instance */
+
+ (void) (
+ ( error = TT_New_Instance( face, &instance ) ) ||
+ ( error = TT_Set_Instance_Resolutions( instance, dpi, dpi ) ) ||
+ ( error = TT_Set_Instance_PointSize( instance, ptsize ) )
+ );
+
+ if ( error )
+ Panic( "Could not create and initialize instance: error 0x%x.\n",
+ error );
+ }
+
+
+ static void Done_Face( void )
+ {
+ TT_Done_Instance( instance );
+ TT_Close_Face( face );
+ }
+
+
+ /* rasterization stuff */
+
+ static void Init_Raster_Areas( const char* txt, int txtlen )
+ {
+ int i, upm, ascent, descent;
+ TT_Face_Properties properties;
+ TT_Instance_Metrics imetrics;
+ TT_Glyph_Metrics gmetrics;
+
+
+ /* allocate the large bitmap */
+
+ TT_Get_Face_Properties( face, &properties );
+ TT_Get_Instance_Metrics( instance, &imetrics );
+
+ upm = properties.header->Units_Per_EM;
+ ascent = ( properties.horizontal->Ascender * imetrics.y_ppem ) / upm;
+ descent = ( properties.horizontal->Descender * imetrics.y_ppem ) / upm;
+
+ pnm_width = 2 * border;
+ pnm_height = 2 * border + ascent - descent;
+
+ for ( i = 0; i < txtlen; ++i )
+ {
+ unsigned char j = txt[i];
+
+
+ if ( !TT_VALID( glyphs[j] ) )
+ continue;
+
+ TT_Get_Glyph_Metrics( glyphs[j], &gmetrics );
+ pnm_width += gmetrics.advance / 64;
+ }
+
+ Init_Raster_Map( &bit, pnm_width, pnm_height );
+ Clear_Raster_Map( &bit );
+
+ pnm_x_shift = border;
+ pnm_y_shift = border - descent;
+
+ /* allocate the small bitmap if you need it */
+
+ if ( smooth )
+ Init_Raster_Map( &small_bit, imetrics.x_ppem + 32, pnm_height );
+ }
+
+
+ static void Done_Raster_Areas( void )
+ {
+ Done_Raster_Map( &bit );
+ if ( smooth )
+ Done_Raster_Map( &small_bit );
+ }
+
+
+ static void Render_Glyph( TT_Glyph glyph,
+ int x_off, int y_off,
+ TT_Glyph_Metrics* gmetrics )
+ {
+ if ( !smooth )
+ TT_Get_Glyph_Bitmap( glyph, &bit, x_off * 64L, y_off * 64L);
+ else
+ {
+ TT_F26Dot6 xmin, ymin, xmax, ymax;
+
+
+ /* grid-fit the bounding box */
+
+ xmin = gmetrics->bbox.xMin & -64;
+ ymin = gmetrics->bbox.yMin & -64;
+ xmax = (gmetrics->bbox.xMax + 63) & -64;
+ ymax = (gmetrics->bbox.yMax + 63) & -64;
+
+ /* now render the glyph in the small pixmap */
+ /* and blit-or the resulting small pixmap into the biggest one */
+
+ Clear_Raster_Map( &small_bit );
+ TT_Get_Glyph_Pixmap( glyph, &small_bit, -xmin, -ymin );
+ Blit_Or( &bit, &small_bit, xmin/64 + x_off, -ymin/64 - y_off );
+ }
+ }
+
+
+ static void Render_All_Glyphs( char* txt, int txtlen )
+ {
+ int i;
+ TT_F26Dot6 x, y, adjx;
+ TT_Glyph_Metrics gmetrics;
+
+
+ x = pnm_x_shift;
+ y = pnm_y_shift;
+
+ for ( i = 0; i < txtlen; i++ )
+ {
+ unsigned char j = txt[i];
+
+ if ( !TT_VALID( glyphs[j] ) )
+ continue;
+
+ TT_Get_Glyph_Metrics( glyphs[j], &gmetrics );
+
+ adjx = x; /* ??? lsb */
+ Render_Glyph( glyphs[j], adjx, y, &gmetrics );
+
+ x += gmetrics.advance / 64;
+ }
+ }
+
+
+ static void usage( void )
+ {
+ printf( "\n" );
+ printf( "%s: simple text to image converter -- part of the FreeType project\n", PROGNAME );
+ printf( "\n" );
+ printf( "Usage: %s [options below] filename [string]\n", PROGNAME );
+ printf( "\n" );
+ printf( " -g gray-level rendering (default: off)\n" );
+ printf( " -h hinting off (default: on)\n" );
+ printf( " -r X resolution X dpi (default: 96)\n" );
+ printf( " -p X pointsize X pt (default: 12)\n" );
+ printf( " -b X border X pixels wide (default: 0)\n" );
+ printf( " -c X textcolor X in RRGGBB hexadecimal format (default: 00000 (=black))\n" );
+ printf( "\n" );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ int main( int argc, char** argv )
+ {
+ int option, txtlen;
+ long int hexvalue;
+ char *txt, *filename;
+ TT_Error error;
+
+
+ /* Parse options */
+
+ while ( 1 )
+ {
+ option = ft_getopt( argc, argv, "ghr:p:b:c:" );
+
+ if ( option == -1 )
+ break;
+
+ switch ( option )
+ {
+ case 'g':
+ smooth = 1;
+ break;
+ case 'h':
+ hinted = 0;
+ break;
+ case 'r':
+ dpi = atoi( ft_optarg );
+ break;
+ case 'p':
+ ptsize = atoi( ft_optarg );
+ break;
+ case 'b':
+ border = atoi( ft_optarg );
+ break;
+ case 'c':
+ sscanf( ft_optarg, "%lx", &hexvalue );
+ textclr[0] = hexvalue>>16 & 0xFF;
+ textclr[1] = hexvalue>> 8 & 0xFF;
+ textclr[2] = hexvalue>> 0 & 0xFF;
+ break;
+
+ default:
+ usage();
+ break;
+ }
+ }
+
+ argc -= ft_optind;
+ argv += ft_optind;
+
+ if ( argc <= 0 || argc > 2 || dpi <= 0 || ptsize <= 0 || border < 0 )
+ usage();
+
+ filename = argv[0];
+
+ if ( argc > 1 )
+ txt = argv[1];
+ else
+ txt = "The quick brown fox jumps over the lazy dog";
+
+ txtlen = strlen( txt );
+
+ /* Initialize engine and other stuff */
+
+ error = TT_Init_FreeType( &engine );
+ if ( error )
+ Panic( "Error while initializing engine, code = 0x%x.\n", error );
+
+ Init_Face( filename );
+ Load_Glyphs( txt, txtlen );
+ Init_Raster_Areas( txt, txtlen );
+
+ /* Do the real work now */
+
+ Render_All_Glyphs( txt, txtlen );
+ Dump_Raster_Map( &bit, stdout );
+
+ /* Clean up */
+
+ Done_Raster_Areas();
+ Done_Glyphs();
+ Done_Face();
+
+ /* That's all, folks! */
+
+ TT_Done_FreeType( engine );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+}
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftstrtto.c b/Build/source/libs/freetype/test/ftstrtto.c
new file mode 100644
index 00000000000..823632ddbd9
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftstrtto.c
@@ -0,0 +1,1476 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftstrtto: Making string text from individual glyph information, using */
+/* TrueType Open features. */
+/* */
+/* Keys: */
+/* */
+/* + : fast scale up */
+/* - : fast scale down */
+/* u : fine scale down */
+/* j : fine scale up */
+/* */
+/* h : toggle hinting */
+/* K : toggle kerning */
+/* B : toggle sbit */
+/* S : toggle GSUB */
+/* P : toggle GPOS */
+/* */
+/* q : */
+/* ESC : exit */
+/* */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "arabic.h"
+#include "blitter.h"
+#include "common.h"
+#include "display.h"
+
+#include "freetype.h"
+#include "ftxkern.h"
+#include "ftxopen.h"
+#include "ftxsbit.h"
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+/* we want to use FREE() to make a compilation with DEBUG_MEMORY happy */
+
+#include "ttmemory.h"
+
+#define MAXPTSIZE 500 /* dtp */
+#define Center_X ( Bit.width / 2 ) /* dtp */
+#define Center_Y ( Bit.rows / 2 ) /* dtp */
+
+#define FEATURE_init MAKE_TT_TAG( 'i', 'n', 'i', 't' )
+#define FEATURE_medi MAKE_TT_TAG( 'm', 'e', 'd', 'i' )
+#define FEATURE_fina MAKE_TT_TAG( 'f', 'i', 'n', 'a' )
+#define FEATURE_isol MAKE_TT_TAG( 'i', 's', 'o', 'l' )
+
+
+ char Header[128];
+
+ TT_Engine engine;
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+ TT_CharMap char_map;
+ TT_Kerning directory;
+
+ TTO_GSUBHeader gsub_;
+ TTO_GSUBHeader* gsub;
+ TTO_GPOSHeader gpos_;
+ TTO_GPOSHeader* gpos;
+ TTO_GDEFHeader gdef_;
+ TTO_GDEFHeader* gdef;
+
+ TT_Big_Glyph_Metrics metrics;
+ TT_Outline outline;
+ TT_Face_Properties face_properties;
+ TT_Instance_Metrics imetrics;
+
+ TT_SBit_Image* sbit;
+
+ int pt_size;
+ int ttc_index;
+ TT_Bool hinted;
+ TT_Bool gray_render;
+ TT_Bool r2l;
+ TT_Bool vertical;
+
+ TT_Bool has_kern;
+ TT_Bool use_kern;
+ TT_Bool has_gdef;
+ TT_Bool has_gsub;
+ TT_Bool use_gsub;
+ TT_Bool has_gpos;
+ TT_Bool use_gpos;
+ TT_Bool has_sbit;
+ TT_Bool use_sbit;
+ TT_Bool glyph_has_sbit;
+
+ TT_Bool default_language_system;
+
+ int Fail;
+
+ char* char_string;
+
+ TT_UShort glyph_code_array[129];
+ TT_ULong char_code[128];
+ TT_UShort properties[128];
+
+ TT_UShort* glyph_code;
+ int num_glyphs;
+
+ TT_ULong script_tag;
+ char* script_tag_string;
+ TT_UShort gsub_script_index;
+ TT_UShort gpos_script_index;
+
+ TT_ULong language_tag;
+ char* language_tag_string;
+ TT_UShort gsub_language_index;
+ TT_UShort gpos_language_index;
+ TT_UShort gsub_req_feature_index = 0xFFFF;
+ TT_UShort gpos_req_feature_index = 0xFFFF;
+
+ TT_ULong* feature_tags;
+ char** feature_tag_strings;
+ TT_UShort* gsub_feature_indices;
+ TT_UShort* gpos_feature_indices;
+ int num_features;
+
+
+ static void Select_CMap( void )
+ {
+ TT_UShort i, n;
+ TT_UShort platform, encoding;
+
+
+ n = face_properties.num_CharMaps;
+
+ /* try pid/eid (3,10) before (3,1) */
+
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ if ( platform == 3 && encoding == 10 )
+ {
+ TT_Get_CharMap( face, i, &char_map );
+ break;
+ }
+ }
+
+ if ( i == n )
+ {
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ if ( platform == 3 && encoding == 1 )
+ {
+ TT_Get_CharMap( face, i, &char_map );
+ break;
+ }
+ }
+ }
+
+ /* we try only pid/eid (0,0) if no (3,1) map is found -- many Windows
+ fonts have only rudimentary (0,0) support. */
+
+ if ( i == n )
+ {
+ for ( i = 0; i < n; i++ )
+ {
+ TT_Get_CharMap_ID( face, i, &platform, &encoding );
+ if ( platform == 0 && encoding == 0 )
+ {
+ TT_Get_CharMap( face, i, &char_map );
+ break;
+ }
+ }
+
+ if ( i == n )
+ Panic( "Sorry, but this font doesn't contain"
+ " any Unicode mapping table.\n" );
+ }
+ }
+
+
+ /* Convert a Latin 1 string to a string of glyph indexes. */
+ /* */
+ /* IMPORTANT NOTE: */
+ /* */
+ /* There is no portable way to convert from any system's char. code */
+ /* to Unicode. This function simply takes a char. string as argument */
+ /* and `interprets' each character as a Unicode char. index with no */
+ /* further check. */
+ /* */
+ /* We interpret the command line string as Unicode with the high byte */
+ /* set to zero. This is equivalent to Latin-1. */
+
+ static void Latin1Char_To_Glyph( char* source )
+ {
+ TT_UShort n;
+
+
+ glyph_code = glyph_code_array + 1; /* we want to make glyph_code[-1] */
+ glyph_code[-1] = 0; /* possible. */
+
+ for ( n = 0; n < 128 && source[n]; n++ )
+ {
+ char_code[n] = (TT_ULong)( (unsigned char)source[n] );
+ glyph_code[n] = TT_Char_Index( char_map, char_code[n] );
+ }
+
+ num_glyphs = n;
+ }
+
+
+ static void UTF8Char_To_Glyph( char* source )
+ {
+ TT_UShort in, out, in_code;
+ TT_ULong out_code;
+ TT_UShort count, limit;
+
+
+ glyph_code = glyph_code_array + 1; /* we want to make glyph_code[-1] */
+ glyph_code[-1] = 0; /* possible. */
+
+ for ( in = out = 0, count = limit = 1, in_code = out_code = 0;
+ in < 128 && source[in]; in++ )
+ {
+ in_code = (TT_UShort)( (unsigned char)source[in] );
+
+ if ( in_code >= 0xC0 )
+ {
+ limit = 1;
+ count = 1;
+
+ if ( in_code < 0xE0 ) /* U+0080 - U+07FF */
+ {
+ limit = 2;
+ out_code = in_code & 0x1F;
+ }
+ else if ( in_code < 0xF0 ) /* U+0800 - U+FFFF */
+ {
+ limit = 3;
+ out_code = in_code & 0x0F;
+ }
+ else if ( in_code < 0xF8 ) /* U+10000 - U+1FFFFF */
+ {
+ limit = 4;
+ out_code = in_code & 0x07;
+ }
+ continue;
+ }
+ else if ( in_code >= 0x80 )
+ {
+ count++;
+
+ if ( count <= limit )
+ {
+ out_code <<= 6;
+ out_code += in_code & 0x3F;
+ }
+ if ( count != limit )
+ continue;
+ }
+ else
+ out_code = in_code;
+
+ char_code[out] = out_code;
+ glyph_code[out++] = TT_Char_Index( char_map, out_code );
+ }
+
+ num_glyphs = out;
+ }
+
+
+ static TT_Error Reset_Scale( int pointSize )
+ {
+ TT_Error error;
+
+
+ error = TT_Set_Instance_CharSize( instance, pointSize * 64L );
+ if ( error )
+ {
+ RestoreScreen();
+ Panic( "Could not reset instance, code = 0x%x.\n", error );
+ }
+
+ TT_Get_Instance_Metrics( instance, &imetrics );
+
+ /* now re-allocate the small bitmap */
+ if ( gray_render )
+ {
+ Init_Small( imetrics.x_ppem, imetrics.y_ppem );
+ Clear_Small();
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error Load_TrueType_Char( TT_UShort idx,
+ TT_Bool hint )
+ {
+ int flags;
+ TT_Error error;
+
+
+ glyph_has_sbit = 0;
+
+ error = TT_Load_Glyph_Bitmap( face, instance, idx, sbit );
+ if ( error == TT_Err_Ok )
+ {
+ has_sbit = 1;
+ glyph_has_sbit = 1;
+ }
+
+ if ( glyph_has_sbit && use_sbit )
+ return TT_Err_Ok;
+
+ flags = TTLOAD_SCALE_GLYPH;
+ if ( hint )
+ flags |= TTLOAD_HINT_GLYPH;
+
+ return TT_Load_Glyph( instance, glyph, idx, flags );
+ }
+
+
+ static TT_Error Get_Kern_Values( TT_UShort idx,
+ TT_Pos* x,
+ TT_Pos* y )
+ {
+ TT_UShort i;
+ TT_Kern_Subtable table;
+ TT_Kern_0_Pair* pairs_0;
+
+ TT_UShort min, max, new_min, new_max, middle;
+ TT_Long target_idx, current_idx;
+
+
+ *x = 0;
+ *y = 0;
+
+ for ( i = 0; i < directory.nTables; i++ )
+ {
+ table = directory.tables[i];
+
+ /* handle only horizontal kerning tables */
+
+ if ( table.coverage & 0x0001 )
+ {
+ switch ( table.format )
+ {
+ case 0:
+ pairs_0 = table.t.kern0.pairs;
+ target_idx = ( glyph_code[idx - 1] << 16 ) + glyph_code[idx];
+
+ /* binary search */
+
+ new_min = 0;
+ new_max = table.t.kern0.nPairs - 1;
+
+ do
+ {
+ min = new_min;
+ max = new_max;
+ middle = max - ( ( max - min ) >> 1 );
+
+ current_idx = ( pairs_0[middle].left << 16 ) +
+ pairs_0[middle].right;
+
+ if ( target_idx == current_idx )
+ {
+ *x += pairs_0[middle].value;
+ break;
+ }
+ else if ( target_idx < current_idx )
+ {
+ if ( middle == min )
+ break;
+ new_max = middle - 1;
+ }
+ else
+ {
+ if ( middle == max )
+ break;
+ new_min = middle + 1;
+ }
+ } while ( min < max );
+
+ break;
+
+ /* we currently ignore format 2 kerning tables */
+
+ case 2:
+ break;
+ }
+ }
+ }
+
+ /* scaling */
+
+ *x = *x * imetrics.x_scale / 0x10000;
+ *y = *y * imetrics.y_scale / 0x10000;
+
+ return TT_Err_Ok;
+ }
+
+
+ /* for testing purposes, we always select the last available alternate
+ glyph, not using the `data' field. */
+
+ static TT_UShort alternate_function( TT_ULong pos,
+ TT_UShort glyphID,
+ TT_UShort num_alternates,
+ TT_UShort* alternates,
+ void* data )
+ {
+ return num_alternates - 1;
+ }
+
+
+ static TT_Error Render_All( void )
+ {
+ TT_Pos x, y, z, min_x, min_y, max_x, max_y;
+ TT_Pos kern_x, kern_y;
+ TT_Pos back_x, back_y;
+ TT_Pos* X;
+ TT_Pos* Y;
+ int i, n, back;
+ TT_UShort* gc;
+ TT_UShort glyph_property = 0;
+
+ TT_Error error;
+
+ TTO_GSUB_String in, out;
+ TTO_GPOS_Data* gd = NULL;
+ TTO_GPOS_Data* curr_gd;
+ TTO_GPOS_Data empty_gd = {0, 0, 0, 0, 0, 0};
+
+
+ /* On the first pass, we compute the compound bounding box */
+
+ x = y = 0;
+ kern_x = kern_y = 0;
+ min_x = min_y = max_x = max_y = 0;
+
+ in.length = num_glyphs;
+ in.pos = 0;
+ in.string = glyph_code;
+ in.properties = properties;
+ in.components = NULL;
+ in.ligIDs = NULL;
+
+ out.pos = 0;
+ out.allocated = 0;
+ out.string = NULL;
+ out.properties = NULL;
+ out.components = NULL;
+ out.ligIDs = NULL;
+
+ if ( has_gsub && use_gsub )
+ {
+ error = TT_GSUB_Apply_String( gsub, &in, &out );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+ else
+ out = in;
+
+ if ( has_gpos && use_gpos )
+ {
+ error = TT_GPOS_Apply_String( instance, glyph, gpos,
+ hinted ? TTLOAD_HINT_GLYPH : 0,
+ &out, &gd, 0, r2l );
+ if ( error && error != TTO_Err_Not_Covered )
+ return error;
+ }
+
+ n = out.length;
+ gc = out.string;
+
+ /* we save the glyph positions for future reference as needed
+ for mark glyphs attached to base glyphs in TTO_GPOS_Data */
+
+ X = (TT_Pos*)malloc( n * sizeof ( TT_Pos ) );
+ Y = (TT_Pos*)malloc( n * sizeof ( TT_Pos ) );
+ if ( !X || !Y )
+ Panic( "Can't allocate position arrays.\n" );
+
+ has_sbit = 0;
+ curr_gd = &empty_gd;
+
+ for ( i = 0; i < n; i++ )
+ {
+ X[i] = x;
+ Y[i] = y;
+
+ error = Load_TrueType_Char( gc[i], hinted );
+ if ( error == TT_Err_Ok )
+ {
+ if ( glyph_has_sbit && use_sbit )
+ metrics = sbit->metrics;
+ else
+ TT_Get_Glyph_Big_Metrics( glyph, &metrics );
+ if ( has_kern && use_kern )
+ Get_Kern_Values( i, &kern_x, &kern_y );
+
+ if ( gd )
+ {
+ curr_gd = &gd[i];
+
+ /* search the base glyph */
+
+ back_x = gd[i].x_pos;
+ back_y = gd[i].y_pos;
+ back = i - gd[i].back;
+
+ while ( gd[back].back )
+ {
+ back_x += gd[back].x_pos;
+ back_y += gd[back].y_pos;
+ back -= gd[back].back;
+ }
+ }
+ else
+ {
+ back_x = back_y = 0;
+ back = i;
+ }
+
+ z = X[back] + metrics.bbox.xMin + kern_x + back_x;
+ if ( min_x > z )
+ min_x = z;
+
+ z = X[back] + metrics.bbox.xMax + kern_x + back_x;
+ if ( max_x < z )
+ max_x = z;
+
+ z = Y[back] + metrics.bbox.yMin + kern_y + back_y;
+ if ( min_y > z )
+ min_y = z;
+
+ z = Y[back] + metrics.bbox.yMax + kern_y + back_y;
+ if ( max_y < z )
+ max_y = z;
+
+ if ( has_gdef )
+ {
+ error = TT_GDEF_Get_Glyph_Property( gdef, gc[i], &glyph_property );
+ if ( error )
+ return error;
+ }
+
+ /* advance only if it is not a mark glyph */
+
+ if ( !( glyph_property & TTO_MARK ) )
+ {
+ if ( vertical )
+ y += kern_y + curr_gd->y_advance +
+ ( curr_gd->new_advance ? 0 : metrics.vertAdvance );
+ else
+ x += kern_x + curr_gd->x_advance +
+ ( curr_gd->new_advance ? 0 : metrics.horiAdvance );
+ }
+ }
+ else
+ Fail++;
+ }
+
+ /* We now center the bbox inside the target bitmap */
+
+ min_x = min_x & -64;
+ min_y = min_y & -64;
+
+ max_x = ( max_x + 63 ) & -64;
+ max_y = ( max_y + 63 ) & -64;
+
+ max_x -= min_x;
+ max_y -= min_y;
+
+ min_x = ( ( Bit.width << 6 ) - max_x ) / 2;
+ min_y = ( ( Bit.rows << 6 ) - max_y ) / 2;
+
+ max_x += min_x;
+ max_y += min_y;
+
+ /* On the second pass, we render each glyph to its centered position. */
+ /* This is slow, because we reload each glyph to render it! Using a */
+ /* cache (for glyphs, metrics, properties, and kern values) could */
+ /* speed this up significantly in real applications. */
+
+ x = vertical ? min_x : ( r2l ? max_x : min_x );
+ y = vertical ? ( r2l ? min_y : max_y ) : min_y;
+
+ for ( i = 0; i < n; i++ )
+ {
+ error = Load_TrueType_Char( gc[i], hinted );
+ if ( error == TT_Err_Ok )
+ {
+ if ( glyph_has_sbit && use_sbit )
+ metrics = sbit->metrics;
+ else
+ TT_Get_Glyph_Big_Metrics( glyph, &metrics );
+ if ( has_kern && use_kern )
+ Get_Kern_Values( i, &kern_x, &kern_y );
+
+ if ( gd )
+ curr_gd = &gd[i];
+
+ if ( has_gdef )
+ (void)TT_GDEF_Get_Glyph_Property( gdef, gc[i], &glyph_property );
+
+ if ( !( glyph_property & TTO_MARK ) )
+ {
+ if ( r2l )
+ {
+ if ( vertical )
+ y += curr_gd->y_advance +
+ ( curr_gd->new_advance ? 0 : metrics.vertAdvance );
+ else
+ x -= curr_gd->x_advance +
+ ( curr_gd->new_advance ? 0 : metrics.horiAdvance );
+ }
+ else
+ {
+ if ( vertical )
+ y -= kern_y;
+ else
+ x += kern_x;
+ }
+ }
+
+ /* We must specify the upper left corner of the bitmap, but the
+ lower left corner for the outline. Another complication is that
+ Blit_Bitmap() assumes that increasing y values means moving
+ downwards.
+
+ For vertical layout, the origin of the horizontal and vertical
+ bearings of embedded bitmaps is the top, thus we shift the
+ outline glyphs down.
+
+ Now we finally round all values to integer pixels. */
+
+ if ( glyph_has_sbit && use_sbit )
+ {
+ if ( !curr_gd->back )
+ {
+ X[i] = ( ( ( x + curr_gd->x_pos +
+ vertical ? metrics.vertBearingX :
+ metrics.horiBearingX )
+ + 32 ) & -64 ) >> 6;
+ Y[i] = Bit.rows -
+ ( ( ( ( y + curr_gd->y_pos +
+ vertical ? metrics.vertBearingY :
+ metrics.horiBearingY )
+ + 32 ) & -64 ) >> 6 );
+ Blit_Bitmap( &Bit,
+ &sbit->map,
+ gray_render ? 8 : 1,
+ X[i], Y[i], gray_palette[4] );
+ }
+ else
+ {
+ /* search the base glyph */
+
+ back_x = gd[i].x_pos;
+ back_y = gd[i].y_pos;
+ back = i - gd[i].back;
+
+ while ( gd[back].back )
+ {
+ back_x += gd[back].x_pos;
+ back_y += gd[back].y_pos;
+ back -= gd[back].back;
+ }
+
+ Blit_Bitmap( &Bit,
+ &sbit->map,
+ gray_render ? 8 : 1,
+ X[back] + ( ( ( back_x + 32 ) & -64 ) >> 6 ),
+ Y[back] + ( ( ( back_y + 32 ) & -64 ) >> 6 ),
+ gray_palette[4] );
+ }
+ }
+ else
+ {
+ if ( !curr_gd->back )
+ {
+ X[i] = ( ( x + curr_gd->x_pos + 32 ) & -64 ) >> 6;
+ Y[i] = ( ( y + curr_gd->y_pos -
+ ( vertical ?
+ metrics.vertBearingY + metrics.bbox.yMax :
+ 0 )
+ + 32 ) & -64 ) >> 6;
+ Render_Single_Glyph( gray_render,
+ glyph,
+ X[i], Y[i] );
+ }
+ else
+ {
+ /* search the base glyph */
+
+ back_x = gd[i].x_pos;
+ back_y = gd[i].y_pos;
+ back = i - gd[i].back;
+
+ while ( gd[back].back )
+ {
+ back_x += gd[back].x_pos;
+ back_y += gd[back].y_pos;
+ back -= gd[back].back;
+ }
+
+ Render_Single_Glyph(
+ gray_render,
+ glyph,
+ X[back] + ( ( ( back_x + 32 ) & -64 ) >> 6 ),
+ Y[back] + ( ( ( back_y + 32 ) & -64 ) >> 6 ) );
+ }
+ }
+
+ if ( !( glyph_property & TTO_MARK ) )
+ {
+ if ( r2l )
+ {
+ if ( vertical )
+ y += kern_y;
+ else
+ x -= kern_x;
+ }
+ else
+ {
+ if ( vertical )
+ y -= curr_gd->y_advance +
+ ( curr_gd->new_advance ? 0 : metrics.vertAdvance );
+ else
+ x += curr_gd->x_advance +
+ ( curr_gd->new_advance ? 0 : metrics.horiAdvance );
+ }
+ }
+ }
+ }
+
+ if ( has_gsub && use_gsub )
+ {
+ if ( out.string ) {
+ FREE( out.string );
+ FREE( out.components );
+ FREE( out.ligIDs );
+ }
+ if ( out.properties )
+ FREE( out.properties );
+ }
+
+ if ( has_gpos && use_gpos )
+ FREE( gd );
+
+ return TT_Err_Ok;
+ }
+
+
+ static int Process_Event( TEvent* event )
+ {
+ switch ( event->what )
+ {
+ case event_Quit: /* ESC or q */
+ return 0;
+
+ case event_Keyboard:
+ if ( event->info == 'h' ) /* Toggle hinting */
+ hinted = !hinted;
+ else if ( event->info == 'K' ) /* Toggle kerning */
+ use_kern = !use_kern;
+ else if ( event->info == 'B' ) /* Toggle sbit */
+ use_sbit = !use_sbit;
+ else if ( event->info == 'S' ) /* Toggle gsub */
+ use_gsub = !use_gsub;
+ else if ( event->info == 'P' ) /* Toggle gpos */
+ use_gpos = !use_gpos;
+ break;
+
+ case event_Rotate_Glyph:
+ break;
+
+ case event_Scale_Glyph:
+ pt_size += event->info;
+ if ( pt_size < 1 ) pt_size = 1;
+ if ( pt_size > MAXPTSIZE ) pt_size = MAXPTSIZE;
+ break;
+
+ case event_Change_Glyph:
+ break;
+ }
+
+ return 1;
+ }
+
+
+ static void Usage( char* execname )
+ {
+ fprintf( stderr,
+ "\n"
+ "ftstrtto: TrueType Open String Test Display -- part of the FreeType project\n"
+ "---------------------------------------------------------------------------\n"
+ "\n"
+ "Usage: %s [options below] ptsize fontname[.ttf|.ttc] [string|-]\n"
+ "\n"
+ " -c C use font with index C in TrueType collection (default: 0)\n"
+ " -f F use feature F (can be specified more than once)\n"
+ " -g gray-level rendering\n"
+ " -l L use language L\n"
+ " -r R use resolution R dpi (default: 96)\n"
+ " -s S use script S\n"
+ " -u interpret input data as UTF8-encoded\n"
+ " -v display string vertically\n"
+ " -x display string from right to left\n"
+ "\n"
+ " F, L, and S must be specified as 4-character tags.\n"
+ " Specifying only F and S selects default language system of S.\n"
+ " Specifying only L and S selects the req. feature of L only (if any).\n"
+ "\n"
+ " If `-' is specified as input string, stdin is read instead.\n"
+ "\n", execname );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ static TT_ULong Make_Tag( char* tag_string )
+ {
+ char t1 = ' ', t2 = ' ', t3 = ' ', t4 = ' ';
+
+
+ if ( !tag_string )
+ return 0;
+
+ t1 = tag_string[0];
+ if ( tag_string[1] )
+ t2 = tag_string[1];
+ if ( tag_string[2] )
+ t3 = tag_string[2];
+ if ( tag_string[3] )
+ t4 = tag_string[3];
+
+ return MAKE_TT_TAG( t1, t2, t3, t4 );
+ }
+
+
+ int main( int argc,
+ char** argv )
+ {
+ int i, old_pt_size, orig_pt_size, file;
+
+ int graphics_initialized = 0;
+
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+
+ int option;
+ int res = 96;
+ int utf8 = 0;
+
+ TT_Error error;
+ TEvent event;
+
+
+ execname = argv[0];
+
+ while ( 1 )
+ {
+ option = ft_getopt( argc, argv, "c:f:gl:r:s:uvx" );
+
+ if ( option == -1 )
+ break;
+
+ switch ( option )
+ {
+ case 'c':
+ ttc_index = atoi( ft_optarg );
+ if ( ttc_index < 0 )
+ Usage( execname );
+ break;
+
+ case 'f':
+ num_features++;
+ feature_tag_strings = (char**)
+ realloc( feature_tag_strings,
+ num_features * sizeof ( char* ) );
+ feature_tags = (TT_ULong*)
+ realloc( feature_tags,
+ num_features * sizeof ( TT_ULong ) );
+ if ( !feature_tag_strings || !feature_tags )
+ Panic( "Can't allocate feature tag arrays.\n" );
+
+ feature_tag_strings[num_features - 1] = ft_optarg;
+ if ( !(feature_tags[num_features - 1] = Make_Tag( ft_optarg ) ) )
+ Usage( execname );
+ break;
+
+ case 'g':
+ gray_render = 1;
+ break;
+
+ case 'l':
+ language_tag_string = ft_optarg;
+ if ( !(language_tag = Make_Tag( ft_optarg ) ) )
+ Usage( execname );
+ break;
+
+ case 'r':
+ res = atoi( ft_optarg );
+ if ( res < 1 )
+ Usage( execname );
+ break;
+
+ case 's':
+ script_tag_string = ft_optarg;
+ if ( !(script_tag = Make_Tag( ft_optarg ) ) )
+ Usage( execname );
+ break;
+
+ case 'u':
+ utf8 = 1;
+ break;
+
+ case 'v':
+ vertical = 1;
+ break;
+
+ case 'x':
+ r2l = 1;
+ break;
+
+ default:
+ Usage( execname );
+ break;
+ }
+ }
+
+ argc -= ft_optind;
+ argv += ft_optind;
+
+ if ( argc <= 1 )
+ Usage( execname );
+
+ if ( sscanf( argv[0], "%d", &orig_pt_size ) != 1 )
+ orig_pt_size = 64;
+
+ file = 1;
+
+ /* Initialize engine */
+
+ error = TT_Init_FreeType( &engine );
+ if ( error )
+ Panic( "Error while initializing engine, code = 0x%x.\n", error );
+
+ error = TT_Init_Kerning_Extension( engine );
+ if ( error )
+ Panic( "Error while initializing kerning extension, code = 0x%x.\n",
+ error );
+
+ error = TT_Init_SBit_Extension( engine );
+ if ( error )
+ Panic( "Error while initializing sbit extension, code = 0x%x.\n",
+ error );
+
+ error = TT_Init_GDEF_Extension( engine );
+ if ( error )
+ Panic( "Error while initializing GDEF extension, code = 0x%x.\n",
+ error );
+
+ error = TT_Init_GSUB_Extension( engine );
+ if ( error )
+ Panic( "Error while initializing GSUB extension, code = 0x%x.\n",
+ error );
+
+ error = TT_Init_GPOS_Extension( engine );
+ if ( error )
+ Panic( "Error while initializing GPOS extension, code = 0x%x.\n",
+ error );
+
+ pt_size = orig_pt_size;
+ hinted = 1;
+ use_gsub = 1;
+ use_gpos = 1;
+ use_kern = 1;
+ use_sbit = 1;
+
+ i = strlen( argv[file] );
+ while ( i > 0 && argv[file][i] != '\\' && argv[file][i] != '/' )
+ {
+ if ( argv[file][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[file], 128 );
+ strncpy( alt_filename, argv[file], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( "Could not find/open `%s'.\n", filename );
+ else if ( error )
+ Panic( "Error while opening `%s', code = 0x%x.\n",
+ filename, error );
+
+ /* get face properties and allocate preload arrays */
+
+ TT_Get_Face_Properties( face, &face_properties );
+
+ /* open font in collection */
+
+ if ( ttc_index >= face_properties.num_Faces )
+ Panic( "There is no collection with index %d in this font file.\n",
+ ttc_index );
+
+ TT_Close_Face( face );
+
+ error = TT_Open_Collection( engine, filename, ttc_index, &face );
+ if ( error )
+ Panic( "Error while opening collection %d in `%s', code = 0x%x.\n",
+ ttc_index, filename, error );
+
+ /* create glyph object */
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ Panic( "Could not create glyph container, code = 0x%x.\n", error );
+
+ /* create sbit slot */
+
+ error = TT_New_SBit_Image( &sbit );
+ if ( error )
+ Panic( "Could not create sbit slot, code = 0x%x.\n" , error);
+
+ /* create instance */
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ Panic( "Could not create instance for `%s', code = 0x%x.\n",
+ filename, error );
+
+ error = TT_Set_Instance_Resolutions( instance, res, res );
+ if ( error )
+ Panic( "Could not set device resolutions, code = 0x%x.\n", error );
+
+ error = TT_Get_Kerning_Directory( face, &directory );
+ if ( error )
+ Panic( "Could not get kerning directory, code = 0x%x.\n", error );
+
+ /* load all kerning tables */
+
+ for ( i = 0; i < directory.nTables; i++ )
+ {
+ error = TT_Load_Kerning_Table( face, i );
+ if ( error )
+ Panic( "Could not load kerning table, code = 0x%x.\n", error );
+ }
+
+ if ( directory.nTables )
+ has_kern = 1;
+
+ Select_CMap();
+
+ /* GDEF support */
+
+ gdef = &gdef_;
+
+ error = TT_Load_GDEF_Table( face, gdef );
+ if ( !error )
+ has_gdef = 1;
+ else if ( error != TT_Err_Table_Missing )
+ Panic( "Error while loading GDEF table, code = 0x%x.\n", error );
+
+ /* we assign glyph properties in case no GDEF table is available */
+
+ if ( !has_gdef )
+ {
+ Build_Arabic_Glyph_Properties( char_map, face_properties.num_Glyphs,
+ &gdef );
+ if ( gdef )
+ has_gdef = 1;
+ }
+
+ /* GSUB and GPOS support */
+
+ gsub = &gsub_;
+ gpos = &gpos_;
+
+ error = TT_Load_GSUB_Table( face, gsub, gdef );
+ if ( !error )
+ {
+ if ( script_tag && feature_tags )
+ has_gsub = 1;
+ if ( script_tag && language_tag )
+ has_gsub = 1;
+ }
+ else if ( error != TT_Err_Table_Missing )
+ Panic( "Error while loading GSUB table, code = 0x%x.\n", error );
+
+ error = TT_Load_GPOS_Table( face, gpos, gdef );
+ if ( !error )
+ {
+ if ( script_tag && feature_tags )
+ has_gpos = 1;
+ if ( script_tag && language_tag )
+ has_gpos = 1;
+ }
+ else if ( error != TT_Err_Table_Missing )
+ Panic( "Error while loading GPOS table, code = 0x%x.\n", error );
+
+ TT_GSUB_Clear_Features( gsub );
+ TT_GPOS_Clear_Features( gpos );
+
+ if ( ( has_gsub || has_gpos ) && !language_tag )
+ default_language_system = 1;
+
+ /* we allocate one element more to always have a non-zero value
+ for malloc */
+ gsub_feature_indices = (TT_UShort*)
+ malloc( ( num_features + 1 ) *
+ sizeof ( TT_UShort ) );
+ gpos_feature_indices = (TT_UShort*)
+ malloc( ( num_features + 1 ) *
+ sizeof ( TT_UShort ) );
+ if ( !gsub_feature_indices || !gpos_feature_indices )
+ Panic( "Can't allocate feature index arrays.\n" );
+
+ if ( has_gsub )
+ {
+ error = TT_GSUB_Select_Script( gsub,
+ script_tag,
+ &gsub_script_index );
+ if ( error )
+ {
+ gsub_script_index = 0xFFFF;
+ goto try_gpos;
+ }
+
+ if ( default_language_system )
+ {
+ for ( i = 0; i < num_features; i++ )
+ {
+ error = TT_GSUB_Select_Feature( gsub,
+ feature_tags[i],
+ gsub_script_index, 0xFFFF,
+ &gsub_feature_indices[i] );
+ if ( error )
+ gsub_feature_indices[i] = 0xFFFF;
+ }
+ }
+ else
+ {
+ error = TT_GSUB_Select_Language( gsub,
+ language_tag,
+ gsub_script_index,
+ &gsub_language_index,
+ &gsub_req_feature_index );
+ if ( error )
+ {
+ gsub_language_index = 0xFFFF;
+ goto try_gpos;
+ }
+
+ for ( i = 0; i < num_features; i++ )
+ {
+ error = TT_GSUB_Select_Feature( gsub,
+ feature_tags[i],
+ gsub_script_index,
+ gsub_language_index,
+ &gsub_feature_indices[i] );
+ if ( error )
+ gsub_feature_indices[i] = 0xFFFF;
+ }
+ }
+
+ if ( gsub_req_feature_index != 0xFFFF )
+ TT_GSUB_Add_Feature( gsub, gsub_req_feature_index, ALL_GLYPHS );
+ else if ( !num_features )
+ has_gsub = 0;
+
+ for ( i = 0; i < num_features; i++ )
+ {
+ if ( gsub_feature_indices[i] != 0xFFFF )
+ {
+ if ( feature_tags[i] == FEATURE_init )
+ TT_GSUB_Add_Feature( gsub, gsub_feature_indices[i], initial );
+ else if ( feature_tags[i] == FEATURE_medi )
+ TT_GSUB_Add_Feature( gsub, gsub_feature_indices[i], medial );
+ else if ( feature_tags[i] == FEATURE_fina )
+ TT_GSUB_Add_Feature( gsub, gsub_feature_indices[i], final );
+ else if ( feature_tags[i] == FEATURE_isol )
+ TT_GSUB_Add_Feature( gsub, gsub_feature_indices[i], isolated );
+ else
+ TT_GSUB_Add_Feature( gsub, gsub_feature_indices[i], ALL_GLYPHS );
+ }
+ }
+
+ TT_GSUB_Register_Alternate_Function( gsub, alternate_function, NULL );
+ }
+
+ try_gpos:
+
+ if ( has_gpos )
+ {
+ error = TT_GPOS_Select_Script( gpos,
+ script_tag,
+ &gpos_script_index );
+ if ( error )
+ {
+ gpos_script_index = 0xFFFF;
+ goto check;
+ }
+
+ if ( default_language_system )
+ {
+ for ( i = 0; i < num_features; i++ )
+ {
+ error = TT_GPOS_Select_Feature( gpos,
+ feature_tags[i],
+ gpos_script_index, 0xFFFF,
+ &gpos_feature_indices[i] );
+ if ( error )
+ gpos_feature_indices[i] = 0xFFFF;
+ }
+ }
+ else
+ {
+ error = TT_GPOS_Select_Language( gpos,
+ language_tag,
+ gpos_script_index,
+ &gpos_language_index,
+ &gpos_req_feature_index );
+ if ( error )
+ {
+ gpos_language_index = 0xFFFF;
+ goto check;
+ }
+
+ for ( i = 0; i < num_features; i++ )
+ {
+ error = TT_GPOS_Select_Feature( gpos,
+ feature_tags[i],
+ gpos_script_index,
+ gpos_language_index,
+ &gpos_feature_indices[i] );
+ if ( error )
+ gpos_feature_indices[i] = 0xFFFF;
+ }
+ }
+
+ if ( gpos_req_feature_index != 0xFFFF )
+ TT_GPOS_Add_Feature( gpos, gpos_req_feature_index, ALL_GLYPHS );
+ else if ( !num_features )
+ has_gpos = 0;
+
+ for ( i = 0; i < num_features; i++ )
+ {
+ if ( gpos_feature_indices[i] != 0xFFFF )
+ {
+ if ( feature_tags[i] == FEATURE_init )
+ TT_GPOS_Add_Feature( gpos, gpos_feature_indices[i], initial );
+ else if ( feature_tags[i] == FEATURE_medi )
+ TT_GPOS_Add_Feature( gpos, gpos_feature_indices[i], medial );
+ else if ( feature_tags[i] == FEATURE_fina )
+ TT_GPOS_Add_Feature( gpos, gpos_feature_indices[i], final );
+ else if ( feature_tags[i] == FEATURE_isol )
+ TT_GPOS_Add_Feature( gpos, gpos_feature_indices[i], isolated );
+ else
+ TT_GPOS_Add_Feature( gpos, gpos_feature_indices[i], ALL_GLYPHS );
+ }
+ }
+ }
+
+ check:
+
+ if ( has_gsub || has_gpos )
+ {
+ if ( gsub_script_index == 0xFFFF && gpos_script_index == 0xFFFF )
+ Panic( "Requested script `%-4.4s' not found.\n",
+ script_tag_string );
+
+ if ( default_language_system )
+ {
+ for ( i = 0; i < num_features; i++ )
+ {
+ if ( gsub_feature_indices[i] == 0xFFFF &&
+ gpos_feature_indices[i] == 0xFFFF )
+ Panic( "Requested feature `%-4.4s'\n"
+ "for default language system of script `%-4.4s' not found.\n",
+ feature_tag_strings[i], script_tag_string );
+ }
+ }
+ else
+ {
+ if ( gsub_language_index == 0xFFFF && gpos_language_index == 0xFFFF )
+ Panic( "Requested language `%-4.4s'\n"
+ "for script `%-4.4s' not found.\n",
+ language_tag_string, script_tag_string );
+
+ for ( i = 0; i < num_features; i++ )
+ {
+ if ( gsub_feature_indices[i] == 0xFFFF &&
+ gpos_feature_indices[i] == 0xFFFF )
+ Panic( "Requested feature `%-4.4s'\n"
+ "for script `%-4.4s', language `%-4.4s' not found.\n",
+ feature_tag_strings[i], script_tag_string,
+ language_tag_string );
+ }
+ }
+ }
+
+ if ( !graphics_initialized )
+ {
+ graphics_initialized = 1;
+
+ if ( gray_render )
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Gray ) )
+ Panic( "Could not set up grayscale graphics mode.\n" );
+
+ TT_Set_Raster_Gray_Palette( engine, virtual_palette );
+ }
+ else
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Mono ) )
+ Panic( "Could not set up mono graphics mode.\n" );
+ }
+ }
+
+ Init_Display( gray_render );
+
+ Reset_Scale( pt_size );
+
+ old_pt_size = pt_size;
+
+ Fail = 0;
+
+ /* get string to display, if any */
+
+ if ( argv[2] )
+ {
+ if ( argv[2][0] == '-' )
+ {
+ int ch;
+ char* p;
+
+
+ char_string = (char*)malloc( 128 * sizeof ( char ) );
+ if ( !char_string || !gpos_feature_indices )
+ Panic( "Can't allocate character string.\n" );
+ p = char_string;
+
+ for ( i = 0; i < 128; i++ )
+ {
+ ch = getchar();
+ if ( ch == '\n' || ch == EOF )
+ {
+ *p = '\0';
+ break;
+ }
+
+ *p++ = (char)ch;
+ }
+
+ *p = '\0';
+ }
+ else
+ char_string = argv[2];
+ }
+ else
+ char_string = "The quick brown fox jumps over the lazy dog";
+
+ if ( utf8 )
+ UTF8Char_To_Glyph( char_string );
+ else
+ Latin1Char_To_Glyph( char_string );
+
+ /* we assign Arabic script features (e.g. `initial' or `final') */
+
+ Assign_Arabic_Properties( char_code, properties, num_glyphs );
+
+ /* the main loop */
+
+ for ( ;; )
+ {
+ int key;
+
+
+ Clear_Display();
+
+ error = Render_All();
+ if ( error )
+ Panic( "Error while rendering string, code = 0x%x.\n", error );
+
+ if ( gray_render )
+ Convert_To_Display_Palette();
+
+ sprintf( Header,
+ "%s: %ddpi, %dpt, %dppem hinting: %s%s%s%s%s%s%s%s%s",
+ ft_basename( filename ),
+ res,
+ pt_size,
+ imetrics.x_ppem,
+ hinted ? "on" : "off",
+ has_kern ? " kerning: " : "",
+ has_kern ? ( use_kern ? "on" : "off" ) : "",
+ has_sbit ? " sbit: " : "",
+ has_sbit ? ( use_sbit ? "on" : "off" ) : "",
+ has_gsub ? " GSUB: " : "",
+ has_gsub ? ( use_gsub ? "on" : "off" ) : "",
+ has_gpos ? " GPOS: " : "",
+ has_gpos ? ( use_gpos ? "on" : "off" ) : "" );
+
+ Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols );
+
+#ifndef X11
+#ifndef OS2
+ Print_XY( 0, 0, Header );
+#endif
+#endif
+
+ Get_Event( &event );
+ if ( !( key = Process_Event( &event ) ) )
+ goto Fin;
+
+ if ( pt_size != old_pt_size )
+ {
+ if ( Reset_Scale( pt_size ) )
+ Panic( "Could not resize font.\n" );
+
+ old_pt_size = pt_size;
+ }
+ }
+
+ Fin:
+ RestoreScreen();
+
+ TT_Done_SBit_Image( sbit );
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ printf( "Execution completed successfully.\n" );
+ printf( "Fails = %d.\n", Fail );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+}
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/fttimer.c b/Build/source/libs/freetype/test/fttimer.c
new file mode 100644
index 00000000000..c1e3b9156b5
--- /dev/null
+++ b/Build/source/libs/freetype/test/fttimer.c
@@ -0,0 +1,455 @@
+/****************************************************************************/
+/* */
+/* The FreeType project - a Free and Portable Quality TrueType Renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* fttimer: A simple performance benchmark. Now with graylevel rendering */
+/* with the '-g' option. */
+/* */
+/* Be aware that the timer program benchmarks different things */
+/* in each release of the FreeType library. Thus, performance */
+/* should only be compared between similar release numbers. */
+/* */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. In no way does it shows the final */
+/* high-level interface that client applications will use. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+#ifndef __USE_MISC
+#define __USE_MISC /* MkLinux needs this to get a definition of
+ CLOCKS_PER_SEC */
+#endif
+
+#include <time.h> /* for clock() */
+
+/* SunOS 4.1.* does not define CLOCKS_PER_SEC, so include <sys/param.h> */
+/* to get the HZ macro which is the equivalent. */
+#if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)
+#include <sys/param.h>
+#define CLOCKS_PER_SEC HZ
+#endif
+
+#define MAX_GLYPHS 512 /* Maximum number of glyphs rendered at one time */
+
+ char Header[128];
+
+ TT_Error error;
+
+ TT_Engine engine;
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+
+ TT_Outline outline;
+ TT_Glyph_Metrics metrics;
+
+ TT_Face_Properties properties;
+
+ TT_F26Dot6* cur_x;
+ TT_F26Dot6* cur_y;
+
+ unsigned short* cur_endContour;
+ unsigned char* cur_touch;
+
+ TT_Outline outlines[MAX_GLYPHS];
+
+ int num_glyphs;
+ int tab_glyphs;
+ int cur_glyph;
+ int cur_point;
+ unsigned short cur_contour;
+
+ extern TT_Raster_Map Bit;
+
+ int Fail;
+ int Num;
+
+ short visual; /* display glyphs while rendering */
+ short gray_render; /* smooth fonts with gray levels */
+
+
+ static void Clear_Buffer( void );
+
+
+/*******************************************************************/
+/* */
+/* Get_Time: */
+/* */
+/* Returns the current time in milliseconds. */
+/* */
+/*******************************************************************/
+
+ long Get_Time( void )
+ {
+ return clock() * 1000 / CLOCKS_PER_SEC;
+ }
+
+
+/*******************************************************************/
+/* */
+/* Init_Engine: */
+/* */
+/* Allocates bitmap, render pool and other structs... */
+/* */
+/*******************************************************************/
+
+ void Init_Engine( void )
+ {
+ Bit.rows = vio_Height; /* The whole window */
+ Bit.width = vio_Width;
+
+ if ( gray_render )
+ {
+ Bit.cols = Bit.width;
+ Bit.flow = TT_Flow_Up;
+ Bit.size = Bit.rows * Bit.width;
+ }
+ else
+ {
+ Bit.cols = (Bit.width + 7) / 8; /* convert to # of bytes */
+ Bit.flow = TT_Flow_Up;
+ Bit.size = Bit.rows * Bit.cols; /* number of bytes in buffer */
+ }
+
+ Bit.bitmap = (void*)malloc( Bit.size );
+ if ( !Bit.bitmap )
+ Panic( "ERROR: not enough memory to allocate bitmap!\n" );
+
+ Clear_Buffer();
+ }
+
+
+/*******************************************************************/
+/* */
+/* Clear_Buffer: */
+/* */
+/* Clears current bitmap. */
+/* */
+/*******************************************************************/
+
+ static void Clear_Buffer( void )
+ {
+ if ( gray_render )
+ memset( Bit.bitmap, gray_palette[0], Bit.size );
+ else
+ memset( Bit.bitmap, 0, Bit.size );
+ }
+
+
+/*******************************************************************/
+/* */
+/* LoadTrueTypeChar: */
+/* */
+/* Loads a glyph into memory. */
+/* */
+/*******************************************************************/
+
+ TT_Error LoadTrueTypeChar( int idx )
+ {
+ error = TT_Load_Glyph( instance, glyph, idx, TTLOAD_DEFAULT );
+ if ( error )
+ return error;
+
+ TT_Get_Glyph_Outline( glyph, &outline );
+
+ outline.second_pass = 0;
+ outline.high_precision = 0;
+ outline.dropout_mode = 0;
+
+ /* debugging */
+#if 0
+ if ( idx == 0 && !visual )
+ {
+ printf( "points = %d\n", outline.points );
+ for ( j = 0; j < outline.points; j++ )
+ printf( "%02x (%01hx,%01hx)\n",
+ j, outline.xCoord[j], outline.yCoord[j] );
+ printf( "\n" );
+ }
+#endif
+
+ /* create a new outline */
+ TT_New_Outline( outline.n_points,
+ outline.n_contours,
+ &outlines[cur_glyph] );
+
+ /* copy the glyph outline into it */
+ outline.high_precision = 0;
+ outline.second_pass = 0;
+ TT_Copy_Outline( &outline, &outlines[cur_glyph] );
+
+ /* translate it */
+ TT_Translate_Outline( &outlines[cur_glyph],
+ vio_Width * 16,
+ vio_Height * 16 );
+ cur_glyph++;
+
+ return TT_Err_Ok;
+ }
+
+
+/*******************************************************************/
+/* */
+/* ConvertRaster: */
+/* */
+/* Performs scan conversion. */
+/* */
+/*******************************************************************/
+
+ TT_Error ConvertRaster( int index )
+ {
+ outlines[index].second_pass = 0;
+ outlines[index].high_precision = 0;
+
+ if ( gray_render )
+ return TT_Get_Outline_Pixmap( engine, &outlines[index], &Bit );
+ else
+ return TT_Get_Outline_Bitmap( engine, &outlines[index], &Bit );
+ }
+
+
+ int main( int argc, char** argv )
+ {
+ int i, total, mode, base, rendered_glyphs;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+
+ long t, t0, tz0;
+
+
+ execname = argv[0];
+
+ gray_render = 0;
+ visual = 0;
+
+ while ( argc > 1 && argv[1][0] == '-' )
+ {
+ switch ( argv[1][1] )
+ {
+ case 'g':
+ gray_render = 1;
+ break;
+
+ case 'v':
+ visual = 1;
+ break;
+
+ default:
+ Panic( "Unknown argument '%s'!\n", argv[1] );
+ }
+ argc--;
+ argv++;
+ }
+
+ if ( argc != 2 )
+ {
+ fprintf( stderr, "fttimer: simple performance timer -- part of the FreeType project\n" );
+ fprintf( stderr,"-----------------------------------------------------------------\n\n" );
+ fprintf( stderr,"Usage: %s [-g] [-v] fontname[.ttf|.ttc]\n\n", execname );
+ fprintf( stderr," where '-g' asks for gray-levels rendering\n" );
+ fprintf( stderr," '-v' displays while rendering (slower)\n" );
+
+ exit( EXIT_FAILURE );
+ }
+
+ i = strlen( argv[1] );
+ while ( i > 0 && argv[1][i] != '\\' )
+ {
+ if ( argv[1][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[1], 128 );
+ strncpy( alt_filename, argv[1], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Initialize engine */
+
+ if ( (error = TT_Init_FreeType( &engine )) )
+ Panic( "Error while initializing engine, code = 0x%x.\n", error );
+
+ /* Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( "Could not find/open %s.\n", filename );
+ else if ( error )
+ Panic( "Error while opening %s, error code = 0x%x.\n",
+ filename, error );
+
+ /* get face properties and allocate preload arrays */
+
+ TT_Get_Face_Properties( face, &properties );
+
+ num_glyphs = properties.num_Glyphs;
+
+ tab_glyphs = MAX_GLYPHS;
+ if ( tab_glyphs > num_glyphs )
+ tab_glyphs = num_glyphs;
+
+ /* create glyph */
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ Panic( "Could not create glyph container.\n" );
+
+ /* create instance */
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ Panic( "Could not create instance for %s.\n", filename );
+
+ error = TT_Set_Instance_CharSize( instance, 400*64 );
+ if ( error )
+ Panic( "Could not reset instance for %s.\n", filename );
+
+ if ( gray_render )
+ mode = Graphics_Mode_Gray;
+ else
+ mode = Graphics_Mode_Mono;
+
+ if ( visual )
+ {
+ if ( !SetGraphScreen( mode ) )
+ Panic( "Could not set graphics mode.\n" );
+ TT_Set_Raster_Gray_Palette( engine, gray_palette );
+ }
+ else
+ {
+ /* This is the default bitmap size used */
+ vio_Width = 640;
+ vio_Height = 450;
+ }
+
+ Init_Engine();
+
+ Num = 0;
+ Fail = 0;
+
+ total = num_glyphs;
+ base = 0;
+
+ rendered_glyphs = 0;
+
+ t0 = 0; /* Initial time */
+
+ tz0 = Get_Time();
+
+ while ( total > 0 )
+ {
+ /* First, preload 'tab_glyphs' in memory */
+
+ cur_glyph = 0;
+ cur_point = 0;
+ cur_contour = 0;
+
+ printf( "loading %d glyphs", tab_glyphs );
+
+ for ( Num = 0; Num < tab_glyphs; Num++ )
+ {
+ error = LoadTrueTypeChar( base + Num );
+ if ( error )
+ Fail++;
+
+ total--;
+ }
+
+ base += tab_glyphs;
+
+ if ( tab_glyphs > total )
+ tab_glyphs = total;
+
+ printf( ", rendering... " );
+
+ /* Now, render the loaded glyphs */
+
+ t = Get_Time();
+
+ for ( Num = 0; Num < cur_glyph; Num++ )
+ {
+ if ( (error = ConvertRaster( Num )) )
+ Fail++;
+ else
+ {
+ rendered_glyphs ++;
+
+ if ( visual )
+ {
+ sprintf( Header, "Glyph: %5d", Num );
+ Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols );
+
+ Clear_Buffer();
+ }
+ }
+ }
+
+ t = Get_Time() - t;
+ if ( t < 0 )
+ t += 100L * 60 * 60;
+
+ printf( " = %f s\n", (double)t / 1000 );
+ t0 += t;
+
+ /* Now free all loaded outlines */
+ for ( Num = 0; Num < cur_glyph; Num++ )
+ TT_Done_Outline( &outlines[Num] );
+ }
+
+ tz0 = Get_Time() - tz0;
+
+ if ( visual )
+ RestoreScreen();
+
+ TT_Close_Face( face );
+
+ printf( "\n" );
+ printf( "rendered glyphs = %d\n", rendered_glyphs );
+ printf( "render time = %f s\n", (double)t0 / 1000 );
+ printf( "fails = %d\n", Fail );
+ printf( "average glyphs/s = %f\n",
+ (double)rendered_glyphs / t0 * 1000 );
+
+ printf( "total timing = %f s\n", (double)tz0 / 1000 );
+ printf( "Fails = %d\n", Fail );
+
+ TT_Done_FreeType( engine );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftview.c b/Build/source/libs/freetype/test/ftview.c
new file mode 100644
index 00000000000..71ca0d87a28
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftview.c
@@ -0,0 +1,539 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftview: A simple font viewer. Supports hinting and grayscaling. */
+/* */
+/* */
+/* Keys: */
+/* */
+/* x : fine counter-clockwise rotation */
+/* c : fine clockwise rotation */
+/* */
+/* v : fast counter-clockwise rotation */
+/* b : fast clockwise rotation */
+/* */
+/* + : fast scale up */
+/* - : fast scale down */
+/* u : fine scale down */
+/* j : fine scale up */
+/* */
+/* l : go to next glyph */
+/* k : go to previous glyph */
+/* */
+/* o : go to tenth next glyph */
+/* i : go to tenth previous glyph */
+/* */
+/* 0 : go to hundredth next glyph */
+/* 9 : go to hundredth previous glyph */
+/* */
+/* ) : go to 1000th next glyph */
+/* ( : go to 1000th previous glyph */
+/* */
+/* } : go to 10000th next glyph */
+/* { : go to 10000th previous glyph */
+/* */
+/* n : go to next (or last) .ttf file */
+/* p : go to previous (or first) .ttf file */
+/* */
+/* h : toggle hinting */
+/* */
+/* B : toggle sbit */
+/* */
+/* ESC : exit */
+/* */
+/* */
+/* NOTE: This is just a test program that is used to show off and */
+/* debug the current engine. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "blitter.h"
+#include "common.h"
+#include "display.h"
+#include "freetype.h"
+#include "ftxsbit.h"
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+#define Pi 3.1415926535
+
+#define MAXPTSIZE 500 /* dtp */
+#define Center_X ( Bit.width / 2 ) /* dtp */
+#define Center_Y ( Bit.rows / 2 ) /* dtp */
+
+/*
+ * If Ignore_Err_Not_SBit is not defined,
+ * "Fail" increase when the glyph does not have sbit and
+ * sbit_flag is 1.
+ */
+#define Ignore_Err_Not_SBit 1
+
+ TT_Engine engine;
+
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+
+ TT_Big_Glyph_Metrics metrics;
+ TT_Outline outline;
+ TT_Face_Properties properties;
+ TT_Instance_Metrics imetrics;
+
+ TT_SBit_Image* sbit;
+
+ int num_glyphs;
+
+ int ptsize;
+ int hinted;
+
+ char Header[128];
+
+ int Rotation;
+ int Fail;
+ int Num;
+
+ int gray_render;
+ unsigned int sbit_flag; /* 0 if to display outlines
+ * 1 if to use embedded bitmaps
+ * 2 if to show sbit and outline glyphs
+ */
+
+ int glyph_has_sbit;
+
+
+
+ static TT_Error Reset_Scale( int pointSize )
+ {
+ TT_Error error;
+ TT_SBit_Strike strike;
+
+
+ if ( (error = TT_Set_Instance_PointSize( instance, pointSize )) )
+ {
+ RestoreScreen();
+ fprintf( stderr, "Error = 0x%x.\n", (unsigned)error );
+ Panic( "Could not reset instance.\n" );
+ }
+ TT_Get_Instance_Metrics( instance, &imetrics );
+
+ /* now re-allocates the small bitmap */
+ if ( gray_render )
+ {
+ Init_Small( imetrics.x_ppem, imetrics.y_ppem );
+ Clear_Small();
+ }
+
+ if ( TT_Get_SBit_Strike( face, instance, &strike ) )
+ glyph_has_sbit = 0;
+ else
+ glyph_has_sbit = 1;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error LoadTrueTypeChar( int idx, int hint )
+ {
+ int flags;
+
+
+ flags = TTLOAD_SCALE_GLYPH;
+ if ( hint )
+ flags |= TTLOAD_HINT_GLYPH;
+
+ return TT_Load_Glyph( instance, glyph, idx, flags );
+ }
+
+
+ static TT_Error Render_All( int first_glyph, int ptsize )
+ {
+ TT_F26Dot6 start_x, start_y, step_y, x, y;
+ int i;
+
+ TT_Error error = 0;
+
+
+ start_x = 4;
+ start_y = vio_Height - ( ( ptsize * 96 + 36 ) / 72 + 10 );
+
+ step_y = imetrics.y_ppem + 10;
+
+ x = start_x;
+ y = start_y;
+
+ i = first_glyph;
+
+ while ( i < num_glyphs )
+ {
+ if ( ( glyph_has_sbit ) &&
+ ( ( sbit_flag + 1 ) & 2 ) &&
+ !(error = TT_Load_Glyph_Bitmap( face, instance, i, sbit )) )
+ {
+ Blit_Bitmap( &Bit,
+ &sbit->map,
+ gray_render ? 8 : 1,
+ (int)x + (int)(sbit->metrics.horiBearingX/64),
+ Bit.rows - (int)y - (int)(sbit->metrics.horiBearingY/64),
+ gray_palette[4] );
+ metrics = sbit->metrics;
+ goto Step;
+ }
+
+ if ( ( ( !glyph_has_sbit ) ||
+ ( ( sbit_flag + 1 ) & 1 ) ) &&
+ !(error = LoadTrueTypeChar( i, hinted )) )
+ {
+ TT_Get_Glyph_Outline( glyph, &outline );
+ TT_Get_Glyph_Big_Metrics( glyph, &metrics );
+
+ Render_Single_Glyph( gray_render, glyph, (int)x, (int)y );
+ }
+ else
+ {
+#ifdef Ignore_Err_Not_SBit
+ if (!(( glyph_has_sbit ) &&
+ ( sbit_flag == 1 ) &&
+ ( error == TT_Err_Invalid_Glyph_Index )))
+#endif
+ Fail++;
+ }
+ Step:
+ x += ( metrics.horiAdvance / 64 ) + 1;
+
+ if ( x + imetrics.x_ppem > vio_Width )
+ {
+ x = start_x;
+ y -= step_y;
+
+ if ( y < 10 )
+ return TT_Err_Ok;
+ }
+ i++;
+ }
+ return TT_Err_Ok;
+ }
+
+
+ static int Process_Event( TEvent* event )
+ {
+ switch ( event->what )
+ {
+ case event_Quit: /* ESC or q */
+ return 0;
+
+ case event_Keyboard:
+ if ( event->info == 'n' ) /* Next file */
+ return 'n';
+ if ( event->info == 'p' ) /* Previous file */
+ return 'p';
+ if ( event->info == 'h' ) /* Toggle hinting */
+ hinted = !hinted;
+ if ( ( event->info == 'B' ) && ( glyph_has_sbit ) ) /* Toggle sbit */
+ sbit_flag = ( sbit_flag + 1 ) % 3;
+ break;
+
+ case event_Rotate_Glyph:
+ Rotation = ( Rotation + event->info ) & 1023;
+ break;
+
+ case event_Scale_Glyph:
+ ptsize += event->info;
+ if ( ptsize < 1 ) ptsize = 1;
+ if ( ptsize > MAXPTSIZE ) ptsize = MAXPTSIZE;
+ break;
+
+ case event_Change_Glyph:
+ Num += event->info;
+ if ( Num < 0 ) Num = 0;
+ if ( Num >= num_glyphs ) Num = num_glyphs - 1;
+ break;
+ }
+
+ return 1;
+ }
+
+
+ static void usage( char* execname )
+ {
+ fprintf( stderr,
+ "\n"
+ "ftview: simple TrueType interpreter tester -- part of the FreeType project\n"
+ "--------------------------------------------------------------------------\n"
+ "\n"
+ "Usage: %s [options below] ppem fontname[.ttf|.ttc] ...\n",
+ execname );
+ fprintf( stderr,
+ "\n"
+ " -g gray-level rendering (default: none)\n"
+ " -r R use resolution R dpi (default: 96)\n"
+ " -B use embedded bitmaps (default: none)\n"
+ "\n" );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ int main( int argc, char** argv )
+ {
+ int i, old_ptsize, orig_ptsize, file;
+ int XisSetup = 0;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ int option;
+ int res = 96;
+
+ TT_Error error;
+ TEvent event;
+
+ TT_EBLC eblc_table;
+
+
+ execname = ft_basename( argv[0] );
+
+ while ( 1 )
+ {
+ option = ft_getopt( argc, argv, "gr:B" );
+
+ if ( option == -1 )
+ break;
+
+ switch ( option )
+ {
+ case 'g':
+ gray_render = 1;
+ sbit_flag = 0;
+ break;
+
+ case 'r':
+ res = atoi( ft_optarg );
+ if ( res < 1 )
+ usage( execname );
+ break;
+
+ case 'B':
+ if (!gray_render)
+#if 0
+ sbit_flag = 1;
+#else
+ sbit_flag = 2;
+#endif
+ break;
+
+ default:
+ usage( execname );
+ break;
+ }
+ }
+
+ argc -= ft_optind;
+ argv += ft_optind;
+
+ if ( argc <= 1 )
+ usage( execname );
+
+ if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 )
+ orig_ptsize = 64;
+
+ file = 1;
+
+ /* Initialize engine */
+
+ if ( (error = TT_Init_FreeType( &engine )) )
+ Panic( "Error while initializing engine, code = 0x%x.\n", error );
+
+ if ( (error = TT_Init_SBit_Extension( engine )) )
+ Panic( "Error while initializing sbit extention, code = 0x%x.\n", error );
+
+ NewFile:
+ ptsize = orig_ptsize;
+ hinted = 1;
+
+ i = strlen( argv[file] );
+ while ( i > 0 && argv[file][i] != '\\' && argv[file][i] != '/' )
+ {
+ if ( argv[file][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[file], 128 );
+ strncpy( alt_filename, argv[file], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ /* Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( "Could not find/open %s.\n", filename );
+ else if ( error )
+ Panic( "Error while opening %s, error code = 0x%x.\n",
+ filename, error );
+
+ /* get face properties and allocate preload arrays */
+
+ TT_Get_Face_Properties( face, &properties );
+
+ num_glyphs = properties.num_Glyphs;
+
+ glyph_has_sbit = 0;
+
+ error = TT_Get_Face_Bitmaps( face, &eblc_table );
+ if ( error == TT_Err_Ok )
+ glyph_has_sbit = 1;
+ if ( sbit_flag && !glyph_has_sbit )
+ Panic( "%s does not have embedded bitmap glyphs.\n", filename );
+
+ /* create glyph */
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ Panic( "Could not create glyph container.\n" );
+
+ error = TT_New_SBit_Image( &sbit );
+ if ( error )
+ Panic( "Could not create sbit slot.\n" );
+
+ /* create instance */
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ Panic( "Could not create instance for %s.\n", filename );
+
+ error = TT_Set_Instance_Resolutions( instance, res, res );
+ if ( error )
+ Panic( "Could not set device resolutions." );
+
+ if ( !XisSetup )
+ {
+ XisSetup = 1;
+
+ if ( gray_render )
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Gray ) )
+ Panic( "Could not set up grayscale graphics mode.\n" );
+
+ TT_Set_Raster_Gray_Palette( engine, virtual_palette );
+ }
+ else
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Mono ) )
+ Panic( "Could not set up mono graphics mode.\n" );
+ }
+ }
+
+ Init_Display( gray_render );
+
+ Reset_Scale( ptsize );
+
+ old_ptsize = ptsize;
+
+ Fail = 0;
+ Num = 0;
+
+ for ( ;; )
+ {
+ int key;
+ char* sbit_string;
+ static char* sbit_messages[4] =
+ { "off", "on", " if available", "NONE" };
+
+ sbit_string = sbit_messages[3];
+ if ( glyph_has_sbit )
+ {
+ if (sbit_flag >= 0 && sbit_flag < 3)
+ sbit_string = sbit_messages[sbit_flag];
+ }
+
+ Clear_Display();
+ Render_All( Num, ptsize );
+ if ( gray_render )
+ Convert_To_Display_Palette();
+
+ sprintf( Header, "%s: Glyph: %4d ptsize: %4d hinting: %s sbit: %s",
+ ft_basename( filename ), Num, ptsize,
+ hinted ? "on" : "off",
+ sbit_string );
+ Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols );
+
+#ifndef X11
+#ifndef OS2
+ Print_XY( 0, 0, Header );
+#endif
+#endif
+
+ Get_Event( &event );
+ if ( !( key = Process_Event( &event ) ) )
+ goto End;
+
+ if ( key == 'n' )
+ {
+ TT_Close_Face( face );
+
+ if ( file < argc - 1 )
+ file++;
+
+ goto NewFile;
+ }
+
+ if ( key == 'p' )
+ {
+ TT_Close_Face( face );
+
+ if ( file > 1 )
+ file--;
+
+ goto NewFile;
+ }
+
+ if ( ptsize != old_ptsize )
+ {
+ if ( Reset_Scale( ptsize ) )
+ Panic( "Could not resize font.\n" );
+
+ old_ptsize = ptsize;
+ }
+ }
+
+ End:
+ RestoreScreen();
+
+ TT_Done_SBit_Image( sbit );
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ printf( "Execution completed successfully.\n" );
+ printf( "Fails = %d\n", Fail );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+}
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/ftzoom.c b/Build/source/libs/freetype/test/ftzoom.c
new file mode 100644
index 00000000000..228f8895610
--- /dev/null
+++ b/Build/source/libs/freetype/test/ftzoom.c
@@ -0,0 +1,682 @@
+/****************************************************************************/
+/* */
+/* The FreeType project - a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* ftzoom : A simple glyph viewer. Now supports graylevel rendering */
+/* with the '-g' option. */
+/* */
+/* Use `-p <platformID>' together with `-e <encodingID>' to */
+/* select a cmap. */
+/* */
+/* Keys: */
+/* */
+/* x : fine counter_clockwise rotation */
+/* c : fine clockwise rotation */
+/* */
+/* v : fast counter_clockwise rotation */
+/* b : fast clockwise rotation */
+/* */
+/* + : fast scale up */
+/* - : fast scale down */
+/* u : fine scale down */
+/* j : fine scale up */
+/* */
+/* l : go to next glyph */
+/* k : go to previous glyph */
+/* */
+/* o : go to tenth next glyph */
+/* i : go to tenth previous glyph */
+/* */
+/* 0 : go to hundredth next glyph */
+/* 9 : go to hundredth previous glyph */
+/* */
+/* ) : go to 1000th next glyph */
+/* ( : go to 1000th previous glyph */
+/* */
+/* } : go to 10000th next glyph */
+/* { : go to 10000th previous glyph */
+/* */
+/* q : */
+/* ESC : exit */
+/* */
+/* */
+/* NOTE 1: This is just a test program that is used to show off and */
+/* debug the current engine. In no way does it show the final */
+/* high-level interface that client applications will use. */
+/* */
+/* NOTE 2: The `post' engine is used to display the PS glyph names. */
+/* Use the `-n' switch if you don't want that. */
+/* */
+/****************************************************************************/
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common.h"
+#include "freetype.h"
+#include "ftxpost.h"
+
+#include "gdriver.h"
+#include "gevents.h"
+#include "gmain.h"
+
+#ifdef DEBUG_LEVEL_TRACE
+#include "ttdebug.h"
+#endif
+
+
+#define Pi 3.1415926535
+
+#define MAXPTSIZE 5000 /* dtp */
+
+ char Header[128];
+
+ TT_Engine engine;
+ TT_Face face;
+ TT_Instance instance;
+ TT_Glyph glyph;
+ TT_CharMap char_map;
+
+ TT_Glyph_Metrics metrics;
+ TT_Outline outline;
+ TT_Face_Properties properties;
+ TT_Instance_Metrics imetrics;
+
+ int num_glyphs;
+ int xcenter_upem;
+ int ycenter_upem;
+ int units_per_em;
+
+ int ptsize;
+ int old_ptsize;
+ int rotation;
+ int old_rotation;
+
+ TT_Matrix matrix;
+ TT_Matrix zoom_matrix;
+ int apply_matrix;
+ int xcenter;
+ int ycenter;
+ int xoffset;
+ int yoffset;
+
+ extern TT_Raster_Map Bit;
+
+ int Fail;
+ int Num;
+ int Code;
+
+ int gray_render = 0;
+ int hinted = 1;
+ int use_cmap = 0;
+ int zoom_factor = 1;
+ int grid = 0;
+ int use_post = 1;
+
+ char palette[5] = { 0, 1, 2, 3, 4 };
+
+
+ static void ClearData( void )
+ {
+ if ( gray_render )
+ memset( Bit.bitmap, gray_palette[0], Bit.size );
+ else
+ memset( Bit.bitmap, 0, Bit.size );
+ }
+
+
+ void Init_Raster_Area( void )
+ {
+ Bit.rows = vio_Height; /* The whole window */
+ Bit.width = vio_Width;
+ Bit.flow = TT_Flow_Up;
+
+ if ( gray_render )
+ {
+ Bit.cols = Bit.width;
+ Bit.size = Bit.rows * Bit.width;
+ }
+ else
+ {
+ Bit.cols = ( Bit.width + 7 ) / 8; /* convert to # of bytes */
+ Bit.size = Bit.rows * Bit.cols; /* number of bytes in buffer */
+ }
+
+ Bit.bitmap = (void*)malloc( (int)Bit.size );
+ if ( !Bit.bitmap )
+ Panic( "Not enough memory to allocate bitmap!\n" );
+
+ ClearData();
+ }
+
+
+ static TT_Error Reset_PtSize( int pointSize )
+ {
+ TT_Error error;
+
+
+ if ( (error = TT_Set_Instance_PointSize( instance, pointSize )) )
+ {
+ RestoreScreen();
+ printf( "Error = 0x%x.\n", (int)error );
+ Panic( "Could not reset instance.\n" );
+ }
+
+ TT_Get_Instance_Metrics( instance, &imetrics );
+
+ xcenter = imetrics.x_ppem * xcenter_upem / units_per_em / 4;
+ ycenter = imetrics.y_ppem * ycenter_upem / units_per_em / 4;
+
+ xoffset = vio_Width/2 - xcenter;
+ yoffset = vio_Height/2 - ycenter;
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error Reset_Rotation( int rotation )
+ {
+ if ( rotation )
+ {
+ float angle;
+
+
+ TT_Set_Instance_Transform_Flags( instance, 1, 0 );
+
+ angle = rotation * Pi / 512;
+
+ matrix.xx = (TT_Fixed)(cos( angle ) * (1L<<16));
+ matrix.xy = (TT_Fixed)(sin( angle ) * (1L<<16));
+ matrix.yx = -matrix.xy;
+ matrix.yy = matrix.xx;
+
+ apply_matrix = 1;
+ }
+ else
+ apply_matrix = 0;
+
+ if ( zoom_factor != 1 )
+ {
+ zoom_matrix.xx = zoom_matrix.yy = zoom_factor * (1L<<16);
+ zoom_matrix.xy = zoom_matrix.yx = 0;
+ }
+
+ return TT_Err_Ok;
+ }
+
+
+ static TT_Error LoadTrueTypeChar( int idx, int hint )
+ {
+ TT_Error error;
+ int flags;
+
+
+ flags = TTLOAD_SCALE_GLYPH;
+ if ( hint )
+ flags |= TTLOAD_HINT_GLYPH;
+
+ error = TT_Load_Glyph( instance, glyph, idx, flags );
+ if ( error )
+ return error;
+
+ if ( apply_matrix || zoom_factor != 1 )
+ {
+ TT_Get_Glyph_Outline( glyph, &outline );
+ TT_Translate_Outline( &outline, -xcenter*64L, -ycenter*64L );
+ if ( apply_matrix )
+ TT_Transform_Outline( &outline, &matrix );
+ if ( zoom_factor != 1 )
+ TT_Transform_Outline( &outline, &zoom_matrix );
+ TT_Translate_Outline( &outline, xcenter*64L, ycenter*64L );
+ }
+
+ return error;
+ }
+
+
+ static TT_Error ConvertRaster( void )
+ {
+ if ( gray_render )
+ return TT_Get_Glyph_Pixmap( glyph, &Bit, xoffset*64L, yoffset*64L );
+ else
+ return TT_Get_Glyph_Bitmap( glyph, &Bit, xoffset*64L, yoffset*64L );
+ }
+
+
+ static void DrawGrid( void )
+ {
+ char *bmap, mask;
+ int x, y, shift, toggle;
+
+
+ bmap = (char *)Bit.bitmap;
+
+ for ( y = 0; y < Bit.rows; ++y )
+ {
+ if ( ( y - xoffset ) % zoom_factor == 0 )
+ {
+ if ( gray_render )
+ for ( x = y & 1; x < Bit.cols; x += 2 )
+ bmap[x] = 4 - bmap[x];
+ else {
+ mask = y & 1 ? 0x55 : 0xAA;
+ for ( x = 0; x < Bit.cols; ++x )
+ bmap[x] ^= mask;
+ }
+ }
+ else
+ {
+ toggle = y & 1;
+
+ if ( gray_render )
+ {
+ for ( x = xoffset % zoom_factor; x < Bit.cols; x += zoom_factor )
+ if ( ( x & 1 ) == toggle )
+ bmap[x] = 4 - bmap[x];
+ }
+ else
+ {
+ /* tricky business */
+ shift = xoffset % zoom_factor;
+ for ( x = 0; x < Bit.cols; ++x )
+ {
+ for ( mask = 0; shift < 8; shift += zoom_factor )
+ if ( ( shift & 1 ) == toggle )
+ mask |= 0x80 >> shift;
+ bmap[x] ^= mask;
+ shift -= 8;
+ }
+ }
+ }
+ bmap += Bit.cols;
+ }
+ }
+
+
+ static int Process_Event( TEvent* event )
+ {
+ switch ( event->what )
+ {
+ case event_Quit: /* ESC or q */
+ return 0;
+
+ case event_Keyboard:
+ if ( event->info == 'h' ) /* Toggle hinting */
+ hinted = !hinted;
+ break;
+
+ case event_Rotate_Glyph:
+ rotation = ( rotation + event->info ) & 1023;
+ break;
+
+ case event_Scale_Glyph:
+ ptsize += event->info;
+ if ( ptsize < 1 )
+ ptsize = 1;
+ if ( ptsize > MAXPTSIZE / zoom_factor )
+ ptsize = MAXPTSIZE / zoom_factor;
+ break;
+
+ case event_Change_Glyph:
+ if ( use_cmap )
+ {
+ if ( event->info < 0 )
+ {
+ if ( Code > -event->info )
+ Code += event->info;
+ else
+ Code = 0;
+
+ for ( ; Code >= 0; Code-- )
+ {
+ Num = TT_Char_Index( char_map, Code );
+ if ( Num > 0 )
+ break;
+ }
+ }
+ else
+ {
+ if ( Code < 65536 - event->info - 1 )
+ Code += event->info;
+ else
+ Code = 65536 - 1;
+
+ for ( ; Code < 65536; Code++ )
+ {
+ Num = TT_Char_Index( char_map, Code );
+ if ( Num > 0 )
+ break;
+ }
+ }
+ }
+ else
+ {
+ if ( event->info < 0 )
+ {
+ if ( Num > -event->info )
+ Num += event->info;
+ else
+ Num = 0;
+ }
+ else
+ {
+ if ( Num < num_glyphs - event->info - 1 )
+ Num += event->info;
+ else
+ Num = num_glyphs - 1;
+ }
+ }
+ break;
+ }
+
+ return 1;
+ }
+
+
+ void usage( char* execname )
+ {
+ printf( "\n" );
+ printf( "ftzoom: simple TrueType glyph viewer -- part of the FreeType project\n" );
+ printf( "--------------------------------------------------------------------\n" );
+ printf( "\n" );
+ printf( "Usage: %s [options below] fontname[.ttf|.ttc]\n", execname );
+ printf( "\n" );
+ printf( " -g gray-level rendering (default: none)\n" );
+ printf( " -r R use resolution R dpi (default: 96)\n" );
+ printf( " -z Z Z:1 magnification (default: 1:1)\n" );
+ printf( " -p id platform id (default: none)\n" );
+ printf( " -e id encoding id (default: none)\n" );
+ printf( " -n don't use the `post' table\n" );
+ printf( " If either -p or -e is not set, no cmap will be used.\n" );
+ printf( "\n" );
+
+ exit( EXIT_FAILURE );
+ }
+
+
+ /* stack check dtp */
+
+ int main( int argc, char** argv )
+ {
+ int i;
+ int platform = -1, encoding = -1;
+ char filename[128 + 4];
+ char alt_filename[128 + 4];
+ char* execname;
+ int option;
+ int res = 96;
+ TT_Error error;
+ TT_Post post;
+
+ TEvent event;
+
+
+ execname = argv[0];
+ gray_render = 0;
+
+
+#ifdef DEBUG_LEVEL_TRACE
+
+ set_tt_trace_levels( trace_raster, 7 );
+ set_tt_trace_levels( trace_gload, 7 );
+
+#endif
+
+
+ while ( 1 )
+ {
+ option = ft_getopt( argc, argv, "e:gnp:r:z:" );
+
+ if ( option == -1 )
+ break;
+
+ switch ( option )
+ {
+ case 'e':
+ encoding = atoi( ft_optarg );
+ break;
+
+ case 'g':
+ gray_render = 1;
+ break;
+
+ case 'n':
+ use_post = 0;
+ break;
+
+ case 'p':
+ platform = atoi( ft_optarg );
+ break;
+
+ case 'r':
+ res = atoi( ft_optarg );
+ if ( res < 1 )
+ usage( execname );
+ break;
+
+ case 'z':
+ zoom_factor = atoi( ft_optarg );
+ if ( zoom_factor < 1 || zoom_factor > 16 )
+ usage( execname );
+ if ( zoom_factor > 4 )
+ grid = 1;
+ break;
+
+ default:
+ usage( execname );
+ break;
+ }
+ }
+
+ if ( ft_optind == argc )
+ usage( execname );
+
+ i = strlen( argv[ft_optind] );
+ while ( i > 0 && argv[ft_optind][i] != '\\' && argv[ft_optind][i] != '/' )
+ {
+ if ( argv[ft_optind][i] == '.' )
+ i = 0;
+ i--;
+ }
+
+ filename[128] = '\0';
+ alt_filename[128] = '\0';
+
+ strncpy( filename, argv[ft_optind], 128 );
+ strncpy( alt_filename, argv[ft_optind], 128 );
+
+ if ( i >= 0 )
+ {
+ strncpy( filename + strlen( filename ), ".ttf", 4 );
+ strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
+ }
+
+ if ( platform >= 0 || encoding >= 0 )
+ use_cmap = 1;
+
+ /* Initialization */
+ TT_Init_FreeType( &engine );
+
+ /* Initialization of the post extension */
+ if ( use_post )
+ TT_Init_Post_Extension( engine );
+
+ /* Load face */
+
+ error = TT_Open_Face( engine, filename, &face );
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ {
+ strcpy( filename, alt_filename );
+ error = TT_Open_Face( engine, alt_filename, &face );
+ }
+
+ if ( error == TT_Err_Could_Not_Open_File )
+ Panic( "Could not find/open %s.\n", filename );
+ else if ( error )
+ Panic( "Error while opening %s, error code = 0x%x.\n",
+ filename, error );
+
+ /* get face properties and allocate preload arrays */
+
+ TT_Get_Face_Properties( face, &properties );
+
+ num_glyphs = properties.num_Glyphs;
+ xcenter_upem = (properties.header->xMax - properties.header->xMin) / 2;
+ ycenter_upem = (properties.header->yMax - properties.header->yMin) / 2;
+ units_per_em = properties.header->Units_Per_EM;
+
+ /* load full post table */
+ if ( use_post )
+ {
+ error = TT_Load_PS_Names( face, &post );
+ if ( error )
+ Panic( "Could not load PS names.\n" );
+ }
+
+ /* create glyph */
+
+ error = TT_New_Glyph( face, &glyph );
+ if ( error )
+ Panic( "Could not create glyph container.\n" );
+
+ /* create instance */
+
+ error = TT_New_Instance( face, &instance );
+ if ( error )
+ Panic( "Could not create instance for %s.\n", filename );
+
+ error = TT_Set_Instance_Resolutions( instance, res, res );
+ if ( error )
+ Panic( "Could not set device resolutions." );
+
+ if ( gray_render )
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Gray ) )
+ Panic( "Could not set up grayscale graphics mode.\n" );
+
+ TT_Set_Raster_Gray_Palette( engine, gray_palette );
+ }
+ else
+ {
+ if ( !SetGraphScreen( Graphics_Mode_Mono ) )
+ Panic( "Could not set up mono graphics mode.\n" );
+ }
+
+ Init_Raster_Area();
+
+ old_ptsize = ptsize = 150 / zoom_factor;
+ old_rotation = rotation = 0;
+
+ Reset_PtSize ( ptsize );
+ Reset_Rotation( rotation );
+
+ if ( use_cmap )
+ {
+ unsigned short num_cmap;
+ unsigned short cmap_plat;
+ unsigned short cmap_enc;
+
+
+ num_cmap = properties.num_CharMaps;
+ for ( i = 0; i < num_cmap; i++ )
+ {
+ error = TT_Get_CharMap_ID( face, i, &cmap_plat, &cmap_enc );
+ if ( error )
+ Panic( "Cannot query cmap, error = 0x%x.\n", error );
+ if ( cmap_plat == platform && cmap_enc == encoding )
+ break;
+ }
+
+ if ( i == num_cmap )
+ Panic( "Invalid platform and/or encoding ID.\n" );
+
+ error = TT_Get_CharMap( face, i, &char_map );
+ if ( error )
+ Panic( "Cannot load cmap, error = 0x%x.\n", error );
+
+ num_glyphs = (1L << 16) - 1;
+ }
+
+ Code = 0;
+ Num = 0;
+ Fail = 0;
+
+ for ( ;; )
+ {
+ char *glyphname;
+
+
+ glyphname = NULL;
+
+ ClearData();
+
+ if ( ptsize != old_ptsize )
+ {
+ Reset_PtSize( ptsize );
+ old_ptsize = ptsize;
+ }
+
+ if ( rotation != old_rotation )
+ {
+ Reset_Rotation( rotation );
+ old_rotation = rotation;
+ }
+
+ if ( (error = LoadTrueTypeChar( Num, hinted )) == TT_Err_Ok )
+ {
+ ConvertRaster();
+ if ( grid )
+ DrawGrid();
+
+ if ( use_post )
+ (void)TT_Get_PS_Name(face, Num, &glyphname);
+
+ if ( use_cmap )
+ sprintf( Header, "\"%s\": index = %3d, code = 0x%x, hinting = %s",
+ use_post ? glyphname : "", Num, Code,
+ hinted ? "ON" : "OFF" );
+ else
+ sprintf( Header, "\"%s\": index = %3d, hinting = %s",
+ use_post ? glyphname : "", Num, hinted ? "ON" : "OFF" );
+ }
+ else {
+ Fail++;
+ sprintf( Header, "\"%s\": index = %3d, hinting = %s (ERROR 0x%lx)",
+ glyphname ? glyphname : "", Num,
+ hinted ? "ON" : "OFF", error );
+ }
+
+ Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols );
+
+#ifndef X11
+#ifndef OS2
+ Print_XY( 0, 0, Header );
+#endif
+#endif
+
+ Get_Event( &event );
+ if ( !Process_Event( &event ) ) goto End;
+ }
+
+ End:
+
+ RestoreScreen();
+
+ TT_Close_Face( face );
+ TT_Done_FreeType( engine );
+
+ printf( "Fails = %d.\n", Fail );
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+ }
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/gdriver.h b/Build/source/libs/freetype/test/gdriver.h
new file mode 100644
index 00000000000..e57ffbc0342
--- /dev/null
+++ b/Build/source/libs/freetype/test/gdriver.h
@@ -0,0 +1,55 @@
+/*******************************************************************
+ *
+ * gdriver.h : Graphics utility driver generic interface 1.1
+ *
+ * Generic interface for all drivers of the graphics utility used
+ * by the FreeType test programs.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#ifndef GDRIVER_H
+#define GDRIVER_H
+
+ /* Note that we now support an event based model, even with */
+ /* full-screen modes. It is the responsability of the driver */
+ /* to map its events to the TEvent structure when called */
+ /* through Get_Event. */
+
+ /* The event classes are defined in the file 'gevents.h' included */
+ /* by the test programs, not by the graphics utility. */
+
+ typedef struct _TEvent
+ {
+ int what; /* event class */
+ int info; /* event parameter */
+ } TEvent;
+
+
+ /* Get last event. In full-screen modes, a keystroke must be */
+ /* translated to an event class with a parameter. */
+ void Get_Event( TEvent* event );
+
+ /* A call to this function must set the graphics mode, the Vio */
+ /* variable, as well as the values vio_ScanLineWidth, vio_Width */
+ /* and vio_Height. */
+ int Driver_Set_Graphics( int mode );
+
+ /* Restore previous mode or release display buffer/window */
+ int Driver_Restore_Mode( void );
+
+ /* display bitmap on screen */
+ int Driver_Display_Bitmap( char* buffer, int line, int col );
+
+#endif /* GDRIVER_H */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/gevents.h b/Build/source/libs/freetype/test/gevents.h
new file mode 100644
index 00000000000..8f7f977a451
--- /dev/null
+++ b/Build/source/libs/freetype/test/gevents.h
@@ -0,0 +1,43 @@
+/*******************************************************************
+ *
+ * gevents.h test programs events definition 1.1
+ *
+ * This file defines the events used by the FreeType test programs
+ * It is _not_ included by 'gmain.c'. This file is also used by the
+ * drivers to translate their own events in GEvents.
+ *
+ * Not a very good design, but we're not rewriting X...
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#ifndef GEVENTS_H
+#define GEVENTS_H
+
+ typedef enum _GEvent
+ {
+ event_None,
+ event_Quit, /* Quit program */
+
+ event_Keyboard, /* unknown keystroke */
+
+ event_Change_Glyph,
+ event_Rotate_Glyph,
+ event_Scale_Glyph,
+
+ event_Change_ScanType,
+ event_Change_Instructions
+ } GEvent;
+
+#endif /* GEVENTS_H */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/gmain.c b/Build/source/libs/freetype/test/gmain.c
new file mode 100644
index 00000000000..f8eefc7aef3
--- /dev/null
+++ b/Build/source/libs/freetype/test/gmain.c
@@ -0,0 +1,475 @@
+/*******************************************************************
+ *
+ * gmain.c graphics utility main body 1.1
+ *
+ * This file defines a common implementation of the graphics
+ * utility used by the FreeType test programs. It relies on
+ * system-specific drivers, like 'gfs_os.c', which interface is
+ * described in the file 'gdriver.h'.
+ *
+ * Copyright 1996-2000 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.
+ *
+ ******************************************************************/
+
+#include "gdriver.h"
+#include "gmain.h"
+
+#ifndef FAILURE
+#define FAILURE 0
+#endif
+
+#ifndef SUCCESS
+#define SUCCESS 1
+#endif
+
+ char* Vio; /* pointer to VRAM or display buffer */
+
+ int vio_ScanLineWidth; /* scan line width in bytes */
+
+ int vio_Width;
+ int vio_Height;
+
+ int gcursor_x = 0;
+ int gcursor_y = 0;
+
+ int gwindow_width = 0;
+ int gwindow_height = 0;
+
+ unsigned char gray_palette[5];
+
+
+ typedef void TFunction_Print_8x8_Char( int x,
+ int y,
+ unsigned char c );
+
+ TFunction_Print_8x8_Char* Print_8x8_Char;
+
+ /* font characters */
+
+ unsigned char font_8x8[2048] =
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E,
+ 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E,
+ 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00,
+ 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00,
+ 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x92, 0x10, 0x7C,
+ 0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C,
+ 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00,
+ 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF,
+ 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00,
+ 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF,
+ 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78,
+ 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18,
+ 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0,
+ 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0,
+ 0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99,
+ 0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00,
+ 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00,
+ 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00,
+ 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00,
+ 0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0x86, 0xFC,
+ 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00,
+ 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF,
+ 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00,
+ 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00,
+ 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00,
+ 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00,
+ 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00,
+ 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00,
+ 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00,
+ 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00,
+ 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00,
+ 0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00,
+ 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00,
+ 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00,
+ 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00,
+ 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
+ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,
+ 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30,
+ 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
+ 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00,
+ 0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00,
+ 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00,
+ 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00,
+ 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00,
+ 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00,
+ 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00,
+ 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00,
+ 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00,
+ 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00,
+ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00,
+ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30,
+ 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00,
+ 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00,
+ 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00,
+ 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00,
+ 0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00,
+ 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00,
+ 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00,
+ 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00,
+ 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00,
+ 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00,
+ 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00,
+ 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00,
+ 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00,
+ 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00,
+ 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00,
+ 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00,
+ 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00,
+ 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00,
+ 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00,
+ 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,
+ 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00,
+ 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00,
+ 0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00,
+ 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
+ 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00,
+ 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00,
+ 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00,
+ 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00,
+ 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
+ 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00,
+ 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
+ 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
+ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00,
+ 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00,
+ 0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00,
+ 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
+ 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00,
+ 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78,
+ 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00,
+ 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00,
+ 0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
+ 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0,
+ 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E,
+ 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00,
+ 0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00,
+ 0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00,
+ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,
+ 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00,
+ 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00,
+ 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
+ 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00,
+ 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00,
+ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
+ 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00,
+ 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00,
+ 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x0C, 0x06, 0x7C,
+ 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0x7E, 0x81, 0x3C, 0x06, 0x3E, 0x66, 0x3B, 0x00,
+ 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x78, 0x0C, 0x38,
+ 0x7E, 0x81, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00,
+ 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00,
+ 0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x7C, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00,
+ 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0xC6, 0x10, 0x7C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00,
+ 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00,
+ 0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00,
+ 0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00,
+ 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00,
+ 0x78, 0x84, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x78, 0x84, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8,
+ 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00,
+ 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00,
+ 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18,
+ 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00,
+ 0xCC, 0xCC, 0x78, 0x30, 0xFC, 0x30, 0xFC, 0x30,
+ 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC3,
+ 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70,
+ 0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00,
+ 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
+ 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x00, 0xF8, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0x00,
+ 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00,
+ 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00,
+ 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00,
+ 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3C, 0x00,
+ 0x00, 0x00, 0x00, 0xFC, 0xC0, 0xC0, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00,
+ 0xC6, 0xCC, 0xD8, 0x36, 0x6B, 0xC2, 0x84, 0x0F,
+ 0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6D, 0xCF, 0x03,
+ 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00,
+ 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00,
+ 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00,
+ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88,
+ 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
+ 0xDB, 0xF6, 0xDB, 0x6F, 0xDB, 0x7E, 0xD7, 0xED,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18,
+ 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18,
+ 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00,
+ 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36,
+ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36,
+ 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
+ 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36,
+ 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00,
+ 0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0,
+ 0x00, 0xFC, 0xCC, 0xC0, 0xC0, 0xC0, 0xC0, 0x00,
+ 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x00,
+ 0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00,
+ 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00,
+ 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0,
+ 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00,
+ 0xFC, 0x30, 0x78, 0xCC, 0xCC, 0x78, 0x30, 0xFC,
+ 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00,
+ 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00,
+ 0x1C, 0x30, 0x18, 0x7C, 0xCC, 0xCC, 0x78, 0x00,
+ 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00,
+ 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0,
+ 0x38, 0x60, 0xC0, 0xF8, 0xC0, 0x60, 0x38, 0x00,
+ 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00,
+ 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00,
+ 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00,
+ 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00,
+ 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00,
+ 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70,
+ 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00,
+ 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00,
+ 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C,
+ 0x58, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00,
+ 0x70, 0x98, 0x30, 0x60, 0xF8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+
+ void Print_8x8_Mono( int x, int y, unsigned char c )
+ {
+ int offset, i;
+ unsigned char* bitm;
+
+ if ( !Vio )
+ return;
+
+ offset = x + y * vio_ScanLineWidth * 8;
+ bitm = font_8x8 + (int)c * 8;
+
+ for ( i = 0; i < 8; i++ )
+ {
+ Vio[offset] = *bitm;
+ bitm++;
+ offset += vio_ScanLineWidth;
+ }
+ }
+
+
+ void Print_8x8_Gray( int x, int y, unsigned char c )
+ {
+ int offset, i, bit;
+ unsigned char* bitm;
+
+ if ( !Vio )
+ return;
+
+ offset = x * 8 + y * vio_ScanLineWidth * 8;
+ bitm = font_8x8 + (int)c * 8;
+
+ for ( i = 0; i < 8; i++ )
+ {
+ bit = 0x80;
+ while ( bit > 0 )
+ {
+ if ( bit & *bitm )
+ Vio[offset] = (char)0x0f;
+ else
+ Vio[offset] = 0x00;
+
+ bit >>= 1;
+ offset++;
+ }
+ offset += vio_ScanLineWidth - 8;
+ bitm++;
+ }
+ }
+
+
+ int SetGraphScreen( int mode )
+ {
+ gcursor_x = 0;
+ gcursor_y = 0;
+
+ switch( mode )
+ {
+ case Graphics_Mode_Mono:
+ if ( !Driver_Set_Graphics( mode ) )
+ return FAILURE;
+
+ gwindow_width = vio_ScanLineWidth;
+ gwindow_height = vio_Height / 8;
+
+ Print_8x8_Char = Print_8x8_Mono;
+ break;
+
+ case Graphics_Mode_Gray:
+ if ( !Driver_Set_Graphics( mode ) )
+ return FAILURE;
+
+ gwindow_width = vio_ScanLineWidth / 8;
+ gwindow_height = vio_Height / 8;
+
+ Print_8x8_Char = Print_8x8_Gray;
+ break;
+
+ default:
+ /* Invalid function call */
+ return FAILURE;
+ }
+
+ return SUCCESS;
+ }
+
+
+ /* restore previous (or text) video mode */
+
+ int RestoreScreen( void )
+ {
+ gcursor_x = 0;
+ gcursor_y = 0;
+ gwindow_height = 0;
+ gwindow_height = 0;
+
+ return Driver_Restore_Mode();
+ }
+
+
+ void Display_Bitmap_On_Screen( char* buffer, int line, int col )
+ {
+ Driver_Display_Bitmap( buffer, line, col );
+ }
+
+
+ void Goto_XY( int x, int y )
+ {
+ gcursor_x = x;
+ gcursor_y = y;
+ }
+
+
+ void Print_Str( char* string )
+ {
+ if ( !string ) return;
+
+ while ( *string )
+ {
+ switch ( *string )
+ {
+ case '\n':
+ gcursor_x = 0;
+ gcursor_y++;
+ if ( gcursor_y > gwindow_height ) gcursor_y = 0;
+ break;
+
+ default:
+ (*Print_8x8_Char)( gcursor_x, gcursor_y, *string );
+
+ gcursor_x++;
+
+ if ( gcursor_x >= gwindow_width )
+ {
+ gcursor_x = 0;
+ gcursor_y++;
+
+ if ( gcursor_y >= gwindow_height ) gcursor_y = 0;
+ }
+ }
+ string++;
+ }
+ }
+
+
+ void Print_XY( int x, int y, char* string )
+ {
+ Goto_XY( x, y );
+ Print_Str( string );
+ }
+
+
+
+
+
+
+
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/gmain.h b/Build/source/libs/freetype/test/gmain.h
new file mode 100644
index 00000000000..3b40440b672
--- /dev/null
+++ b/Build/source/libs/freetype/test/gmain.h
@@ -0,0 +1,71 @@
+/*******************************************************************
+ *
+ * gmain.h graphics utility main interface 1.1
+ *
+ * This file defines a common interface, implemented in the body
+ * file 'gmain.c'. It relies on system dependent driver files,
+ * like 'gfs_os.c', whose interface is described in 'gdriver.h'.
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef GMAIN_H
+#define GMAIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Graphics mode definitions */
+
+#define Graphics_Mode_Mono 1 /* monochrome graphics mode */
+#define Graphics_Mode_Gray 2 /* 8-bit palette graphics mode */
+
+ extern char* Vio; /* Pointer to VRAM or display buffer */
+
+ extern int vio_ScanLineWidth; /* Scan Line width in bytes */
+
+ extern int vio_Width;
+ extern int vio_Height;
+
+ extern unsigned char gray_palette[5]; /* standard gray_palette */
+
+
+ /* set a graphics mode, chosen from the Graphics_Mode_xxx list */
+ int SetGraphScreen( int mode );
+
+ /* restore previous (or text) video mode */
+ int RestoreScreen( void );
+
+ /* display a bitmap of 'line' lines, and 'col' columns (each */
+ /* column made of 8 bits) */
+ void Display_Bitmap_On_Screen( char* buffer, int line, int col );
+
+ void Goto_XY( int x, int y );
+
+
+ extern int gcursor_x;
+ extern int gcursor_y;
+
+ extern int gwindow_width;
+ extern int gwindow_height;
+
+ void Print_Str( char* string );
+ void Print_XY ( int x, int y, char* string );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GMAIN_H */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/test/textdisp.c b/Build/source/libs/freetype/test/textdisp.c
new file mode 100644
index 00000000000..c6ac8df860f
--- /dev/null
+++ b/Build/source/libs/freetype/test/textdisp.c
@@ -0,0 +1,47 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* textdisp.c: Text-mode display component used by some test programs. */
+/* */
+/* This file is used to display glyphs using only text, with ' ' and '*'. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+
+#include "textdisp.h"
+
+ void
+ Show_Single_Glyph( const TT_Raster_Map* map )
+ {
+ int y;
+
+ unsigned char* line = map->bitmap;
+
+
+ for ( y = 0; y < map->rows; y++, line += map->cols )
+ {
+ unsigned char* ptr = line;
+ int x;
+ unsigned char mask = 0x80;
+
+
+ for ( x = 0; x < map->width; x++ )
+ {
+ printf( "%c", (ptr[0] & mask) ? '*' : '.' );
+ mask >>= 1;
+ if ( mask == 0 )
+ {
+ mask = 0x80;
+ ptr++;
+ }
+ }
+ printf( "\n" );
+ }
+ }
+
+/* End */
diff --git a/Build/source/libs/freetype/test/textdisp.h b/Build/source/libs/freetype/test/textdisp.h
new file mode 100644
index 00000000000..829fc164804
--- /dev/null
+++ b/Build/source/libs/freetype/test/textdisp.h
@@ -0,0 +1,32 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2001 by */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* textdisp.h: Text-mode display component used by some test programs. */
+/* */
+/* This file is used to display glyphs using only text, with ' ' and '*'. */
+/* */
+/****************************************************************************/
+
+#ifndef TEXTDISP_H
+#define TEXTDISP_H
+
+#include "freetype.h" /* TT_Raster_Map */
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ void Show_Single_Glyph( const TT_Raster_Map* map );
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* TEXTDISP_H */
+
+
+/* End */
diff --git a/Build/source/libs/freetype/win32.mak b/Build/source/libs/freetype/win32.mak
new file mode 100644
index 00000000000..4a87be7f412
--- /dev/null
+++ b/Build/source/libs/freetype/win32.mak
@@ -0,0 +1,29 @@
+################################################################################
+#
+# Makefile : Freetype
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <03/08/12 23:06:05 popineau>
+#
+################################################################################
+root_srcdir = ..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+!include <msvc/common.mak>
+
+# Package subdirectories, the library, and all subdirectories.
+subdirs = \
+ lib
+
+!include <msvc/subdirs.mak>
+!include <msvc/clean.mak>
+
+#
+# Local Variables:
+# mode: Makefile
+# End:
+# DO NOT DELETE
diff --git a/Build/source/libs/freetype/withenable.ac b/Build/source/libs/freetype/withenable.ac
new file mode 100644
index 00000000000..90f783d00e7
--- /dev/null
+++ b/Build/source/libs/freetype/withenable.ac
@@ -0,0 +1,10 @@
+AC_ARG_WITH(system_freetype,
+ [ --with-system-freetype use installed freetype library])
+
+AC_ARG_WITH(freetype_libdir,
+[ --with-freetype-libdir=DIR
+ Specify directory where the libfreetype resides.])
+
+AC_ARG_WITH(freetype_include,
+[ --with-freetype-include=DIR
+ Specify the freetype header files location.])