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

View File

@@ -0,0 +1,106 @@
# 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
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 \
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 $(LIBDIR)/libttf.a
ftstrpnm: ftstrpnm.o common.o $(LIBDIR)/libttf.a
ftmetric: ftmetric.o common.o $(LIBDIR)/libttf.a
ftstrtto: $(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
-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

16
test/arch/amigaos/TODO Normal file
View File

@@ -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@lists.lrz-muenchen.de

View File

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

View File

@@ -0,0 +1,522 @@
/*******************************************************************
*
* 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-1999 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>
#ifdef __GNUC__
#include <inline/exec.h>
#include <inline/intuition.h>
#include <inline/graphics.h>
#include <inline/dos.h>
#include <inline/gadtools.h>
#else
#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>
#endif
/* 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)"G", 0, 0L, (APTR)'G'},
{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 */

180
test/arch/amigaos/smakefile Normal file
View File

@@ -0,0 +1,180 @@
# 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.
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 ftxerr18.o \
ftxsbit.o ftxgsub.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)
TSCFLAGS = $(SCFLAGS) idir=$(TST) idir=$(COREXT)
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 blitter.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=$@ $<
ftxerr18.o: $(COREXT)ftxerr18.c
sc $(SCFLAGS) objname=$@ $<
ftxsbit.o: $(COREXT)ftxsbit.c
sc $(SCFLAGS) objname=$@ $<
ftxgsub.o: $(COREXT)ftxgsub.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) display.o $(LIB)
sc $(TST)ftstring.c uchar programname=$@ $(TOBJ) display.o $(TOPTS)
ftview: $(TST)ftview.c $(TOBJ) display.o $(LIB)
sc $(TST)ftview.c programname=$@ $(TOBJ) display.o $(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 $(LIB)
sc $(TST)ftsbit.c programname=$@ common.o $(TOPTS)
ftmetric: $(TST)ftmetric.c common.o $(LIB)
sc $(TST)ftmetric.c programname=$@ common.o $(TOPTS)
# use unsigned char so full latin1/UTF8 encoding may be used in argument
ftstrtto: $(TST)ftstrtto.c $(TOBJ) display.o arabic.o $(LIB)
sc $(TST)ftstrtto.c uchar programname=$@ $(TOBJ) \
arabic.o display.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=$@ $<
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

View File

@@ -0,0 +1,99 @@
# 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 statement:
#
# make -f arch/debugger/Makefile
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 -M $(INCDIRS) $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.emx

181
test/arch/msdos/Makefile.BC Normal file
View File

@@ -0,0 +1,181 @@
# 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
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 \
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: 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
do_clean:
-del *.obj
-del $(ARCH)\*.obj
del time.h # clean the ugly hack for Turbo C...
!include "$(ARCH)\depend.dos"
# end of Makefile

142
test/arch/msdos/Makefile.MS Normal file
View File

@@ -0,0 +1,142 @@
# 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
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 \
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 $(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.dos"
# end of Makefile.MS

196
test/arch/msdos/Makefile.TC Normal file
View File

@@ -0,0 +1,196 @@
# 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
# Turbo C v.1.0 (May '87) is too old (lack of structure assignment)
# to compile FreeType. Update your compiler. ;-)
#
#
# 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) with
#
# make -DDEBUG -farch\msdos\Makefile.TC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.TC
CC = tcc
LIBDIR = ..\lib
INCDIRS = -I$(LIBDIR);$(LIBDIR)\$(ARCH);.;$(LIBDIR)\extend
!if ! $d(DEBUG)
CFLAGS = -ml -A -O -Z -G -a -w-stv -w-sig $(INCDIRS)
LDFLAGS = -ml
!else
# For Turbo C v.1.5, replace the -v option below by -y.
CFLAGS = -v -N -ml -A -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig $(INCDIRS)
LDFLAGS = -v -ml
!endif
# 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 \
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.
$(GDRIVER):
$(CC) $(CFLAGS) -A- -c -o$* $*.c
!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
!else
# Normal behaviour
fttimer.exe: $(G1OBJ) fttimer.obj common.obj $(LIBDIR)\libttf.lib
$(CC) $(LDFLAGS) fttimer.obj $(G1OBJ) common.obj $(LIBDIR)\libttf.lib
!endif
# 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 is handled above (because of <time.h> hack)
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
do_clean:
-del *.obj
-del $(ARCH)\*.obj
del time.h # clean the ugly hack for Turbo C...
!include "$(ARCH)\depend.dos"
# end of Makefile

143
test/arch/msdos/Makefile.VC Normal file
View File

@@ -0,0 +1,143 @@
# 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
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 \
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 $(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.dos"
# end of Makefile.VC

145
test/arch/msdos/Makefile.dm Normal file
View File

@@ -0,0 +1,145 @@
# 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
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 \
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 $(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
[
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

View File

@@ -0,0 +1,130 @@
# 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 statement:
#
# 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
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
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 $(ARCH)\gfs_dos.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,50 @@
# This dependency file to be used with various MS-DOS 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\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
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 ..\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 ..\lib\arch\msdos\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
arch\msdos\gfs_dos.obj: arch\msdos\gfs_dos.c gdriver.h gevents.h gmain.h

357
test/arch/msdos/gfs_dos.c Normal file
View File

@@ -0,0 +1,357 @@
/*******************************************************************
*
* 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-1999 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 --------------------------------------- */
/* DJGPP v1.x */
#if !defined( __DJGPP__ ) && defined( __GO32__ )
#define DJGPP1
#undef __STRICT_ANSI__
#include <sys/nearptr.h>
#include <dos.h>
#include <strings.h>
#include <conio.h>
#define reg_ax regs.x.ax
#endif
/* DJGPP v2.x */
#ifdef __DJGPP__
#define DJGPP2
#undef __STRICT_ANSI__
#include <bios.h>
#include <conio.h>
#include <sys/movedata.h>
#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 )
#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>
#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( DJGPP1 ) || defined( DJGPP2 )
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
#ifndef FP_SEG
#define FP_SEG(fp) (*((unsigned __far *)&(fp) + 1))
#endif
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 DJGPP2
char cbuf = 0;
int i;
for( i = 0; i < vio_Height*vio_ScanLineWidth; i++ )
dosmemput( &cbuf, 1, (unsigned long) Vio+i );
#else
#ifdef DJGPP1
__djgpp_nearptr_enable();
Vio += __djgpp_conventional_base;
#else
memset( Vio, 0, vio_Height * vio_ScanLineWidth );
#endif /* DJGPP1 */
#endif /* DJGPP2 */
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 DJGPP2
dosmemput( buffer, used_col, (unsigned long)target );
#else
memcpy( target, buffer, used_col );
#endif
target -= vio_ScanLineWidth;
buffer += col;
}
#ifdef DJGPP1
__djgpp_nearptr_disable();
Vio -= __djgpp_conventional_base;
#endif
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 */

22
test/arch/msdos/makedep Normal file
View File

@@ -0,0 +1,22 @@
# makedep
#
# This shell script creates a dependency file necessary for older compilers
# on the MS-DOS platform.
echo "\
# This dependency file to be used with various MS-DOS compilers
# has been generated automatically with the script \`makedep' on
# `date +%d-%b-%Y`.
" > 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/win16 -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

124
test/arch/msdos/time_tc.h Normal file
View File

@@ -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 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__>0x200
/*
* 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 */

143
test/arch/os2/Makefile.dm Normal file
View File

@@ -0,0 +1,143 @@
# 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
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
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 $(LIBDIR)/libttf.a
ftmetric.exe: ftmetric.o common.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

108
test/arch/os2/Makefile.emx Normal file
View File

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

145
test/arch/os2/Makefile.icc Normal file
View File

@@ -0,0 +1,145 @@
# 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
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 \
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
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) $(LIBDIR)\libttf.lib $(COMMON)
$(CC) $(CFLAGS) /Fe$@ $**
ftmetric.exe: $(OBJ9) $(LIBDIR)\libttf.lib $(COMMON)
$(CC) $(CFLAGS) /Fe$@ $**
ftstrtfs.exe: $(GFSOBJS) $(OBJ10) $(LIBDIR)\libttf.lib
$(CC) $(CFLAGS) /Fe$@ $**
ftstrtto.exe: $(GPMOBJS) $(OBJ10) arabic.obj $(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

155
test/arch/os2/Makefile.wat Normal file
View File

@@ -0,0 +1,155 @@
# 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
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 &
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 $(LIBFILE)
$(CC) $(CCFLAGS) $(LIBFILE) common.obj $[*.c /fe=$[*.exe
ftmetric.exe: ftmetric.obj $(LIBFILE)
$(CC) $(CCFLAGS) $(LIBFILE) common.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

219
test/arch/os2/gfs_os2.c Normal file
View File

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

654
test/arch/os2/gpm_os2.c Normal file
View File

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

View File

@@ -0,0 +1,5 @@
NAME WINDOWCOMPAT
DESCRIPTION 'FreeType Graphics'
HEAPSIZE 8192
STACKSIZE 40888

View File

@@ -0,0 +1 @@
Makefile

170
test/arch/unix/Makefile.in Normal file
View File

@@ -0,0 +1,170 @@
# This file is part of the FreeType project.
#
# test/arch/unix/Makefile.in
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)/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 = ftview fttimer ftlint ftdump ftzoom ftsbit \
ftstring ftstrpnm fterror ftmetric ftstrtto
# 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: $(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 $(LIBTTF)
$(PROCESS) -o ftmetric ftmetric.o common.o \
$(EFENCE) $(LIBTTF) $(FT_LIBS)
ftsbit: ftsbit.o common.o $(LIBTTF)
$(PROCESS) -o ftsbit ftsbit.o common.o \
$(EFENCE) $(LIBTTF)
ftstring: ftstring.o $(DISPOBJS) $(LIBTTF)
$(PROCESS) -o ftstring ftstring.o $(DISPOBJS) \
$(EFENCE) $(LIBTTF) $(FT_LIBS) -lX11
# ftstrpnm does not need any extra libraries
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: $(PROGRAMS)
$(MKINSTALLDIRS) $(bindir)
for P in $(PROGRAMS) ; do \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$P $(bindir)/$$P ; \
done
uninstall:
-for P in $(PROGRAMS) ; do \
$(LIBTOOL) --mode=uninstall $(RM) $(bindir)/$$P ; \
done
clean: do_clean
distclean: do_clean
-$(RMF) $(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
# Dependencies generated by make depend: PUT NO STUFF BELOW

451
test/arch/unix/gwin_x11.c Normal file
View File

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

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

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