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

197
test/arch/win32/Makefile.BC Normal file
View File

@@ -0,0 +1,197 @@
# 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
ARCH = arch\win32
FT_MAKEFILE = $(ARCH)\Makefile.BC
FT_DLL = ft13_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 = -i48 $(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 \
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: 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
-del *.tds
!include "$(ARCH)\depend.win"
# end of Makefile

175
test/arch/win32/Makefile.CL Normal file
View File

@@ -0,0 +1,175 @@
# 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
ARCH = arch\win32
FT_MAKEFILE = $(ARCH)\Makefile.CL
FT_MAKE = $(MAKE) /nologo
FT_DLL = ft13_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 \
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 $(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
-del *.ilk
-del *.pch
-del *.exp
!include "$(ARCH)\depend.win"
# end of Makefile.CL

View File

@@ -0,0 +1,122 @@
# 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 statement:
#
# make -f arch/win32/Makefile.min
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 \
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 $(LIBDIR)/libttf.a
ftmetric.exe: ftmetric.o common.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 -M $(INCDIRS) $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.gcc

View File

@@ -0,0 +1,131 @@
# 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 statement:
#
# 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
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 \
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 $@ $^
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 $(LIBDIR)/libttf.a
ftmetric.exe: ftmetric.o common.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 -M $(INCDIRS) $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.gcc

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
# 03-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\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
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 ..\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 ..\lib\arch\win32\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\win32\gw_win32.obj: arch\win32\gw_win32.c gdriver.h gevents.h gmain.h
!endif

378
test/arch/win32/gw_win32.c Normal file
View File

@@ -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 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>
#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 */

29
test/arch/win32/makedep Normal file
View File

@@ -0,0 +1,29 @@
# 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.
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/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