- Mesaj
- 1
- Beğeni
- 0
- Puan
- 1
- Ticaret Puanı
- 0
C++:
GrpFontTexture.cpp
/// 1.
// Search
#include "Util.h"
// Add below
#define __FONT_TEXTURE_FIX__ // Adds padding to prevent random dots in font textures.
/// 2.
// Search @ CGraphicFontTexture::GetFont
logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
// Replace with
#if defined(__FONT_TEXTURE_FIX__)
logFont.lfOutPrecision = OUT_TT_PRECIS;
#else
logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
#endif
/// 3.
// Search @ CGraphicFontTexture::TCharacterInfomation* CGraphicFontTexture::UpdateCharacterInfomation
int width = m_dib.GetWidth();
int height = m_dib.GetHeight();
// Add below
#if defined(__FONT_TEXTURE_FIX__)
const int padding = 1;
#endif
/// 4.
// Search @ CGraphicFontTexture::TCharacterInfomation* CGraphicFontTexture::UpdateCharacterInfomation
if (m_x + size.cx >= (width - 1))
// Replace with
#if defined(__FONT_TEXTURE_FIX__)
if (m_x + size.cx + padding >= (width - 1))
#else
if (m_x + size.cx >= (width - 1))
#endif
/// 5.
// Search @ CGraphicFontTexture::TCharacterInfomation* CGraphicFontTexture::UpdateCharacterInfomation
if (m_y + size.cy >= (height - 1))
// Replace with
#if defined(__FONT_TEXTURE_FIX__)
if (m_y + size.cy + padding >= (height - 1))
#else
if (m_y + size.cy >= (height - 1))
#endif
/// 6.
// Search @ CGraphicFontTexture::TCharacterInfomation* CGraphicFontTexture::UpdateCharacterInfomation
m_x += size.cx;
// Replace with
#if defined(__FONT_TEXTURE_FIX__)
m_x += size.cx + padding;
#else
m_x += size.cx;
#endif
I also decided to use `OUT_TT_PRECIS` over `OUT_DEFAULT_PRECIS` because, after some research, I learned that it provides better rendering, especially for scaling, anti-aliasing, and glyph alignment.