mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 05:39:34 +01: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;
 | 
			
		||||
 | 
			
		||||
  // 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);
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user