* Sync with Wine 1.5.19.

svn path=/trunk/; revision=58282
This commit is contained in:
Amine Khaldi 2013-02-03 20:49:47 +00:00
parent 358bfbd6c8
commit 17089cd7b4
6 changed files with 1795 additions and 262 deletions

View file

@ -208,7 +208,7 @@ static INT Indic_process_next_syllable( LPCWSTR input, INT cChar, INT start, INT
return parse_consonant_syllable(input, cChar, start, main, next, lex);
}
static BOOL Consonent_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
static BOOL Consonant_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
{
if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant)
{
@ -225,7 +225,7 @@ static BOOL Consonent_is_post_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCac
return FALSE;
}
static BOOL Consonent_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
static BOOL Consonant_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
{
if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant)
{
@ -242,7 +242,7 @@ static BOOL Consonent_is_below_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCa
return FALSE;
}
static BOOL Consonent_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
static BOOL Consonant_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical, BOOL modern)
{
if (is_consonant(lexical(pwChar[s->base])) && s->base > s->start && lexical(pwChar[s->base-1]) == lex_Halant)
{
@ -259,7 +259,7 @@ static BOOL Consonent_is_pre_base_form(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCach
return FALSE;
}
static BOOL Consonent_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical)
static BOOL Consonant_is_ralf(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LPCWSTR pwChar, IndicSyllable *s, lexical_function lexical)
{
if ((lexical(pwChar[s->start])==lex_Ra) && s->end > s->start && lexical(pwChar[s->start+1]) == lex_Halant)
return (SHAPE_does_GSUB_feature_apply_to_chars(hdc, psa, psc, &pwChar[s->start], 1, 2, "rphf") > 0);
@ -273,7 +273,7 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP
BOOL pref = FALSE;
/* remove ralf from consideration */
if (Consonent_is_ralf(hdc, psa, psc, input, s, lex))
if (Consonant_is_ralf(hdc, psa, psc, input, s, lex))
{
s->ralf = s->start;
s->start+=2;
@ -290,7 +290,7 @@ static int FindBaseConsonant(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, LP
}
}
while ((blwf = Consonent_is_below_base_form(hdc, psa, psc, input, s, lex, modern)) || Consonent_is_post_base_form(hdc, psa, psc, input, s, lex, modern) || (pref = Consonent_is_pre_base_form(hdc, psa, psc, input, s, lex, modern)))
while ((blwf = Consonant_is_below_base_form(hdc, psa, psc, input, s, lex, modern)) || Consonant_is_post_base_form(hdc, psa, psc, input, s, lex, modern) || (pref = Consonant_is_pre_base_form(hdc, psa, psc, input, s, lex, modern)))
{
if (blwf && s->blwf == -1)
s->blwf = s->base - 1;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -729,9 +729,61 @@ static inline BOOL heap_free(LPVOID mem)
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline WCHAR get_cache_default_char(SCRIPT_CACHE *psc)
/* TODO Fix font properties on Arabic locale */
static inline BOOL set_cache_font_properties(const HDC hdc, ScriptCache *sc)
{
return ((ScriptCache *)*psc)->tm.tmDefaultChar;
if (!sc->sfnt)
{
sc->sfp.wgBlank = sc->tm.tmBreakChar;
sc->sfp.wgDefault = sc->tm.tmDefaultChar;
sc->sfp.wgInvalid = sc->sfp.wgBlank;
sc->sfp.wgKashida = 0xFFFF;
sc->sfp.iKashidaWidth = 0;
}
else
{
static const WCHAR chars[4] = {0x0020, 0x200B, 0xF71B, 0x0640};
/* U+0020: numeric space
U+200B: zero width space
U+F71B: unknow char found by black box testing
U+0640: kashida */
WORD gi[4];
if (GetGlyphIndicesW(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];
else
sc->sfp.wgBlank = 0;
sc->sfp.wgDefault = 0;
if (gi[2] != 0xFFFF)
sc->sfp.wgInvalid = gi[2];
else if (gi[1] != 0xFFFF)
sc->sfp.wgInvalid = gi[1];
else if (gi[0] != 0xFFFF)
sc->sfp.wgInvalid = gi[0];
else
sc->sfp.wgInvalid = 0;
sc->sfp.wgKashida = gi[3];
sc->sfp.iKashidaWidth = 0; /* TODO */
}
else
return FALSE;
}
return TRUE;
}
static inline void get_cache_font_properties(SCRIPT_FONTPROPERTIES *sfp, ScriptCache *sc)
{
sfp->wgBlank = sc->sfp.wgBlank;
sfp->wgDefault = sc->sfp.wgDefault;
sfp->wgInvalid = sc->sfp.wgInvalid;
sfp->wgKashida = sc->sfp.wgKashida;
sfp->iKashidaWidth = sc->sfp.iKashidaWidth;
}
static inline LONG get_cache_height(SCRIPT_CACHE *psc)
@ -746,18 +798,24 @@ static inline BYTE get_cache_pitch_family(SCRIPT_CACHE *psc)
static inline WORD get_cache_glyph(SCRIPT_CACHE *psc, DWORD c)
{
WORD *block = ((ScriptCache *)*psc)->glyphs[c >> GLYPH_BLOCK_SHIFT];
CacheGlyphPage *page = ((ScriptCache *)*psc)->page[c / 0x10000];
WORD *block;
if (!page) return 0;
block = page->glyphs[(c % 0x10000) >> GLYPH_BLOCK_SHIFT];
if (!block) return 0;
return block[c & GLYPH_BLOCK_MASK];
return block[(c % 0x10000) & GLYPH_BLOCK_MASK];
}
static inline WORD set_cache_glyph(SCRIPT_CACHE *psc, WCHAR c, WORD glyph)
{
WORD **block = &((ScriptCache *)*psc)->glyphs[c >> GLYPH_BLOCK_SHIFT];
CacheGlyphPage **page = &((ScriptCache *)*psc)->page[c / 0x10000];
WORD **block;
if (!*page && !(*page = heap_alloc_zero(sizeof(CacheGlyphPage)))) return 0;
block = &(*page)->glyphs[(c % 0x10000) >> GLYPH_BLOCK_SHIFT];
if (!*block && !(*block = heap_alloc_zero(sizeof(WORD) * GLYPH_BLOCK_SIZE))) return 0;
return ((*block)[c & GLYPH_BLOCK_MASK] = glyph);
return ((*block)[(c % 0x10000) & GLYPH_BLOCK_MASK] = glyph);
}
static inline BOOL get_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
@ -782,6 +840,7 @@ static inline BOOL set_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *ab
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
{
ScriptCache *sc;
int size;
if (!psc) return E_INVALIDARG;
if (*psc) return S_OK;
@ -793,12 +852,24 @@ static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
heap_free(sc);
return E_INVALIDARG;
}
size = GetOutlineTextMetricsW(hdc, 0, NULL);
if (size)
{
sc->otm = heap_alloc(size);
sc->otm->otmSize = size;
GetOutlineTextMetricsW(hdc, size, sc->otm);
}
if (!GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(LOGFONTW), &sc->lf))
{
heap_free(sc);
return E_INVALIDARG;
}
sc->sfnt = (GetFontData(hdc, MS_MAKE_TAG('h','e','a','d'), 0, NULL, 0)!=GDI_ERROR);
if (!set_cache_font_properties(hdc, sc))
{
heap_free(sc);
return E_INVALIDARG;
}
*psc = sc;
TRACE("<- %p\n", sc);
return S_OK;
@ -965,12 +1036,20 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
unsigned int i;
for (i = 0; i < GLYPH_MAX / GLYPH_BLOCK_SIZE; i++)
{
heap_free(((ScriptCache *)*psc)->glyphs[i]);
heap_free(((ScriptCache *)*psc)->widths[i]);
}
for (i = 0; i < 0x10; i++)
{
int j;
if (((ScriptCache *)*psc)->page[i])
for (j = 0; j < GLYPH_MAX / GLYPH_BLOCK_SIZE; j++)
heap_free(((ScriptCache *)*psc)->page[i]->glyphs[j]);
heap_free(((ScriptCache *)*psc)->page[i]);
}
heap_free(((ScriptCache *)*psc)->GSUB_Table);
heap_free(((ScriptCache *)*psc)->GDEF_Table);
heap_free(((ScriptCache *)*psc)->CMAP_Table);
heap_free(((ScriptCache *)*psc)->GPOS_Table);
for (i = 0; i < ((ScriptCache *)*psc)->script_count; i++)
{
int j;
@ -984,6 +1063,7 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
heap_free(((ScriptCache *)*psc)->scripts[i].languages);
}
heap_free(((ScriptCache *)*psc)->scripts);
heap_free(((ScriptCache *)*psc)->otm);
heap_free(*psc);
*psc = NULL;
}
@ -1040,12 +1120,7 @@ HRESULT WINAPI ScriptGetFontProperties(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPR
if (sfp->cBytes != sizeof(SCRIPT_FONTPROPERTIES))
return E_INVALIDARG;
/* return something sensible? */
sfp->wgBlank = 0;
sfp->wgDefault = get_cache_default_char(psc);
sfp->wgInvalid = 0;
sfp->wgKashida = 0xffff;
sfp->iKashidaWidth = 0;
get_cache_font_properties(sfp, *psc);
return S_OK;
}
@ -2084,7 +2159,7 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
* ssa [I] buffer to hold the analysed string components
* iX [I] X axis displacement for output
* iY [I] Y axis displacement for output
* uOptions [I] flags controling output processing
* uOptions [I] flags controlling output processing
* prc [I] rectangle coordinates
* iMinSel [I] starting pos for substringing output string
* iMaxSel [I] ending pos for substringing output string
@ -3030,6 +3105,8 @@ HRESULT WINAPI ScriptPlaceOpenType( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS
if (piAdvance) piAdvance[i] = abc.abcA + abc.abcB + abc.abcC;
}
SHAPE_ApplyOpenTypePositions(hdc, (ScriptCache *)*psc, psa, pwGlyphs, cGlyphs, piAdvance, pGoffset);
if (pABC) TRACE("Total for run: abcA=%d, abcB=%d, abcC=%d\n", pABC->abcA, pABC->abcB, pABC->abcC);
return S_OK;
}
@ -3160,6 +3237,8 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
const int *piJustify, const GOFFSET *pGoffset)
{
HRESULT hr = S_OK;
INT i;
INT *lpDx;
TRACE("(%p, %p, %d, %d, %04x, %p, %p, %p, %d, %p, %d, %p, %p, %p)\n",
hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs,
@ -3173,6 +3252,45 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
if (!psa->fNoGlyphIndex) /* Have Glyphs? */
fuOptions |= ETO_GLYPH_INDEX; /* Say don't do translation to glyph */
lpDx = heap_alloc(cGlyphs * sizeof(INT) * 2);
if (pGoffset)
{
for (i = 0; i < cGlyphs; i++)
if (!(fuOptions&ETO_PDY) && pGoffset[i].dv)
fuOptions |= ETO_PDY;
}
for (i = 0; i < cGlyphs; i++)
{
int idx = i;
if (fuOptions&ETO_PDY)
{
idx *=2;
lpDx[idx+1] = 0;
}
lpDx[idx] = piAdvance[i];
}
if (pGoffset)
{
for (i = 1; i < cGlyphs; i++)
{
int idx = i;
int prev_idx = i-1;
if (fuOptions&ETO_PDY)
{
idx*=2;
prev_idx = idx-2;
}
lpDx[prev_idx] += pGoffset[i].du;
lpDx[idx] -= pGoffset[i].du;
if (fuOptions&ETO_PDY)
{
lpDx[prev_idx+1] += pGoffset[i].dv;
lpDx[idx+1] -= pGoffset[i].dv;
}
}
}
if (psa->fRTL && psa->fLogicalOrder)
{
int i;
@ -3180,19 +3298,24 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
rtlGlyphs = heap_alloc(cGlyphs * sizeof(WORD));
if (!rtlGlyphs)
{
heap_free(lpDx);
return E_OUTOFMEMORY;
}
for (i = 0; i < cGlyphs; i++)
rtlGlyphs[i] = pwGlyphs[cGlyphs-1-i];
if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, rtlGlyphs, cGlyphs, NULL))
if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, rtlGlyphs, cGlyphs, lpDx))
hr = S_FALSE;
heap_free(rtlGlyphs);
}
else
if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, pwGlyphs, cGlyphs, NULL))
if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, pwGlyphs, cGlyphs, lpDx))
hr = S_FALSE;
heap_free(lpDx);
return hr;
}

