Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f152153f
Commit
f152153f
authored
Jan 03, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Implement and test ScriptStringGetOrder and ScriptString_pcOutChars.
parent
e0c38fd1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
35 deletions
+91
-35
usp10.c
dlls/usp10/tests/usp10.c
+22
-20
usp10.c
dlls/usp10/usp10.c
+67
-13
usp10.spec
dlls/usp10/usp10.spec
+2
-2
No files found.
dlls/usp10/tests/usp10.c
View file @
f152153f
...
...
@@ -617,8 +617,8 @@ static void test_ScriptString(HDC hdc)
HRESULT
hr
;
WCHAR
teststr
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'1'
,
' '
,
'a'
,
'2'
,
'b'
,
'3'
,
'\0'
};
int
String
=
(
sizeof
(
teststr
)
/
sizeof
(
WCHAR
))
-
1
;
int
Glyphs
=
String
*
2
+
16
;
int
len
=
(
sizeof
(
teststr
)
/
sizeof
(
WCHAR
))
-
1
;
int
Glyphs
=
len
*
2
+
16
;
int
Charset
;
DWORD
Flags
=
SSA_GLYPHS
;
int
ReqWidth
=
100
;
...
...
@@ -633,49 +633,51 @@ static void test_ScriptString(HDC hdc)
int
Y
=
100
;
UINT
Options
=
0
;
const
RECT
rc
=
{
0
,
50
,
100
,
100
};
int
MinSel
=
0
;
int
MinSel
=
0
;
int
MaxSel
=
0
;
BOOL
Disabled
=
FALSE
;
const
int
*
clip_len
;
UINT
*
order
,
i
;
LOGFONTA
lf
;
lstrcpyA
(
lf
.
lfFaceName
,
"Symbol"
);
lf
.
lfHeight
=
10
;
lf
.
lfItalic
=
0
;
lf
.
lfEscapement
=
0
;
lf
.
lfOrientation
=
0
;
lf
.
lfUnderline
=
0
;
lf
.
lfStrikeOut
=
0
;
lf
.
lfWeight
=
300
;
lf
.
lfWidth
=
10
;
Charset
=
-
1
;
/* this flag indicates unicode input */
/* Test without hdc to get E_PENDING */
hr
=
ScriptStringAnalyse
(
NULL
,
teststr
,
String
,
Glyphs
,
Charset
,
Flags
,
hr
=
ScriptStringAnalyse
(
NULL
,
teststr
,
len
,
Glyphs
,
Charset
,
Flags
,
ReqWidth
,
&
Control
,
&
State
,
Dx
,
&
Tabdef
,
&
InClass
,
&
ssa
);
ok
(
hr
==
E_PENDING
,
"ScriptStringAnalyse Stub should return E_PENDING not %08x
\n
"
,
hr
);
/* test with hdc, this should be a valid test */
hr
=
ScriptStringAnalyse
(
hdc
,
teststr
,
String
,
Glyphs
,
Charset
,
Flags
,
hr
=
ScriptStringAnalyse
(
hdc
,
teststr
,
len
,
Glyphs
,
Charset
,
Flags
,
ReqWidth
,
&
Control
,
&
State
,
Dx
,
&
Tabdef
,
&
InClass
,
&
ssa
);
ok
(
hr
==
S_OK
,
"ScriptStringAnalyse should return S_OK not %08x
\n
"
,
hr
);
/* test makes sure that a call with a valid pssa still works */
hr
=
ScriptStringAnalyse
(
hdc
,
teststr
,
String
,
Glyphs
,
Charset
,
Flags
,
hr
=
ScriptStringAnalyse
(
hdc
,
teststr
,
len
,
Glyphs
,
Charset
,
Flags
,
ReqWidth
,
&
Control
,
&
State
,
Dx
,
&
Tabdef
,
&
InClass
,
&
ssa
);
ok
(
hr
==
S_OK
,
"ScriptStringAnalyse should return S_OK not %08x
\n
"
,
hr
);
ok
(
ssa
!=
NULL
,
"ScriptStringAnalyse pssa should not be NULL
\n
"
);
if
(
hr
==
0
)
if
(
hr
==
S_OK
)
{
hr
=
ScriptStringOut
(
ssa
,
X
,
Y
,
Options
,
&
rc
,
MinSel
,
MaxSel
,
Disabled
);
ok
(
hr
==
S_OK
,
"ScriptStringOut should return S_OK not %08x
\n
"
,
hr
);
hr
=
ScriptStringFree
(
&
ssa
);
ok
(
hr
==
S_OK
,
"ScriptStringFree should return S_OK not %08x
\n
"
,
hr
);
}
clip_len
=
ScriptString_pcOutChars
(
ssa
);
ok
(
*
clip_len
==
len
,
"ScriptString_pcOutChars failed, got %d, expected %d
\n
"
,
*
clip_len
,
len
);
order
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
*
clip_len
*
sizeof
(
UINT
));
hr
=
ScriptStringGetOrder
(
ssa
,
order
);
ok
(
hr
==
S_OK
,
"ScriptStringGetOrder failed, got %08x, expected S_OK
\n
"
,
hr
);
for
(
i
=
0
;
i
<
*
clip_len
;
i
++
)
ok
(
order
[
i
]
==
i
,
"%d: got %d expected %d
\n
"
,
i
,
order
[
i
],
i
);
HeapFree
(
GetProcessHeap
(),
0
,
order
);
hr
=
ScriptStringFree
(
&
ssa
);
ok
(
hr
==
S_OK
,
"ScriptStringFree should return S_OK not %08x
\n
"
,
hr
);
}
static
void
test_ScriptStringXtoCP_CPtoX
(
HDC
hdc
)
...
...
dlls/usp10/usp10.c
View file @
f152153f
...
...
@@ -159,6 +159,7 @@ typedef struct {
typedef
struct
{
BOOL
invalid
;
int
clip_len
;
ScriptCache
*
sc
;
int
cItems
;
int
cMaxGlyphs
;
...
...
@@ -520,19 +521,12 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
* ScriptStringAnalyse (USP10.@)
*
*/
HRESULT
WINAPI
ScriptStringAnalyse
(
HDC
hdc
,
const
void
*
pString
,
int
cString
,
int
cGlyphs
,
int
iCharset
,
DWORD
dwFlags
,
int
iReqWidth
,
SCRIPT_CONTROL
*
psControl
,
SCRIPT_STATE
*
psState
,
const
int
*
piDx
,
SCRIPT_TABDEF
*
pTabdef
,
const
BYTE
*
pbInClass
,
SCRIPT_STRING_ANALYSIS
*
pssa
)
HRESULT
WINAPI
ScriptStringAnalyse
(
HDC
hdc
,
const
void
*
pString
,
int
cString
,
int
cGlyphs
,
int
iCharset
,
DWORD
dwFlags
,
int
iReqWidth
,
SCRIPT_CONTROL
*
psControl
,
SCRIPT_STATE
*
psState
,
const
int
*
piDx
,
SCRIPT_TABDEF
*
pTabdef
,
const
BYTE
*
pbInClass
,
SCRIPT_STRING_ANALYSIS
*
pssa
)
{
HRESULT
hr
=
E_OUTOFMEMORY
;
StringAnalysis
*
analysis
=
NULL
;
...
...
@@ -542,12 +536,20 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc,
hdc
,
pString
,
cString
,
cGlyphs
,
iCharset
,
dwFlags
,
iReqWidth
,
psControl
,
psState
,
piDx
,
pTabdef
,
pbInClass
,
pssa
);
if
(
iCharset
!=
-
1
)
{
FIXME
(
"Only Unicode strings are supported
\n
"
);
return
E_INVALIDARG
;
}
if
(
cString
<
1
||
!
pString
)
return
E_INVALIDARG
;
if
((
dwFlags
&
SSA_GLYPHS
)
&&
!
hdc
)
return
E_PENDING
;
if
(
!
(
analysis
=
usp_zero_alloc
(
sizeof
(
StringAnalysis
))))
return
E_OUTOFMEMORY
;
if
(
!
(
analysis
->
pItem
=
usp_zero_alloc
(
num_items
*
sizeof
(
SCRIPT_ITEM
)
+
1
)))
goto
error
;
/* FIXME: handle clipping */
analysis
->
clip_len
=
cString
;
hr
=
ScriptItemize
(
pString
,
cString
,
num_items
,
psControl
,
psState
,
analysis
->
pItem
,
&
analysis
->
numItems
);
...
...
@@ -1567,3 +1569,55 @@ const SCRIPT_LOGATTR * WINAPI ScriptString_pLogAttr(SCRIPT_STRING_ANALYSIS ssa)
if
(
!
analysis
)
return
NULL
;
return
analysis
->
logattrs
;
}
/***********************************************************************
* ScriptString_pcOutChars (USP10.@)
*
* Retrieve the length of a string after clipping.
*
* PARAMS
* ssa [I] String analysis.
*
* RETURNS
* Success: Pointer to the length.
* Failure: NULL
*/
const
int
*
WINAPI
ScriptString_pcOutChars
(
SCRIPT_STRING_ANALYSIS
ssa
)
{
StringAnalysis
*
analysis
=
ssa
;
TRACE
(
"(%p)
\n
"
,
ssa
);
if
(
!
analysis
)
return
NULL
;
return
&
analysis
->
clip_len
;
}
/***********************************************************************
* ScriptStringGetOrder (USP10.@)
*
* Retrieve a glyph order map.
*
* PARAMS
* ssa [I] String analysis.
* order [I/O] Array of glyph positions.
*
* RETURNS
* Success: S_OK
* Failure: a non-zero HRESULT.
*/
HRESULT
WINAPI
ScriptStringGetOrder
(
SCRIPT_STRING_ANALYSIS
ssa
,
UINT
*
order
)
{
unsigned
int
i
,
j
,
k
;
StringAnalysis
*
analysis
=
ssa
;
TRACE
(
"(%p)
\n
"
,
ssa
);
if
(
!
analysis
)
return
S_FALSE
;
/* FIXME: handle RTL scripts */
for
(
i
=
0
,
k
=
0
;
i
<
analysis
->
numItems
;
i
++
)
for
(
j
=
0
;
j
<
analysis
->
glyphs
[
i
].
numGlyphs
;
j
++
,
k
++
)
order
[
k
]
=
k
;
return
S_OK
;
}
dlls/usp10/usp10.spec
View file @
f152153f
...
...
@@ -21,13 +21,13 @@
@ stdcall ScriptStringCPtoX(ptr long long ptr)
@ stdcall ScriptStringFree(ptr)
@ stdcall ScriptStringGetLogicalWidths(ptr ptr)
@ st
ub ScriptStringGetOrder
@ st
dcall ScriptStringGetOrder(ptr ptr)
@ stdcall ScriptStringOut(ptr long long long ptr long long long)
@ stdcall ScriptStringValidate(ptr)
@ stdcall ScriptStringXtoCP(ptr long ptr ptr)
@ stdcall ScriptString_pLogAttr(ptr)
@ stdcall ScriptString_pSize(ptr)
@ st
ub ScriptString_pcOutChars
@ st
dcall ScriptString_pcOutChars(ptr)
@ stdcall ScriptTextOut(ptr ptr long long long ptr ptr ptr long ptr long ptr ptr ptr)
@ stdcall ScriptXtoCP(long long long ptr ptr ptr ptr ptr ptr)
@ stub UspAllocCache
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment