ReactOS 0.4.15-dev-7942-gd23573b
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( const unsigned short *table, WCHAR ch )
239{
240 return table[table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
241}
242
244typedef void (*reorder_function)(WCHAR *chars, IndicSyllable *syllable, lexical_function lex);
245
246#define odd(x) ((x) & 1)
247#define BIDI_STRONG 1
248#define BIDI_WEAK 2
249#define BIDI_NEUTRAL 0
250
253
254BOOL BIDI_DetermineLevels(const WCHAR *string, unsigned int count, const SCRIPT_STATE *s,
255 const SCRIPT_CONTROL *c, WORD *levels, WORD *overrides) DECLSPEC_HIDDEN;
256BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count,
257 const SCRIPT_CONTROL *c, WORD *strength) DECLSPEC_HIDDEN;
258INT BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN;
259INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE* plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN;
262void SHAPE_ApplyOpenTypePositions(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WORD* pwGlyphs, INT cGlyphs, int *piAdvance, GOFFSET *pGoffset ) DECLSPEC_HIDDEN;
269
271 IndicSyllable **syllables, int *syllable_count, lexical_function lexical_f,
272 reorder_function reorder_f, BOOL modern) DECLSPEC_HIDDEN;
273void Indic_ParseSyllables(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, const WCHAR *input, unsigned int cChar,
274 IndicSyllable **syllables, int *syllable_count, lexical_function lex, BOOL modern) DECLSPEC_HIDDEN;
275
276void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la) DECLSPEC_HIDDEN;
277
280int OpenType_apply_GSUB_lookup(const void *table, unsigned int lookup_index, WORD *glyphs,
281 unsigned int glyph_index, int write_dir, int *glyph_count) DECLSPEC_HIDDEN;
282unsigned int OpenType_apply_GPOS_lookup(const ScriptCache *psc, const OUTLINETEXTMETRICW *otm,
283 const LOGFONTW *logfont, const SCRIPT_ANALYSIS *analysis, int *advance, unsigned int lookup_index,
284 const WORD *glyphs, unsigned int glyph_index, unsigned int glyph_count, GOFFSET *goffset) DECLSPEC_HIDDEN;
_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:37
#define LF_FACESIZE
Definition: dimm.idl:39
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint GLsizei count
Definition: gl.h:1545
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
GLenum target
Definition: glext.h:7315
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:92
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static UINT UINT LPWORD glyphs
Definition: font.c:44
static LPCSTR INT LPWORD pgi
Definition: font.c:51
INTERNETFEATURELIST feature
Definition: misc.c:1719
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG tagScript
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG int OPENTYPE_TAG * pLangSysTags
Definition: usp10.c:67
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD SCRIPT_GLYPHPROP int * pcGlyphs
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int OPENTYPE_TAG * pFeatureTags
Definition: usp10.c:68
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG * pScriptTags
Definition: usp10.c:62
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS int cMaxTags
Definition: usp10.c:66
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD * pwOutGlyphs
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS int OPENTYPE_TAG int * pcTags
Definition: usp10.c:66
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int cMaxGlyphs
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR * pwcChars
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG tagLangSys
Definition: usp10.c:64
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:1410
OPENTYPE_TAG scriptTag
WCHAR fallbackFont[LF_FACESIZE]
SCRIPT_ANALYSIS a
SCRIPT_PROPERTIES props
Definition: module.h:576
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
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
HRESULT SHAPE_GetFontScriptTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags) DECLSPEC_HIDDEN
Definition: shape.c:3477
HRESULT SHAPE_GetFontLanguageTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangSysTags, int *pcTags) DECLSPEC_HIDDEN
Definition: shape.c:3495
int OpenType_apply_GSUB_lookup(const void *table, unsigned int lookup_index, WORD *glyphs, unsigned int glyph_index, int write_dir, int *glyph_count) DECLSPEC_HIDDEN
Definition: opentype.c:1540
void OpenType_GDEF_UpdateGlyphProps(ScriptCache *psc, const WORD *pwGlyphs, const WORD cGlyphs, WORD *pwLogClust, const WORD cChars, SCRIPT_GLYPHPROP *pGlyphProp) DECLSPEC_HIDDEN
Definition: opentype.c:751
#define GLYPH_BLOCK_SIZE
BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count, const SCRIPT_CONTROL *c, WORD *strength) DECLSPEC_HIDDEN
Definition: bidi.c:1249
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) DECLSPEC_HIDDEN
Definition: indic.c:373
BOOL BIDI_DetermineLevels(const WCHAR *string, unsigned int count, const SCRIPT_STATE *s, const SCRIPT_CONTROL *c, WORD *levels, WORD *overrides) DECLSPEC_HIDDEN
Definition: bidi.c:1088
void SHAPE_ApplyOpenTypePositions(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WORD *pwGlyphs, INT cGlyphs, int *piAdvance, GOFFSET *pGoffset) DECLSPEC_HIDDEN
Definition: shape.c:3429
int USP10_FindGlyphInLogClust(const WORD *pwLogClust, int cChars, WORD target) DECLSPEC_HIDDEN
Definition: usp10.c:1044
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) DECLSPEC_HIDDEN
Definition: indic.c:324
HRESULT OpenType_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags) DECLSPEC_HIDDEN
Definition: opentype.c:2761
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa) DECLSPEC_HIDDEN
Definition: shape.c:3454
usp10_language_table
@ USP10_LANGUAGE_TABLE_GSUB
@ USP10_LANGUAGE_TABLE_COUNT
@ USP10_LANGUAGE_TABLE_GPOS
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
Definition: shape.c:3378
void(* reorder_function)(WCHAR *chars, IndicSyllable *syllable, lexical_function lex)
#define GLYPH_MAX
HRESULT OpenType_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags) DECLSPEC_HIDDEN
Definition: opentype.c:2647
void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR *pwcChars, INT cChars, WORD *pwOutGlyphs, INT *pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust) DECLSPEC_HIDDEN
Definition: shape.c:3388
@ 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(* lexical_function)(WCHAR c)
void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD *pwOutGlyphs, INT *pcGlyphs, INT cMaxGlyphs, INT cChars, WORD *pwLogClust) DECLSPEC_HIDDEN
Definition: shape.c:3421
static unsigned short get_table_entry(const unsigned short *table, WCHAR ch)
INT BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE *plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN
Definition: bidi.c:1215
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
void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la) DECLSPEC_HIDDEN
Definition: breaking.c:77
DWORD OpenType_CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, LPWORD pgi, DWORD flags) DECLSPEC_HIDDEN
HRESULT SHAPE_GetFontFeatureTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags) DECLSPEC_HIDDEN
Definition: shape.c:3523
#define NUM_PAGES
struct _scriptData scriptData
usp10_script_table
@ USP10_SCRIPT_TABLE_GSUB
@ USP10_SCRIPT_TABLE_COUNT
@ USP10_SCRIPT_TABLE_GPOS
INT BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE *plevel, int cch, BOOL fReverse) DECLSPEC_HIDDEN
Definition: bidi.c:1188
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) DECLSPEC_HIDDEN
Definition: opentype.c:2557
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) DECLSPEC_HIDDEN
Definition: opentype.c:2872
BOOL usp10_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size) DECLSPEC_HIDDEN
Definition: usp10.c:730
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193