/// <summary> /// Composes the element. /// </summary> /// <param name="ctx">Context of the text component.</param> /// <param name="surface">The surface of the image.</param> /// <param name="withFont">The font for the element.</param> public override void ComposeElements(Context ctx, ImageSurface surface) { textUtil.DrawMultilineText(ctx, font, lines, font.Orientation); /* ctx.LineWidth = 1f; * ctx.SetSourceRGBA(0, 0, 0, 0.5); * for (int i = 0; i < lines.Length; i++) * { * TextLine line = lines[i]; * ctx.Rectangle(line.Bounds.X, line.Bounds.Y, line.Bounds.Width, line.Bounds.Height); * ctx.Stroke(); * }*/ }
public double DrawMultilineTextAt(Context ctx, double posX, double posY, EnumTextOrientation orientation = EnumTextOrientation.Left) { Font.SetupContext(ctx); TextLine[] lines = textUtil.Lineize(Font, text, Bounds.InnerWidth); ctx.Save(); Matrix m = ctx.Matrix; m.Translate(posX, posY); ctx.Matrix = m; textUtil.DrawMultilineText(ctx, Font, lines, orientation); ctx.Restore(); return(lines.Length == 0 ? 0 : (lines[lines.Length - 1].Bounds.Y + lines[lines.Length - 1].Bounds.Height)); }