From 205001dab8ceb976141878a0d27d8716aa74e451 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 4 Jan 2015 19:32:27 +0100 Subject: [PATCH] d3dx9_36-DrawText: Added patch to fix horizontal centering. --- patches/Makefile | 2 ++ ...izontal-centering-in-ID3DXFont_DrawT.patch | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 patches/d3dx9_36-DrawText/0002-d3dx9_36-Fix-horizontal-centering-in-ID3DXFont_DrawT.patch diff --git a/patches/Makefile b/patches/Makefile index 00281188..9e8225d4 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -409,8 +409,10 @@ d3dx9_36-DXTn.ok: wined3d-DXTn.ok .INTERMEDIATE: d3dx9_36-DrawText.ok d3dx9_36-DrawText.ok: $(call APPLY_FILE,d3dx9_36-DrawText/0001-d3dx9_36-Implement-ID3DXFontImpl_DrawText.patch) + $(call APPLY_FILE,d3dx9_36-DrawText/0002-d3dx9_36-Fix-horizontal-centering-in-ID3DXFont_DrawT.patch) @( \ echo '+ { "Christian Costa", "d3dx9_36: Implement ID3DXFontImpl_DrawText.", 1 },'; \ + echo '+ { "Christian Costa", "d3dx9_36: Fix horizontal centering in ID3DXFont_DrawText.", 1 },'; \ ) > d3dx9_36-DrawText.ok # Patchset d3dx9_36-Filter_Warnings diff --git a/patches/d3dx9_36-DrawText/0002-d3dx9_36-Fix-horizontal-centering-in-ID3DXFont_DrawT.patch b/patches/d3dx9_36-DrawText/0002-d3dx9_36-Fix-horizontal-centering-in-ID3DXFont_DrawT.patch new file mode 100644 index 00000000..5761c07a --- /dev/null +++ b/patches/d3dx9_36-DrawText/0002-d3dx9_36-Fix-horizontal-centering-in-ID3DXFont_DrawT.patch @@ -0,0 +1,32 @@ +From 93b91dc6b0ccaf6c9babab7adb218454df93b750 Mon Sep 17 00:00:00 2001 +From: Christian Costa +Date: Sun, 4 Jan 2015 18:43:42 +0100 +Subject: d3dx9_36: Fix horizontal centering in ID3DXFont_DrawText. + +Fix remaining text issues in Air Strike. +Should fix text placement in Stronghold Kingdoms. +--- + dlls/d3dx9_36/font.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c +index 368c784..fa52859 100644 +--- a/dlls/d3dx9_36/font.c ++++ b/dlls/d3dx9_36/font.c +@@ -254,6 +254,13 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, + return height; + } + ++ if (format & DT_CENTER) ++ { ++ UINT new_width = calc_rect.right - calc_rect.left; ++ calc_rect.left = (rect->right + rect->left - new_width) / 2; ++ calc_rect.right = calc_rect.left + new_width; ++ } ++ + if (height && (calc_rect.left < calc_rect.right)) + { + D3DLOCKED_RECT locked_rect; +-- +2.2.1 +