ReactOS  0.4.14-dev-815-ge410a12
pshints.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CF2_HintMaskRec_
 
struct  CF2_StemHintRec_
 
struct  CF2_HintMapRec_
 
struct  CF2_GlyphPathRec_
 

Typedefs

typedef struct CF2_HintMaskRec_ CF2_HintMaskRec
 
typedef struct CF2_HintMaskRec_CF2_HintMask
 
typedef struct CF2_StemHintRec_ CF2_StemHintRec
 
typedef struct CF2_StemHintRec_CF2_StemHint
 
typedef struct CF2_HintMapRec_ CF2_HintMapRec
 
typedef struct CF2_HintMapRec_CF2_HintMap
 
typedef struct CF2_GlyphPathRec_ CF2_GlyphPathRec
 
typedef struct CF2_GlyphPathRec_CF2_GlyphPath
 

Enumerations

enum  { CF2_MAX_HINTS = 96 }
 
enum  { CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2 }
 

Functions

 cf2_hint_isValid (const CF2_Hint hint)
 
 cf2_hint_isTop (const CF2_Hint hint)
 
 cf2_hint_isBottom (const CF2_Hint hint)
 
 cf2_hint_lock (CF2_Hint hint)
 
 cf2_hintmap_init (CF2_HintMap hintmap, CF2_Font font, CF2_HintMap initialMap, CF2_ArrStack hintMoves, CF2_Fixed scale)
 
 cf2_hintmap_build (CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)
 
 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 hintOrigin, const CF2_Blues blues, const FT_Vector *fractionalTranslation)
 
 cf2_glyphpath_finalize (CF2_GlyphPath glyphpath)
 
 cf2_glyphpath_moveTo (CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
 
 cf2_glyphpath_lineTo (CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
 
 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_glyphpath_closeOpenPath (CF2_GlyphPath glyphpath)
 

Typedef Documentation

◆ CF2_GlyphPath

◆ CF2_GlyphPathRec

◆ CF2_HintMap

◆ CF2_HintMapRec

◆ CF2_HintMask

◆ CF2_HintMaskRec

◆ CF2_StemHint

◆ CF2_StemHintRec

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CF2_MAX_HINTS 

Definition at line 45 of file pshints.h.

46  {
47  CF2_MAX_HINTS = 96 /* maximum # of hints */
48  };

◆ anonymous enum

anonymous enum
Enumerator
CF2_MAX_HINT_EDGES 

Definition at line 120 of file pshints.h.

Function Documentation

◆ cf2_glyphpath_closeOpenPath()

cf2_glyphpath_closeOpenPath ( CF2_GlyphPath  glyphpath)

Definition at line 1907 of file pshints.c.

1908  {
1909  if ( glyphpath->pathIsOpen )
1910  {
1911  /*
1912  * A closing line in Character Space line is always generated below
1913  * with `cf2_glyphPath_lineTo'. It may be ignored later if it turns
1914  * out to be zero length in Device Space.
1915  */
1916  glyphpath->pathIsClosing = TRUE;
1917 
1918  cf2_glyphpath_lineTo( glyphpath,
1919  glyphpath->start.x,
1920  glyphpath->start.y );
1921 
1922  /* empty the final element from the queue and close the path */
1923  if ( glyphpath->elemIsQueued )
1924  cf2_glyphpath_pushPrevElem( glyphpath,
1925  &glyphpath->hintMap,
1926  &glyphpath->offsetStart0,
1927  glyphpath->offsetStart1,
1928  TRUE );
1929 
1930  /* reset state machine */
1931  glyphpath->moveIsPending = TRUE;
1932  glyphpath->pathIsOpen = FALSE;
1933  glyphpath->pathIsClosing = FALSE;
1934  glyphpath->elemIsQueued = FALSE;
1935  }
1936  }
cf2_glyphpath_lineTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
Definition: pshints.c:1711
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
FT_Vector offsetStart0
Definition: pshints.h:225
FT_Pos x
Definition: ftimage.h:76
FT_Vector offsetStart1
Definition: pshints.h:226
FT_Bool moveIsPending
Definition: pshints.h:208
FT_Bool elemIsQueued
Definition: pshints.h:236
FT_Bool pathIsClosing
Definition: pshints.h:206
FT_Vector start
Definition: pshints.h:233
static void cf2_glyphpath_pushPrevElem(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *nextP0, FT_Vector nextP1, FT_Bool close)
Definition: pshints.c:1321
FT_Bool pathIsOpen
Definition: pshints.h:205
CF2_HintMapRec hintMap
Definition: pshints.h:189

Referenced by cf2_glyphpath_moveTo(), and cf2_interpT2CharString().

◆ cf2_glyphpath_curveTo()

cf2_glyphpath_curveTo ( CF2_GlyphPath  glyphpath,
CF2_Fixed  x1,
CF2_Fixed  y1,
CF2_Fixed  x2,
CF2_Fixed  y2,
CF2_Fixed  x3,
CF2_Fixed  y3 
)

Definition at line 1817 of file pshints.c.

1824  {
1825  CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3;
1826  FT_Vector P0, P1, P2, P3;
1827 
1828 
1829  /* TODO: ignore zero length portions of curve?? */
1830  cf2_glyphpath_computeOffset( glyphpath,
1831  glyphpath->currentCS.x,
1832  glyphpath->currentCS.y,
1833  x1,
1834  y1,
1835  &xOffset1,
1836  &yOffset1 );
1837  cf2_glyphpath_computeOffset( glyphpath,
1838  x2,
1839  y2,
1840  x3,
1841  y3,
1842  &xOffset3,
1843  &yOffset3 );
1844 
1845  /* add momentum from the middle segment */
1846  glyphpath->callbacks->windingMomentum =
1847  ADD_INT32( glyphpath->callbacks->windingMomentum,
1848  cf2_getWindingMomentum( x1, y1, x2, y2 ) );
1849 
1850  /* construct offset points */
1851  P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 );
1852  P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 );
1853  P1.x = ADD_INT32( x1, xOffset1 );
1854  P1.y = ADD_INT32( y1, yOffset1 );
1855  /* note: preserve angle of final segment by using offset3 at both ends */
1856  P2.x = ADD_INT32( x2, xOffset3 );
1857  P2.y = ADD_INT32( y2, yOffset3 );
1858  P3.x = ADD_INT32( x3, xOffset3 );
1859  P3.y = ADD_INT32( y3, yOffset3 );
1860 
1861  if ( glyphpath->moveIsPending )
1862  {
1863  /* emit offset 1st point as MoveTo */
1864  cf2_glyphpath_pushMove( glyphpath, P0 );
1865 
1866  glyphpath->moveIsPending = FALSE;
1867  glyphpath->pathIsOpen = TRUE;
1868 
1869  glyphpath->offsetStart1 = P1; /* record second point */
1870  }
1871 
1872  if ( glyphpath->elemIsQueued )
1873  {
1874  FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
1875  glyphpath->hintMap.count == 0 );
1876 
1877  cf2_glyphpath_pushPrevElem( glyphpath,
1878  &glyphpath->hintMap,
1879  &P0,
1880  P1,
1881  FALSE );
1882  }
1883 
1884  /* queue the current element with offset points */
1885  glyphpath->elemIsQueued = TRUE;
1886  glyphpath->prevElemOp = CF2_PathOpCubeTo;
1887  glyphpath->prevElemP0 = P0;
1888  glyphpath->prevElemP1 = P1;
1889  glyphpath->prevElemP2 = P2;
1890  glyphpath->prevElemP3 = P3;
1891 
1892  /* update current map */
1893  if ( cf2_hintmask_isNew( glyphpath->hintMask ) )
1894  cf2_hintmap_build( &glyphpath->hintMap,
1895  glyphpath->hStemHintArray,
1896  glyphpath->vStemHintArray,
1897  glyphpath->hintMask,
1898  glyphpath->hintOriginY,
1899  FALSE );
1900 
1901  glyphpath->currentCS.x = x3; /* pre-offset current point */
1902  glyphpath->currentCS.y = y3;
1903  }
static FT_Bool cf2_hintmap_isValid(const CF2_HintMap hintmap)
Definition: pshints.c:296
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
static void cf2_glyphpath_computeOffset(CF2_GlyphPath glyphpath, CF2_Fixed x1, CF2_Fixed y1, CF2_Fixed x2, CF2_Fixed y2, CF2_Fixed *x, CF2_Fixed *y)
Definition: pshints.c:1530
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
CF2_UInt count
Definition: pshints.h:140
FT_Pos x
Definition: ftimage.h:76
#define ADD_INT32(a, b)
Definition: ftcalc.h:429
FT_Vector prevElemP0
Definition: pshints.h:239
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
FT_Vector offsetStart1
Definition: pshints.h:226
static CF2_Int cf2_getWindingMomentum(CF2_Fixed x1, CF2_Fixed y1, CF2_Fixed x2, CF2_Fixed y2)
Definition: pshints.c:69
FT_Vector prevElemP3
Definition: pshints.h:242
CF2_ArrStack vStemHintArray
Definition: pshints.h:212
CF2_ArrStack hStemHintArray
Definition: pshints.h:211
CF2_Fixed hintOriginY
Definition: pshints.h:214
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
CF2_OutlineCallbacks callbacks
Definition: pshints.h:186
CF2_Int prevElemOp
Definition: pshints.h:237
FT_Bool moveIsPending
Definition: pshints.h:208
FT_Bool elemIsQueued
Definition: pshints.h:236
FT_Vector currentCS
Definition: pshints.h:229
cf2_hintmask_isNew(const CF2_HintMask hintmask)
Definition: psintrp.c:83
static void cf2_glyphpath_pushMove(CF2_GlyphPath glyphpath, FT_Vector start)
Definition: pshints.c:1485
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
static void cf2_glyphpath_pushPrevElem(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *nextP0, FT_Vector nextP1, FT_Bool close)
Definition: pshints.c:1321
cf2_hintmap_build(CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)
Definition: pshints.c:808
FT_Bool pathIsOpen
Definition: pshints.h:205
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
FT_Vector prevElemP1
Definition: pshints.h:240
CF2_HintMapRec hintMap
Definition: pshints.h:189
FT_Vector prevElemP2
Definition: pshints.h:241
CF2_HintMask hintMask
Definition: pshints.h:213
#define CF2_Fixed
Definition: psfixed.h:48

Referenced by cf2_doFlex(), and cf2_interpT2CharString().

◆ cf2_glyphpath_finalize()

cf2_glyphpath_finalize ( CF2_GlyphPath  glyphpath)

Definition at line 1154 of file pshints.c.

1155  {
1156  cf2_arrstack_finalize( &glyphpath->hintMoves );
1157  }
CF2_ArrStackRec hintMoves
Definition: pshints.h:193
cf2_arrstack_finalize(CF2_ArrStack arrstack)
Definition: psarrst.c:76

Referenced by cf2_interpT2CharString().

◆ cf2_glyphpath_init()

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  hintOrigin,
const CF2_Blues  blues,
const FT_Vector fractionalTranslation 
)

Definition at line 1083 of file pshints.c.

1094  {
1095  FT_ZERO( glyphpath );
1096 
1097  glyphpath->font = font;
1098  glyphpath->callbacks = callbacks;
1099 
1100  cf2_arrstack_init( &glyphpath->hintMoves,
1101  font->memory,
1102  &font->error,
1103  sizeof ( CF2_HintMoveRec ) );
1104 
1105  cf2_hintmap_init( &glyphpath->initialHintMap,
1106  font,
1107  &glyphpath->initialHintMap,
1108  &glyphpath->hintMoves,
1109  scaleY );
1110  cf2_hintmap_init( &glyphpath->firstHintMap,
1111  font,
1112  &glyphpath->initialHintMap,
1113  &glyphpath->hintMoves,
1114  scaleY );
1115  cf2_hintmap_init( &glyphpath->hintMap,
1116  font,
1117  &glyphpath->initialHintMap,
1118  &glyphpath->hintMoves,
1119  scaleY );
1120 
1121  glyphpath->scaleX = font->innerTransform.a;
1122  glyphpath->scaleC = font->innerTransform.c;
1123  glyphpath->scaleY = font->innerTransform.d;
1124 
1125  glyphpath->fractionalTranslation = *fractionalTranslation;
1126 
1127 #if 0
1128  glyphpath->hShift = hShift; /* for fauxing */
1129 #endif
1130 
1131  glyphpath->hStemHintArray = hStemHintArray;
1132  glyphpath->vStemHintArray = vStemHintArray;
1133  glyphpath->hintMask = hintMask; /* ptr to current mask */
1134  glyphpath->hintOriginY = hintOriginY;
1135  glyphpath->blues = blues;
1136  glyphpath->darken = font->darkened; /* TODO: should we make copies? */
1137  glyphpath->xOffset = font->darkenX;
1138  glyphpath->yOffset = font->darkenY;
1139  glyphpath->miterLimit = 2 * FT_MAX(
1140  cf2_fixedAbs( glyphpath->xOffset ),
1141  cf2_fixedAbs( glyphpath->yOffset ) );
1142 
1143  /* .1 character space unit */
1144  glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 );
1145 
1146  glyphpath->moveIsPending = TRUE;
1147  glyphpath->pathIsOpen = FALSE;
1148  glyphpath->pathIsClosing = FALSE;
1149  glyphpath->elemIsQueued = FALSE;
1150  }
FT_Vector fractionalTranslation
Definition: pshints.h:199
#define TRUE
Definition: types.h:120
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
cf2_arrstack_init(CF2_ArrStack arrstack, FT_Memory memory, FT_Error *error, size_t sizeItem)
Definition: psarrst.c:56
Definition: mk_font.cpp:20
CF2_Fixed scaleY
Definition: pshints.h:197
CF2_Fixed scaleC
Definition: pshints.h:196
CF2_HintMapRec firstHintMap
Definition: pshints.h:190
CF2_Fixed miterLimit
Definition: pshints.h:221
cf2_hintmap_init(CF2_HintMap hintmap, CF2_Font font, CF2_HintMap initialMap, CF2_ArrStack hintMoves, CF2_Fixed scale)
Definition: pshints.c:277
CF2_Fixed snapThreshold
Definition: pshints.h:223
CF2_ArrStack vStemHintArray
Definition: pshints.h:212
CF2_ArrStackRec hintMoves
Definition: pshints.h:193
CF2_ArrStack hStemHintArray
Definition: pshints.h:211
CF2_Fixed hintOriginY
Definition: pshints.h:214
FT_Bool darken
Definition: pshints.h:207
CF2_Font font
Definition: pshints.h:185
CF2_OutlineCallbacks callbacks
Definition: pshints.h:186
CF2_HintMapRec initialHintMap
Definition: pshints.h:191
const CF2_BluesRec * blues
Definition: pshints.h:215
FT_Bool moveIsPending
Definition: pshints.h:208
CF2_Fixed scaleX
Definition: pshints.h:195
FT_Bool elemIsQueued
Definition: pshints.h:236
#define FT_ZERO(p)
Definition: ftmemory.h:237
#define FT_MAX(a, b)
Definition: ftobjs.h:72
FT_Bool pathIsClosing
Definition: pshints.h:206
CF2_Fixed xOffset
Definition: pshints.h:217
CF2_Fixed yOffset
Definition: pshints.h:218
#define cf2_doubleToFixed(f)
Definition: psfixed.h:66
FT_Bool pathIsOpen
Definition: pshints.h:205
CF2_HintMapRec hintMap
Definition: pshints.h:189
static int callbacks
Definition: xmllint.c:873
CF2_HintMask hintMask
Definition: pshints.h:213
#define cf2_fixedAbs(x)
Definition: psfixed.h:68

