PdfSimpleFont extends PdfFont { @Override public GlyphLine createGlyphLine(String content) { List<Glyph> glyphs = new ArrayList<>(content.length()); if (fontEncoding.isFontSpecific()) { for (int i = 0; i < content.length(); i++) { Glyph glyph = fontProgram.getGlyphByCode(content.charAt(i)); if (glyph != null) { glyphs.add(glyph); } } } else { for (int i = 0; i < content.length(); i++) { Glyph glyph = getGlyph((int) content.charAt(i)); if (glyph != null) { glyphs.add(glyph); } } } return new GlyphLine(glyphs); } 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 createGlyphLineWithSpecificEncodingTest() throws IOException { PdfSimpleFont<FontProgram> fontToTest = new TestSimpleFont(FontEncoding.createFontSpecificEncoding()); GlyphLine glyphLine = fontToTest.createGlyphLine("te"); List<Glyph> glyphs = new ArrayList<>(); glyphs.add(T_GLYPH_FONT_SPECIFIC); glyphs.add(E_GLYPH_FONT_SPECIFIC); GlyphLine expected = new GlyphLine(glyphs, 0, 2); Assert.assertEquals(expected, glyphLine); }
@Test public void createGlyphLineWithEmptyEncodingTest() throws IOException { PdfSimpleFont<FontProgram> fontToTest = new TestSimpleFont(FontEncoding.createEmptyFontEncoding()); GlyphLine glyphLine = fontToTest.createGlyphLine("te"); List<Glyph> glyphs = new ArrayList<>(); glyphs.add(E_GLYPH_CUSTOM_MAPPED); GlyphLine expected = new GlyphLine(glyphs, 0, 1); Assert.assertEquals(expected, glyphLine); }