FontFactoryImp.java

1
/*
2
 * $Id: FontFactoryImp.java 4063 2009-09-13 19:02:46Z psoares33 $
3
 *
4
 * Copyright 2002 by Bruno Lowagie.
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * (the "License"); you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the License.
13
 *
14
 * The Original Code is 'iText, a free JAVA-PDF library'.
15
 *
16
 * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
17
 * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
18
 * All Rights Reserved.
19
 * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
20
 * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
21
 *
22
 * Contributor(s): all the names of the contributors are added in the source code
23
 * where applicable.
24
 *
25
 * Alternatively, the contents of this file may be used under the terms of the
26
 * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
27
 * provisions of LGPL are applicable instead of those above.  If you wish to
28
 * allow use of your version of this file only under the terms of the LGPL
29
 * License and not to allow others to use your version of this file under
30
 * the MPL, indicate your decision by deleting the provisions above and
31
 * replace them with the notice and other provisions required by the LGPL.
32
 * If you do not delete the provisions above, a recipient may use your version
33
 * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
34
 *
35
 * This library is free software; you can redistribute it and/or modify it
36
 * under the terms of the MPL as stated above or under the terms of the GNU
37
 * Library General Public License as published by the Free Software Foundation;
38
 * either version 2 of the License, or any later version.
39
 *
40
 * This library is distributed in the hope that it will be useful, but WITHOUT
41
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
42
 * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
43
 * details.
44
 *
45
 * If you didn't download this code from the following link, you should check if
46
 * you aren't using an obsolete version:
47
 * http://www.lowagie.com/iText/
48
 */
49
50
package com.lowagie.text;
51
52
import java.awt.Color;
53
import java.io.File;
54
import java.io.IOException;
55
import java.util.ArrayList;
56
import java.util.Enumeration;
57
import java.util.Hashtable;
58
import java.util.Locale;
59
import java.util.Properties;
60
import java.util.Set;
61
62
import com.lowagie.text.ExceptionConverter;
63
import com.lowagie.text.html.Markup;
64
import com.lowagie.text.pdf.BaseFont;
65
66
67
/**
68
 * If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files
69
 * to this class first and then create fonts in your code using one of the getFont method
70
 * without having to enter a path as parameter.
71
 *
72
 * @author  Bruno Lowagie
73
 */
