diff --git a/src/EterLib/BlockTexture.cpp b/src/EterLib/BlockTexture.cpp index f8464d5..d2b3e31 100644 --- a/src/EterLib/BlockTexture.cpp +++ b/src/EterLib/BlockTexture.cpp @@ -94,7 +94,16 @@ void CBlockTexture::Render(int ix, int iy) STATEMANAGER.SetTexture(0, m_lpd3dTexture); STATEMANAGER.SetTexture(1, NULL); STATEMANAGER.SetFVF(D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_DIFFUSE); + + STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + STATEMANAGER.SaveRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + STATEMANAGER.SaveRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 4, 0, 2); + + STATEMANAGER.RestoreRenderState(D3DRS_DESTBLEND); + STATEMANAGER.RestoreRenderState(D3DRS_SRCBLEND); + STATEMANAGER.RestoreRenderState(D3DRS_ALPHABLENDENABLE); } } @@ -141,10 +150,7 @@ void CBlockTexture::InvalidateRect(const RECT & c_rsrcRect) { for (int i = 0; i < iclipWidth; ++i) { - if (pdwSrc[i]) - pdwDst[i] = pdwSrc[i] | 0xff000000; - else - pdwDst[i] = 0; + pdwDst[i] = pdwSrc[i]; } pdwDst += dwDstWidth; pdwSrc += dwSrcWidth; diff --git a/src/EterLib/FontManager.cpp b/src/EterLib/FontManager.cpp index 8a88703..3181de3 100644 --- a/src/EterLib/FontManager.cpp +++ b/src/EterLib/FontManager.cpp @@ -62,8 +62,11 @@ bool CFontManager::Initialize() // Common Latin fonts m_fontPathMap["arial"] = "arial.ttf"; + m_fontPathMap["arial bold"] = "arialbd.ttf"; m_fontPathMap["tahoma"] = "tahoma.ttf"; + m_fontPathMap["tahoma bold"] = "tahomabd.ttf"; m_fontPathMap["verdana"] = "verdana.ttf"; + m_fontPathMap["verdana bold"] = "verdanab.ttf"; m_fontPathMap["times new roman"] = "times.ttf"; m_fontPathMap["courier new"] = "cour.ttf"; m_fontPathMap["segoe ui"] = "segoeui.ttf"; diff --git a/src/EterLib/TextBar.cpp b/src/EterLib/TextBar.cpp index 776183c..07d9843 100644 --- a/src/EterLib/TextBar.cpp +++ b/src/EterLib/TextBar.cpp @@ -6,7 +6,7 @@ #include #include -#include FT_BITMAP_H +#include FT_FREETYPE_H #include @@ -22,8 +22,17 @@ static struct STextBarGammaLUT { void CTextBar::__SetFont(int fontSize, bool isBold) { - // Create a per-instance FT_Face (this instance owns it) - m_ftFace = CFontManager::Instance().CreateFace("Tahoma"); + // Load bold font variant if available, otherwise fall back to regular + if (isBold) + { + m_ftFace = CFontManager::Instance().CreateFace("Tahoma Bold"); + if (!m_ftFace) + m_ftFace = CFontManager::Instance().CreateFace("Tahoma"); + } + else + { + m_ftFace = CFontManager::Instance().CreateFace("Tahoma"); + } if (!m_ftFace) return; @@ -109,11 +118,6 @@ void CTextBar::TextOut(int ix, int iy, const char * c_szText) continue; FT_GlyphSlot slot = m_ftFace->glyph; - - // Apply synthetic bold (32 = 0.5px embolden; 64 = 1px was too aggressive) - if (m_isBold && slot->bitmap.buffer) - FT_Bitmap_Embolden(CFontManager::Instance().GetLibrary(), &slot->bitmap, 32, 0); - FT_Bitmap& bitmap = slot->bitmap; int bmpX = penX + slot->bitmap_left; diff --git a/src/EterPythonLib/PythonGraphicModule.cpp b/src/EterPythonLib/PythonGraphicModule.cpp index 2acf8b1..ac8e815 100644 --- a/src/EterPythonLib/PythonGraphicModule.cpp +++ b/src/EterPythonLib/PythonGraphicModule.cpp @@ -38,7 +38,7 @@ PyObject* grpCreateBigTextBar(PyObject* poSelf, PyObject* poArgs) if (!PyTuple_GetInteger(poArgs, 2, &iFontSize)) return Py_BuildException(); - CTextBar * pTextBar = new CTextBar(iFontSize, true); + CTextBar * pTextBar = new CTextBar(iFontSize, false); if (!pTextBar->Create(iWidth, iHeight)) { delete pTextBar;