InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SLCTextGlyphNode.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Adobe Developer Technologies
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __SLCTextGlyphNode_h__
25 #define __SLCTextGlyphNode_h__
26 
27 class IComposeScanner;
28 class IDrawingStyle;
29 class IWaxLine;
30 class IWaxRun;
31 class IFontInstance;
32 
33 #include "SLCGlyphNode.h"
34 
48 {
49 public:
52  SLCTextGlyphNode(IComposeScanner* composeScanner,
53  IDrawingStyle* drawingStyle,
54  TextIndex startingIndex,
55  const PMReal& xOffset);
56 
59  virtual ~SLCTextGlyphNode(void);
60 
63  virtual SLComposerStatusCode GetGlyph(const UTF32TextChar& character, Text::GlyphID& glyphID, PMReal& glyphWidth);
64 
67  virtual SLComposerStatusCode BufferGlyph(const UTF32TextChar& character, const Text::GlyphID& glyphID, const PMReal& glyphWidth);
68 
71  virtual PMReal GetWidth(void) const;
72 
75  virtual SLComposerStatusCode FindTextBreak(void);
76 
79  virtual bool16 GetTrailingWhiteSpaceWidth(PMReal& width) const;
80 
83  virtual bool16 FitTrailingWhiteSpace(const PMReal& widthScaleFactor);
84 
87  virtual SLComposerStatusCode CreateWax(const IWaxLine* waxLine) const;
88 
91  virtual IWaxRun* CreateWaxRun(void) const;
92 
93 protected:
96  inline const PMReal& GetPointSize(void) const
97  {
98  return fPointSize;
99  }
100 
106 
130 
134  {
135  return fFixedToPMRealEmDashWidthRoundingError;
136  }
137 
140  inline const PMReal& GetEmDashWidth(void) const
141  {
142  return fEmDashWidth;
143  }
144 
155  virtual Text::GlyphID DetermineGlyphID(const UTF32TextChar& character) const;
156 
161  virtual PMReal DetermineGlyphWidth(const Text::GlyphID& glyphID) const;
162 
166  {
167  return fGlyphIDs;
168  };
169 
174  {
175  return fGlyphWidths;
176  };
177 
182 
189  virtual SLComposerStatusCode GetCharacter(int32 glyphNodeIndex, UTF32TextChar& character) const;
190 
196  virtual SLComposerStatusCode PushOut(UTF32TextChar& lastCharacter);
197 
198 private:
199 
200  /* Font instance for the glyphs that is used to get GlyphIDs and metrics.
201  */
202  IFontInstance* fFontInstance;
203 
204  /* Current dynamic buffer size.
205  */
206  int32 fBufferSize;
207 
208  /* Buffers storing GlyphIDs and corresponding widths (allocated on the heap).
209  */
210 #if 0
211  Text::GlyphID* fGlyphIDs;
212  PMReal* fGlyphWidths;
213 #define USING_PTRS_FOR_MEMBERS
214 #else
215  K2Vector<Text::GlyphID> fGlyphIDs;
216  K2Vector<PMReal> fGlyphWidths;
217 #endif
218 
219  /* Cached metrics for the font.
220  */
221  PMReal fPointSize;
222 
223  /* Adjustment to compensate for AGM fixed-point math rounding error.
224  */
225  PMReal fFixedToPMRealEmDashWidthRoundingError;
226 
227  /* Width of an em-dash in AGM fixed-point.
228  */
229  PMReal fEmDashWidth;
230 };
231 
232 #endif // __SLCTextGlyphNode_h__
233 
234 // End, SLCTextGlyphNode.h
235