PdfSimpleFont extends PdfFont { @Override public int appendAnyGlyph(String text, int from, List<Glyph> glyphs) { Glyph glyph; if (fontEncoding.isFontSpecific()) { glyph = fontProgram.getGlyphByCode(text.charAt(from)); } else { glyph = getGlyph((int) text.charAt(from)); } if (glyph != null) { glyphs.add(glyph); } return 1; } protected  PdfSimpleFont(PdfDictionary fontDictionary); protected  PdfSimpleFont(); @Override boolean isBuiltWith(String fontProgram, String encoding); @Override GlyphLine createGlyphLine(String content); @Override int appendGlyphs(String text, int from, int to, List<Glyph> glyphs); @Override int appendAnyGlyph(String text, int from, List<Glyph> glyphs); FontEncoding getFontEncoding(); @Override byte[] convertToBytes(String text); @Override byte[] convertToBytes(GlyphLine glyphLine); @Override byte[] convertToBytes(Glyph glyph); @Override void writeText(GlyphLine text, int from, int to, PdfOutputStream stream); @Override void writeText(String text, PdfOutputStream stream); @Override String decode(PdfString content); @Override GlyphLine decodeIntoGlyphLine(PdfString content); @Override float getContentWidth(PdfString content); boolean isForceWidthsOutput(); void setForceWidthsOutput(boolean forceWidthsOutput);  }
@Test public void appendAnyGlyphWithSpecificEncodingTest() throws IOException { PdfSimpleFont<FontProgram> fontToTest = new TestSimpleFont(FontEncoding.createFontSpecificEncoding()); List<Glyph> toAppend = new ArrayList<>(); int processed = fontToTest.appendAnyGlyph("te", 0, toAppend); Assert.assertEquals(1, processed); List<Glyph> glyphs = new ArrayList<>(); glyphs.add(T_GLYPH_FONT_SPECIFIC); Assert.assertEquals(glyphs, toAppend); }
@Test public void appendAnyGlyphWithEmptyEncodingTest() throws IOException { PdfSimpleFont<FontProgram> fontToTest = new TestSimpleFont(FontEncoding.createEmptyFontEncoding()); List<Glyph> toAppend = new ArrayList<>(); int processed = fontToTest.appendAnyGlyph("e ete", 0, toAppend); Assert.assertEquals(1, processed); List<Glyph> glyphs = new ArrayList<>(); glyphs.add(E_GLYPH_CUSTOM_MAPPED); Assert.assertEquals(glyphs, toAppend); }