这是TTextLayout中的错误吗?

时间:2017-01-02 16:45:30

标签: delphi firemonkey

在下面的代码中,在windows下,为什么用

aLayout.Text := '   '; (11 characters)

然后PositionAtPoint(50,0)返回5,但带

aLayout.Text := ' ' (5 characters) 

然后PositionAtPoint(50,0)返回3 :(

var aLayout: TTextLayout;
    aMeasuredWidth : single;
    aCharCount: integer;  
begin
  aLayout := TTextLayoutManager.DefaultTextLayout.Create;
  try

    aLayout.Font.Family := 'Segoe UI';
    aLayout.Font.Style := [];
    aLayout.Font.Size := 14;
    aLayout.MaxSize := Tpointf.Create(50, 65535);
    aLayout.Trimming := TTextTrimming.Character;
    aLayout.VerticalAlign := TTextAlign.Leading;
    aLayout.HorizontalAlign := TTextAlign.Leading;
    aLayout.WordWrap := False;

    aLayout.Text := '   ';
    aMeasuredWidth := aLayout.TextWidth;
    aCharCount := aLayout.PositionAtPoint(TpointF.Create(aMeasuredWidth,0)); 

    aLayout.Text := ' ';
    aMeasuredWidth := aLayout.TextWidth;
    aCharCount := aLayout.PositionAtPoint(TpointF.Create(aMeasuredWidth,0)); 

  finally
    aLayout.Free;
  end;
end;

0 个答案:

没有答案