Referenced by cf2_interpT2CharString().

◆ cf2_glyphpath_lineTo()

cf2_glyphpath_lineTo ( CF2_GlyphPath  glyphpath,
CF2_Fixed  x,
CF2_Fixed  y 
)

Definition at line 1711 of file pshints.c.

1714  {
1716  FT_Vector P0, P1;
1717  FT_Bool newHintMap;
1718 
1719  /*
1720  * New hints will be applied after cf2_glyphpath_pushPrevElem has run.
1721  * In case this is a synthesized closing line, any new hints should be
1722  * delayed until this path is closed (`cf2_hintmask_isNew' will be
1723  * called again before the next line or curve).
1724  */
1725 
1726  /* true if new hint map not on close */
1727  newHintMap = cf2_hintmask_isNew( glyphpath->hintMask ) &&
1728  !glyphpath->pathIsClosing;
1729 
1730  /*
1731  * Zero-length lines may occur in the charstring. Because we cannot
1732  * compute darkening offsets or intersections from zero-length lines,
1733  * it is best to remove them and avoid artifacts. However, zero-length
1734  * lines in CS at the start of a new hint map can generate non-zero
1735  * lines in DS due to hint substitution. We detect a change in hint
1736  * map here and pass those zero-length lines along.
1737  */
1738 
1739  /*
1740  * Note: Find explicitly closed paths here with a conditional
1741  * breakpoint using
1742  *
1743  * !gp->pathIsClosing && gp->start.x == x && gp->start.y == y
1744  *
1745  */
1746 
1747  if ( glyphpath->currentCS.x == x &&
1748  glyphpath->currentCS.y == y &&
1749  !newHintMap )
1750  /*
1751  * Ignore zero-length lines in CS where the hint map is the same
1752  * because the line in DS will also be zero length.
1753  *
1754  * Ignore zero-length lines when we synthesize a closing line because
1755  * the close will be handled in cf2_glyphPath_pushPrevElem.
1756  */
1757  return;
1758 
1759  cf2_glyphpath_computeOffset( glyphpath,
1760  glyphpath->currentCS.x,
1761  glyphpath->currentCS.y,
1762  x,
1763  y,
1764  &xOffset,
1765  &yOffset );
1766 
1767  /* construct offset points */
1768  P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset );
1769  P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset );
1770  P1.x = ADD_INT32( x, xOffset );
1771  P1.y = ADD_INT32( y, yOffset );
1772 
1773  if ( glyphpath->moveIsPending )
1774  {
1775  /* emit offset 1st point as MoveTo */
1776  cf2_glyphpath_pushMove( glyphpath, P0 );
1777 
1778  glyphpath->moveIsPending = FALSE; /* adjust state machine */
1779  glyphpath->pathIsOpen = TRUE;
1780 
1781  glyphpath->offsetStart1 = P1; /* record second point */
1782  }
1783 
1784  if ( glyphpath->elemIsQueued )
1785  {
1786  FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
1787  glyphpath->hintMap.count == 0 );
1788 
1789  cf2_glyphpath_pushPrevElem( glyphpath,
1790  &glyphpath->hintMap,
1791  &P0,
1792  P1,
1793  FALSE );
1794  }
1795 
1796  /* queue the current element with offset points */
1797  glyphpath->elemIsQueued = TRUE;
1798  glyphpath->prevElemOp = CF2_PathOpLineTo;
1799  glyphpath->prevElemP0 = P0;
1800  glyphpath->prevElemP1 = P1;
1801 
1802  /* update current map */
1803  if ( newHintMap )
1804  cf2_hintmap_build( &glyphpath->hintMap,
1805  glyphpath->hStemHintArray,
1806  glyphpath->vStemHintArray,
1807  glyphpath->hintMask,
1808  glyphpath->hintOriginY,
1809  FALSE );
1810 
1811  glyphpath->currentCS.x = x; /* pre-offset current point */
1812  glyphpath->currentCS.y = y;
1813  }
static FT_Bool cf2_hintmap_isValid(const CF2_HintMap hintmap)
Definition: pshints.c:296
static void cf2_glyphpath_computeOffset(CF2_GlyphPath glyphpath, CF2_Fixed x1, CF2_Fixed y1, CF2_Fixed x2, CF2_Fixed y2, CF2_Fixed *x, CF2_Fixed *y)
Definition: pshints.c:1530
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
CF2_UInt count
Definition: pshints.h:140
FT_Pos x
Definition: ftimage.h:76
#define ADD_INT32(a, b)
Definition: ftcalc.h:429
FT_Vector prevElemP0
Definition: pshints.h:239
FT_Vector offsetStart1
Definition: pshints.h:226
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
CF2_ArrStack vStemHintArray
Definition: pshints.h:212
CF2_ArrStack hStemHintArray
Definition: pshints.h:211
CF2_Fixed hintOriginY
Definition: pshints.h:214
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
CF2_Int prevElemOp
Definition: pshints.h:237
FT_Bool moveIsPending
Definition: pshints.h:208
FT_Bool elemIsQueued
Definition: pshints.h:236
FT_Vector currentCS
Definition: pshints.h:229
FT_Bool pathIsClosing
Definition: pshints.h:206
cf2_hintmask_isNew(const CF2_HintMask hintmask)
Definition: psintrp.c:83
static void cf2_glyphpath_pushMove(CF2_GlyphPath glyphpath, FT_Vector start)
Definition: pshints.c:1485
static void cf2_glyphpath_pushPrevElem(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *nextP0, FT_Vector nextP1, FT_Bool close)
Definition: pshints.c:1321
cf2_hintmap_build(CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)
Definition: pshints.c:808
FT_Bool pathIsOpen
Definition: pshints.h:205
int xOffset
Definition: appswitch.c:59
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
FT_Vector prevElemP1
Definition: pshints.h:240
CF2_HintMapRec hintMap
Definition: pshints.h:189
int yOffset
Definition: appswitch.c:59
CF2_HintMask hintMask
Definition: pshints.h:213
#define CF2_Fixed
Definition: psfixed.h:48

