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