Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline Text in TText: problem when AutoSize is True and WordWrap is False #284

Closed
federgraph opened this issue Nov 20, 2023 · 3 comments

Comments

@federgraph
Copy link

Hi,

In Delphi 12 FMX, with Skia enabled, there is a problem with TText when AutoSize is True and WordWrap is False.
The problem shows when multiline Text is assigned from TStringList.Text.
The Width of the TText component will not be adjusted.

This Issue has already been reported to Embarcadero as RSP-43371.

I fixed it for myself in FMX.Skia.Canvas like so:

function TSkTextLayout.NeedHorizontalAlignment: Boolean;
var
  LShouldHaveSingleLine: Boolean;
begin
  LShouldHaveSingleLine := not WordWrap;

  if WordWrap then
  begin
    if Text.Contains(#13) or Text.Contains(#10) then
      LShouldHaveSingleLine := False;	
  end;

  Result := LShouldHaveSingleLine and (Trimming = TTextTrimming.None);
end;

Trimming is None in my case. AutoSize is not available inside NeedHorizontalAlignment. Therefore: If WordWrap is true then LShouldHaveSingleLine must return True, in my special case. Thanks.

@viniciusfbb
Copy link
Member

@federgraph Thank you very much to report the issue!

The real cause is the same of #273 and was fixed on 7f45095 and 65df505. So, as a workaround, just add to your project the current FMX.Skia.Canvas.pas. Let's see if Embarcadero add this fix in a hotfix for RAD 12.0.

@federgraph
Copy link
Author

Ok, I have updated my Skia units with latest from GitHub, and can confirm that it works. Thank you.

@viniciusfbb
Copy link
Member

Fixed in new release v6.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants