PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

mulitpe fonts in DrawString
http://forum.pdfsharp.de/viewtopic.php?f=2&t=1559
Page 1 of 1

Author:  paulv [ Wed Feb 23, 2011 10:38 am ]
Post subject:  mulitpe fonts in DrawString

If I use DrawString to display the text strText :

tf.DrawString(strText, font, XBrushes.Black, rect, XStringFormats.TopLeft);


is it possible to have different fonts in the strText.

So if the text is strText = "this is a test line"

Could I have "this is a " as one font and "test line" as another font.

Paul

Author:  Thomas Hoevel [ Wed Feb 23, 2011 11:05 am ]
Post subject:  Re: mulitpe fonts in DrawString

The answer is YES.

It is however left as an exercise to the reader.

See XTextFormatter class:
Code:
/// <summary>
/// Represents a very simple text formatter.
/// If this class does not satisfy your needs on formatting paragraphs I recommend to take a look
/// at MigraDoc Foundation. Alternatively you should copy this class in your own source code and modify it.
/// </summary>

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/