mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-09-20 17:46:09 -04:00
Merge pull request #71 from markwal/lastlinewidth
getTextBounds should consider the last line width
This commit is contained in:
commit
2fced4b700
@ -772,6 +772,7 @@ void Adafruit_GFX::getTextBounds(char *str, int16_t x, int16_t y,
|
||||
}
|
||||
// End of string
|
||||
if(lineWidth) y += textsize * 8; // Add height of last (or only) line
|
||||
if(lineWidth > maxWidth) maxWidth = lineWidth; // Is the last or only line the widest?
|
||||
*w = maxWidth - 1; // Don't include last interchar x gap
|
||||
*h = y - *y1;
|
||||
|
||||
@ -861,6 +862,7 @@ void Adafruit_GFX::getTextBounds(const __FlashStringHelper *str,
|
||||
}
|
||||
// End of string
|
||||
if(lineWidth) y += textsize * 8; // Add height of last (or only) line
|
||||
if(lineWidth > maxWidth) maxWidth = lineWidth; // Is the last or only line the widest?
|
||||
*w = maxWidth - 1; // Don't include last interchar x gap
|
||||
*h = y - *y1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user