Ejemplo n.º 1
0
 protected internal override void DoDraw(SvgDrawContext context)
 {
     if (this.attributesAndStyles != null && this.attributesAndStyles.ContainsKey(SvgConstants.Attributes.TEXT_CONTENT
                                                                                  ))
     {
         PdfCanvas currentCanvas = context.GetCurrentCanvas();
         //TODO(DEVSIX-2507): Support for glyph by glyph handling of x, y and rotate
         currentCanvas.MoveText(context.GetTextMove()[0], context.GetTextMove()[1]);
         currentCanvas.ShowText(this.attributesAndStyles.Get(SvgConstants.Attributes.TEXT_CONTENT));
     }
 }
        private static AffineTransform GetTextTransform(float[][] absolutePositions, SvgDrawContext context)
        {
            AffineTransform tf = new AffineTransform();

            //If x is not specified, but y is, we need to correct for preceding text.
            if (absolutePositions[0] == null && absolutePositions[1] != null)
            {
                absolutePositions[0] = new float[] { context.GetTextMove()[0] };
            }
            //If y is not present, we can replace it with a neutral transformation (0.0f)
            if (absolutePositions[1] == null)
            {
                absolutePositions[1] = new float[] { 0.0f };
            }
            tf.Concatenate(TEXTFLIP);
            tf.Concatenate(AffineTransform.GetTranslateInstance(absolutePositions[0][0], -absolutePositions[1][0]));
            return(tf);
        }