예제 #1
0
        /// <summary>
        /// Initializes a new instance of the standard font with specified properties.
        /// </summary>
        /// <param name="standardFont">The Bytescout.PDF.StandardFonts value that specifies the standard font.</param>
        /// <param name="emSize" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The em-size, in points, of the font.</param>
        /// <param name="underline" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be underlined.</param>
        /// <param name="strikeout" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be stroked out.</param>
        public Font(StandardFonts standardFont, float emSize, bool underline, bool strikeout)
        {
            if (emSize < 0)
            {
                throw new ArgumentOutOfRangeException("emSize");
            }

            _baseFont  = FontsManager.AddStandardFont(standardFont, underline, strikeout);
            _size      = emSize;
            _bold      = _baseFont.RealBold;
            _italic    = _baseFont.RealItalic;
            _underline = underline;
            _strikeout = strikeout;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new Bytescout.PDF.Font using a specified properties.
        /// </summary>
        /// <param name="fontName" href="http://msdn.microsoft.com/en-us/library/system.string.aspx">The name of the font.</param>
        /// <param name="emSize" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The em-size, in points, of the font.</param>
        /// <param name="bold" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be bold.</param>
        /// <param name="italic" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be italic.</param>
        /// <param name="underline" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be underlined.</param>
        /// <param name="strikeout" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be stroked out.</param>
        public Font(string fontName, float emSize, bool bold, bool italic, bool underline, bool strikeout)
        {
            if (emSize < 0)
            {
                throw new ArgumentOutOfRangeException("emSize");
            }

            _baseFont  = FontsManager.AddFont(fontName, bold, italic);
            _strikeout = strikeout;
            _underline = underline;
            _size      = emSize;
            _bold      = bold;
            _italic    = italic;
        }
예제 #3
0
        /// <summary>
        /// Creates a Bytescout.PDF.Font from the specified data stream.
        /// </summary>
        /// <param name="stream" href="http://msdn.microsoft.com/en-us/library/system.io.stream.aspx">A System.IO.Stream that contains the data for this Bytescout.PDF.Font.</param>
        /// <param name="emSize" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The em-size, in points, of the font.</param>
        /// <param name="underline" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be underlined.</param>
        /// <param name="strikeout" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be stroked out.</param>
        /// <returns cref="Font">The Bytescout.PDF.Font this method creates.</returns>
        public static Font FromStream(System.IO.Stream stream, float emSize, bool underline, bool strikeout)
        {
            if (emSize < 0)
            {
                throw new ArgumentOutOfRangeException("emSize");
            }

            FontBase fnt  = FontsManager.AddFontFromStream(stream);
            Font     font = new Font(fnt);

            font._strikeout = strikeout;
            font._underline = underline;
            font.Size       = emSize;
            return(font);
        }
예제 #4
0
        /// <summary>
        /// Creates a Bytescout.PDF.Font from the specified file.
        /// </summary>
        /// <param name="fileName" href="http://msdn.microsoft.com/en-us/library/system.string.aspx">A string that contains the name of the file from which to create the Bytescout.PDF.Font.</param>
        /// <param name="emSize" href="http://msdn.microsoft.com/en-us/library/system.single.aspx">The em-size, in points, of the font.</param>
        /// <param name="underline" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be underlined.</param>
        /// <param name="strikeout" href="http://msdn.microsoft.com/en-us/library/system.boolean.aspx">If set to true, the initialized font will be stroked out.</param>
        /// <returns cref="Font">The Bytescout.PDF.Font this method creates.</returns>
        public static Font FromFile(string fileName, float emSize, bool underline, bool strikeout)
        {
            if (emSize < 0)
            {
                throw new ArgumentOutOfRangeException("emSize");
            }

            FontBase fnt  = FontsManager.AddFontFromFile(fileName);
            Font     font = new Font(fnt);

            font._strikeout = strikeout;
            font._underline = underline;
            font.Size       = emSize;
            return(font);
        }