FreeType 1.31.1

This commit is contained in:
2023-08-27 18:03:45 +02:00
commit 5edbb7a80a
454 changed files with 173977 additions and 0 deletions

212
test/arch/win16/Makefile.BC Normal file
View File

@@ -0,0 +1,212 @@
# 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
ARCH = arch\win16
FT_MAKEFILE = $(ARCH)\Makefile.BC
FT_DLL = ft13_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 \
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: ftsbit.obj common.obj $(LIBDIR)\libttf.lib
$(CC) $(LDFLAGS) ftsbit.obj common.obj $(LIBDIR)\libttf.lib
ftmetric.exe: ftmetric.obj common.obj $(LIBDIR)\libttf.lib
$(CC) $(LDFLAGS) ftmetric.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

145
test/arch/win16/Makefile.MS Normal file
View File

@@ -0,0 +1,145 @@
# 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
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 \
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 $(LIBDIR)\libttf.lib
ftmetric.exe: ftmetric.obj common.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

187
test/arch/win16/Makefile.VC Normal file
View File

@@ -0,0 +1,187 @@
# 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
ARCH = arch\win16
FT_MAKEFILE = $(ARCH)\Makefile.VC
FT_MAKE = $(MAKE) /nologo
FT_DLL = ft13_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 \
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 $(LIBDIR)\libttf.lib
ftmetric.exe: ftmetric.obj common.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

View File

@@ -0,0 +1,52 @@
# This dependency file to be used with various Windows compilers
# has been generated automatically with the script `makedep' on
# 02-Sep-1999.
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
common.obj: common.c common.h ..\lib\freetype.h ..\lib\fterrid.h \
..\lib\ftnameid.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
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 ..\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 ..\lib\arch\win16\ft_conf.h
ftstring.obj: ftstring.c common.h ..\lib\freetype.h ..\lib\fterrid.h \
..\lib\ftnameid.h display.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
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 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
!ifndef __MAKE__
arch\win16\gw_win16.obj: arch\win16\gw_win16.c gdriver.h gevents.h gmain.h
!endif

430
test/arch/win16/gw_win16.c Normal file
View File

@@ -0,0 +1,430 @@
/*******************************************************************
*
* 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 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.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 */

30
test/arch/win16/makedep Normal file
View File

@@ -0,0 +1,30 @@
# 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.
echo "\
# This dependency file to be used with various Windows compilers
# has been generated automatically with the script \`makedep' on
# `date +%d-%b-%Y`.
" > 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