1 diff -ruN freetype-2.10.0/builds/aros/src/base/ftsystem.c freetype-2.10.0.aros/builds/aros/src/base/ftsystem.c
2 --- freetype-2.10.0/builds/aros/src/base/ftsystem.c 1970-01-01 01:00:00.000000000 +0100
3 +++ freetype-2.10.0.aros/builds/aros/src/base/ftsystem.c 2019-04-11 14:31:03.250183154 +0200
5 +/***************************************************************************/
9 +/* ANSI-specific FreeType low-level system interface (body). */
11 +/* Copyright 1996-2018 by */
12 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */
14 +/* This file is part of the FreeType project, and may only be used, */
15 +/* modified, and distributed under the terms of the FreeType project */
16 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
17 +/* this file you indicate that you have read the license and */
18 +/* understand and accept it fully. */
20 +/***************************************************************************/
22 + /*************************************************************************/
24 + /* This file contains the default interface used by FreeType to access */
25 + /* low-level, i.e. memory management, i/o access as well as thread */
26 + /* synchronisation. It can be replaced by user-specific routines if */
29 + /*************************************************************************/
32 +#include <ft2build.h>
33 +#include FT_CONFIG_CONFIG_H
34 +#include FT_INTERNAL_DEBUG_H
42 +#include <exec/types.h>
43 +#include <exec/memory.h>
45 +#include <proto/exec.h>
46 +#include <proto/dos.h>
49 +#include <aros/debug.h>
52 + /*************************************************************************/
54 + /* MEMORY MANAGEMENT INTERFACE */
56 + /*************************************************************************/
58 + /*************************************************************************/
60 + /* It is not necessary to do any error checking for the */
61 + /* allocation-related functions. This will be done by the higher level */
62 + /* routines like FT_Alloc() or FT_Realloc(). */
64 + /*************************************************************************/
67 + /*************************************************************************/
73 + /* The memory allocation function. */
76 + /* memory :: A pointer to the memory object. */
78 + /* size :: The requested size in bytes. */
81 + /* The address of newly allocated block. */
83 + FT_CALLBACK_DEF( void* )
84 + ft_alloc( FT_Memory memory,
87 + ULONG memsize = size + sizeof(ULONG);
89 + APTR MemPool = (APTR)memory->user;
91 + D(bug("Entering ft_alloc(memory=%x,size=%ld)\n", memory, size));
93 + retval = AllocPooled(MemPool, memsize);
95 + D(bug("Allocated retval=%x\n", (void*)retval));
97 + *((ULONG *)retval) = memsize;
99 + D(bug("Leaving ft_alloc retval=%x\n", (void*)((ULONG*)retval + 1)));
101 + return (void*)((ULONG*)retval + 1);
105 + /*************************************************************************/
110 + /* <Description> */
111 + /* The memory release function. */
114 + /* memory :: A pointer to the memory object. */
116 + /* block :: The address of block in memory to be freed. */
118 + FT_CALLBACK_DEF( void )
119 + ft_free( FT_Memory memory,
122 + APTR mem = (APTR)((char*)block - sizeof(ULONG));
123 + APTR MemPool = (APTR)memory->user;
125 + D(bug("Entering ft_free(memory=%x, block=%x)\n", memory, block));
127 + FreePooled( MemPool, mem, *((ULONG*)mem) );
129 + D(bug("Leaving ft_free\n"));
133 + /*************************************************************************/
138 + /* <Description> */
139 + /* The memory reallocation function. */
142 + /* memory :: A pointer to the memory object. */
144 + /* cur_size :: The current size of the allocated memory block. */
146 + /* new_size :: The newly requested size in bytes. */
148 + /* block :: The current address of the block in memory. */
151 + /* The address of the reallocated memory block. */
153 + FT_CALLBACK_DEF( void* )
154 + ft_realloc( FT_Memory memory,
161 + D(bug("Entering ft_free(memory=%x, cur_size=%ld, new_size=%ld, block=%x)\n",
162 + memory, cur_size, new_size, block));
164 + if ((retval = ft_alloc( memory, new_size )) != NULL)
166 + CopyMem( block, retval, cur_size );
167 + ft_free( memory, block );
170 + D(bug("Leaving ft_free retval=%x\n", retval));
176 + /*************************************************************************/
178 + /* RESOURCE MANAGEMENT INTERFACE */
180 + /*************************************************************************/
183 + /*************************************************************************/
185 + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
186 + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
187 + /* messages during execution. */
190 +#define FT_COMPONENT trace_io
192 + /* We use the macro STREAM_FILE for convenience to extract the */
193 + /* system-specific stream handle from a given FreeType stream object */
194 +#define STREAM_FILE( stream ) ( (BPTR)stream->descriptor.pointer )
197 + /*************************************************************************/
200 + /* ft_ansi_stream_close */
202 + /* <Description> */
203 + /* The function to close a stream. */
206 + /* stream :: A pointer to the stream object. */
208 + FT_CALLBACK_DEF( void )
209 + ft_ansi_stream_close( FT_Stream stream )
211 + D(bug("Entering ft_ansi_stream_close(stream=%x)\n", stream));
213 + Close( STREAM_FILE( stream ) );
215 + stream->descriptor.pointer = NULL;
219 + D(bug("Entering ft_ansi_stream_close\n"));
223 + /*************************************************************************/
226 + /* ft_ansi_stream_io */
228 + /* <Description> */
229 + /* The function to open a stream. */
232 + /* stream :: A pointer to the stream object. */
234 + /* offset :: The position in the data stream to start reading. */
236 + /* buffer :: The address of buffer to store the read data. */
238 + /* count :: The number of bytes to read from the stream. */
241 + /* The number of bytes actually read. */
243 + FT_CALLBACK_DEF( unsigned long )
244 + ft_ansi_stream_io( FT_Stream stream,
245 + unsigned long offset,
246 + unsigned char* buffer,
247 + unsigned long count )
250 + unsigned long actcount;
252 + D(bug("Entering ft_ansi_stream_io(stream=%x,offset=%ld,buffer=%x,count=%ld)\n",
253 + stream, offset, buffer, count));
254 + file = STREAM_FILE( stream );
256 + Seek( file, offset, OFFSET_BEGINNING );
258 + actcount = (unsigned long)Read( file, buffer, count );
262 + D(bug("Leaving ft_ansi_stream_io actcount=%ld",actcount));
268 + /* documentation is in ftobjs.h */
270 + FT_EXPORT_DEF( FT_Error )
271 + FT_Stream_Open( FT_Stream stream,
272 + const char* filepathname )
277 + return FT_Err_Invalid_Stream_Handle;
279 + file = Open( filepathname, MODE_OLDFILE );
282 + FT_ERROR(( "FT_Stream_Open:" ));
283 + FT_ERROR(( " could not open `%s'\n", filepathname ));
285 + return FT_Err_Cannot_Open_Resource;
288 + Seek( file, 0, OFFSET_END );
289 + stream->size = Seek( file, 0, OFFSET_BEGINNING );
291 + stream->descriptor.pointer = (APTR)file;
292 + stream->pathname.pointer = (char*)filepathname;
295 + stream->read = ft_ansi_stream_io;
296 + stream->close = ft_ansi_stream_close;
298 + FT_TRACE1(( "FT_Stream_Open:" ));
299 + FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
300 + filepathname, stream->size ));
306 +#ifdef FT_DEBUG_MEMORY
309 + ft_mem_debug_init( FT_Memory memory );
312 + ft_mem_debug_done( FT_Memory memory );
317 + /* documentation is in ftobjs.h */
319 + FT_EXPORT_DEF( FT_Memory )
320 + FT_New_Memory( void )
325 + D(bug("Entering FT_New_Memory\n"));
327 + MemPool = CreatePool(MEMF_ANY, 2048, 256);
330 + memory = (FT_Memory)AllocPooled( MemPool, sizeof ( *memory ) );
333 + memory->user = (void*)MemPool;
334 + memory->alloc = ft_alloc;
335 + memory->realloc = ft_realloc;
336 + memory->free = ft_free;
337 +#ifdef FT_DEBUG_MEMORY
338 + ft_mem_debug_init( memory );
345 + D(bug("Leaving FT_New_Memory memory=%x\n", memory));
351 + /* documentation is in ftobjs.h */
353 + FT_EXPORT_DEF( void )
354 + FT_Done_Memory( FT_Memory memory )
356 +#ifdef FT_DEBUG_MEMORY
357 + ft_mem_debug_done( memory );
359 + DeletePool((APTR)memory->user);
364 diff -ruN freetype-2.10.0/src/autofit/afcjk.c freetype-2.10.0.aros/src/autofit/afcjk.c
365 --- freetype-2.10.0/src/autofit/afcjk.c 2019-02-23 10:06:07.000000000 +0100
366 +++ freetype-2.10.0.aros/src/autofit/afcjk.c 2019-04-11 14:31:46.282454489 +0200
371 +#include <exec/exec.h>
372 +#include <proto/exec.h>
374 #include <ft2build.h>
375 #include FT_ADVANCES_H
376 #include FT_INTERNAL_DEBUG_H
380 /* scan the array of segments in each direction */
381 - AF_GlyphHintsRec hints[1];
383 + //AF_GlyphHintsRec hints[1];
384 + AF_GlyphHintsRec *hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
387 + /* no reasonable error handling possible */
392 "cjk standard widths computation (style `%s')\n"
395 FT_ULong glyph_index;
397 - AF_CJKMetricsRec dummy[1];
398 + //AF_CJKMetricsRec dummy[1];
399 + AF_CJKMetricsRec *dummy = (AF_CJKMetricsRec *) AllocVec(sizeof(AF_CJKMetricsRec) * 2, MEMF_ANY);
404 AF_Scaler scaler = &dummy->root.scaler;
406 AF_StyleClass style_class = metrics->root.style_class;
407 @@ -269,11 +282,15 @@
418 af_glyph_hints_done( hints );
423 diff -ruN freetype-2.10.0/src/autofit/aflatin2.c freetype-2.10.0.aros/src/autofit/aflatin2.c
424 --- freetype-2.10.0/src/autofit/aflatin2.c 2019-02-23 10:06:07.000000000 +0100
425 +++ freetype-2.10.0.aros/src/autofit/aflatin2.c 2019-04-11 14:31:46.282454489 +0200
431 #include FT_ADVANCES_H
437 /* scan the array of segments in each direction */
438 - AF_GlyphHintsRec hints[1];
440 + //AF_GlyphHintsRec hints[1];
441 + AF_GlyphHintsRec *hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
444 + /* no reasonable error handling possible */
448 af_glyph_hints_init( hints, face->memory );
454 - AF_LatinMetricsRec dummy[1];
455 + //AF_LatinMetricsRec dummy[1];
456 + AF_LatinMetricsRec *dummy = (AF_LatinMetricsRec *) AllocVec(sizeof(AF_LatinMetricsRec) * 2, MEMF_ANY);
461 AF_Scaler scaler = &dummy->root.scaler;
465 axis->standard_width = stdw;
466 axis->extra_light = 0;
472 af_glyph_hints_done( hints );
477 diff -ruN freetype-2.10.0/src/autofit/aflatin.c freetype-2.10.0.aros/src/autofit/aflatin.c
478 --- freetype-2.10.0/src/autofit/aflatin.c 2019-02-23 10:06:07.000000000 +0100
479 +++ freetype-2.10.0.aros/src/autofit/aflatin.c 2019-04-11 14:31:46.282454489 +0200
484 +#include <exec/exec.h>
485 +#include <proto/exec.h>
487 #include <ft2build.h>
488 #include FT_ADVANCES_H
492 /* scan the array of segments in each direction */
493 - AF_GlyphHintsRec hints[1];
495 + //AF_GlyphHintsRec hints[1];
496 + AF_GlyphHintsRec *hints;
499 "latin standard widths computation (style `%s')\n"
502 af_style_names[metrics->root.style_class->style] ));
504 + hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
507 + /* no reasonable error handling possible */
511 af_glyph_hints_init( hints, face->memory );
513 metrics->axis[AF_DIMENSION_HORZ].width_count = 0;
516 FT_ULong glyph_index;
518 - AF_LatinMetricsRec dummy[1];
519 + //AF_LatinMetricsRec dummy[1];
520 + AF_LatinMetricsRec *dummy = (AF_LatinMetricsRec *) AllocVec(sizeof(AF_LatinMetricsRec) * 2, MEMF_ANY);
525 AF_Scaler scaler = &dummy->root.scaler;
527 AF_StyleClass style_class = metrics->root.style_class;
528 @@ -261,12 +275,17 @@
541 af_glyph_hints_done( hints );
546 diff -ruN freetype-2.10.0/src/autofit/afmodule.c freetype-2.10.0.aros/src/autofit/afmodule.c
547 --- freetype-2.10.0/src/autofit/afmodule.c 2019-02-23 10:06:07.000000000 +0100
548 +++ freetype-2.10.0.aros/src/autofit/afmodule.c 2019-04-11 14:31:46.282454489 +0200
551 #else /* !FT_DEBUG_AUTOFIT */
553 - AF_GlyphHintsRec hints[1];
554 - AF_LoaderRec loader[1];
555 + //AF_GlyphHintsRec hints[1];
556 + AF_GlyphHintsRec *hints = (AF_GlyphHintsRec *)AllocVec(sizeof(AF_GlyphHintsRec) * 2, MEMF_ANY);
559 + return !FT_Err_Ok; /* ? */
561 + //AF_LoaderRec loader[1];
562 + AF_LoaderRec *loader = (AF_LoaderRec *)AllocVec(sizeof(AF_LoaderRec) * 2, MEMF_ANY);
566 + return !FT_Err_Ok; /* ? */
572 af_loader_done( loader );
573 af_glyph_hints_done( hints );
580 #endif /* !FT_DEBUG_AUTOFIT */