Referenced by cf2_glyphpath_closeOpenPath(), and cf2_interpT2CharString().

◆ cf2_glyphpath_moveTo()

cf2_glyphpath_moveTo ( CF2_GlyphPath  glyphpath,
CF2_Fixed  x,
CF2_Fixed  y 
)

Definition at line 1681 of file pshints.c.

1684  {
1685  cf2_glyphpath_closeOpenPath( glyphpath );
1686 
1687  /* save the parameters of the move for later, when we'll know how to */
1688  /* offset it; */
1689  /* also save last move point */
1690  glyphpath->currentCS.x = glyphpath->start.x = x;
1691  glyphpath->currentCS.y = glyphpath->start.y = y;
1692 
1693  glyphpath->moveIsPending = TRUE;
1694 
1695  /* ensure we have a valid map with current mask */
1696  if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ||
1697  cf2_hintmask_isNew( glyphpath->hintMask ) )
1698  cf2_hintmap_build( &glyphpath->hintMap,
1699  glyphpath->hStemHintArray,
1700  glyphpath->vStemHintArray,
1701  glyphpath->hintMask,
1702  glyphpath->hintOriginY,
1703  FALSE );
1704 
1705  /* save a copy of current HintMap to use when drawing initial point */
1706  glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */
1707  }
static FT_Bool cf2_hintmap_isValid(const CF2_HintMap hintmap)
Definition: pshints.c:296
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
FT_Pos x
Definition: ftimage.h:76
CF2_HintMapRec firstHintMap
Definition: pshints.h:190
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
CF2_ArrStack vStemHintArray
Definition: pshints.h:212
CF2_ArrStack hStemHintArray
Definition: pshints.h:211
CF2_Fixed hintOriginY
Definition: pshints.h:214
FT_Bool moveIsPending
Definition: pshints.h:208
cf2_glyphpath_closeOpenPath(CF2_GlyphPath glyphpath)
Definition: pshints.c:1907
FT_Vector currentCS
Definition: pshints.h:229
cf2_hintmask_isNew(const CF2_HintMask hintmask)
Definition: psintrp.c:83
FT_Vector start
Definition: pshints.h:233
cf2_hintmap_build(CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)
Definition: pshints.c:808
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
CF2_HintMapRec hintMap
Definition: pshints.h:189
CF2_HintMask hintMask
Definition: pshints.h:213

