Skip to content

Commit

Permalink
TextSpan: collapse all neighboring content.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradallred committed Feb 18, 2015
1 parent 174a3dd commit 4943739
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions gemrb/core/GUI/TextSystem/TextContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ inline Region TextSpan::LayoutInFrameAtPoint(const Point& p, const Region& rgn)

Regions TextSpan::LayoutForPointInRegion(Point layoutPoint, const Region& rgn) const
{
// collapse with neighboring content
if (layoutPoint.y != 0) {
// if we arent the first line, then collapse with the above line
layoutPoint.y--;
}
if (layoutPoint.x != 0) {
layoutPoint.x--;
}

Regions layoutRegions;
const Point& drawOrigin = rgn.Origin();
const Font* layoutFont = LayoutFont();
Expand Down Expand Up @@ -235,10 +244,6 @@ Regions TextSpan::LayoutForPointInRegion(Point layoutPoint, const Region& rgn) c
// just because we didnt fit doesnt mean somethng else wont...
Region lineLayout = Region::RegionEnclosingRegions(lineExclusions);
assert(lineLayout.h % lineheight == 0);
if (layoutPoint.y != 0) {
// if we arent the first line, then collapse with the above line
lineLayout.y--;
}
layoutRegions.push_back(lineLayout);
lineExclusions.clear();
}
Expand All @@ -255,10 +260,6 @@ Regions TextSpan::LayoutForPointInRegion(Point layoutPoint, const Region& rgn) c

Region drawRegion = LayoutInFrameAtPoint(layoutPoint, rgn);
assert(drawRegion.h && drawRegion.w);
if (layoutPoint.y != 0) {
// if we arent the first line, then collapse with the above line
drawRegion.y--;
}
layoutRegions.push_back(drawRegion);
}
return layoutRegions;
Expand Down

0 comments on commit 4943739

Please sign in to comment.