Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GR_WIN32_GRAPHICS_H
00021 #define GR_WIN32_GRAPHICS_H
00022
00023 #include "ut_types.h"
00024 #include "gr_Win32Graphics.h"
00025 #include "gr_RenderInfo.h"
00026 #include "gr_Win32Uniscribe.h"
00027
00028
00029 #define GR_WIN32USP_BUILTIN
00030
00031 #ifndef GR_WIN32USP_BUILTIN
00032 #define PLUGIN_NAME "Uniscribe graphics class for Win32"
00033 #endif
00034
00035
00036
00037
00038 class ABI_EXPORT GR_Win32USPFont : public GR_Win32Font
00039 {
00040 public:
00041 static GR_Win32USPFont * newFont(LOGFONTW & lf, double fPoints, HDC hdc, HDC printHDC);
00042 virtual ~GR_Win32USPFont();
00043
00044 SCRIPT_CACHE * getScriptCache() {return &m_sc;}
00045 HDC getPrintDC() const {return m_printHDC;}
00046 void setPrintDC(HDC dc) {m_printHDC = dc;}
00047
00048 UT_sint32 getScreenAscent() const {return m_iScreenAscent;}
00049 void setScreenAscent(UT_sint32 iA) {m_iScreenAscent = iA;}
00050
00051 protected:
00052
00053 GR_Win32USPFont(LOGFONTW & lf, double fPoints, HDC hdc, HDC printHDC);
00054
00055 virtual void _clearAnyCachedInfo();
00056
00057 private:
00058 SCRIPT_CACHE m_sc;
00059 HDC m_printHDC;
00060 UT_sint32 m_iScreenAscent;
00061 };
00062
00063 class GR_Win32USPRenderInfo;
00064
00065 class ABI_EXPORT GR_Win32USPGraphics : public GR_Win32Graphics
00066 {
00067
00068
00069 public:
00070 virtual ~GR_Win32USPGraphics();
00071
00072 static UT_uint32 s_getClassId() {return GRID_WIN32_UNISCRIBE;}
00073 virtual UT_uint32 getClassId() {return s_getClassId();}
00074
00075 virtual GR_Capability getCapability() {return GRCAP_SCREEN_AND_PRINTER;}
00076 static const char * graphicsDescriptor();
00077 static const char * getUSPVersion();
00078 static GR_Graphics * graphicsAllocator(GR_AllocInfo&);
00079
00080 virtual void setFont(const GR_Font* pFont);
00081
00082 virtual void drawChars(const UT_UCSChar* pChars,
00083 int iCharOffset, int iLength,
00084 UT_sint32 xoff, UT_sint32 yoff,
00085 int * pCharWidth);
00086
00087 virtual void drawCharsRelativeToBaseline(const UT_UCSChar* pChars,
00088 int iCharOffset,
00089 int iLength,
00090 UT_sint32 xoff,
00091 UT_sint32 yoff,
00092 int* pCharWidths = NULL);
00093
00094 virtual UT_uint32 getFontHeight();
00095 virtual UT_uint32 getFontAscent();
00096 virtual UT_uint32 getFontDescent();
00097 virtual UT_uint32 getFontAscent(GR_Font *);
00098 virtual UT_uint32 getFontDescent(GR_Font *);
00099 virtual UT_uint32 getFontHeight(GR_Font *);
00100
00101 virtual void setZoomPercentage(UT_uint32 iZoom);
00102
00104
00105
00106 virtual bool itemize(UT_TextIterator & text, GR_Itemization & I);
00107 virtual bool shape(GR_ShapingInfo & si, GR_RenderInfo *& ri);
00108 virtual void prepareToRenderChars(GR_RenderInfo & ri);
00109 virtual void renderChars(GR_RenderInfo & ri);
00110 virtual void measureRenderedCharWidths(GR_RenderInfo & ri);
00111 virtual void appendRenderedCharsToBuff(GR_RenderInfo & ri, UT_GrowBuf & buf) const;
00112
00113 virtual bool canBreak(GR_RenderInfo & ri, UT_sint32 &iNext, bool bAfter);
00114
00115 virtual bool nativeBreakInfoForRightEdge() {return false;}
00116
00117 virtual UT_sint32 resetJustification(GR_RenderInfo & ri, bool bPermanent);
00118 virtual UT_sint32 countJustificationPoints(const GR_RenderInfo & ri) const;
00119 virtual void justify(GR_RenderInfo & ri);
00120
00121 virtual UT_uint32 XYToPosition(const GR_RenderInfo & ri, UT_sint32 x, UT_sint32 y) const;
00122 virtual void positionToXY(const GR_RenderInfo & ri,
00123 UT_sint32& x, UT_sint32& y,
00124 UT_sint32& x2, UT_sint32& y2,
00125 UT_sint32& height, bool& bDirection) const;
00126
00127 virtual UT_sint32 getTextWidth(GR_RenderInfo & ri);
00128
00129 virtual bool needsSpecialCaretPositioning(GR_RenderInfo & ri);
00130 virtual UT_uint32 adjustCaretPosition(GR_RenderInfo & ri, bool bForward);
00131 virtual void adjustDeletePosition(GR_RenderInfo & ri);
00132
00133 protected:
00134 inline bool _needsSpecialBreaking(GR_Win32USPRenderInfo &ri);
00135 inline bool _needsSpecialCaretPositioning(GR_Win32USPRenderInfo &ri);
00136 inline bool _scriptBreak(GR_Win32USPRenderInfo &ri);
00137
00138 public:
00139 virtual const UT_VersionInfo & getVersion() const {return s_Version;}
00140
00141 virtual void setPrintDC(HDC dc);
00142
00143
00144 protected:
00145
00146 GR_Win32USPGraphics(HDC, HWND);
00147 GR_Win32USPGraphics(HDC, const DOCINFOW *, HGLOBAL hDevMode = NULL);
00148
00149 private:
00150 bool _constructorCommonCode();
00151 virtual GR_Win32Font * _newFont(LOGFONTW & lf, double fPoints, HDC hdc, HDC printHDC);
00152
00153 void _setupFontOnDC(GR_Win32USPFont *pFont, bool bZoomMe);
00154
00155 void _drawChars(const UT_UCSChar* pChars,
00156 int iCharOffset, int iLength,
00157 UT_sint32 xoff, UT_sint32 yoff,
00158 int * pCharWidth);
00159
00160 bool m_bConstructorSucceeded;
00161
00162 static HINSTANCE s_hUniscribe;
00163 static UT_uint32 s_iInstanceCount;
00164 static UT_VersionInfo s_Version;
00165 static const SCRIPT_PROPERTIES **s_ppScriptProperties;
00166 static int s_iMaxScript;
00167 static UT_UTF8String s_sDescription;
00168 static UT_UTF8String s_sUSPVersion;
00169
00170 protected:
00171
00172
00173
00174
00175
00176
00177
00178 static tScriptItemize fScriptItemize;
00179 static tScriptShape fScriptShape;
00180 static tScriptStringOut fScriptStringOut;
00181 static tScriptStringAnalyse fScriptStringAnalyse;
00182 static tScriptStringFree fScriptStringFree;
00183 static tScriptTextOut fScriptTextOut;
00184 static tScriptPlace fScriptPlace;
00185 static tScriptJustify fScriptJustify;
00186 static tScriptCPtoX fScriptCPtoX;
00187 static tScriptXtoCP fScriptXtoCP;
00188 static tScriptBreak fScriptBreak;
00189 static tScriptIsComplex fScriptIsComplex;
00190 static tScriptGetProperties fScriptGetProperties;
00191 static tScriptRecordDigitSubstitution fScriptRecordDigitSubstitution;
00192 public:
00193
00194 static tScriptFreeCache fScriptFreeCache;
00195 };
00196
00197 #endif