2000-07-19 22:02:14 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
2000-07-26 16:11:15 +02:00
|
|
|
/* ahoptim.h */
|
2000-07-19 22:02:14 +02:00
|
|
|
/* */
|
2000-07-26 16:11:15 +02:00
|
|
|
/* FreeType auto hinting outline optimization (declaration). */
|
2000-07-19 22:02:14 +02:00
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
/* Copyright 2000-2001 Catharon Productions Inc. */
|
2000-07-19 22:02:14 +02:00
|
|
|
/* Author: David Turner */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the Catharon Typography Project and shall only */
|
|
|
|
/* be used, modified, and distributed under the terms of the Catharon */
|
|
|
|
/* Open Source License that should come with this file under the name */
|
2000-07-26 16:11:15 +02:00
|
|
|
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
|
2000-07-19 22:02:14 +02:00
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
2000-07-26 16:11:15 +02:00
|
|
|
/* Note that this license is compatible with the FreeType license. */
|
2000-07-19 22:02:14 +02:00
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
#ifndef __AHOPTIM_H__
|
|
|
|
#define __AHOPTIM_H__
|
2000-07-26 16:11:15 +02:00
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ahtypes.h"
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
FT_BEGIN_HEADER
|
2000-08-01 15:17:04 +02:00
|
|
|
|
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
/* the maximal number of stem configurations to record */
|
|
|
|
/* during optimization */
|
2000-07-19 22:02:14 +02:00
|
|
|
#define AH_MAX_CONFIGS 8
|
|
|
|
|
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
typedef struct AH_Stem_
|
2000-07-19 22:02:14 +02:00
|
|
|
{
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Pos pos; /* current position */
|
|
|
|
FT_Pos velocity; /* current velocity */
|
|
|
|
FT_Pos force; /* sum of current forces */
|
|
|
|
FT_Pos width; /* normalized width */
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Pos min_pos; /* minimum grid position */
|
|
|
|
FT_Pos max_pos; /* maximum grid position */
|
2000-07-19 22:02:14 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
AH_Edge edge1; /* left/bottom edge */
|
|
|
|
AH_Edge edge2; /* right/top edge */
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Pos opos; /* original position */
|
|
|
|
FT_Pos owidth; /* original width */
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Pos min_coord; /* minimum coordinate */
|
|
|
|
FT_Pos max_coord; /* maximum coordinate */
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
} AH_Stem;
|
|
|
|
|
|
|
|
|
|
|
|
/* A spring between two stems */
|
2000-07-26 16:11:15 +02:00
|
|
|
typedef struct AH_Spring_
|
2000-07-19 22:02:14 +02:00
|
|
|
{
|
|
|
|
AH_Stem* stem1;
|
|
|
|
AH_Stem* stem2;
|
|
|
|
FT_Pos owidth; /* original width */
|
|
|
|
FT_Pos tension; /* current tension */
|
|
|
|
|
|
|
|
} AH_Spring;
|
|
|
|
|
|
|
|
|
|
|
|
/* A configuration records the position of each stem at a given time */
|
2000-07-26 16:11:15 +02:00
|
|
|
/* as well as the associated distortion */
|
2000-07-19 22:02:14 +02:00
|
|
|
typedef struct AH_Configuration_
|
|
|
|
{
|
|
|
|
FT_Pos* positions;
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Long distortion;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
} AH_Configuration;
|
|
|
|
|
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
typedef struct AH_Optimizer_
|
2000-07-19 22:02:14 +02:00
|
|
|
{
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Memory memory;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
AH_Outline outline;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Int num_hstems;
|
|
|
|
AH_Stem* horz_stems;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Int num_vstems;
|
|
|
|
AH_Stem* vert_stems;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Int num_hsprings;
|
|
|
|
FT_Int num_vsprings;
|
|
|
|
AH_Spring* horz_springs;
|
|
|
|
AH_Spring* vert_springs;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
FT_Int num_configs;
|
2000-07-26 16:11:15 +02:00
|
|
|
AH_Configuration configs[AH_MAX_CONFIGS];
|
2000-07-19 22:02:14 +02:00
|
|
|
FT_Pos* positions;
|
|
|
|
|
|
|
|
/* during each pass, use these instead */
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Int num_stems;
|
|
|
|
AH_Stem* stems;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Int num_springs;
|
|
|
|
AH_Spring* springs;
|
|
|
|
FT_Bool vertical;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
FT_Fixed tension_scale;
|
|
|
|
FT_Pos tension_threshold;
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
} AH_Optimizer;
|
|
|
|
|
|
|
|
|
|
|
|
/* loads the outline into the optimizer */
|
2001-06-27 18:18:10 +02:00
|
|
|
int
|
|
|
|
AH_Optimizer_Init( AH_Optimizer* optimizer,
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
AH_Outline outline,
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_Memory memory );
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* compute optimal outline */
|
2001-06-27 18:18:10 +02:00
|
|
|
void
|
|
|
|
AH_Optimizer_Compute( AH_Optimizer* optimizer );
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
/* release the optimization data */
|
2001-06-27 18:18:10 +02:00
|
|
|
void
|
|
|
|
AH_Optimizer_Done( AH_Optimizer* optimizer );
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
FT_END_HEADER
|
2000-08-01 15:17:04 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
#endif /* __AHOPTIM_H__ */
|
2000-07-19 22:02:14 +02:00
|
|
|
|
|
|
|
|
2000-07-26 16:11:15 +02:00
|
|
|
/* END */
|