Recent

Author Topic: Line spacing  (Read 8662 times)

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Line spacing
« on: August 29, 2016, 09:05:09 pm »
The following setting of <\pard\rtlpar\pagebb\nowidctlpar\s1\sa432\sl-403\slmult0\> can display high placed vowels, but it is not a setting that <PageMemo.SetRangeParaParams(PageMemo.SelStart, PageMemo.SelLength, [pmm_LineSpacing], m)> can support.

<\sl-403> is an absolute line hight, and <\slmult0> is its compliment.

When <Str(m.LineSpacing:0:2,s); OfsLns.Text:= s;> gets the linespacing parmeter, it reports <24.18> instead of its actual value. It seems that <m.LineSpacing> doesn't know how to translate or apply it. If you change its value, such as 1.3 or 1.5, it cuts off the top of the vowel.

Yet when the text is copy/pasted into RichMemo it does translate the value, and you see the entire vowel. But when you change any of the formatting, it cuts off the top of the vowel.

I suspect that the problem could be that RichMemo paints the text from the bottom to the top of the screen, and the higher LineSpace overwrites the image of the vowel. If it painted from the top down, the image would overwrite the blank space of the upper line... and everything would be good. Even a value of 1.3 for linespace would work, instead of having to do a fixed hight.

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: Line spacing
« Reply #1 on: August 29, 2016, 10:15:11 pm »
Things have changed... please read the attached RTF (zipped) file.

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: Line spacing
« Reply #2 on: August 29, 2016, 10:33:36 pm »
False hope. I removed all of the \sl codes. It did not help the larger document. It still chopped off the top of the vowel. I don't have any idea why it helped the smaller samples and not the larger.

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: Line spacing
« Reply #3 on: August 30, 2016, 04:30:55 pm »
With the sample RTF that I sent you I copy/pasted the word with the vowel into each display line of the high excerpt. On the 3rd line it chopped the vowel.

I did the same with the lower excerpt and it would hit and miss at chopping, the same as with the above.

The chop had happened on odd numbers for the first 11 of the display lines... being 3, 5, 7, 9 & 11. But then it did not happen until line 14, and again on line 22. I then looked at line one more carefully, and it had a very fractional chop at its top.

I don't see any visual reason, such as character combinations on the lines, that would cause it. Kerning position seems to be consistent. That it is usually odd numbers suggests to me that it is round-out metrics with the RichMemo display. That line one is only a shave, and it misses line 13, to hit 14, then does not hit again until 22, suggests that it is an accumulative value that eventually departs from serially odd figures.

I loaded the file into WordPad. It chopped the vowel on 3, 7, 9, 13 & 22. A slightly different series, but still showing an affinity to odd numerals.

I loaded it into PolyEdit. It never chopped the vowel on any line.

I loaded it into OpenOffice Writer.  It also did not chop the vowel on any line.

Since PolyEdit and OpenOffice are more modern than WordPad, I suspect that it may be a fluke that was fixed for editors that came later.

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: Line spacing
« Reply #4 on: August 30, 2016, 04:43:59 pm »
I forgot to upload the file. It is attached with this post.

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

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Line spacing
« Reply #5 on: September 01, 2016, 03:40:31 am »
I can't see the problem. It's either Windows 10 (where the problem might be fixed) or something else.  Could you please provide screen shots of "wrong" and "right"?
Also, how do you set line spacing in richmemo (the code example)?

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Line spacing
« Reply #6 on: September 01, 2016, 02:52:29 pm »
I get line spacing by the following. It is called OfsLns.

