InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DrawStringUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Paul Sorrick
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 __DRAWSTRINGUTILS__
25 #define __DRAWSTRINGUTILS__
26 
27 #include "IPMUnknown.h"
28 #include "PMString.h"
29 #include "IInterfaceColors.h"
30 #include "InterfaceFontInfo.h"
31 #include "WidgetDefs.h"
32 #include <string>
33 
34 #include "DVAForwardDeclarations.h"
35 #include "DVPublicUtilities.h"
36 
37 class IGraphicsContext;
38 
39 
40 namespace StringUtils
41 {
52  DV_ void PMDrawString(IGraphicsContext* gc, const PMRect& textBBox, int16 alignment, const PMString& str, const InterfaceFontInfo& fontInfo,
53  IInterfaceColors::InterfaceColor color = kInterfaceTextColor, bool16 convertAmpersandToUnderline = kFalse, bool16 centerVertically = kTrue, bool16 underlineText = kFalse);
54 
64  DV_ void PMDrawString(IGraphicsContext* gc, const PMPoint& startPt, const PMString& str, const InterfaceFontInfo& fontInfo,
65  IInterfaceColors::InterfaceColor color = kInterfaceTextColor, bool16 convertAmpersandToUnderline = kFalse, bool16 underlineText = kFalse);
66 
77  DV_ void PMDrawStringRGB (IGraphicsContext* gc, const PMRect& textBBox, int16 alignment, const PMString& str,
78  const InterfaceFontInfo& fontInfo, const RealAGMColor & rgbColor, bool16 convertAmpersandToUnderline = kFalse, bool16 centerVertically = kTrue, bool16 underlineText = kFalse, dv_utils::AntiAliasPolicy aa_policy = dv_utils::kAntiAliasPolicy_Med);
79  DV_ void PMDrawStringRGB (IGraphicsContext* gc, const PMPoint& startPt, const PMString& str,
80  const InterfaceFontInfo& fontInfo, const RealAGMColor & rgbColor, bool16 convertAmpersandToUnderline = kFalse, bool16 underlineText = kFalse, dv_utils::AntiAliasPolicy aa_policy = dv_utils::kAntiAliasPolicy_Med);
81 
82  DV_ void PostTransformPMDrawStringRGB (IGraphicsContext* gc, const PMRect& textBBox, int16 alignment, const PMString& str,
83  const InterfaceFontInfo& fontInfo, const RealAGMColor & rgbColor, bool16 convertAmpersandToUnderline = kFalse, bool16 centerVertically = kFalse, bool16 underlineText = kFalse);
84 
85  DV_ PMPoint PMMeasureString(IGraphicsContext* gc, const PMString& str, const InterfaceFontInfo& fontInfo,
86  bool16 convertAmpersandToUnderline = kTrue);
87  DV_ PMPoint PMMeasureString(const PMString& str, const InterfaceFontInfo& fontInfo,
88  bool16 convertAmpersandToUnderline = kTrue);
89 
90  DV_ PMString PMEllipsizeString(IGraphicsContext* gc, PMReal width, const PMString& str, const InterfaceFontInfo& fontInfo,
91  bool16* didTruncate = nil, bool16 convertAmpersandToUnderline = kTrue);
92  DV_ PMString PMEllipsizeString(IGraphicsContext* gc, PMReal width, const PMString& str, const InterfaceFontInfo& fontInfo,
93  EllipsizeStyle truncateWhere, bool16* didTruncate = nil, bool16 convertAmpersandToUnderline = kTrue);
94  DV_ PMString PMEllipsizeString(PMReal width, const PMString& str, const InterfaceFontInfo& fontInfo, EllipsizeStyle truncateWhere,
95  bool16* didTruncate, bool16 convertAmpersand = kTrue);
96 
97  //========================================================================================
98  // PMDrawStringRGB
99  //
100  // Drawbot based utility function to draw the text at the specified draw point using specified
101  // color and font information. Also draws underline if specified.
102  //========================================================================================
103  DV_ void PMDrawStringRGB (
104  dvaui::drawbot::Drawbot* pDrawbot,
105  const PMPoint & drawPt,
106  int16 alignment,
107  const PMString & str,
108  const InterfaceFontInfo & fontInfo,
109  const RealAGMColor & realColor,
110  bool16 convertAmpersandToUnderline,
111  bool16 drawUnderline,
112  dv_utils::AntiAliasPolicy aa_policy = dv_utils::kAntiAliasPolicy_Med);
113 
114  DV_ void PMDrawStringRGB (
115  dvaui::drawbot::Drawbot* pDrawbot,
116  const PMRect& textBBox,
117  int16 alignment,
118  const PMString & str,
119  const InterfaceFontInfo & fontInfo,
120  const RealAGMColor & realColor,
121  bool16 convertAmpersandToUnderline,
122  bool16 centerVertically,
123  bool16 underlineText,
124  dv_utils::AntiAliasPolicy aa_policy = dv_utils::kAntiAliasPolicy_Med);
125 
126  //========================================================================================
127  // PMMeasureStringDroverized
128  //
129  // Drawbot based utility function to obtain text dimension based on specified font info.
130  //========================================================================================
131  DV_ PMPoint PMMeasureStringDroverized(
132  const PMString & str,
133  const InterfaceFontInfo & fontInfo,
134  bool16 convertAmpersandToUnderline);
135 }
136 
137 
138 #endif