예제 #1
0
        //------------------------------------------------------------------------------------------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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 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));
 }
예제 #6
0
 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));
     }
 }
예제 #7
0
파일: Dx.cs 프로젝트: calinipate/Slipe-Core
 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));
 }
예제 #8
0
 /// <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)
 {
 }
예제 #9
0
 /// <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)
 {
 }
예제 #10
0
 /// <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()));
 }