mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 16:49:12 +02:00
fpvectorial: Advances mathml rendering, not working yet
git-svn-id: trunk@37532 -
This commit is contained in:
parent
c73fdaff8b
commit
3c0d09c424
@ -411,6 +411,8 @@ type
|
|||||||
AdjacentNumber: Double;
|
AdjacentNumber: Double;
|
||||||
Formula: TvFormula;
|
Formula: TvFormula;
|
||||||
BottomFormula: TvFormula;
|
BottomFormula: TvFormula;
|
||||||
|
public
|
||||||
|
Top, Left, Width, Height: Integer;
|
||||||
function CalculateHeight: Single; // 1.0 = the normal text height, will return for example 2.2 for 2,2 times the text height
|
function CalculateHeight: Single; // 1.0 = the normal text height, will return for example 2.2 for 2,2 times the text height
|
||||||
function CalculateWidth(ADest: TFPCustomCanvas): Integer; // in pixels
|
function CalculateWidth(ADest: TFPCustomCanvas): Integer; // in pixels
|
||||||
function AsText: string;
|
function AsText: string;
|
||||||
@ -426,6 +428,7 @@ type
|
|||||||
protected
|
protected
|
||||||
FElements: TFPList; // of TvFormulaElement
|
FElements: TFPList; // of TvFormulaElement
|
||||||
public
|
public
|
||||||
|
Top, Left, Width, Height: Integer;
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
//
|
//
|
||||||
@ -1682,20 +1685,18 @@ begin
|
|||||||
begin
|
begin
|
||||||
if ADest = nil then Result := 10 * UTF8Length(lText)
|
if ADest = nil then Result := 10 * UTF8Length(lText)
|
||||||
else Result := TCanvas(ADest).TextWidth(lText);
|
else Result := TCanvas(ADest).TextWidth(lText);
|
||||||
Exit;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ case Kind of
|
case Kind of
|
||||||
fekFraction: Result := 2.3;
|
// fekFraction: Result := 2.3;
|
||||||
fekRoot: Result := Formula.CalculateHeight();
|
fekRoot: Result := Formula.CalculateWidth(ADest) + 5;
|
||||||
fekNumberWithPower,
|
fekNumberWithPower,
|
||||||
fekVariableWithPower: Result := 1.1;
|
fekVariableWithPower: Result := Round(Result * 1.2);
|
||||||
//fekParenteses: Result,// This is utilized to group elements. Inside it goes a Formula
|
fekParenteses: Result := Result + 6;
|
||||||
fekParentesesWithPower: Result := 1.1;
|
fekParentesesWithPower: Result := Result + 8;
|
||||||
fekSomatory: Result := 1.5;
|
fekSomatory: Result := 8;
|
||||||
else
|
else
|
||||||
Result := 1.0;
|
end;
|
||||||
end;}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TvFormulaElement.AsText: string;
|
function TvFormulaElement.AsText: string;
|
||||||
@ -1797,7 +1798,24 @@ end;
|
|||||||
|
|
||||||
procedure TvFormula.Render(ADest: TFPCustomCanvas; ADestX: Integer;
|
procedure TvFormula.Render(ADest: TFPCustomCanvas; ADestX: Integer;
|
||||||
ADestY: Integer; AMulX: Double; AMulY: Double);
|
ADestY: Integer; AMulX: Double; AMulY: Double);
|
||||||
|
var
|
||||||
|
lElement: TvFormulaElement;
|
||||||
begin
|
begin
|
||||||
|
CalculateHeight();
|
||||||
|
CalculateWidth(ADest);
|
||||||
|
|
||||||
|
// First calculate the maximum width and height of all elements
|
||||||
|
lElement := GetFirstElement();
|
||||||
|
if lElement = nil then Exit;
|
||||||
|
while lElement <> nil do
|
||||||
|
begin
|
||||||
|
lElement.CalculateHeight();
|
||||||
|
lElement.CalculateWidth(ADest);
|
||||||
|
|
||||||
|
lElement := GetNextElement();
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Then calculate the position of each element
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user