mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 00:00:39 +02:00
fpvectorial-html: Implements support for inline html text, fixes column size construction when Page size is zero (unknown), fixes support for </br>
git-svn-id: trunk@51951 -
This commit is contained in:
parent
4b11aaff8c
commit
ee424ff37f
@ -2336,6 +2336,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// If it goes over the page width, recalculate with equal sizes (in the future do better)
|
// If it goes over the page width, recalculate with equal sizes (in the future do better)
|
||||||
|
if FPage.Width <= 0 then Exit;
|
||||||
if TableWidth <= FPage.Width then Exit;
|
if TableWidth <= FPage.Width then Exit;
|
||||||
TableWidth := FPage.Width;
|
TableWidth := FPage.Width;
|
||||||
for col := 0 to Length(ColWidthsInMM)-1 do
|
for col := 0 to Length(ColWidthsInMM)-1 do
|
||||||
@ -5533,6 +5534,9 @@ begin
|
|||||||
CalcEntityCanvasMinMaxXY(ARenderInfo, pt.x, pt.y);
|
CalcEntityCanvasMinMaxXY(ARenderInfo, pt.x, pt.y);
|
||||||
lTextSize := ACanvas.TextExtent(lText);
|
lTextSize := ACanvas.TextExtent(lText);
|
||||||
lTextWidth := lTextSize.cx;
|
lTextWidth := lTextSize.cx;
|
||||||
|
// Reserve vertical space for </br> and similar line ending constructs
|
||||||
|
if (lText = '') then
|
||||||
|
lTextSize.cy := ACanvas.TextHeight(STR_FPVECTORIAL_TEXT_HEIGHT_SAMPLE);
|
||||||
// other end of the text
|
// other end of the text
|
||||||
pt := Point(round(Render_NextText_X) + lTextWidth, round(LowerDimY) + lTextSize.cy );
|
pt := Point(round(Render_NextText_X) + lTextWidth, round(LowerDimY) + lTextSize.cy );
|
||||||
pt := Rotate2dPoint(pt, refPt, -Phi);
|
pt := Rotate2dPoint(pt, refPt, -Phi);
|
||||||
|
@ -80,7 +80,7 @@ end;
|
|||||||
function TvHTMLVectorialReader.ReadEntityFromNode(ANode: TDOMNode;
|
function TvHTMLVectorialReader.ReadEntityFromNode(ANode: TDOMNode;
|
||||||
AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
|
AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
|
||||||
var
|
var
|
||||||
lEntityName: DOMString;
|
lEntityName, lTextValue: DOMString;
|
||||||
lPara: TvParagraph;
|
lPara: TvParagraph;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
@ -103,6 +103,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
'ul': Result := ReadUListFromNode(ANode, AData, ADoc);
|
'ul': Result := ReadUListFromNode(ANode, AData, ADoc);
|
||||||
end;
|
end;
|
||||||
|
// Raw text
|
||||||
|
if (ANode is TDOMText) and (lEntityName = '#text') then
|
||||||
|
begin
|
||||||
|
lTextValue := Trim(ANode.NodeValue);
|
||||||
|
if (lTextValue <> '') then
|
||||||
|
begin
|
||||||
|
AData.AddParagraph().AddText(lTextValue);
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TvHTMLVectorialReader.ReadHeaderFromNode(ANode: TDOMNode;
|
function TvHTMLVectorialReader.ReadHeaderFromNode(ANode: TDOMNode;
|
||||||
|
@ -5,6 +5,11 @@ License: The same modified LGPL as the Free Pascal RTL
|
|||||||
See the file COPYING.modifiedLGPL for more details
|
See the file COPYING.modifiedLGPL for more details
|
||||||
|
|
||||||
AUTHORS: Felipe Monteiro de Carvalho
|
AUTHORS: Felipe Monteiro de Carvalho
|
||||||
|
|
||||||
|
SVG Coordinates vs FPVectorial coordinates:
|
||||||
|
|
||||||
|
SVG by default has [0, 0] at the top-left and coordinates grow downwards and to the right
|
||||||
|
Text is drawn upwards (towards negative Y)
|
||||||
}
|
}
|
||||||
unit svgvectorialreader;
|
unit svgvectorialreader;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user