Font.java

1
/*
2
 * $Id: Font.java 4020 2009-07-10 05:13:14Z xlv $
3
 *
4
 * Copyright 1999, 2000, 2001, 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
54
import com.lowagie.text.ExceptionConverter;
55
import com.lowagie.text.html.Markup;
56
import com.lowagie.text.pdf.BaseFont;
57
58
59
/**
60
 * Contains all the specifications of a font: fontfamily, size, style and color.
61
 * <P>
62
 * Example: <BLOCKQUOTE>
63
 * 
64
 * <PRE>
65
 * 
66
 * Paragraph p = new Paragraph("This is a paragraph", <STRONG>new
67
 * Font(Font.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)) </STRONG>);
68
 * 
69
 * </PRE>
70
 * 
71
 * </BLOCKQUOTE>
72
 */
73
74
public class Font implements Comparable {
75
76
    // static membervariables for the different families
77
78
    /** a possible value of a font family. */
79
    public static final int COURIER = 0;
80
81
    /** a possible value of a font family. */
82
    public static final int HELVETICA = 1;
83
84
    /** a possible value of a font family. */
85
    public static final int TIMES_ROMAN = 2;
86
87
    /** a possible value of a font family. */
88
    public static final int SYMBOL = 3;
89
90
    /** a possible value of a font family. */
91
    public static final int ZAPFDINGBATS = 4;
92
93
    // static membervariables for the different styles
94
95
    /** this is a possible style. */
96
    public static final int NORMAL = 0;
97
98
    /** this is a possible style. */
99
    public static final int BOLD = 1;
100
101
    /** this is a possible style. */
102
    public static final int ITALIC = 2;
103
104
    /** this is a possible style. */
105
    public static final int UNDERLINE = 4;
106
107
    /** this is a possible style. */
108
    public static final int STRIKETHRU = 8;
109
110
    /** this is a possible style. */
111
    public static final int BOLDITALIC = BOLD | ITALIC;
112
113
    // static membervariables
114
115
    /** the value of an undefined attribute. */
116
    public static final int UNDEFINED = -1;
117
118
    /** the value of the default size. */
119
    public static final int DEFAULTSIZE = 12;
120
121
    // membervariables
122
123
    /** the value of the fontfamily. */
124
    private int family = UNDEFINED;
125
126
    /** the value of the fontsize. */
127
    private float size = UNDEFINED;
128
129
    /** the value of the style. */
130
    private int style = UNDEFINED;
131
132
    /** the value of the color. */
133
    private Color color = null;
134
135
    /** the external font */
136
    private BaseFont baseFont = null;
137
138
    // constructors
139
140
    /**
141
     * Copy constructor of a Font
142
     * 
143
     * @param other
144
     *            the font that has to be copied
145
     */
146
    public Font(Font other) {
147
        this.family = other.family;
148
        this.size = other.size;
149
        this.style = other.style;
150
        this.color = other.color;
151
        this.baseFont = other.baseFont;
152
    }
153
154
    /**
155
     * Constructs a Font.
156
     * 
157
     * @param family
158
     *            the family to which this font belongs
159
     * @param size
160
     *            the size of this font
161
     * @param style
162
     *            the style of this font
163
     * @param color
164
     *            the <CODE>Color</CODE> of this font.
165
     */
166
167
    public Font(int family, float size, int style, Color color) {
168
        this.family = family;
169
        this.size = size;
170
        this.style = style;
171
        this.color = color;
172
    }
173
174
    /**
175
     * Constructs a Font.
176
     * 
177
     * @param bf
178
     *            the external font
179
     * @param size
180
     *            the size of this font
181
     * @param style
182
     *            the style of this font
183
     * @param color
184
     *            the <CODE>Color</CODE> of this font.
185
     */
186
187
    public Font(BaseFont bf, float size, int style, Color color) {
188
        this.baseFont = bf;
189
        this.size = size;
190
        this.style = style;
191
        this.color = color;
192
    }
193
194
    /**
195
     * Constructs a Font.
196
     * 
197
     * @param bf
198
     *            the external font
199
     * @param size
200
     *            the size of this font
201
     * @param style
202
     *            the style of this font
203
     */
204
    public Font(BaseFont bf, float size, int style) {
205
        this(bf, size, style, null);
206
    }
207
208
    /**
209
     * Constructs a Font.
210
     * 
211
     * @param bf
212
     *            the external font
213
     * @param size
214
     *            the size of this font
215
     */
216
    public Font(BaseFont bf, float size) {
217
        this(bf, size, UNDEFINED, null);
218
    }
219
220
    /**
221
     * Constructs a Font.
222
     * 
223
     * @param bf
224
     *            the external font
225
     */
226
    public Font(BaseFont bf) {
227
        this(bf, UNDEFINED, UNDEFINED, null);
228
    }
229
230
    /**
231
     * Constructs a Font.
232
     * 
233
     * @param family
234
     *            the family to which this font belongs
235
     * @param size
236
     *            the size of this font
237
     * @param style
238
     *            the style of this font
239
     */
240
241
    public Font(int family, float size, int style) {
242
        this(family, size, style, null);
243
    }
244
245
    /**
246
     * Constructs a Font.
247
     * 
248
     * @param family
249
     *            the family to which this font belongs
250
     * @param size
251
     *            the size of this font
252
     */
253
254
    public Font(int family, float size) {
255
        this(family, size, UNDEFINED, null);
256
    }
257
258
    /**
259
     * Constructs a Font.
260
     * 
261
     * @param family
262
     *            the family to which this font belongs
263
     */
264
265
    public Font(int family) {
266
        this(family, UNDEFINED, UNDEFINED, null);
267
    }
268
269
    /**
270
     * Constructs a Font.
271
     */
272
273
    public Font() {
274
        this(UNDEFINED, UNDEFINED, UNDEFINED, null);
275
    }
276
277
    // implementation of the Comparable interface
278
279
    /**
280
     * Compares this <CODE>Font</CODE> with another
281
     * 
282
     * @param object
283
     *            the other <CODE>Font</CODE>
284
     * @return a value
285
     */
286
    public int compareTo(Object object) {
287 1 1. compareTo : negated conditional → NO_COVERAGE
        if (object == null) {
288 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return -1;
289
        }
290
        Font font;
291
        try {
292
            font = (Font) object;
293 2 1. compareTo : negated conditional → NO_COVERAGE
2. compareTo : negated conditional → NO_COVERAGE
            if (baseFont != null && !baseFont.equals(font.getBaseFont())) {
294 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return -2;
295
            }
296 1 1. compareTo : negated conditional → NO_COVERAGE
            if (this.family != font.getFamily()) {
297 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 1;
298
            }
299 1 1. compareTo : negated conditional → NO_COVERAGE
            if (this.size != font.getSize()) {
300 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 2;
301
            }
302 1 1. compareTo : negated conditional → NO_COVERAGE
            if (this.style != font.getStyle()) {
303 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 3;
304
            }
305 1 1. compareTo : negated conditional → NO_COVERAGE
            if (this.color == null) {
306 1 1. compareTo : negated conditional → NO_COVERAGE
                if (font.color == null) {
307 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                    return 0;
308
                }
309 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 4;
310
            }
311 1 1. compareTo : negated conditional → NO_COVERAGE
            if (font.color == null) {
312 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 4;
313
            }
314 1 1. compareTo : negated conditional → NO_COVERAGE
            if (this.color.equals(font.getColor())) {
315 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return 0;
316
            }
317 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return 4;
318
        } catch (ClassCastException cce) {
319 1 1. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return -3;
320
        }
321
    }
322
323
    // FAMILY
324
325
    /**
326
     * Gets the family of this font.
327
     * 
328
     * @return the value of the family
329
     */
330
    public int getFamily() {
331
        return family;
332
    }
333
334
    /**
335
     * Gets the familyname as a String.
336
     * 
337
     * @return the familyname
338
     */
339
    public String getFamilyname() {
340
        String tmp = "unknown";
341
        switch (getFamily()) {
342
        case Font.COURIER:
343 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return FontFactory.COURIER;
344
        case Font.HELVETICA:
345 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return FontFactory.HELVETICA;
346
        case Font.TIMES_ROMAN:
347 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return FontFactory.TIMES_ROMAN;
348
        case Font.SYMBOL:
349 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return FontFactory.SYMBOL;
350
        case Font.ZAPFDINGBATS:
351 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return FontFactory.ZAPFDINGBATS;
352
        default:
353 1 1. getFamilyname : negated conditional → NO_COVERAGE
            if (baseFont != null) {
354
                String[][] names = baseFont.getFamilyFontName();
355
                for (String[] name : names) {
356 1 1. getFamilyname : negated conditional → NO_COVERAGE
                    if ("0".equals(name[2])) {
357 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                        return name[3];
358
                    }
359 1 1. getFamilyname : negated conditional → NO_COVERAGE
                    if ("1033".equals(name[2])) {
360
                        tmp = name[3];
361
                    }
362 1 1. getFamilyname : negated conditional → NO_COVERAGE
                    if ("".equals(name[2])) {
363
                        tmp = name[3];
364
                    }
365
                }
366
            }
367
        }
368 1 1. getFamilyname : mutated return of Object value for com/lowagie/text/Font::getFamilyname to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return tmp;
369
    }
370
371
    /**
372
     * Sets the family using a <CODE>String</CODE> ("Courier", "Helvetica",
373
     * "Times New Roman", "Symbol" or "ZapfDingbats").
374
     * 
375
     * @param family
376
     *            A <CODE>String</CODE> representing a certain font-family.
377
     */
378
    public void setFamily(String family) {
379
        this.family = getFamilyIndex(family);
380
    }
381
382
    /**
383
     * Translates a <CODE>String</CODE> -value of a certain family into the
384
     * index that is used for this family in this class.
385
     * 
386
     * @param family
387
     *            A <CODE>String</CODE> representing a certain font-family
388
     * @return the corresponding index
389
     */
390
    public static int getFamilyIndex(String family) {
391 1 1. getFamilyIndex : negated conditional → NO_COVERAGE
        if (family.equalsIgnoreCase(FontFactory.COURIER)) {
392 1 1. getFamilyIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return COURIER;
393
        }
394 1 1. getFamilyIndex : negated conditional → NO_COVERAGE
        if (family.equalsIgnoreCase(FontFactory.HELVETICA)) {
395 1 1. getFamilyIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return HELVETICA;
396
        }
397 1 1. getFamilyIndex : negated conditional → NO_COVERAGE
        if (family.equalsIgnoreCase(FontFactory.TIMES_ROMAN)) {
398 1 1. getFamilyIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return TIMES_ROMAN;
399
        }
400 1 1. getFamilyIndex : negated conditional → NO_COVERAGE
        if (family.equalsIgnoreCase(FontFactory.SYMBOL)) {
401 1 1. getFamilyIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return SYMBOL;
402
        }
403 1 1. getFamilyIndex : negated conditional → NO_COVERAGE
        if (family.equalsIgnoreCase(FontFactory.ZAPFDINGBATS)) {
404 1 1. getFamilyIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return ZAPFDINGBATS;
405
        }
406 1 1. getFamilyIndex : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return UNDEFINED;
407
    }
408
409
    // SIZE
410
    
411
    /**
412
     * Gets the size of this font.
413
     * 
414
     * @return a size
415
     */
416
    public float getSize() {
417
        return size;
418
    }
419
420
    /**
421
     * Gets the size that can be used with the calculated <CODE>BaseFont
422
     * </CODE>.
423
     * 
424
     * @return the size that can be used with the calculated <CODE>BaseFont
425
     *         </CODE>
426
     */
427
    public float getCalculatedSize() {
428
        float s = this.size;
429 1 1. getCalculatedSize : negated conditional → NO_COVERAGE
        if (s == UNDEFINED) {
430
            s = DEFAULTSIZE;
431
        }
432 1 1. getCalculatedSize : replaced return of float value with -(x + 1) for com/lowagie/text/Font::getCalculatedSize → NO_COVERAGE
        return s;
433
    }
434
435
    /**
436
     * Gets the leading that can be used with this font.
437
     * 
438
     * @param linespacing
439
     *            a certain linespacing
440
     * @return the height of a line
441
     */
442
    public float getCalculatedLeading(float linespacing) {
443 2 1. getCalculatedLeading : Replaced float multiplication with division → NO_COVERAGE
2. getCalculatedLeading : replaced return of float value with -(x + 1) for com/lowagie/text/Font::getCalculatedLeading → NO_COVERAGE
        return linespacing * getCalculatedSize();
444
    }
445
446
    /**
447
     * Sets the size.
448
     * 
449
     * @param size
450
     *            The new size of the font.
451
     */
452
    public void setSize(float size) {
453
        this.size = size;
454
    }
455
456
    // STYLE
457
    
458
    /**
459
     * Gets the style of this font.
460
     * 
461
     * @return a size
462
     */
463
    public int getStyle() {
464
        return style;
465
    }
466
467
    /**
468
     * Gets the style that can be used with the calculated <CODE>BaseFont
469
     * </CODE>.
470
     * 
471
     * @return the style that can be used with the calculated <CODE>BaseFont
472
     *         </CODE>
473
     */
474
    public int getCalculatedStyle() {
475
        int style = this.style;
476 1 1. getCalculatedStyle : negated conditional → NO_COVERAGE
        if (style == UNDEFINED) {
477
            style = NORMAL;
478
        }
479 1 1. getCalculatedStyle : negated conditional → NO_COVERAGE
        if (baseFont != null)
480 1 1. getCalculatedStyle : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return style;
481 2 1. getCalculatedStyle : negated conditional → NO_COVERAGE
2. getCalculatedStyle : negated conditional → NO_COVERAGE
        if (family == SYMBOL || family == ZAPFDINGBATS)
482 1 1. getCalculatedStyle : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return style;
483
        else
484 2 1. getCalculatedStyle : Replaced bitwise AND with OR → NO_COVERAGE
2. getCalculatedStyle : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return style & (~BOLDITALIC);
485
    }
486
487
    /**
488
     * checks if this font is Bold.
489
     * 
490
     * @return a <CODE>boolean</CODE>
491
     */
492
    public boolean isBold() {
493 1 1. isBold : negated conditional → NO_COVERAGE
        if (style == UNDEFINED) {
494 1 1. isBold : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return false;
495
        }
496 3 1. isBold : Replaced bitwise AND with OR → NO_COVERAGE
2. isBold : negated conditional → NO_COVERAGE
3. isBold : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (style & BOLD) == BOLD;
497
    }
498
499
    /**
500
     * checks if this font is italic.
501
     * 
502
     * @return a <CODE>boolean</CODE>
503
     */
504
    public boolean isItalic() {
505 1 1. isItalic : negated conditional → NO_COVERAGE
        if (style == UNDEFINED) {
506 1 1. isItalic : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return false;
507
        }
508 3 1. isItalic : Replaced bitwise AND with OR → NO_COVERAGE
2. isItalic : negated conditional → NO_COVERAGE
3. isItalic : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (style & ITALIC) == ITALIC;
509
    }
510
511
    /**
512
     * checks if this font is underlined.
513
     * 
514
     * @return a <CODE>boolean</CODE>
515
     */
516
    public boolean isUnderlined() {
517 1 1. isUnderlined : negated conditional → NO_COVERAGE
        if (style == UNDEFINED) {
518 1 1. isUnderlined : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return false;
519
        }
520 3 1. isUnderlined : Replaced bitwise AND with OR → NO_COVERAGE
2. isUnderlined : negated conditional → NO_COVERAGE
3. isUnderlined : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (style & UNDERLINE) == UNDERLINE;
521
    }
522
523
    /**
524
     * checks if the style of this font is STRIKETHRU.
525
     * 
526
     * @return a <CODE>boolean</CODE>
527
     */
528
    public boolean isStrikethru() {
529 1 1. isStrikethru : negated conditional → NO_COVERAGE
        if (style == UNDEFINED) {
530 1 1. isStrikethru : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return false;
531
        }
532 3 1. isStrikethru : Replaced bitwise AND with OR → NO_COVERAGE
2. isStrikethru : negated conditional → NO_COVERAGE
3. isStrikethru : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (style & STRIKETHRU) == STRIKETHRU;
533
    }
534
535
    /**
536
     * Sets the style.
537
     * 
538
     * @param style
539
     *            the style.
540
     */
541
    public void setStyle(int style) {
542
        this.style = style;
543
    }
544
545
    /**
546
     * Sets the style using a <CODE>String</CODE> containing one of more of
547
     * the following values: normal, bold, italic, underline, strike.
548
     * 
549
     * @param style
550
     *            A <CODE>String</CODE> representing a certain style.
551
     */
552
    public void setStyle(String style) {
553 1 1. setStyle : negated conditional → NO_COVERAGE
        if (this.style == UNDEFINED)
554
            this.style = NORMAL;
555 1 1. setStyle : Replaced bitwise OR with AND → NO_COVERAGE
        this.style |= getStyleValue(style);
556
    }
557
558
    /**
559
     * Translates a <CODE>String</CODE> -value of a certain style into the
560
     * index value is used for this style in this class.
561
     * 
562
     * @param style
563
     *            A <CODE>String</CODE>
564
     * @return the corresponding value
565
     */
566
    public static int getStyleValue(String style) {
567
        int s = 0;
568 1 1. getStyleValue : negated conditional → NO_COVERAGE
        if (style.contains(Markup.CSS_VALUE_NORMAL)) {
569 1 1. getStyleValue : Replaced bitwise OR with AND → NO_COVERAGE
            s |= NORMAL;
570
        }
571 1 1. getStyleValue : negated conditional → NO_COVERAGE
        if (style.contains(Markup.CSS_VALUE_BOLD)) {
572 1 1. getStyleValue : Replaced bitwise OR with AND → NO_COVERAGE
            s |= BOLD;
573
        }
574 1 1. getStyleValue : negated conditional → NO_COVERAGE
        if (style.contains(Markup.CSS_VALUE_ITALIC)) {
575 1 1. getStyleValue : Replaced bitwise OR with AND → NO_COVERAGE
            s |= ITALIC;
576
        }
577 1 1. getStyleValue : negated conditional → NO_COVERAGE
        if (style.contains(Markup.CSS_VALUE_OBLIQUE)) {
578 1 1. getStyleValue : Replaced bitwise OR with AND → NO_COVERAGE
            s |= ITALIC;
579
        }
580 1 1. getStyleValue : negated conditional → NO_COVERAGE
        if (style.contains(Markup.CSS_VALUE_UNDERLINE)) {
581 1 1. getStyleValue : Replaced bitwise OR with AND → NO_COVERAGE
            s |= UNDERLINE;
582
        }
583 1 1. getStyleValue : negated conditional → NO_COVERAGE
        if (style.contains(Markup.CSS_VALUE_LINETHROUGH)) {
584 1 1. getStyleValue : Replaced bitwise OR with AND → NO_COVERAGE
            s |= STRIKETHRU;
585
        }
586 1 1. getStyleValue : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return s;
587
    }
588
589
    // COLOR
590
    
591
    /**
592
     * Gets the color of this font.
593
     * 
594
     * @return a color
595
     */
596
    public Color getColor() {
597
        return color;
598
    }
599
600
    /**
601
     * Sets the color.
602
     * 
603
     * @param color
604
     *            the new color of the font
605
     */
606
607
    public void setColor(Color color) {
608
        this.color = color;
609
    }
610
611
    /**
612
     * Sets the color.
613
     * 
614
     * @param red
615
     *            the red-value of the new color
616
     * @param green
617
     *            the green-value of the new color
618
     * @param blue
619
     *            the blue-value of the new color
620
     */
621
    public void setColor(int red, int green, int blue) {
622
        this.color = new Color(red, green, blue);
623
    }
624
625
    // BASEFONT
626
627
    /**
628
     * Gets the <CODE>BaseFont</CODE> inside this object.
629
     * 
630
     * @return the <CODE>BaseFont</CODE>
631
     */
632
    public BaseFont getBaseFont() {
633
        return baseFont;
634
    }
635
636
    /**
637
     * Gets the <CODE>BaseFont</CODE> this class represents. For the built-in
638
     * fonts a <CODE>BaseFont</CODE> is calculated.
639
     * 
640
     * @param specialEncoding
641
     *            <CODE>true</CODE> to use the special encoding for Symbol and
642
     *            ZapfDingbats, <CODE>false</CODE> to always use <CODE>Cp1252
643
     *            </CODE>
644
     * @return the <CODE>BaseFont</CODE> this class represents
645
     */
646
    public BaseFont getCalculatedBaseFont(boolean specialEncoding) {
647 1 1. getCalculatedBaseFont : negated conditional → NO_COVERAGE
        if (baseFont != null)
648 1 1. getCalculatedBaseFont : mutated return of Object value for com/lowagie/text/Font::getCalculatedBaseFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return baseFont;
649
        int style = this.style;
650 1 1. getCalculatedBaseFont : negated conditional → NO_COVERAGE
        if (style == UNDEFINED) {
651
            style = NORMAL;
652
        }
653
        String fontName = BaseFont.HELVETICA;
654
        String encoding = BaseFont.WINANSI;
655
        BaseFont cfont = null;
656
        switch (family) {
657
        case COURIER:
658 1 1. getCalculatedBaseFont : Replaced bitwise AND with OR → NO_COVERAGE
            switch (style & BOLDITALIC) {
659
            case BOLD:
660
                fontName = BaseFont.COURIER_BOLD;
661
                break;
662
            case ITALIC:
663
                fontName = BaseFont.COURIER_OBLIQUE;
664
                break;
665
            case BOLDITALIC:
666
                fontName = BaseFont.COURIER_BOLDOBLIQUE;
667
                break;
668
            default:
669
                //case NORMAL:
670
                fontName = BaseFont.COURIER;
671
                break;
672
            }
673
            break;
674
        case TIMES_ROMAN:
675 1 1. getCalculatedBaseFont : Replaced bitwise AND with OR → NO_COVERAGE
            switch (style & BOLDITALIC) {
676
            case BOLD:
677
                fontName = BaseFont.TIMES_BOLD;
678
                break;
679
            case ITALIC:
680
                fontName = BaseFont.TIMES_ITALIC;
681
                break;
682
            case BOLDITALIC:
683
                fontName = BaseFont.TIMES_BOLDITALIC;
684
                break;
685
            default:
686
            case NORMAL:
687
                fontName = BaseFont.TIMES_ROMAN;
688
                break;
689
            }
690
            break;
691
        case SYMBOL:
692
            fontName = BaseFont.SYMBOL;
693 1 1. getCalculatedBaseFont : negated conditional → NO_COVERAGE
            if (specialEncoding)
694
                encoding = BaseFont.SYMBOL;
695
            break;
696
        case ZAPFDINGBATS:
697
            fontName = BaseFont.ZAPFDINGBATS;
698 1 1. getCalculatedBaseFont : negated conditional → NO_COVERAGE
            if (specialEncoding)
699
                encoding = BaseFont.ZAPFDINGBATS;
700
            break;
701
        default:
702
        case Font.HELVETICA:
703 1 1. getCalculatedBaseFont : Replaced bitwise AND with OR → NO_COVERAGE
            switch (style & BOLDITALIC) {
704
            case BOLD:
705
                fontName = BaseFont.HELVETICA_BOLD;
706
                break;
707
            case ITALIC:
708
                fontName = BaseFont.HELVETICA_OBLIQUE;
709
                break;
710
            case BOLDITALIC:
711
                fontName = BaseFont.HELVETICA_BOLDOBLIQUE;
712
                break;
713
            default:
714
            case NORMAL:
715
                fontName = BaseFont.HELVETICA;
716
                break;
717
            }
718
            break;
719
        }
720
        try {
721
            cfont = BaseFont.createFont(fontName, encoding, false);
722
        } catch (Exception ee) {
723
            throw new ExceptionConverter(ee);
724
        }
725 1 1. getCalculatedBaseFont : mutated return of Object value for com/lowagie/text/Font::getCalculatedBaseFont to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return cfont;
726
    }
727
    
728
    
729
    // Helper methods
730
731
    /**
732
     * Checks if the properties of this font are undefined or null.
733
     * <P>
734
     * If so, the standard should be used.
735
     * 
736
     * @return a <CODE>boolean</CODE>
737
     */
738
    public boolean isStandardFont() {
739 6 1. isStandardFont : negated conditional → NO_COVERAGE
2. isStandardFont : negated conditional → NO_COVERAGE
3. isStandardFont : negated conditional → NO_COVERAGE
4. isStandardFont : negated conditional → NO_COVERAGE
5. isStandardFont : negated conditional → NO_COVERAGE
6. isStandardFont : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (family == UNDEFINED && size == UNDEFINED && style == UNDEFINED
740
                && color == null && baseFont == null);
741
    }
742
743
    /**
744
     * Replaces the attributes that are equal to <VAR>null</VAR> with the
745
     * attributes of a given font.
746
     * 
747
     * @param font
748
     *            the font of a bigger element class
749
     * @return a <CODE>Font</CODE>
750
     */
751
    public Font difference(Font font) {
752 2 1. difference : negated conditional → NO_COVERAGE
2. difference : mutated return of Object value for com/lowagie/text/Font::difference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        if (font == null) return this;
753
        // size
754
        float dSize = font.size;
755 1 1. difference : negated conditional → NO_COVERAGE
        if (dSize == UNDEFINED) {
756
            dSize = this.size;
757
        }
758
        // style
759
        int dStyle = UNDEFINED;
760
        int style1 = this.style;
761
        int style2 = font.getStyle();
762 2 1. difference : negated conditional → NO_COVERAGE
2. difference : negated conditional → NO_COVERAGE
        if (style1 != UNDEFINED || style2 != UNDEFINED) {
763 1 1. difference : negated conditional → NO_COVERAGE
            if (style1 == UNDEFINED)
764
                style1 = 0;
765 1 1. difference : negated conditional → NO_COVERAGE
            if (style2 == UNDEFINED)
766
                style2 = 0;
767 1 1. difference : Replaced bitwise OR with AND → NO_COVERAGE
            dStyle = style1 | style2;
768
        }
769
        // color
770
        Color dColor = font.color;
771 1 1. difference : negated conditional → NO_COVERAGE
        if (dColor == null) {
772
            dColor = this.color;
773
        }
774
        // family
775 1 1. difference : negated conditional → NO_COVERAGE
        if (font.baseFont != null) {
776 1 1. difference : mutated return of Object value for com/lowagie/text/Font::difference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new Font(font.baseFont, dSize, dStyle, dColor);
777
        }
778 1 1. difference : negated conditional → NO_COVERAGE
        if (font.getFamily() != UNDEFINED) {
779 1 1. difference : mutated return of Object value for com/lowagie/text/Font::difference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new Font(font.family, dSize, dStyle, dColor);
780
        }
781 1 1. difference : negated conditional → NO_COVERAGE
        if (this.baseFont != null) {
782 1 1. difference : negated conditional → NO_COVERAGE
            if (dStyle == style1) {
783 1 1. difference : mutated return of Object value for com/lowagie/text/Font::difference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new Font(this.baseFont, dSize, dStyle, dColor);
784
            } else {
785 1 1. difference : mutated return of Object value for com/lowagie/text/Font::difference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return FontFactory.getFont(this.getFamilyname(), dSize, dStyle,
786
                        dColor);
787
            }
788
        }
789 1 1. difference : mutated return of Object value for com/lowagie/text/Font::difference to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new Font(this.family, dSize, dStyle, dColor);
790
    }
791
792
}

