Skip to content

Commit 983079e

Browse files
author
delphidabbler
committed
Added support for generating CSS line-height property
1 parent bcd72b4 commit 983079e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Src/UCSSUtils.pas

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,14 @@ TCSS = record
417417
/// <returns>string. Required CSS property.</returns>
418418
class function OverflowProp(const Value: TCSSOverflowValue;
419419
const Direction: TCSSOverflowDirection = codBoth): string; static;
420+
421+
/// <summary>Creates a CSS "line-height" property.</summary>
422+
/// <param name="Percentage">UInt16 [in] Line height as a percentage of
423+
/// font size.</param>
424+
/// <returns>string. Required CSS property.</returns>
425+
/// <remarks>Only the percentage version of line height is supported.
426+
/// </remarks>
427+
class function LineHeightProp(const Percentage: UInt16): string; static;
420428
end;
421429

422430

@@ -615,6 +623,11 @@ class function TCSS.LengthUnit(const LU: TCSSLengthUnit): string;
615623
Result := Units[LU];
616624
end;
617625

626+
class function TCSS.LineHeightProp(const Percentage: UInt16): string;
627+
begin
628+
Result := 'line-height: ' + IntToStr(Percentage) + '%';
629+
end;
630+
618631
class function TCSS.MarginProp(const Margin: array of Integer): string;
619632
begin
620633
Assert(Length(Margin) in [1,2,4],

0 commit comments

Comments
 (0)