/// <exception cref="System.IO.IOException"/>
        private static FontProgramDescriptor FetchTTCDescriptor(String baseName)
        {
            int ttcSplit = baseName.ToLowerInvariant().IndexOf(".ttc,", StringComparison.Ordinal);

            if (ttcSplit > 0)
            {
                String ttcName;
                int    ttcIndex;
                try {
                    ttcName = baseName.JSubstring(0, ttcSplit + 4);
                    // count(.ttc) = 4
                    ttcIndex = Convert.ToInt32(baseName.Substring(ttcSplit + 5));
                }
                catch (FormatException nfe) {
                    // count(.ttc,) = 5)
                    throw new iText.IO.IOException(nfe.Message, nfe);
                }
                OpenTypeParser        parser     = new OpenTypeParser(ttcName, ttcIndex);
                FontProgramDescriptor descriptor = FetchOpenTypeFontDescriptor(parser);
                parser.Close();
                return(descriptor);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Close()
 {
     if (fontParser != null)
     {
         fontParser.Close();
     }
     fontParser = null;
 }
예제 #3
0
 /// <exception cref="System.IO.IOException"/>
 internal TrueTypeFont(String ttcPath, int ttcIndex)
 {
     fontParser = new OpenTypeParser(ttcPath, ttcIndex);
     fontParser.LoadTables(true);
     InitializeFontProperties();
 }
예제 #4
0
 /// <exception cref="System.IO.IOException"/>
 public TrueTypeFont(byte[] ttf)
 {
     fontParser = new OpenTypeParser(ttf);
     fontParser.LoadTables(true);
     InitializeFontProperties();
 }
예제 #5
0
 /// <exception cref="System.IO.IOException"/>
 public TrueTypeFont(String path)
 {
     fontParser = new OpenTypeParser(path);
     fontParser.LoadTables(true);
     InitializeFontProperties();
 }
예제 #6
0
 /// <exception cref="System.IO.IOException"/>
 internal TrueTypeFont(byte[] ttc, int ttcIndex)
 {
     fontParser = new OpenTypeParser(ttc, ttcIndex);
     fontParser.LoadTables(true);
     InitializeFontProperties();
 }
 /// <exception cref="System.IO.IOException"/>
 private static FontProgramDescriptor FetchOpenTypeFontDescriptor(OpenTypeParser fontParser)
 {
     fontParser.LoadTables(false);
     return(new FontProgramDescriptor(fontParser.GetFontNames(), fontParser.GetPostTable().italicAngle, fontParser
                                      .GetPostTable().isFixedPitch));
 }
 /// <exception cref="System.IO.IOException"/>
 private static FontProgramDescriptor FetchTrueTypeFontDescriptor(byte[] fontProgram)
 {
     using (OpenTypeParser parser = new OpenTypeParser(fontProgram)) {
         return(FetchOpenTypeFontDescriptor(parser));
     }
 }
예제 #9
0
 /// <exception cref="System.IO.IOException"/>
 private TrueTypeFont(OpenTypeParser fontParser)
 {
     this.fontParser = fontParser;
     this.fontParser.LoadTables(true);
     InitializeFontProperties();
 }
예제 #10
0
 /// <exception cref="System.IO.IOException"/>
 internal TrueTypeFont(String ttcPath, int ttcIndex)
 {
     CheckFilePath(ttcPath);
     fontParser = new OpenTypeParser(ttcPath, ttcIndex);
     InitializeFontProperties();
 }
예제 #11
0
 /// <exception cref="System.IO.IOException"/>
 public TrueTypeFont(String path)
 {
     CheckFilePath(path);
     fontParser = new OpenTypeParser(path);
     InitializeFontProperties();
 }