Mutations

287

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

288

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

293

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

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

294

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

296

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

297

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

299

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

300

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

302

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

303

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

305

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

306

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

307

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

309

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

311

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

312

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

314

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

315

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

317

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

319

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

343

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

345

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

347

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

349

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

351

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

353

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

356

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

357

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

359

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

362

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

368

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

391

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

392

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

394

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

395

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

397

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

398

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

400

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

401

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

403

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

404

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

406

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

429

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

432

1.1
Location : getCalculatedSize
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/Font::getCalculatedSize → NO_COVERAGE

443

1.1
Location : getCalculatedLeading
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

2.2
Location : getCalculatedLeading
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/Font::getCalculatedLeading → NO_COVERAGE

476

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

479

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

480

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

481

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

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

482

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

484

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

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

493

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

494

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

496

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

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

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

505

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

506

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

508

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

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

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

517

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

518

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

520

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

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

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

529

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

530

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

532

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

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

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

553

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

555

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

568

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

569

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

571

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

572

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

574

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

575

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

577

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

578

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

580

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

581

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

583

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

584

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

586

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

647

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

648

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

650

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

658

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

675

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

693

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

698

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

703

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

725

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

739

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

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

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

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

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

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

752

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

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

755

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

762

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

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

763

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

765

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

767

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

771

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

775

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

776

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

778

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

779

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

781

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

782

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

783

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

785

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

789

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

Active mutators

Tests examined


Report generated by PIT 1.4.2