Skip to content

Commit

Permalink
Tests were using deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsteiner1984 committed Jun 25, 2024
1 parent a74500f commit fbe5d54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ public void testMappingNotFound() throws IOException {
MyFOPPDFMultiByteFont multiByteFont = new MyFOPPDFMultiByteFont(fontDict, null);
PDType0Font font = (PDType0Font) multiByteFont.getFontContainer().getFont();
GlyphTable glyphTable = ((PDCIDFontType2)font.getDescendantFont()).getTrueTypeFont().getGlyph();
glyphTable.setGlyphs(new GlyphData[glyphTable.getGlyphs().length - 1]);
glyphTable.setGlyphs(
new GlyphData[((PDCIDFontType2) font.getDescendantFont()).getTrueTypeFont().getNumberOfGlyphs() - 1]);
IOException ex = Assert.assertThrows(IOException.class, () -> multiByteFont.addFont(fontDict));
Assert.assertEquals(ex.getMessage(), "Mapping not found in glyphData");
pdf.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,8 @@ public void testReorderGlyphs() throws IOException {
TTFParser parser = new TTFParser(true);
TrueTypeFont trueTypeFont = parser.parse(inputStream);
int i = 0;
for (GlyphData glyphData : trueTypeFont.getGlyph().getGlyphs()) {
for (int gid = 0; gid < trueTypeFont.getNumberOfGlyphs(); gid++) {
GlyphData glyphData = trueTypeFont.getGlyph().getGlyph(gid);
if (glyphData != null && glyphData.getDescription().isComposite()) {
compositeList.add(i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void setFilterMap(PDFDocument doc) {
private COSStream getStream() throws IOException {
COSStream stream = new COSStream();
stream.setItem(COSName.SUBTYPE, COSName.FORM);
try (OutputStream os = stream.createUnfilteredStream()) {
try (OutputStream os = stream.createOutputStream()) {
os.write("/a tf".getBytes(PDFDocument.ENCODING));
}
return stream;
Expand Down

0 comments on commit fbe5d54

Please sign in to comment.