Skip to content

Commit

Permalink
correction of MagicFoundation#17
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeus64 committed Sep 4, 2018
1 parent d570616 commit 8ac0ce4
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
Binary file modified lib/jar/com.alcinoe/alcinoe.jar
Binary file not shown.
78 changes: 78 additions & 0 deletions source/ALFmxCommon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,45 @@ function ALBreakText(const aPaint: JPaint;
((aMaxLines > 0) and (aTotalLines >= aMaxLines)) or
(compareValue(aCurrLineY + aMetrics.descent, aMaxHeight, TEpsilon.position) > 0) then break;

//add the last empty row if their is one
if (ATextIdx >= ATextLn) and aLineEndWithBreakLine and (aEllipsisLine = nil) then begin

//init aBreakedText
aBreakTextItem := TalBreakTextItem.Create;
try

//update aBreakTextItem
aBreakTextItem.line := StringToJstring('');
case AHTextAlign of
TTextAlign.Center: begin
aBreakTextItem.pos := TpointF.create((aMaxWidth - aEllipsisLineLn - aLineIndent) / 2, aCurrLineY);
end;
TTextAlign.Leading: begin
aBreakTextItem.pos := TpointF.create(aLineIndent, aCurrLineY);
end;
TTextAlign.Trailing: begin
aBreakTextItem.pos := TpointF.create(aMaxWidth - aEllipsisLineLn, aCurrLineY);
end;
end;
aBreakTextItem.rect := Trectf.Create(TPointF.Create(aBreakTextItem.pos.x,
aBreakTextItem.pos.Y - (-1*aMetrics.Ascent)),
0,
(-1*aMetrics.Ascent) + aMetrics.Descent);

// update aBreakTextItems
aBreakTextItems.Add(aBreakTextItem);

except
ALFreeAndNil(aBreakTextItem);
raise;
end;

//update aCurrLineY
aCurrLineY := aCurrLineY + aLineHeight;
inc(aTotalLines);

end;

end;

finally
Expand Down Expand Up @@ -3049,6 +3088,45 @@ function ALBreakText(const aFontColor: TalphaColor;
((aMaxLines > 0) and (aTotalLines >= aMaxLines)) or
(compareValue(aCurrLineY + aDescent, aMaxHeight, TEpsilon.position) > 0) then break;

//add the last empty row if their is one
if (ATextIdx >= ATextLn) and aLineEndWithBreakLine and (aEllipsisLine = '') then begin

//init aBreakedText
aBreakTextItem := TalBreakTextItem.Create;
try

//update aBreakTextItem
aBreakTextItem.line := '';
case AHTextAlign of
TTextAlign.Center: begin
aBreakTextItem.pos := TpointF.create((aMaxWidth - aEllipsisLineLn - aLineIndent) / 2, aCurrLineY);
end;
TTextAlign.Leading: begin
aBreakTextItem.pos := TpointF.create(aLineIndent, aCurrLineY);
end;
TTextAlign.Trailing: begin
aBreakTextItem.pos := TpointF.create(aMaxWidth - aEllipsisLineLn, aCurrLineY);
end;
end;
aBreakTextItem.rect := Trectf.Create(TPointF.Create(aBreakTextItem.pos.x,
aBreakTextItem.pos.Y - (-1*aAscent)),
0,
(-1*aAscent) + aDescent);

// update aBreakTextItems
aBreakTextItems.Add(aBreakTextItem);

except
ALFreeAndNil(aBreakTextItem);
raise;
end;

//update aCurrLineY
aCurrLineY := aCurrLineY + aLineHeight;
inc(aTotalLines);

end;

end;

end
Expand Down

0 comments on commit 8ac0ce4

Please sign in to comment.