Ejemplo n.º 1
0
 public void SetUp()
 {
     // This test uses a 11x16 font.
     styleSystem         = LayoutTestStyle.CreateStyleSystem();
     textStyleDefinition = styleSystem.StylesFor <TextStyleDefinition>();
     textStyle           = LayoutTestStyle.CreateTextStyle(styleSystem);
 }
Ejemplo n.º 2
0
        public static IStyle CreateTextStyle(IStyleSystem styleSystem)
        {
            var textStyles = styleSystem.StylesFor <TextStyleDefinition>();

            var style = new PresentationStyle(styleSystem);

            style.SetValue(textStyles.Font, CreateFont("CreateTextStyle[11,16]", 11, 16));
            style.SetValue(textStyles.TextColor, Color.Black);
            return(style);
        }
Ejemplo n.º 3
0
        public void Draw()
        {
            var drawingService = Substitute.For <IBatchedDrawingService>();

            var textStyle = styleSystem.StylesFor <TextStyleDefinition>();

            var text = "  Hello World! ";

            var chunk = CreateChunk(null, null, text);

            chunk.Arrange(new Rectangle(10, 20, 200, 20));

            var font          = chunk.Style.GetValue(textStyle.Font);
            var textColor     = chunk.Style.GetValue(textStyle.TextColor);
            var outlineColor  = chunk.Style.GetValue(textStyle.OutlineColor);
            var outlineRadius = chunk.Style.GetValue(textStyle.OutlineSize);

            chunk.Draw(drawingService);

            drawingService.Received().DrawBlurredText(font, "Hello World!", new Vector2(10 + 22, 20 + font.Baseline), textColor, outlineRadius, outlineColor);
        }