Commit f801e27d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiGetGlyphIndicesW for GetGlyphIndicesW.

parent 5a7505e8
......@@ -4189,36 +4189,6 @@ UINT WINAPI NtGdiGetTextCharsetInfo( HDC hdc, FONTSIGNATURE *fs, DWORD flags )
}
/***********************************************************************
* FONT_mbtowc
*
* Returns a Unicode translation of str using the charset of the
* currently selected font in hdc. If count is -1 then str is assumed
* to be '\0' terminated, otherwise it contains the number of bytes to
* convert. If plenW is non-NULL, on return it will point to the
* number of WCHARs that have been written. If pCP is non-NULL, on
* return it will point to the codepage used in the conversion. The
* caller should free the returned LPWSTR from the process heap
* itself.
*/
static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
{
UINT cp;
INT lenW;
LPWSTR strW;
cp = GdiGetCodePage( hdc );
if(count == -1) count = strlen(str);
lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR));
MultiByteToWideChar(cp, 0, str, count, strW, lenW);
TRACE("mapped %s -> %s\n", debugstr_an(str, count), debugstr_wn(strW, lenW));
if(plenW) *plenW = lenW;
if(pCP) *pCP = cp;
return strW;
}
/***********************************************************************
* NtGdiHfontCreate (win32u.@)
*/
HFONT WINAPI NtGdiHfontCreate( const ENUMLOGFONTEXDVW *penumex, ULONG size, ULONG type,
......@@ -6074,42 +6044,21 @@ DWORD WINAPI NtGdiGetFontData( HDC hdc, DWORD table, DWORD offset, void *buffer,
}
/*************************************************************************
* GetGlyphIndicesA [GDI32.@]
*/
DWORD WINAPI GetGlyphIndicesA(HDC hdc, LPCSTR lpstr, INT count,
LPWORD pgi, DWORD flags)
{
DWORD ret;
WCHAR *lpstrW;
INT countW;
TRACE("(%p, %s, %d, %p, 0x%x)\n",
hdc, debugstr_an(lpstr, count), count, pgi, flags);
lpstrW = FONT_mbtowc(hdc, lpstr, count, &countW, NULL);
ret = GetGlyphIndicesW(hdc, lpstrW, countW, pgi, flags);
HeapFree(GetProcessHeap(), 0, lpstrW);
return ret;
}
/*************************************************************************
* GetGlyphIndicesW [GDI32.@]
* NtGdiGetGlyphIndicesW (win32u.@)
*/
DWORD WINAPI GetGlyphIndicesW(HDC hdc, LPCWSTR lpstr, INT count,
LPWORD pgi, DWORD flags)
DWORD WINAPI NtGdiGetGlyphIndicesW( HDC hdc, const WCHAR *str, INT count,
WORD *indices, DWORD flags )
{
DC *dc = get_dc_ptr(hdc);
PHYSDEV dev;
DWORD ret;
TRACE("(%p, %s, %d, %p, 0x%x)\n",
hdc, debugstr_wn(lpstr, count), count, pgi, flags);
TRACE( "(%p, %s, %d, %p, 0x%x)\n", hdc, debugstr_wn(str, count), count, indices, flags );
if(!dc) return GDI_ERROR;
dev = GET_DC_PHYSDEV( dc, pGetGlyphIndices );
ret = dev->funcs->pGetGlyphIndices( dev, lpstr, count, pgi, flags );
ret = dev->funcs->pGetGlyphIndices( dev, str, count, indices, flags );
release_dc_ptr( dc );
return ret;
}
......
......@@ -298,7 +298,7 @@
@ stdcall GetFontResourceInfoW(wstr ptr ptr long)
@ stdcall GetFontUnicodeRanges(ptr ptr)
@ stdcall GetGlyphIndicesA(long ptr long ptr long)
@ stdcall GetGlyphIndicesW(long ptr long ptr long)
@ stdcall GetGlyphIndicesW(long ptr long ptr long) NtGdiGetGlyphIndicesW
@ stdcall GetGlyphOutline(long long long ptr long ptr ptr) GetGlyphOutlineA
@ stdcall GetGlyphOutlineA(long long long ptr long ptr ptr)
@ stdcall GetGlyphOutlineW(long long long ptr long ptr ptr)
......
......@@ -1187,7 +1187,7 @@ DWORD WINAPI GetCharacterPlacementW( HDC hdc, const WCHAR *str, INT count, INT m
}
if (result->lpGlyphs)
GetGlyphIndicesW( hdc, str, set_cnt, result->lpGlyphs, 0 );
NtGdiGetGlyphIndicesW( hdc, str, set_cnt, result->lpGlyphs, 0 );
if (GetTextExtentPoint32W( hdc, str, count, &size ))
ret = MAKELONG( size.cx + kern_total, size.cy );
......@@ -1897,3 +1897,20 @@ DWORD WINAPI GetFontLanguageInfo( HDC hdc )
return result;
}
/*************************************************************************
* GetGlyphIndicesA (GDI32.@)
*/
DWORD WINAPI GetGlyphIndicesA( HDC hdc, const char *str, INT count, WORD *indices, DWORD flags )
{
DWORD ret;
WCHAR *strW;
INT countW;
TRACE( "(%p, %s, %d, %p, 0x%x)\n", hdc, debugstr_an(str, count), count, indices, flags );
strW = text_mbtowc( hdc, str, count, &countW, NULL );
ret = NtGdiGetGlyphIndicesW( hdc, strW, countW, indices, flags );
HeapFree( GetProcessHeap(), 0, strW );
return ret;
}
......@@ -676,7 +676,7 @@ DWORD OpenType_CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, WORD
if (utf32c < 0x10000)
{
WCHAR ch = utf32c;
return GetGlyphIndicesW(hdc, &ch, 1, glyph_index, flags);
return NtGdiGetGlyphIndicesW(hdc, &ch, 1, glyph_index, flags);
}
if (!psc->CMAP_format12_Table)
......
......@@ -723,7 +723,7 @@ int SHAPE_does_GSUB_feature_apply_to_chars(HDC hdc, SCRIPT_ANALYSIS *psa, Script
INT rc;
glyphs = heap_calloc(count, 2 * sizeof(*glyphs));
GetGlyphIndicesW(hdc, chars, count, glyphs, 0);
NtGdiGetGlyphIndicesW(hdc, chars, count, glyphs, 0);
rc = apply_GSUB_feature_to_glyph(hdc, psa, psc, glyphs, 0, write_dir, &glyph_count, feature);
if (rc > GSUB_E_NOGLYPH)
rc = count - glyph_count;
......@@ -919,7 +919,7 @@ static void mark_invalid_combinations(HDC hdc, const WCHAR* pwcChars, INT cChars
for (i = 0; i < cChars; i++)
context_type[i] = lex(pwcChars[i]);
GetGlyphIndicesW(hdc, &invalid, 1, &invalid_glyph, 0);
NtGdiGetGlyphIndicesW(hdc, &invalid, 1, &invalid_glyph, 0);
for (i = 1, g=1; i < cChars - 1; i++, g++)
{
if (context_type[i] != 0 && context_type[i+write_dir]==context_type[i])
......@@ -1163,7 +1163,9 @@ static void ContextualShape_Arabic(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *p
{
/* fall back to presentation form B */
WCHAR context_char = wine_shaping_forms[pwcChars[char_index] - FIRST_ARABIC_CHAR][context_shape[char_index]];
if (context_char != pwcChars[char_index] && GetGlyphIndicesW(hdc, &context_char, 1, &newGlyph, 0) != GDI_ERROR && newGlyph != 0x0000)
if (context_char != pwcChars[char_index] &&
NtGdiGetGlyphIndicesW(hdc, &context_char, 1, &newGlyph, 0) != GDI_ERROR &&
newGlyph != 0x0000)
pwOutGlyphs[glyph_index] = newGlyph;
}
}
......@@ -2319,7 +2321,7 @@ static void ContextualShape_Sinhala(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *
}
/* Step 4: Base Form application to syllables */
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
ShapeIndicSyllables(hdc, psc, psa, input, cChars, syllables, syllable_count, pwOutGlyphs, pcGlyphs, pwLogClust, sinhala_lex, NULL, TRUE);
......@@ -2374,7 +2376,7 @@ static void ContextualShape_Devanagari(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSI
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, devanagari_lex, Reorder_Like_Devanagari, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2431,7 +2433,7 @@ static void ContextualShape_Bengali(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, bengali_lex, Reorder_Like_Bengali, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Initial form is only applied to the beginning of words */
......@@ -2494,7 +2496,7 @@ static void ContextualShape_Gurmukhi(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, gurmukhi_lex, Reorder_Like_Bengali, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2534,7 +2536,7 @@ static void ContextualShape_Gujarati(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
/* Step 1: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, gujarati_lex, Reorder_Like_Devanagari, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 2: Base Form application to syllables */
......@@ -2590,7 +2592,7 @@ static void ContextualShape_Oriya(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, oriya_lex, Reorder_Like_Bengali, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2640,7 +2642,7 @@ static void ContextualShape_Tamil(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, tamil_lex, Reorder_Like_Bengali, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2689,7 +2691,7 @@ static void ContextualShape_Telugu(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *p
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, telugu_lex, Reorder_Like_Bengali, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2741,7 +2743,7 @@ static void ContextualShape_Kannada(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, kannada_lex, Reorder_Like_Kannada, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2786,7 +2788,7 @@ static void ContextualShape_Malayalam(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
/* Step 2: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, malayalam_lex, Reorder_Like_Devanagari, modern);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 3: Base Form application to syllables */
......@@ -2820,7 +2822,7 @@ static void ContextualShape_Khmer(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
/* Step 1: Reorder within Syllables */
Indic_ReorderCharacters( hdc, psa, psc, input, cCount, &syllables, &syllable_count, khmer_lex, Reorder_Like_Devanagari, FALSE);
TRACE("reordered string %s\n",debugstr_wn(input,cCount));
GetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
NtGdiGetGlyphIndicesW(hdc, input, cCount, pwOutGlyphs, 0);
*pcGlyphs = cCount;
/* Step 2: Base Form application to syllables */
......
......@@ -694,7 +694,7 @@ static inline BOOL set_cache_font_properties(const HDC hdc, ScriptCache *sc)
U+0640: kashida */
WORD gi[4];
if (GetGlyphIndicesW(hdc, chars, 4, gi, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
if (NtGdiGetGlyphIndicesW(hdc, chars, 4, gi, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
{
if(gi[0] != 0xFFFF) /* 0xFFFF: index of default non exist char */
sc->sfp.wgBlank = gi[0];
......@@ -3499,7 +3499,8 @@ HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars
{
WORD glyph;
if (!hdc) return E_PENDING;
if (GetGlyphIndicesW(hdc, &inChar, 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) return S_FALSE;
if (NtGdiGetGlyphIndicesW(hdc, &inChar, 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR)
return S_FALSE;
if (glyph == 0xffff)
{
hr = S_FALSE;
......
......@@ -243,6 +243,8 @@ BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result );
INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap );
BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr );
DWORD WINAPI NtGdiGetFontData( HDC hdc, DWORD table, DWORD offset, void *buffer, DWORD length );
DWORD WINAPI NtGdiGetGlyphIndicesW( HDC hdc, const WCHAR *str, INT count,
WORD *indices, DWORD flags );
DWORD WINAPI NtGdiGetGlyphOutlineW( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics,
DWORD size, void *buffer, const MAT2 *mat2,
BOOL ignore_rotation );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment