mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:12:57 +00:00
Move GetKerningPairs from stubs to font.c. Ported GetKerningPairsA from Wine.
svn path=/trunk/; revision=31479
This commit is contained in:
parent
ffce1d4abf
commit
1d95f6ebc0
3 changed files with 95 additions and 40 deletions
|
@ -68,24 +68,6 @@ PolyTextOutA(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @unimplemented
|
|
||||||
*/
|
|
||||||
DWORD
|
|
||||||
STDCALL
|
|
||||||
GetKerningPairsA(
|
|
||||||
HDC a0,
|
|
||||||
DWORD a1,
|
|
||||||
LPKERNINGPAIR a2
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,28 +32,6 @@ PolyTextOutW(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
DWORD
|
|
||||||
STDCALL
|
|
||||||
GetKerningPairsW(HDC hdc,
|
|
||||||
ULONG cPairs,
|
|
||||||
LPKERNINGPAIR pkpDst)
|
|
||||||
{
|
|
||||||
if ((cPairs != 0) || (pkpDst == 0))
|
|
||||||
{
|
|
||||||
return NtGdiGetKerningPairs(hdc,cPairs,pkpDst);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1116,6 +1116,101 @@ GetOutlineTextMetricsW(
|
||||||
return NtGdiGetOutlineTextMetricsInternalW(hdc, cbData, lpOTM, &Tmd);
|
return NtGdiGetOutlineTextMetricsInternalW(hdc, cbData, lpOTM, &Tmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
DWORD
|
||||||
|
STDCALL
|
||||||
|
GetKerningPairsW(HDC hdc,
|
||||||
|
ULONG cPairs,
|
||||||
|
LPKERNINGPAIR pkpDst)
|
||||||
|
{
|
||||||
|
if ((cPairs != 0) || (pkpDst == 0))
|
||||||
|
{
|
||||||
|
return NtGdiGetKerningPairs(hdc,cPairs,pkpDst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
DWORD
|
||||||
|
STDCALL
|
||||||
|
GetKerningPairsA( HDC hDC,
|
||||||
|
DWORD cPairs,
|
||||||
|
LPKERNINGPAIR kern_pairA )
|
||||||
|
{
|
||||||
|
INT charset;
|
||||||
|
CHARSETINFO csi;
|
||||||
|
CPINFO cpi;
|
||||||
|
DWORD i, total_kern_pairs, kern_pairs_copied = 0;
|
||||||
|
KERNINGPAIR *kern_pairW;
|
||||||
|
|
||||||
|
if (!cPairs && kern_pairA)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
charset = GetTextCharset(hDC);
|
||||||
|
if (!TranslateCharsetInfo(ULongToPtr(charset), &csi, TCI_SRCCHARSET))
|
||||||
|
{
|
||||||
|
DPRINT1("Can't find codepage for charset %d\n", charset);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* GetCPInfo() will fail on CP_SYMBOL, and WideCharToMultiByte is supposed
|
||||||
|
* to fail on an invalid character for CP_SYMBOL.
|
||||||
|
*/
|
||||||
|
cpi.DefaultChar[0] = 0;
|
||||||
|
if (csi.ciACP != CP_SYMBOL && !GetCPInfo(csi.ciACP, &cpi))
|
||||||
|
{
|
||||||
|
DPRINT1("Can't find codepage %u info\n", csi.ciACP);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
DPRINT("charset %d => codepage %u\n", charset, csi.ciACP);
|
||||||
|
|
||||||
|
total_kern_pairs = GetKerningPairsW(hDC, 0, NULL);
|
||||||
|
if (!total_kern_pairs) return 0;
|
||||||
|
|
||||||
|
kern_pairW = HeapAlloc(GetProcessHeap(), 0, total_kern_pairs * sizeof(*kern_pairW));
|
||||||
|
GetKerningPairsW(hDC, total_kern_pairs, kern_pairW);
|
||||||
|
|
||||||
|
for (i = 0; i < total_kern_pairs; i++)
|
||||||
|
{
|
||||||
|
char first, second;
|
||||||
|
|
||||||
|
if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wFirst, 1, &first, 1, NULL, NULL))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wSecond, 1, &second, 1, NULL, NULL))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (first == cpi.DefaultChar[0] || second == cpi.DefaultChar[0])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (kern_pairA)
|
||||||
|
{
|
||||||
|
if (kern_pairs_copied >= cPairs) break;
|
||||||
|
|
||||||
|
kern_pairA->wFirst = (BYTE)first;
|
||||||
|
kern_pairA->wSecond = (BYTE)second;
|
||||||
|
kern_pairA->iKernAmount = kern_pairW[i].iKernAmount;
|
||||||
|
kern_pairA++;
|
||||||
|
}
|
||||||
|
kern_pairs_copied++;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, kern_pairW);
|
||||||
|
|
||||||
|
return kern_pairs_copied;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue