40 #include FT_INTERNAL_DEBUG_H 54 #define FT_COMPONENT trace_cf2blues 62 #define cf2_blueToFixed( x ) cf2_intToFixed( x ) 78 size_t numFamilyBlues;
79 size_t numFamilyOtherBlues;
89 CF2_Int unitsPerEm = font->unitsPerEm;
92 if ( unitsPerEm == 0 )
96 blues->scale = font->innerTransform.d;
122 FCM_getHorizontalLineMetrics( &e,
127 if ( ascender - descender == unitsPerEm )
140 ( numBlueValues == 0 ||
141 ( numBlueValues == 4 &&
161 blues->emBoxBottomEdge.csCoord,
164 blues->emBoxBottomEdge.scale = blues->scale;
169 blues->emBoxTopEdge.csCoord = emBoxTop + CF2_FIXED_EPSILON +
173 blues->emBoxTopEdge.csCoord,
176 blues->emBoxTopEdge.scale = blues->scale;
181 blues->doEmBoxHints =
TRUE;
188 for ( i = 0; i < numBlueValues; i += 2 )
190 blues->zone[blues->count].csBottomEdge =
192 blues->zone[blues->count].csTopEdge =
195 zoneHeight = blues->zone[blues->count].csTopEdge -
196 blues->zone[blues->count].csBottomEdge;
198 if ( zoneHeight < 0 )
200 FT_TRACE4((
"cf2_blues_init: ignoring negative zone height\n" ));
204 if ( zoneHeight > maxZoneHeight )
208 maxZoneHeight = zoneHeight;
214 blues->zone[blues->count].csTopEdge += 2 * font->darkenY;
215 blues->zone[blues->count].csBottomEdge += 2 * font->darkenY;
221 blues->zone[blues->count].bottomZone =
223 blues->zone[blues->count].csFlatEdge =
224 blues->zone[blues->count].csTopEdge;
228 blues->zone[blues->count].bottomZone =
230 blues->zone[blues->count].csFlatEdge =
231 blues->zone[blues->count].csBottomEdge;
237 for ( i = 0; i < numOtherBlues; i += 2 )
239 blues->zone[blues->count].csBottomEdge =
241 blues->zone[blues->count].csTopEdge =
244 zoneHeight = blues->zone[blues->count].csTopEdge -
245 blues->zone[blues->count].csBottomEdge;
247 if ( zoneHeight < 0 )
249 FT_TRACE4((
"cf2_blues_init: ignoring negative zone height\n" ));
253 if ( zoneHeight > maxZoneHeight )
257 maxZoneHeight = zoneHeight;
263 blues->zone[blues->count].bottomZone =
265 blues->zone[blues->count].csFlatEdge =
266 blues->zone[blues->count].csTopEdge;
280 for ( i = 0; i < blues->count; i++ )
286 CF2_Fixed flatEdge = blues->zone[
i].csFlatEdge;
289 if ( blues->zone[i].bottomZone )
297 for ( j = 0; j < numFamilyOtherBlues; j += 2 )
304 if ( diff < minDiff && diff < csUnitsPerPixel )
306 blues->zone[
i].csFlatEdge = flatFamilyEdge;
315 if ( numFamilyBlues >= 2 )
322 if ( diff < minDiff && diff < csUnitsPerPixel )
323 blues->zone[
i].csFlatEdge = flatFamilyEdge;
335 for ( j = 2; j < numFamilyBlues; j += 2 )
341 flatFamilyEdge += 2 * font->darkenY;
345 if ( diff < minDiff && diff < csUnitsPerPixel )
347 blues->zone[
i].csFlatEdge = flatFamilyEdge;
362 if ( maxZoneHeight > 0 )
383 if ( blueScale < .4 / maxZoneHeight )
385 tetraphilia_assert( 0 );
387 blueScale = .4 / maxZoneHeight;
401 if ( blues->scale < blues->blueScale )
403 blues->suppressOvershoot =
TRUE;
413 blues->blueScale ) ) );
414 if ( blues->boost > 0x7FFF )
417 blues->boost = 0x7FFF;
422 if ( font->stemDarkened )
428 for ( i = 0; i < blues->count; i++ )
430 if ( blues->zone[i].bottomZone )
433 blues->zone[i].csFlatEdge,
439 blues->zone[i].csFlatEdge,
486 for (
i = 0;
i < blues->count;
i++ )
488 if ( blues->zone[
i].bottomZone &&
491 if ( ( blues->zone[
i].csBottomEdge - csFuzz ) <=
492 bottomHintEdge->csCoord &&
493 bottomHintEdge->csCoord <=
494 ( blues->zone[
i].csTopEdge + csFuzz ) )
498 if ( blues->suppressOvershoot )
499 dsNew = blues->zone[
i].dsFlatEdge;
501 else if ( ( blues->zone[
i].csTopEdge - bottomHintEdge->csCoord ) >=
516 dsMove = dsNew - bottomHintEdge->dsCoord;
525 if ( ( blues->zone[
i].csBottomEdge - csFuzz ) <=
526 topHintEdge->csCoord &&
527 topHintEdge->csCoord <=
528 ( blues->zone[
i].csTopEdge + csFuzz ) )
532 if ( blues->suppressOvershoot )
533 dsNew = blues->zone[
i].dsFlatEdge;
535 else if ( ( topHintEdge->csCoord - blues->zone[
i].csBottomEdge ) >=
550 dsMove = dsNew - topHintEdge->dsCoord;
563 bottomHintEdge->dsCoord += dsMove;
569 topHintEdge->dsCoord += dsMove;
#define cf2_fixedRound(x)
cf2_getFamilyOtherBlues(CFF_Decoder *decoder, size_t *count, FT_Pos **data)
FT_DivFix(FT_Long a, FT_Long b)
cf2_hint_isBottom(const CF2_Hint hint)
FT_BEGIN_HEADER typedef signed long FT_Pos
cf2_getOtherBlues(CFF_Decoder *decoder, size_t *count, FT_Pos **data)
cf2_hint_lock(CF2_Hint hint)
cf2_getFamilyBlues(CFF_Decoder *decoder, size_t *count, FT_Pos **data)
cf2_blues_init(CF2_Blues blues, CF2_Font font)
cf2_getBlueValues(CFF_Decoder *decoder, size_t *count, FT_Pos **data)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
cf2_getLanguageGroup(CFF_Decoder *decoder)
cf2_blues_capture(const CF2_Blues blues, CF2_Hint bottomHintEdge, CF2_Hint topHintEdge)
#define FT_ASSERT(condition)
#define FT_TRACE4(varformat)
#define cf2_blueToFixed(x)
cf2_hint_isValid(const CF2_Hint hint)
#define cf2_intToFixed(i)
cf2_getBlueMetrics(CFF_Decoder *decoder, CF2_Fixed *blueScale, CF2_Fixed *blueShift, CF2_Fixed *blueFuzz)
FT_MulFix(FT_Long a, FT_Long b)
#define cf2_floatToFixed(f)
cf2_hint_isTop(const CF2_Hint hint)
#define CF2_FIXED_EPSILON