mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Tests - fixed tests failing due to font issue on test machine
This commit is contained in:
parent
0914d476ef
commit
e16bd30366
1 changed files with 6 additions and 0 deletions
|
@ -158,12 +158,18 @@ public class TextLayoutGraphics extends Graphics2D {
|
||||||
//Insert spaces to account for distance past last field in row
|
//Insert spaces to account for distance past last field in row
|
||||||
FontMetrics metrics = COMPONENT.getFontMetrics(sortedTextInfo.font);
|
FontMetrics metrics = COMPONENT.getFontMetrics(sortedTextInfo.font);
|
||||||
int spaceWidth = metrics.charWidth(' ');
|
int spaceWidth = metrics.charWidth(' ');
|
||||||
|
if (spaceWidth == 0) {
|
||||||
|
// some environments report 0 for some fonts
|
||||||
|
spaceWidth = 4;
|
||||||
|
}
|
||||||
|
|
||||||
int fillSpaces =
|
int fillSpaces =
|
||||||
Math.round((float) (sortedTextInfo.point.x - lastXPos) / (float) spaceWidth);
|
Math.round((float) (sortedTextInfo.point.x - lastXPos) / (float) spaceWidth);
|
||||||
//Account for the case where there's a very small amount of space between fields
|
//Account for the case where there's a very small amount of space between fields
|
||||||
if (fillSpaces == 0 && sortedTextInfo.point.x > lastXPos) {
|
if (fillSpaces == 0 && sortedTextInfo.point.x > lastXPos) {
|
||||||
fillSpaces = 1;
|
fillSpaces = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < fillSpaces; j++) {
|
for (int j = 0; j < fillSpaces; j++) {
|
||||||
buffer.append(' ');
|
buffer.append(' ');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue