Revert "Formatting."

This reverts commit a0f3a1f25a.
This commit is contained in:
Werner Lemberg 2016-07-08 06:58:46 +02:00
parent a0f3a1f25a
commit 109d1662d4
4 changed files with 17 additions and 137 deletions

View File

@ -2,25 +2,25 @@
[smooth] Sub-banding protocol revision.
Rasterization sub-banding is utilized at large sizes while using a
rather small fixed memory pool. Indeed it is possible to make an
Rasterization sub-banding is utilized at large sizes while using
rather small fixed memory pool. Indeed it is possible to make an
educated guess how much memory is necessary at a given size for a
given glyph. It turns out that, for a large majority of European
glyphs, you should store about 8 times more boundary pixels than
their height. Or, vice versa, if your memory pool can hold 800
pixels the band height should be 100 and you should sub-band
anything larger than that. Should you still run out of memory,
FreeType bisects the band but you have wasted some time. This is
what has been implemented in FreeType since the beginning.
given glyph. It turns out that, for large majority of European glyphs,
you should store about 8 times more boundary pixels than their height.
Or, vice versa, if your memory pool can hold 800 pixels the band
height should be 100 and you should sub-band anything larger than
that. Should you still run out of memory, FreeType bisects the band
but you have wasted some time. This is what has been implemented in
FreeType since the beginning.
It was overlooked, however, that the top band could grow to twice
the default band size leading to unnecessary memory overflows there.
This commit fixes that. Now the bands are distributed more evenly
and cannot exceed the default size.
It was overlooked, however, that the top band could grow to twice the
default band size leading to unnecessary memory overflows there. This
commit fixes that. Now the bands are distributed more evenly and
cannot exceed the default size.
Now the magic number 8 is really suitable for rather simple European
scripts. For complex Chinese logograms the magic number should be
13 but that is subject for another day.
scripts. For complex Chinese logograms the magic number should be 13
but that is subject for another day.
* src/smooth/ftgrays.c (gray_convert_glyph): Revise sub-banding
protocol.

View File

@ -142,8 +142,7 @@
/**********************************************************************/
#define ft_atol atol
#define ft_getenv getenv
#define ft_atol atol
/**********************************************************************/

View File

@ -226,123 +226,6 @@
}
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
#define MAX_LENGTH 128
/*
* The `FREETYPE_PROPERTIES' environment variable has the following
* syntax form (broken here into multiple lines for better readability)
*
* <whitespace>
* <module-name1> ':'
* <property-name1> '=' <property-value1>
* <whitespace>
* <module-name2> ':'
* <property-name2> '=' <property-value2>
* ...
*
* Example:
*
* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
* cff:no-stem-darkening=1 \
* autofitter:warping=1
*
*/
static void
ft_get_default_properties( FT_Library library )
{
const char* env;
const char* p;
const char* q;
char module_name[MAX_LENGTH + 1];
char property_name[MAX_LENGTH + 1];
char property_value[MAX_LENGTH + 1];
int i;
env = getenv( "FREETYPE_PROPERTIES" );
if ( !env )
return;
for ( p = env; *p; p++ )
{
module_name[0] = '\0';
property_name[0] = '\0';
property_value[0] = '\0';
/* skip leading whitespace and separators */
if ( *p == ' ' || *p == '\t' )
continue;
/* read module name, followed by `:' */
q = p;
for ( i = 0; i < MAX_LENGTH; i++ )
{
if ( !*p || *p == ':' )
break;
module_name[i] = *p++;
}
module_name[i] = '\0';
if ( !*p )
break;
if ( *p != ':' || p == q )
break;
/* read property name, followed by `=' */
q = p;
for ( i = 0; i < MAX_LENGTH; i++ )
{
if ( !*p || *p == '=' )
break;
property_name[i] = *p++;
}
property_name[i] = '\0';
if ( !*p )
break;
if ( *p != '=' || p == q )
break;
/* read property value, followed by whitespace (if any) */
q = p;
for ( i = 0; i < MAX_LENGTH; i++ )
{
if ( !*p || *p == ' ' || *p == '\t' )
break;
property_value[i] = *p++;
}
property_value[i] = '\0';
if ( !( *p == '\0' || *p == ' ' || *p == '\t' ) || p == q )
break;
/* we have all data; resolve them into a call to FT_Property_Set */
/* if possible */
/* we completely ignore errors */
FT_Property_Set( library,
module_name,
property_name,
property_value );
}
}
#else
static void
ft_get_default_properties( FT_Library library )
{
FT_UNUSED( library );
}
#endif
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Error )
@ -373,8 +256,6 @@
else
FT_Add_Default_Modules( *alibrary );
ft_get_default_properties( *alibrary );
return error;
}

View File

@ -1911,7 +1911,7 @@ typedef ptrdiff_t FT_PtrDist;
min = ras.min_ey;
max_y = ras.max_ey;
for ( ; min < max_y; min = max )
for (; min < max_y; min = max )
{
max = min + band_size;
if ( max > max_y )