Referenced by cf2_glyphpath_pushMove(), and cf2_interpT2CharString().

◆ cf2_hint_isBottom()

cf2_hint_isBottom ( const CF2_Hint  hint)

Definition at line 248 of file pshints.c.

249  {
250  return (FT_Bool)( ( hint->flags &
251  ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 );
252  }
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
DWORD hint
Definition: vfdcmd.c:88

Referenced by cf2_blues_capture().

◆ cf2_hint_isTop()

cf2_hint_isTop ( const CF2_Hint  hint)

Definition at line 240 of file pshints.c.

241  {
242  return (FT_Bool)( ( hint->flags &
243  ( CF2_PairTop | CF2_GhostTop ) ) != 0 );
244  }
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
DWORD hint
Definition: vfdcmd.c:88

Referenced by cf2_blues_capture(), cf2_hint_init(), cf2_hintmap_build(), and cf2_hintmap_dump().

◆ cf2_hint_isValid()

cf2_hint_isValid ( const CF2_Hint  hint)

Definition at line 218 of file pshints.c.

219  {
220  return (FT_Bool)( hint->flags != 0 );
221  }
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
DWORD hint
Definition: vfdcmd.c:88

Referenced by cf2_blues_capture(), cf2_hintmap_adjustHints(), and cf2_hintmap_insertHint().

◆ cf2_hint_lock()

cf2_hint_lock ( CF2_Hint  hint)

Definition at line 270 of file pshints.c.

271  {
272  hint->flags |= CF2_Locked;
273  }
DWORD hint
Definition: vfdcmd.c:88

Referenced by cf2_blues_capture(), and cf2_hint_init().

◆ cf2_hintmap_build()

cf2_hintmap_build ( CF2_HintMap  hintmap,
CF2_ArrStack  hStemHintArray,
CF2_ArrStack  vStemHintArray,
CF2_HintMask  hintMask,
CF2_Fixed  hintOrigin,
FT_Bool  initialMap 
)

Definition at line 808 of file pshints.c.

814  {
815  FT_Byte* maskPtr;
816 
817  CF2_Font font = hintmap->font;
818  CF2_HintMaskRec tempHintMask;
819 
820  size_t bitCount, i;
821  FT_Byte maskByte;
822 
823 
824  /* check whether initial map is constructed */
825  if ( !initialMap && !cf2_hintmap_isValid( hintmap->initialHintMap ) )
826  {
827  /* make recursive call with initialHintMap and temporary mask; */
828  /* temporary mask will get all bits set, below */
829  cf2_hintmask_init( &tempHintMask, hintMask->error );
831  hStemHintArray,
832  vStemHintArray,
833  &tempHintMask,
834  hintOrigin,
835  TRUE );
836  }
837 
838  if ( !cf2_hintmask_isValid( hintMask ) )
839  {
840  /* without a hint mask, assume all hints are active */
841  cf2_hintmask_setAll( hintMask,
842  cf2_arrstack_size( hStemHintArray ) +
843  cf2_arrstack_size( vStemHintArray ) );
844  if ( !cf2_hintmask_isValid( hintMask ) )
845  {
846  if ( font->isT1 )
847  {
848  /* no error, just continue unhinted */
849  *hintMask->error = FT_Err_Ok;
850  hintmap->hinted = FALSE;
851  }
852  return; /* too many stem hints */
853  }
854  }
855 
856  /* begin by clearing the map */
857  hintmap->count = 0;
858  hintmap->lastIndex = 0;
859 
860  /* make a copy of the hint mask so we can modify it */
861  tempHintMask = *hintMask;
862  maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
863 
864  /* use the hStem hints only, which are first in the mask */
865  bitCount = cf2_arrstack_size( hStemHintArray );
866 
867  /* Defense-in-depth. Should never return here. */
868  if ( bitCount > hintMask->bitCount )
869  return;
870 
871  /* synthetic embox hints get highest priority */
872  if ( font->blues.doEmBoxHints )
873  {
875 
876 
877  cf2_hint_initZero( &dummy ); /* invalid hint map element */
878 
879  /* ghost bottom */
880  cf2_hintmap_insertHint( hintmap,
881  &font->blues.emBoxBottomEdge,
882  &dummy );
883  /* ghost top */
884  cf2_hintmap_insertHint( hintmap,
885  &dummy,
886  &font->blues.emBoxTopEdge );
887  }
888 
889  /* insert hints captured by a blue zone or already locked (higher */
890  /* priority) */
891  for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
892  {
893  if ( maskByte & *maskPtr )
894  {
895  /* expand StemHint into two `CF2_Hint' elements */
896  CF2_HintRec bottomHintEdge, topHintEdge;
897 
898 
899  cf2_hint_init( &bottomHintEdge,
900  hStemHintArray,
901  i,
902  font,
903  hintOrigin,
904  hintmap->scale,
905  TRUE /* bottom */ );
906  cf2_hint_init( &topHintEdge,
907  hStemHintArray,
908  i,
909  font,
910  hintOrigin,
911  hintmap->scale,
912  FALSE /* top */ );
913 
914  if ( cf2_hint_isLocked( &bottomHintEdge ) ||
915  cf2_hint_isLocked( &topHintEdge ) ||
916  cf2_blues_capture( &font->blues,
917  &bottomHintEdge,
918  &topHintEdge ) )
919  {
920  /* insert captured hint into map */
921  cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
922 
923  *maskPtr &= ~maskByte; /* turn off the bit for this hint */
924  }
925  }
926 
927  if ( ( i & 7 ) == 7 )
928  {
929  /* move to next mask byte */
930  maskPtr++;
931  maskByte = 0x80;
932  }
933  else
934  maskByte >>= 1;
935  }
936 
937  /* initial hint map includes only captured hints plus maybe one at 0 */
938 
939  /*
940  * TODO: There is a problem here because we are trying to build a
941  * single hint map containing all captured hints. It is
942  * possible for there to be conflicts between captured hints,
943  * either because of darkening or because the hints are in
944  * separate hint zones (we are ignoring hint zones for the
945  * initial map). An example of the latter is MinionPro-Regular
946  * v2.030 glyph 883 (Greek Capital Alpha with Psili) at 15ppem.
947  * A stem hint for the psili conflicts with the top edge hint
948  * for the base character. The stem hint gets priority because
949  * of its sort order. In glyph 884 (Greek Capital Alpha with
950  * Psili and Oxia), the top of the base character gets a stem
951  * hint, and the psili does not. This creates different initial
952  * maps for the two glyphs resulting in different renderings of
953  * the base character. Will probably defer this either as not
954  * worth the cost or as a font bug. I don't think there is any
955  * good reason for an accent to be captured by an alignment
956  * zone. -darnold 2/12/10
957  */
958 
959  if ( initialMap )
960  {
961  /* Apply a heuristic that inserts a point for (0,0), unless it's */
962  /* already covered by a mapping. This locks the baseline for glyphs */
963  /* that have no baseline hints. */
964 
965  if ( hintmap->count == 0 ||
966  hintmap->edge[0].csCoord > 0 ||
967  hintmap->edge[hintmap->count - 1].csCoord < 0 )
968  {
969  /* all edges are above 0 or all edges are below 0; */
970  /* construct a locked edge hint at 0 */
971 
972  CF2_HintRec edge, invalid;
973 
974 
975  cf2_hint_initZero( &edge );
976 
977  edge.flags = CF2_GhostBottom |
978  CF2_Locked |
980  edge.scale = hintmap->scale;
981 
983  cf2_hintmap_insertHint( hintmap, &edge, &invalid );
984  }
985  }
986  else
987  {
988  /* insert remaining hints */
989 
990  maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
991 
992  for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
993  {
994  if ( maskByte & *maskPtr )
995  {
996  CF2_HintRec bottomHintEdge, topHintEdge;
997 
998 
999  cf2_hint_init( &bottomHintEdge,
1000  hStemHintArray,
1001  i,
1002  font,
1003  hintOrigin,
1004  hintmap->scale,
1005  TRUE /* bottom */ );
1006  cf2_hint_init( &topHintEdge,
1007  hStemHintArray,
1008  i,
1009  font,
1010  hintOrigin,
1011  hintmap->scale,
1012  FALSE /* top */ );
1013 
1014  cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
1015  }
1016 
1017  if ( ( i & 7 ) == 7 )
1018  {
1019  /* move to next mask byte */
1020  maskPtr++;
1021  maskByte = 0x80;
1022  }
1023  else
1024  maskByte >>= 1;
1025  }
1026  }
1027 
1028  FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op "
1029  "[b]ottom [L]ocked [S]ynthetic\n"
1030  "Initial hintmap\n"
1031  : "Hints:\n" ));
1032  cf2_hintmap_dump( hintmap );
1033 
1034  /*
1035  * Note: The following line is a convenient place to break when
1036  * debugging hinting. Examine `hintmap->edge' for the list of
1037  * enabled hints, then step over the call to see the effect of
1038  * adjustment. We stop here first on the recursive call that
1039  * creates the initial map, and then on each counter group and
1040  * hint zone.
1041  */
1042 
1043  /* adjust positions of hint edges that are not locked to blue zones */
1044  cf2_hintmap_adjustHints( hintmap );
1045 
1046  FT_TRACE6(( "(adjusted)\n" ));
1047  cf2_hintmap_dump( hintmap );
1048 
1049  /* save the position of all hints that were used in this hint map; */
1050  /* if we use them again, we'll locate them in the same position */
1051  if ( !initialMap )
1052  {
1053  for ( i = 0; i < hintmap->count; i++ )
1054  {
1055  if ( !cf2_hint_isSynthetic( &hintmap->edge[i] ) )
1056  {
1057  /* Note: include both valid and invalid edges */
1058  /* Note: top and bottom edges are copied back separately */
1059  CF2_StemHint stemhint = (CF2_StemHint)
1060  cf2_arrstack_getPointer( hStemHintArray,
1061  hintmap->edge[i].index );
1062 
1063 
1064  if ( cf2_hint_isTop( &hintmap->edge[i] ) )
1065  stemhint->maxDS = hintmap->edge[i].dsCoord;
1066  else
1067  stemhint->minDS = hintmap->edge[i].dsCoord;
1068 
1069  stemhint->used = TRUE;
1070  }
1071  }
1072  }
1073 
1074  /* hint map is ready to use */
1075  hintmap->isValid = TRUE;
1076 
1077  /* remember this mask has been used */
1078  cf2_hintmask_setNew( hintMask, FALSE );
1079  }
static FT_Bool cf2_hintmap_isValid(const CF2_HintMap hintmap)
Definition: pshints.c:296
static void cf2_hint_initZero(CF2_Hint hint)
Definition: pshints.c:211
static const WCHAR invalid[]
Definition: assoc.c:39
#define TRUE
Definition: types.h:120
CF2_Fixed scale
Definition: pshints.h:139
cf2_hintmask_setNew(CF2_HintMask hintmask, FT_Bool val)
Definition: psintrp.c:90
CF2_UInt count
Definition: pshints.h:140
Definition: mk_font.cpp:20
CF2_Fixed maxDS
Definition: pshints.h:93
static FT_Bool cf2_hint_isLocked(const CF2_Hint hint)
Definition: pshints.c:256
cf2_hintmask_getMaskPtr(CF2_HintMask hintmask)
Definition: psintrp.c:101
cf2_hintmask_isValid(const CF2_HintMask hintmask)
Definition: psintrp.c:76
cf2_hintmask_setAll(CF2_HintMask hintmask, size_t bitCount)
Definition: psintrp.c:173
CF2_Fixed scale
Definition: psblues.h:125
return FT_Err_Ok
Definition: ftbbox.c:511
static void cf2_hint_init(CF2_Hint hint, const CF2_ArrStack stemHintArray, size_t indexStemHint, const CF2_Font font, CF2_Fixed hintOrigin, CF2_Fixed scale, FT_Bool bottom)
Definition: pshints.c:90
CF2_Fixed dsCoord
Definition: psblues.h:124
static FT_Bool cf2_hint_isSynthetic(const CF2_Hint hint)
Definition: pshints.c:263
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
cf2_arrstack_getPointer(const CF2_ArrStack arrstack, size_t idx)
Definition: psarrst.c:187
unsigned char FT_Byte
Definition: fttypes.h:154
FT_Bool isValid
Definition: pshints.h:136
struct CF2_HintMapRec_ * initialHintMap
Definition: pshints.h:131
FT_Error * error
Definition: pshints.h:72
static void cf2_hintmap_dump(CF2_HintMap hintmap)
Definition: pshints.c:303
struct CF2_StemHintRec_ * CF2_StemHint
static void cf2_hintmap_adjustHints(CF2_HintMap hintmap)
Definition: pshints.c:399
CF2_Font font
Definition: pshints.h:128
static void cf2_hintmap_insertHint(CF2_HintMap hintmap, CF2_Hint bottomHintEdge, CF2_Hint topHintEdge)
Definition: pshints.c:602
CF2_UInt flags
Definition: psblues.h:120
cf2_hint_isTop(const CF2_Hint hint)
Definition: pshints.c:240
size_t bitCount
Definition: pshints.h:77
#define FT_TRACE6(varformat)
Definition: ftdebug.h:163
cf2_hintmap_build(CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)
Definition: pshints.c:808
CF2_Fixed minDS
Definition: pshints.h:92
unsigned char dummy
Definition: maze.c:118
CF2_Fixed csCoord
Definition: psblues.h:123
CF2_HintRec edge[CF2_MAX_HINT_EDGES]
Definition: pshints.h:145
cf2_arrstack_size(const CF2_ArrStack arrstack)
Definition: psarrst.c:168
CF2_UInt lastIndex
Definition: pshints.h:143
size_t index
Definition: psblues.h:121
cf2_blues_capture(const CF2_Blues blues, CF2_Hint bottomHintEdge, CF2_Hint topHintEdge)
Definition: psblues.c:465
FT_Bool used
Definition: pshints.h:87
FT_Bool hinted
Definition: pshints.h:137
cf2_hintmask_init(CF2_HintMask hintmask, FT_Error *error)
Definition: psintrp.c:66

