Skip to content

Commit

Permalink
KOTOR: Fix for too small widgets for their font
Browse files Browse the repository at this point in the history
  • Loading branch information
farmboy0 committed Dec 13, 2017
1 parent 73c0393 commit 61833ae
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/engines/kotor/gui/widgets/kotorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "src/aurora/gff3file.h"
#include "src/aurora/talkman.h"

#include "src/graphics/font.h"
#include "src/graphics/windowman.h"

#include "src/graphics/aurora/fontman.h"
Expand Down Expand Up @@ -321,10 +322,20 @@ void KotORWidget::load(const Aurora::GFF3Struct &gff) {
Text text = createText(gff);

if (!text.font.empty()) {
_text.reset(new Graphics::Aurora::HighlightableText(FontMan.get(text.font), extend.w, extend.h,
// Buttons in Jade are too small for their text
// If widget height is less than the font needs
// increase to font height and reposition
float fontHeight = FontMan.get(text.font).getFont().getHeight();
float tY = extend.y;
float tH = extend.h;
if (extend.h < fontHeight) {
tH = fontHeight;
tY = extend.y - (fontHeight - extend.h);
}
_text.reset(new Graphics::Aurora::HighlightableText(FontMan.get(text.font), extend.w, tH,
text.text, text.r, text.g, text.b, 1.0f, text.halign, text.valign));

_text->setPosition(extend.x, extend.y, -1.0f);
_text->setPosition(extend.x, tY, -1.0f);
_text->setTag(getTag());
_text->setClickable(true);
}
Expand Down

0 comments on commit 61833ae

Please sign in to comment.