summaryrefslogtreecommitdiffstats
path: root/src/pshinter
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commita38fc482eeeb2c1929803c233835369dcf1b8781 (patch)
tree73115efff0a679d5d62e2150a35d135651175ec7 /src/pshinter
parentf463818dd9146e11105c0572fb119e757eb47768 (diff)
downloadandroid_external_freetype-a38fc482eeeb2c1929803c233835369dcf1b8781.tar.gz
android_external_freetype-a38fc482eeeb2c1929803c233835369dcf1b8781.tar.bz2
android_external_freetype-a38fc482eeeb2c1929803c233835369dcf1b8781.zip
Initial Contribution
Diffstat (limited to 'src/pshinter')
-rw-r--r--src/pshinter/Jamfile29
-rw-r--r--src/pshinter/module.mk23
-rw-r--r--src/pshinter/pshalgo.c77
-rw-r--r--src/pshinter/pshalgo.h4
-rw-r--r--src/pshinter/pshrec.h6
-rw-r--r--src/pshinter/rules.mk72
6 files changed, 49 insertions, 162 deletions
diff --git a/src/pshinter/Jamfile b/src/pshinter/Jamfile
deleted file mode 100644
index 769dcc4..0000000
--- a/src/pshinter/Jamfile
+++ /dev/null
@@ -1,29 +0,0 @@
-# FreeType 2 src/pshinter Jamfile
-#
-# Copyright 2001, 2003 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.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = pshrec pshglob pshalgo pshmod ;
- }
- else
- {
- _sources = pshinter ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pshinter Jamfile
diff --git a/src/pshinter/module.mk b/src/pshinter/module.mk
deleted file mode 100644
index cd171d0..0000000
--- a/src/pshinter/module.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# FreeType 2 PSHinter module definition
-#
-
-
-# Copyright 1996-2001, 2006 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.
-
-
-FTMODULE_H_COMMANDS += PSHINTER_MODULE
-
-define PSHINTER_MODULE
-$(OPEN_DRIVER)pshinter_module_class$(CLOSE_DRIVER)
-$(ECHO_DRIVER)pshinter $(ECHO_DRIVER_DESC)Postscript hinter module$(ECHO_DRIVER_DONE)
-endef
-
-# EOF
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index 505d95c..5d7e2f4 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (body). */
/* */
-/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -2223,15 +2223,22 @@
FT_Fixed x_scale = dim_x->scale_mult;
FT_Fixed y_scale = dim_y->scale_mult;
+ FT_Fixed old_x_scale = x_scale;
+ FT_Fixed old_y_scale = y_scale;
+
FT_Fixed scaled;
FT_Fixed fitted;
+ FT_Bool rescale = FALSE;
+
scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
fitted = FT_PIX_ROUND( scaled );
if ( fitted != 0 && scaled != fitted )
{
+ rescale = TRUE;
+
y_scale = FT_MulDiv( y_scale, fitted, scaled );
if ( fitted < scaled )
@@ -2239,43 +2246,47 @@
psh_globals_set_scale( glyph->globals, x_scale, y_scale, 0, 0 );
}
- }
-
- glyph->do_horz_hints = 1;
- glyph->do_vert_hints = 1;
-
- glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
- hint_mode == FT_RENDER_MODE_LCD );
- glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
- hint_mode == FT_RENDER_MODE_LCD_V );
+ glyph->do_horz_hints = 1;
+ glyph->do_vert_hints = 1;
- glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
+ glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
+ hint_mode == FT_RENDER_MODE_LCD );
- for ( dimension = 0; dimension < 2; dimension++ )
- {
- /* load outline coordinates into glyph */
- psh_glyph_load_points( glyph, dimension );
-
- /* compute local extrema */
- psh_glyph_compute_extrema( glyph );
-
- /* compute aligned stem/hints positions */
- psh_hint_table_align_hints( &glyph->hint_tables[dimension],
- glyph->globals,
- dimension,
- glyph );
+ glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
+ hint_mode == FT_RENDER_MODE_LCD_V );
- /* find strong points, align them, then interpolate others */
- psh_glyph_find_strong_points( glyph, dimension );
- if ( dimension == 1 )
- psh_glyph_find_blue_points( &globals->blues, glyph );
- psh_glyph_interpolate_strong_points( glyph, dimension );
- psh_glyph_interpolate_normal_points( glyph, dimension );
- psh_glyph_interpolate_other_points( glyph, dimension );
+ glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
- /* save hinted coordinates back to outline */
- psh_glyph_save_points( glyph, dimension );
+ for ( dimension = 0; dimension < 2; dimension++ )
+ {
+ /* load outline coordinates into glyph */
+ psh_glyph_load_points( glyph, dimension );
+
+ /* compute local extrema */
+ psh_glyph_compute_extrema( glyph );
+
+ /* compute aligned stem/hints positions */
+ psh_hint_table_align_hints( &glyph->hint_tables[dimension],
+ glyph->globals,
+ dimension,
+ glyph );
+
+ /* find strong points, align them, then interpolate others */
+ psh_glyph_find_strong_points( glyph, dimension );
+ if ( dimension == 1 )
+ psh_glyph_find_blue_points( &globals->blues, glyph );
+ psh_glyph_interpolate_strong_points( glyph, dimension );
+ psh_glyph_interpolate_normal_points( glyph, dimension );
+ psh_glyph_interpolate_other_points( glyph, dimension );
+
+ /* save hinted coordinates back to outline */
+ psh_glyph_save_points( glyph, dimension );
+
+ if ( rescale )
+ psh_globals_set_scale( glyph->globals,
+ old_x_scale, old_y_scale, 0, 0 );
+ }
}
Exit:
diff --git a/src/pshinter/pshalgo.h b/src/pshinter/pshalgo.h
index f68de71..1a248a7 100644
--- a/src/pshinter/pshalgo.h
+++ b/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (specification). */
/* */
-/* Copyright 2001, 2002, 2003 by */
+/* Copyright 2001, 2002, 2003, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -32,7 +32,7 @@ FT_BEGIN_HEADER
typedef struct PSH_HintRec_* PSH_Hint;
/* hint bit-flags */
- typedef enum
+ typedef enum PSH_Hint_Flags_
{
PSH_HINT_GHOST = PS_HINT_FLAG_GHOST,
PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h
index f7ef900..dcb3197 100644
--- a/src/pshinter/pshrec.h
+++ b/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
/* */
/* Postscript (Type1/Type2) hints recorder (specification). */
/* */
-/* Copyright 2001, 2002, 2003, 2006 by */
+/* Copyright 2001, 2002, 2003, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -52,7 +52,7 @@ FT_BEGIN_HEADER
typedef struct PS_HintRec_* PS_Hint;
/* hint types */
- typedef enum
+ typedef enum PS_Hint_Type_
{
PS_HINT_TYPE_1 = 1,
PS_HINT_TYPE_2 = 2
@@ -61,7 +61,7 @@ FT_BEGIN_HEADER
/* hint flags */
- typedef enum
+ typedef enum PS_Hint_Flags_
{
PS_HINT_FLAG_GHOST = 1,
PS_HINT_FLAG_BOTTOM = 2
diff --git a/src/pshinter/rules.mk b/src/pshinter/rules.mk
deleted file mode 100644
index 5777339..0000000
--- a/src/pshinter/rules.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# FreeType 2 PSHinter driver configuration rules
-#
-
-
-# Copyright 2001, 2003 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.
-
-
-# PSHINTER driver directory
-#
-PSHINTER_DIR := $(SRC_DIR)/pshinter
-
-
-# compilation flags for the driver
-#
-PSHINTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSHINTER_DIR))
-
-
-# PSHINTER driver sources (i.e., C files)
-#
-PSHINTER_DRV_SRC := $(PSHINTER_DIR)/pshrec.c \
- $(PSHINTER_DIR)/pshglob.c \
- $(PSHINTER_DIR)/pshmod.c \
- $(PSHINTER_DIR)/pshalgo.c
-
-
-# PSHINTER driver headers
-#
-PSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h) \
- $(PSHINTER_DIR)/pshnterr.h
-
-
-# PSHINTER driver object(s)
-#
-# PSHINTER_DRV_OBJ_M is used during `multi' builds.
-# PSHINTER_DRV_OBJ_S is used during `single' builds.
-#
-PSHINTER_DRV_OBJ_M := $(PSHINTER_DRV_SRC:$(PSHINTER_DIR)/%.c=$(OBJ_DIR)/%.$O)
-PSHINTER_DRV_OBJ_S := $(OBJ_DIR)/pshinter.$O
-
-# PSHINTER driver source file for single build
-#
-PSHINTER_DRV_SRC_S := $(PSHINTER_DIR)/pshinter.c
-
-
-# PSHINTER driver - single object
-#
-$(PSHINTER_DRV_OBJ_S): $(PSHINTER_DRV_SRC_S) $(PSHINTER_DRV_SRC) \
- $(FREETYPE_H) $(PSHINTER_DRV_H)
- $(PSHINTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(PSHINTER_DRV_SRC_S))
-
-
-# PSHINTER driver - multiple objects
-#
-$(OBJ_DIR)/%.$O: $(PSHINTER_DIR)/%.c $(FREETYPE_H) $(PSHINTER_DRV_H)
- $(PSHINTER_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
-
-
-# update main driver object lists
-#
-DRV_OBJS_S += $(PSHINTER_DRV_OBJ_S)
-DRV_OBJS_M += $(PSHINTER_DRV_OBJ_M)
-
-
-# EOF