Formatting, minor clean-ups.

This commit is contained in:
Werner Lemberg 2006-01-15 07:30:32 +00:00
parent ce5ee00d02
commit 1723dcc261
6 changed files with 36 additions and 31 deletions

View File

@ -1,31 +1,34 @@
2006-01-15 Chia-I Wu <b90201047@ntu.edu.tw> 2006-01-15 Chia-I Wu <b90201047@ntu.edu.tw>
* include/freetype/internal/ftobjs.h (ft_fake_vertical_metrics), * include/freetype/internal/ftobjs.h (ft_fake_vertical_metrics),
src/base/ftobjs.c (ft_fake_vertical_metrics): New function to fake the src/base/ftobjs.c (ft_fake_vertical_metrics): New function to fake
vertical metrics. vertical metrics.
* src/cff/cffgload.c, src/cid/cidgload.c, src/pcf/pcfdrivr.c, * src/cff/cffgload.c, src/cid/cidgload.c, src/pcf/pcfdrivr.c,
src/type1/t1gload.c, src/winfonts/winfnt.c: Fake the vertical metrics. src/type1/t1gload.c, src/winfonts/winfnt.c: Fake vertical metrics,
The fake metrics is monotone. which are monotone.
* src/truetype/ttgload.c (compute_glyph_metrics): Some fixes and * src/truetype/ttgload.c (compute_glyph_metrics): Some fixes and
formattings in vertical metrics faking. There are still rooms for formattings in vertical metrics faking. There is still room for
improvements (and so do the CFF module). improvements (and so does the CFF module).
2006-01-15 Chia-I Wu <b90201047@ntu.edu.tw> 2006-01-15 Chia-I Wu <b90201047@ntu.edu.tw>
* src/bdf/bdfdrivr.c (BDF_Glyph_Load), src/pcf/pcfdrivr.c * src/bdf/bdfdrivr.c (BDF_Glyph_Load), src/pcf/pcfdrivr.c
(PCF_Glyph_Load), src/winfonts/winfnt.c (FNT_Load_Glyph): Don't set (PCF_Glyph_Load), src/winfonts/winfnt.c (FNT_Load_Glyph): Don't set
the linear advance fields as they are only for the outline glyphs. the linear advance fields as they are only used by the outline
glyphs.
* include/freetype/freetype.h: Documentation updates/clarificatoins. * include/freetype/freetype.h: Documentation updates and
clarifications.
The meaning of FT_LOAD_FORCE_AUTOHINT is changed so that no real The meaning of FT_LOAD_FORCE_AUTOHINT is changed so that no real
change need be made to the code. change need be made to the code.
* src/base/ftobjs.c (FT_Load_Glyph): Resolve flag dependencies and * src/base/ftobjs.c (FT_Load_Glyph): Resolve flag dependencies and
decide whether to use the auto-hinter according to documentation. decide whether to use the auto-hinter according to documentation.
There should to be no real difference. There should to be no real difference.
Some checks (e.g., is text height positve?) after the glyph is loaded. Some checks (e.g., is text height positve?) after the glyph is
loaded.
(FT_Select_Size, FT_Request_Size): Scales are set to wrong values. (FT_Select_Size, FT_Request_Size): Scales are set to wrong values.
Be careful that scales won't be negative. Be careful that scales won't be negative.

View File

@ -1238,16 +1238,16 @@ FT_BEGIN_HEADER
/* */ /* */
/* y_ppem :: The height of the scaled EM square in pixels, */ /* y_ppem :: The height of the scaled EM square in pixels, */
/* hence the term `ppem' (pixels per EM). It is also */ /* hence the term `ppem' (pixels per EM). It is also */
/* refeered to as `nominal height'. */ /* referred to as `nominal height'. */
/* */ /* */
/* x_scale :: A 16.16 fractional scale used to convert */ /* x_scale :: A 16.16 fractional scale used to convert */
/* horizontal metrics from font units to 26.6 */ /* horizontal metrics from font units to 26.6 */
/* fractional pixels. Only relevant for scalable */ /* fractional pixels. Only relevant for scalable */
/* formats. */ /* font formats. */
/* */ /* */
/* y_scale :: A 16.16 fractional scale used to convert vertical */ /* y_scale :: A 16.16 fractional scale used to convert vertical */
/* metrics from font units to 26.6 fractional pixels. */ /* metrics from font units to 26.6 fractional pixels. */
/* Only relevant for scalable formats. */ /* Only relevant for scalable font formats. */
/* */ /* */
/* ascender :: The ascender in 26.6 fractional pixels. See */ /* ascender :: The ascender in 26.6 fractional pixels. See */
/* @FT_FaceRec for the details. */ /* @FT_FaceRec for the details. */
@ -1263,9 +1263,9 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Note> */ /* <Note> */
/* The scales, if relevant, are determined first during a size */ /* The scales, if relevant, are determined first during a size */
/* changing operation. The reset fields are then set by the driver. */ /* changing operation. The remaining fields are then set by the */
/* For scalable formats, they are usually set to scaled values of the */ /* driver. For scalable formats, they are usually set to scaled */
/* corresponding fields in @FT_FaceRec. */ /* values of the corresponding fields in @FT_FaceRec. */
/* */ /* */
/* Note that due to glyph hinting, these values might not be exact */ /* Note that due to glyph hinting, these values might not be exact */
/* for certain fonts. Thus they must be treated as unreliable */ /* for certain fonts. Thus they must be treated as unreliable */
@ -2432,8 +2432,8 @@ FT_BEGIN_HEADER
* `load_flags'. They can't be ORed. * `load_flags'. They can't be ORed.
* *
* If @FT_LOAD_RENDER is also set, the glyph is rendered in the * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
* corresponding mode (i.e., the mode best matching the algorithm used) * corresponding mode (i.e., the mode which matches the used algorithm
* unless @FT_LOAD_MONOCHROME is set. * best) unless @FT_LOAD_MONOCHROME is set.
* *
* You can use a hinting algorithm that doesn't correspond to the same * You can use a hinting algorithm that doesn't correspond to the same
* rendering mode. As an example, it is possible to use the `light' * rendering mode. As an example, it is possible to use the `light'

