Recent

Author Topic: EM_FORMATRANGE  (Read 5654 times)

rick2691

  • Sr. Member
  • ****
  • Posts: 444
EM_FORMATRANGE
« on: October 02, 2016, 04:31:58 pm »
It appears that EM_FORMATRANGE might have been changed at about halfway through our working with the function.

It now formats with an extra line. By appearance it looks as if it is proper, but a printer will not fit that last line on the page.

It also seems that word wrapping has slightly changed. It used to do exactly as WordPad would do with lines and wrapping, and now both are different.

To be sure I went back to my first code, and there is a PDF on the PrintViewer thread. The oldest version does the same as newest one, and it is not what is posted on the thread.

Rick
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #1 on: October 02, 2016, 04:35:37 pm »
Here is the older version, as per the thread post.

That didn't work... You'll have to go look it up.

Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: EM_FORMATRANGE
« Reply #2 on: October 02, 2016, 06:41:24 pm »
I assume you are comparing it with the image in this post.

It seems to me that you changed the format. Check the attached image.

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #3 on: October 02, 2016, 07:43:17 pm »
Yes, it looks as though you are correct... I must have changed the RETURN attribute at some point.

But why does that change the EM_FORMATRANGE result so that it incorrectly shows that the format will fit on a page?

When printing it sends the last line to the next page.

Rick

Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #4 on: October 02, 2016, 08:17:35 pm »
I would have done it by deleting the RETURN space and doing a new RETURN from the lesser font. Something I sometimes do to make things look better.

Does printing insist that a RETURN is from the higher font with its attributes?

Rick
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #5 on: October 03, 2016, 01:02:49 pm »
I edited through with the RETURN's to see if it corrected anything, and it did not. I still may have changed the font size to get the extra line. But I sent the file to WordPad, and it showed a Preview that pushed the last line to the next page. EM_FORMATRANGE is still retaining that line on page 1. The following is the WordPad preview.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #6 on: October 03, 2016, 01:18:23 pm »
The following also a printing by RichMemo to a PDF printer. It shows that the last line belongs on the next page.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

rvk

  • Hero Member
  • *****
  • Posts: 6056
Re: EM_FORMATRANGE
« Reply #7 on: October 03, 2016, 01:26:55 pm »
I'm not sure if I totally understand your problem but my experience with RICHED20.dll (and other RichEdit versions) is that they are very sensitive to the assigned hdc and hdcTarget.

I've used it a lot in Delphi and always had a difference in wrapping of lines on screen and on a real printer (or PDF-printer). I finally settled to filling the hdc and hdcTarget with the default printer handle even when using a screen-view.

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #8 on: October 03, 2016, 03:00:39 pm »
Thanks. I'll give that a try.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: EM_FORMATRANGE
« Reply #9 on: October 03, 2016, 03:12:21 pm »
rvk... you are a good man (or person). That made it work.
Windows 11, LAZ 2.0.10, FPC 3.2.0, SVN 63526, i386-win32-win32/win64, using windows unit

 

TinyPortal © 2005-2018