From 93b91dc6b0ccaf6c9babab7adb218454df93b750 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
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

