mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-11 11:02:34 +02:00
fpvectorial-svg: Improves text positioning
git-svn-id: trunk@45168 -
This commit is contained in:
parent
fa2cd799f8
commit
0af01e94b2
@ -79,7 +79,7 @@ type
|
|||||||
function DebugOutTokensAsString: string;
|
function DebugOutTokensAsString: string;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TSVGCoordinateKind = (sckUnknown, sckX, sckY, sckXDelta, sckYDelta, sckYSize);
|
TSVGCoordinateKind = (sckUnknown, sckX, sckY, sckXDelta, sckYDelta, sckXSize, sckYSize);
|
||||||
|
|
||||||
TSVGUnit = (suPX, suMM);
|
TSVGUnit = (suPX, suMM);
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if AKey = 'stroke-width' then
|
else if AKey = 'stroke-width' then
|
||||||
begin
|
begin
|
||||||
ADestEntity.Pen.Width := Round(StringWithUnitToFloat(AValue, sckX));
|
ADestEntity.Pen.Width := Round(StringWithUnitToFloat(AValue, sckXSize));
|
||||||
Result := Result + [spbfPenWidth];
|
Result := Result + [spbfPenWidth];
|
||||||
end
|
end
|
||||||
else if AKey = 'stroke-opacity' then
|
else if AKey = 'stroke-opacity' then
|
||||||
@ -982,8 +982,8 @@ begin
|
|||||||
end
|
end
|
||||||
else if AKey = 'font-size' then
|
else if AKey = 'font-size' then
|
||||||
begin
|
begin
|
||||||
if ADestEntity <> nil then ADestEntity.Font.Size := Round(StringWithUnitToFloat(AValue, sckX, suPX));
|
if ADestEntity <> nil then ADestEntity.Font.Size := Round(StringWithUnitToFloat(AValue, sckXSize, suPX));
|
||||||
if ADestStyle <> nil then ADestStyle.Font.Size := Round(StringWithUnitToFloat(AValue, sckX, suPX));
|
if ADestStyle <> nil then ADestStyle.Font.Size := Round(StringWithUnitToFloat(AValue, sckXSize, suPX));
|
||||||
Result := Result + [spbfFontSize];
|
Result := Result + [spbfFontSize];
|
||||||
end
|
end
|
||||||
else if AKey = 'font-family' then
|
else if AKey = 'font-family' then
|
||||||
@ -2596,7 +2596,7 @@ begin
|
|||||||
|
|
||||||
// Set the coordinates
|
// Set the coordinates
|
||||||
ConvertSVGCoordinatesToFPVCoordinates(
|
ConvertSVGCoordinatesToFPVCoordinates(
|
||||||
AData, lx, ly, lParagraph.X, lParagraph.Y);
|
AData, lx, ly, lParagraph.X, lParagraph.Y, False);
|
||||||
|
|
||||||
// Now add other lines, which appear as <tspan ...>another line</tspan>
|
// Now add other lines, which appear as <tspan ...>another line</tspan>
|
||||||
// Example:
|
// Example:
|
||||||
@ -2690,7 +2690,8 @@ function TvSVGVectorialReader.StringWithUnitToFloat(AStr: string;
|
|||||||
begin
|
begin
|
||||||
case ACoordKind of
|
case ACoordKind of
|
||||||
sckX: Result := (Result - ViewBox_Left) * Page_Width / ViewBox_Width;
|
sckX: Result := (Result - ViewBox_Left) * Page_Width / ViewBox_Width;
|
||||||
sckXDelta: Result := Result * Page_Width / ViewBox_Width;
|
sckXDelta,
|
||||||
|
sckXSize: Result := Result * Page_Width / ViewBox_Width;
|
||||||
sckY: Result := Page_Height - (Result - ViewBox_Top) * Page_Height / ViewBox_Height;
|
sckY: Result := Page_Height - (Result - ViewBox_Top) * Page_Height / ViewBox_Height;
|
||||||
sckYDelta: Result := - (Result - ViewBox_Top) * Page_Height / ViewBox_Height;
|
sckYDelta: Result := - (Result - ViewBox_Top) * Page_Height / ViewBox_Height;
|
||||||
sckYSize: Result := Result * Page_Height / ViewBox_Height;
|
sckYSize: Result := Result * Page_Height / ViewBox_Height;
|
||||||
|
Loading…
Reference in New Issue
Block a user