74
75
public class FontFactoryImp implements FontProvider {
76
        
77
/** This is a map of postscriptfontnames of True Type fonts and the path of their ttf- or ttc-file. */
78
    private Properties trueTypeFonts = new Properties();
79
    
80
    private static String[] TTFamilyOrder = {
81
        "3", "1", "1033",
82
        "3", "0", "1033",
83
        "1", "0", "0",
84
        "0", "3", "0"
85
    };
86
87
/** This is a map of fontfamilies. */
88
    private Hashtable fontFamilies = new Hashtable();
89
    
90
/** This is the default encoding to use. */
91
    public String defaultEncoding = BaseFont.WINANSI;
92
    
93
/** This is the default value of the <VAR>embedded</VAR> variable. */
94
    public boolean defaultEmbedding = BaseFont.NOT_EMBEDDED;
95
    
96
/** Creates new FontFactory */
97
    public FontFactoryImp() {
98
        trueTypeFonts.setProperty(FontFactory.COURIER.toLowerCase(Locale.ROOT), FontFactory.COURIER);
99
        trueTypeFonts.setProperty(FontFactory.COURIER_BOLD.toLowerCase(Locale.ROOT), FontFactory.COURIER_BOLD);
100
        trueTypeFonts.setProperty(FontFactory.COURIER_OBLIQUE.toLowerCase(Locale.ROOT), FontFactory.COURIER_OBLIQUE);
101
        trueTypeFonts.setProperty(FontFactory.COURIER_BOLDOBLIQUE.toLowerCase(Locale.ROOT), FontFactory.COURIER_BOLDOBLIQUE);
102
        trueTypeFonts.setProperty(FontFactory.HELVETICA.toLowerCase(Locale.ROOT), FontFactory.HELVETICA);
103
        trueTypeFonts.setProperty(FontFactory.HELVETICA_BOLD.toLowerCase(Locale.ROOT), FontFactory.HELVETICA_BOLD);
104
        trueTypeFonts.setProperty(FontFactory.HELVETICA_OBLIQUE.toLowerCase(Locale.ROOT), FontFactory.HELVETICA_OBLIQUE);
105
        trueTypeFonts.setProperty(FontFactory.HELVETICA_BOLDOBLIQUE.toLowerCase(Locale.ROOT), FontFactory.HELVETICA_BOLDOBLIQUE);
106
        trueTypeFonts.setProperty(FontFactory.SYMBOL.toLowerCase(Locale.ROOT), FontFactory.SYMBOL);
107
        trueTypeFonts.setProperty(FontFactory.TIMES_ROMAN.toLowerCase(Locale.ROOT), FontFactory.TIMES_ROMAN);
108
        trueTypeFonts.setProperty(FontFactory.TIMES_BOLD.toLowerCase(Locale.ROOT), FontFactory.TIMES_BOLD);
109
        trueTypeFonts.setProperty(FontFactory.TIMES_ITALIC.toLowerCase(Locale.ROOT), FontFactory.TIMES_ITALIC);
110
        trueTypeFonts.setProperty(FontFactory.TIMES_BOLDITALIC.toLowerCase(Locale.ROOT), FontFactory.TIMES_BOLDITALIC);
111
        trueTypeFonts.setProperty(FontFactory.ZAPFDINGBATS.toLowerCase(Locale.ROOT), FontFactory.ZAPFDINGBATS);
112
113
        ArrayList tmp;
114
        tmp = new ArrayList();
115
        tmp.add(FontFactory.COURIER);
116
        tmp.add(FontFactory.COURIER_BOLD);
117
        tmp.add(FontFactory.COURIER_OBLIQUE);
118
        tmp.add(FontFactory.COURIER_BOLDOBLIQUE);
119
        fontFamilies.put(FontFactory.COURIER.toLowerCase(Locale.ROOT), tmp);
120
        tmp = new ArrayList();
121
        tmp.add(FontFactory.HELVETICA);
122
        tmp.add(FontFactory.HELVETICA_BOLD);
123
        tmp.add(FontFactory.HELVETICA_OBLIQUE);
124
        tmp.add(FontFactory.HELVETICA_BOLDOBLIQUE);
125
        fontFamilies.put(FontFactory.HELVETICA.toLowerCase(Locale.ROOT), tmp);
126
        tmp = new ArrayList();
127
        tmp.add(FontFactory.SYMBOL);
128
        fontFamilies.put(FontFactory.SYMBOL.toLowerCase(Locale.ROOT), tmp);
129
        tmp = new ArrayList();
130
        tmp.add(FontFactory.TIMES_ROMAN);
131
        tmp.add(FontFactory.TIMES_BOLD);
132
        tmp.add(FontFactory.TIMES_ITALIC);
133
        tmp.add(FontFactory.TIMES_BOLDITALIC);
134
        fontFamilies.put(FontFactory.TIMES.toLowerCase(Locale.ROOT), tmp);
135
        fontFamilies.put(FontFactory.TIMES_ROMAN.toLowerCase(Locale.ROOT), tmp);
136
        tmp = new ArrayList();
137
        tmp.add(FontFactory.ZAPFDINGBATS);
138
        fontFamilies.put(FontFactory.ZAPFDINGBATS.toLowerCase(Locale.ROOT), tmp);
139
    }
140
    
141
    /**
142
     * Constructs a <CODE>Font</CODE>-object.
143
     *
144
     * @param    fontname    the name of the font
145
     * @param    encoding    the encoding of the font
146
     * @param       embedded    true if the font is to be embedded in the PDF
147
     * @param    size        the size of this font
148
     * @param    style        the style of this font
149
     * @param    color        the <CODE>Color</CODE> of this font.
150
     * @return the Font constructed based on the parameters
151
     */
152
    public Font getFont(String fontname, String encoding, boolean embedded, float size, int style, Color color) {
153 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, embedded, size, style, color, true);
154
    }
155
    
156
    
157
    
158
    /**
159
     * Constructs a <CODE>Font</CODE>-object.
160
     *
161
     * @param    fontname    the name of the font
162
     * @param    encoding    the encoding of the font
163
     * @param       embedded    true if the font is to be embedded in the PDF
164
     * @param    size        the size of this font
165
     * @param    style        the style of this font
166
     * @param    color        the <CODE>Color</CODE> of this font.
167
     * @param    cached         true if the font comes from the cache or is added to
168
     *                 the cache if new, false if the font is always created new
169
     * @return the Font constructed based on the parameters
170
     */
171
    public Font getFont(String fontname, String encoding, boolean embedded, float size, int style, Color color, boolean cached) {
172 2 1. getFont : negated conditional → NO_COVERAGE
2. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        if (fontname == null) return new Font(Font.UNDEFINED, size, style, color);
173
        String lowercasefontname = fontname.toLowerCase(Locale.ROOT);
174
        ArrayList tmp = (ArrayList) fontFamilies.get(lowercasefontname);
175 1 1. getFont : negated conditional → NO_COVERAGE
        if (tmp != null) {
176
            // some bugs were fixed here by Daniel Marczisovszky
177 1 1. getFont : negated conditional → NO_COVERAGE
            int s = style == Font.UNDEFINED ? Font.NORMAL : style;
178
            for (Object o : tmp) {
179
                String f = (String) o;
180
                String lcf = f.toLowerCase(Locale.ROOT);
181
                int fs = Font.NORMAL;
182 2 1. getFont : Replaced bitwise OR with AND → NO_COVERAGE
2. getFont : negated conditional → NO_COVERAGE
                if (lcf.contains("bold")) fs |= Font.BOLD;
183 3 1. getFont : Replaced bitwise OR with AND → NO_COVERAGE
2. getFont : negated conditional → NO_COVERAGE
3. getFont : negated conditional → NO_COVERAGE
                if (lcf.contains("italic") || lcf.contains("oblique")) fs |= Font.ITALIC;
184 2 1. getFont : Replaced bitwise AND with OR → NO_COVERAGE
2. getFont : negated conditional → NO_COVERAGE
                if ((s & Font.BOLDITALIC) == fs) {
185
                    fontname = f;
186
                    break;
187
                }
188
            }
189
        }
190
        BaseFont basefont = null;
191
        try {
192
            try {
193
                // the font is a type 1 font or CJK font
194
                basefont = BaseFont.createFont(fontname, encoding, embedded, cached, null, null, true);
195
            }
196
            catch(DocumentException de) {
197
            }
198 1 1. getFont : negated conditional → NO_COVERAGE
            if (basefont == null) {
199
                // the font is a true type font or an unknown font
200
                fontname = trueTypeFonts.getProperty(lowercasefontname);
201
                // the font is not registered as truetype font
202 2 1. getFont : negated conditional → NO_COVERAGE
2. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                if (fontname == null) return new Font(Font.UNDEFINED, size, style, color);
203
                // the font is registered as truetype font
204
                basefont = BaseFont.createFont(fontname, encoding, embedded, cached, null, null);
205
            }
206
        }
207
        catch(DocumentException de) {
208
            // this shouldn't happen
209
            throw new ExceptionConverter(de);
210
        }
211
        catch(IOException ioe) {
212
            // the font is registered as a true type font, but the path was wrong
213 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new Font(Font.UNDEFINED, size, style, color);
214
        }
215
        catch(NullPointerException npe) {
216
        // null was entered as fontname and/or encoding
217 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new Font(Font.UNDEFINED, size, style, color);
218
        }
219 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new Font(basefont, size, style, color);
220
    }
