//------------------------------------------------------------------------------------------xx.03.2006 /// <summary>Gets a font definition for the specified standard font.</summary> /// <param name="report">Report to which this font belongs</param> /// <param name="sFontName">Standard font enumeration value</param> /// <param name="fontType"></param> /// <returns>Font definition for the specified standard font</returns> /// <remarks> /// If the font is already registered, the handle of the registered font definition will be returned. /// </remarks> private static FontDef fontDef_Check(Report report, String sFontName, FontType fontType) { if (sFontName == null) { throw new ArgumentNullException("sFontName", "font name must be specified"); } #if Framework2 FontDef fontDef; if (report.dict_FontDef.TryGetValue(sFontName, out fontDef)) { if (fontDef.fontType != fontType) { throw new ReportException(String.Format("Font '{0}' has been defined as '{1}' font.", sFontName, fontDef.fontType.ToString("G"))); } return(fontDef); } #else FontDef fontDef = (FontDef)report.dict_FontDef[sFontName]; if (fontDef != null) { if (fontDef.fontType != fontType) { throw new ReportException(String.Format("Font '{0}' has been defined as '{1}' font.", sFontName, fontDef.fontType.ToString("G"))); } return(fontDef); } #endif return(null); }
/// <summary> /// Procedimento que dispara a geração dos relatórios. /// </summary> private void GerarTermo() { Guid g; g = Guid.NewGuid(); this.ReportCadastro = new Root.Reports.Report(new Root.Reports.PdfFormatter()); this.FontDefin = new Root.Reports.FontDef(this.ReportCadastro, Root.Reports.FontDef.StandardFont.Helvetica); this.FontProp = new Root.Reports.FontProp(this.FontDefin, 7); this.NovaPagina(0); this.EscreverTermo(); //this.fileNamePDF = string.Format("TermoAdesao-{0}.pdf", this.GetIdCliente.ToString()); this.fileNamePDF = g.ToString(); if (this.SitemaOrigem == SistemaOrigem.Portal) { this.ReportCadastro.Save(string.Concat(this.GetEnderecoArquivoPortal, "\\", fileNamePDF)); } else { this.ReportCadastro.Save(string.Concat(this.GetEnderecoArquivoIntranet, "\\", fileNamePDF)); } }
//------------------------------------------------------------------------------------------06.03.2005 /// <summary></summary> /// <param name="fontDef">Font definition</param> /// <param name="fontStyle">Font style</param> /// <param name="encoding">Encoding to be applied to this font</param> internal FontData(FontDef fontDef, FontStyle fontStyle, Encoding encoding) { this.fontDef = fontDef; this.fontStyle = fontStyle; this.encoding = encoding; this.bEmbed = false; }
//------------------------------------------------------------------------------------------xx.03.2006 /// <summary>Gets a font definition for the specified standard font.</summary> /// <param name="report">Report to which this font belongs</param> /// <param name="sFontName">TTF font name</param> /// <returns>Font definition for the specified standard font</returns> /// <remarks> /// If the font is already registered, the handle of the registered font definition will be returned. /// </remarks> public static FontDef fontDef_FromTTF(Report report, String sFontName) { FontDef fontDef = fontDef_Check(report, sFontName, FontType.TTF); if (fontDef != null) { return(fontDef); } return(new FontDef(report, sFontName, FontType.TTF)); }
//------------------------------------------------------------------------------------------xx.03.2006 #region Static //---------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------xx.03.2006 /// <overloads> /// <summary>Gets a font definition.</summary> /// <remarks> /// If the font is already registered, the handle of the registered font definition will be returned. /// </remarks> /// </overloads> /// /// <summary>Gets a font definition for the specified font name.</summary> /// <param name="report">Report to which this font belongs</param> /// <param name="sFontName">Name of the font family</param> /// <returns>Font definition for the specified font family</returns> /// <remarks> /// If the font is already registered, the handle of the registered font definition will be returned. /// </remarks> public static FontDef fontDef_FromName(Report report, String sFontName) { FontDef fontDef = fontDef_Check(report, sFontName, FontType.InternalAFM); if (fontDef != null) { return(fontDef); } return(new FontDef(report, sFontName)); }
//------------------------------------------------------------------------------------------xx.03.2006 /// <summary>Gets a font definition for the specified standard font.</summary> /// <param name="report">Report to which this font belongs</param> /// <param name="standardFont">Standard font enumeration value</param> /// <returns>Font definition for the specified standard font</returns> /// <remarks> /// If the font is already registered, the handle of the registered font definition will be returned. /// </remarks> public static FontDef fontDef_FromName(Report report, StandardFont standardFont) { String sFontName = sGetFontName(report, standardFont); FontDef fontDef = fontDef_Check(report, sFontName, FontType.InternalAFM); if (fontDef != null) { return(fontDef); } return(new FontDef(report, standardFont)); }
/// <summary>Creates the type 1 font data object.</summary> /// <param name="stream">AFM definition stream</param> /// <param name="style">Font style</param> /// <param name="bEmbedded"><see langword="true"/> if the font must be embedded in the PDF file</param> internal OpenTypeFontData(FontDef fontDef, FontStyle fontStyle) : base(fontDef, fontStyle, FontData.Encoding.Cp1252) { this.fontDef = fontDef; RegistryKey registryKey_CurrentVersion = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"); if (registryKey_CurrentVersion == null) { throw new ReportException("Cannot find the directory of the font files"); } String sSystemRoot = (String)registryKey_CurrentVersion.GetValue("SystemRoot"); RegistryKey registryKey_Font = registryKey_CurrentVersion.OpenSubKey(@"Fonts"); if (registryKey_Font == null) { throw new ReportException("Cannot find the definition of the font"); } String sFontFileName = (String)registryKey_Font.GetValue(fontDef.sFontName + " (TrueType)"); String s = sFontFileName.ToLower(); if (s.EndsWith(".ttc")) { bTrueTypeCollection = true; } else if (!(s.EndsWith(".ttf") || s.EndsWith(".otf"))) { throw new ReportException("'" + fontDef.sFontName + "' is not a TTF, OTF or TTC font."); } sFontFileName = Path.Combine(sSystemRoot, @"Fonts\" + sFontFileName); using (OpenTypeReader openTypeReader = new OpenTypeReader(sFontFileName)) { ReadFontDataFromFile(openTypeReader); } }
//------------------------------------------------------------------------------------------28.07.2006 /// <summary>Creates a new font property object with the specified size (in points).</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSizePoint">Size of the font in points.</param> /// <remarks> /// The default color of the font is black. /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in points. /// </remarks> /// <example><see cref="FontPropPoint">FontPropPoint constructor sample</see></example> public FontPropPoint(FontDef fontDef, Double rSizePoint) : this(fontDef, rSizePoint, Color.Black) { }
//------------------------------------------------------------------------------------------28.07.2006 #region Constructor //---------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------28.07.2006 /// <overloads> /// <summary>Creates a new font property object. The size is specified in points.</summary> /// <remarks> /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in points. /// </remarks> /// </overloads> /// /// <summary>Creates a new font property object with the specified size (in points) and color.</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSizePoint">Size of the font in points.</param> /// <param name="color">Color of the font</param> /// <remarks> /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in points. /// </remarks> /// <example><see cref="FontPropPoint">FontPropPoint constructor sample</see></example> public FontPropPoint(FontDef fontDef, Double rSizePoint, Color color) : base(fontDef, rSizePoint, color) { }
//------------------------------------------------------------------------------------------28.07.2006 /// <summary>Creates a new font property object with the specified size (in millimeters).</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSizeMM">Size of the font in millimeters, height of the letter "H".</param> /// <remarks> /// The default color of the font is black. /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in millimeters, height of the letter "H". /// </remarks> /// <example><see cref="FontPropMM">FontPropMM constructor sample</see></example> public FontPropMM(FontDef fontDef, Double rSizeMM) : this(fontDef, rSizeMM, Color.Black) { }
//------------------------------------------------------------------------------------------28.07.2006 /// <overloads> /// <summary>Creates a new font property object with metric values.</summary> /// <remarks> /// After a FontPropMM object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in millimeters, height of the letter "H". /// </remarks> /// </overloads> /// /// <summary>Creates a new font property object with the specified size (in millimeters) and color.</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSizeMM">Size of the font in millimeters, height of the letter "H".</param> /// <param name="color">Color of the font</param> /// <remarks> /// After a FontPropMM object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in millimeters, height of the letter "H". /// </remarks> /// <example><see cref="FontPropMM">FontPropMM constructor sample</see></example> public FontPropMM(FontDef fontDef, Double rSizeMM, Color color) : base(fontDef, RT.rPointFromMM(rSizeMM), color) { }
//------------------------------------------------------------------------------------------28.07.2006 /// <summary>Creates a new font property object with the specified size.</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSize">Size of the font in 1/72 inches, height of the letter "H".</param> /// <remarks> /// The default color of the font is black. /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in 1/72 inches, height of the letter "H". /// </remarks> /// <include file='Prop\FontProp.cs.xml' path='documentation/class[@name="FontProp.FontProp1"]/*'/> public FontProp(FontDef fontDef, Double rSize) : this(fontDef, rSize, Color.Black) { }
//------------------------------------------------------------------------------------------28.07.2006 /// <summary>Creates a new font property object with the specified size and color.</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSize">Size of the font in 1/72 inches, height of the letter "H".</param> /// <param name="color">Color of the font</param> /// <remarks> /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in 1/72 inches, height of the letter "H". /// </remarks> /// <include file='Prop\FontProp.cs.xml' path='documentation/class[@name="FontProp.FontProp"]/*'/> public FontProp(FontDef fontDef, Double rSize, Color color) { this.fontDef = fontDef; this._rSizeInternal = rSize; this.color = color; }
//------------------------------------------------------------------------------------------02.02.2005 #region FontProp //---------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------02.02.2005 /// <overloads> /// <summary>Creates a new font property object.</summary> /// <remarks> /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in points (1/72 inch): height of the letter "H". /// </remarks> /// </overloads> /// /// <summary>Creates a new font property object with the specified size and color.</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSize">Size of the font in points (1/72 inch): height of the letter "H".</param> /// <param name="color">Color of the font</param> /// <remarks> /// After a FontProp object has been created, the format and style attributes of the object can be changed. /// The size of the font can be specified in points (1/72 inch): height of the letter "H". /// </remarks> public FontProp(FontDef fontDef, Double rSize, Color color) { this._fontDef = fontDef; this._rSize = rSize; this._color = color; }
//------------------------------------------------------------------------------------------06.03.2005 /// <summary>Create the font data array.</summary> /// <param name="fontDef">Font definition object</param> internal AFontData(FontDef fontDef) { this.fontDef = fontDef; }