summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2004-02-23 21:08:37 +0000
committerDavid Turner <david@freetype.org>2004-02-23 21:08:37 +0000
commit8c9c760326c5c59b47738d5f42854558faba8852 (patch)
tree61cca9478d727db29c5c987def68ecf740e376d9
parent648dd5acea85fb0163909519fda348537e95865c (diff)
downloadfreetype2-8c9c760326c5c59b47738d5f42854558faba8852.tar.gz
adding support for dummy script, i.e. no-hinting for non latin glyphs
-rw-r--r--ChangeLog7
-rw-r--r--src/autofit/Jamfile2
-rw-r--r--src/autofit/afdummy.c35
-rw-r--r--src/autofit/afdummy.h18
-rw-r--r--src/autofit/afglobal.c5
-rw-r--r--src/autofit/aflatin.c14
-rw-r--r--src/autofit/aflatin.h1
-rw-r--r--src/autofit/afloader.c5
-rw-r--r--src/autofit/aftypes.h4
-rw-r--r--src/autofit/autofit.c1
10 files changed, 80 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 75ac247b1..d3fe97518 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-23 David Turner <david@freetype.org>
+
+ * src/autofit/afhints.c, src/autofit/afhints.h, src/autofit/aflatin.c,
+ src/autofit/afloader.c, src/types.h: grave bugs were fixed. The
+ auto-fitter works, doesn't crashes, but still produces unexpected
+ results !!
+
2004-02-21 Werner Lemberg <wl@gnu.org>
* src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD): Changed to hold
diff --git a/src/autofit/Jamfile b/src/autofit/Jamfile
index 3253c821e..3063f2371 100644
--- a/src/autofit/Jamfile
+++ b/src/autofit/Jamfile
@@ -5,7 +5,7 @@ SubDir FT2_TOP src autofit ;
if $(FT2_MULTI)
{
- _sources = afangles afglobal afhints aflatin afloader afmodule ;
+ _sources = afangles afglobal afhints aflatin afloader afmodule afdummy ;
}
else
{
diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c
new file mode 100644
index 000000000..ec6a70e2d
--- /dev/null
+++ b/src/autofit/afdummy.c
@@ -0,0 +1,35 @@
+#include "afdummy.h"
+
+
+ static FT_Error
+ af_dummy_hints_init( AF_GlyphHints hints,
+ FT_Outline* outline,
+ AF_ScriptMetrics metrics )
+ {
+ return af_glyph_hints_reset( hints,
+ &metrics->scaler,
+ metrics,
+ outline );
+ }
+
+ static FT_Error
+ af_dummy_hints_apply( AF_GlyphHints hints,
+ FT_Outline* outline )
+ {
+ af_glyph_hints_save( hints, outline );
+ }
+
+
+ FT_LOCAL_DEF( const AF_ScriptClassRec ) af_dummy_script_class =
+ {
+ AF_SCRIPT_NONE,
+ NULL,
+
+ sizeof( AF_ScriptMetricsRec ),
+ (AF_Script_InitMetricsFunc) NULL,
+ (AF_Script_ScaleMetricsFunc) NULL,
+ (AF_Script_DoneMetricsFunc) NULL,
+
+ (AF_Script_InitHintsFunc) af_dummy_hints_init,
+ (AF_Script_ApplyHintsFunc) af_dummy_hints_apply
+ };
diff --git a/src/autofit/afdummy.h b/src/autofit/afdummy.h
new file mode 100644
index 000000000..6d3ab444e
--- /dev/null
+++ b/src/autofit/afdummy.h
@@ -0,0 +1,18 @@
+#ifndef __AFDUMMY_H__
+#define __AFDUMMY_H__
+
+#include "aftypes.h"
+
+FT_BEGIN_HEADER
+
+ /* a dummy script metrics class used when no hinting should
+ * be performed. This is the default for non-latin glyphs !
+ */
+
+ FT_LOCAL( const AF_ScriptClassRec ) af_dummy_script_class;
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __AFDUMMY_H__ */
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 636203637..cadc80347 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -1,10 +1,12 @@
#include "afglobal.h"
+#include "afdummy.h"
#include "aflatin.h"
/* populate this list when you add new scripts
*/
static AF_ScriptClass const af_script_classes[] =
{
+ & af_dummy_script_class,
& af_latin_script_class,
NULL /* do not remove */
@@ -66,6 +68,9 @@
AF_ScriptClass clazz = af_script_classes[ss];
AF_Script_UniRange range;
+ if ( clazz->script_uni_ranges == NULL )
+ continue;
+
/* scan all unicode points in the range, and set the corresponding
* glyph script index
*/
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 131bff666..00fb7b6d0 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -389,13 +389,13 @@
if ( dim == AF_DIMENSION_HORZ )
{
- metrics->scaler.x_scale = scale;
- metrics->scaler.x_delta = delta;
+ metrics->root.scaler.x_scale = scale;
+ metrics->root.scaler.x_delta = delta;
}
else
{
- metrics->scaler.y_scale = scale;
- metrics->scaler.y_delta = delta;
+ metrics->root.scaler.y_scale = scale;
+ metrics->root.scaler.y_delta = delta;
}
/* scale the standard widths
@@ -437,8 +437,6 @@
af_latin_metrics_scale( AF_LatinMetrics metrics,
AF_Scaler scaler )
{
- metrics->scaler = scaler[0];
-
af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );
af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );
}
@@ -1146,7 +1144,7 @@
FT_Error error;
FT_Render_Mode mode;
- error = af_glyph_hints_reset( hints, &metrics->scaler,
+ error = af_glyph_hints_reset( hints, &metrics->root.scaler,
(AF_ScriptMetrics) metrics,
outline );
if (error)
@@ -1156,7 +1154,7 @@
/* compute flags depending on render mode, etc...
*/
- mode = metrics->scaler.render_mode;
+ mode = metrics->root.scaler.render_mode;
/* we snap the width of vertical stems for the monochrome and
* horizontal LCD rendering targets only.
diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h
index da51cad69..a52e42101 100644
--- a/src/autofit/aflatin.h
+++ b/src/autofit/aflatin.h
@@ -92,7 +92,6 @@ FT_BEGIN_HEADER
AF_ScriptMetricsRec root;
FT_UInt units_per_em;
AF_LatinAxisRec axis[ AF_DIMENSION_MAX ];
- AF_ScalerRec scaler;
} AF_LatinMetricsRec, *AF_LatinMetrics;
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 023b251b4..f7f1b8b5f 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -426,7 +426,10 @@
{
loader->metrics = metrics;
- metrics->clazz->script_metrics_scale( metrics, &scaler );
+ metrics->scaler = scaler;
+
+ if ( metrics->clazz->script_metrics_scale )
+ metrics->clazz->script_metrics_scale( metrics, &scaler );
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;
load_flags &= ~FT_LOAD_RENDER;
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 798539002..5b2afd41e 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -195,7 +195,8 @@ FT_BEGIN_HEADER
*/
typedef enum
{
- AF_SCRIPT_LATIN = 0,
+ AF_SCRIPT_NONE = 0,
+ AF_SCRIPT_LATIN = 1,
/* add new scripts here. don't forget to update the list in "afglobal.c" */
AF_SCRIPT_MAX /* do not remove */
@@ -209,6 +210,7 @@ FT_BEGIN_HEADER
typedef struct AF_ScriptMetricsRec_
{
AF_ScriptClass clazz;
+ AF_ScalerRec scaler;
} AF_ScriptMetricsRec, *AF_ScriptMetrics;
diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c
index 91e4db307..c258e0d7a 100644
--- a/src/autofit/autofit.c
+++ b/src/autofit/autofit.c
@@ -3,6 +3,7 @@
#include "afangles.c"
#include "afglobal.c"
#include "afhints.c"
+#include "afdummy.c"
#include "aflatin.c"
#include "afloader.c"
#include "afmodule.c"