221
    
222
    
223
/**
224
 * Constructs a <CODE>Font</CODE>-object.
225
 *
226
 * @param   attributes  the attributes of a <CODE>Font</CODE> object.
227
 * @return the Font constructed based on the attributes
228
 */
229
    
230
    public Font getFont(Properties attributes) {
231
        String fontname = null;
232
        String encoding = defaultEncoding;
233
        boolean embedded = defaultEmbedding;
234
        float size = Font.UNDEFINED;
235
        int style = Font.NORMAL;
236
        Color color = null;
237
        String value = attributes.getProperty(Markup.HTML_ATTR_STYLE);
238 3 1. getFont : changed conditional boundary → NO_COVERAGE
2. getFont : negated conditional → NO_COVERAGE
3. getFont : negated conditional → NO_COVERAGE
        if (value != null && value.length() > 0) {
239
            Properties styleAttributes = Markup.parseAttributes(value);
240 1 1. getFont : negated conditional → NO_COVERAGE
            if (styleAttributes.isEmpty()) {
241
                attributes.put(Markup.HTML_ATTR_STYLE, value);
242
            }
243
            else {
244
                fontname = styleAttributes.getProperty(Markup.CSS_KEY_FONTFAMILY);
245 1 1. getFont : negated conditional → NO_COVERAGE
                if (fontname != null) {
246
                    String tmp;
247 1 1. getFont : negated conditional → NO_COVERAGE
                    while (fontname.indexOf(',') != -1) {
248
                        tmp = fontname.substring(0, fontname.indexOf(','));
249 1 1. getFont : negated conditional → NO_COVERAGE
                        if (isRegistered(tmp)) {
250
                            fontname = tmp;
251
                        }
252
                        else {
253 1 1. getFont : Replaced integer addition with subtraction → NO_COVERAGE
                            fontname = fontname.substring(fontname.indexOf(',') + 1);
254
                        }
255
                    }
256
                }
257 1 1. getFont : negated conditional → NO_COVERAGE
                if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTSIZE)) != null) {
258
                    size = Markup.parseLength(value);
259
                }
260 1 1. getFont : negated conditional → NO_COVERAGE
                if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTWEIGHT)) != null) {
261 1 1. getFont : Replaced bitwise OR with AND → NO_COVERAGE
                    style |= Font.getStyleValue(value);
262
                }
263 1 1. getFont : negated conditional → NO_COVERAGE
                if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTSTYLE)) != null) {
264 1 1. getFont : Replaced bitwise OR with AND → NO_COVERAGE
                    style |= Font.getStyleValue(value);
265
                }
266 1 1. getFont : negated conditional → NO_COVERAGE
                if ((value = styleAttributes.getProperty(Markup.CSS_KEY_COLOR)) != null) {
267
                    color = Markup.decodeColor(value);
268
                }
269 1 1. getFont : removed call to java/util/Properties::putAll → NO_COVERAGE
                attributes.putAll(styleAttributes);
270 1 1. getFont : negated conditional → NO_COVERAGE
                for (Enumeration e = styleAttributes.keys(); e.hasMoreElements();) {
271
                    Object o = e.nextElement();
272
                    attributes.put(o, styleAttributes.get(o));
273
                }
274
            }
275
        }
276 1 1. getFont : negated conditional → NO_COVERAGE
        if ((value = attributes.getProperty(ElementTags.ENCODING)) != null) {
277
            encoding = value;
278
        }
279 1 1. getFont : negated conditional → NO_COVERAGE
        if ("true".equals(attributes.getProperty(ElementTags.EMBEDDED))) {
280
            embedded = true;
281
        }
282 1 1. getFont : negated conditional → NO_COVERAGE
        if ((value = attributes.getProperty(ElementTags.FONT)) != null) {
283
            fontname = value;
284
        }