Code: Pascal  [Select][+][-]
  1. procedure TCmdForm.MnuFormatClick(Sender: TObject);
  2. var m: TParaMetric;
  3.     s: string;
  4.     FParaProps: TParaFormat2;
  5.     Result: boolean;
  6. begin
  7.   FormatOfs.Visible:= true;
  8.  
  9.   // get paragraph offset metrics
  10.   PageMemo.GetParaMetric(PageMemo.SelStart, m);
  11.   OfsTop.Text:= IntToStr(round(m.SpaceBefore));
  12.   OfsInd.Text:= IntToStr(round(m.FirstLine));
  13.   OfsLft.Text:= IntToStr(round(m.HeadIndent));
  14.   OfsRht.Text:= IntToStr(round(m.TailIndent));
  15.   OfsBtm.Text:= IntToStr(round(m.SpaceAfter));
  16.   Str(m.LineSpacing:0:2,s); OfsLns.Text:= s;
  17.  
  18.   // get paragraph LTR/RTL flow
  19.   FillChar(FParaProps, SizeOf(TParaFormat2), 0);
  20.   FParaProps.cbSize:= SizeOf(TParaFormat2);
  21.   PageMemo.Perform(EM_GetParaFormat, 0, LParam(@FParaProps));
  22.   if (FParaProps.dwMask and PFM_RTLPARA)=0
  23.       then Result:= False
  24.       else Result:= (FParaProps.wEffects and PFE_RTLPARA)<>0;
  25.   if Result then btnRTL.checked:= true else btnLTR.checked:= true;
  26. end;
  27.  

I set OfsLns by the following.

Code: Pascal  [Select][+][-]
  1. procedure TCmdForm.SetOfsLns(Sender: TObject);
  2. var
  3.   m: TParaMetric;
  4.   x: double;
  5.   inpOK: boolean;
  6.   err: integer;
  7.   s: string;
  8. begin
  9.   InitParaMetric(m);
  10.   Val(OfsLns.Text, x, Err);
  11.   InpOK:= (Err=0);
  12.   if InpOK then
  13.      begin
  14.      m.LineSpacing:= x;
  15.      PageMemo.SetRangeParaParams(PageMemo.SelStart, PageMemo.SelLength, [pmm_LineSpacing], m);
  16.      end else if (length(OfsLns.Text)>0) then showmessage('Improper value entry.')
  17.                                          else showmessage('Must enter value.')
  18. end;
  19.  

I tried to make a PDF of the file. It did not chop any vowels.

So I started changing the width of the RichMemo form. Once I get the form large enough, the entire RTL paragraph has no chopping.

But the short excerpt at the top keeps its chopped vowels regardless of the form size... and the chops have nothing to do with the screen line (which became two lines). So everything that I said earlier about line numbers was bogus.

I'll have to install a screen capture program to get you a picture.

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: Line spacing
« Reply #7 on: September 01, 2016, 02:59:44 pm »
I just noticed this in your documentation...

Quote
LineSpacing - a factor used to calculate line spacing between lines in the paragraph. The factor is applied to Font size (tallest in the line), not the line height. Thus it's matching CSS's line-height property. Note that normal line-spacing is 1.2. I.e. font of 12 pt size, an actual lines spacing set to 1.2, would result in 14pt line height.
not supported in WinXP or earlier

What does "not supported in WinXP" refer to? Mine is changing the line spacing.

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

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Line spacing
« Reply #8 on: September 01, 2016, 03:33:38 pm »
I'll have to install a screen capture program to get you a picture.
You don't have to.
Just press Alt + Print Screen on your keyboard when the application focused. Then paste the image to MS Paint.

What does "not supported in WinXP" refer to? Mine is changing the line spacing.
Apparently there were some issues with line-spacing on my XP box, but can't recall what they were.
« Last Edit: September 01, 2016, 03:37:00 pm by skalogryz »

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Line spacing
« Reply #9 on: September 01, 2016, 06:33:12 pm »
Attached is "Chopped Vowels.png".

The red words are whole, and blue have one chopped vowel at the top of the tallest letter in the word. I hope you can see it.

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

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Line spacing
« Reply #10 on: September 01, 2016, 07:08:32 pm »
I guess I see that (see the attached example).
But the issue looks very odd to me...

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Line spacing
« Reply #11 on: September 01, 2016, 09:12:35 pm »
Yes, you see it now.

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

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Line spacing
« Reply #12 on: September 01, 2016, 10:25:59 pm »
Could you also attach the font you're using. Or is it standard Windows font?

rick2691

  • Sr. Member
  • ****
  • Posts: 444
Re: Line spacing
« Reply #13 on: September 02, 2016, 01:22:13 pm »
It is the font that I sent you a while back, Estrangelo Talada. Its compliment is Estrangelo Edessa, and it does not behave this way because it keeps all of the vowels lower. The Talada sets them higher because its vowels are larger. It is easier to read. The standard Windows fonts have tiny vowels.

I would blame it on its being too aggressive with the extra sizing, but it operates fine in other editors.

They are attached.

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

 

TinyPortal © 2005-2018