mirror of https://github.com/deadw00d/AROS.git
562 lines
20 KiB
Diff
562 lines
20 KiB
Diff
diff -ruN freetype-2.12.1/builds/aros/src/base/ftsystem.c freetype-2.12.1.aros/builds/aros/src/base/ftsystem.c
|
|
--- freetype-2.12.1/builds/aros/src/base/ftsystem.c 1970-01-01 00:00:00.000000000 +0000
|
|
+++ freetype-2.12.1.aros/builds/aros/src/base/ftsystem.c 2021-01-08 22:52:37.860000000 +0000
|
|
@@ -0,0 +1,356 @@
|
|
+/***************************************************************************/
|
|
+/* */
|
|
+/* ftsystem.c */
|
|
+/* */
|
|
+/* ANSI-specific FreeType low-level system interface (body). */
|
|
+/* */
|
|
+/* Copyright 1996-2018 by */
|
|
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
+/* */
|
|
+/* This file is part of the FreeType project, and may only be used, */
|
|
+/* modified, and distributed under the terms of the FreeType project */
|
|
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
+/* this file you indicate that you have read the license and */
|
|
+/* understand and accept it fully. */
|
|
+/* */
|
|
+/***************************************************************************/
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* This file contains the default interface used by FreeType to access */
|
|
+ /* low-level, i.e. memory management, i/o access as well as thread */
|
|
+ /* synchronisation. It can be replaced by user-specific routines if */
|
|
+ /* necessary. */
|
|
+ /* */
|
|
+ /*************************************************************************/
|
|
+
|
|
+#include <aros/debug.h>
|
|
+
|
|
+#include <ft2build.h>
|
|
+#include FT_CONFIG_CONFIG_H
|
|
+#include <freetype/internal/ftdebug.h>
|
|
+#include <freetype/ftsystem.h>
|
|
+#include <freetype/fterrors.h>
|
|
+#include <freetype/fttypes.h>
|
|
+
|
|
+#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
+
|
|
+#include <exec/types.h>
|
|
+#include <exec/memory.h>
|
|
+#include <dos/dos.h>
|
|
+#include <proto/exec.h>
|
|
+#include <proto/dos.h>
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* MEMORY MANAGEMENT INTERFACE */
|
|
+ /* */
|
|
+ /*************************************************************************/
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* It is not necessary to do any error checking for the */
|
|
+ /* allocation-related functions. This will be done by the higher level */
|
|
+ /* routines like FT_Alloc() or FT_Realloc(). */
|
|
+ /* */
|
|
+ /*************************************************************************/
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* <Function> */
|
|
+ /* ft_alloc */
|
|
+ /* */
|
|
+ /* <Description> */
|
|
+ /* The memory allocation function. */
|
|
+ /* */
|
|
+ /* <Input> */
|
|
+ /* memory :: A pointer to the memory object. */
|
|
+ /* */
|
|
+ /* size :: The requested size in bytes. */
|
|
+ /* */
|
|
+ /* <Return> */
|
|
+ /* The address of newly allocated block. */
|
|
+ /* */
|
|
+ FT_CALLBACK_DEF( void* )
|
|
+ ft_alloc( FT_Memory memory,
|
|
+ long size )
|
|
+ {
|
|
+ ULONG memsize = size + sizeof(ULONG);
|
|
+ void* retval;
|
|
+ APTR MemPool = (APTR)memory->user;
|
|
+
|
|
+ D(bug("Entering ft_alloc(memory=%x,size=%ld)\n", memory, size));
|
|
+
|
|
+ retval = AllocPooled(MemPool, memsize);
|
|
+
|
|
+ D(bug("Allocated retval=%x\n", (void*)retval));
|
|
+
|
|
+ *((ULONG *)retval) = memsize;
|
|
+
|
|
+ D(bug("Leaving ft_alloc retval=%x\n", (void*)((ULONG*)retval + 1)));
|
|
+
|
|
+ return (void*)((ULONG*)retval + 1);
|
|
+ }
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* <Function> */
|
|
+ /* ft_free */
|
|
+ /* */
|
|
+ /* <Description> */
|
|
+ /* The memory release function. */
|
|
+ /* */
|
|
+ /* <Input> */
|
|
+ /* memory :: A pointer to the memory object. */
|
|
+ /* */
|
|
+ /* block :: The address of block in memory to be freed. */
|
|
+ /* */
|
|
+ FT_CALLBACK_DEF( void )
|
|
+ ft_free( FT_Memory memory,
|
|
+ void* block )
|
|
+ {
|
|
+ APTR mem = (APTR)((char*)block - sizeof(ULONG));
|
|
+ APTR MemPool = (APTR)memory->user;
|
|
+
|
|
+ D(bug("Entering ft_free(memory=%x, block=%x)\n", memory, block));
|
|
+
|
|
+ FreePooled( MemPool, mem, *((ULONG*)mem) );
|
|
+
|
|
+ D(bug("Leaving ft_free\n"));
|
|
+ }
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* <Function> */
|
|
+ /* ft_realloc */
|
|
+ /* */
|
|
+ /* <Description> */
|
|
+ /* The memory reallocation function. */
|
|
+ /* */
|
|
+ /* <Input> */
|
|
+ /* memory :: A pointer to the memory object. */
|
|
+ /* */
|
|
+ /* cur_size :: The current size of the allocated memory block. */
|
|
+ /* */
|
|
+ /* new_size :: The newly requested size in bytes. */
|
|
+ /* */
|
|
+ /* block :: The current address of the block in memory. */
|
|
+ /* */
|
|
+ /* <Return> */
|
|
+ /* The address of the reallocated memory block. */
|
|
+ /* */
|
|
+ FT_CALLBACK_DEF( void* )
|
|
+ ft_realloc( FT_Memory memory,
|
|
+ long cur_size,
|
|
+ long new_size,
|
|
+ void* block )
|
|
+ {
|
|
+ void* retval;
|
|
+
|
|
+ D(bug("Entering ft_free(memory=%x, cur_size=%ld, new_size=%ld, block=%x)\n",
|
|
+ memory, cur_size, new_size, block));
|
|
+
|
|
+ if ((retval = ft_alloc( memory, new_size )) != NULL)
|
|
+ {
|
|
+ CopyMem( block, retval, cur_size );
|
|
+ ft_free( memory, block );
|
|
+ }
|
|
+
|
|
+ D(bug("Leaving ft_free retval=%x\n", retval));
|
|
+
|
|
+ return retval;
|
|
+ }
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* RESOURCE MANAGEMENT INTERFACE */
|
|
+ /* */
|
|
+ /*************************************************************************/
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
+ /* messages during execution. */
|
|
+ /* */
|
|
+#undef FT_COMPONENT
|
|
+#define FT_COMPONENT trace_io
|
|
+
|
|
+ /* We use the macro STREAM_FILE for convenience to extract the */
|
|
+ /* system-specific stream handle from a given FreeType stream object */
|
|
+#define STREAM_FILE( stream ) ( (BPTR)stream->descriptor.pointer )
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* <Function> */
|
|
+ /* ft_ansi_stream_close */
|
|
+ /* */
|
|
+ /* <Description> */
|
|
+ /* The function to close a stream. */
|
|
+ /* */
|
|
+ /* <Input> */
|
|
+ /* stream :: A pointer to the stream object. */
|
|
+ /* */
|
|
+ FT_CALLBACK_DEF( void )
|
|
+ ft_ansi_stream_close( FT_Stream stream )
|
|
+ {
|
|
+ D(bug("Entering ft_ansi_stream_close(stream=%x)\n", stream));
|
|
+
|
|
+ Close( STREAM_FILE( stream ) );
|
|
+
|
|
+ stream->descriptor.pointer = NULL;
|
|
+ stream->size = 0;
|
|
+ stream->base = 0;
|
|
+
|
|
+ D(bug("Entering ft_ansi_stream_close\n"));
|
|
+ }
|
|
+
|
|
+
|
|
+ /*************************************************************************/
|
|
+ /* */
|
|
+ /* <Function> */
|
|
+ /* ft_ansi_stream_io */
|
|
+ /* */
|
|
+ /* <Description> */
|
|
+ /* The function to open a stream. */
|
|
+ /* */
|
|
+ /* <Input> */
|
|
+ /* stream :: A pointer to the stream object. */
|
|
+ /* */
|
|
+ /* offset :: The position in the data stream to start reading. */
|
|
+ /* */
|
|
+ /* buffer :: The address of buffer to store the read data. */
|
|
+ /* */
|
|
+ /* count :: The number of bytes to read from the stream. */
|
|
+ /* */
|
|
+ /* <Return> */
|
|
+ /* The number of bytes actually read. */
|
|
+ /* */
|
|
+ FT_CALLBACK_DEF( unsigned long )
|
|
+ ft_ansi_stream_io( FT_Stream stream,
|
|
+ unsigned long offset,
|
|
+ unsigned char* buffer,
|
|
+ unsigned long count )
|
|
+ {
|
|
+ BPTR file;
|
|
+ unsigned long actcount;
|
|
+
|
|
+ D(bug("Entering ft_ansi_stream_io(stream=%x,offset=%ld,buffer=%x,count=%ld)\n",
|
|
+ stream, offset, buffer, count));
|
|
+ file = STREAM_FILE( stream );
|
|
+
|
|
+ Seek( file, offset, OFFSET_BEGINNING );
|
|
+ if (count>0)
|
|
+ actcount = (unsigned long)Read( file, buffer, count );
|
|
+ else
|
|
+ actcount = 0;
|
|
+
|
|
+ D(bug("Leaving ft_ansi_stream_io actcount=%ld",actcount));
|
|
+
|
|
+ return actcount;
|
|
+ }
|
|
+
|
|
+
|
|
+ /* documentation is in ftobjs.h */
|
|
+
|
|
+ FT_EXPORT_DEF( FT_Error )
|
|
+ FT_Stream_Open( FT_Stream stream,
|
|
+ const char* filepathname )
|
|
+ {
|
|
+ BPTR file;
|
|
+
|
|
+ if ( !stream )
|
|
+ return FT_Err_Invalid_Stream_Handle;
|
|
+
|
|
+ file = Open( filepathname, MODE_OLDFILE );
|
|
+ if ( !file )
|
|
+ {
|
|
+ FT_ERROR(( "FT_Stream_Open:" ));
|
|
+ FT_ERROR(( " could not open `%s'\n", filepathname ));
|
|
+
|
|
+ return FT_Err_Cannot_Open_Resource;
|
|
+ }
|
|
+
|
|
+ Seek( file, 0, OFFSET_END );
|
|
+ stream->size = Seek( file, 0, OFFSET_BEGINNING );
|
|
+
|
|
+ stream->descriptor.pointer = (APTR)file;
|
|
+ stream->pathname.pointer = (char*)filepathname;
|
|
+ stream->pos = 0;
|
|
+
|
|
+ stream->read = ft_ansi_stream_io;
|
|
+ stream->close = ft_ansi_stream_close;
|
|
+
|
|
+ FT_TRACE1(( "FT_Stream_Open:" ));
|
|
+ FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
|
|
+ filepathname, stream->size ));
|
|
+
|
|
+ return FT_Err_Ok;
|
|
+ }
|
|
+
|
|
+
|
|
+#ifdef FT_DEBUG_MEMORY
|
|
+
|
|
+ extern FT_Int
|
|
+ ft_mem_debug_init( FT_Memory memory );
|
|
+
|
|
+ extern void
|
|
+ ft_mem_debug_done( FT_Memory memory );
|
|
+
|
|
+#endif
|
|
+
|
|
+
|
|
+ /* documentation is in ftobjs.h */
|
|
+
|
|
+ FT_EXPORT_DEF( FT_Memory )
|
|
+ FT_New_Memory( void )
|
|
+ {
|
|
+ FT_Memory memory;
|
|
+ APTR MemPool;
|
|
+
|
|
+ D(bug("Entering FT_New_Memory\n"));
|
|
+
|
|
+ MemPool = CreatePool(MEMF_ANY, 2048, 256);
|
|
+ if (MemPool)
|
|
+ {
|
|
+ memory = (FT_Memory)AllocPooled( MemPool, sizeof ( *memory ) );
|
|
+ if ( memory )
|
|
+ {
|
|
+ memory->user = (void*)MemPool;
|
|
+ memory->alloc = ft_alloc;
|
|
+ memory->realloc = ft_realloc;
|
|
+ memory->free = ft_free;
|
|
+#ifdef FT_DEBUG_MEMORY
|
|
+ ft_mem_debug_init( memory );
|
|
+#endif
|
|
+ }
|
|
+ }
|
|
+ else
|
|
+ memory=NULL;
|
|
+
|
|
+ D(bug("Leaving FT_New_Memory memory=%x\n", memory));
|
|
+
|
|
+ return memory;
|
|
+ }
|
|
+
|
|
+
|
|
+ /* documentation is in ftobjs.h */
|
|
+
|
|
+ FT_EXPORT_DEF( void )
|
|
+ FT_Done_Memory( FT_Memory memory )
|
|
+ {
|
|
+#ifdef FT_DEBUG_MEMORY
|
|
+ ft_mem_debug_done( memory );
|
|
+#endif
|
|
+ DeletePool((APTR)memory->user);
|
|
+ }
|
|
+
|
|
+
|
|
+/* END */
|
|
diff -ruN freetype-2.12.1/include/freetype/config/public-macros.h freetype-2.12.1.aros/include/freetype/config/public-macros.h
|
|
--- freetype-2.12.1/include/freetype/config/public-macros.h 2020-08-27 06:17:20.000000000 +0000
|
|
+++ freetype-2.12.1.aros/include/freetype/config/public-macros.h 2022-03-27 05:35:05.934677526 +0000
|
|
@@ -71,6 +71,8 @@
|
|
#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllimport )
|
|
#endif
|
|
|
|
+#elif defined(__AROS__)
|
|
+
|
|
/* gcc, clang */
|
|
#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ )
|
|
#define FT_PUBLIC_FUNCTION_ATTRIBUTE \
|
|
diff -ruN freetype-2.12.1/src/autofit/afcjk.c freetype-2.12.1.aros/src/autofit/afcjk.c
|
|
--- freetype-2.12.1/src/autofit/afcjk.c 2022-01-27 07:43:19.000000000 +0000
|
|
+++ freetype-2.12.1.aros/src/autofit/afcjk.c 2022-05-06 19:37:29.628118000 +0000
|
|
@@ -22,6 +22,11 @@
|
|
*
|
|
*/
|
|
|
|
+#if defined(__AROS__)
|
|
+#include <exec/exec.h>
|
|
+#include <proto/exec.h>
|
|
+#endif
|
|
+
|
|
#include <freetype/ftadvanc.h>
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
@@ -64,8 +69,16 @@
|
|
FT_Face face )
|
|
{
|
|
/* scan the array of segments in each direction */
|
|
+#if !defined(__AROS__)
|
|
AF_GlyphHintsRec hints[1];
|
|
-
|
|
+#else
|
|
+ AF_GlyphHintsRec *hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
|
|
+ if(!hints)
|
|
+ {
|
|
+ /* no reasonable error handling possible */
|
|
+ return;
|
|
+ }
|
|
+#endif
|
|
|
|
FT_TRACE5(( "\n" ));
|
|
FT_TRACE5(( "cjk standard widths computation (style `%s')\n",
|
|
@@ -82,7 +95,15 @@
|
|
FT_Error error;
|
|
FT_ULong glyph_index;
|
|
int dim;
|
|
+#if !defined(__AROS__)
|
|
AF_CJKMetricsRec dummy[1];
|
|
+#else
|
|
+ AF_CJKMetricsRec *dummy = (AF_CJKMetricsRec *) AllocVec(sizeof(AF_CJKMetricsRec) * 2, MEMF_ANY);
|
|
+ if(!dummy)
|
|
+ {
|
|
+ goto ErrorExit;
|
|
+ }
|
|
+#endif
|
|
AF_Scaler scaler = &dummy->root.scaler;
|
|
|
|
AF_StyleClass style_class = metrics->root.style_class;
|
|
@@ -263,11 +284,19 @@
|
|
}
|
|
#endif
|
|
}
|
|
+#if defined(__AROS__)
|
|
+ FreeVec(dummy);
|
|
+ ErrorExit:
|
|
+ ;
|
|
+#endif
|
|
}
|
|
|
|
FT_TRACE5(( "\n" ));
|
|
|
|
af_glyph_hints_done( hints );
|
|
+#if defined(__AROS__)
|
|
+ FreeVec(hints);
|
|
+#endif
|
|
}
|
|
|
|
|
|
diff -ruN freetype-2.12.1/src/autofit/aflatin.c freetype-2.12.1.aros/src/autofit/aflatin.c
|
|
--- freetype-2.12.1/src/autofit/aflatin.c 2022-01-27 07:43:19.000000000 +0000
|
|
+++ freetype-2.12.1.aros/src/autofit/aflatin.c 2022-05-06 19:37:29.628118000 +0000
|
|
@@ -15,6 +15,10 @@
|
|
*
|
|
*/
|
|
|
|
+#if defined(__AROS__)
|
|
+#include <exec/exec.h>
|
|
+#include <proto/exec.h>
|
|
+#endif
|
|
|
|
#include <freetype/ftadvanc.h>
|
|
#include <freetype/internal/ftdebug.h>
|
|
@@ -55,8 +59,11 @@
|
|
FT_Face face )
|
|
{
|
|
/* scan the array of segments in each direction */
|
|
+#if !defined(__AROS__)
|
|
AF_GlyphHintsRec hints[1];
|
|
-
|
|
+#else
|
|
+ AF_GlyphHintsRec *hints;
|
|
+#endif
|
|
|
|
FT_TRACE5(( "\n" ));
|
|
FT_TRACE5(( "latin standard widths computation (style `%s')\n",
|
|
@@ -64,6 +71,15 @@
|
|
FT_TRACE5(( "=====================================================\n" ));
|
|
FT_TRACE5(( "\n" ));
|
|
|
|
+#if defined(__AROS__)
|
|
+ hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
|
|
+ if(!hints)
|
|
+ {
|
|
+ /* no reasonable error handling possible */
|
|
+ return;
|
|
+ }
|
|
+#endif
|
|
+
|
|
af_glyph_hints_init( hints, face->memory );
|
|
|
|
metrics->axis[AF_DIMENSION_HORZ].width_count = 0;
|
|
@@ -73,7 +89,13 @@
|
|
FT_Error error;
|
|
FT_ULong glyph_index;
|
|
int dim;
|
|
+#if !defined(__AROS__)
|
|
AF_LatinMetricsRec dummy[1];
|
|
+#else
|
|
+ AF_LatinMetricsRec *dummy = (AF_LatinMetricsRec *) AllocVec(sizeof(AF_LatinMetricsRec) * 2, MEMF_ANY);
|
|
+ if(!dummy)
|
|
+ goto ErrorExit;
|
|
+#endif
|
|
AF_Scaler scaler = &dummy->root.scaler;
|
|
|
|
AF_StyleClass style_class = metrics->root.style_class;
|
|
@@ -259,12 +281,21 @@
|
|
FT_TRACE5(( "\n" ));
|
|
}
|
|
#endif
|
|
+
|
|
}
|
|
+#if defined(__AROS__)
|
|
+ FreeVec(dummy);
|
|
+ ErrorExit:
|
|
+ ;
|
|
+#endif
|
|
}
|
|
|
|
FT_TRACE5(( "\n" ));
|
|
|
|
af_glyph_hints_done( hints );
|
|
+#if defined(__AROS__)
|
|
+ FreeVec(hints);
|
|
+#endif
|
|
}
|
|
|
|
|
|
diff -ruN freetype-2.12.1/src/autofit/afmodule.c freetype-2.12.1.aros/src/autofit/afmodule.c
|
|
--- freetype-2.12.1/src/autofit/afmodule.c 2022-01-27 07:43:19.000000000 +0000
|
|
+++ freetype-2.12.1.aros/src/autofit/afmodule.c 2022-05-06 19:37:29.628118000 +0000
|
|
@@ -477,8 +477,25 @@
|
|
|
|
#else /* !FT_DEBUG_AUTOFIT */
|
|
|
|
+#if !defined(__AROS__)
|
|
AF_GlyphHintsRec hints[1];
|
|
+#else
|
|
+ AF_GlyphHintsRec *hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
|
|
+ if(!hints)
|
|
+ {
|
|
+ return !FT_Err_Ok; /* ? */
|
|
+ }
|
|
+#endif
|
|
+#if !defined(__AROS__)
|
|
AF_LoaderRec loader[1];
|
|
+#else
|
|
+ AF_LoaderRec *loader = (AF_LoaderRec *)AllocVec(sizeof(AF_LoaderRec) * 2, MEMF_ANY);
|
|
+ if(!loader)
|
|
+ {
|
|
+ FreeVec(hints);
|
|
+ return !FT_Err_Ok; /* ? */
|
|
+ }
|
|
+#endif
|
|
|
|
FT_UNUSED( size );
|
|
|
|
@@ -492,6 +509,11 @@
|
|
af_loader_done( loader );
|
|
af_glyph_hints_done( hints );
|
|
|
|
+#if defined(__AROS__)
|
|
+ FreeVec(hints);
|
|
+ FreeVec(loader);
|
|
+#endif
|
|
+
|
|
return error;
|
|
|
|
#endif /* !FT_DEBUG_AUTOFIT */
|