285 1 1. getFont : negated conditional → NO_COVERAGE
        if ((value = attributes.getProperty(ElementTags.SIZE)) != null) {
286
            size = Markup.parseLength(value);
287
        }
288 1 1. getFont : negated conditional → NO_COVERAGE
        if ((value = attributes.getProperty(Markup.HTML_ATTR_STYLE)) != null) {
289 1 1. getFont : Replaced bitwise OR with AND → NO_COVERAGE
            style |= Font.getStyleValue(value);
290
        }
291 1 1. getFont : negated conditional → NO_COVERAGE
        if ((value = attributes.getProperty(ElementTags.STYLE)) != null) {
292 1 1. getFont : Replaced bitwise OR with AND → NO_COVERAGE
            style |= Font.getStyleValue(value);
293
        }
294
        String r = attributes.getProperty(ElementTags.RED);
295
        String g = attributes.getProperty(ElementTags.GREEN);
296
        String b = attributes.getProperty(ElementTags.BLUE);
297 3 1. getFont : negated conditional → NO_COVERAGE
2. getFont : negated conditional → NO_COVERAGE
3. getFont : negated conditional → NO_COVERAGE
        if (r != null || g != null || b != null) {
298
            int red = 0;
299
            int green = 0;
300
            int blue = 0;
301 1 1. getFont : negated conditional → NO_COVERAGE
            if (r != null) red = Integer.parseInt(r);
302 1 1. getFont : negated conditional → NO_COVERAGE
            if (g != null) green = Integer.parseInt(g);
303 1 1. getFont : negated conditional → NO_COVERAGE
            if (b != null) blue = Integer.parseInt(b);
304
            color = new Color(red, green, blue);
305
        }
306 1 1. getFont : negated conditional → NO_COVERAGE
        else if ((value = attributes.getProperty(ElementTags.COLOR)) != null) {
307
            color = Markup.decodeColor(value);
308
        }
309 1 1. getFont : negated conditional → NO_COVERAGE
        if (fontname == null) {
310 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return getFont(null, encoding, embedded, size, style, color);
311
        }
312 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, embedded, size, style, color);
313
    }
314
    
315
/**
316
 * Constructs a <CODE>Font</CODE>-object.
317
 *
318
 * @param    fontname    the name of the font
319
 * @param    encoding    the encoding of the font
320
 * @param       embedded    true if the font is to be embedded in the PDF
321
 * @param    size        the size of this font
322
 * @param    style        the style of this font
323
 * @return the Font constructed based on the parameters
324
 */
325
    
326
    public Font getFont(String fontname, String encoding, boolean embedded, float size, int style) {
327 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, embedded, size, style, null);
328
    }
329
    
330
/**
331
 * Constructs a <CODE>Font</CODE>-object.
332
 *
333
 * @param    fontname    the name of the font
334
 * @param    encoding    the encoding of the font
335
 * @param       embedded    true if the font is to be embedded in the PDF
336
 * @param    size        the size of this font
337
 * @return the Font constructed based on the parameters
338
 */
339
    
340
    public Font getFont(String fontname, String encoding, boolean embedded, float size) {
341 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, embedded, size, Font.UNDEFINED, null);
342
    }
343
    
344
/**
345
 * Constructs a <CODE>Font</CODE>-object.
346
 *
347
 * @param    fontname    the name of the font
348
 * @param    encoding    the encoding of the font
349
 * @param       embedded    true if the font is to be embedded in the PDF
350
 * @return the Font constructed based on the parameters
351
 */
352
    
353
    public Font getFont(String fontname, String encoding, boolean embedded) {
354 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, embedded, Font.UNDEFINED, Font.UNDEFINED, null);
355
    }
356
    
357
/**
358
 * Constructs a <CODE>Font</CODE>-object.
359
 *
360
 * @param    fontname    the name of the font
361
 * @param    encoding    the encoding of the font
362
 * @param    size        the size of this font
363
 * @param    style        the style of this font
364
 * @param    color        the <CODE>Color</CODE> of this font.
365
 * @return the Font constructed based on the parameters
366
 */
367
    
368
    public Font getFont(String fontname, String encoding, float size, int style, Color color) {
369 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, defaultEmbedding, size, style, color);
370
    }
371
    
372
/**
373
 * Constructs a <CODE>Font</CODE>-object.
374
 *
375
 * @param    fontname    the name of the font
376
 * @param    encoding    the encoding of the font
377
 * @param    size        the size of this font
378
 * @param    style        the style of this font
379
 * @return the Font constructed based on the parameters
380
 */
381
    
382
    public Font getFont(String fontname, String encoding, float size, int style) {
383 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, defaultEmbedding, size, style, null);
384
    }
385
    
386
/**
387
 * Constructs a <CODE>Font</CODE>-object.
388
 *
389
 * @param    fontname    the name of the font
390
 * @param    encoding    the encoding of the font
391
 * @param    size        the size of this font
392
 * @return the Font constructed based on the parameters
393
 */
394
    
395
    public Font getFont(String fontname, String encoding, float size) {
396 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, defaultEmbedding, size, Font.UNDEFINED, null);
397
    }
398
    
