mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:59:16 +02:00
ipro: fixed range check font size
This commit is contained in:
parent
cd71d115c1
commit
1ff7a16725
@ -5592,6 +5592,7 @@ begin
|
|||||||
with CurFONT do begin
|
with CurFONT do begin
|
||||||
Face := FindAttribute(htmlAttrFACE);
|
Face := FindAttribute(htmlAttrFACE);
|
||||||
Size.Free;
|
Size.Free;
|
||||||
|
Size:=nil;
|
||||||
Size := ParseRelSize{('+0')};
|
Size := ParseRelSize{('+0')};
|
||||||
Size.OnChange := SizeChanged;
|
Size.OnChange := SizeChanged;
|
||||||
Color := ColorFromString(FindAttribute(htmlAttrCOLOR));
|
Color := ColorFromString(FindAttribute(htmlAttrCOLOR));
|
||||||
@ -6971,7 +6972,7 @@ end;
|
|||||||
function TIpHtml.ParseRelSize{(const Default : string)} : TIpHtmlRelSize;
|
function TIpHtml.ParseRelSize{(const Default : string)} : TIpHtmlRelSize;
|
||||||
var
|
var
|
||||||
S : string;
|
S : string;
|
||||||
Err : Integer;
|
i, Err : Integer;
|
||||||
begin
|
begin
|
||||||
Result := TIpHtmlRelSize.Create;
|
Result := TIpHtmlRelSize.Create;
|
||||||
Result.FSizeType := hrsUnspecified;
|
Result.FSizeType := hrsUnspecified;
|
||||||
@ -6987,7 +6988,8 @@ begin
|
|||||||
Result.SizeType := hrsRelative;
|
Result.SizeType := hrsRelative;
|
||||||
end else
|
end else
|
||||||
Result.SizeType := hrsAbsolute;
|
Result.SizeType := hrsAbsolute;
|
||||||
Val(S, Result.FValue, Err);
|
Val(S, i, Err);
|
||||||
|
Result.Value := i;
|
||||||
if Err <> 0 then
|
if Err <> 0 then
|
||||||
if FlagErrors then
|
if FlagErrors then
|
||||||
ReportError(SHtmlInvInt);
|
ReportError(SHtmlInvInt);
|
||||||
@ -9098,6 +9100,14 @@ end;
|
|||||||
{ TIpHtmlNodeFONT }
|
{ TIpHtmlNodeFONT }
|
||||||
|
|
||||||
procedure TIpHtmlNodeFONT.ApplyProps(const RenderProps: TIpHtmlProps);
|
procedure TIpHtmlNodeFONT.ApplyProps(const RenderProps: TIpHtmlProps);
|
||||||
|
|
||||||
|
function GetFontSizeValue(aSize: integer): integer;
|
||||||
|
begin
|
||||||
|
aSize:=MaxI2(aSize,low(FONTSIZESVALUESARRAY));
|
||||||
|
aSize:=MinI2(aSize,high(FONTSIZESVALUESARRAY));
|
||||||
|
Result:=FONTSIZESVALUESARRAY[aSize];
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
TmpSize : Integer;
|
TmpSize : Integer;
|
||||||
begin
|
begin
|
||||||
@ -9106,17 +9116,14 @@ begin
|
|||||||
Props.FontName := FindFontName(Face);
|
Props.FontName := FindFontName(Face);
|
||||||
case Size.SizeType of
|
case Size.SizeType of
|
||||||
hrsAbsolute :
|
hrsAbsolute :
|
||||||
Props.FontSize := FONTSIZESVALUESARRAY[Size.Value-1];
|
begin
|
||||||
|
TmpSize:=Size.Value;
|
||||||
|
Props.FontSize := GetFontSizeValue(TmpSize);
|
||||||
|
end;
|
||||||
hrsRelative :
|
hrsRelative :
|
||||||
begin
|
begin
|
||||||
TmpSize := Props.BaseFontSize + Size.Value;
|
TmpSize := Props.BaseFontSize + Size.Value;
|
||||||
if TmpSize <= 1 then
|
Props.FontSize := GetFontSizeValue(TmpSize);
|
||||||
Props.FontSize := 8
|
|
||||||
else
|
|
||||||
if TmpSize > 7 then
|
|
||||||
Props.FontSize := 36
|
|
||||||
else
|
|
||||||
Props.FontSize := FONTSIZESVALUESARRAY[TmpSize-1];
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if Color <> clNone then
|
if Color <> clNone then
|
||||||
@ -9132,7 +9139,7 @@ end;
|
|||||||
destructor TIpHtmlNodeFONT.Destroy;
|
destructor TIpHtmlNodeFONT.Destroy;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
FSize.Free;
|
FreeAndNil(FSize);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIpHtmlNodeFONT.SetColor(const Value: TColor);
|
procedure TIpHtmlNodeFONT.SetColor(const Value: TColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user