Referenced by cf2_glyphpath_curveTo(), cf2_glyphpath_lineTo(), cf2_glyphpath_moveTo(), cf2_hintmap_build(), and cf2_interpT2CharString().

◆ cf2_hintmap_init()

cf2_hintmap_init ( CF2_HintMap  hintmap,
CF2_Font  font,
CF2_HintMap  initialMap,
CF2_ArrStack  hintMoves,
CF2_Fixed  scale 
)

Definition at line 277 of file pshints.c.

282  {
283  FT_ZERO( hintmap );
284 
285  /* copy parameters from font instance */
286  hintmap->hinted = font->hinted;
287  hintmap->scale = scale;
288  hintmap->font = font;
289  hintmap->initialHintMap = initialMap;
290  /* will clear in `cf2_hintmap_adjustHints' */
291  hintmap->hintMoves = hintMoves;
292  }
CF2_Fixed scale
Definition: pshints.h:139
Definition: mk_font.cpp:20
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
struct CF2_HintMapRec_ * initialHintMap
Definition: pshints.h:131
CF2_ArrStack hintMoves
Definition: pshints.h:134
#define FT_ZERO(p)
Definition: ftmemory.h:237
CF2_Font font
Definition: pshints.h:128
FT_Bool hinted
Definition: pshints.h:137

Referenced by cf2_glyphpath_init(), and cf2_interpT2CharString().