Exemple #1
0
        /**
         * Returns a FontDescriptor for the given AFM. Used only for Standard 14 fonts.
         *
         * @param metrics AFM
         */
        public static FontDescriptor BuildFontDescriptor(FontMetrics metrics)
        {
            bool isSymbolic = metrics.EncodingScheme.Equals("FontSpecific", StringComparison.Ordinal);

            FontDescriptor fd = new FontDescriptor();

            fd.FontName    = metrics.FontName;
            fd.FontFamily  = metrics.FamilyName;
            fd.NonSymbolic = !isSymbolic;
            fd.Symbolic    = isSymbolic;
            fd.FontBBox    = new Rectangle(metrics.FontBBox);
            fd.ItalicAngle = metrics.ItalicAngle;
            fd.Ascent      = metrics.Ascender;
            fd.Descent     = metrics.Descender;
            fd.CapHeight   = metrics.CapHeight;
            fd.XHeight     = metrics.XHeight;
            fd.AvgWidth    = metrics.GetAverageCharacterWidth();
            fd.CharSet     = metrics.CharacterSet;
            fd.StemV       = 0; // for PDF/A
            return(fd);
        }