now replaced by 'autofit'david-pic-changes
parent
ebf5585dd0
commit
665279f0d5
21 changed files with 5 additions and 5516 deletions
@ -1,123 +0,0 @@ |
||||
The Catharon Open Source LICENSE |
||||
---------------------------- |
||||
|
||||
2000-Jul-04 |
||||
|
||||
Copyright (C) 2000 by Catharon Productions, Inc. |
||||
|
||||
|
||||
|
||||
Introduction |
||||
============ |
||||
|
||||
This license applies to source files distributed by Catharon |
||||
Productions, Inc. in several archive packages. This license |
||||
applies to all files found in such packages which do not fall |
||||
under their own explicit license. |
||||
|
||||
This license was inspired by the BSD, Artistic, and IJG |
||||
(Independent JPEG Group) licenses, which all encourage inclusion |
||||
and use of free software in commercial and freeware products |
||||
alike. As a consequence, its main points are that: |
||||
|
||||
o We don't promise that this software works. However, we are |
||||
interested in any kind of bug reports. (`as is' distribution) |
||||
|
||||
o You can use this software for whatever you want, in parts or |
||||
full form, without having to pay us. (`royalty-free' usage) |
||||
|
||||
o You may not pretend that you wrote this software. If you use |
||||
it, or only parts of it, in a program, you must acknowledge |
||||
somewhere in your documentation that you have used the |
||||
Catharon Code. (`credits') |
||||
|
||||
We specifically permit and encourage the inclusion of this |
||||
software, with or without modifications, in commercial products. |
||||
We disclaim all warranties covering the packages distributed by |
||||
Catharon Productions, Inc. and assume no liability related to |
||||
their use. |
||||
|
||||
|
||||
Legal Terms |
||||
=========== |
||||
|
||||
0. Definitions |
||||
-------------- |
||||
|
||||
Throughout this license, the terms `Catharon Package', `package', |
||||
and `Catharon Code' refer to the set of files originally |
||||
distributed by Catharon Productions, Inc. |
||||
|
||||
`You' refers to the licensee, or person using the project, where |
||||
`using' is a generic term including compiling the project's source |
||||
code as well as linking it to form a `program' or `executable'. |
||||
This program is referred to as `a program using one of the |
||||
Catharon Packages'. |
||||
|
||||
This license applies to all files distributed in the original |
||||
Catharon Package(s), including all source code, binaries and |
||||
documentation, unless otherwise stated in the file in its |
||||
original, unmodified form as distributed in the original archive. |
||||
If you are unsure whether or not a particular file is covered by |
||||
this license, you must contact us to verify this. |
||||
|
||||
The Catharon Packages are copyright (C) 2000 by Catharon |
||||
Productions, Inc. All rights reserved except as specified below. |
||||
|
||||
1. No Warranty |
||||
-------------- |
||||
|
||||
THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY |
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS |
||||
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO |
||||
USE THE CATHARON PACKAGE. |
||||
|
||||
2. Redistribution |
||||
----------------- |
||||
|
||||
This license grants a worldwide, royalty-free, perpetual and |
||||
irrevocable right and license to use, execute, perform, compile, |
||||
display, copy, create derivative works of, distribute and |
||||
sublicense the Catharon Packages (in both source and object code |
||||
forms) and derivative works thereof for any purpose; and to |
||||
authorize others to exercise some or all of the rights granted |
||||
herein, subject to the following conditions: |
||||
|
||||
o Redistribution of source code must retain this license file |
||||
(`license.txt') unaltered; any additions, deletions or changes |
||||
to the original files must be clearly indicated in |
||||
accompanying documentation. The copyright notices of the |
||||
unaltered, original files must be preserved in all copies of |
||||
source files. |
||||
|
||||
o Redistribution in binary form must provide a disclaimer that |
||||
states that the software is based in part on the work of |
||||
Catharon Productions, Inc. in the distribution documentation. |
||||
|
||||
These conditions apply to any software derived from or based on |
||||
the Catharon Packages, not just the unmodified files. If you use |
||||
our work, you must acknowledge us. However, no fee need be paid |
||||
to us. |
||||
|
||||
3. Advertising |
||||
-------------- |
||||
|
||||
Neither Catharon Productions, Inc. and contributors nor you shall |
||||
use the name of the other for commercial, advertising, or |
||||
promotional purposes without specific prior written permission. |
||||
|
||||
We suggest, but do not require, that you use the following phrase |
||||
to refer to this software in your documentation: 'this software is |
||||
based in part on the Catharon Typography Project'. |
||||
|
||||
As you have not signed this license, you are not required to |
||||
accept it. However, as the Catharon Packages are copyrighted |
||||
material, only this license, or another one contracted with the |
||||
authors, grants you the right to use, distribute, and modify it. |
||||
Therefore, by using, distributing, or modifying the Catharon |
||||
Packages, you indicate that you understand and accept all the |
||||
terms of this license. |
||||
|
||||
--- end of license.txt --- |
@ -1,21 +0,0 @@ |
||||
# FreeType 2 src/autohint Jamfile (c) 2001 David Turner |
||||
# |
||||
|
||||
SubDir FT2_TOP $(FT2_SRC_DIR) autohint ; |
||||
|
||||
{ |
||||
local _sources ; |
||||
|
||||
if $(FT2_MULTI) |
||||
{ |
||||
_sources = ahangles ahglobal ahglyph ahhint ahmodule ; |
||||
} |
||||
else |
||||
{ |
||||
_sources = autohint ; |
||||
} |
||||
|
||||
Library $(FT2_LIB) : $(_sources).c ; |
||||
} |
||||
|
||||
# end of src/autohint Jamfile |
@ -1,148 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahangles.c */ |
||||
/* */ |
||||
/* Routines used to compute vector angles with limited accuracy */ |
||||
/* and very high speed (body). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002, 2005 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include "ahangles.h" |
||||
|
||||
|
||||
/* the following table has been automatically generated with */ |
||||
/* the `mather.py' Python script */ |
||||
|
||||
const AH_Angle ah_arctan[1L << AH_ATAN_BITS] = |
||||
{ |
||||
0, 0, 1, 1, 1, 2, 2, 2, |
||||
3, 3, 3, 3, 4, 4, 4, 5, |
||||
5, 5, 6, 6, 6, 7, 7, 7, |
||||
8, 8, 8, 9, 9, 9, 10, 10, |
||||
10, 10, 11, 11, 11, 12, 12, 12, |
||||
13, 13, 13, 14, 14, 14, 14, 15, |
||||
15, 15, 16, 16, 16, 17, 17, 17, |
||||
18, 18, 18, 18, 19, 19, 19, 20, |
||||
20, 20, 21, 21, 21, 21, 22, 22, |
||||
22, 23, 23, 23, 24, 24, 24, 24, |
||||
25, 25, 25, 26, 26, 26, 26, 27, |
||||
27, 27, 28, 28, 28, 28, 29, 29, |
||||
29, 30, 30, 30, 30, 31, 31, 31, |
||||
31, 32, 32, 32, 33, 33, 33, 33, |
||||
34, 34, 34, 34, 35, 35, 35, 35, |
||||
36, 36, 36, 36, 37, 37, 37, 38, |
||||
38, 38, 38, 39, 39, 39, 39, 40, |
||||
40, 40, 40, 41, 41, 41, 41, 42, |
||||
42, 42, 42, 42, 43, 43, 43, 43, |
||||
44, 44, 44, 44, 45, 45, 45, 45, |
||||
46, 46, 46, 46, 46, 47, 47, 47, |
||||
47, 48, 48, 48, 48, 48, 49, 49, |
||||
49, 49, 50, 50, 50, 50, 50, 51, |
||||
51, 51, 51, 51, 52, 52, 52, 52, |
||||
52, 53, 53, 53, 53, 53, 54, 54, |
||||
54, 54, 54, 55, 55, 55, 55, 55, |
||||
56, 56, 56, 56, 56, 57, 57, 57, |
||||
57, 57, 57, 58, 58, 58, 58, 58, |
||||
59, 59, 59, 59, 59, 59, 60, 60, |
||||
60, 60, 60, 61, 61, 61, 61, 61, |
||||
61, 62, 62, 62, 62, 62, 62, 63, |
||||
63, 63, 63, 63, 63, 64, 64, 64 |
||||
}; |
||||
|
||||
|
||||
FT_LOCAL_DEF( AH_Angle ) |
||||
ah_angle( FT_Vector* v ) |
||||
{ |
||||
FT_Pos dx, dy; |
||||
AH_Angle angle; |
||||
|
||||
|
||||
dx = v->x; |
||||
dy = v->y; |
||||
|
||||
/* check trivial cases */ |
||||
if ( dy == 0 ) |
||||
{ |
||||
angle = 0; |
||||
if ( dx < 0 ) |
||||
angle = AH_PI; |
||||
return angle; |
||||
} |
||||
else if ( dx == 0 ) |
||||
{ |
||||
angle = AH_HALF_PI; |
||||
if ( dy < 0 ) |
||||
angle = -AH_HALF_PI; |
||||
return angle; |
||||
} |
||||
|
||||
angle = 0; |
||||
if ( dx < 0 ) |
||||
{ |
||||
dx = -v->x; |
||||
dy = -v->y; |
||||
angle = AH_PI; |
||||
} |
||||
|
||||
if ( dy < 0 ) |
||||
{ |
||||
FT_Pos tmp; |
||||
|
||||
|
||||
tmp = dx; |
||||
dx = -dy; |
||||
dy = tmp; |
||||
angle -= AH_HALF_PI; |
||||
} |
||||
|
||||
if ( dx == 0 && dy == 0 ) |
||||
return 0; |
||||
|
||||
if ( dx == dy ) |
||||
angle += AH_PI / 4; |
||||
else if ( dx > dy ) |
||||
angle += ah_arctan[FT_DivFix( dy, dx ) >> ( 16 - AH_ATAN_BITS )]; |
||||
else |
||||
angle += AH_HALF_PI - |
||||
ah_arctan[FT_DivFix( dx, dy ) >> ( 16 - AH_ATAN_BITS )]; |
||||
|
||||
if ( angle > AH_PI ) |
||||
angle -= AH_2PI; |
||||
|
||||
return angle; |
||||
} |
||||
|
||||
|
||||
FT_LOCAL_DEF( AH_Angle ) |
||||
ah_angle_diff( AH_Angle angle1, |
||||
AH_Angle angle2 ) |
||||
{ |
||||
AH_Angle delta; |
||||
|
||||
|
||||
delta = ( angle2 - angle1 ); |
||||
if ( delta < 0 ) |
||||
delta += AH_2PI; |
||||
|
||||
if ( delta > AH_PI ) |
||||
delta -= AH_2PI; |
||||
|
||||
return delta; |
||||
}
|
||||
|
||||
|
||||
/* END */ |
@ -1,64 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahangles.h */ |
||||
/* */ |
||||
/* A routine used to compute vector angles with limited accuracy */ |
||||
/* and very high speed (specification). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHANGLES_H__ |
||||
#define __AHANGLES_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include FT_INTERNAL_OBJECTS_H |
||||
#include "ahtypes.h" |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
/* PI expressed in ah_angles -- we don't really need an important */ |
||||
/* precision, so 256 should be enough */ |
||||
#define AH_PI 256 |
||||
#define AH_2PI ( AH_PI * 2 ) |
||||
#define AH_HALF_PI ( AH_PI / 2 ) |
||||
#define AH_2PIMASK ( AH_2PI - 1 ) |
||||
|
||||
/* the number of bits used to express an arc tangent; */ |
||||
/* see the structure of the lookup table */ |
||||
#define AH_ATAN_BITS 8 |
||||
|
||||
extern |
||||
const AH_Angle ah_arctan[1L << AH_ATAN_BITS]; |
||||
|
||||
|
||||
FT_LOCAL( AH_Angle ) |
||||
ah_angle( FT_Vector* v ); |
||||
|
||||
|
||||
FT_LOCAL( AH_Angle ) |
||||
ah_angle_diff( AH_Angle angle1, |
||||
AH_Angle angle2 ); |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHANGLES_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -1,40 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* aherrors.h */ |
||||
/* */ |
||||
/* Autohinter error codes (specification only). */ |
||||
/* */ |
||||
/* Copyright 2001 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 is used to define the Autohinter error enumeration */ |
||||
/* constants. */ |
||||
/* */ |
||||
/*************************************************************************/ |
||||
|
||||
#ifndef __AHERRORS_H__ |
||||
#define __AHERRORS_H__ |
||||
|
||||
#include FT_MODULE_ERRORS_H |
||||
|
||||
#undef __FTERRORS_H__ |
||||
|
||||
#define FT_ERR_PREFIX AH_Err_ |
||||
#define FT_ERR_BASE FT_Mod_Err_Autohint |
||||
|
||||
#include FT_ERRORS_H |
||||
|
||||
#endif /* __AHERRORS_H__ */ |
||||
|
||||
/* END */ |
@ -1,402 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahglobal.c */ |
||||
/* */ |
||||
/* Routines used to compute global metrics automatically (body). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include FT_INTERNAL_DEBUG_H |
||||
#include "ahglobal.h" |
||||
#include "ahglyph.h" |
||||
|
||||
|
||||
#define MAX_TEST_CHARACTERS 12 |
||||
|
||||
/* cf. AH_BLUE_XXX constants in ahtypes.h */ |
||||
|
||||
static |
||||
const char* const blue_chars[AH_BLUE_MAX] = |
||||
{ |
||||
"THEZOCQS", |
||||
"HEZLOCUS", |
||||
#ifdef FT_CONFIG_CHESTER_SMALL_F |
||||
"fijkdbh", |
||||
#endif |
||||
"xzroesc", |
||||
"xzroesc", |
||||
"pqgjy" |
||||
}; |
||||
|
||||
|
||||
/* simple insertion sort */ |
||||
static void |
||||
sort_values( FT_Int count, |
||||
FT_Pos* table ) |
||||
{ |
||||
FT_Int i, j; |
||||
FT_Pos swap; |
||||
|
||||
|
||||
for ( i = 1; i < count; i++ ) |
||||
{ |
||||
for ( j = i; j > 0; j-- ) |
||||
{ |
||||
if ( table[j] > table[j - 1] ) |
||||
break; |
||||
|
||||
swap = table[j]; |
||||
table[j] = table[j - 1]; |
||||
table[j - 1] = swap; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
static FT_Error |
||||
ah_hinter_compute_blues( AH_Hinter hinter ) |
||||
{ |
||||
AH_Blue blue; |
||||
AH_Globals globals = &hinter->globals->design; |
||||
FT_Pos flats [MAX_TEST_CHARACTERS]; |
||||
FT_Pos rounds[MAX_TEST_CHARACTERS]; |
||||
FT_Int num_flats; |
||||
FT_Int num_rounds; |
||||
|
||||
FT_Face face; |
||||
FT_GlyphSlot glyph; |
||||
FT_Error error; |
||||
FT_CharMap charmap; |
||||
|
||||
|
||||
face = hinter->face; |
||||
glyph = face->glyph; |
||||
|
||||
/* save current charmap */ |
||||
charmap = face->charmap; |
||||
|
||||
/* do we have a Unicode charmap in there? */ |
||||
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); |
||||
if ( error ) |
||||
goto Exit; |
||||
|
||||
/* we compute the blues simply by loading each character from the */ |
||||
/* `blue_chars[blues]' string, then compute its top-most or */ |
||||
/* bottom-most points (depending on `AH_IS_TOP_BLUE') */ |
||||
|
||||
AH_LOG(( "blue zones computation\n" )); |
||||
AH_LOG(( "------------------------------------------------\n" )); |
||||
|
||||
for ( blue = AH_BLUE_CAPITAL_TOP; blue < AH_BLUE_MAX; blue++ ) |
||||
{ |
||||
const char* p = blue_chars[blue]; |
||||
const char* limit = p + MAX_TEST_CHARACTERS; |
||||
|
||||
FT_Pos *blue_ref, *blue_shoot; |
||||
|
||||
|
||||
AH_LOG(( "blue %3d: ", blue )); |
||||
|
||||
num_flats = 0; |
||||
num_rounds = 0; |
||||
|
||||
for ( ; p < limit; p++ ) |
||||
{ |
||||
FT_UInt glyph_index; |
||||
FT_Vector* extremum; |
||||
FT_Vector* points; |
||||
FT_Vector* point_limit; |
||||
FT_Vector* point; |
||||
FT_Bool round; |
||||
|
||||
|
||||
/* exit if we reach the end of the string */ |
||||
if ( !*p ) |
||||
break; |
||||
|
||||
AH_LOG(( "`%c'", *p )); |
||||
|
||||
/* load the character in the face -- skip unknown or empty ones */ |
||||
glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); |
||||
if ( glyph_index == 0 ) |
||||
continue; |
||||
|
||||
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); |
||||
if ( error || glyph->outline.n_points <= 0 ) |
||||
continue; |
||||
|
||||
/* now compute min or max point indices and coordinates */ |
||||
points = glyph->outline.points; |
||||
point_limit = points + glyph->outline.n_points; |
||||
point = points; |
||||
extremum = point; |
||||
point++; |
||||
|
||||
if ( AH_IS_TOP_BLUE( blue ) ) |
||||
{ |
||||
for ( ; point < point_limit; point++ ) |
||||
if ( point->y > extremum->y ) |
||||
extremum = point; |
||||
} |
||||
else |
||||
{ |
||||
for ( ; point < point_limit; point++ ) |
||||
if ( point->y < extremum->y ) |
||||
extremum = point; |
||||
} |
||||
|
||||
AH_LOG(( "%5d", (int)extremum->y )); |
||||
|
||||
/* now, check whether the point belongs to a straight or round */ |
||||
/* segment; we first need to find in which contour the extremum */ |
||||
/* lies, then see its previous and next points */ |
||||
{ |
||||
FT_Int idx = (FT_Int)( extremum - points ); |
||||
FT_Int n; |
||||
FT_Int first, last, prev, next, end; |
||||
FT_Pos dist; |
||||
|
||||
|
||||
last = -1; |
||||
first = 0; |
||||
|
||||
for ( n = 0; n < glyph->outline.n_contours; n++ ) |
||||
{ |
||||
end = glyph->outline.contours[n]; |
||||
if ( end >= idx ) |
||||
{ |
||||
last = end; |
||||
break; |
||||
} |
||||
first = end + 1; |
||||
} |
||||
|
||||
/* XXX: should never happen! */ |
||||
if ( last < 0 ) |
||||
continue; |
||||
|
||||
/* now look for the previous and next points that are not on the */ |
||||
/* same Y coordinate. Threshold the `closeness'... */ |
||||
|
||||
prev = idx; |
||||
next = prev; |
||||
|
||||
do |
||||
{ |
||||
if ( prev > first ) |
||||
prev--; |
||||
else |
||||
prev = last; |
||||
|
||||
dist = points[prev].y - extremum->y; |
||||
if ( dist < -5 || dist > 5 ) |
||||
break; |
||||
|
||||
} while ( prev != idx ); |
||||
|
||||
do |
||||
{ |
||||
if ( next < last ) |
||||
next++; |
||||
else |
||||
next = first; |
||||
|
||||
dist = points[next].y - extremum->y; |
||||
if ( dist < -5 || dist > 5 ) |
||||
break; |
||||
|
||||
} while ( next != idx ); |
||||
|
||||
/* now, set the `round' flag depending on the segment's kind */ |
||||
round = FT_BOOL( |
||||
FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_CURVE_TAG_ON || |
||||
FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_CURVE_TAG_ON ); |
||||
|
||||
AH_LOG(( "%c ", round ? 'r' : 'f' )); |
||||
} |
||||
|
||||
if ( round ) |
||||
rounds[num_rounds++] = extremum->y; |
||||
else |
||||
flats[num_flats++] = extremum->y; |
||||
} |
||||
|
||||
AH_LOG(( "\n" )); |
||||
|
||||
/* we have computed the contents of the `rounds' and `flats' tables, */ |
||||
/* now determine the reference and overshoot position of the blue -- */ |
||||
/* we simply take the median value after a simple sort */ |
||||
sort_values( num_rounds, rounds ); |
||||
sort_values( num_flats, flats ); |
||||
|
||||
blue_ref = globals->blue_refs + blue; |
||||
blue_shoot = globals->blue_shoots + blue; |
||||
if ( num_flats == 0 && num_rounds == 0 ) |
||||
{ |
||||
*blue_ref = -10000; |
||||
*blue_shoot = -10000; |
||||
} |
||||
else if ( num_flats == 0 ) |
||||
{ |
||||
*blue_ref = |
||||
*blue_shoot = rounds[num_rounds / 2]; |
||||
} |
||||
else if ( num_rounds == 0 ) |
||||
{ |
||||
*blue_ref = |
||||
*blue_shoot = flats[num_flats / 2]; |
||||
} |
||||
else |
||||
{ |
||||
*blue_ref = flats[num_flats / 2]; |
||||
*blue_shoot = rounds[num_rounds / 2]; |
||||
} |
||||
|
||||
/* there are sometimes problems: if the overshoot position of top */ |
||||
/* zones is under its reference position, or the opposite for bottom */ |
||||
/* zones. We must thus check everything there and correct the errors */ |
||||
if ( *blue_shoot != *blue_ref ) |
||||
{ |
||||
FT_Pos ref = *blue_ref; |
||||
FT_Pos shoot = *blue_shoot; |
||||
FT_Bool over_ref = FT_BOOL( shoot > ref ); |
||||
|
||||
|
||||
if ( AH_IS_TOP_BLUE( blue ) ^ over_ref ) |
||||
*blue_shoot = *blue_ref = ( shoot + ref ) / 2; |
||||
} |
||||
|
||||
AH_LOG(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot )); |
||||
} |
||||
|
||||
/* reset original face charmap */ |
||||
FT_Set_Charmap( face, charmap ); |
||||
error = 0; |
||||
|
||||
Exit: |
||||
return error; |
||||
} |
||||
|
||||
|
||||
static FT_Error |
||||
ah_hinter_compute_widths( AH_Hinter hinter ) |
||||
{ |
||||
/* scan the array of segments in each direction */ |
||||
AH_Outline outline = hinter->glyph; |
||||
AH_Segment segments; |
||||
AH_Segment limit; |
||||
AH_Globals globals = &hinter->globals->design; |
||||
FT_Pos* widths; |
||||
FT_Int dimension; |
||||
FT_Int* p_num_widths; |
||||
FT_Error error = 0; |
||||
FT_Pos edge_distance_threshold = 32000; |
||||
|
||||
|
||||
globals->num_widths = 0; |
||||
globals->num_heights = 0; |
||||
|
||||
/* For now, compute the standard width and height from the `o' */ |
||||
/* character. I started computing the stem width of the `i' and the */ |
||||
/* stem height of the "-", but it wasn't too good. Moreover, we now */ |
||||
/* have a single character that gives us standard width and height. */ |
||||
{ |
||||
FT_UInt glyph_index; |
||||
|
||||
|
||||
glyph_index = FT_Get_Char_Index( hinter->face, 'o' ); |
||||
if ( glyph_index == 0 ) |
||||
return 0; |
||||
|
||||
error = FT_Load_Glyph( hinter->face, glyph_index, FT_LOAD_NO_SCALE ); |
||||
if ( error ) |
||||
goto Exit; |
||||
|
||||
error = ah_outline_load( hinter->glyph, 0x10000L, 0x10000L, |
||||
hinter->face ); |
||||
if ( error ) |
||||
goto Exit; |
||||
|
||||
ah_outline_compute_segments( hinter->glyph ); |
||||
ah_outline_link_segments( hinter->glyph ); |
||||
} |
||||
|
||||
segments = outline->horz_segments; |
||||
limit = segments + outline->num_hsegments; |
||||
widths = globals->heights; |
||||
p_num_widths = &globals->num_heights; |
||||
|
||||
for ( dimension = 1; dimension >= 0; dimension-- ) |
||||
{ |
||||
AH_Segment seg = segments; |
||||
AH_Segment link; |
||||
FT_Int num_widths = 0; |
||||
|
||||
|
||||
for ( ; seg < limit; seg++ ) |
||||
{ |
||||
link = seg->link; |
||||
/* we only consider stem segments there! */ |
||||
if ( link && link->link == seg && link > seg ) |
||||
{ |
||||
FT_Pos dist; |
||||
|
||||
|
||||
dist = seg->pos - link->pos; |
||||
if ( dist < 0 ) |
||||
dist = -dist; |
||||
|
||||
if ( num_widths < AH_MAX_WIDTHS ) |
||||
widths[num_widths++] = dist; |
||||
} |
||||
} |
||||
|
||||
sort_values( num_widths, widths ); |
||||
*p_num_widths = num_widths; |
||||
|
||||
/* we will now try to find the smallest width */ |
||||
if ( num_widths > 0 && widths[0] < edge_distance_threshold ) |
||||
edge_distance_threshold = widths[0]; |
||||
|
||||
segments = outline->vert_segments; |
||||
limit = segments + outline->num_vsegments; |
||||
widths = globals->widths; |
||||
p_num_widths = &globals->num_widths; |
||||
} |
||||
|
||||
/* Now, compute the edge distance threshold as a fraction of the */ |
||||
/* smallest width in the font. Set it in `hinter->glyph' too! */ |
||||
if ( edge_distance_threshold == 32000 ) |
||||
edge_distance_threshold = 50; |
||||
|
||||
/* let's try 20% */ |
||||
hinter->glyph->edge_distance_threshold = edge_distance_threshold / 5; |
||||
|
||||
Exit: |
||||
return error; |
||||
} |
||||
|
||||
|
||||
FT_LOCAL_DEF( FT_Error ) |
||||
ah_hinter_compute_globals( AH_Hinter hinter ) |
||||
{ |
||||
return ah_hinter_compute_widths( hinter ) || |
||||
ah_hinter_compute_blues ( hinter ); |
||||
} |
||||
|
||||
|
||||
/* END */ |
@ -1,59 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahglobal.h */ |
||||
/* */ |
||||
/* Routines used to compute global metrics automatically */ |
||||
/* (specification). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHGLOBAL_H__ |
||||
#define __AHGLOBAL_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include "ahtypes.h" |
||||
#include FT_INTERNAL_OBJECTS_H |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
#ifdef FT_CONFIG_CHESTER_SMALL_F |
||||
|
||||
#define AH_IS_TOP_BLUE( b ) ( (b) == AH_BLUE_CAPITAL_TOP || \ |
||||
(b) == AH_BLUE_SMALL_F_TOP || \
|
||||
(b) == AH_BLUE_SMALL_TOP ) |
||||
|
||||
#else /* !FT_CONFIG_CHESTER_SMALL_F */ |
||||
|
||||
#define AH_IS_TOP_BLUE( b ) ( (b) == AH_BLUE_CAPITAL_TOP || \ |
||||
(b) == AH_BLUE_SMALL_TOP ) |
||||
|
||||
#endif /* !FT_CONFIG_CHESTER_SMALL_F */ |
||||
|
||||
|
||||
/* compute global metrics automatically */ |
||||
FT_LOCAL( FT_Error ) |
||||
ah_hinter_compute_globals( AH_Hinter hinter ); |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHGLOBAL_H__ */ |
||||
|
||||
|
||||
/* END */ |
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahglyph.h */ |
||||
/* */ |
||||
/* Routines used to load and analyze a given glyph before hinting */ |
||||
/* (specification). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHGLYPH_H__ |
||||
#define __AHGLYPH_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include "ahtypes.h" |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
typedef enum AH_UV_ |
||||
{ |
||||
AH_UV_FXY, |
||||
AH_UV_FYX, |
||||
AH_UV_OXY, |
||||
AH_UV_OYX, |
||||
AH_UV_OX, |
||||
AH_UV_OY, |
||||
AH_UV_YX, |
||||
AH_UV_XY /* should always be last! */ |
||||
|
||||
} AH_UV; |
||||
|
||||
|
||||
FT_LOCAL( void ) |
||||
ah_setup_uv( AH_Outline outline, |
||||
AH_UV source ); |
||||
|
||||
|
||||
/* AH_OutlineRec functions - they should be typically called in this order */ |
||||
|
||||
FT_LOCAL( FT_Error ) |
||||
ah_outline_new( FT_Memory memory, |
||||
AH_Outline* aoutline ); |
||||
|
||||
FT_LOCAL( FT_Error ) |
||||
ah_outline_load( AH_Outline outline, |
||||
FT_Fixed x_scale, |
||||
FT_Fixed y_scale, |
||||
FT_Face face ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_compute_segments( AH_Outline outline ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_link_segments( AH_Outline outline ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_detect_features( AH_Outline outline ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_compute_blue_edges( AH_Outline outline, |
||||
AH_Face_Globals globals ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_scale_blue_edges( AH_Outline outline, |
||||
AH_Face_Globals globals ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_save( AH_Outline outline, |
||||
AH_Loader loader ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_outline_done( AH_Outline outline ); |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHGLYPH_H__ */ |
||||
|
||||
|
||||
/* END */ |
File diff suppressed because it is too large
Load Diff
@ -1,75 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahhint.h */ |
||||
/* */ |
||||
/* Glyph hinter (declaration). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHHINT_H__ |
||||
#define __AHHINT_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include "ahglobal.h" |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
#define AH_HINT_DEFAULT 0 |
||||
#define AH_HINT_NO_ALIGNMENT 1 |
||||
#define AH_HINT_NO_HORZ_EDGES 0x200000L /* temporary hack */ |
||||
#define AH_HINT_NO_VERT_EDGES 0x400000L /* temporary hack */ |
||||
|
||||
|
||||
/* create a new empty hinter object */ |
||||
FT_LOCAL( FT_Error ) |
||||
ah_hinter_new( FT_Library library, |
||||
AH_Hinter* ahinter ); |
||||
|
||||
/* Load a hinted glyph in the hinter */ |
||||
FT_LOCAL( FT_Error ) |
||||
ah_hinter_load_glyph( AH_Hinter hinter, |
||||
FT_GlyphSlot slot, |
||||
FT_Size size, |
||||
FT_UInt glyph_index, |
||||
FT_Int32 load_flags ); |
||||
|
||||
/* finalize a hinter object */ |
||||
FT_LOCAL( void ) |
||||
ah_hinter_done( AH_Hinter hinter ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_hinter_done_face_globals( AH_Face_Globals globals ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_hinter_get_global_hints( AH_Hinter hinter, |
||||
FT_Face face, |
||||
void** global_hints, |
||||
long* global_len ); |
||||
|
||||
FT_LOCAL( void ) |
||||
ah_hinter_done_global_hints( AH_Hinter hinter, |
||||
void* global_hints ); |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHHINT_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -1,61 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahloader.h */ |
||||
/* */ |
||||
/* Glyph loader for the auto-hinting module (declaration only). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* This defines the AH_GlyphLoader type; it is simply a typedef to */ |
||||
/* FT_GlyphLoader. */ |
||||
/* */ |
||||
/*************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHLOADER_H__ |
||||
#define __AHLOADER_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
#include FT_INTERNAL_GLYPH_LOADER_H |
||||
|
||||
#define AH_Load FT_GlyphLoad |
||||
#define AH_Loader FT_GlyphLoader |
||||
|
||||
#define ah_loader_new FT_GlyphLoader_New |
||||
#define ah_loader_done FT_GlyphLoader_Done |
||||
#define ah_loader_reset FT_GlyphLoader_Reset |
||||
#define ah_loader_rewind FT_GlyphLoader_Rewind |
||||
#define ah_loader_create_extra FT_GlyphLoader_CreateExtra |
||||
#define ah_loader_check_points FT_GlyphLoader_CheckPoints |
||||
#define ah_loader_check_subglyphs FT_GlyphLoader_CheckSubGlyphs |
||||
#define ah_loader_prepare FT_GlyphLoader_Prepare |
||||
#define ah_loader_add FT_GlyphLoader_Add |
||||
#define ah_loader_copy_points FT_GlyphLoader_CopyPoints |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHLOADER_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -1,143 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahmodule.c */ |
||||
/* */ |
||||
/* Auto-hinting module implementation (declaration). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include FT_MODULE_H |
||||
#include "ahhint.h" |
||||
|
||||
|
||||
#ifdef DEBUG_HINTER |
||||
AH_Hinter ah_debug_hinter = NULL; |
||||
FT_Bool ah_debug_disable_horz = 0; |
||||
FT_Bool ah_debug_disable_vert = 0; |
||||
#endif |
||||
|
||||
typedef struct FT_AutoHinterRec_ |
||||
{ |
||||
FT_ModuleRec root; |
||||
AH_Hinter hinter; |
||||
|
||||
} FT_AutoHinterRec; |
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error ) |
||||
ft_autohinter_init( FT_Module module ) /* FT_AutoHinter */ |
||||
{ |
||||
FT_AutoHinter autohinter = (FT_AutoHinter)module; |
||||
FT_Error error; |
||||
|
||||
|
||||
error = ah_hinter_new( module->library, &autohinter->hinter ); |
||||
|
||||
#ifdef DEBUG_HINTER |
||||
if ( !error ) |
||||
ah_debug_hinter = autohinter->hinter; |
||||
#endif |
||||
|
||||
return error; |
||||
} |
||||
|
||||
|
||||
FT_CALLBACK_DEF( void ) |
||||
ft_autohinter_done( FT_Module module ) |
||||
{ |
||||
FT_AutoHinter autohinter = (FT_AutoHinter)module; |
||||
|
||||
|
||||
ah_hinter_done( autohinter->hinter ); |
||||
|
||||
#ifdef DEBUG_HINTER |
||||
ah_debug_hinter = NULL; |
||||
#endif |
||||
} |
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error ) |
||||
ft_autohinter_load_glyph( FT_AutoHinter module, |
||||
FT_GlyphSlot slot, |
||||
FT_Size size, |
||||
FT_UInt glyph_index, |
||||
FT_Int32 load_flags ) |
||||
{ |
||||
return ah_hinter_load_glyph( module->hinter, |
||||
slot, size, glyph_index, load_flags ); |
||||
} |
||||
|
||||
|
||||
FT_CALLBACK_DEF( void ) |
||||
ft_autohinter_reset_globals( FT_AutoHinter module, |
||||
FT_Face face ) |
||||
{ |
||||
FT_UNUSED( module ); |
||||
|
||||
if ( face->autohint.data ) |
||||
ah_hinter_done_face_globals( (AH_Face_Globals)(face->autohint.data) ); |
||||
} |
||||
|
||||
|
||||
FT_CALLBACK_DEF( void ) |
||||
ft_autohinter_get_globals( FT_AutoHinter module, |
||||
FT_Face face, |
||||
void** global_hints, |
||||
long* global_len ) |
||||
{ |
||||
ah_hinter_get_global_hints( module->hinter, face, |
||||
global_hints, global_len ); |
||||
} |
||||
|
||||
|
||||
FT_CALLBACK_DEF( void ) |
||||
ft_autohinter_done_globals( FT_AutoHinter module, |
||||
void* global_hints ) |
||||
{ |
||||
ah_hinter_done_global_hints( module->hinter, global_hints ); |
||||
} |
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF |
||||
const FT_AutoHinter_ServiceRec ft_autohinter_service = |
||||
{ |
||||
ft_autohinter_reset_globals, |
||||
ft_autohinter_get_globals, |
||||
ft_autohinter_done_globals, |
||||
ft_autohinter_load_glyph |
||||
}; |
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF |
||||
const FT_Module_Class autohint_module_class = |
||||
{ |
||||
FT_MODULE_HINTER, |
||||
sizeof ( FT_AutoHinterRec ), |
||||
|
||||
"autohinter", |
||||
0x10000L, /* version 1.0 of the autohinter */ |
||||
0x20000L, /* requires FreeType 2.0 or above */ |
||||
|
||||
(const void*) &ft_autohinter_service, |
||||
|
||||
ft_autohinter_init, |
||||
ft_autohinter_done, |
||||
0 /* FT_Module_Requester */ |
||||
}; |
||||
|
||||
|
||||
/* END */ |
@ -1,42 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahmodule.h */ |
||||
/* */ |
||||
/* Auto-hinting module (declaration). */ |
||||
/* */ |
||||
/* Copyright 2000-2001 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHMODULE_H__ |
||||
#define __AHMODULE_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include FT_MODULE_H |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
FT_CALLBACK_TABLE |
||||
const FT_Module_Class autohint_module_class; |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHMODULE_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -1,527 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ahtypes.h */ |
||||
/* */ |
||||
/* General types and definitions for the auto-hint module */ |
||||
/* (specification only). */ |
||||
/* */ |
||||
/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __AHTYPES_H__ |
||||
#define __AHTYPES_H__ |
||||
|
||||
|
||||
#include <ft2build.h> |
||||
#include FT_INTERNAL_OBJECTS_H |
||||
|
||||
#ifdef DEBUG_HINTER |
||||
#include <../src/autohint/ahloader.h> |
||||
#else |
||||
#include "ahloader.h" |
||||
#endif |
||||
|
||||
|
||||
#define xxAH_DEBUG |
||||
|
||||
|
||||
#ifdef AH_DEBUG |
||||
|
||||
#include <stdio.h> |
||||
#define AH_LOG( x ) printf ## x |
||||
|
||||
#else |
||||
|
||||
#define AH_LOG( x ) do ; while ( 0 ) /* nothing */ |
||||
|
||||
#endif /* AH_DEBUG */ |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
/**** ****/ |
||||
/**** COMPILE-TIME BUILD OPTIONS ****/ |
||||
/**** ****/ |
||||
/**** Toggle these configuration macros to experiment with `features' ****/ |
||||
/**** of the auto-hinter. ****/ |
||||
/**** ****/ |
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* If this option is defined, only strong interpolation will be used to */ |
||||
/* place the points between edges. Otherwise, `smooth' points are */ |
||||
/* detected and later hinted through weak interpolation to correct some */ |
||||
/* unpleasant artefacts. */ |
||||
/* */ |
||||
#undef AH_OPTION_NO_WEAK_INTERPOLATION |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* Undefine this macro if you don't want to hint the metrics. There is */ |
||||
/* no reason to do this (at least for non-CJK scripts), except for */ |
||||
/* experimentation. */ |
||||
/* */ |
||||
#undef AH_HINT_METRICS |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* Define this macro if you do not want to insert extra edges at a */ |
||||
/* glyph's x and y extremum (if there isn't one already available). */ |
||||
/* This helps to reduce a number of artefacts and allows hinting of */ |
||||
/* metrics. */ |
||||
/* */ |
||||
#undef AH_OPTION_NO_EXTREMUM_EDGES |
||||
|
||||
|
||||
/* don't touch for now */ |
||||
#define AH_MAX_WIDTHS 12 |
||||
#define AH_MAX_HEIGHTS 12 |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
/**** ****/ |
||||
/**** TYPE DEFINITIONS ****/ |
||||
/**** ****/ |
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
/*************************************************************************/ |
||||
|
||||
|
||||
/* see ahangles.h */ |
||||
typedef FT_Int AH_Angle; |
||||
|
||||
|
||||
/* hint flags */ |
||||
#define AH_FLAG_NONE 0 |
||||
|
||||
/* bezier control points flags */ |
||||
#define AH_FLAG_CONIC 1 |
||||
#define AH_FLAG_CUBIC 2 |
||||
#define AH_FLAG_CONTROL ( AH_FLAG_CONIC | AH_FLAG_CUBIC ) |
||||
|
||||
/* extrema flags */ |
||||
#define AH_FLAG_EXTREMA_X 4 |
||||
#define AH_FLAG_EXTREMA_Y 8 |
||||
|
||||
/* roundness */ |
||||
#define AH_FLAG_ROUND_X 16 |
||||
#define AH_FLAG_ROUND_Y 32 |
||||
|
||||
/* touched */ |
||||
#define AH_FLAG_TOUCH_X 64 |
||||
#define AH_FLAG_TOUCH_Y 128 |
||||
|
||||
/* weak interpolation */ |
||||
#define AH_FLAG_WEAK_INTERPOLATION 256 |
||||
#define AH_FLAG_INFLECTION 512 |
||||
|
||||
typedef FT_Int AH_Flags; |
||||
|
||||
|
||||
/* edge hint flags */ |
||||
#define AH_EDGE_NORMAL 0 |
||||
#define AH_EDGE_ROUND 1 |
||||
#define AH_EDGE_SERIF 2 |
||||
#define AH_EDGE_DONE 4 |
||||
|
||||
typedef FT_Int AH_Edge_Flags; |
||||
|
||||
|
||||
/* hint directions -- the values are computed so that two vectors are */ |
||||
/* in opposite directions iff `dir1+dir2 == 0' */ |
||||
#define AH_DIR_NONE 4 |
||||
#define AH_DIR_RIGHT 1 |
||||
#define AH_DIR_LEFT -1 |
||||
#define AH_DIR_UP 2 |
||||
#define AH_DIR_DOWN -2 |
||||
|
||||
typedef FT_Int AH_Direction; |
||||
|
||||
|
||||
typedef struct AH_PointRec_* AH_Point; |
||||
typedef struct AH_SegmentRec_* AH_Segment; |
||||
typedef struct AH_EdgeRec_* AH_Edge; |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* <Struct> */ |
||||
/* AH_PointRec */ |
||||
/* */ |
||||
/* <Description> */ |
||||
/* A structure used to model an outline point to the AH_OutlineRec */ |
||||
/* type. */ |
||||
/* */ |
||||
/* <Fields> */ |
||||
/* flags :: The current point hint flags. */ |
||||
/* */ |
||||
/* ox, oy :: The current original scaled coordinates. */ |
||||
/* */ |
||||
/* fx, fy :: The current coordinates in font units. */ |
||||
/* */ |
||||
/* x, y :: The current hinted coordinates. */ |
||||
/* */ |
||||
/* u, v :: Point coordinates -- meaning varies with context. */ |
||||
/* */ |
||||
/* in_dir :: The direction of the inwards vector (prev->point). */ |
||||
/* */ |
||||
/* out_dir :: The direction of the outwards vector (point->next). */ |
||||
/* */ |
||||
/* next :: The next point in same contour. */ |
||||
/* */ |
||||
/* prev :: The previous point in same contour. */ |
||||
/* */ |
||||
typedef struct AH_PointRec_ |
||||
{ |
||||
AH_Flags flags; /* point flags used by hinter */ |
||||
FT_Pos ox, oy; |
||||
FT_Pos fx, fy; |
||||
FT_Pos x, y; |
||||
FT_Pos u, v; |
||||
|
||||
AH_Direction in_dir; /* direction of inwards vector */ |
||||
AH_Direction out_dir; /* direction of outwards vector */ |
||||
|
||||
AH_Point next; /* next point in contour */ |
||||
AH_Point prev; /* previous point in contour */ |
||||
|
||||
} AH_PointRec; |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* <Struct> */ |
||||
/* AH_SegmentRec */ |
||||
/* */ |
||||
/* <Description> */ |
||||
/* A structure used to describe an edge segment to the auto-hinter. */ |
||||
/* A segment is simply a sequence of successive points located on the */ |
||||
/* same horizontal or vertical `position', in a given direction. */ |
||||
/* */ |
||||
/* <Fields> */ |
||||
/* flags :: The segment edge flags (straight, rounded, etc.). */ |
||||
/* */ |
||||
/* dir :: The segment direction. */ |
||||
/* */ |
||||
/* min_coord :: The minimum coordinate of the segment. */ |
||||
/* */ |
||||
/* max_coord :: The maximum coordinate of the segment. */ |
||||
/* */ |
||||
/* edge :: The edge of the current segment. */ |
||||
/* */ |
||||
/* edge_next :: The next segment on the same edge. */ |
||||
/* */ |
||||
/* link :: The pairing segment for this edge. */ |
||||
/* */ |
||||
/* serif :: The primary segment for serifs. */ |
||||
/* */ |
||||
/* num_linked :: The number of other segments that link to this one. */ |
||||
/* */ |
||||
/* score :: Used to score the segment when selecting them. */ |
||||
/* */ |
||||
/* first :: The first point in the segment. */ |
||||
/* */ |
||||
/* last :: The last point in the segment. */ |
||||
/* */ |
||||
/* contour :: A pointer to the first point of the segment's */ |
||||
/* contour. */ |
||||
/* */ |
||||
typedef struct AH_SegmentRec_ |
||||
{ |
||||
AH_Edge_Flags flags; |
||||
AH_Direction dir; |
||||
FT_Pos pos; /* position of segment */ |
||||
FT_Pos min_coord; /* minimum coordinate of segment */ |
||||
FT_Pos max_coord; /* maximum coordinate of segment */ |
||||
|
||||
AH_Edge edge; |
||||
AH_Segment edge_next; |
||||
|
||||
AH_Segment link; /* link segment */ |
||||
AH_Segment serif; /* primary segment for serifs */ |
||||
FT_Pos num_linked; /* number of linked segments */ |
||||
FT_Pos score; |
||||
|
||||
AH_Point first; /* first point in edge segment */ |
||||
AH_Point last; /* last point in edge segment */ |
||||
AH_Point* contour; /* ptr to first point of segment's contour */ |
||||
|
||||
} AH_SegmentRec; |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* <Struct> */ |
||||
/* AH_EdgeRec */ |
||||
/* */ |
||||
/* <Description> */ |
||||
/* A structure used to describe an edge, which really is a horizontal */ |
||||
/* or vertical coordinate to be hinted depending on the segments */ |
||||
/* located on it. */ |
||||
/* */ |
||||
/* <Fields> */ |
||||
/* fpos :: The original edge position in font units. */ |
||||
/* */ |
||||
/* opos :: The original scaled edge position. */ |
||||
/* */ |
||||
/* pos :: The hinted edge position. */ |
||||
/* */ |
||||
/* flags :: The segment edge flags (straight, rounded, etc.). */ |
||||
/* */ |
||||
/* dir :: The main segment direction on this edge. */ |
||||
/* */ |
||||
/* scale :: Scaling factor between original and hinted edge */ |
||||
/* positions. */ |
||||
/* */ |
||||
/* blue_edge :: Indicate the blue zone edge this edge is related to. */ |
||||
/* Only set for some of the horizontal edges in a latin */ |
||||
/* font. */ |
||||
/* */ |
||||
/* link :: The linked edge. */ |
||||
/* */ |
||||
/* serif :: The serif edge. */ |
||||
/* */ |
||||
/* num_linked :: The number of other edges that pair to this one. */ |
||||
/* */ |
||||
/* score :: Used to score the edge when selecting them. */ |
||||
/* */ |
||||
/* first :: The first edge segment. */ |
||||
/* */ |
||||
/* last :: The last edge segment. */ |
||||
/* */ |
||||
typedef struct AH_EdgeRec_ |
||||
{ |
||||
FT_Pos fpos; |
||||
FT_Pos opos; |
||||
FT_Pos pos; |
||||
|
||||
AH_Edge_Flags flags; |
||||
AH_Direction dir; |
||||
FT_Fixed scale; |
||||
FT_Pos* blue_edge; |
||||
|
||||
AH_Edge link; |
||||
AH_Edge serif; |
||||
FT_Int num_linked; |
||||
|
||||
FT_Int score; |
||||
|
||||
AH_Segment first; |
||||
AH_Segment last; |
||||
|
||||
|
||||
} AH_EdgeRec; |
||||
|
||||
|
||||
/* an outline as seen by the hinter */ |
||||
typedef struct AH_OutlineRec_ |
||||
{ |
||||
FT_Memory memory; |
||||
|
||||
AH_Direction vert_major_dir; /* vertical major direction */ |
||||
AH_Direction horz_major_dir; /* horizontal major direction */ |
||||
|
||||
FT_Fixed x_scale; |
||||
FT_Fixed y_scale; |
||||
FT_Pos edge_distance_threshold; |
||||
|
||||
FT_Int max_points; |
||||
FT_Int num_points; |
||||
AH_Point points; |
||||
|
||||
FT_Int max_contours; |
||||
FT_Int num_contours; |
||||
AH_Point* contours; |
||||
|
||||
FT_Int num_hedges; |
||||
AH_Edge horz_edges; |
||||
|
||||
FT_Int num_vedges; |
||||
AH_Edge vert_edges; |
||||
|
||||
FT_Int num_hsegments; |
||||
AH_Segment horz_segments; |
||||
|
||||
FT_Int num_vsegments; |
||||
AH_Segment vert_segments; |
||||
|
||||
} AH_OutlineRec, *AH_Outline; |
||||
|
||||
|
||||
#ifdef FT_CONFIG_CHESTER_SMALL_F |
||||
|
||||
#define AH_BLUE_CAPITAL_TOP 0 /* THEZOCQS */ |
||||
#define AH_BLUE_CAPITAL_BOTTOM ( AH_BLUE_CAPITAL_TOP + 1 ) /* HEZLOCUS */ |
||||
#define AH_BLUE_SMALL_F_TOP ( AH_BLUE_CAPITAL_BOTTOM + 1 ) /* fijkdbh */ |
||||
#define AH_BLUE_SMALL_TOP ( AH_BLUE_SMALL_F_TOP + 1 ) /* xzroesc */ |
||||
#define AH_BLUE_SMALL_BOTTOM ( AH_BLUE_SMALL_TOP + 1 ) /* xzroesc */ |
||||
#define AH_BLUE_SMALL_MINOR ( AH_BLUE_SMALL_BOTTOM + 1 ) /* pqgjy */ |
||||
#define AH_BLUE_MAX ( AH_BLUE_SMALL_MINOR + 1 ) |
||||
|
||||
#else /* !FT_CONFIG_CHESTER_SMALL_F */ |
||||
|
||||
#define AH_BLUE_CAPITAL_TOP 0 /* THEZOCQS */ |
||||
#define AH_BLUE_CAPITAL_BOTTOM ( AH_BLUE_CAPITAL_TOP + 1 ) /* HEZLOCUS */ |
||||
#define AH_BLUE_SMALL_TOP ( AH_BLUE_CAPITAL_BOTTOM + 1 ) /* xzroesc */ |
||||
#define AH_BLUE_SMALL_BOTTOM ( AH_BLUE_SMALL_TOP + 1 ) /* xzroesc */ |
||||
#define AH_BLUE_SMALL_MINOR ( AH_BLUE_SMALL_BOTTOM + 1 ) /* pqgjy */ |
||||
#define AH_BLUE_MAX ( AH_BLUE_SMALL_MINOR + 1 ) |
||||
|
||||
#endif /* !FT_CONFIG_CHESTER_SMALL_F */ |
||||
|
||||
typedef FT_Int AH_Blue; |
||||
|
||||
|
||||
#define AH_HINTER_MONOCHROME 1 |
||||
#define AH_HINTER_OPTIMIZE 2 |
||||
|
||||
typedef FT_Int AH_Hinter_Flags; |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* <Struct> */ |
||||
/* AH_GlobalsRec */ |
||||
/* */ |
||||
/* <Description> */ |
||||
/* Holds the global metrics for a given font face (be it in design */ |
||||
/* units or scaled pixel values). */ |
||||
/* */ |
||||
/* <Fields> */ |
||||
/* num_widths :: The number of widths. */ |
||||
/* */ |
||||
/* num_heights :: The number of heights. */ |
||||
/* */ |
||||
/* stds :: A two-element array giving the default stem width */ |
||||
/* and height. */ |
||||
/* */ |
||||
/* widths :: Snap widths, including standard one. */ |
||||
/* */ |
||||
/* heights :: Snap height, including standard one. */ |
||||
/* */ |
||||
/* blue_refs :: The reference positions of blue zones. */ |
||||
/* */ |
||||
/* blue_shoots :: The overshoot positions of blue zones. */ |
||||
/* */ |
||||
typedef struct AH_GlobalsRec_ |
||||
{ |
||||
FT_Int num_widths; |
||||
FT_Int num_heights; |
||||
|
||||
FT_Pos stds[2]; |
||||
|
||||
FT_Pos widths [AH_MAX_WIDTHS]; |
||||
FT_Pos heights[AH_MAX_HEIGHTS]; |
||||
|
||||
FT_Pos blue_refs [AH_BLUE_MAX]; |
||||
FT_Pos blue_shoots[AH_BLUE_MAX]; |
||||
|
||||
} AH_GlobalsRec, *AH_Globals; |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* <Struct> */ |
||||
/* AH_Face_GlobalsRec */ |
||||
/* */ |
||||
/* <Description> */ |
||||
/* Holds the complete global metrics for a given font face (i.e., the */ |
||||
/* design units version + a scaled version + the current scales */ |
||||
/* used). */ |
||||
/* */ |
||||
/* <Fields> */ |
||||
/* face :: A handle to the source face object */ |
||||
/* */ |
||||
/* design :: The globals in font design units. */ |
||||
/* */ |
||||
/* scaled :: Scaled globals in sub-pixel values. */ |
||||
/* */ |
||||
/* x_scale :: The current horizontal scale. */ |
||||
/* */ |
||||
/* y_scale :: The current vertical scale. */ |
||||
/* */ |
||||
/* control_overshoot :: */ |
||||
/* Currently unused. */ |
||||
/* */ |
||||
typedef struct AH_Face_GlobalsRec_ |
||||
{ |
||||
FT_Face face; |
||||
AH_GlobalsRec design; |
||||
AH_GlobalsRec scaled; |
||||
FT_Fixed x_scale; |
||||
FT_Fixed y_scale; |
||||
FT_Bool control_overshoot; |
||||
|
||||
} AH_Face_GlobalsRec, *AH_Face_Globals; |
||||
|
||||
|
||||
typedef struct AH_HinterRec_ |
||||
{ |
||||
FT_Memory memory; |
||||
AH_Hinter_Flags flags; |
||||
|
||||
FT_Int algorithm; |
||||
FT_Face face; |
||||
|
||||
AH_Face_Globals globals; |
||||
|
||||
AH_Outline glyph; |
||||
|
||||
AH_Loader loader; |
||||
FT_Vector pp1; /* horizontal phantom points */ |
||||
FT_Vector pp2; |
||||
/* we ignore vertical phantom points */ |
||||
|
||||
FT_Bool transformed; |
||||
FT_Vector trans_delta; |
||||
FT_Matrix trans_matrix; |
||||
|
||||
FT_Bool do_horz_hints; /* disable X hinting */ |
||||
FT_Bool do_vert_hints; /* disable Y hinting */ |
||||
FT_Bool do_horz_snapping; /* disable X stem size snapping */ |
||||
FT_Bool do_vert_snapping; /* disable Y stem size snapping */ |
||||
FT_Bool do_stem_adjust; /* disable light stem snapping */ |
||||
|
||||
} AH_HinterRec, *AH_Hinter; |
||||
|
||||
|
||||
#ifdef DEBUG_HINTER |
||||
extern AH_Hinter ah_debug_hinter; |
||||
extern FT_Bool ah_debug_disable_horz; |
||||
extern FT_Bool ah_debug_disable_vert; |
||||
#else |
||||
#define ah_debug_disable_horz 0 |
||||
#define ah_debug_disable_vert 0 |
||||
#endif /* DEBUG_HINTER */ |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __AHTYPES_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -1,32 +0,0 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* autohint.c */ |
||||
/* */ |
||||
/* Automatic Hinting wrapper (body only). */ |
||||
/* */ |
||||
/* Copyright 2000-2001 Catharon Productions Inc. */ |
||||
/* 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 */ |
||||
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ |
||||
/* this file you indicate that you have read the license and */ |
||||
/* understand and accept it fully. */ |
||||
/* */ |
||||
/* Note that this license is compatible with the FreeType license. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#define FT_MAKE_OPTION_SINGLE_OBJECT |
||||
|
||||
#include <ft2build.h> |
||||
#include "ahangles.c" |
||||
#include "ahglyph.c" |
||||
#include "ahglobal.c" |
||||
#include "ahhint.c" |
||||
#include "ahmodule.c" |
||||
|
||||
|
||||
/* END */ |
@ -1,78 +0,0 @@ |
||||
#!/usr/bin/env python |
||||
# |
||||
|
||||
# |
||||
# autohint math table builder |
||||
# |
||||
|
||||
|
||||
# Copyright 1996-2000 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. |
||||
|
||||
|
||||
import math |
||||
|
||||
ag_pi = 256 |
||||
|
||||
def print_arctan( atan_bits ): |
||||
atan_base = 1 << atan_bits |
||||
|
||||
print " static AH_Angle ag_arctan[1L << AG_ATAN_BITS] =" |
||||
print " {" |
||||
|
||||
count = 0 |
||||
line = " " |
||||
|
||||
for n in range( atan_base ): |
||||
comma = "," |
||||
if ( n == atan_base - 1 ): |
||||
comma = "" |
||||
|
||||
angle = math.atan( n * 1.0 / atan_base ) / math.pi * ag_pi |
||||
line = line + " " + repr( int( angle + 0.5 ) ) + comma |
||||
count = count + 1; |
||||
if ( count == 8 ): |
||||
count = 0 |
||||
print line |
||||
line = " " |
||||
|
||||
if ( count > 0 ): |
||||
print line |
||||
print " };" |
||||
|
||||
|
||||
# This routine is not used currently. |
||||
# |
||||
def print_sines(): |
||||
print " static FT_Fixed ah_sines[AG_HALF_PI + 1] =" |
||||
print " {" |
||||
|
||||
count = 0 |
||||
line = " " |
||||
|
||||
for n in range( ag_pi / 2 ): |
||||
sinus = math.sin( n * math.pi / ag_pi ) |
||||
line = line + " " + repr( int( 65536.0 * sinus ) ) + "," |
||||
count = count + 1 |
||||
if ( count == 8 ): |
||||
count = 0 |
||||
print line |
||||
line = " " |
||||
|
||||
if ( count > 0 ): |
||||
print line |
||||
print " 65536" |
||||
print " };" |
||||
|
||||
|
||||
print_arctan( 8 ) |
||||
print |
||||
|
||||
|
||||
# END |
@ -1,25 +0,0 @@ |
||||
#
|
||||
# FreeType 2 auto-hinter module definition
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2000 Catharon Productions Inc.
|
||||
# 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
|
||||
# `CatharonLicense.txt'. By continuing to use, modify, or distribute
|
||||
# this file you indicate that you have read the license and
|
||||
# understand and accept it fully.
|
||||
#
|
||||
# Note that this license is compatible with the FreeType license.
|
||||
|
||||
|
||||
make_module_list: add_autohint_module |
||||
|
||||
add_autohint_module: |
||||
$(OPEN_DRIVER)autohint_module_class$(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)autohint $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)
|
||||
|
||||
# EOF
|
@ -1,77 +0,0 @@ |
||||
#
|
||||
# FreeType 2 auto-hinter module configuration rules
|
||||
#
|
||||
|
||||
|
||||
# Copyright 2000, 2001, 2002, 2003 Catharon Productions Inc.
|
||||
# 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
|
||||
# `CatharonLicense.txt'. By continuing to use, modify, or distribute
|
||||
# this file you indicate that you have read the license and
|
||||
# understand and accept it fully.
|
||||
#
|
||||
# Note that this license is compatible with the FreeType license.
|
||||
|
||||
|
||||
# AUTO driver directory
|
||||
#
|
||||
AUTO_DIR := $(SRC_DIR)/autohint
|
||||
|
||||
|
||||
# compilation flags for the driver
|
||||
#
|
||||
AUTO_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTO_DIR))
|
||||
|
||||
|
||||
# AUTO driver sources (i.e., C files)
|
||||
#
|
||||
AUTO_DRV_SRC := $(AUTO_DIR)/ahangles.c \
|
||||
$(AUTO_DIR)/ahglobal.c \
|
||||
$(AUTO_DIR)/ahglyph.c \
|
||||
$(AUTO_DIR)/ahhint.c \
|
||||
$(AUTO_DIR)/ahmodule.c
|
||||
|
||||
# AUTO driver headers
|
||||
#
|
||||
AUTO_DRV_H := $(AUTO_DRV_SRC:%c=%h) \
|
||||
$(AUTO_DIR)/ahloader.h \
|
||||
$(AUTO_DIR)/ahtypes.h \
|
||||
$(AUTO_DIR)/aherrors.h
|
||||
|
||||
|
||||
# AUTO driver object(s)
|
||||
#
|
||||
# AUTO_DRV_OBJ_M is used during `multi' builds.
|
||||
# AUTO_DRV_OBJ_S is used during `single' builds.
|
||||
#
|
||||
AUTO_DRV_OBJ_M := $(AUTO_DRV_SRC:$(AUTO_DIR)/%.c=$(OBJ_DIR)/%.$O)
|
||||
AUTO_DRV_OBJ_S := $(OBJ_DIR)/autohint.$O
|
||||
|
||||
# AUTO driver source file for single build
|
||||
#
|
||||
AUTO_DRV_SRC_S := $(AUTO_DIR)/autohint.c
|
||||
|
||||
|
||||
# AUTO driver - single object
|
||||
#
|
||||
$(AUTO_DRV_OBJ_S): $(AUTO_DRV_SRC_S) $(AUTO_DRV_SRC) \
|
||||
$(FREETYPE_H) $(AUTO_DRV_H)
|
||||
$(AUTO_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(AUTO_DRV_SRC_S))
|
||||
|
||||
|
||||
# AUTO driver - multiple objects
|
||||
#
|
||||
$(OBJ_DIR)/%.$O: $(AUTO_DIR)/%.c $(FREETYPE_H) $(AUTO_DRV_H) |
||||
$(AUTO_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
|
||||
|
||||
|
||||
# update main driver object lists
|
||||
#
|
||||
DRV_OBJS_S += $(AUTO_DRV_OBJ_S)
|
||||
DRV_OBJS_M += $(AUTO_DRV_OBJ_M)
|
||||
|
||||
|
||||
# EOF
|
Loading…
Reference in new issue