Skip to content

Commit 3771b42

Browse files
committed
Change to restore default font size when bad value assigned.
Setting highlighter font size preference to an out of range value resets the preference to its default value.
1 parent c7a09ed commit 3771b42

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Src/Hiliter.UAttrs.pas

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ THiliteAttrs = class(TInterfacedObject,
107107
/// <remarks>Method of IHiliteAttrs.</remarks>
108108
function GetFontSize: Integer;
109109
/// <summary>Sets size of highlighter font.</summary>
110-
/// <remarks>Method of IHiliteAttrs.</remarks>
110+
/// <remarks>
111+
/// <para>If font size is out of range of supported sizes then the
112+
/// highlighter font is reset to its default value.</para>
113+
/// <para>Method of IHiliteAttrs.</para>
114+
/// </remarks>
111115
procedure SetFontSize(const AFontSize: Integer);
112116
/// <summary>Resets highlighter font name and size to default values.
113117
/// </summary>
@@ -307,7 +311,10 @@ procedure THiliteAttrs.SetFontName(const AFontName: string);
307311

308312
procedure THiliteAttrs.SetFontSize(const AFontSize: Integer);
309313
begin
310-
fFontSize := AFontSize;
314+
if TFontHelper.IsInCommonFontSizeRange(AFontSize) then
315+
fFontSize := AFontSize
316+
else
317+
fFontSize := cDefFontSize;
311318
end;
312319

313320
{ THiliteElemAttrs }

0 commit comments

Comments
 (0)