DocumentFont.java

1
/*
2
 * Copyright 2004 by Paulo Soares.
3
 *
4
 * The contents of this file are subject to the Mozilla Public License Version 1.1
5
 * (the "License"); you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
7
 *
8
 * Software distributed under the License is distributed on an "AS IS" basis,
9
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10
 * for the specific language governing rights and limitations under the License.
11
 *
12
 * The Original Code is 'iText, a free JAVA-PDF library'.
13
 *
14
 * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
15
 * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
16
 * All Rights Reserved.
17
 * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
18
 * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
19
 *
20
 * Contributor(s): all the names of the contributors are added in the source code
21
 * where applicable.
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of the
24
 * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
25
 * provisions of LGPL are applicable instead of those above.  If you wish to
26
 * allow use of your version of this file only under the terms of the LGPL
27
 * License and not to allow others to use your version of this file under
28
 * the MPL, indicate your decision by deleting the provisions above and
29
 * replace them with the notice and other provisions required by the LGPL.
30
 * If you do not delete the provisions above, a recipient may use your version
31
 * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
32
 *
33
 * This library is free software; you can redistribute it and/or modify it
34
 * under the terms of the MPL as stated above or under the terms of the GNU
35
 * Library General Public License as published by the Free Software Foundation;
36
 * either version 2 of the License, or any later version.
37
 *
38
 * This library is distributed in the hope that it will be useful, but WITHOUT
39
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
40
 * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
41
 * details.
42
 *
43
 * If you didn't download this code from the following link, you should check if
44
 * you aren't using an obsolete version:
45
 * http://www.lowagie.com/iText/
46
 */
47
package com.lowagie.text.pdf;
48
49
import com.lowagie.text.DocumentException;
50
import com.lowagie.text.ExceptionConverter;
51
import java.util.HashMap;
52
53
54
/**
55
 * @author psoares
56
 */
57
public class DocumentFont extends BaseFont {
58
59
  // code, [glyph, width]
60
  private HashMap<Integer, int[]> metrics = new HashMap<>();
61
  private String fontName;
62
  private PRIndirectReference refFont;
63
  private PdfDictionary font;
64
  private IntHashtable uni2byte = new IntHashtable();
65
  private IntHashtable diffmap;
66
  private float Ascender = 800;
67
  private float CapHeight = 700;
68
  private float Descender = -200;
69
  private float ItalicAngle = 0;
70
  private float llx = -50;
71
  private float lly = -200;
72
  private float urx = 100;
73
  private float ury = 900;
74
  private boolean isType0 = false;
75
76
  private BaseFont cjkMirror;
77
78
  private static String[] cjkNames = {"HeiseiMin-W3", "HeiseiKakuGo-W5", "STSong-Light", "MHei-Medium",
79
      "MSung-Light", "HYGoThic-Medium", "HYSMyeongJo-Medium", "MSungStd-Light", "STSongStd-Light",
80
      "HYSMyeongJoStd-Medium", "KozMinPro-Regular"};
81
82
  private static String[] cjkEncs = {"UniJIS-UCS2-H", "UniJIS-UCS2-H", "UniGB-UCS2-H", "UniCNS-UCS2-H",
83
      "UniCNS-UCS2-H", "UniKS-UCS2-H", "UniKS-UCS2-H", "UniCNS-UCS2-H", "UniGB-UCS2-H",
84
      "UniKS-UCS2-H", "UniJIS-UCS2-H"};
85
86
  private static String[] cjkNames2 = {"MSungStd-Light", "STSongStd-Light", "HYSMyeongJoStd-Medium", "KozMinPro-Regular"};
87
88
  private static String[] cjkEncs2 = {"UniCNS-UCS2-H", "UniGB-UCS2-H", "UniKS-UCS2-H", "UniJIS-UCS2-H",
89
      "UniCNS-UTF16-H", "UniGB-UTF16-H", "UniKS-UTF16-H", "UniJIS-UTF16-H"};
90
91
  private static final int[] stdEnc = {
92
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94
      32, 33, 34, 35, 36, 37, 38, 8217, 40, 41, 42, 43, 44, 45, 46, 47,
95
      48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
96
      64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
97
      80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
98
      8216, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
99
      112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 0,
100
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
101
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102
      0, 161, 162, 163, 8260, 165, 402, 167, 164, 39, 8220, 171, 8249, 8250, 64257, 64258,
103
      0, 8211, 8224, 8225, 183, 0, 182, 8226, 8218, 8222, 8221, 187, 8230, 8240, 0, 191,
104
      0, 96, 180, 710, 732, 175, 728, 729, 168, 0, 730, 184, 0, 733, 731, 711,
105
      8212, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106
      0, 198, 0, 170, 0, 0, 0, 0, 321, 216, 338, 186, 0, 0, 0, 0,
107
      0, 230, 0, 0, 0, 305, 0, 0, 322, 248, 339, 223, 0, 0, 0, 0};
108
109
  /**
110
   * Creates a new instance of DocumentFont
111
   */
112
  DocumentFont(PRIndirectReference refFont) {
113
    encoding = "";
114
    fontSpecific = false;
115
    this.refFont = refFont;
116
    fontType = FONT_TYPE_DOCUMENT;
117
    font = (PdfDictionary) PdfReader.getPdfObject(refFont);
118
    PdfName asName = font.getAsName(PdfName.BASEFONT);
119 1 1. : negated conditional → NO_COVERAGE
    if (asName != null) {
120
      fontName = PdfName.decodeName(asName.toString());
121
    } else {
122
      fontName = "badFontName";
123
    }
124
    PdfName subType = font.getAsName(PdfName.SUBTYPE);
125 2 1. : negated conditional → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
    if (PdfName.TYPE1.equals(subType) || PdfName.TRUETYPE.equals(subType)) {
126 1 1. : removed call to com/lowagie/text/pdf/DocumentFont::doType1TT → NO_COVERAGE
      doType1TT();
127
    } else {
128 3 1. : changed conditional boundary → NO_COVERAGE
2. : Changed increment from 1 to -1 → NO_COVERAGE
3. : negated conditional → NO_COVERAGE
      for (int k = 0; k < cjkNames.length; ++k) {
129 1 1. : negated conditional → NO_COVERAGE
        if (fontName.startsWith(cjkNames[k])) {
130
          fontName = cjkNames[k];
131
          try {
132
            cjkMirror = BaseFont.createFont(fontName, cjkEncs[k], false);
133
          } catch (Exception e) {
134
            throw new ExceptionConverter(e);
135
          }
136
          return;
137
        }
138
      }
139
      PdfName encName = font.getAsName(PdfName.ENCODING);
140 1 1. : negated conditional → NO_COVERAGE
      if (encName != null) {
141
        String enc = PdfName.decodeName(encName.toString());
142 3 1. : changed conditional boundary → NO_COVERAGE
2. : Changed increment from 1 to -1 → NO_COVERAGE
3. : negated conditional → NO_COVERAGE
        for (int k = 0; k < cjkEncs2.length; ++k) {
143 1 1. : negated conditional → NO_COVERAGE
          if (enc.startsWith(cjkEncs2[k])) {
144
            try {
145 2 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
              if (k > 3) {
146 1 1. : Changed increment from -4 to 4 → NO_COVERAGE
                k -= 4;
147
              }
148
              cjkMirror = BaseFont.createFont(cjkNames2[k], cjkEncs2[k], false);
149
            } catch (Exception e) {
150
              throw new ExceptionConverter(e);
151
            }
152
            return;
153
          }
154
        }
155
        encoding = enc;
156 2 1. : negated conditional → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
        if (PdfName.TYPE0.equals(subType) && enc.equals("Identity-H")) {
157 1 1. : removed call to com/lowagie/text/pdf/DocumentFont::processType0 → NO_COVERAGE
          processType0(font);
158
          isType0 = true;
159
        }
160
      }
161
    }
162
  }
163
164
  private void processType0(PdfDictionary font) {
165
    try {
166
      PdfObject toUniObject = PdfReader.getPdfObjectRelease(font.get(PdfName.TOUNICODE));
167
      PdfArray df = (PdfArray) PdfReader.getPdfObjectRelease(font.get(PdfName.DESCENDANTFONTS));
168
      PdfDictionary cidft = (PdfDictionary) PdfReader.getPdfObjectRelease(df.getPdfObject(0));
169
      PdfNumber dwo = (PdfNumber) PdfReader.getPdfObjectRelease(cidft.get(PdfName.DW));
170
      int dw = 1000;
171 1 1. processType0 : negated conditional → NO_COVERAGE
      if (dwo != null) {
172
        dw = dwo.intValue();
173
      }
174
      IntHashtable widths = readWidths((PdfArray) PdfReader.getPdfObjectRelease(cidft.get(PdfName.W)));
175
      PdfDictionary fontDesc = (PdfDictionary) PdfReader.getPdfObjectRelease(cidft.get(PdfName.FONTDESCRIPTOR));
176 1 1. processType0 : removed call to com/lowagie/text/pdf/DocumentFont::fillFontDesc → NO_COVERAGE
      fillFontDesc(fontDesc);
177 1 1. processType0 : negated conditional → NO_COVERAGE
      if (toUniObject != null) {
178 1 1. processType0 : removed call to com/lowagie/text/pdf/DocumentFont::fillMetrics → NO_COVERAGE
        fillMetrics(PdfReader.getStreamBytes((PRStream) toUniObject), widths, dw);
179
      }
180
181
    } catch (Exception e) {
182
      throw new ExceptionConverter(e);
183
    }
184
  }
185
186
  private IntHashtable readWidths(PdfArray ws) {
187
    IntHashtable hh = new IntHashtable();
188 1 1. readWidths : negated conditional → NO_COVERAGE
    if (ws == null) {
189 1 1. readWidths : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::readWidths to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
      return hh;
190
    }
191 3 1. readWidths : changed conditional boundary → NO_COVERAGE
2. readWidths : Changed increment from 1 to -1 → NO_COVERAGE
3. readWidths : negated conditional → NO_COVERAGE
    for (int k = 0; k < ws.size(); ++k) {
192
      int c1 = ((PdfNumber) PdfReader.getPdfObjectRelease(ws.getPdfObject(k))).intValue();
193 1 1. readWidths : Changed increment from 1 to -1 → NO_COVERAGE
      PdfObject obj = PdfReader.getPdfObjectRelease(ws.getPdfObject(++k));
194 1 1. readWidths : negated conditional → NO_COVERAGE
      if (obj.isArray()) {
195
        PdfArray a2 = (PdfArray) obj;
196 3 1. readWidths : changed conditional boundary → NO_COVERAGE
2. readWidths : Changed increment from 1 to -1 → NO_COVERAGE
3. readWidths : negated conditional → NO_COVERAGE
        for (int j = 0; j < a2.size(); ++j) {
197
          int c2 = ((PdfNumber) PdfReader.getPdfObjectRelease(a2.getPdfObject(j))).intValue();
198 1 1. readWidths : Changed increment from 1 to -1 → NO_COVERAGE
          hh.put(c1++, c2);
199
        }
200
      } else {
201
        int c2 = ((PdfNumber) obj).intValue();
202 1 1. readWidths : Changed increment from 1 to -1 → NO_COVERAGE
        int w = ((PdfNumber) PdfReader.getPdfObjectRelease(ws.getPdfObject(++k))).intValue();
203 3 1. readWidths : changed conditional boundary → NO_COVERAGE
2. readWidths : Changed increment from 1 to -1 → NO_COVERAGE
3. readWidths : negated conditional → NO_COVERAGE
        for (; c1 <= c2; ++c1) {
204
          hh.put(c1, w);
205
        }
206
      }
207
    }
208 1 1. readWidths : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::readWidths to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
    return hh;
209
  }
210
211
  private String decodeString(PdfString ps) {
212 1 1. decodeString : negated conditional → NO_COVERAGE
    if (ps.isHexWriting()) {
213 1 1. decodeString : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::decodeString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
      return PdfEncodings.convertToString(ps.getBytes(), "UnicodeBigUnmarked");
214
    } else {
215 1 1. decodeString : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::decodeString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
      return ps.toUnicodeString();
216
    }
217
  }
218
219
  private void fillMetrics(byte[] touni, IntHashtable widths, int dw) {
220
    try {
221
      PdfContentParser ps = new PdfContentParser(new PRTokeniser(touni));
222
      PdfObject ob = null;
223
      PdfObject last = null;
224 1 1. fillMetrics : negated conditional → NO_COVERAGE
      while ((ob = ps.readPRObject()) != null) {
225 1 1. fillMetrics : negated conditional → NO_COVERAGE
        if (ob.type() == PdfContentParser.COMMAND_TYPE) {
226 1 1. fillMetrics : negated conditional → NO_COVERAGE
          if (ob.toString().equals("beginbfchar")) {
227
            int n = ((PdfNumber) last).intValue();
228 3 1. fillMetrics : changed conditional boundary → NO_COVERAGE
2. fillMetrics : Changed increment from 1 to -1 → NO_COVERAGE
3. fillMetrics : negated conditional → NO_COVERAGE
            for (int k = 0; k < n; ++k) {
229
              String cid = decodeString((PdfString) ps.readPRObject());
230
              String uni = decodeString((PdfString) ps.readPRObject());
231 1 1. fillMetrics : negated conditional → NO_COVERAGE
              if (uni.length() == 1) {
232
                int cidc = cid.charAt(0);
233 1 1. fillMetrics : Replaced integer subtraction with addition → NO_COVERAGE
                int unic = uni.charAt(uni.length() - 1);
234
                int w = dw;
235 1 1. fillMetrics : negated conditional → NO_COVERAGE
                if (widths.containsKey(cidc)) {
236
                  w = widths.get(cidc);
237
                }
238
                metrics.put(unic, new int[]{cidc, w});
239
              }
240
            }
241 1 1. fillMetrics : negated conditional → NO_COVERAGE
          } else if (ob.toString().equals("beginbfrange")) {
242
            int n = ((PdfNumber) last).intValue();
243 3 1. fillMetrics : changed conditional boundary → NO_COVERAGE
2. fillMetrics : Changed increment from 1 to -1 → NO_COVERAGE
3. fillMetrics : negated conditional → NO_COVERAGE
            for (int k = 0; k < n; ++k) {
244
              String cid1 = decodeString((PdfString) ps.readPRObject());
245
              String cid2 = decodeString((PdfString) ps.readPRObject());
246
              int cid1c = cid1.charAt(0);
247
              int cid2c = cid2.charAt(0);
248
              PdfObject ob2 = ps.readPRObject();
249 1 1. fillMetrics : negated conditional → NO_COVERAGE
              if (ob2.isString()) {
250
                String uni = decodeString((PdfString) ob2);
251 1 1. fillMetrics : negated conditional → NO_COVERAGE
                if (uni.length() == 1) {
252 1 1. fillMetrics : Replaced integer subtraction with addition → NO_COVERAGE
                  int unic = uni.charAt(uni.length() - 1);
253 4 1. fillMetrics : changed conditional boundary → NO_COVERAGE
2. fillMetrics : Changed increment from 1 to -1 → NO_COVERAGE
3. fillMetrics : Changed increment from 1 to -1 → NO_COVERAGE
4. fillMetrics : negated conditional → NO_COVERAGE
                  for (; cid1c <= cid2c; cid1c++, unic++) {
254
                    int w = dw;
255 1 1. fillMetrics : negated conditional → NO_COVERAGE
                    if (widths.containsKey(cid1c)) {
256
                      w = widths.get(cid1c);
257
                    }
258
                    metrics.put(unic, new int[]{cid1c, w});
259
                  }
260
                }
261
              } else {
262
                PdfArray a = (PdfArray) ob2;
263 4 1. fillMetrics : changed conditional boundary → NO_COVERAGE
2. fillMetrics : Changed increment from 1 to -1 → NO_COVERAGE
3. fillMetrics : Changed increment from 1 to -1 → NO_COVERAGE
4. fillMetrics : negated conditional → NO_COVERAGE
                for (int j = 0; j < a.size(); ++j, ++cid1c) {
264
                  String uni = decodeString(a.getAsString(j));
265 1 1. fillMetrics : negated conditional → NO_COVERAGE
                  if (uni.length() == 1) {
266 1 1. fillMetrics : Replaced integer subtraction with addition → NO_COVERAGE
                    int unic = uni.charAt(uni.length() - 1);
267
                    int w = dw;
268 1 1. fillMetrics : negated conditional → NO_COVERAGE
                    if (widths.containsKey(cid1c)) {
269
                      w = widths.get(cid1c);
270
                    }
271
                    metrics.put(unic, new int[]{cid1c, w});
272
                  }
273
                }
274
              }
275
            }
276
          }
277
        } else {
278
          last = ob;
279
        }
280
      }
281
    } catch (Exception e) {
282
      throw new ExceptionConverter(e);
283
    }
284
  }
285
286
  private void doType1TT() {
287
    PdfObject enc = PdfReader.getPdfObject(font.get(PdfName.ENCODING));
288 1 1. doType1TT : negated conditional → NO_COVERAGE
    if (enc == null) {
289 1 1. doType1TT : removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE
      fillEncoding(null);
290
    } else {
291 1 1. doType1TT : negated conditional → NO_COVERAGE
      if (enc.isName()) {
292 1 1. doType1TT : removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE
        fillEncoding((PdfName) enc);
293
      } else {
294
        PdfDictionary encDic = (PdfDictionary) enc;
295
        enc = PdfReader.getPdfObject(encDic.get(PdfName.BASEENCODING));
296 1 1. doType1TT : negated conditional → NO_COVERAGE
        if (enc == null) {
297 1 1. doType1TT : removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE
          fillEncoding(null);
298
        } else {
299 1 1. doType1TT : removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE
          fillEncoding((PdfName) enc);
300
        }
301
        PdfArray diffs = encDic.getAsArray(PdfName.DIFFERENCES);
302 1 1. doType1TT : negated conditional → NO_COVERAGE
        if (diffs != null) {
303
          diffmap = new IntHashtable();
304
          int currentNumber = 0;
305 3 1. doType1TT : changed conditional boundary → NO_COVERAGE
2. doType1TT : Changed increment from 1 to -1 → NO_COVERAGE
3. doType1TT : negated conditional → NO_COVERAGE
          for (int k = 0; k < diffs.size(); ++k) {
306
            PdfObject obj = diffs.getPdfObject(k);
307 1 1. doType1TT : negated conditional → NO_COVERAGE
            if (obj.isNumber()) {
308
              currentNumber = ((PdfNumber) obj).intValue();
309
            } else {
310
              int[] c = GlyphList.nameToUnicode(PdfName
311
                  .decodeName(obj.toString()));
312 3 1. doType1TT : changed conditional boundary → NO_COVERAGE
2. doType1TT : negated conditional → NO_COVERAGE
3. doType1TT : negated conditional → NO_COVERAGE
              if (c != null && c.length > 0) {
313
                uni2byte.put(c[0], currentNumber);
314
                diffmap.put(c[0], currentNumber);
315
              }
316 1 1. doType1TT : Changed increment from 1 to -1 → NO_COVERAGE
              ++currentNumber;
317
            }
318
          }
319
        }
320
      }
321
    }
322
    PdfArray newWidths = font.getAsArray(PdfName.WIDTHS);
323
    PdfNumber first = font.getAsNumber(PdfName.FIRSTCHAR);
324
    PdfNumber last = font.getAsNumber(PdfName.LASTCHAR);
325 1 1. doType1TT : negated conditional → NO_COVERAGE
    if (BuiltinFonts14.containsKey(fontName)) {
326
      BaseFont bf;
327
      try {
328
        bf = BaseFont.createFont(fontName, WINANSI, false);
329
      } catch (Exception e) {
330
        throw new ExceptionConverter(e);
331
      }
332
      int[] e = uni2byte.toOrderedKeys();
333
      for (int i : e) {
334
        int n = uni2byte.get(i);
335
        widths[n] = bf.getRawWidth(n, GlyphList.unicodeToName(i));
336
      }
337 1 1. doType1TT : negated conditional → NO_COVERAGE
      if (diffmap != null) { //widths for diffmap must override existing ones
338
        e = diffmap.toOrderedKeys();
339
        for (int i : e) {
340
          int n = diffmap.get(i);
341
          widths[n] = bf.getRawWidth(n, GlyphList.unicodeToName(i));
342
        }
343
        diffmap = null;
344
      }
345
      Ascender = bf.getFontDescriptor(ASCENT, 1000);
346
      CapHeight = bf.getFontDescriptor(CAPHEIGHT, 1000);
347
      Descender = bf.getFontDescriptor(DESCENT, 1000);
348
      ItalicAngle = bf.getFontDescriptor(ITALICANGLE, 1000);
349
      llx = bf.getFontDescriptor(BBOXLLX, 1000);
350
      lly = bf.getFontDescriptor(BBOXLLY, 1000);
351
      urx = bf.getFontDescriptor(BBOXURX, 1000);
352
      ury = bf.getFontDescriptor(BBOXURY, 1000);
353
    }
354 3 1. doType1TT : negated conditional → NO_COVERAGE
2. doType1TT : negated conditional → NO_COVERAGE
3. doType1TT : negated conditional → NO_COVERAGE
    if (first != null && last != null && newWidths != null) {
355
      int f = first.intValue();
356 2 1. doType1TT : changed conditional boundary → NO_COVERAGE
2. doType1TT : negated conditional → NO_COVERAGE
      for (int k = 0; k < newWidths.size(); ++k) {
357 1 1. doType1TT : Replaced integer addition with subtraction → NO_COVERAGE
        widths[f + k] = newWidths.getAsNumber(k).intValue();
358
      }
359
    }
360 1 1. doType1TT : removed call to com/lowagie/text/pdf/DocumentFont::fillFontDesc → NO_COVERAGE
    fillFontDesc(font.getAsDict(PdfName.FONTDESCRIPTOR));
361
  }
362
363
  private void fillFontDesc(PdfDictionary fontDesc) {
364 1 1. fillFontDesc : negated conditional → NO_COVERAGE
    if (fontDesc == null) {
365
      return;
366
    }
367
    PdfNumber v = fontDesc.getAsNumber(PdfName.ASCENT);
368 1 1. fillFontDesc : negated conditional → NO_COVERAGE
    if (v != null) {
369
      Ascender = v.floatValue();
370
    }
371
    v = fontDesc.getAsNumber(PdfName.CAPHEIGHT);
372 1 1. fillFontDesc : negated conditional → NO_COVERAGE
    if (v != null) {
373
      CapHeight = v.floatValue();
374
    }
375
    v = fontDesc.getAsNumber(PdfName.DESCENT);
376 1 1. fillFontDesc : negated conditional → NO_COVERAGE
    if (v != null) {
377
      Descender = v.floatValue();
378
    }
379
    v = fontDesc.getAsNumber(PdfName.ITALICANGLE);
380 1 1. fillFontDesc : negated conditional → NO_COVERAGE
    if (v != null) {
381
      ItalicAngle = v.floatValue();
382
    }
383
    PdfArray bbox = fontDesc.getAsArray(PdfName.FONTBBOX);
384 1 1. fillFontDesc : negated conditional → NO_COVERAGE
    if (bbox != null) {
385
      llx = bbox.getAsNumber(0).floatValue();
386
      lly = bbox.getAsNumber(1).floatValue();
387
      urx = bbox.getAsNumber(2).floatValue();
388
      ury = bbox.getAsNumber(3).floatValue();
389 2 1. fillFontDesc : changed conditional boundary → NO_COVERAGE
2. fillFontDesc : negated conditional → NO_COVERAGE
      if (llx > urx) {
390
        float t = llx;
391
        llx = urx;
392
        urx = t;
393
      }
394 2 1. fillFontDesc : changed conditional boundary → NO_COVERAGE
2. fillFontDesc : negated conditional → NO_COVERAGE
      if (lly > ury) {
395
        float t = lly;
396
        lly = ury;
397
        ury = t;
398
      }
399
    }
400
  }
401
402
  private void fillEncoding(PdfName encoding) {
403 2 1. fillEncoding : negated conditional → NO_COVERAGE
2. fillEncoding : negated conditional → NO_COVERAGE
    if (PdfName.MAC_ROMAN_ENCODING.equals(encoding) || PdfName.WIN_ANSI_ENCODING.equals(encoding)) {
404
      byte[] b = new byte[256];
405 3 1. fillEncoding : changed conditional boundary → NO_COVERAGE
2. fillEncoding : Changed increment from 1 to -1 → NO_COVERAGE
3. fillEncoding : negated conditional → NO_COVERAGE
      for (int k = 0; k < 256; ++k) {
406
        b[k] = (byte) k;
407
      }
408
      String enc = WINANSI;
409 1 1. fillEncoding : negated conditional → NO_COVERAGE
      if (PdfName.MAC_ROMAN_ENCODING.equals(encoding)) {
410
        enc = MACROMAN;
411
      }
412
      String cv = PdfEncodings.convertToString(b, enc);
413
      char[] arr = cv.toCharArray();
414 3 1. fillEncoding : changed conditional boundary → NO_COVERAGE
2. fillEncoding : Changed increment from 1 to -1 → NO_COVERAGE
3. fillEncoding : negated conditional → NO_COVERAGE
      for (int k = 0; k < 256; ++k) {
415
        uni2byte.put(arr[k], k);
416
      }
417
    } else {
418 3 1. fillEncoding : changed conditional boundary → NO_COVERAGE
2. fillEncoding : Changed increment from 1 to -1 → NO_COVERAGE
3. fillEncoding : negated conditional → NO_COVERAGE
      for (int k = 0; k < 256; ++k) {
419
        uni2byte.put(stdEnc[k], k);
420
      }
421
    }
422
  }
423
424
  /**
425
   * Gets the family name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language
426
   * ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.<br> For
427
   * the other fonts the array has a single element with {"", "", "", font name}.
428
   *
429
   * @return the family name of the font
430
   */
431
  public String[][] getFamilyFontName() {
432
    return getFullFontName();
433
  }
434
435
  /**
436
   * Gets the font parameter identified by <CODE>key</CODE>. Valid values for <CODE>key</CODE> are <CODE>ASCENT</CODE>,
437
   * <CODE>CAPHEIGHT</CODE>, <CODE>DESCENT</CODE>,
438
   * <CODE>ITALICANGLE</CODE>, <CODE>BBOXLLX</CODE>, <CODE>BBOXLLY</CODE>, <CODE>BBOXURX</CODE>
439
   * and <CODE>BBOXURY</CODE>.
440
   *
441
   * @param key the parameter to be extracted
442
   * @param fontSize the font size in points
443
   * @return the parameter in points
444
   */
445
  public float getFontDescriptor(int key, float fontSize) {
446 1 1. getFontDescriptor : negated conditional → NO_COVERAGE
    if (cjkMirror != null) {
447 1 1. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
      return cjkMirror.getFontDescriptor(key, fontSize);
448
    }
449
    switch (key) {
450
      case AWT_ASCENT:
451
      case ASCENT:
452 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return Ascender * fontSize / 1000;
453
      case CAPHEIGHT:
454 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return CapHeight * fontSize / 1000;
455
      case AWT_DESCENT:
456
      case DESCENT:
457 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return Descender * fontSize / 1000;
458
      case ITALICANGLE:
459 1 1. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return ItalicAngle;
460
      case BBOXLLX:
461 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return llx * fontSize / 1000;
462
      case BBOXLLY:
463 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return lly * fontSize / 1000;
464
      case BBOXURX:
465 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return urx * fontSize / 1000;
466
      case BBOXURY:
467 3 1. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
2. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
3. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return ury * fontSize / 1000;
468
      case AWT_LEADING:
469 1 1. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return 0;
470
      case AWT_MAXADVANCE:
471 4 1. getFontDescriptor : Replaced float subtraction with addition → NO_COVERAGE
2. getFontDescriptor : Replaced float multiplication with division → NO_COVERAGE
3. getFontDescriptor : Replaced float division with multiplication → NO_COVERAGE
4. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
        return (urx - llx) * fontSize / 1000;
472
    }
473 1 1. getFontDescriptor : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE
    return 0;
474
  }
475
476
  /**
477
   * Gets the full name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language ID,
478
   * font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.<br> For the
479
   * other fonts the array has a single element with {"", "", "", font name}.
480
   *
481
   * @return the full name of the font
482
   */
483
  public String[][] getFullFontName() {
484 1 1. getFullFontName : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::getFullFontName to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
    return new String[][]{{"", "", "", fontName}};
485
  }
486
487
  /**
488
   * Gets all the entries of the names-table. If it is a True Type font each array element will have {Name ID, Platform ID, Platform
489
   * Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the
490
   * 'name' table.<br> For the other fonts the array has a single element with {"4", "", "", "", font name}.
491
   *
492
   * @return the full name of the font
493
   * @since 2.0.8
494
   */
495
  public String[][] getAllNameEntries() {
496 1 1. getAllNameEntries : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::getAllNameEntries to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
    return new String[][]{{"4", "", "", "", fontName}};
497
  }
498
499
  /**
500
   * Gets the kerning between two Unicode chars.
501
   *
502
   * @param char1 the first char
503
   * @param char2 the second char
504
   * @return the kerning to be applied
505
   */
506
  public int getKerning(int char1, int char2) {
507
    return 0;
508
  }
509
510
  /**
511
   * Gets the postscript font name.
512
   *
513
   * @return the postscript font name
514
   */
515
  public String getPostscriptFontName() {
516
    return fontName;
517
  }
518
519
  /**
520
   * Gets the width from the font according to the Unicode char <CODE>c</CODE> or the <CODE>name</CODE>. If the <CODE>name</CODE> is null
521
   * it's a symbolic font.
522
   *
523
   * @param c the unicode char
524
   * @param name the glyph name
525
   * @return the width of the char
526
   */
527
  int getRawWidth(int c, String name) {
528
    return 0;
529
  }
530
531
  /**
532
   * Checks if the font has any kerning pairs.
533
   *
534
   * @return <CODE>true</CODE> if the font has any kerning pairs
535
   */
536
  public boolean hasKernPairs() {
537
    return false;
538
  }
539
540
  /**
541
   * Outputs to the writer the font dictionaries and streams.
542
   *
543
   * @param writer the writer for this document
544
   * @param ref the font indirect reference
545
   * @param params several parameters that depend on the font type
546
   * @throws DocumentException error in generating the object
547
   */
548
  void writeFont(PdfWriter writer, PdfIndirectReference ref, Object[] params) throws DocumentException {
549
  }
550
551
  /**
552
   * Always returns null.
553
   *
554
   * @return null
555
   * @since 2.1.3
556
   */
557
  public PdfStream getFullFontStream() {
558
    return null;
559
  }
560
561
  /**
562
   * Gets the width of a <CODE>char</CODE> in normalized 1000 units.
563
   *
564
   * @param char1 the unicode <CODE>char</CODE> to get the width of
565
   * @return the width in normalized 1000 units
566
   */
567
  public int getWidth(int char1) {
568 1 1. getWidth : negated conditional → NO_COVERAGE
    if (cjkMirror != null) {
569 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return cjkMirror.getWidth(char1);
570 1 1. getWidth : negated conditional → NO_COVERAGE
    } else if (isType0) {
571
      int[] ws = metrics.get(char1);
572 1 1. getWidth : negated conditional → NO_COVERAGE
      if (ws != null) {
573 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return ws[1];
574
      } else {
575 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return 0;
576
      }
577
    } else {
578 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return super.getWidth(char1);
579
    }
580
  }
581
582
  public int getWidth(String text) {
583 1 1. getWidth : negated conditional → NO_COVERAGE
    if (cjkMirror != null) {
584 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return cjkMirror.getWidth(text);
585 1 1. getWidth : negated conditional → NO_COVERAGE
    } else if (isType0) {
586
      char[] chars = text.toCharArray();
587
      int total = 0;
588
      for (char aChar : chars) {
589
        int[] ws = metrics.get(aChar);
590 1 1. getWidth : negated conditional → NO_COVERAGE
        if (ws != null) {
591 1 1. getWidth : Replaced integer addition with subtraction → NO_COVERAGE
          total += ws[1];
592
        }
593
      }
594 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return total;
595
    } else {
596 1 1. getWidth : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return super.getWidth(text);
597
    }
598
  }
599
600
  byte[] convertToBytes(String text) {
601 1 1. convertToBytes : negated conditional → NO_COVERAGE
    if (cjkMirror != null) {
602 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
      return PdfEncodings.convertToBytes(text, CJKFont.CJK_ENCODING);
603 1 1. convertToBytes : negated conditional → NO_COVERAGE
    } else if (isType0) {
604
      char[] chars = text.toCharArray();
605
      int len = chars.length;
606 1 1. convertToBytes : Replaced integer multiplication with division → NO_COVERAGE
      byte[] b = new byte[len * 2];
607
      int bptr = 0;
608
      for (char aChar : chars) {
609
        int[] ws = metrics.get(aChar);
610 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (ws != null) {
611
          int g = ws[0];
612 2 1. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
2. convertToBytes : Replaced integer division with multiplication → NO_COVERAGE
          b[bptr++] = (byte) (g / 256);
613 1 1. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
          b[bptr++] = (byte) (g);
614
        }
615
      }
616 1 1. convertToBytes : negated conditional → NO_COVERAGE
      if (bptr == b.length) {
617 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return b;
618
      } else {
619
        byte[] nb = new byte[bptr];
620 1 1. convertToBytes : removed call to java/lang/System::arraycopy → NO_COVERAGE
        System.arraycopy(b, 0, nb, 0, bptr);
621 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return nb;
622
      }
623
    } else {
624
      char[] cc = text.toCharArray();
625
      byte[] b = new byte[cc.length];
626
      int ptr = 0;
627
      for (char c : cc) {
628 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (uni2byte.containsKey(c)) {
629 1 1. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
          b[ptr++] = (byte) uni2byte.get(c);
630
        }
631
      }
632 1 1. convertToBytes : negated conditional → NO_COVERAGE
      if (ptr == b.length) {
633 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return b;
634
      } else {
635
        byte[] b2 = new byte[ptr];
636 1 1. convertToBytes : removed call to java/lang/System::arraycopy → NO_COVERAGE
        System.arraycopy(b, 0, b2, 0, ptr);
637 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return b2;
638
      }
639
    }
640
  }
641
642
  byte[] convertToBytes(int char1) {
643 1 1. convertToBytes : negated conditional → NO_COVERAGE
    if (cjkMirror != null) {
644 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
      return PdfEncodings.convertToBytes((char) char1, CJKFont.CJK_ENCODING);
645 1 1. convertToBytes : negated conditional → NO_COVERAGE
    } else if (isType0) {
646
      int[] ws = metrics.get(char1);
647 1 1. convertToBytes : negated conditional → NO_COVERAGE
      if (ws != null) {
648
        int g = ws[0];
649 2 1. convertToBytes : Replaced integer division with multiplication → NO_COVERAGE
2. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new byte[]{(byte) (g / 256), (byte) (g)};
650
      } else {
651 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new byte[0];
652
      }
653
    } else {
654 1 1. convertToBytes : negated conditional → NO_COVERAGE
      if (uni2byte.containsKey(char1)) {
655 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new byte[]{(byte) uni2byte.get(char1)};
656
      } else {
657 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/DocumentFont::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new byte[0];
658
      }
659
    }
660
  }
661
662
  PdfIndirectReference getIndirectReference() {
663
    return refFont;
664
  }
665
666
  public boolean charExists(int c) {
667 1 1. charExists : negated conditional → NO_COVERAGE
    if (cjkMirror != null) {
668 1 1. charExists : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return cjkMirror.charExists(c);
669 1 1. charExists : negated conditional → NO_COVERAGE
    } else if (isType0) {
670 1 1. charExists : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return metrics.containsKey(c);
671
    } else {
672 1 1. charExists : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
      return super.charExists(c);
673
    }
674
  }
675
676
  /**
677
   * Sets the font name that will appear in the pdf font dictionary. It does nothing in this case as the font is already in the document.
678
   *
679
   * @param name the new font name
680
   */
681
  public void setPostscriptFontName(String name) {
682
  }
683
684
  public boolean setKerning(int char1, int char2, int kern) {
685
    return false;
686
  }
687
688
  public int[] getCharBBox(int c) {
689
    return null;
690
  }
691
692
  protected int[] getRawCharBBox(int c, String name) {
693
    return null;
694
  }
695
696
  /**
697
   * Exposes the unicode - > CID map that is constructed from the font's encoding
698
   *
699
   * @return the unicode to CID map
700
   * @since 2.1.7
701
   */
702
  IntHashtable getUni2Byte() {
703
    return uni2byte;
704
  }
705
}

