@@ -44,8 +44,8 @@ This file is part of the iText (R) project.
44
44
45
45
import com .itextpdf .html2pdf .ConverterProperties ;
46
46
import com .itextpdf .html2pdf .attach .impl .DefaultTagWorkerFactory ;
47
- import com .itextpdf .html2pdf .attach .impl .OutlineHandler ;
48
47
import com .itextpdf .html2pdf .attach .impl .LinkContext ;
48
+ import com .itextpdf .html2pdf .attach .impl .OutlineHandler ;
49
49
import com .itextpdf .html2pdf .css .apply .ICssApplierFactory ;
50
50
import com .itextpdf .html2pdf .css .apply .impl .DefaultCssApplierFactory ;
51
51
import com .itextpdf .html2pdf .css .resolve .CssContext ;
@@ -58,6 +58,7 @@ This file is part of the iText (R) project.
58
58
import com .itextpdf .layout .font .FontInfo ;
59
59
import com .itextpdf .layout .font .FontProvider ;
60
60
import com .itextpdf .layout .font .FontSet ;
61
+ import com .itextpdf .layout .font .Range ;
61
62
import com .itextpdf .styledxmlparser .css .media .MediaDeviceDescription ;
62
63
import com .itextpdf .styledxmlparser .resolver .resource .ResourceResolver ;
63
64
@@ -66,60 +67,96 @@ This file is part of the iText (R) project.
66
67
*/
67
68
public class ProcessorContext {
68
69
69
- /** The font provider. */
70
+ /**
71
+ * The font provider.
72
+ */
70
73
private FontProvider fontProvider ;
71
74
72
- /** Temporary set of fonts used in the PDF. */
75
+ /**
76
+ * Temporary set of fonts used in the PDF.
77
+ */
73
78
private FontSet tempFonts ;
74
79
75
- /** The resource resolver. */
80
+ /**
81
+ * The resource resolver.
82
+ */
76
83
private ResourceResolver resourceResolver ;
77
84
78
- /** The device description. */
85
+ /**
86
+ * The device description.
87
+ */
79
88
private MediaDeviceDescription deviceDescription ;
80
89
81
- /** The tag worker factory. */
90
+ /**
91
+ * The tag worker factory.
92
+ */
82
93
private ITagWorkerFactory tagWorkerFactory ;
83
94
84
- /** The CSS applier factory. */
95
+ /**
96
+ * The CSS applier factory.
97
+ */
85
98
private ICssApplierFactory cssApplierFactory ;
86
99
87
- /** The base URI. */
100
+ /**
101
+ * The base URI.
102
+ */
88
103
private String baseUri ;
89
104
90
- /** Indicates whether an AcroForm needs to be created. */
105
+ /**
106
+ * Indicates whether an AcroForm needs to be created.
107
+ */
91
108
private boolean createAcroForm ;
92
109
93
- /** The form field name resolver. */
110
+ /**
111
+ * The form field name resolver.
112
+ */
94
113
private FormFieldNameResolver formFieldNameResolver ;
95
114
96
- /** The radio check resolver. */
115
+ /**
116
+ * The radio check resolver.
117
+ */
97
118
private RadioCheckResolver radioCheckResolver ;
98
119
99
- /** The outline handler. */
120
+ /**
121
+ * The outline handler.
122
+ */
100
123
private OutlineHandler outlineHandler ;
101
124
102
- /** Indicates whether the document should be opened in immediate flush or not **/
125
+ /**
126
+ * Indicates whether the document should be opened in immediate flush or not
127
+ **/
103
128
private boolean immediateFlush ;
104
129
105
130
// Variable fields
106
131
107
- /** The state. */
132
+ /**
133
+ * The state.
134
+ */
108
135
private State state ;
109
136
110
- /** The CSS context. */
137
+ /**
138
+ * The CSS context.
139
+ */
111
140
private CssContext cssContext ;
112
141
113
- /** The link context */
142
+ /**
143
+ * The link context
144
+ */
114
145
private LinkContext linkContext ;
115
146
116
- /** The PDF document. */
147
+ /**
148
+ * The PDF document.
149
+ */
117
150
private PdfDocument pdfDocument ;
118
151
119
- /** The Processor meta info */
152
+ /**
153
+ * The Processor meta info
154
+ */
120
155
private IMetaInfo metaInfo ;
121
156
122
- /** Internal state variable to keep track of whether the processor is currently inside an inlineSvg*/
157
+ /**
158
+ * Internal state variable to keep track of whether the processor is currently inside an inlineSvg
159
+ */
123
160
private boolean processingInlineSvg ;
124
161
125
162
/**
@@ -316,25 +353,44 @@ public OutlineHandler getOutlineHandler() {
316
353
* Add temporary font from @font-face.
317
354
*
318
355
* @param fontInfo the font info
319
- * @param alias the alias
356
+ * @param alias the alias
320
357
*/
321
358
public void addTemporaryFont (FontInfo fontInfo , String alias ) {
322
- if (tempFonts == null ) tempFonts = new FontSet ();
359
+ if (tempFonts == null ) {
360
+ tempFonts = new FontSet ();
361
+ }
323
362
tempFonts .addFont (fontInfo , alias );
324
363
}
325
364
326
365
/**
327
366
* Add temporary font from @font-face.
328
367
*
329
368
* @param fontProgram the font program
330
- * @param encoding the encoding
331
- * @param alias the alias
369
+ * @param encoding the encoding
370
+ * @param alias the alias
332
371
*/
333
372
public void addTemporaryFont (FontProgram fontProgram , String encoding , String alias ) {
334
- if (tempFonts == null ) tempFonts = new FontSet ();
373
+ if (tempFonts == null ) {
374
+ tempFonts = new FontSet ();
375
+ }
335
376
tempFonts .addFont (fontProgram , encoding , alias );
336
377
}
337
378
379
+ /**
380
+ * Add temporary font from @font-face.
381
+ *
382
+ * @param fontProgram the font program
383
+ * @param encoding the encoding
384
+ * @param alias the alias
385
+ * @param unicodeRange the unicode range
386
+ */
387
+ public void addTemporaryFont (FontProgram fontProgram , String encoding , String alias , Range unicodeRange ) {
388
+ if (tempFonts == null ) {
389
+ tempFonts = new FontSet ();
390
+ }
391
+ tempFonts .addFont (fontProgram , encoding , alias , unicodeRange );
392
+ }
393
+
338
394
/**
339
395
* Check fonts in font provider and temporary font set.
340
396
*
@@ -379,16 +435,17 @@ public void reset(PdfDocument pdfDocument) {
379
435
*
380
436
* @return the baseUri
381
437
*/
382
- public String getBaseUri (){
438
+ public String getBaseUri () {
383
439
return baseUri ;
384
440
}
385
441
386
442
387
443
/**
388
444
* Checks if immediateFlush is set
445
+ *
389
446
* @return true if immediateFlush is set, false if not.
390
447
*/
391
- public boolean isImmediateFlush (){
448
+ public boolean isImmediateFlush () {
392
449
return immediateFlush ;
393
450
}
394
451
0 commit comments