View file

@ -137,29 +137,38 @@ typedef struct {
typedef struct {
OPENTYPE_TAG tag;
LPCVOID table;
LPCVOID gsub_table;
LPCVOID gpos_table;
INT feature_count;
LoadedFeature *features;
} LoadedLanguage;
typedef struct {
OPENTYPE_TAG tag;
LPCVOID table;
LPCVOID gsub_table;
LPCVOID gpos_table;
LoadedLanguage default_language;
INT language_count;
LoadedLanguage *languages;
} LoadedScript;
typedef struct {
WORD *glyphs[GLYPH_MAX / GLYPH_BLOCK_SIZE];
} CacheGlyphPage;
typedef struct {
LOGFONTW lf;
TEXTMETRICW tm;
OUTLINETEXTMETRICW *otm;
SCRIPT_FONTPROPERTIES sfp;
BOOL sfnt;
WORD *glyphs[GLYPH_MAX / GLYPH_BLOCK_SIZE];
CacheGlyphPage *page[0x10];
ABC *widths[GLYPH_MAX / GLYPH_BLOCK_SIZE];
LPVOID GSUB_Table;
LPVOID GDEF_Table;
LPVOID CMAP_Table;
LPVOID CMAP_format12_Table;
LPVOID GPOS_Table;
INT script_count;
LoadedScript *scripts;
@ -214,6 +223,7 @@ INT BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE* plevel, int cch, B
INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN;
void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwcChars, INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust) DECLSPEC_HIDDEN;
void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs, INT cChars, WORD *pwLogClust) DECLSPEC_HIDDEN;
void SHAPE_ApplyOpenTypePositions(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WORD* pwGlyphs, INT cGlyphs, int *piAdvance, GOFFSET *pGoffset );
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa) DECLSPEC_HIDDEN;
void SHAPE_CharGlyphProp(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp) DECLSPEC_HIDDEN;
INT SHAPE_does_GSUB_feature_apply_to_chars(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, const WCHAR *chars, INT write_dir, INT count, const char* feature) DECLSPEC_HIDDEN;
@ -229,6 +239,7 @@ void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT
DWORD OpenType_CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, LPWORD pgi, DWORD flags) DECLSPEC_HIDDEN;
void OpenType_GDEF_UpdateGlyphProps(HDC hdc, ScriptCache *psc, const WORD *pwGlyphs, const WORD cGlyphs, WORD* pwLogClust, const WORD cChars, SCRIPT_GLYPHPROP *pGlyphProp) DECLSPEC_HIDDEN;
INT OpenType_apply_GSUB_lookup(LPCVOID table, INT lookup_index, WORD *glyphs, INT glyph_index, INT write_dir, INT *glyph_count) DECLSPEC_HIDDEN;
HRESULT OpenType_GSUB_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags, LPCVOID* script_table) DECLSPEC_HIDDEN;
HRESULT OpenType_GSUB_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags, LPCVOID* language_table) DECLSPEC_HIDDEN;
HRESULT OpenType_GSUB_GetFontFeatureTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG language_tag, BOOL filtered, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags, LoadedFeature** feature) DECLSPEC_HIDDEN;
INT OpenType_apply_GPOS_lookup(LPOUTLINETEXTMETRICW lpotm, LPLOGFONTW lplogfont, INT* piAdvance, LPCVOID table, INT lookup_index, const WORD *glyphs, INT glyph_index, INT write_dir, INT glyph_count, GOFFSET *pGoffset) DECLSPEC_HIDDEN;
HRESULT OpenType_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags) DECLSPEC_HIDDEN;
HRESULT OpenType_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags) DECLSPEC_HIDDEN;
HRESULT OpenType_GetFontFeatureTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG language_tag, BOOL filtered, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags, LoadedFeature** feature) DECLSPEC_HIDDEN;

View file

@ -179,7 +179,7 @@ reactos/dll/win32/unicows # Synced to Wine-1.3.32 (Win9x only, why do we
reactos/dll/win32/updspapi # Synced to Wine-1.5.4
reactos/dll/win32/url # Synced to Wine-1.5.19
reactos/dll/win32/urlmon # Autosync
reactos/dll/win32/usp10 # Synced to Wine-1.5.4
reactos/dll/win32/usp10 # Synced to Wine-1.5.19
reactos/dll/win32/uxtheme # Forked
reactos/dll/win32/version # Autosync
reactos/dll/win32/wer # Autosync