399
400
/**
401
 * Constructs a <CODE>Font</CODE>-object.
402
 *
403
 * @param    fontname    the name of the font
404
 * @param    size        the size of this font
405
 * @param    color        the <CODE>Color</CODE> of this font.
406
 * @return the Font constructed based on the parameters
407
 * @since 2.1.0
408
 */
409
    
410
    public Font getFont(String fontname, float size, Color color) {
411 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, defaultEncoding, defaultEmbedding, size, Font.UNDEFINED, color);
412
    }
413
    
414
/**
415
 * Constructs a <CODE>Font</CODE>-object.
416
 *
417
 * @param    fontname    the name of the font
418
 * @param    encoding    the encoding of the font
419
 * @return the Font constructed based on the parameters
420
 */
421
    
422
    public Font getFont(String fontname, String encoding) {
423 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, encoding, defaultEmbedding, Font.UNDEFINED, Font.UNDEFINED, null);
424
    }
425
    
426
/**
427
 * Constructs a <CODE>Font</CODE>-object.
428
 *
429
 * @param    fontname    the name of the font
430
 * @param    size        the size of this font
431
 * @param    style        the style of this font
432
 * @param    color        the <CODE>Color</CODE> of this font.
433
 * @return the Font constructed based on the parameters
434
 */
435
    
436
    public Font getFont(String fontname, float size, int style, Color color) {
437 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, defaultEncoding, defaultEmbedding, size, style, color);
438
    }
439
    
440
/**
441
 * Constructs a <CODE>Font</CODE>-object.
442
 *
443
 * @param    fontname    the name of the font
444
 * @param    size        the size of this font
445
 * @param    style        the style of this font
446
 * @return the Font constructed based on the parameters
447
 */
448
    
449
    public Font getFont(String fontname, float size, int style) {
450 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, defaultEncoding, defaultEmbedding, size, style, null);
451
    }
452
    
453
/**
454
 * Constructs a <CODE>Font</CODE>-object.
455
 *
456
 * @param    fontname    the name of the font
457
 * @param    size        the size of this font
458
 * @return the Font constructed based on the parameters
459
 */
460
    
461
    public Font getFont(String fontname, float size) {
462 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, defaultEncoding, defaultEmbedding, size, Font.UNDEFINED, null);
463
    }
464
    
465
/**
466
 * Constructs a <CODE>Font</CODE>-object.
467
 *
468
 * @param    fontname    the name of the font
469
 * @return the Font constructed based on the parameters
470
 */
471
    
472
    public Font getFont(String fontname) {
473 1 1. getFont : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getFont(fontname, defaultEncoding, defaultEmbedding, Font.UNDEFINED, Font.UNDEFINED, null);
474
    }
475
    
476
    /**
477
     * Register a font by giving explicitly the font family and name.
478
     * @param familyName the font family
479
     * @param fullName the font name
480
     * @param path the font path
481
     */
482
    public void registerFamily(String familyName, String fullName, String path) {
483 1 1. registerFamily : negated conditional → NO_COVERAGE
        if (path != null)
484
            trueTypeFonts.setProperty(fullName, path);
485
        ArrayList tmp = (ArrayList) fontFamilies.get(familyName);
486 1 1. registerFamily : negated conditional → NO_COVERAGE
        if (tmp == null) {
487
            tmp = new ArrayList();
488
            tmp.add(fullName);
489
            fontFamilies.put(familyName, tmp);
490
        }
491
        else {
492
            int fullNameLength = fullName.length();
493
            boolean inserted = false;
494 3 1. registerFamily : changed conditional boundary → NO_COVERAGE
2. registerFamily : Changed increment from 1 to -1 → NO_COVERAGE
3. registerFamily : negated conditional → NO_COVERAGE
            for (int j = 0; j < tmp.size(); ++j) {
495 2 1. registerFamily : changed conditional boundary → NO_COVERAGE
2. registerFamily : negated conditional → NO_COVERAGE
                if (((String)tmp.get(j)).length() >= fullNameLength) {
496 1 1. registerFamily : removed call to java/util/ArrayList::add → NO_COVERAGE
                    tmp.add(j, fullName);
497
                    inserted = true;
498
                    break;
499
                }
500
            }
501 1 1. registerFamily : negated conditional → NO_COVERAGE
            if (!inserted)
502
                tmp.add(fullName);
503
        }
504
    }
505
    
506
/**
507
 * Register a ttf- or a ttc-file.
508
 *
509
 * @param   path    the path to a ttf- or ttc-file
510
 */
511
    
512
    public void register(String path) {
513 1 1. register : removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE
        register(path, null);
514
    }
515
    
516
/**
517
 * Register a font file and use an alias for the font contained in it.
518
 *
519
 * @param   path    the path to a font file
520
 * @param   alias   the alias you want to use for the font
521
 */
522
    
