< prev index next >
src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c
Print this page
*** 147,157 ****
--- 147,161 ----
}
af_shaper_buf_destroy( face, shaper_buf );
if ( !glyph_index )
+ {
+ FT_TRACE5(( "standard character missing;"
+ " using fallback stem widths\n" ));
goto Exit;
+ }
FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
ch, glyph_index ));
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
*** 310,320 ****
/* Find all blue zones. Flat segments give the reference points, */
/* round segments the overshoot positions. */
! static void
af_latin_metrics_init_blues( AF_LatinMetrics metrics,
FT_Face face )
{
FT_Pos flats [AF_BLUE_STRING_MAX_LEN];
FT_Pos rounds[AF_BLUE_STRING_MAX_LEN];
--- 314,324 ----
/* Find all blue zones. Flat segments give the reference points, */
/* round segments the overshoot positions. */
! static int
af_latin_metrics_init_blues( AF_LatinMetrics metrics,
FT_Face face )
{
FT_Pos flats [AF_BLUE_STRING_MAX_LEN];
FT_Pos rounds[AF_BLUE_STRING_MAX_LEN];
*** 979,992 ****
} /* end for loop */
af_shaper_buf_destroy( face, shaper_buf );
- /* we finally check whether blue zones are ordered; */
- /* `ref' and `shoot' values of two blue zones must not overlap */
if ( axis->blue_count )
{
FT_UInt i;
AF_LatinBlue blue_sorted[AF_BLUE_STRINGSET_MAX_LEN + 2];
for ( i = 0; i < axis->blue_count; i++ )
--- 983,997 ----
} /* end for loop */
af_shaper_buf_destroy( face, shaper_buf );
if ( axis->blue_count )
{
+ /* we finally check whether blue zones are ordered; */
+ /* `ref' and `shoot' values of two blue zones must not overlap */
+
FT_UInt i;
AF_LatinBlue blue_sorted[AF_BLUE_STRINGSET_MAX_LEN + 2];
for ( i = 0; i < axis->blue_count; i++ )
*** 1031,1045 ****
a_is_top ? "overshoot" : "reference",
blue_sorted[i] - axis->blues,
*a ));
}
}
}
FT_TRACE5(( "\n" ));
! return;
}
/* Check whether all ASCII digits have the same advance width. */
--- 1036,1073 ----
a_is_top ? "overshoot" : "reference",
blue_sorted[i] - axis->blues,
*a ));
}
}
+
+ FT_TRACE5(( "\n" ));
+
+ return 0;
+ }
+ else
+ {
+ /* disable hinting for the current style if there are no blue zones */
+
+ AF_FaceGlobals globals = metrics->root.globals;
+ FT_UShort* gstyles = globals->glyph_styles;
+
+ FT_Long i;
+
+
+ FT_TRACE5(( "no blue zones found:"
+ " hinting disabled for this style\n" ));
+
+ for ( i = 0; i < globals->glyph_count; i++ )
+ {
+ if ( ( gstyles[i] & AF_STYLE_MASK ) == sc->style )
+ gstyles[i] = AF_STYLE_NONE_DFLT;
}
FT_TRACE5(( "\n" ));
! return 1;
! }
}
/* Check whether all ASCII digits have the same advance width. */
*** 1114,1137 ****
FT_LOCAL_DEF( FT_Error )
af_latin_metrics_init( AF_LatinMetrics metrics,
FT_Face face )
{
FT_CharMap oldmap = face->charmap;
metrics->units_per_em = face->units_per_EM;
if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
{
af_latin_metrics_init_widths( metrics, face );
! af_latin_metrics_init_blues( metrics, face );
af_latin_metrics_check_digits( metrics, face );
}
FT_Set_Charmap( face, oldmap );
! return FT_Err_Ok;
}
/* Adjust scaling value, then scale and shift widths */
/* and blue zones (if applicable) for given dimension. */
--- 1142,1173 ----
FT_LOCAL_DEF( FT_Error )
af_latin_metrics_init( AF_LatinMetrics metrics,
FT_Face face )
{
+ FT_Error error = FT_Err_Ok;
+
FT_CharMap oldmap = face->charmap;
metrics->units_per_em = face->units_per_EM;
if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
{
af_latin_metrics_init_widths( metrics, face );
! if ( af_latin_metrics_init_blues( metrics, face ) )
! {
! /* use internal error code to indicate missing blue zones */
! error = -1;
! goto Exit;
! }
af_latin_metrics_check_digits( metrics, face );
}
+ Exit:
FT_Set_Charmap( face, oldmap );
! return error;
}
/* Adjust scaling value, then scale and shift widths */
/* and blue zones (if applicable) for given dimension. */
*** 1441,1456 ****
FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n"
" overshoot %d: %d scaled to %.2f%s\n",
nn,
blue->ref.org,
blue->ref.fit / 64.0,
! blue->flags & AF_LATIN_BLUE_ACTIVE ? ""
: " (inactive)",
nn,
blue->shoot.org,
blue->shoot.fit / 64.0,
! blue->flags & AF_LATIN_BLUE_ACTIVE ? ""
: " (inactive)" ));
}
#endif
}
}
--- 1477,1492 ----
FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n"
" overshoot %d: %d scaled to %.2f%s\n",
nn,
blue->ref.org,
blue->ref.fit / 64.0,
! ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? ""
: " (inactive)",
nn,
blue->shoot.org,
blue->shoot.fit / 64.0,
! ( blue->flags & AF_LATIN_BLUE_ACTIVE ) ? ""
: " (inactive)" ));
}
#endif
}
}
< prev index next >