ReactOS 0.4.16-dev-1098-g0ca6002
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 };
@ CF2_MAX_HINTS
Definition: pshints.h:47

◆ anonymous enum

anonymous enum
Enumerator
CF2_MAX_HINT_EDGES 

Definition at line 120 of file pshints.h.

121 {
123 };
@ CF2_MAX_HINT_EDGES
Definition: pshints.h:122

Function Documentation

◆ cf2_glyphpath_closeOpenPath()

cf2_glyphpath_closeOpenPath ( CF2_GlyphPath  glyphpath)

Definition at line 1904 of file pshints.c.

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

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 1814 of file pshints.c.

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

Referenced by cf2_doFlex(), and cf2_interpT2CharString().

◆ cf2_glyphpath_finalize()

cf2_glyphpath_finalize ( CF2_GlyphPath  glyphpath)

Definition at line 1151 of file pshints.c.

1152 {
1153 cf2_arrstack_finalize( &glyphpath->hintMoves );
1154 }
cf2_arrstack_finalize(CF2_ArrStack arrstack)
Definition: psarrst.c:76
CF2_ArrStackRec hintMoves
Definition: pshints.h:193

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 1080 of file pshints.c.

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

Referenced by cf2_interpT2CharString().

◆ cf2_glyphpath_lineTo()

cf2_glyphpath_lineTo ( CF2_GlyphPath  glyphpath,
CF2_Fixed  x,
CF2_Fixed  y 
)

Definition at line 1708 of file pshints.c.

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

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 1678 of file pshints.c.

1681 {
1682 cf2_glyphpath_closeOpenPath( glyphpath );
1683
1684 /* save the parameters of the move for later, when we'll know how to */
1685 /* offset it; */
1686 /* also save last move point */
1687 glyphpath->currentCS.x = glyphpath->start.x = x;
1688 glyphpath->currentCS.y = glyphpath->start.y = y;
1689
1690 glyphpath->moveIsPending = TRUE;
1691
1692 /* ensure we have a valid map with current mask */
1693 if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ||
1694 cf2_hintmask_isNew( glyphpath->hintMask ) )
1695 cf2_hintmap_build( &glyphpath->hintMap,
1696 glyphpath->hStemHintArray,
1697 glyphpath->vStemHintArray,
1698 glyphpath->hintMask,
1699 glyphpath->hintOriginY,
1700 FALSE );
1701
1702 /* save a copy of current HintMap to use when drawing initial point */
1703 glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */
1704 }
cf2_glyphpath_closeOpenPath(CF2_GlyphPath glyphpath)
Definition: pshints.c:1904

Referenced by cf2_glyphpath_pushMove(), and cf2_interpT2CharString().

◆ cf2_hint_isBottom()

cf2_hint_isBottom ( const CF2_Hint  hint)

Definition at line 246 of file pshints.c.

247 {
248 return FT_BOOL( hint->flags & ( CF2_PairBottom | CF2_GhostBottom ) );
249 }
#define FT_BOOL(x)
Definition: fttypes.h:591
@ CF2_PairBottom
Definition: psblues.h:89
@ CF2_GhostBottom
Definition: psblues.h:87
DWORD hint
Definition: vfdcmd.c:88

Referenced by cf2_blues_capture().

◆ cf2_hint_isTop()

cf2_hint_isTop ( const CF2_Hint  hint)

Definition at line 239 of file pshints.c.

240 {
241 return FT_BOOL( hint->flags & ( CF2_PairTop | CF2_GhostTop ) );
242 }
@ CF2_PairTop
Definition: psblues.h:90
@ CF2_GhostTop
Definition: psblues.h: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 );
221 }

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

◆ cf2_hint_lock()

cf2_hint_lock ( CF2_Hint  hint)

Definition at line 267 of file pshints.c.

268 {
269 hint->flags |= CF2_Locked;
270 }
@ CF2_Locked
Definition: psblues.h:91

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 805 of file pshints.c.

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

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 274 of file pshints.c.

279 {
280 FT_ZERO( hintmap );
281
282 /* copy parameters from font instance */
283 hintmap->hinted = font->hinted;
284 hintmap->scale = scale;
285 hintmap->font = font;
286 hintmap->initialHintMap = initialMap;
287 /* will clear in `cf2_hintmap_adjustHints' */
288 hintmap->hintMoves = hintMoves;
289 }
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
CF2_ArrStack hintMoves
Definition: pshints.h:134

Referenced by cf2_glyphpath_init(), and cf2_interpT2CharString().