523
    public void register(String path, String alias) {
524
        try {
525 4 1. register : changed conditional boundary → NO_COVERAGE
2. register : negated conditional → NO_COVERAGE
3. register : negated conditional → NO_COVERAGE
4. register : negated conditional → NO_COVERAGE
            if (path.toLowerCase().endsWith(".ttf") || path.toLowerCase().endsWith(".otf") || path.toLowerCase().indexOf(".ttc,") > 0) {
526
                Object[] allNames = BaseFont.getAllFontNames(path, BaseFont.WINANSI, null);
527
                trueTypeFonts.setProperty(((String)allNames[0]).toLowerCase(), path);
528 1 1. register : negated conditional → NO_COVERAGE
                if (alias != null) {
529
                    trueTypeFonts.setProperty(alias.toLowerCase(), path);
530
                }
531
                // register all the font names with all the locales
532
                String[][] names = (String[][])allNames[2]; //full name
533
                for (String[] name1 : names) {
534
                    trueTypeFonts.setProperty(name1[3].toLowerCase(), path);
535
                }
536
                String fullName = null;
537
                String familyName = null;
538
                names = (String[][])allNames[1]; //family name
539 3 1. register : changed conditional boundary → NO_COVERAGE
2. register : Changed increment from 3 to -3 → NO_COVERAGE
3. register : negated conditional → NO_COVERAGE
                for (int k = 0; k < TTFamilyOrder.length; k += 3) {
540
                    for (String[] name : names) {
541 5 1. register : Replaced integer addition with subtraction → NO_COVERAGE
2. register : Replaced integer addition with subtraction → NO_COVERAGE
3. register : negated conditional → NO_COVERAGE
4. register : negated conditional → NO_COVERAGE
5. register : negated conditional → NO_COVERAGE
                        if (TTFamilyOrder[k].equals(name[0]) && TTFamilyOrder[k + 1].equals(name[1]) && TTFamilyOrder[k + 2].equals(name[2])) {
542
                            familyName = name[3].toLowerCase();
543
                            k = TTFamilyOrder.length;
544
                            break;
545
                        }
546
                    }
547
                }
548 1 1. register : negated conditional → NO_COVERAGE
                if (familyName != null) {
549
                    String lastName = "";
550
                    names = (String[][])allNames[2]; //full name
551
                    for (String[] name : names) {
552 3 1. register : changed conditional boundary → NO_COVERAGE
2. register : Changed increment from 3 to -3 → NO_COVERAGE
3. register : negated conditional → NO_COVERAGE
                        for (int k = 0; k < TTFamilyOrder.length; k += 3) {
553 5 1. register : Replaced integer addition with subtraction → NO_COVERAGE
2. register : Replaced integer addition with subtraction → NO_COVERAGE
3. register : negated conditional → NO_COVERAGE
4. register : negated conditional → NO_COVERAGE
5. register : negated conditional → NO_COVERAGE
                            if (TTFamilyOrder[k].equals(name[0]) && TTFamilyOrder[k + 1].equals(name[1]) && TTFamilyOrder[k + 2].equals(name[2])) {
554
                                fullName = name[3];
555 1 1. register : negated conditional → NO_COVERAGE
                                if (fullName.equals(lastName))
556
                                    continue;
557
                                lastName = fullName;
558 1 1. register : removed call to com/lowagie/text/FontFactoryImp::registerFamily → NO_COVERAGE
                                registerFamily(familyName, fullName, null);
559
                                break;
560
                            }
561
                        }
562
                    }
563
                }
564
            }
565 1 1. register : negated conditional → NO_COVERAGE
            else if (path.toLowerCase().endsWith(".ttc")) {
566 1 1. register : negated conditional → NO_COVERAGE
                if (alias != null)
567 1 1. register : removed call to java/io/PrintStream::println → NO_COVERAGE
                    System.err.println("class FontFactory: You can't define an alias for a true type collection.");
568
                String[] names = BaseFont.enumerateTTCNames(path);
569 2 1. register : changed conditional boundary → NO_COVERAGE
2. register : negated conditional → NO_COVERAGE
                for (int i = 0; i < names.length; i++) {
570 1 1. register : removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE
                    register(path + "," + i);
571
                }
572
            }
573 2 1. register : negated conditional → NO_COVERAGE
2. register : negated conditional → NO_COVERAGE
            else if (path.toLowerCase().endsWith(".afm") || path.toLowerCase().endsWith(".pfm")) {
574
                BaseFont bf = BaseFont.createFont(path, BaseFont.CP1252, false);
575
                String fullName = bf.getFullFontName()[0][3].toLowerCase();
576
                String familyName = bf.getFamilyFontName()[0][3].toLowerCase();
577
                String psName = bf.getPostscriptFontName().toLowerCase();
578 1 1. register : removed call to com/lowagie/text/FontFactoryImp::registerFamily → NO_COVERAGE
                registerFamily(familyName, fullName, null);
579
                trueTypeFonts.setProperty(psName, path);
580
                trueTypeFonts.setProperty(fullName, path);
581
            }
582
        }
583
        catch(DocumentException | IOException de) {
584
            // this shouldn't happen
585
            throw new ExceptionConverter(de);
586
        }
587
    }
588
589
    /** Register all the fonts in a directory.
590
     * @param dir the directory
591
     * @return the number of fonts registered
592
     */    
593
    public int registerDirectory(String dir) {
594 1 1. registerDirectory : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return registerDirectory(dir, false);
595
    }
596
597
    /**
598
     * Register all the fonts in a directory and possibly its subdirectories.
599
     * @param dir the directory
600
     * @param scanSubdirectories recursively scan subdirectories if <code>true</true>
601
     * @return the number of fonts registered
602
     * @since 2.1.2
603
     */