Mutations

119

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

125

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

126

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::doType1TT → NO_COVERAGE

128

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

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

3.3
Location :
Killed by : none
negated conditional → NO_COVERAGE

129

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

140

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

142

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

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

3.3
Location :
Killed by : none
negated conditional → NO_COVERAGE

143

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

145

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

146

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

156

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

157

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::processType0 → NO_COVERAGE

171

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

176

1.1
Location : processType0
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillFontDesc → NO_COVERAGE

177

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

178

1.1
Location : processType0
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillMetrics → NO_COVERAGE

188

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

189

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

191

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

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

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

193

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

194

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

196

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

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

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

198

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

202

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

203

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

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

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

208

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

212

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

213

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

215

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

224

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

225

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

226

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

228

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

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

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

231

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

233

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

235

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

241

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

243

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

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

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

249

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

251

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

252

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

253

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

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

3.3
Location : fillMetrics
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

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

255

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

263

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

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

3.3
Location : fillMetrics
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

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

265

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

266

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

268

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

288

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

289

1.1
Location : doType1TT
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE

291

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

292

1.1
Location : doType1TT
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE

296

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

297

1.1
Location : doType1TT
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE

299

1.1
Location : doType1TT
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillEncoding → NO_COVERAGE

302

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

305

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

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

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

