Re: Printing formatted text




alanglloyd@xxxxxxx ha scritto:

GD1 wrote:
<snip>
how can I make it without using several
TextOut instructions (along with several Printer.Canvas.Font.Style
switches and related positioning matters)?


You can't, that's what it takes to do what you want <g>.

1 Split sting into elements of differing fonts by using the bold or
italic indicators as delimiters.

2 Get length of each element allocating fonts as necessary and using
Canvas.TextWidth.

3 Sum text widths and calculate spacing to justify (if fully justified)

4 Use DrawText API to send each element to canvas with appropriate
alignment for each element. Keep an incrementing variable to hold the X
coordinate.

5 Move to next line

6 GoTo 1

Alan Lloyd

Thank you. ;)

.



Relevant Pages

  • Re: Printing formatted text
    ... TextOut instructions (along with several Printer.Canvas.Font.Style ... switches and related positioning matters)? ... Get length of each element allocating fonts as necessary and using ...
    (comp.lang.pascal.delphi.misc)
  • Re: Printing formatted text
    ... TextOut instructions (along with several Printer.Canvas.Font.Style ... switches and related positioning matters)? ... Maarten Wiltink ...
    (comp.lang.pascal.delphi.misc)