Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
4241adbf
Commit
4241adbf
authored
Feb 22, 2006
by
Jeff Latimer
Committed by
Alexandre Julliard
Feb 22, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Add ScriptGetCMap functionality to translate wchars to glyphs.
parent
82818284
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
7 deletions
+64
-7
usp10.c
dlls/usp10/tests/usp10.c
+24
-4
usp10.c
dlls/usp10/usp10.c
+40
-3
No files found.
dlls/usp10/tests/usp10.c
View file @
4241adbf
...
...
@@ -52,6 +52,8 @@ START_TEST(usp10)
int
cChars
;
int
cMaxGlyphs
;
unsigned
short
pwOutGlyphs
[
256
];
unsigned
short
pwOutGlyphs2
[
256
];
unsigned
short
pwOutGlyphs3
[
256
];
unsigned
short
pwLogClust
[
256
];
SCRIPT_VISATTR
psva
[
256
];
int
pcGlyphs
;
...
...
@@ -59,6 +61,7 @@ START_TEST(usp10)
GOFFSET
pGoffset
[
256
];
ABC
pABC
[
256
];
int
cnt
;
DWORD
dwFlags
;
/* We need a valid HDC to drive a lot of Script functions which requires the following *
* to set up for the tests. */
...
...
@@ -170,23 +173,40 @@ START_TEST(usp10)
pItem
[
0
].
a
.
fNoGlyphIndex
=
1
;
/* say no translate */
hr
=
ScriptShape
(
NULL
,
&
psc
,
TestItem2
,
cChars
,
cMaxGlyphs
,
&
pItem
[
0
].
a
,
pwOutGlyphs
,
pwLogClust
,
psva
,
&
pcGlyphs
);
pwOutGlyphs
2
,
pwLogClust
,
psva
,
&
pcGlyphs
);
ok
(
hr
!=
E_PENDING
,
"If psc should not be NULL (%08x) and the E_PENDING should be returned
\n
"
,
(
unsigned
int
)
hr
);
ok
(
hr
==
0
,
"ScriptShape should return 0 not (%08x)
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
!=
NULL
,
"psc should not be null and have SCRIPT_CACHE buffer address
\n
"
);
ok
(
pcGlyphs
==
cChars
,
"Chars in (%d) should equal Glyphs out (%d)
\n
"
,
cChars
,
pcGlyphs
);
for
(
cnt
=
0
;
cnt
<
cChars
&&
TestItem2
[
cnt
]
==
pwOutGlyphs
[
cnt
];
cnt
++
)
{}
for
(
cnt
=
0
;
cnt
<
cChars
&&
TestItem2
[
cnt
]
==
pwOutGlyphs
2
[
cnt
];
cnt
++
)
{}
ok
(
cnt
==
cChars
,
"Translation to place when told not to. WCHAR %d - %04x != %04x
\n
"
,
cnt
,
TestItem2
[
cnt
],
pwOutGlyphs
[
cnt
]);
cnt
,
TestItem2
[
cnt
],
pwOutGlyphs
2
[
cnt
]);
if
(
hr
==
0
)
{
hr
=
ScriptPlace
(
NULL
,
&
psc
,
pwOutGlyphs
,
pcGlyphs
,
psva
,
&
pItem
[
0
].
a
,
piAdvance
,
hr
=
ScriptPlace
(
NULL
,
&
psc
,
pwOutGlyphs
2
,
pcGlyphs
,
psva
,
&
pItem
[
0
].
a
,
piAdvance
,
pGoffset
,
pABC
);
ok
(
hr
==
0
,
"ScriptPlace should return 0 not (%08x)
\n
"
,
(
unsigned
int
)
hr
);
}
}
hr
=
ScriptFreeCache
(
&
psc
);
ok
(
!
psc
,
"psc is not null after ScriptFreeCache
\n
"
);
/* Check to make sure that SCRIPT_CACHE gets allocated ok */
dwFlags
=
0
;
hr
=
ScriptGetCMap
(
NULL
,
&
psc
,
TestItem1
,
cInChars
,
dwFlags
,
pwOutGlyphs3
);
ok
(
hr
==
E_PENDING
,
"If psc is NULL (%08x) the E_PENDING should be returned
\n
"
,
(
unsigned
int
)
hr
);
/* Check to see if teh results are the same as those returned by ScriptShape */
hr
=
ScriptGetCMap
(
hdc
,
&
psc
,
TestItem1
,
cInChars
,
dwFlags
,
pwOutGlyphs3
);
ok
(
hr
==
0
,
"ScriptGetCMap should return 0 not (%08x)
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
!=
NULL
,
"psc should not be null and have SCRIPT_CACHE buffer address
\n
"
);
for
(
cnt
=
0
;
cnt
<
cChars
&&
pwOutGlyphs
[
cnt
]
==
pwOutGlyphs3
[
cnt
];
cnt
++
)
{}
ok
(
cnt
==
cInChars
,
"Translation not correct. WCHAR %d - %04x != %04x
\n
"
,
cnt
,
pwOutGlyphs
[
cnt
],
pwOutGlyphs3
[
cnt
]);
hr
=
ScriptFreeCache
(
&
psc
);
ok
(
!
psc
,
"psc is not null after ScriptFreeCache
\n
"
);
}
DeleteObject
(
hrgn
);
ReleaseDC
(
hwnd
,
hdc
);
...
...
dlls/usp10/usp10.c
View file @
4241adbf
...
...
@@ -433,11 +433,49 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
* ScriptGetCMap (USP10.@)
*
*/
/***********************************************************************
* ScriptGetCMap (USP10.@)
*
*/
HRESULT
WINAPI
ScriptGetCMap
(
HDC
hdc
,
SCRIPT_CACHE
*
psc
,
const
WCHAR
*
pwcInChars
,
int
cChars
,
DWORD
dwFlags
,
WORD
*
pwOutGlyphs
)
{
FIXME
(
"(%p,%p,%s,%d,0x%lx,%p): stub
\n
"
,
hdc
,
psc
,
debugstr_w
(
pwcInChars
),
cChars
,
dwFlags
,
pwOutGlyphs
);
return
E_NOTIMPL
;
HDC
phdc
;
int
cnt
;
DWORD
hr
;
Scriptcache
*
pScriptcache
;
FIXME
(
"(%p,%p,%s,%d,0x%lx,%p): semi-stub
\n
"
,
hdc
,
psc
,
debugstr_wn
(
pwcInChars
,
cChars
),
cChars
,
dwFlags
,
pwOutGlyphs
);
if
(
!
hdc
&&
!*
psc
)
{
TRACE
(
"No Script_Cache (psc) and no hdc. Ask for one. Hdc=%p, psc=%p
\n
"
,
hdc
,
*
psc
);
return
E_PENDING
;
}
else
if
(
hdc
&&
!*
psc
)
{
pScriptcache
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
Scriptcache
)
);
pScriptcache
->
hdc
=
hdc
;
phdc
=
hdc
;
pScriptcache
->
HaveWidths
=
0
;
*
psc
=
pScriptcache
;
}
else
if
(
*
psc
)
{
pScriptcache
=
*
psc
;
phdc
=
pScriptcache
->
hdc
;
}
TRACE
(
"Before: "
);
for
(
cnt
=
0
;
cnt
<
cChars
;
cnt
++
)
TRACE
(
"%4x"
,
pwcInChars
[
cnt
]);
TRACE
(
"
\n
"
);
hr
=
GetGlyphIndicesW
(
phdc
,
pwcInChars
,
cChars
,
pwOutGlyphs
,
0
);
TRACE
(
"After: "
);
for
(
cnt
=
0
;
cnt
<
cChars
;
cnt
++
)
{
TRACE
(
"%04x"
,
pwOutGlyphs
[
cnt
]);
pScriptcache
->
GlyphToChar
[
pwOutGlyphs
[
cnt
]]
=
pwcInChars
[
cnt
];
/* save for ScriptPlace */
}
TRACE
(
"
\n
"
);
return
0
;
}
/***********************************************************************
...
...
@@ -454,4 +492,3 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
piAdvance
,
piJustify
,
pGoffset
);
return
E_NOTIMPL
;
}
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