604
    public int registerDirectory(String dir, boolean scanSubdirectories) {
605
        int count = 0;
606
        try {
607
            File file = new File(dir);
608 2 1. registerDirectory : negated conditional → NO_COVERAGE
2. registerDirectory : negated conditional → NO_COVERAGE
            if (!file.exists() || !file.isDirectory())
609 1 1. registerDirectory : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 0;
610
            String[] files = file.list();
611 1 1. registerDirectory : negated conditional → NO_COVERAGE
            if (files == null)
612 1 1. registerDirectory : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 0;
613
            for (String file1 : files) {
614
                try {
615
                    file = new File(dir, file1);
616 1 1. registerDirectory : negated conditional → NO_COVERAGE
                    if (file.isDirectory()) {
617 1 1. registerDirectory : negated conditional → NO_COVERAGE
                        if (scanSubdirectories) {
618 1 1. registerDirectory : Replaced integer addition with subtraction → NO_COVERAGE
                            count += registerDirectory(file.getAbsolutePath(), true);
619
                        }
620
                    } else {
621
                        String name = file.getPath();
622 3 1. registerDirectory : changed conditional boundary → NO_COVERAGE
2. registerDirectory : Replaced integer subtraction with addition → NO_COVERAGE
3. registerDirectory : negated conditional → NO_COVERAGE
                        String suffix = name.length() < 4 ? null : name.substring(name.length() - 4).toLowerCase();
623 2 1. registerDirectory : negated conditional → NO_COVERAGE
2. registerDirectory : negated conditional → NO_COVERAGE
                        if (".afm".equals(suffix) || ".pfm".equals(suffix)) {
624
                            /* Only register Type 1 fonts with matching .pfb files */
625 1 1. registerDirectory : Replaced integer subtraction with addition → NO_COVERAGE
                            File pfb = new File(name.substring(0, name.length() - 4) + ".pfb");
626 1 1. registerDirectory : negated conditional → NO_COVERAGE
                            if (pfb.exists()) {
627 1 1. registerDirectory : removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE
                                register(name, null);
628 1 1. registerDirectory : Changed increment from 1 to -1 → NO_COVERAGE
                                ++count;
629
                            }
630 2 1. registerDirectory : negated conditional → NO_COVERAGE
2. registerDirectory : negated conditional → NO_COVERAGE
                        } else if (".ttf".equals(suffix) || ".otf".equals(suffix)) {
631 1 1. registerDirectory : removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE
                            register(name, file1);
632 1 1. registerDirectory : Changed increment from 1 to -1 → NO_COVERAGE
                            ++count;
633 1 1. registerDirectory : negated conditional → NO_COVERAGE
                        } else if (".ttc".equals(suffix)) {
634 1 1. registerDirectory : removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE
                            register(name, null);
635 1 1. registerDirectory : Changed increment from 1 to -1 → NO_COVERAGE
                            ++count;
636
                        }
637
                    }
638
                } catch (Exception e) {
639
                    //empty on purpose
640
                }
641
            }
642
        }
643
        catch (Exception e) {
644
            //empty on purpose
645
        }
646 1 1. registerDirectory : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return count;
647
    }
648
649
    /** Register fonts in some probable directories. It usually works in Windows,
650
     * Linux and Solaris.
651
     * @return the number of fonts registered
652
     */    
653
    public int registerDirectories() {
654
        int count = 0;
655 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("c:/windows/fonts");
656 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("c:/winnt/fonts");
657 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("d:/windows/fonts");
658 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("d:/winnt/fonts");
659 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/usr/share/X11/fonts", true);
660 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/usr/X/lib/X11/fonts", true);
661 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/usr/openwin/lib/X11/fonts", true);
662 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/usr/share/fonts", true);
663 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/usr/X11R6/lib/X11/fonts", true);
664 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/Library/Fonts");
665 1 1. registerDirectories : Replaced integer addition with subtraction → NO_COVERAGE
        count += registerDirectory("/System/Library/Fonts");
666 1 1. registerDirectories : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return count;
667
    }
668
669
/**
670
 * Gets a set of registered fontnames.
671
 * @return a set of registered fonts
672
 */
673
    
674
    public Set getRegisteredFonts() {
675 1 1. getRegisteredFonts : mutated return of Object value for com/lowagie/text/FontFactoryImp::getRegisteredFonts to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return Utilities.getKeySet(trueTypeFonts);
676
    }
677
    
678
/**
679
 * Gets a set of registered fontnames.
680
 * @return a set of registered font families
681
 */
682
    
683
    public Set getRegisteredFamilies() {
684 1 1. getRegisteredFamilies : mutated return of Object value for com/lowagie/text/FontFactoryImp::getRegisteredFamilies to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return Utilities.getKeySet(fontFamilies);
685
    }
686
    
687
/**
688
 * Checks if a certain font is registered.
689
 *
690
 * @param   fontname    the name of the font that has to be checked.
691
 * @return  true if the font is found
692
 */
693
    public boolean isRegistered(String fontname) {
694 1 1. isRegistered : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return trueTypeFonts.containsKey(fontname.toLowerCase());
695
    }
696
    
