Ejemplo n.º 1
0
        /**
         * <summary>Loads the font metrics.</summary>
         */
        private void Load(
            string fontName
            )
        {
            Stream fontMetricsStream = null;

            try
            {
                fontMetricsStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("fonts.afm." + fontName);

                AfmParser parser = new AfmParser(new bytes::Stream(fontMetricsStream));
                metrics       = parser.Metrics;
                symbolic      = metrics.IsCustomEncoding;
                glyphIndexes  = parser.GlyphIndexes;
                glyphKernings = parser.GlyphKernings;
                glyphWidths   = parser.GlyphWidths;
            }
            catch (Exception e)
            { throw new Exception("Failed to load '" + fontName + "'.", e); }
            finally
            {
                if (fontMetricsStream != null)
                {
                    fontMetricsStream.Close();
                }
            }
        }
Ejemplo n.º 2
0
 /**
  * <summary>Loads the font metrics.</summary>
  */
 private void Load(
     string fontName
     )
 {
     try
     {
         using (var fontMetricsStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("fonts.afm." + fontName))
         {
             AfmParser parser = new AfmParser(new bytes::Stream(fontMetricsStream));
             metrics       = parser.Metrics;
             symbolic      = metrics.IsCustomEncoding;
             glyphIndexes  = parser.GlyphIndexes;
             glyphKernings = parser.GlyphKernings;
             glyphWidths   = parser.GlyphWidths;
         }
     }
     catch (Exception e)
     { throw new Exception(String.Format("Failed to load '{0}'", fontName), e); }
 }
Ejemplo n.º 3
0
        /**
          <summary>Loads the font metrics.</summary>
        */
        private void Load(
      string fontName
      )
        {
            Stream fontMetricsStream = null;
              try
              {
            fontMetricsStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("fonts.afm." + fontName);

            AfmParser parser = new AfmParser(new bytes::Stream(fontMetricsStream));
            metrics = parser.Metrics;
            symbolic = metrics.IsCustomEncoding;
            glyphIndexes = parser.GlyphIndexes;
            glyphKernings = parser.GlyphKernings;
            glyphWidths = parser.GlyphWidths;
              }
              catch(Exception e)
              {throw new Exception("Failed to load '" + fontName + "'.",e);}
              finally
              {
            if(fontMetricsStream != null)
            {fontMetricsStream.Close();}
              }
        }