From 98348bd652283ba0d163dfa0a613832a0e2c05fa Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Sat, 16 Feb 2019 15:43:07 -0800 Subject: [PATCH] Added support for BitmapFont symbol padding Added padding to FontTBL.BitmapFont to fix issue where some symbols were bleeding adjacent symbols --- core/src/gdx/diablo/codec/FontTBL.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/gdx/diablo/codec/FontTBL.java b/core/src/gdx/diablo/codec/FontTBL.java index de7b8ae7..55302a9f 100644 --- a/core/src/gdx/diablo/codec/FontTBL.java +++ b/core/src/gdx/diablo/codec/FontTBL.java @@ -29,6 +29,7 @@ public class FontTBL { private static final boolean DEBUG_CHARS = DEBUG && false; public static final int CHARS = 256; + private static final int CHAR_SHEET_PADDING = 2; final Header header; final CharData cData[]; @@ -70,8 +71,8 @@ public class FontTBL { glyph.id = c; - glyph.srcX = (c % 16) * charWidth; - glyph.srcY = (c / 16) * charHeight; + glyph.srcX = (c % 16) * (charWidth + CHAR_SHEET_PADDING); + glyph.srcY = (c / 16) * (charHeight + CHAR_SHEET_PADDING); CharData cData = FontTBL.this.cData[c]; glyph.width = cData.width; @@ -89,8 +90,8 @@ public class FontTBL { Pixmap createFontSheet() { DC.Direction dir = dc6.getDirection(0); - final int columnWidth = dir.box.width; - final int columnHeight = dir.box.height; + final int columnWidth = dir.box.width + CHAR_SHEET_PADDING; + final int columnHeight = dir.box.height + CHAR_SHEET_PADDING; final int columns = 16; final int rows = 16;