697
/**
698
 * Get a registered font path.
699
 *
700
 * @param   fontname    the name of the font to get.
701
 * @return  the font path if found or null
702
 */
703
    public Object getFontPath(String fontname) {
704 1 1. getFontPath : mutated return of Object value for com/lowagie/text/FontFactoryImp::getFontPath to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
    	return trueTypeFonts.get(fontname.toLowerCase());
705
	}
706
}

Mutations

153

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

172

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

175

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

177

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

182

1.1
Location : getFont
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

2.2
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

183

1.1
Location : getFont
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

2.2
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

184

1.1
Location : getFont
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

198

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

202

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

213

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

217

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

219

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

238

1.1
Location : getFont
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

240

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

245

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

247

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

249

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

253

1.1
Location : getFont
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

257

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

260

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

261

1.1
Location : getFont
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

263

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

264

1.1
Location : getFont
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

266

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

269

1.1
Location : getFont
Killed by : none
removed call to java/util/Properties::putAll → NO_COVERAGE

270

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

276

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

279

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

282

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

285

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

288

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

289

1.1
Location : getFont
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

291

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

292

1.1
Location : getFont
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

297

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

301

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

302

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

303

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

306

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

309

1.1
Location : getFont
Killed by : none
negated conditional → NO_COVERAGE

310

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

312

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

327

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

341

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

354

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

369

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

383

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

396

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

411

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

423

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

437

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

450

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

462

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

473

1.1
Location : getFont
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

483

1.1
Location : registerFamily
Killed by : none
negated conditional → NO_COVERAGE

486

1.1
Location : registerFamily
Killed by : none
negated conditional → NO_COVERAGE

494

1.1
Location : registerFamily
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : registerFamily
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : registerFamily
Killed by : none
negated conditional → NO_COVERAGE

495

1.1
Location : registerFamily
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : registerFamily
Killed by : none
negated conditional → NO_COVERAGE

496

1.1
Location : registerFamily
Killed by : none
removed call to java/util/ArrayList::add → NO_COVERAGE

501

1.1
Location : registerFamily
Killed by : none
negated conditional → NO_COVERAGE

513

1.1
Location : register
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE

525

1.1
Location : register
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : register
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : register
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : register
Killed by : none
negated conditional → NO_COVERAGE

528

1.1
Location : register
Killed by : none
negated conditional → NO_COVERAGE

539

1.1
Location : register
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : register
Killed by : none
Changed increment from 3 to -3 → NO_COVERAGE

3.3
Location : register
Killed by : none
negated conditional → NO_COVERAGE

541

1.1
Location : register
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : register
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : register
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : register
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : register
Killed by : none
negated conditional → NO_COVERAGE

548

1.1
Location : register
Killed by : none
negated conditional → NO_COVERAGE

552

1.1
Location : register
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : register
Killed by : none
Changed increment from 3 to -3 → NO_COVERAGE

3.3
Location : register
Killed by : none
negated conditional → NO_COVERAGE

553

1.1
Location : register
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : register
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : register
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : register
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : register
Killed by : none
negated conditional → NO_COVERAGE

555

1.1
Location : register
Killed by : none
negated conditional → NO_COVERAGE

558

1.1
Location : register
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::registerFamily → NO_COVERAGE

565

1.1
Location : register
Killed by : none
negated conditional → NO_COVERAGE

566

1.1
Location : register
Killed by : none
negated conditional → NO_COVERAGE

567

1.1
Location : register
Killed by : none
removed call to java/io/PrintStream::println → NO_COVERAGE

569

1.1
Location : register
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : register
Killed by : none
negated conditional → NO_COVERAGE

570

1.1
Location : register
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE

573

1.1
Location : register
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : register
Killed by : none
negated conditional → NO_COVERAGE

578

1.1
Location : register
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::registerFamily → NO_COVERAGE

594

1.1
Location : registerDirectory
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

608

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

609

1.1
Location : registerDirectory
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

611

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

612

1.1
Location : registerDirectory
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

616

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

617

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

618

1.1
Location : registerDirectory
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

622

1.1
Location : registerDirectory
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : registerDirectory
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

623

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

625

1.1
Location : registerDirectory
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

626

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

627

1.1
Location : registerDirectory
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE

628

1.1
Location : registerDirectory
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

630

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

631

1.1
Location : registerDirectory
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE

632

1.1
Location : registerDirectory
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

633

1.1
Location : registerDirectory
Killed by : none
negated conditional → NO_COVERAGE

634

1.1
Location : registerDirectory
Killed by : none
removed call to com/lowagie/text/FontFactoryImp::register → NO_COVERAGE

635

1.1
Location : registerDirectory
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

646

1.1
Location : registerDirectory
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

655

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

656

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

657

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

658

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

659

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

660

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

661

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

662

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

663

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

664

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

665

1.1
Location : registerDirectories
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

666

1.1
Location : registerDirectories
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

675

1.1
Location : getRegisteredFonts
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getRegisteredFonts to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

684

1.1
Location : getRegisteredFamilies
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getRegisteredFamilies to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

694

1.1
Location : isRegistered
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

704

1.1
Location : getFontPath
Killed by : none
mutated return of Object value for com/lowagie/text/FontFactoryImp::getFontPath to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2