FontCollection.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/collections/ienumerator.h>
5 #include <system/collections/icollection.h>
6 #include <system/array.h>
7 #include <cstdint>
8 
9 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
10 
11 namespace Aspose
12 {
13 namespace Pdf
14 {
15 namespace Annotations
16 {
17 class Annotation;
18 class FreeTextAnnotation;
19 class RedactionAnnotation;
20 class WidgetAnnotation;
21 } // namespace Annotations
22 class ApsToPdfConverter;
23 namespace Collections
24 {
25 template <typename, typename> class AsposeHashDictionary;
26 } // namespace Collections
27 class Document;
28 namespace Engine
29 {
30 namespace CommonData
31 {
32 namespace PageContent
33 {
34 class IResourceDictionary;
35 } // namespace PageContent
36 namespace Text
37 {
38 namespace Fonts
39 {
40 namespace Utilities
41 {
42 class DocumentCIDType2FontContentUpdater;
43 class FontUtilities;
44 } // namespace Utilities
45 } // namespace Fonts
46 } // namespace Text
47 } // namespace CommonData
48 namespace Data
49 {
50 class IPdfDictionary;
51 class IPdfObject;
52 } // namespace Data
53 namespace IO
54 {
55 namespace ConvertStrategies
56 {
57 namespace ConvertHelpers
58 {
59 class LowLevelFontSubstitutor;
60 } // namespace ConvertHelpers
61 } // namespace ConvertStrategies
62 } // namespace IO
63 } // namespace Engine
64 namespace Facades
65 {
66 class FormEditor;
67 } // namespace Facades
68 namespace Forms
69 {
70 class ButtonField;
71 class C128Barcode;
72 class CheckboxField;
73 class Form;
74 class RadioButtonOptionField;
75 class TextModel;
76 } // namespace Forms
77 namespace PageModel
78 {
79 class TextElement;
80 } // namespace PageModel
81 class Resources;
82 namespace Tests
83 {
84 class RegressionTests_v11_6;
85 class RegressionTests_v19_5;
86 class RegressionTests_v20_06;
87 class RegressionTests_v7_6;
88 } // namespace Tests
89 namespace Text
90 {
91 class Font;
92 class FontAbsorber;
93 class FontCleanup;
94 class FontUsage;
95 } // namespace Text
96 class TextStamp;
97 } // namespace Pdf
98 } // namespace Aspose
99 namespace System
100 {
101 namespace Collections
102 {
103 namespace Generic
104 {
105 template <typename> class List;
106 } // namespace Generic
107 } // namespace Collections
108 } // namespace System
109 
110 namespace Aspose {
111 
112 namespace Pdf {
113 
114 namespace Text {
115 
125 class ASPOSE_PDF_SHARED_CLASS FontCollection final : public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Pdf::Text::Font>>
126 {
127  typedef FontCollection ThisType;
129 
130  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
131  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
132 
133  friend class Aspose::Pdf::ApsToPdfConverter;
134  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::ConvertHelpers::LowLevelFontSubstitutor;
135  friend class Aspose::Pdf::Engine::CommonData::Text::Fonts::Utilities::FontUtilities;
136  friend class Aspose::Pdf::Engine::CommonData::Text::Fonts::Utilities::DocumentCIDType2FontContentUpdater;
139  friend class Aspose::Pdf::PageModel::TextElement;
140  friend class Aspose::Pdf::Text::FontUsage;
141  friend class Aspose::Pdf::Text::FontCleanup;
147  friend class Aspose::Pdf::Forms::C128Barcode;
153  friend class Aspose::Pdf::ApsToPdfConverter;
154  friend class Aspose::Pdf::Forms::TextModel;
155  friend class Aspose::Pdf::Tests::RegressionTests_v7_6;
156  friend class Aspose::Pdf::Tests::RegressionTests_v11_6;
157  friend class Aspose::Pdf::Tests::RegressionTests_v19_5;
158  friend class Aspose::Pdf::Tests::RegressionTests_v20_06;
159 
160 private:
161 
162  class FontsEnumerator : public System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Pdf::Text::Font>>
163  {
164  typedef FontsEnumerator ThisType;
166 
167  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
168  RTTI_INFO_DECL();
169  CODEPORTING_ENUMERATOR_ITERATOR_METHODS_DECLARATION(CODEPORTING_ARGS(System::SharedPtr<Font>), CODEPORTING_NO_API_KEYWORD);
170 
171  public:
172 
173  const System::SharedPtr<Font>& get_Current() const override;
174 
176 
177  bool MoveNext() override;
178  void Reset() override;
179  void Dispose() override;
180 
181  private:
182 
184  int32_t viewed;
185  System::SharedPtr<Document> _licensedDoc;
186 
187  bool MoveNextImplementation();
188  System::SharedPtr<Font>* GetCurrentElementPointer();
189 
190  };
191 
192 
193 public:
194 
198  ASPOSE_PDF_SHARED_API int32_t get_Count() const override;
202  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Object> get_SyncRoot() const;
206  ASPOSE_PDF_SHARED_API bool get_IsSynchronized();
210  ASPOSE_PDF_SHARED_API bool get_IsReadOnly() const override;
211 
216  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Font>>> GetEnumerator() override;
222  //[Obfuscation(Feature = "virtualization", Exclude = false)]
223  ASPOSE_PDF_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<Font>> array, int32_t index) override;
229  ASPOSE_PDF_SHARED_API void Add(System::SharedPtr<Font> newFont, System::String& resName);
230 
236  //[Obfuscation(Feature = "virtualization", Exclude = false)]
237  ASPOSE_PDF_SHARED_API System::SharedPtr<Font> idx_get(int32_t index);
244  ASPOSE_PDF_SHARED_API System::SharedPtr<Font> idx_get(System::String name);
245 
251  ASPOSE_PDF_SHARED_API bool Contains(const System::String& name) const;
257  ASPOSE_PDF_SHARED_API bool Contains(const System::SharedPtr<Font>& item) const override;
263  ASPOSE_PDF_SHARED_API bool Remove(const System::SharedPtr<Font>& item) override;
264 
265 protected:
266 
269  bool get_ResourceMode() const;
270 
275 
276  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(FontCollection, CODEPORTING_ARGS(System::SharedPtr<Document> doc));
277 
282 
283  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(FontCollection, CODEPORTING_ARGS(System::SharedPtr<Aspose::Pdf::Engine::CommonData::PageContent::IResourceDictionary> resourceDictionary));
287  void Delete(int32_t index);
292  void Delete(System::String fontResourceName);
297  void Clear() override;
305  void Init();
318  void Add(System::String resName, System::String baseFontName);
319 
320  virtual ASPOSE_PDF_SHARED_API ~FontCollection();
321 
322 private:
323 
329  bool resourceMode;
330  bool _isInitialized;
331  System::WeakPtr<Document> _licensedDoc;
332 
333  void BuildHash();
338  void Add(const System::SharedPtr<Font>& item) override;
339 
340 };
341 
342 } // namespace Text
343 } // namespace Pdf
344 } // namespace Aspose
345 
346 
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
class ASPOSECPP_SHARED_CLASS List
Definition: ienumerable.h:17
Class representing form object.
Definition: Form.h:172
Definition: Artifact.h:67
Represents a free text annotation that displays text directly on the page. Unlike an ordinary text an...
Definition: FreeTextAnnotation.h:91
Represents an absorber object of fonts. Performs search for fonts and provides access to search resul...
Definition: FontAbsorber.h:31
Class represnets push button field.
Definition: ButtonField.h:73
Class representing widget annotation.
Definition: WidgetAnnotation.h:93
Definition: signed_info.h:13
Class representing page resources.
Definition: Resources.h:257
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Class represents item of RadioButton field.
Definition: RadioButtonOptionField.h:62
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: BaseOperatorCollection.h:47
Definition: AFRelationship.h:4
Subclass of System::SmartPtr which sets itself to weak mode at construction. Please note that this cl...
Definition: TextFragmentState.h:69
Represents textual stamp.
Definition: TextStamp.h:69
Interface of collection of elements. Objects of this class should only be allocated using System::Mak...
Definition: Collection.h:41
List forward declaration.
Definition: Artifact.h:74
Represents font collection.
Definition: FontCollection.h:125
Represents Redact annotation.
Definition: RedactionAnnotation.h:61
Class representing annotation object.
Definition: Annotation.h:303
Class representing checkbox field
Definition: CheckboxField.h:86
Class for editing forms (ading/deleting field etc)
Definition: FormEditor.h:73
Whole PDF file will be submitted.