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:
sekelsenmat 2016-03-15 15:17:31 +00:00
parent 4b11aaff8c
commit ee424ff37f
3 changed files with 20 additions and 1 deletions

View File

@ -2336,6 +2336,7 @@ begin
end;
// 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;
TableWidth := FPage.Width;
for col := 0 to Length(ColWidthsInMM)-1 do
@ -5533,6 +5534,9 @@ begin
CalcEntityCanvasMinMaxXY(ARenderInfo, pt.x, pt.y);
lTextSize := ACanvas.TextExtent(lText);
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
pt := Point(round(Render_NextText_X) + lTextWidth, round(LowerDimY) + lTextSize.cy );
pt := Rotate2dPoint(pt, refPt, -Phi);

View File

@ -80,7 +80,7 @@ end;
function TvHTMLVectorialReader.ReadEntityFromNode(ANode: TDOMNode;
AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
var
lEntityName: DOMString;
lEntityName, lTextValue: DOMString;
lPara: TvParagraph;
begin
Result := nil;
@ -103,6 +103,16 @@ begin
end;
'ul': Result := ReadUListFromNode(ANode, AData, ADoc);
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;
function TvHTMLVectorialReader.ReadHeaderFromNode(ANode: TDOMNode;

View File

@ -5,6 +5,11 @@ License: The same modified LGPL as the Free Pascal RTL
See the file COPYING.modifiedLGPL for more details
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;