mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
98 lines
3.6 KiB
Diff
98 lines
3.6 KiB
Diff
From 1f4a7bc3ed8ede33a6e623bf49067550cee433d8 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
Date: Sun, 19 Mar 2017 15:52:42 +0100
|
|
Subject: gdi32: Treat lpResults as optional in GetCharacterPlacement.
|
|
|
|
---
|
|
dlls/gdi32/font.c | 13 ++++++++++++-
|
|
dlls/gdi32/tests/font.c | 32 ++++++++++++++++++++++++++++++++
|
|
2 files changed, 44 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
|
|
index ddd0051ab6..fcc24d8645 100644
|
|
--- a/dlls/gdi32/font.c
|
|
+++ b/dlls/gdi32/font.c
|
|
@@ -3201,10 +3201,18 @@ GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount,
|
|
TRACE("%s, %d, %d, 0x%08x\n",
|
|
debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags);
|
|
|
|
+ lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
|
|
+
|
|
+ if (!lpResults)
|
|
+ {
|
|
+ ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, NULL, dwFlags);
|
|
+ HeapFree(GetProcessHeap(), 0, lpStringW);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
/* both structs are equal in size */
|
|
memcpy(&resultsW, lpResults, sizeof(resultsW));
|
|
|
|
- lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
|
|
if(lpResults->lpOutString)
|
|
resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW);
|
|
|
|
@@ -3259,6 +3267,9 @@ GetCharacterPlacementW(
|
|
TRACE("%s, %d, %d, 0x%08x\n",
|
|
debugstr_wn(lpString, uCount), uCount, nMaxExtent, dwFlags);
|
|
|
|
+ if (!lpResults)
|
|
+ return GetTextExtentPoint32W(hdc, lpString, uCount, &size) ? MAKELONG(size.cx, size.cy) : 0;
|
|
+
|
|
TRACE("lStructSize=%d, lpOutString=%p, lpOrder=%p, lpDx=%p, lpCaretPos=%p\n"
|
|
"lpClass=%p, lpGlyphs=%p, nGlyphs=%u, nMaxFit=%d\n",
|
|
lpResults->lStructSize, lpResults->lpOutString, lpResults->lpOrder,
|
|
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
|
|
index fb27f8e005..974b471462 100644
|
|
--- a/dlls/gdi32/tests/font.c
|
|
+++ b/dlls/gdi32/tests/font.c
|
|
@@ -4910,6 +4910,37 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
|
|
ok(ratio >= 90 && ratio <= 110, "expected width/height ratio 90-110, got %d\n", ratio);
|
|
}
|
|
|
|
+static void test_GetCharacterPlacement(void)
|
|
+{
|
|
+ GCP_RESULTSA result;
|
|
+ DWORD size, size2;
|
|
+ WCHAR glyphs[20];
|
|
+ HDC hdc;
|
|
+
|
|
+ hdc = CreateCompatibleDC(0);
|
|
+ ok(!!hdc, "CreateCompatibleDC failed\n");
|
|
+
|
|
+ memset(&result, 0, sizeof(result));
|
|
+ result.lStructSize = sizeof(result);
|
|
+ result.lpGlyphs = glyphs;
|
|
+ result.nGlyphs = 20;
|
|
+
|
|
+ size = GetCharacterPlacementA(hdc, "Wine Test", 9, 0, &result, 0);
|
|
+ ok(size, "GetCharacterPlacementA failed!\n");
|
|
+
|
|
+ size2 = GetCharacterPlacementA(hdc, "Wine Test", 9, 0, NULL, 0);
|
|
+ ok(size2, "GetCharacterPlacementA failed!\n");
|
|
+ ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
|
|
+
|
|
+ size2 = GetCharacterPlacementA(hdc, "Wine Test", 9, 1024, NULL, GCP_REORDER);
|
|
+ ok(size2, "GetCharacterPlacementA failed!\n");
|
|
+ ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
|
|
+
|
|
+ size = GetCharacterPlacementA(hdc, "Wine Test", 9, 1024, &result, GCP_REORDER);
|
|
+ ok(size, "GetCharacterPlacementA failed!\n");
|
|
+ ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
|
|
+}
|
|
+
|
|
static void test_CreateFontIndirect(void)
|
|
{
|
|
LOGFONTA lf, getobj_lf;
|
|
@@ -6682,6 +6713,7 @@ START_TEST(font)
|
|
test_GetTextMetrics2("Arial", -11);
|
|
test_GetTextMetrics2("Arial", -55);
|
|
test_GetTextMetrics2("Arial", -110);
|
|
+ test_GetCharacterPlacement();
|
|
test_CreateFontIndirect();
|
|
test_CreateFontIndirectEx();
|
|
test_oemcharset();
|
|
--
|
|
2.11.0
|
|
|