2V0-g: port the .fnt font pipeline over a FreeType GDI emulation
CGraphicText, CGraphicFontTexture and CGraphicDib are the 40250 bodies verbatim; CGraphicTextInstance is verbatim except that its D3D draws become UI render commands (one image quad per glyph, Bar for cursor/underline). - platform/Win32Gdi.cpp: the GDI subset those files call, over vendored FreeType 2.13.3, following GDI's LOGFONT cell height, win metrics and gasp rules; system font lookup with substitute and CJK fallback faces - Win32Crt: MultiByteToWideChar / WideCharToMultiByte (UTF-8 and 1252 by hand, other code pages through iconv) - CGraphicImageTexture memory textures: glyph pages reach Godot as "mem:<id>@<revision>"; Metin2PythonHost.memory_texture + Canvas cache - Util.cpp code page / font face table, SetDefaultCodePage at boot, DefaultFont_* block, fnt resource type, GetMaxTextureWidth/Height - TextTag, StringCodec, Arabic, Vietnamese copied from 40250 - tests: port.text (Tahoma 12 metrics, alignment, CP949), port.app_loop and python_host_test.gd now check glyph quads instead of text commands Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
141206cb69
commit
afe63bfa61
@@ -1,71 +1,115 @@
|
||||
// Platform skeleton for EterLib/GrpDIB.h (40250 EterLib/GrpDIB.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
// 40250 EterLib/GrpDIB.cpp, verbatim. The GDI calls are the FreeType-backed platform/Win32Gdi.cpp.
|
||||
#include "EterLib/StdAfx.h"
|
||||
#include "EterLib/GrpDIB.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CGraphicDib::CGraphicDib()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CGraphicDib::~CGraphicDib()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
auto CGraphicDib::Destroy() -> void
|
||||
void CGraphicDib::Initialize()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
m_hDC=NULL;
|
||||
m_hBmp=NULL;
|
||||
m_pvBuf=NULL;
|
||||
m_width=0;
|
||||
m_height=0;
|
||||
}
|
||||
|
||||
auto CGraphicDib::Create(HDC, int, int) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
void CGraphicDib::Destroy()
|
||||
{
|
||||
if (m_hBmp) DeleteObject(m_hBmp);
|
||||
if (m_hDC) DeleteDC(m_hDC);
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
auto CGraphicDib::SetBkMode(int) -> void
|
||||
bool CGraphicDib::Create(HDC hDC, int width, int height)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
Destroy();
|
||||
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
ZeroMemory(&m_bmi.bmiHeader, sizeof(BITMAPINFOHEADER));
|
||||
m_bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
m_bmi.bmiHeader.biWidth = m_width;
|
||||
m_bmi.bmiHeader.biHeight = -m_height;
|
||||
m_bmi.bmiHeader.biPlanes = 1;
|
||||
m_bmi.bmiHeader.biBitCount = 32;
|
||||
m_bmi.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
m_hDC=CreateCompatibleDC(hDC);
|
||||
if (!m_hDC)
|
||||
{
|
||||
assert(!"CGraphicDib::Create CreateCompatibleDC Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hBmp=CreateDIBSection(m_hDC, &m_bmi, DIB_RGB_COLORS, &m_pvBuf, NULL, 0);
|
||||
if (!m_hBmp)
|
||||
{
|
||||
assert(!"CGraphicDib::Create CreateDIBSection Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
SelectObject(m_hDC, m_hBmp);
|
||||
|
||||
::SetTextColor(m_hDC, RGB(255, 255, 255));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
auto CGraphicDib::TextOut(int, int, const char *) -> void
|
||||
HDC CGraphicDib::GetDCHandle()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return m_hDC;
|
||||
}
|
||||
|
||||
auto CGraphicDib::Put(HDC, int, int) -> void
|
||||
void CGraphicDib::SetBkMode(int iBkMode)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
::SetBkMode(m_hDC, iBkMode);
|
||||
}
|
||||
|
||||
auto CGraphicDib::GetWidth() -> int
|
||||
void CGraphicDib::TextOut(int ix, int iy, const char * c_szText)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
::SetBkColor(m_hDC, 0);
|
||||
::TextOut(m_hDC, ix, iy, c_szText, strlen(c_szText));
|
||||
}
|
||||
|
||||
auto CGraphicDib::GetHeight() -> int
|
||||
void CGraphicDib::Put(HDC hDC, int x, int y)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
SetDIBitsToDevice(
|
||||
hDC,
|
||||
x,
|
||||
y,
|
||||
m_width,
|
||||
m_height,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
m_height,
|
||||
m_pvBuf,
|
||||
&m_bmi,
|
||||
DIB_RGB_COLORS
|
||||
);
|
||||
}
|
||||
|
||||
auto CGraphicDib::GetPointer() -> void *
|
||||
void* CGraphicDib::GetPointer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<void *>();
|
||||
return m_pvBuf;
|
||||
}
|
||||
|
||||
auto CGraphicDib::GetDCHandle() -> HDC
|
||||
int CGraphicDib::GetWidth()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<HDC>();
|
||||
return m_width;
|
||||
}
|
||||
|
||||
auto CGraphicDib::Initialize() -> void
|
||||
int CGraphicDib::GetHeight()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return m_height;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user