2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: FreeType implementation for ReactOS
4 * PURPOSE: Glue functions between FreeType
5 * FILE: win32ss/drivers/font/ftfd/rosglue.c
6 * PROGRAMMER: Ge van Geldorp (ge@gse.nl)
15 #define TAG_FREETYPE 'PYTF'
18 * First some generic routines
22 DbgPrint(IN PCCH Format
, IN
...)
26 va_start(args
, Format
);
27 EngDebugPrint("ft2: ", (PCHAR
)Format
, args
);
35 * Because of realloc, we need to keep track of the size of the allocated
36 * buffer (need to copy the old contents to the new buffer). So, allocate
37 * extra space for a size_t, store the allocated size in there and return
38 * the address just past it as the allocated buffer.
46 Object
= EngAllocMem(0, sizeof(size_t) + Size
, TAG_FREETYPE
);
49 *((size_t *)Object
) = Size
;
50 Object
= (void *)((size_t *)Object
+ 1);
57 realloc(void *Object
, size_t Size
)
62 NewObject
= EngAllocMem(0, sizeof(size_t) + Size
, TAG_FREETYPE
);
63 if (NewObject
!= NULL
)
65 *((size_t *)NewObject
) = Size
;
66 NewObject
= (void *)((size_t *)NewObject
+ 1);
67 CopySize
= *((size_t *)Object
- 1);
72 memcpy(NewObject
, Object
, CopySize
);
73 EngFreeMem((size_t *)Object
- 1);
84 EngFreeMem((size_t *)Object
- 1);
91 * This is easy, we don't want FreeType to do any I/O. So return an
92 * error on each I/O attempt. Note that errno is not being set, it is
93 * not used by FreeType.
97 fopen(const char *FileName
, const char *Mode
)
99 DPRINT1("Freetype tries to open file %s\n", FileName
);
104 fseek(FILE *Stream
, long Offset
, int Origin
)
106 DPRINT1("Doubleplus ungood: freetype shouldn't fseek!\n");
113 DPRINT1("Doubleplus ungood: freetype shouldn't ftell!\n");
118 fread(void *Buffer
, size_t Size
, size_t Count
, FILE *Stream
)
120 DPRINT1("Doubleplus ungood: freetype shouldn't fread!\n");
127 DPRINT1("Doubleplus ungood: freetype shouldn't fclose!\n");