/// <summary>Creates a Type 3 font.</summary> /// <param name="colorized">defines whether the glyph color is specified in the glyph descriptions in the font. /// </param> internal PdfType3Font(PdfDocument document, bool colorized) : base() { MakeIndirect(document); subset = true; embedded = true; fontProgram = new Type3Font(colorized); fontEncoding = FontEncoding.CreateEmptyFontEncoding(); }
public virtual void ConvertGlyphToBytesWithCustomEncodingTest() { FontEncoding emptyFontEncoding = FontEncoding.CreateEmptyFontEncoding(); emptyFontEncoding.AddSymbol(E_CUSTOM_CODE, E_CODE); PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(emptyFontEncoding); byte[] bytes = fontToTest.ConvertToBytes(E_GLYPH_FONT_SPECIFIC); NUnit.Framework.Assert.AreEqual(new byte[] { E_CUSTOM_CODE }, bytes); }
public virtual void WriteTextGlyphLineWithCustomEncodingTest() { FontEncoding fontEncoding = FontEncoding.CreateEmptyFontEncoding(); fontEncoding.AddSymbol(E_CUSTOM_CODE, E_CODE); PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(fontEncoding); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(E_GLYPH_FONT_SPECIFIC); glyphs.Add(T_GLYPH_FONT_SPECIFIC); GlyphLine glyphLine = new GlyphLine(glyphs, 0, 2); MemoryStream bos = new MemoryStream(); using (PdfOutputStream pos = new PdfOutputStream(bos)) { fontToTest.WriteText(glyphLine, 0, 1, pos); } NUnit.Framework.Assert.AreEqual(new byte[] { OPEN_BRACKET_CODE, E_CUSTOM_CODE, CLOSE_BRACKET_CODE }, bos.ToArray ()); }
public virtual void CreateGlyphLineWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); GlyphLine glyphLine = fontToTest.CreateGlyphLine("te"); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(E_GLYPH_CUSTOM_MAPPED); GlyphLine expected = new GlyphLine(glyphs, 0, 1); NUnit.Framework.Assert.AreEqual(expected, glyphLine); }
public virtual void ConvertGlyphToBytesWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); byte[] bytes = fontToTest.ConvertToBytes(E_GLYPH_FONT_SPECIFIC); NUnit.Framework.Assert.AreEqual(new byte[0], bytes); }
public virtual void ConvertToBytesWithNullEntry() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); byte[] bytes = fontToTest.ConvertToBytes((GlyphLine)null); NUnit.Framework.Assert.AreEqual(new byte[0], bytes); }
public virtual void ConvertGlyphLineToBytesWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(T_GLYPH_FONT_SPECIFIC); glyphs.Add(E_GLYPH_FONT_SPECIFIC); GlyphLine glyphLine = new GlyphLine(glyphs, 0, 2); byte[] bytes = fontToTest.ConvertToBytes(glyphLine); NUnit.Framework.Assert.AreEqual(new byte[0], bytes); }
public virtual void AppendAnyGlyphWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); IList <Glyph> toAppend = new List <Glyph>(); int processed = fontToTest.AppendAnyGlyph("e ete", 0, toAppend); NUnit.Framework.Assert.AreEqual(1, processed); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(E_GLYPH_CUSTOM_MAPPED); NUnit.Framework.Assert.AreEqual(glyphs, toAppend); }