2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftmisc.h
|
|
|
|
*
|
|
|
|
* Miscellaneous macros for stand-alone rasterizer (specification
|
|
|
|
* only).
|
|
|
|
*
|
2022-01-11 10:54:10 +01:00
|
|
|
* Copyright (C) 2005-2022 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* 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 is *not* portable! You have to adapt
|
|
|
|
* its definitions to your platform.
|
|
|
|
*
|
|
|
|
*/
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef FTMISC_H_
|
|
|
|
#define FTMISC_H_
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
2010-07-09 09:55:29 +02:00
|
|
|
|
2009-01-13 18:34:48 +01:00
|
|
|
/* memset */
|
|
|
|
#include FT_CONFIG_STANDARD_LIBRARY_H
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
|
|
|
#define FT_BEGIN_HEADER
|
|
|
|
#define FT_END_HEADER
|
|
|
|
|
|
|
|
#define FT_LOCAL_DEF( x ) static x
|
|
|
|
|
2010-07-09 09:55:29 +02:00
|
|
|
|
Another adjustment to header locations.
This change is a result of a discussion thread on freetype-devel
http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html
Re-introduce the `freetype2' subdirectory for all FreeType header
files after installation, and rename the `freetype2' subdirectory in
the git repository to `freetype'.
* include/freetype2: Renamed to...
* include/freetype: This.
* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS): Updated.
Update creation of `ftconfig.h'.
Install generated `ftconfig.h'.
* Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.
* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/freetype2.in: Updated.
* builds/unix/freetype-config.in: Updated.
* builds/unix/configure.raw: Don't check for `rmdir'.
* builds/unix/unix-def.in (DELDIR): Use `rm -rf', which is portable
according to the autoconf info manual.
* builds/unix/install.mk (install, uninstall,
distclean_project_unix): Update and simplify.
* builds/wince/*, builds/windows/*: Updated.
* devel/ft2build.h, include/ft2build.h: Updated.
* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.
* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.
* docs/*: Updated.
2015-06-25 13:04:57 +02:00
|
|
|
/* from include/freetype/fttypes.h */
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
|
|
|
typedef unsigned char FT_Byte;
|
|
|
|
typedef signed int FT_Int;
|
|
|
|
typedef unsigned int FT_UInt;
|
|
|
|
typedef signed long FT_Long;
|
|
|
|
typedef unsigned long FT_ULong;
|
|
|
|
typedef signed long FT_F26Dot6;
|
|
|
|
typedef int FT_Error;
|
|
|
|
|
2021-11-19 21:50:22 +01:00
|
|
|
|
|
|
|
#define FT_STATIC_BYTE_CAST( type, var ) (type)(FT_Byte)(var)
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
|
|
|
|
Another adjustment to header locations.
This change is a result of a discussion thread on freetype-devel
http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html
Re-introduce the `freetype2' subdirectory for all FreeType header
files after installation, and rename the `freetype2' subdirectory in
the git repository to `freetype'.
* include/freetype2: Renamed to...
* include/freetype: This.
* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS): Updated.
Update creation of `ftconfig.h'.
Install generated `ftconfig.h'.
* Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.
* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/freetype2.in: Updated.
* builds/unix/freetype-config.in: Updated.
* builds/unix/configure.raw: Don't check for `rmdir'.
* builds/unix/unix-def.in (DELDIR): Use `rm -rf', which is portable
according to the autoconf info manual.
* builds/unix/install.mk (install, uninstall,
distclean_project_unix): Update and simplify.
* builds/wince/*, builds/windows/*: Updated.
* devel/ft2build.h, include/ft2build.h: Updated.
* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.
* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.
* docs/*: Updated.
2015-06-25 13:04:57 +02:00
|
|
|
/* from include/freetype/ftsystem.h */
|
2009-09-03 13:14:24 +02:00
|
|
|
|
|
|
|
typedef struct FT_MemoryRec_* FT_Memory;
|
|
|
|
|
|
|
|
typedef void* (*FT_Alloc_Func)( FT_Memory memory,
|
2018-10-27 04:52:25 +02:00
|
|
|
long size );
|
2009-09-03 13:14:24 +02:00
|
|
|
|
|
|
|
typedef void (*FT_Free_Func)( FT_Memory memory,
|
|
|
|
void* block );
|
|
|
|
|
|
|
|
typedef void* (*FT_Realloc_Func)( FT_Memory memory,
|
2018-10-27 04:52:25 +02:00
|
|
|
long cur_size,
|
|
|
|
long new_size,
|
2009-09-03 13:14:24 +02:00
|
|
|
void* block );
|
|
|
|
|
|
|
|
typedef struct FT_MemoryRec_
|
|
|
|
{
|
|
|
|
void* user;
|
|
|
|
|
|
|
|
FT_Alloc_Func alloc;
|
|
|
|
FT_Free_Func free;
|
|
|
|
FT_Realloc_Func realloc;
|
|
|
|
|
|
|
|
} FT_MemoryRec;
|
|
|
|
|
2010-07-09 09:55:29 +02:00
|
|
|
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
/* from src/ftcalc.c */
|
|
|
|
|
2010-07-09 09:55:29 +02:00
|
|
|
#if ( defined _WIN32 || defined _WIN64 )
|
|
|
|
|
|
|
|
typedef __int64 FT_Int64;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include "inttypes.h"
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
|
|
|
typedef int64_t FT_Int64;
|
|
|
|
|
2010-07-09 09:55:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
static FT_Long
|
|
|
|
FT_MulDiv( FT_Long a,
|
|
|
|
FT_Long b,
|
|
|
|
FT_Long c )
|
|
|
|
{
|
|
|
|
FT_Int s;
|
|
|
|
FT_Long d;
|
|
|
|
|
|
|
|
|
|
|
|
s = 1;
|
|
|
|
if ( a < 0 ) { a = -a; s = -1; }
|
|
|
|
if ( b < 0 ) { b = -b; s = -s; }
|
|
|
|
if ( c < 0 ) { c = -c; s = -s; }
|
|
|
|
|
|
|
|
d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
|
|
|
|
: 0x7FFFFFFFL );
|
|
|
|
|
|
|
|
return ( s > 0 ) ? d : -d;
|
|
|
|
}
|
|
|
|
|
2012-06-06 13:24:04 +02:00
|
|
|
|
|
|
|
static FT_Long
|
|
|
|
FT_MulDiv_No_Round( FT_Long a,
|
|
|
|
FT_Long b,
|
|
|
|
FT_Long c )
|
|
|
|
{
|
|
|
|
FT_Int s;
|
|
|
|
FT_Long d;
|
|
|
|
|
|
|
|
|
|
|
|
s = 1;
|
|
|
|
if ( a < 0 ) { a = -a; s = -1; }
|
|
|
|
if ( b < 0 ) { b = -b; s = -s; }
|
|
|
|
if ( c < 0 ) { c = -c; s = -s; }
|
|
|
|
|
|
|
|
d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
|
|
|
|
: 0x7FFFFFFFL );
|
|
|
|
|
|
|
|
return ( s > 0 ) ? d : -d;
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* FTMISC_H_ */
|
* src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
2005-05-19 09:20:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|