@@ -25,12 +25,14 @@ You should have received a copy of the GNU Affero General Public License
2525using iText . Kernel ;
2626using iText . Kernel . Pdf ;
2727using iText . Test ;
28+ using iText . Test . Attributes ;
2829
2930namespace iText . Kernel . Font {
3031 public class PdfType3FontTest : ExtendedITextTest {
3132 private const float EPS = 1e-4f ;
3233
3334 [ NUnit . Framework . Test ]
35+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
3436 public virtual void AddDifferentGlyphsInConstructorTest ( ) {
3537 PdfDictionary dictionary = new PdfDictionary ( ) ;
3638 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
@@ -41,7 +43,7 @@ public virtual void AddDifferentGlyphsInConstructorTest() {
4143 dictionary . Put ( PdfName . Widths , new PdfArray ( ) ) ;
4244 dictionary . Put ( PdfName . ToUnicode , PdfName . IdentityH ) ;
4345 dictionary . Put ( PdfName . Encoding , new PdfName ( "zapfdingbatsencoding" ) ) ;
44- PdfType3Font type3Font = new _PdfType3Font_58 ( dictionary ) ;
46+ PdfType3Font type3Font = new _PdfType3Font_64 ( dictionary ) ;
4547 NUnit . Framework . Assert . IsNotNull ( type3Font . GetFontProgram ( ) ) ;
4648 int spaceGlyphCode = 32 ;
4749 Glyph glyph = type3Font . GetFontProgram ( ) . GetGlyph ( spaceGlyphCode ) ;
@@ -51,8 +53,8 @@ public virtual void AddDifferentGlyphsInConstructorTest() {
5153 NUnit . Framework . Assert . AreEqual ( new Glyph ( AGlyphCode , 0 , new char [ ] { 'A' } ) , glyph ) ;
5254 }
5355
54- private sealed class _PdfType3Font_58 : PdfType3Font {
55- public _PdfType3Font_58 ( PdfDictionary baseArg1 )
56+ private sealed class _PdfType3Font_64 : PdfType3Font {
57+ public _PdfType3Font_64 ( PdfDictionary baseArg1 )
5658 : base ( baseArg1 ) {
5759 }
5860
@@ -62,14 +64,15 @@ protected internal override PdfDocument GetDocument() {
6264 }
6365
6466 [ NUnit . Framework . Test ]
67+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
6568 public virtual void AddAlreadyExistingGlyphTest ( ) {
6669 PdfDictionary dictionary = new PdfDictionary ( ) ;
6770 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
6871 PdfDictionary charProcs = new PdfDictionary ( ) ;
6972 charProcs . Put ( new PdfName ( "A" ) , new PdfStream ( ) ) ;
7073 dictionary . Put ( PdfName . CharProcs , charProcs ) ;
7174 dictionary . Put ( PdfName . Widths , new PdfArray ( ) ) ;
72- PdfType3Font type3Font = new _PdfType3Font_82 ( dictionary ) ;
75+ PdfType3Font type3Font = new _PdfType3Font_89 ( dictionary ) ;
7376 Type3Glyph type3Glyph = type3Font . AddGlyph ( 'A' , 1 , 2 , 3 , 5 , 8 ) ;
7477 NUnit . Framework . Assert . AreEqual ( 0 , type3Glyph . GetWx ( ) , EPS ) ;
7578 NUnit . Framework . Assert . AreEqual ( 0 , type3Glyph . GetLlx ( ) , EPS ) ;
@@ -78,8 +81,8 @@ public virtual void AddAlreadyExistingGlyphTest() {
7881 NUnit . Framework . Assert . AreEqual ( 0 , type3Glyph . GetUry ( ) , EPS ) ;
7982 }
8083
81- private sealed class _PdfType3Font_82 : PdfType3Font {
82- public _PdfType3Font_82 ( PdfDictionary baseArg1 )
84+ private sealed class _PdfType3Font_89 : PdfType3Font {
85+ public _PdfType3Font_89 ( PdfDictionary baseArg1 )
8386 : base ( baseArg1 ) {
8487 }
8588
@@ -89,6 +92,7 @@ protected internal override PdfDocument GetDocument() {
8992 }
9093
9194 [ NUnit . Framework . Test ]
95+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
9296 public virtual void SetFontStretchTest ( ) {
9397 PdfDictionary dictionary = new PdfDictionary ( ) ;
9498 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
@@ -104,6 +108,7 @@ public virtual void SetFontStretchTest() {
104108 }
105109
106110 [ NUnit . Framework . Test ]
111+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
107112 public virtual void SetPdfFontFlagsTest ( ) {
108113 PdfDictionary dictionary = new PdfDictionary ( ) ;
109114 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
@@ -118,6 +123,7 @@ public virtual void SetPdfFontFlagsTest() {
118123 }
119124
120125 [ NUnit . Framework . Test ]
126+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
121127 public virtual void GlyphWithUnicodeBiggerThan32CannotBeEncodedTest ( ) {
122128 PdfDictionary dictionary = new PdfDictionary ( ) ;
123129 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
@@ -130,13 +136,14 @@ public virtual void GlyphWithUnicodeBiggerThan32CannotBeEncodedTest() {
130136 }
131137
132138 [ NUnit . Framework . Test ]
139+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
133140 public virtual void ContainsGlyphTest ( ) {
134141 PdfDictionary dictionary = new PdfDictionary ( ) ;
135142 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
136143 PdfDictionary charProcs = new PdfDictionary ( ) ;
137144 dictionary . Put ( PdfName . CharProcs , charProcs ) ;
138145 dictionary . Put ( PdfName . Widths , new PdfArray ( ) ) ;
139- PdfType3Font type3Font = new _PdfType3Font_148 ( dictionary ) ;
146+ PdfType3Font type3Font = new _PdfType3Font_159 ( dictionary ) ;
140147 NUnit . Framework . Assert . IsFalse ( type3Font . ContainsGlyph ( 333 ) ) ;
141148 NUnit . Framework . Assert . IsFalse ( type3Font . ContainsGlyph ( - 5 ) ) ;
142149 NUnit . Framework . Assert . IsFalse ( type3Font . ContainsGlyph ( 32 ) ) ;
@@ -146,8 +153,8 @@ public virtual void ContainsGlyphTest() {
146153 NUnit . Framework . Assert . IsTrue ( type3Font . ContainsGlyph ( 65 ) ) ;
147154 }
148155
149- private sealed class _PdfType3Font_148 : PdfType3Font {
150- public _PdfType3Font_148 ( PdfDictionary baseArg1 )
156+ private sealed class _PdfType3Font_159 : PdfType3Font {
157+ public _PdfType3Font_159 ( PdfDictionary baseArg1 )
151158 : base ( baseArg1 ) {
152159 }
153160
@@ -157,6 +164,7 @@ protected internal override PdfDocument GetDocument() {
157164 }
158165
159166 [ NUnit . Framework . Test ]
167+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
160168 public virtual void FlushExceptionTest ( ) {
161169 NUnit . Framework . Assert . That ( ( ) => {
162170 PdfDictionary dictionary = new PdfDictionary ( ) ;
@@ -173,6 +181,7 @@ public virtual void FlushExceptionTest() {
173181 }
174182
175183 [ NUnit . Framework . Test ]
184+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
176185 public virtual void FillFontDescriptorTest ( ) {
177186 PdfDictionary dictionary = new PdfDictionary ( ) ;
178187 dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
@@ -183,14 +192,14 @@ public virtual void FillFontDescriptorTest() {
183192 String fontStretch = "test" ;
184193 fontDescriptor . Put ( PdfName . FontStretch , new PdfName ( fontStretch ) ) ;
185194 dictionary . Put ( PdfName . FontDescriptor , fontDescriptor ) ;
186- PdfType3Font type3Font = new _PdfType3Font_189 ( dictionary ) ;
195+ PdfType3Font type3Font = new _PdfType3Font_202 ( dictionary ) ;
187196 NUnit . Framework . Assert . IsNotNull ( type3Font . fontProgram ) ;
188197 NUnit . Framework . Assert . IsNotNull ( type3Font . fontProgram . GetFontNames ( ) ) ;
189198 NUnit . Framework . Assert . AreEqual ( fontStretch , type3Font . fontProgram . GetFontNames ( ) . GetFontStretch ( ) ) ;
190199 }
191200
192- private sealed class _PdfType3Font_189 : PdfType3Font {
193- public _PdfType3Font_189 ( PdfDictionary baseArg1 )
201+ private sealed class _PdfType3Font_202 : PdfType3Font {
202+ public _PdfType3Font_202 ( PdfDictionary baseArg1 )
194203 : base ( baseArg1 ) {
195204 }
196205
@@ -199,6 +208,54 @@ protected internal override PdfDocument GetDocument() {
199208 }
200209 }
201210
211+ [ NUnit . Framework . Test ]
212+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
213+ public virtual void NoCharProcsTest ( ) {
214+ PdfDictionary dictionary = new PdfDictionary ( ) ;
215+ dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
216+ dictionary . Put ( PdfName . Widths , new PdfArray ( ) ) ;
217+ NUnit . Framework . Assert . DoesNotThrow ( ( ) => new PdfType3Font ( dictionary ) ) ;
218+ }
219+
220+ [ NUnit . Framework . Test ]
221+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
222+ public virtual void NoEncodingTest ( ) {
223+ PdfDictionary dictionary = new PdfDictionary ( ) ;
224+ dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
225+ PdfDictionary charProcs = new PdfDictionary ( ) ;
226+ dictionary . Put ( PdfName . CharProcs , charProcs ) ;
227+ dictionary . Put ( PdfName . Widths , new PdfArray ( ) ) ;
228+ NUnit . Framework . Assert . DoesNotThrow ( ( ) => new PdfType3Font ( dictionary ) ) ;
229+ }
230+
231+ [ NUnit . Framework . Test ]
232+ [ LogMessage ( iText . IO . LogMessageConstant . TYPE3_FONT_INITIALIZATION_ISSUE ) ]
233+ public virtual void NoDifferenceTest ( ) {
234+ PdfDictionary dictionary = new PdfDictionary ( ) ;
235+ dictionary . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
236+ PdfDictionary charProcs = new PdfDictionary ( ) ;
237+ dictionary . Put ( PdfName . CharProcs , charProcs ) ;
238+ dictionary . Put ( PdfName . Widths , new PdfArray ( ) ) ;
239+ PdfDictionary encoding = new PdfDictionary ( ) ;
240+ dictionary . Put ( PdfName . Encoding , encoding ) ;
241+ NUnit . Framework . Assert . DoesNotThrow ( ( ) => new PdfType3Font ( dictionary ) ) ;
242+ }
243+
244+ [ NUnit . Framework . Test ]
245+ public virtual void NoCharProcGlyphForDifferenceTest ( ) {
246+ PdfDictionary font = new PdfDictionary ( ) ;
247+ font . Put ( PdfName . FontMatrix , new PdfArray ( ) ) ;
248+ font . Put ( PdfName . Widths , new PdfArray ( ) ) ;
249+ font . Put ( PdfName . CharProcs , new PdfDictionary ( ) ) ;
250+ PdfDictionary encoding = new PdfDictionary ( ) ;
251+ PdfArray differences = new PdfArray ( ) ;
252+ differences . Add ( 0 , new PdfNumber ( 65 ) ) ;
253+ differences . Add ( 1 , new PdfName ( "A" ) ) ;
254+ encoding . Put ( PdfName . Differences , differences ) ;
255+ font . Put ( PdfName . Encoding , encoding ) ;
256+ NUnit . Framework . Assert . DoesNotThrow ( ( ) => new PdfType3Font ( font ) ) ;
257+ }
258+
202259 private class DisableEnsureUnderlyingObjectHasIndirectReference : PdfType3Font {
203260 internal DisableEnsureUnderlyingObjectHasIndirectReference ( PdfType3FontTest _enclosing , PdfDictionary fontDictionary
204261 )
0 commit comments