summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/pshinter/pshglob.c
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-03-19 17:34:42 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-03-20 13:42:29 +0000
commit2eaf0cf8fd6e7c290497fedb08134a89e7b49b1d (patch)
tree0a4f7bf528e87d0b0a71ce7fccf702b87f4cdec1 /src/3rdparty/freetype/src/pshinter/pshglob.c
parent77c518a50334d4dcf2476a4f39edc1e3990c7f0b (diff)
Update bundled FreeType to 2.5.5
Removed everything, imported with help of import_from_tarball.sh script, and then added a pre-generated builds/unix/ftconfig.h Task-number: QTBUG-44648 Change-Id: Iea948e41f7761f1580382b3763d04c7a61383382 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/freetype/src/pshinter/pshglob.c')
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshglob.c59
1 files changed, 52 insertions, 7 deletions
diff --git a/src/3rdparty/freetype/src/pshinter/pshglob.c b/src/3rdparty/freetype/src/pshinter/pshglob.c
index 8a69aa1e84..1bcc481b9b 100644
--- a/src/3rdparty/freetype/src/pshinter/pshglob.c
+++ b/src/3rdparty/freetype/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
/* PostScript hinter global hinting management (body). */
/* Inspired by the new auto-hinter module. */
/* */
-/* Copyright 2001, 2002, 2003, 2004, 2006 by */
+/* Copyright 2001-2004, 2006, 2010, 2012-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -522,6 +522,28 @@
}
+ /* calculate the maximum height of given blue zones */
+ static FT_Short
+ psh_calc_max_height( FT_UInt num,
+ const FT_Short* values,
+ FT_Short cur_max )
+ {
+ FT_UInt count;
+
+
+ for ( count = 0; count < num; count += 2 )
+ {
+ FT_Short cur_height = values[count + 1] - values[count];
+
+
+ if ( cur_height > cur_max )
+ cur_max = cur_height;
+ }
+
+ return cur_max;
+ }
+
+
FT_LOCAL_DEF( void )
psh_blues_snap_stem( PSH_Blues blues,
FT_Int stem_top,
@@ -624,7 +646,7 @@
T1_Private* priv,
PSH_Globals *aglobals )
{
- PSH_Globals globals;
+ PSH_Globals globals = NULL;
FT_Error error;
@@ -684,7 +706,32 @@
priv->family_blues, priv->num_family_other_blues,
priv->family_other_blues, priv->blue_fuzz, 1 );
- globals->blues.blue_scale = priv->blue_scale;
+ /* limit the BlueScale value to `1 / max_of_blue_zone_heights' */
+ {
+ FT_Fixed max_scale;
+ FT_Short max_height = 1;
+
+
+ max_height = psh_calc_max_height( priv->num_blue_values,
+ priv->blue_values,
+ max_height );
+ max_height = psh_calc_max_height( priv->num_other_blues,
+ priv->other_blues,
+ max_height );
+ max_height = psh_calc_max_height( priv->num_family_blues,
+ priv->family_blues,
+ max_height );
+ max_height = psh_calc_max_height( priv->num_family_other_blues,
+ priv->family_other_blues,
+ max_height );
+
+ /* BlueScale is scaled 1000 times */
+ max_scale = FT_DivFix( 1000, max_height );
+ globals->blues.blue_scale = priv->blue_scale < max_scale
+ ? priv->blue_scale
+ : max_scale;
+ }
+
globals->blues.blue_shift = priv->blue_shift;
globals->blues.blue_fuzz = priv->blue_fuzz;
@@ -703,14 +750,14 @@
}
- FT_LOCAL_DEF( FT_Error )
+ FT_LOCAL_DEF( void )
psh_globals_set_scale( PSH_Globals globals,
FT_Fixed x_scale,
FT_Fixed y_scale,
FT_Fixed x_delta,
FT_Fixed y_delta )
{
- PSH_Dimension dim = &globals->dimension[0];
+ PSH_Dimension dim;
dim = &globals->dimension[0];
@@ -733,8 +780,6 @@
psh_globals_scale_widths( globals, 1 );
psh_blues_scale_zones( &globals->blues, y_scale, y_delta );
}
-
- return 0;
}