InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IFontGroup.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Jack Kirstein
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 // See the implementation CTPFontGroup.cpp and refer to the CoolType documentation for more information
24 //
25 //========================================================================================
26 
27 #ifndef __IFontGroup__
28 #define __IFontGroup__
29 
30 #include "GRRefCountedObj.h"
31 #include "InterfacePtr.h"
32 #include "K2Vector.h"
33 #include "BravoForwardDecl.h"
34 
35 
36 class PMString;
37 
42 {
43  public:
49  virtual const PMString& GetGroupName() const = 0;
55  virtual const PMString& GetGroupNameNative() const = 0;
56 
61  virtual int32 GetNumFonts() const = 0;
62 
68  virtual CTFamily *GetCTFamily() const = 0;
69 
76  virtual void GetGroupsWithSameName(K2Vector<int32>& fontGroups) const = 0;
77 
83  virtual PMString GetUniqueFamilyNameEnding() const = 0;
84 
88  virtual int32 GetFontGroupIndex() const = 0;
89 
94  virtual int32 GetDictIndex(int32 index, int32& actualIndexInDict) const = 0;
95 
100  virtual void GetDefaultVariableFontName(PMString& fontName) const = 0;
101 
102 };
103 
104 template <>
106 {
107 public:
108  InterfacePtr(IFontGroup * pFace)
109  // Note: Constructing an InterfacePtr from an existing,
110  // "real" interface pointer implies the InterfacePtr
111  // now owns the reference that was held by the real pointer.
112  : fFace(pFace) {}
113 
114  ~InterfacePtr()
115  {
116  if (fFace != nil){
117  //const_cast<IFontGroup *>(unknown)->Release();
118  fFace->Release();
119  }
120  }
121 
122  operator IFontGroup*() const
123  { return fFace; }
124  // We allow the cast operator to return a nil pointer
125  // since it is valid to test against nil and may be valid
126  // to pass a nil pointer to some methods.
127 
128 
129  IFontGroup * operator ->() const
130  {
131  #ifdef DEBUG
132  ASSERT_MSG(fFace != nil,"About to use nil interface ptr!");
133  #endif
134  return fFace;
135  }
136 
137  // Added forget, get and reset from InterfacePtr
138  IFontGroup* forget()
139  {
140  IFontGroup* result = fFace;
141  fFace = 0;
142  return result;
143  }
144 
145  IFontGroup* get() const
146  {
147  return fFace;
148  }
149 
150  void reset(IFontGroup* p = 0)
151  {
152  if (fFace)
153  fFace->Release();
154  fFace = p;
155  }
156 
157 private:
158  IFontGroup * fFace;
159 
160  // If you feel you need one of these, let me know. Thx. - Zak
161  // For the sake of clarity and simplicity, they're currently not supported.
162 
163  InterfacePtr(void);
164  InterfacePtr(const InterfacePtr<IFontGroup>& IFontGroupPtr);
165  InterfacePtr<IFontGroup>& operator=(const InterfacePtr<IFontGroup>& IFontGroupPtr);
166  InterfacePtr<IFontGroup>& operator=(IFontGroup * pFace);
167 
168 };
169 
170 #endif