Update contrib.
1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Font and text classes used by printer drivers.
16 #ifndef PDRSTOREFONT_H
17 #define PDRSTOREFONT_H
21 @internalAll - Internal to Symbian
41 class CPdrResources : public CBase
44 IMPORT_C CPdrResources();
45 IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId aStreamId);
46 IMPORT_C ~CPdrResources();
47 IMPORT_C TPtrC8 ResourceString(TInt anId) const;
51 TPdrResource* iResourceList;
55 class TTypefaceFontsEntry
58 IMPORT_C void InternalizeL(RReadStream& aStream);
65 TBool iNotInLandscape;
69 class CPdrModelInfo : public CBase
72 IMPORT_C CPdrModelInfo();
73 IMPORT_C ~CPdrModelInfo();
74 IMPORT_C void InternalizeL(RReadStream& aStream);
79 TInt iKPixelWidthInTwips;
81 TInt iKPixelHeightInTwips;
83 TPoint iPortraitOffsetInPixels;
85 TPoint iLandscapeOffsetInPixels;
87 TMargins iMinMarginsInPixels;
89 TDisplayMode iDisplayMode;
91 TInt iNumTypefaceFonts;
93 TTypefaceFontsEntry* iTypefaceFontsEntryList;
95 TStreamId iResourcesStreamId;
97 TStreamId iSpareStreamId;
104 class CPdrTypefaceStore : public CTypefaceStore
107 IMPORT_C static CPdrTypefaceStore* NewL(CStreamStore& aStore, TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
108 IMPORT_C ~CPdrTypefaceStore();
109 // CTypefaceStore implementation
110 IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
111 IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
112 IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
113 IMPORT_C TInt NumTypefaces() const;
114 IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
115 IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
116 IMPORT_C void SetPageOrientation(TPageSpec::TPageOrientation aPageOrientation);
118 CPdrTypefaceStore(CStreamStore& aStore, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
119 void ConstructL(TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation);
120 CFontInfo* FontInfoL(TStreamId aStreamId) const;
121 CPdrTranslates* TranslatesL(TStreamId aStreamId) const;
122 TInt GetNearestFontHeightIndex(TInt aTypefaceIndex, TInt aHeightInTwips) const;
123 TFontStyle GetNearestFontStyle(TInt aTypefaceIndex, TInt aHeightIndex, const TFontStyle& aFontStyle) const;
124 TBool IsFontLoaded(CFont*& aFont, const TFontSpec& aFontSpecInTwips, TInt aHeightInPixels) const;
125 CInfoFont* NewFontL(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, TStreamId aFontInfoStreamId);
126 TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
128 CPdrDevice* iPdrDevice;
130 CStreamStore* iStore;
131 TInt iKPixelHeightInTwips;
132 CArrayPtr<CTypefaceFonts>* iTypefaceFontsList;
133 CArrayPtr<CTypefaceFonts>* iPortraitTypefaceFontsList;
134 CArrayPtr<CTypefaceFonts>* iLandscapeTypefaceFontsList;
135 CArrayPtr<CTypefaceFonts>* iCurrentTypefaceFontsList;
136 CArrayPtr<CPdrTranslates>* iTranslatesList;
137 CArrayPtr<CFontInfo>* iFontInfoList;
140 class CPageTextEntry : public CBase
143 IMPORT_C CPageTextEntry(const TPoint& aDrawPos, TInt aHeightInPixels, TInt aTextWidthInPixels, HBufC8* aText, TTextFormat* aTextFormat);
144 IMPORT_C ~CPageTextEntry();
145 IMPORT_C TPoint TopTextPos();
150 TInt iHeightInPixels;
152 TInt iTextWidthInPixels;
156 TTextFormat* iTextFormat;
160 class CPageText : public CBase
166 IMPORT_C static CPageText* NewL();
167 IMPORT_C ~CPageText();
168 IMPORT_C void Reset();
169 IMPORT_C void AddEntryL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString);
170 IMPORT_C TInt NumEntries();
171 IMPORT_C CPageTextEntry* operator [] (TInt anIndex);
172 /** This function is internal only, and is not intended for use. */
173 inline TInt MaxFontHeightInPixels() const {return iMaxFontHeightInPixels;}
176 TInt iMaxFontHeightInPixels;
178 CArrayPtr<TTextFormat>* iTextFormatList;
180 CArrayPtr<CPageTextEntry>* iPageTextEntryList;
184 class CPdrGc : public CGraphicsContext
187 CPdrGc(CPdrDevice* aDevice);
190 static CPdrGc* NewL(CPdrDevice* aDevice);
193 IMPORT_C CGraphicsDevice* Device() const;
194 IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0));
195 IMPORT_C void SetDrawMode(TDrawMode aDrawingMode);
196 IMPORT_C void SetClippingRect(const TRect& aRect);
197 IMPORT_C void CancelClippingRect();
198 IMPORT_C void Reset();
200 IMPORT_C void UseFont(const CFont* aFont);
201 IMPORT_C void DiscardFont();
203 IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
204 IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
205 IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
206 IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
208 IMPORT_C void SetPenColor(const TRgb& aColor);
209 IMPORT_C void SetPenStyle(TPenStyle aPenStyle);
210 IMPORT_C void SetPenSize(const TSize& aSize = TSize(1, 1));
212 IMPORT_C void SetBrushColor(const TRgb& aColor);
213 IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
214 IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
215 IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
216 IMPORT_C void DiscardBrushPattern();
218 IMPORT_C void MoveTo(const TPoint& aPoint);
219 IMPORT_C void MoveBy(const TPoint& aVector);
220 IMPORT_C void Plot(const TPoint& aPoint);
222 IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
223 IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2);
224 IMPORT_C void DrawLineTo(const TPoint& aPoint);
225 IMPORT_C void DrawLineBy(const TPoint& aVector);
226 IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
227 IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
229 IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
230 IMPORT_C void DrawEllipse(const TRect& aRect);
231 IMPORT_C void DrawRect(const TRect& aRect);
232 IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
233 IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList, TFillRule aFillRule = EAlternate);
234 IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate);
236 IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource);
237 IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);
238 IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect);
239 IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
240 IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
242 IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition);
243 IMPORT_C void DrawTextL(const TDesC& aString, const TPoint& aPosition);
244 IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0);
246 IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards);
247 IMPORT_C TInt SetClippingRegion(const TRegion &aRegion);
248 IMPORT_C void CancelClippingRegion();
249 IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
250 IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
251 IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
252 IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
255 CPdrControl* PdrControl() const;
259 CPdrDevice* iPdrDevice;
261 CFbsBitGc* iBandedGc;
273 TFontUnderline iUnderlineStyle;
275 TFontStrikethrough iStrikethroughStyle;
277 TRect iClippingRect; // Relative to absolute origin
279 TInt iWordExcessWidthInPixels;
283 TInt iCharExcessWidthInPixels;
289 TBool iPrintTextUsingBitmaps;
294 #endif // PDRSTOREFONT_H