View File

@ -520,12 +520,12 @@
load_flags |= FT_LOAD_FORCE_AUTOHINT; load_flags |= FT_LOAD_FORCE_AUTOHINT;
/* auto-hinter is preferred and should be used */ /* auto-hinter is preferred and should be used */
if ( ( !FT_DRIVER_HAS_HINTER( driver ) || if ( ( !FT_DRIVER_HAS_HINTER( driver ) ||
( load_flags & FT_LOAD_FORCE_AUTOHINT ) ) && ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ) &&
!( load_flags & FT_LOAD_NO_HINTING ) && !( load_flags & FT_LOAD_NO_HINTING ) &&
!( load_flags & FT_LOAD_NO_AUTOHINT ) ) !( load_flags & FT_LOAD_NO_AUTOHINT ) )
{ {
/* check if it works for this face */ /* check whether it works for this face */
autohint = autohint =
FT_BOOL( hinter && FT_BOOL( hinter &&
FT_DRIVER_IS_SCALABLE( driver ) && FT_DRIVER_IS_SCALABLE( driver ) &&
@ -1729,7 +1729,7 @@
if ( FT_HAS_FIXED_SIZES( face ) ) if ( FT_HAS_FIXED_SIZES( face ) )
{ {
FT_Int i; FT_Int i;
for ( i = 0; i < face->num_fixed_sizes; i++ ) for ( i = 0; i < face->num_fixed_sizes; i++ )
@ -2045,6 +2045,7 @@
ft_fake_vertical_metrics( FT_Glyph_Metrics* metrics, ft_fake_vertical_metrics( FT_Glyph_Metrics* metrics,
FT_Pos advance ) FT_Pos advance )
{ {
/* the factor 1.2 is a heuristical value */
if ( !advance ) if ( !advance )
advance = metrics->height * 12 / 10; advance = metrics->height * 12 / 10;
@ -2110,8 +2111,8 @@
} }
else else
{ {
metrics->x_scale = 1 << 22; metrics->x_scale = 1L << 22;
metrics->y_scale = 1 << 22; metrics->y_scale = 1L << 22;
metrics->ascender = bsize->y_ppem; metrics->ascender = bsize->y_ppem;
metrics->descender = 0; metrics->descender = 0;
metrics->height = bsize->height << 6; metrics->height = bsize->height << 6;
@ -2238,8 +2239,8 @@
else else
{ {
FT_ZERO( metrics ); FT_ZERO( metrics );
metrics->x_scale = 1 << 22; metrics->x_scale = 1L << 22;
metrics->y_scale = 1 << 22; metrics->y_scale = 1L << 22;
if ( FT_HAS_FIXED_SIZES( face ) ) if ( FT_HAS_FIXED_SIZES( face ) )
bitmap_only = 1; bitmap_only = 1;

View File

@ -2610,9 +2610,9 @@
glyph->root.linearHoriAdvance = decoder.glyph_width; glyph->root.linearHoriAdvance = decoder.glyph_width;
glyph->root.internal->glyph_transformed = 0; glyph->root.internal->glyph_transformed = 0;
has_vertical_info = ( face->vertical_info && has_vertical_info = face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 && face->vertical.number_Of_VMetrics > 0 &&
face->vertical.long_metrics != 0 ); face->vertical.long_metrics != 0;
/* get the vertical metrics from the vtmx table if we have one */ /* get the vertical metrics from the vtmx table if we have one */
if ( has_vertical_info ) if ( has_vertical_info )

View File

@ -343,8 +343,8 @@
cidglyph->internal->glyph_transformed = 0; cidglyph->internal->glyph_transformed = 0;
/* make up vertical ones */ /* make up vertical ones */
metrics->vertAdvance = ( face->cid.font_bbox.yMax - metrics->vertAdvance = ( face->cid.font_bbox.yMax -
face->cid.font_bbox.yMin ) >> 16; face->cid.font_bbox.yMin ) >> 16;
cidglyph->linearVertAdvance = metrics->vertAdvance; cidglyph->linearVertAdvance = metrics->vertAdvance;
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;

View File

@ -1673,8 +1673,8 @@
/* up some metrics by `hand'... */ /* up some metrics by `hand'... */
{ {
FT_Pos top; /* scaled vertical top side bearing */ FT_Pos top; /* scaled vertical top side bearing */
FT_Pos advance; /* scaled vertical advance height */ FT_Pos advance; /* scaled vertical advance height */
/* Get the unscaled top bearing and advance height. */ /* Get the unscaled top bearing and advance height. */
@ -1731,6 +1731,7 @@
metrics.bearing_x = 0; metrics.bearing_x = 0;
metrics.bearing_y = top; metrics.bearing_y = top;
metrics.advance = advance; metrics.advance = advance;
error = incr->funcs->get_glyph_metrics( incr->object, error = incr->funcs->get_glyph_metrics( incr->object,
glyph_index, glyph_index,
TRUE, TRUE,