167 |
FT_UInt horz_resolution, |
FT_UInt horz_resolution, |
168 |
FT_UInt vert_resolution ) |
FT_UInt vert_resolution ) |
169 |
{ |
{ |
170 |
TT_Size size = (TT_Size)ttsize; |
TT_Size size = (TT_Size)ttsize; |
171 |
FT_Size_Metrics* metrics = &size->root.metrics; |
FT_Size_Metrics* metrics = &size->metrics; |
172 |
FT_Size_Metrics* metrics2 = &size->metrics; |
TT_Face face = (TT_Face)size->root.face; |
|
TT_Face face = (TT_Face)size->root.face; |
|
|
FT_Long dim_x, dim_y; |
|
173 |
|
|
174 |
|
|
175 |
*metrics2 = *metrics; |
/* copy the result from base layer */ |
176 |
|
*metrics = size->root.metrics; |
177 |
|
|
178 |
/* This bit flag, when set, indicates that the pixel size must be */ |
/* This bit flag, when set, indicates that the pixel size must be */ |
179 |
/* truncated to an integer. Nearly all TrueType fonts have this */ |
/* rounded to integer. Nearly all TrueType fonts have this bit */ |
180 |
/* bit set, as hinting won't work really well otherwise. */ |
/* set, as hinting won't work really well otherwise. */ |
181 |
/* */ |
/* */ |
182 |
if ( ( face->header.Flags & 8 ) != 0 ) |
if ( ( face->header.Flags & 8 ) != 0 ) |
183 |
{ |
{ |
184 |
/* we need to use rounding in the following computations. Otherwise, |
FT_Long dim_x, dim_y; |
|
* the resulting hinted outlines will be very slightly distorted |
|
|
*/ |
|
|
dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & ~63; |
|
|
dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & ~63; |
|
|
} |
|
|
else |
|
|
{ |
|
|
dim_x = ( ( char_width * horz_resolution + 36 ) / 72 ); |
|
|
dim_y = ( ( char_height * vert_resolution + 36 ) / 72 ); |
|
|
} |
|
185 |
|
|
186 |
/* we only modify "metrics2", not "metrics", so these changes have */ |
dim_x = ( char_width * horz_resolution + 36 ) / 72; |
187 |
/* no effect on the result of the auto-hinter when it is used */ |
dim_y = ( char_height * vert_resolution + 36 ) / 72; |
188 |
/* */ |
|
189 |
metrics2->x_ppem = (FT_UShort)( dim_x >> 6 ); |
dim_x = FT_PIX_ROUND(dim_x); |
190 |
metrics2->y_ppem = (FT_UShort)( dim_y >> 6 ); |
dim_y = FT_PIX_ROUND(dim_y); |
191 |
metrics2->x_scale = FT_DivFix( dim_x, face->root.units_per_EM ); |
|
192 |
metrics2->y_scale = FT_DivFix( dim_y, face->root.units_per_EM ); |
metrics->x_ppem = (FT_UShort)( dim_x >> 6 ); |
193 |
|
metrics->y_ppem = (FT_UShort)( dim_y >> 6 ); |
194 |
|
metrics->x_scale = FT_DivFix( dim_x, face->root.units_per_EM ); |
195 |
|
metrics->y_scale = FT_DivFix( dim_y, face->root.units_per_EM ); |
196 |
|
} |
197 |
|
|
198 |
size->ttmetrics.valid = FALSE; |
size->ttmetrics.valid = FALSE; |
199 |
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |