I create a THMTileItem and try to render text on it, using code based on the demo, but instead of truncating the text with an ellipsis, it draws the entire thing out, far beyond the bounds of the THMTileItem. It appears that when the Canvas.Font.Size property is about 14 or higher, the HMEllipsifyText routine works correctly, but when it's smaller than that, no actual ellipsifying takes place.
Sample code:
Code: Select all
procedure TStartupScreen.InternalCreateWhatsNewItem(const aScale, aIndex: Integer; const aitem: TInputItem);
var
tmpX: Integer;
tmpY: Integer;
tmpW: Integer;
header: String;
description: String;
result: THMTileItem;
begin
tmpX := _x(0); //
tmpY := _y2(AIndex + 3);
tmpW := _w(2);
Canvas.Font.Size := 14;
header := HMEllipsifyText(False, aItem.title, Canvas, tmpW - _dpi(20));
Canvas.Font.Size := 10;
description := HMEllipsifyText(True, aItem.description, Canvas, tmpW - _dpi(20), _y2(1));
Result := THMTileItem.CreateEx(GDIPaintPanel, tmpX, tmpY, tmpW, _h2(1), AScale, AScale, FColorSet[2], clBlack, header, description, nil, clGreen, taLeftJustify, 1);
Result.HeaderVerticalAlign := taAlignTop;
Result.TextGap := 7;
Result.DescriptionFontSize := Canvas.Font.Size;
Result.TitleFontSize := 14;
Result.PrepareItem;
end;
If I decrease the font sizes to 12 and 8, respectively, then the title line doesn't get ellipsified either.
Does anyone have any idea what's going on here and how I can fix it?