40 #include FT_INTERNAL_DEBUG_H 55 #define FT_COMPONENT trace_cf2hints 58 typedef struct CF2_HintMoveRec_
77 return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) -
78 ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 );
108 width = stemHint->
max - stemHint->
min;
136 else if ( width < 0 )
192 hint->
index = indexStemHint;
220 return hint->
flags != 0;
225 cf2_hint_isPair(
const CF2_Hint hint )
227 return ( hint->
flags &
233 cf2_hint_isPairTop(
const CF2_Hint hint )
242 return ( hint->
flags &
250 return ( hint->
flags &
256 cf2_hint_isLocked(
const CF2_Hint hint )
263 cf2_hint_isSynthetic(
const CF2_Hint hint )
286 hintmap->hinted = font->
hinted;
287 hintmap->scale =
scale;
288 hintmap->font = font;
289 hintmap->initialHintMap = initialMap;
291 hintmap->hintMoves = hintMoves;
322 while ( i < hintmap->
count - 1 &&
327 while ( i > 0 && csCoord < hintmap->edge[i].csCoord )
332 if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
383 for ( i = 0; i < hintmap->
count; i++ )
385 FT_Bool isPair = cf2_hint_isPair( &hintmap->
edge[i] );
389 j = isPair ? i + 1 :
i;
395 cf2_hint_isLocked( &hintmap->
edge[j] ) );
397 if ( !cf2_hint_isLocked( &hintmap->
edge[i] ) )
431 cf2_hint_isSynthetic( &hintmap->
edge[i - 1] ) )
434 if ( j >= hintmap->
count - 1 ||
435 cf2_hint_isSynthetic( &hintmap->
edge[j + 1] ) )
442 if ( j >= hintmap->
count - 1 ||
449 hintmap->
edge[i].
dsCoord + moveDown - downMinCounter )
452 move = ( -moveDown < moveUp ) ? moveDown : moveUp;
462 hintmap->
edge[i].
dsCoord + moveDown - downMinCounter )
465 saveEdge = moveUp < -moveDown;
481 j < hintmap->count - 1 &&
482 !cf2_hint_isLocked( &hintmap->
edge[j + 1] ) )
489 savedMove.moveUp = moveUp - move;
548 if ( cf2_hint_isPair( &hintmap->
edge[j] ) )
568 CF2_Hint firstHintEdge = bottomHintEdge;
569 CF2_Hint secondHintEdge = topHintEdge;
581 firstHintEdge = topHintEdge;
596 for ( ; indexInsert < hintmap->
count; indexInsert++ )
608 if ( indexInsert < hintmap->
count )
617 if ( cf2_hint_isPairTop( &hintmap->
edge[indexInsert] ) )
623 !cf2_hint_isLocked( firstHintEdge ) )
632 firstHintEdge->
csCoord ) / 2 );
639 firstHintEdge->
dsCoord = midpoint - halfWidth;
640 secondHintEdge->
dsCoord = midpoint + halfWidth;
649 if ( indexInsert > 0 )
656 if ( indexInsert < hintmap->count )
681 FT_TRACE4((
"cf2_hintmap_insertHint: too many hintmaps\n" ));
686 hintmap->
edge[iDst--] = hintmap->
edge[iSrc--];
689 hintmap->
edge[indexInsert] = *firstHintEdge;
695 hintmap->
edge[indexInsert + 1] = *secondHintEdge;
736 if ( !initialMap && !cf2_hintmap_isValid( hintmap->
initialHintMap ) )
762 tempHintMask = *hintMask;
775 cf2_hint_initZero( &dummy );
778 cf2_hintmap_insertHint( hintmap,
782 cf2_hintmap_insertHint( hintmap,
789 for (
i = 0, maskByte = 0x80;
i < bitCount;
i++ )
791 if ( maskByte & *maskPtr )
797 cf2_hint_init( &bottomHintEdge,
804 cf2_hint_init( &topHintEdge,
812 if ( cf2_hint_isLocked( &bottomHintEdge ) ||
813 cf2_hint_isLocked( &topHintEdge ) ||
819 cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
821 *maskPtr &= ~maskByte;
825 if ( (
i & 7 ) == 7 )
863 if ( hintmap->
count == 0 ||
873 cf2_hint_initZero( &edge );
880 cf2_hint_initZero( &invalid );
881 cf2_hintmap_insertHint( hintmap, &edge, &invalid );
890 for (
i = 0, maskByte = 0x80;
i < bitCount;
i++ )
892 if ( maskByte & *maskPtr )
897 cf2_hint_init( &bottomHintEdge,
904 cf2_hint_init( &topHintEdge,
912 cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
915 if ( (
i & 7 ) == 7 )
936 cf2_hintmap_adjustHints( hintmap );
942 for (
i = 0;
i < hintmap->
count;
i++ )
944 if ( !cf2_hint_isSynthetic( &hintmap->
edge[
i] ) )
986 glyphpath->font = font;
987 glyphpath->callbacks = callbacks;
996 &glyphpath->initialHintMap,
997 &glyphpath->hintMoves,
1001 &glyphpath->initialHintMap,
1002 &glyphpath->hintMoves,
1006 &glyphpath->initialHintMap,
1007 &glyphpath->hintMoves,
1014 glyphpath->fractionalTranslation = *fractionalTranslation;
1017 glyphpath->hShift = hShift;
1020 glyphpath->hStemHintArray = hStemHintArray;
1021 glyphpath->vStemHintArray = vStemHintArray;
1022 glyphpath->hintMask = hintMask;
1023 glyphpath->hintOriginY = hintOriginY;
1024 glyphpath->blues = blues;
1025 glyphpath->darken = font->
darkened;
1026 glyphpath->xOffset = font->
darkenX;
1027 glyphpath->yOffset = font->
darkenY;
1028 glyphpath->miterLimit = 2 *
FT_MAX(
1035 glyphpath->moveIsPending =
TRUE;
1036 glyphpath->pathIsOpen =
FALSE;
1037 glyphpath->elemIsQueued =
FALSE;
1066 pt.
y = cf2_hintmap_map( hintmap, y );
1112 #define cf2_perp( a, b ) \ 1113 ( FT_MulFix( a.x, b.y ) - FT_MulFix( a.y, b.x ) ) 1116 #define CF2_CS_SCALE( x ) \ 1117 ( ( (x) + 0x10 ) >> 5 ) 1132 if ( denominator == 0 )
1149 if ( u1->
x == u2->
x &&
1151 intersection->
x = u1->
x;
1152 if ( u1->
y == u2->
y &&
1154 intersection->
y = u1->
y;
1156 if ( v1->
x == v2->
x &&
1158 intersection->
x = v1->
x;
1159 if ( v1->
y == v2->
y &&
1161 intersection->
y = v1->
y;
1226 if ( prevP1->
x != nextP0->
x || prevP1->
y != nextP0->
y )
1230 useIntersection = cf2_glyphpath_computeIntersection( glyphpath,
1236 if ( useIntersection )
1240 *prevP1 = intersection;
1252 cf2_glyphpath_hintPoint( glyphpath,
1268 cf2_glyphpath_hintPoint( glyphpath,
1273 cf2_glyphpath_hintPoint( glyphpath,
1278 cf2_glyphpath_hintPoint( glyphpath,
1291 if ( !useIntersection || close )
1298 cf2_glyphpath_hintPoint( glyphpath,
1318 if ( useIntersection )
1321 *nextP0 = intersection;
1340 if ( !cf2_hintmap_isValid( &glyphpath->
hintMap ) )
1349 cf2_glyphpath_hintPoint( glyphpath,
1396 if ( !glyphpath->
darken )
1401 cf2_getWindingMomentum( x1, y1, x2, y2 );
1416 else if ( dy > 2 * dx )
1441 else if ( -dy > 2 * dx )
1469 else if ( dy > -2 * dx )
1488 if ( -dx > -2 * dy )
1494 else if ( -dy > -2 * dx )
1529 if ( !cf2_hintmap_isValid( &glyphpath->
hintMap ) ||
1556 cf2_glyphpath_computeOffset( glyphpath,
1573 cf2_glyphpath_pushMove( glyphpath, P0 );
1585 cf2_glyphpath_pushPrevElem( glyphpath,
1621 CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3;
1626 cf2_glyphpath_computeOffset( glyphpath,
1633 cf2_glyphpath_computeOffset( glyphpath,
1643 cf2_getWindingMomentum( x1, y1, x2, y2 );
1648 P1.
x = x1 + xOffset1;
1649 P1.
y = y1 + yOffset1;
1651 P2.
x = x2 + xOffset3;
1652 P2.
y = y2 + yOffset3;
1653 P3.
x = x3 + xOffset3;
1654 P3.
y = y3 + yOffset3;
1659 cf2_glyphpath_pushMove( glyphpath, P0 );
1671 cf2_glyphpath_pushPrevElem( glyphpath,
1719 cf2_glyphpath_pushPrevElem( glyphpath,
FT_DivFix(FT_Long a, FT_Long b)
cf2_hint_isBottom(const CF2_Hint hint)
GLenum GLenum GLenum GLenum GLenum scale
GLfloat GLfloat GLfloat v2
cf2_hintmask_setAll(CF2_HintMask hintmask, size_t bitCount)
GLint GLint GLint GLint GLint GLint y
CF2_ArrStack hStemHintArray
cf2_hintmap_init(CF2_HintMap hintmap, CF2_Font font, CF2_HintMap initialMap, CF2_ArrStack hintMoves, CF2_Fixed scale)
CF2_OutlineCallbacks callbacks
cf2_hint_lock(CF2_Hint hint)
cf2_glyphpath_curveTo(CF2_GlyphPath glyphpath, CF2_Fixed x1, CF2_Fixed y1, CF2_Fixed x2, CF2_Fixed y2, CF2_Fixed x3, CF2_Fixed y3)
CF2_HintRec emBoxBottomEdge
GLint GLint GLsizei width
GLint GLint GLint GLint GLint x
cf2_glyphpath_moveTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
CF2_HintMapRec firstHintMap
CF2_Matrix outerTransform
cf2_hintmask_getMaskPtr(CF2_HintMask hintmask)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
cf2_blues_capture(const CF2_Blues blues, CF2_Hint bottomHintEdge, CF2_Hint topHintEdge)
#define FT_ASSERT(condition)
#define FT_TRACE4(varformat)
cf2_glyphpath_lineTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
cf2_arrstack_finalize(CF2_ArrStack arrstack)
#define cf2_fixedFraction(x)
cf2_arrstack_init(CF2_ArrStack arrstack, FT_Memory memory, FT_Error *error, size_t sizeItem)
CF2_Matrix innerTransform
cf2_arrstack_push(CF2_ArrStack arrstack, const void *ptr)
cf2_hintmask_isValid(const CF2_HintMask hintmask)
cf2_hint_isValid(const CF2_Hint hint)
CF2_HintRec edge[CF2_MAX_HINT_EDGES]
#define cf2_intToFixed(i)
CF2_ArrStack vStemHintArray
cf2_glyphpath_init(CF2_GlyphPath glyphpath, CF2_Font font, CF2_OutlineCallbacks callbacks, CF2_Fixed scaleY, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOriginY, const CF2_Blues blues, const FT_Vector *fractionalTranslation)
cf2_glyphpath_finalize(CF2_GlyphPath glyphpath)
cf2_hintmask_setNew(CF2_HintMask hintmask, FT_Bool val)
struct CF2_HintMoveRec_ * CF2_HintMove
cf2_glyphpath_closeOpenPath(CF2_GlyphPath glyphpath)
cf2_arrstack_clear(CF2_ArrStack arrstack)
FT_MulFix(FT_Long a, FT_Long b)
struct CF2_HintMapRec_ * initialHintMap
if(!abbox) return FT_THROW(Invalid_Argument)
cf2_hintmask_init(CF2_HintMask hintmask, FT_Error *error)
GLenum const GLfloat * params
GLubyte GLubyte GLubyte GLubyte w
cf2_arrstack_getPointer(const CF2_ArrStack arrstack, size_t idx)
FT_Vector fractionalTranslation
#define cf2_floatToFixed(f)
cf2_arrstack_size(const CF2_ArrStack arrstack)
struct CF2_StemHintRec_ * CF2_StemHint
struct CF2_HintMoveRec_ CF2_HintMoveRec
GLuint GLuint GLsizei count
cf2_hintmask_isNew(const CF2_HintMask hintmask)
cf2_hint_isTop(const CF2_Hint hint)
FT_BEGIN_HEADER struct CF2_ArrStackRec_ * CF2_ArrStack
cf2_hintmap_build(CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)