307

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

312

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

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

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

316

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

325

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

337

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

354

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

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

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

356

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

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

357

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

360

1.1
Location : doType1TT
Killed by : none
removed call to com/lowagie/text/pdf/DocumentFont::fillFontDesc → NO_COVERAGE

364

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

368

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

372

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

376

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

380

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

384

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

389

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

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

394

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

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

403

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

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

405

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

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

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

409

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

414

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

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

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

418

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

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

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

446

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

447

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

452

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

454

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

457

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

459

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

461

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

463

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

465

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

467

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

2.2
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

469

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

471

1.1
Location : getFontDescriptor
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

2.2
Location : getFontDescriptor
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

3.3
Location : getFontDescriptor
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

4.4
Location : getFontDescriptor
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/DocumentFont::getFontDescriptor → NO_COVERAGE

473

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

484

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

496

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

568

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

569

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

570

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

572

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

573

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

575

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

578

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

583

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

584

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

585

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

590

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

591

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

594

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

596

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

601

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

602

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

603

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

606

1.1
Location : convertToBytes
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

610

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

612

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

2.2
Location : convertToBytes
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

613

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

616

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

617

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

620

1.1
Location : convertToBytes
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

621

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

628

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

629

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

632

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

633

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

636

1.1
Location : convertToBytes
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

637

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

643

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

644

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

645

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

647

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

649

1.1
Location : convertToBytes
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

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

651

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

654

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

655

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

657

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

667

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

668

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

669

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

670

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

672

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

Active mutators

Tests examined


Report generated by PIT 1.4.2