ReactOS 0.4.17-dev-966-gf06eace
usp10_internal.h
Go to the documentation of this file.
1/*
2 * Implementation of Uniscribe Script Processor (usp10.dll)
3 *
4 * Copyright 2010 CodeWeavers, Aric Stewart
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 */
21
22#pragma once
23
24#include "wine/list.h"
25
26#define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
27 ( ( (ULONG)_x4 << 24 ) | \
28 ( (ULONG)_x3 << 16 ) | \
29 ( (ULONG)_x2 << 8 ) | \
30 (ULONG)_x1 )
31
33{
36 Script_CR = 0x02,
50 /* Unicode Chapter 10 */
55 /* Unicode Chapter 11 */
58 Script_Lao = 0x16,
60 /* Unicode Chapter 9 */
81 /* More supplemental */
85 /* Unicode Chapter 11 continued */
93 /* Unicode Chapter 12 */
99 Script_Yi = 0x3b,
100 /* Unicode Chapter 13 */
111 /* Unicode Chapter 14 */
114 /* Unicode Chapter 15 */
116 /* Unicode Chapter 16 */
119 /* Unicode Chapter 13 : Plane 1 */
123 /* Unicode Chapter 15 : Plane 1 */
125 /* Additional Currency Scripts */
129};
130
131#define GLYPH_BLOCK_SHIFT 8
132#define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT)
133#define GLYPH_BLOCK_MASK (GLYPH_BLOCK_SIZE - 1)
134#define GLYPH_MAX 65536
135
136#define NUM_PAGES 17
137
138#define GSUB_E_NOFEATURE -20
139#define GSUB_E_NOGLYPH -10
140
141#define FEATURE_ALL_TABLES 0
142#define FEATURE_GSUB_TABLE 1
143#define FEATURE_GPOS_TABLE 2
144
145typedef struct {
148 const void *feature;
152
154{
159
160typedef struct {
168
170{
175
176typedef struct {
185
186typedef struct {
189
190typedef struct {
191 struct list entry;
209
213
214typedef struct _scriptData
215{
221
222typedef struct {
230
232
233static inline BOOL is_consonant( int type )
234{
235 return (type == lex_Ra || type == lex_Consonant);
236}
237
238static inline unsigned short get_table_entry_16( const unsigned short *table, WCHAR ch )
239{
240 return table[table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
241}
242
243static inline unsigned short get_table_entry_32( const unsigned short *table, UINT ch )
244{
245 return table[table[table[table[ch >> 12] + ((ch >> 8) & 0x0f)] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
246}
247
249typedef void (*reorder_function)(WCHAR *chars, IndicSyllable *syllable, lexical_function lex);
250
251#define odd(x) ((x) & 1)
252#define BIDI_STRONG 1
253#define BIDI_WEAK 2
254#define BIDI_NEUTRAL 0
255
256BOOL usp10_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size);
257int USP10_FindGlyphInLogClust(const WORD* pwLogClust, int cChars, WORD target);
258
259BOOL BIDI_DetermineLevels(const WCHAR *string, unsigned int count, const SCRIPT_STATE *s,
260 const SCRIPT_CONTROL *c, WORD *levels, WORD *overrides);
261BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count,
262 const SCRIPT_CONTROL *c, WORD *strength);
263INT BIDI_ReorderV2lLevel(int level, int *pIndices, const BYTE* plevel, int cch, BOOL fReverse);
264INT BIDI_ReorderL2vLevel(int level, int *pIndices, const BYTE* plevel, int cch, BOOL fReverse);
266 INT cChars, WORD* pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs,
267 WORD *pwLogClust);
269 WORD *pwOutGlyphs, INT* pcGlyphs, INT cMaxGlyphs,
270 INT cChars, WORD *pwLogClust);
272 const WORD *glyphs, INT cGlyphs, int *piAdvance, GOFFSET *goffset );
274void SHAPE_CharGlyphProp(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR *pwcChars,
275 const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust,
276 SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp);
278 const WCHAR *chars, INT write_dir, INT count,
279 const char* feature);
281 OPENTYPE_TAG *pScriptTags, int *pcTags);
283 OPENTYPE_TAG tagScript, int cMaxTags,
284 OPENTYPE_TAG *pLangSysTags, int *pcTags);
286 OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys,
287 int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags);
288
290 unsigned int cChars, IndicSyllable **syllables, int *syllable_count,
291 lexical_function lexical_f, reorder_function reorder_f, BOOL modern);
293 unsigned int cChar, IndicSyllable **syllables, int *syllable_count,
294 lexical_function lex, BOOL modern);
295
296void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la);
297
299void OpenType_GDEF_UpdateGlyphProps(ScriptCache *psc, const WORD *pwGlyphs, const WORD cGlyphs,
300 WORD *pwLogClust, const WORD cChars, SCRIPT_GLYPHPROP *pGlyphProp);
301int OpenType_apply_GSUB_lookup(const void *table, unsigned int lookup_index, WORD *glyphs,
302 unsigned int glyph_index, int write_dir, int *glyph_count);
303unsigned int OpenType_apply_GPOS_lookup(const ScriptCache *psc, const OUTLINETEXTMETRICW *otm,
304 const LOGFONTW *logfont, const SCRIPT_ANALYSIS *analysis, int *advance, unsigned int lookup_index,
305 const WORD *glyphs, unsigned int glyph_index, unsigned int glyph_count, GOFFSET *goffset);
306HRESULT OpenType_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags,
307 OPENTYPE_TAG *pScriptTags, int *pcTags);
309 int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags);
311 BOOL filtered, OPENTYPE_TAG searchingFor, char tableType,
312 int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags,
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
Definition: list.h:39
#define LF_FACESIZE
Definition: dimm.idl:39
unsigned char ch[4][2]
Definition: console.c:118
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLbitfield flags
Definition: glext.h:7161
GLsizei levels
Definition: glext.h:7884
GLenum GLenum GLenum input
Definition: glext.h:9031
unsigned int UINT
Definition: sysinfo.c:13
uint32_t entry
Definition: isohybrid.c:63
#define c
Definition: ke_i.h:80
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
INTERNETFEATURELIST feature
Definition: misc.c:1807
short WCHAR
Definition: pedump.c:58
char CHAR
Definition: pedump.c:57
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
OPENTYPE_TAG tag
const void * feature
OPENTYPE_TAG tag
LoadedFeature * features
OPENTYPE_TAG tag
LoadedLanguage * languages
SIZE_T language_count
BOOL languages_initialized
LoadedLanguage default_language
SIZE_T languages_size
void * GPOS_Table
OUTLINETEXTMETRICW * otm
SCRIPT_FONTPROPERTIES sfp
void * CMAP_format12_Table
OPENTYPE_TAG userLang
BOOL scripts_initialized
void * GDEF_Table
SIZE_T script_count
void * CMAP_Table
void * GSUB_Table
LoadedScript * scripts
SIZE_T scripts_size
OPENTYPE_TAG userScript
TEXTMETRICW tm
Definition: wingdi.h:1856
OPENTYPE_TAG scriptTag
WCHAR fallbackFont[LF_FACESIZE]
SCRIPT_ANALYSIS a
SCRIPT_PROPERTIES props
Definition: module.h:576
Definition: tools.h:99
uint16_t * LPWORD
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
ULONG OPENTYPE_TAG
Definition: usp10.h:205
void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD *pwOutGlyphs, INT *pcGlyphs, INT cMaxGlyphs, INT cChars, WORD *pwLogClust)
Definition: shape.c:3455
static BOOL is_consonant(int type)
usp10_script
@ Script_Kannada_Numeric
@ Script_Bengali_Numeric
@ Script_Telugu
@ Script_Yi
@ Script_Bopomofo
@ Script_Cyrillic
@ Script_Private
@ Script_Tibetan_Numeric
@ Script_Gurmukhi_Numeric
@ Script_Tai_Le
@ Script_Devanagari_Numeric
@ Script_Telugu_Numeric
@ Script_Myanmar
@ Script_NKo
@ Script_Thai_Numeric
@ Script_Khmer
@ Script_Tifinagh
@ Script_Runic
@ Script_Malayalam_Numeric
@ Script_Vietnamese_Currency
@ Script_Phags_pa
@ Script_Undefined
@ Script_Mongolian_Numeric
@ Script_Cherokee
@ Script_Vai_Numeric
@ Script_Sinhala
@ Script_Hebrew
@ Script_Ethiopic
@ Script_Ogham
@ Script_CR
@ Script_Numeric2
@ Script_Gujarati_Numeric
@ Script_Thai
@ Script_Hangul
@ Script_Diacritical
@ Script_Bengali
@ Script_Syriac
@ Script_Tamil_Numeric
@ Script_Oriya_Numeric
@ Script_Osmanya_Numeric
@ Script_Arabic_Numeric
@ Script_Oriya
@ Script_Thai_Currency
@ Script_Deseret
@ Script_Kannada
@ Script_Punctuation2
@ Script_Arabic
@ Script_Hebrew_Currency
@ Script_Control
@ Script_Georgian
@ Script_Mongolian
@ Script_Gurmukhi
@ Script_Thaana
@ Script_Tibetan
@ Script_Tamil
@ Script_New_Tai_Lue
@ Script_Latin
@ Script_Bengali_Currency
@ Script_New_Tai_Lue_Numeric
@ Script_Gujarati_Currency
@ Script_Canadian
@ Script_Greek
@ Script_Persian
@ Script_Armenian
@ Script_Surrogates
@ Script_Ideograph
@ Script_Osmanya
@ Script_Kana
@ Script_Lao_Numeric
@ Script_Myanmar_Numeric
@ Script_Numeric
@ Script_Ethiopic_Numeric
@ Script_Punctuation
@ Script_Gujarati
@ Script_Devanagari
@ Script_Lao
@ Script_Braille
@ Script_Khmer_Numeric
@ Script_CJK_Han
@ Script_Vai
@ Script_Malayalam
@ Script_MathAlpha
void Indic_ReorderCharacters(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, WCHAR *input, unsigned int cChars, IndicSyllable **syllables, int *syllable_count, lexical_function lexical_f, reorder_function reorder_f, BOOL modern)
Definition: indic.c:369
BOOL usp10_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
Definition: usp10.c:655
#define GLYPH_BLOCK_SIZE
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)
Definition: shape.c:3411
HRESULT OpenType_GetFontFeatureTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG language_tag, BOOL filtered, OPENTYPE_TAG searchingFor, char tableType, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags, LoadedFeature **feature)
Definition: opentype.c:2914
HRESULT OpenType_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags)
Definition: opentype.c:2803
HRESULT SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR *pwcChars, INT cChars, WORD *pwOutGlyphs, INT *pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust)
Definition: shape.c:3421
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa)
Definition: shape.c:3488
HRESULT SHAPE_GetFontLanguageTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangSysTags, int *pcTags)
Definition: shape.c:3529
usp10_language_table
@ USP10_LANGUAGE_TABLE_GSUB
@ USP10_LANGUAGE_TABLE_COUNT
@ USP10_LANGUAGE_TABLE_GPOS
void(* reorder_function)(WCHAR *chars, IndicSyllable *syllable, lexical_function lex)
#define GLYPH_MAX
BOOL BIDI_DetermineLevels(const WCHAR *string, unsigned int count, const SCRIPT_STATE *s, const SCRIPT_CONTROL *c, WORD *levels, WORD *overrides)
Definition: bidi.c:1087
void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la)
Definition: breaking.c:76
void SHAPE_ApplyOpenTypePositions(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WORD *glyphs, INT cGlyphs, int *piAdvance, GOFFSET *goffset)
Definition: shape.c:3463
int(* lexical_function)(WCHAR c)
static unsigned short get_table_entry_16(const unsigned short *table, WCHAR ch)
void Indic_ParseSyllables(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, const WCHAR *input, unsigned int cChar, IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern)
Definition: indic.c:323
static unsigned short get_table_entry_32(const unsigned short *table, UINT ch)
void OpenType_GDEF_UpdateGlyphProps(ScriptCache *psc, const WORD *pwGlyphs, const WORD cGlyphs, WORD *pwLogClust, const WORD cChars, SCRIPT_GLYPHPROP *pGlyphProp)
Definition: opentype.c:755
INT BIDI_ReorderV2lLevel(int level, int *pIndices, const BYTE *plevel, int cch, BOOL fReverse)
Definition: bidi.c:1187
INT BIDI_ReorderL2vLevel(int level, int *pIndices, const BYTE *plevel, int cch, BOOL fReverse)
Definition: bidi.c:1214
int USP10_FindGlyphInLogClust(const WORD *pwLogClust, int cChars, WORD target)
Definition: usp10.c:967
HRESULT SHAPE_GetFontFeatureTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags)
Definition: shape.c:3557
BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count, const SCRIPT_CONTROL *c, WORD *strength)
Definition: bidi.c:1248
HRESULT SHAPE_GetFontScriptTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags)
Definition: shape.c:3511
@ lex_Nukta
@ lex_Anudatta
@ lex_Matra_above
@ lex_Matra_below
@ lex_ZWJ
@ lex_Consonant
@ lex_Vowel
@ lex_Ra
@ lex_Modifier
@ lex_Generic
@ lex_NBSP
@ lex_Vedic
@ lex_Composed_Vowel
@ lex_Matra_post
@ lex_ZWNJ
@ lex_Halant
@ lex_Matra_pre
int OpenType_apply_GSUB_lookup(const void *table, unsigned int lookup_index, WORD *glyphs, unsigned int glyph_index, int write_dir, int *glyph_count)
Definition: opentype.c:1544
DWORD OpenType_CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, LPWORD pgi, DWORD flags)
#define NUM_PAGES
struct _scriptData scriptData
HRESULT OpenType_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags)
Definition: opentype.c:2689
usp10_script_table
@ USP10_SCRIPT_TABLE_GSUB
@ USP10_SCRIPT_TABLE_COUNT
@ USP10_SCRIPT_TABLE_GPOS
unsigned int OpenType_apply_GPOS_lookup(const ScriptCache *psc, const OUTLINETEXTMETRICW *otm, const LOGFONTW *logfont, const SCRIPT_ANALYSIS *analysis, int *advance, unsigned int lookup_index, const WORD *glyphs, unsigned int glyph_index, unsigned int glyph_count, GOFFSET *goffset)
Definition: opentype.c:2599
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)
_In_ INT _In_ INT cChars
Definition: winddi.h:1486
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
unsigned char BYTE
Definition: xxhash.c:193