From: <sil...@li...> - 2003-01-31 00:23:14
|
Update of /cvsroot/silgraphite/silgraphite/c/include In directory sc8-pr-cvs1:/tmp/cvs-serv7241/c/include Added Files: graphite.h Log Message: add c wraper --- NEW FILE: graphite.h --- /************************************************************** Copyright (C) 1999, 2001 SIL International. All rights reserved. Distributable under the terms of either the Common Public License or the GNU Lesser General Public License, as specified in the LICENSING.txt file. File: graphite.h Description: Header file for Graphite C interface Author: Frank Yung-Fong Tang <ft...@ne...> *************************************************************/ #ifndef graphite_h__ #define graphite_h__ typedef void* greng; typedef void* grseg; typedef void* grgfx; typedef struct _grgfx_funcs *grgfx_funcs; typedef void* grgfx_data; typedef void* grtxt; typedef struct _grtxt_funcs *grtxt_funcs; typedef void* grtxt_data; /* we probably should move the grres to here. */ typedef enum grres { }; #ifdef __cpluspplus extern "C" { #endif /*-----------------------------------------------------------*/ /* Functions for greng */ greng grengNew(); void grengDone(greng aEng); grres grengFontIsValid(greng aEng, OLECHAR * prgchwErrMsg, int cchMaxErrMsg); grres grengGetSegDatMaxLength(greng aEng, int * pcb); grres grengFindBreakPoint(greng aEng, grgfx pgg, grtxt pgts, int ichMin, int ichLim, int ichLimBacktrack, bool fNeedFinalBreak, bool fStartLine, int dxMaxWidth, LgLineBreak lbPref, LgLineBreak lbMax, LgTrailingWsHandling twsh, bool fParaRtoL, grseg * ppsegRet, int * pdichwLimSeg, int * pdxWidth, LgEndSegmentType * pest, int cbPrev, byte * pbPrevSegDat, int cbNextMax, byte * pbNextSegDat, int * pcbNextSegDat, int * pdichwContext, OLECHAR * prgchwErrMsg, int cchMaxErrMsg); grres grengGetScriptDirection(greng aEng, int * pgrfsdc, OLECHAR * prgchwErrMsg, int cchMaxErrMsg); grres grengInterpretChrp(greng aEng, LgCharRenderProps * pchrp); grres grengIsGraphiteFont(greng aEng, grgfx pgg); int grengGetFontEmUnits(greng aEng ); int grengGetExtraAscent(greng aEng ); int grengGetExtraDescent(greng aEng ); /* Note: We may need to put more GrEngine methods here. I currently only put those I think which is necessary. This list need to be reviewed by Graphite experts. */ /* Functions for grseg */ /* grseg is returned by grres grengFindBreakPoint() */ void grsegDone(grseg aSeg); grres grsegDrawText(grseg aSeg, int ichwBase, grgfx pgg, RECT rcSrc, RECT rcDst, int * pdxdWidth); grres grsegRecompute(grseg aSeg, int ichwBase, grgfx pgg); grres grsegGetWidth(grseg aSeg, int ichwBase, grgfx pgg, int * pxs); grres grsegGetRightOverhang(grseg aSeg, int ichwBase, grgfx pgg, int * pxs); grres grsegGetLeftOverhang(grseg aSeg, int ichwBase, grgfx pgg, int * pxs); grres grsegGetHeight(grseg aSeg, int ichwBase, grgfx pgg, int * pys); grres grsegGetAscent(grseg aSeg, int ichwBase, grgfx pgg, int * pys); grres grsegExtent(grseg aSeg, int ichwBase, grgfx pgg, int * pdxsWidth, int * pdysHt); grres grsegBoundingRect(grseg aSeg, int ichwBase, grgfx pgg, RECT rcSrc, RECT rcDst, RECT * prcBounds); grres grsegGetActualWidth(grseg aSeg, int ichwBase, grgfx pgg, RECT rcSrc, RECT rcDst, int * pdxdWidth); grres grsegGetAscentOverhang(grseg aSeg, int ichwBase, grgfx pgg, int * pys); grres grsegGetDescentOverhang(grseg aSeg, int ichwBase, grgfx pgg, int * pys); grres grsegGetRightToLeft(grseg aSeg, int ichwBase, bool * pfResult); grres grsegGetDirectionDepth(grseg aSeg, int ichwBase, int * pnDepth, bool * pfWeak); grres grsegSetDirectionDepth(grseg aSeg, int ichwBase, int nNewDepth); grres grsegGetWritingSystem(grseg aSeg, int ichwBase, int * penc, int * pws); grres grsegGetLim(grseg aSeg, int ichwBase, int * pdichw); grres grsegGetLimInterest(grseg aSeg, int ichwBase, int * pdichw); grres grsegPutEndLine(grseg aSeg, int ichwBase, grgfx pgg, bool fNewVal); grres grsegPutStartLine(grseg aSeg, int ichwBase, grgfx pgg, bool fNewVal); grres grsegGetStartBreakWeight(grseg aSeg, int ichwBase, grgfx pgg, LgLineBreak * plb); grres grsegGetEndBreakWeight(grseg aSeg, int ichwBase, grgfx pgg, LgLineBreak * plb); grres grsegGetStretch(grseg aSeg, int ichwBase, int * pxs); grres grsegPutStretch(grseg aSeg, int ichwBase, int xs); grres grsegIsValidInsertionPoint(grseg aSeg, int ichwBase, grgfx pgg, int ichwIP, LgIpValidResult * pipvr); grres grsegDoBoundariesCoincide(grseg aSeg, int ichwBase, grgfx pgg, bool fBoundaryEnd, bool fBoundaryRight, bool * pfResult); grres grsegDrawInsertionPoint(grseg aSeg, int ichwBase, grgfx pgg, RECT rcSrc, RECT rcDst, int ichwIP, bool fAssocPrev, bool bOn, LgIPDrawMode dm); grres grsegPositionsOfIP(grseg aSeg, int ichwBase, grgfx pgg, RECT rs, RECT rd, int ichwIP, bool fAssocPrev, LgIPDrawMode dm, RECT * prdPrimary, RECT * prdSecondary, bool * pfPrimaryHere, bool * pfSecHere); grres grsegDrawRange(grseg aSeg, int ichwBase, grgfx pgg, RECT rs, RECT rd, int ichwMin, int ichwLim, int ydTop, int ydBottom, bool bOn); grres grsegPositionOfRange(grseg aSeg, int ichwBase, grgfx pgg, RECT rs, RECT rd, int ichwMin, int ichwLim, int ydTop, int ydBottom, RECT * prsBounds, bool * pfAnythingToDraw); grres grsegPointToChar(grseg aSeg, int ichwBase, grgfx pgg, RECT rs, RECT rd, POINT zptdClickPosition, int * pichw, bool * pfAssocPrev); grres grsegArrowKeyPosition(grseg aSeg, int ichwBase, grgfx pgg, int * pichwIP, bool * pfAssocPrev, bool fRight, bool fMovingIn, bool * pfResult); grres grsegExtendSelectionPosition(grseg aSeg, int ichwBase, grgfx pgg, int * pichw, bool fAssocPrevMatch, bool fAssocPrevNeeded, int ichAnchor, bool fRight, bool fMovingIn, bool* pfRet); grres grsegGetCharPlacement(grseg aSeg, int ichwBase, grgfx pgg, int ichwMin, int ichwLim, RECT rs, RECT rd, bool fSkipSpace, int crgMax, int * pcxd, int * prgxdLefts, int * prgxdRights, int * prgydTops); /* Note: We may need to put more GrSegment methods here. I currently only put those I think which is necessary. This list need to be reviewed by Graphite experts. */ /*-----------------------------------------------------------*/ /* Function prototype for grgfx_funcs */ /* grgfx_funcs hold the function pointer of the class grgfx_data hold ther instance's data member */ /* The grgfxReleaseData function will be called by grgfxDone() to release aData */ typedef grres (*grgfxInitDataFunc) (grgfx_funcs aFunc, grgfx_data aData); typedef grres (*grgfxReleaseDataFunc) (grgfx_funcs aFunc, grgfx_data aData); typedef grres (*grgfxInvertRectFunc) (grgfx_funcs aFunc, grgfx_data aData, int twLeft, int twTop, int twRight, int twBottom); typedef grres (*grgfxDrawTextExtFunc) ( grgfx_funcs aFunc, grgfx_data aData, int x, int y, int cch, const OLECHAR __RPC_FAR * prgchw, UINT uOptions, const RECT __RPC_FAR * pRect, int __RPC_FAR * prgdx); typedef grres (*grgfxGetFontEmSquareFunc) ( grgfx_funcs aFunc, grgfx_data aData, int * pxyFontEmSquare); typedef grres (*grgfxGetGlyphMetricsFunc) ( grgfx_funcs aFunc, grgfx_data aData, int chw, int * psBoundingWidth, int * pyBoundingHeight, int * pxBoundingX, int * pyBoundingY, int * pxAdvanceX, int * pyAdvanceY); typedef grres (*grgfxGetFontDataFunc) ( grgfx_funcs aFunc, grgfx_data aData, int nTableId, int * pcbTableSz, byte * prgb, int cbMax); typedef grres (*grgfxXYFromGlyphPointFunc) ( grgfx_funcs aFunc, grgfx_data aData, int chw, int nPoint, int * pxRet, int * pyRet); typedef grres (*grgfxGetFontAscentFunc) ( grgfx_funcs aFunc, grgfx_data aData, int* pdy); typedef grres (*grgfxGetFontDescentFunc) ( grgfx_funcs aFunc, grgfx_data aData, int* pdy); typedef grres (*grgfxGetYUnitsPerInchFunc) ( grgfx_funcs aFunc, grgfx_data aData, int * pyInch); typedef grres (*grgfxSetupGraphicsFunc) ( grgfx_funcs aFunc, grgfx_data aData, LgCharRenderProps * pchrp); struct _grgfx_funcs { grgfxInitDataFunc mInitData; grgfxReleaseDataFunc mReleaseData; grgfxInvertRectFunc mInvertRect; grgfxDrawTextExtFunc mDrawTextExt; grgfxGetFontEmSquareFunc mGetFontEmSquare; grgfxGetGlyphMetricsFunc mGetGlyphMetrics; grgfxGetFontDataFunc mGetFontData; grgfxXYFromGlyphPointFunc mXYFromGlyphPoint; grgfxGetFontAscentFunc mGetFontAscent; grgfxGetFontDescentFunc mGetFontDescent; grgfxGetYUnitsPerInchFunc mGetYUnitsPerInch; grgfxSetupGraphicsFunc mSetupGraphics; } ; /* Functions for grgfx */ grgfx grgfxNew(grgfx_funcs aFuns, grgfx_data aData); void grgfxDone(grgfx aGra); /*-----------------------------------------------------------*/ /* Function prototype for grtxt_funcs */ /* grtxt_funcs hold the function pointer of the class grtxt_data hold ther instance's data member */ /* The grtxtReleaseData function will be called by grtxtDone() to release aData */ typedef grres (*grtxtInitDataFunc) (grtxt_funcs aFunc, grtxt_data aData); typedef grres (*grtxtReleaseDataFunc) (grtxt_funcs aFunc, grtxt_data aData); typedef grres (*grtxtFetchFunc) (grtxt_funcs aFunc, grtxt_data aData, int ichMin, int ichLim, OLECHAR * prgchBuf); typedef grres (*grtxtGetLengthFunc) (grtxt_funcs aFunc, grtxt_data aData, int * pcch); typedef grres (*grtxtGetCharPropsFunc) (grtxt_funcs aFunc, grtxt_data aData, int ich, LgCharRenderProps * pchrp, int * pichMin, int * pichLim); typedef grres (*grtxtGetParaPropsFunc) (grtxt_funcs aFunc, grtxt_data aData, int ich, LgParaRenderProps * pchrp, int * pichMin, int * pichLim); typedef grres (*grtxtGetFontVariationsFunc) (grtxt_funcs aFunc, grtxt_data aData, int ich, OLECHAR * prgchFontVar, int ichMax, int * pich, int * pichMin, int * pichLim); typedef void (*grtxtTextSrcObjectFunc) (grtxt_funcs aFunc, grtxt_data aData, grtxt* ppgts); typedef void (*grtxtDeleteTextSrcPtrFunc) (grtxt_funcs aFunc, grtxt_data aData); struct _grtxt_funcs { grtxtInitDataFunc mInitData; grtxtReleaseDataFunc mReleaseData; grtxtFetchFunc mFetch; grtxtGetLengthFunc mGetLength; grtxtGetCharPropsFunc mGetCharProps; grtxtGetParaPropsFunc mGetParaProps; grtxtGetFontVariationsFunc mGetFontVariations; grtxtTextSrcObjectFunc mTextSrcObject; grtxtDeleteTextSrcPtrFunc mDeleteTextSrcPtr; } ; /* Functions for grtxt */ grtxt grtxtNew(grtxt_funcs aFuns, grtxt_data aData); void grtxtDone(grtxt aTxt); /*-----------------------------------------------------------*/ #ifdef __cpluspplus }; #endif #endif /* graphite_h__ */ |