//------------------------------------------------------------------------------------------xx.03.2006 /// <summary>Gets the font name.</summary> /// <param name="report">Report to which this font definition belongs</param> /// <param name="standardFont">Standard font enumeration value</param> /// <returns>Name of the font family</returns> private static String sGetFontName(Report report, StandardFont standardFont) { if (report.formatter is PdfFormatter) { if (standardFont == FontDef.StandardFont.TimesRoman) { return("Times-Roman"); } return(standardFont.ToString("G")); } switch (standardFont) { case FontDef.StandardFont.Courier: { return("Courier New"); } case FontDef.StandardFont.Helvetica: { return("Arial"); } case FontDef.StandardFont.Symbol: { return("Symbol"); } case FontDef.StandardFont.TimesRoman: { return("Times New Roman"); } case FontDef.StandardFont.ZapfDingbats: { return("Wingdings"); } } Debug.Fail("unknown standard font"); return(null); }
public void PDFFontConstructor_Test1() { StandardFont font = StandardFont.Helvetica; PDFUnit size = 12; PDFFont target = new PDFFont(font, size); Assert.IsNotNull(target); Assert.AreEqual(target.FamilyName, font.ToString()); Assert.AreEqual(target.Size, size); Assert.AreEqual(target.IsStandard, true); Assert.AreEqual(target.FontStyle, FontStyle.Regular); }
public void PDFFontConstructor_Test5() { StandardFont font = StandardFont.Helvetica; PDFUnit size = 20; FontStyle style = FontStyle.Bold | FontStyle.Italic; PDFFont target = new PDFFont(font, size, style); Assert.IsNotNull(target); Assert.AreEqual(target.FamilyName, font.ToString()); Assert.AreEqual(target.Size, size); Assert.AreEqual(target.IsStandard, true); Assert.AreEqual(target.FontStyle, style); }
public static Font Standard(StandardFont font) { if (StandardFontCache.ContainsKey(font)) { return(StandardFontCache[font]); } var fontInstance = new Font() { Subtype = PdfFontType.Type1, BaseFont = new Name(font.ToString()) }; StandardFontCache.TryAdd(font, fontInstance); return(fontInstance); }
public static float GetTextWidth(string text, float scale = 1, StandardFont font = StandardFont.Default, bool colorCoded = false) { return(MtaClient.DxGetTextWidth(text, scale, font.ToString().ToLower(), colorCoded)); }
public bool Draw(RootElement source, OnRenderEventArgs eventArgs) { if (useCustomFont) { return(MtaClient.DxDrawText(Content, Position.X, Position.Y, BottomRight.X, BottomRight.Y, Color.Hex, Scale.X, Scale.Y, CustomFont.MTAFont, HorizontalAlignment.ToString().ToLower(), VerticalAlignment.ToString().ToLower(), Clip, WordBreak, PostGUI, ColorCoded, SubPixelPositioning, Rotation, RotationOrigin.X, RotationOrigin.Y)); } else { return(MtaClient.DxDrawText(Content, Position.X, Position.Y, BottomRight.X, BottomRight.Y, Color.Hex, Scale.X, Scale.Y, StandardFont.ToString().ToLower(), HorizontalAlignment.ToString().ToLower(), VerticalAlignment.ToString().ToLower(), Clip, WordBreak, PostGUI, ColorCoded, SubPixelPositioning, Rotation, RotationOrigin.X, RotationOrigin.Y)); } }
public static bool DrawText(string text, Vector2 position, Vector2 bottomRight, Color color, Vector2 scale, StandardFont font, HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, float fRotation, Vector2 fRotationCenter, bool clip = false, bool wordBreak = false, bool postGUI = false, bool colorCoded = false, bool subPixelPositioning = false) { return(MtaClient.DxDrawText(text, position.X, position.Y, bottomRight.X, bottomRight.Y, color.Hex, scale.X, scale.Y, font.ToString().ToLower(), horizontalAlign.ToString().ToLower(), verticalAlign.ToString().ToLower(), clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenter.X, fRotationCenter.Y)); }
/// <summary> /// Creates a new standard PDFFont with the specified size and style /// </summary> /// <param name="font">One of the PDF Standard fonts that does not need to be included in the PDF file</param> /// <param name="size">The em size of the font</param> /// <param name="style">The new font style</param> public PDFFont(StandardFont font, PDFUnit size, FontStyle style) : this(font.ToString(), size, style) { }
/// <summary> /// Creates a new regular standard PDFFont with specified size /// </summary> /// <param name="font">One of the PDF Standard fonts that does not need to be included in the PDF file</param> /// <param name="size">The em size of the font</param> public PDFFont(StandardFont font, PDFUnit size) : this(font.ToString(), size, FontStyle.Regular) { }
/// <summary> /// Get the height of a GTA font /// </summary> public static int GetHeight(StandardFont font = StandardFont.Default, float scale = 1) { return(MtaClient.DxGetFontHeight(scale, font.ToString().ToLower())); }