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:
shenlei
2026-09-23 14:17:25 +09:00
co-authored by Claude Opus 5.5
parent 141206cb69
commit afe63bfa61
272 changed files with 137097 additions and 316 deletions
+14 -10
View File
@@ -4,6 +4,7 @@
#include "EterLib/GrpTexture.h"
#include "../PlatformStub.h"
#include "UIRenderCommands.h"
auto CGraphicTexture::IsEmpty() const -> bool
{
@@ -27,34 +28,37 @@ auto CGraphicTexture::SetTextureStage(int) const -> void
auto CGraphicTexture::GetD3DTexture() const -> LPDIRECT3DTEXTURE8
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<LPDIRECT3DTEXTURE8>();
return m_lpd3dTexture;
}
// PORT: safe_release(m_lpd3dTexture); the only textures this platform creates are memory textures.
auto CGraphicTexture::DestroyDeviceObjects() -> void
{
MT_PLATFORM_STUB();
if (m_lpd3dTexture)
UIRenderReleaseMemoryTexture(m_lpd3dTexture);
m_lpd3dTexture = NULL;
}
CGraphicTexture::CGraphicTexture()
{
m_bEmpty = true;
m_width = m_height = 0;
m_lpd3dTexture = nullptr;
Initialize();
}
CGraphicTexture::~CGraphicTexture()
{
MT_PLATFORM_STUB();
}
auto CGraphicTexture::Destroy() -> void
{
m_bEmpty = true;
m_width = m_height = 0;
DestroyDeviceObjects();
Initialize();
}
auto CGraphicTexture::Initialize() -> void
{
MT_PLATFORM_STUB();
m_lpd3dTexture = NULL;
m_width = 0;
m_height = 0;
m_bEmpty = true;
}