Skip to content

Commit

Permalink
KOTOR: Add a global font alias for fnt_d16x16 -> fnt_d16x16
Browse files Browse the repository at this point in the history
This means we only have to mind that once.
  • Loading branch information
DrMcCoy committed Jun 28, 2018
1 parent 4de9478 commit 25c0916
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/engines/aurora/kotorjadegui/kotorinventoryitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void KotORInventoryItem::load(const Aurora::GFF3Struct &gff) {
float r, g, b, a;
_text->getColor(r, g, b, a);

_countText.reset(new Graphics::Aurora::Text(FontMan.get("fnt_d16x16b"),
_countText.reset(new Graphics::Aurora::Text(FontMan.get("fnt_d16x16"),
"", r, g, b, a,
Graphics::Aurora::kHAlignRight,
Graphics::Aurora::kVAlignBottom));
Expand Down
16 changes: 5 additions & 11 deletions src/engines/aurora/kotorjadegui/kotorjadewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,15 @@ void KotORJadeWidget::load(const Aurora::GFF3Struct &gff) {
Text text = createText(gff);

if (!text.font.empty()) {
// Font "fnt_d16x16" in KotOR is broken, replace it with
// "fnt_d16x16b" which is otherwise identical
if (text.font == "fnt_d16x16")
text.font = "fnt_d16x16b";
// 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;
Graphics::Aurora::FontHandle font = FontMan.get(text.font);

const float fontHeight = font.getFont().getHeight();
float tY = extend.y, 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.reset(new Graphics::Aurora::HighlightableText(font, extend.w, tH,
text.text, text.r, text.g, text.b, 1.0f, text.halign, text.valign));

_text->setPosition(extend.x, tY, -1.0f);
Expand Down
1 change: 0 additions & 1 deletion src/engines/kotor/gui/loadscreen/loadscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ LoadScreen::LoadScreen(const Common::UString &loadScreenName, Console *console)
getPanel("TGuiPanel")->setFill("load_" + loadScreenName);

// TODO: Add loading hints according to loadscreenhints.2da
getLabel("LBL_HINT")->setFont("fnt_d16x16b");
getLabel("LBL_HINT")->setText("");

addBackground(kBackgroundTypeLoad);
Expand Down
3 changes: 3 additions & 0 deletions src/engines/kotor/kotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ void KotOREngine::initResources(LoadProgress &progress) {
progress.step("Registering file formats");
registerModelLoader(new KotORModelLoader);
FontMan.setFormat(Graphics::Aurora::kFontFormatTexture);

if (ResMan.hasResource("fnt_d16x16b", Aurora::kResourceImage))
FontMan.addAlias("fnt_d16x16", "fnt_d16x16b");
}

void KotOREngine::initCursorsRemap() {
Expand Down

0 comments on commit 25c0916

Please sign in to comment.