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
1090cd2f
Commit
1090cd2f
authored
Dec 29, 2011
by
Aric Stewart
Committed by
Alexandre Julliard
Dec 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Cache FontScriptTags information.
parent
1fc01563
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
16 deletions
+38
-16
shape.c
dlls/usp10/shape.c
+30
-16
usp10.c
dlls/usp10/usp10.c
+1
-0
usp10_internal.h
dlls/usp10/usp10_internal.h
+7
-0
No files found.
dlls/usp10/shape.c
View file @
1090cd2f
...
...
@@ -3779,39 +3779,53 @@ DWORD CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, LPWORD pgi, DW
return
0
;
}
static
HRESULT
GSUB_GetFontScriptTags
(
LPCVOID
table
,
OPENTYPE_TAG
searchingFor
,
int
cMaxTags
,
OPENTYPE_TAG
*
pScriptTags
,
int
*
pcTags
,
LPCVOID
*
script_table
)
static
void
GSUB_initialize_script_cache
(
ScriptCache
*
psc
)
{
const
GSUB_ScriptList
*
script
;
const
GSUB_Header
*
header
=
(
const
GSUB_Header
*
)
table
;
int
i
;
HRESULT
rc
=
S_OK
;
script
=
(
const
GSUB_ScriptList
*
)((
const
BYTE
*
)
header
+
GET_BE_WORD
(
header
->
ScriptList
));
if
(
!
psc
->
script_count
)
{
const
GSUB_ScriptList
*
script
;
const
GSUB_Header
*
header
=
(
const
GSUB_Header
*
)
psc
->
GSUB_Table
;
script
=
(
const
GSUB_ScriptList
*
)((
const
BYTE
*
)
header
+
GET_BE_WORD
(
header
->
ScriptList
));
psc
->
script_count
=
GET_BE_WORD
(
script
->
ScriptCount
);
TRACE
(
"initializing %i scripts in this font
\n
"
,
psc
->
script_count
);
psc
->
scripts
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
LoadedScript
)
*
psc
->
script_count
);
for
(
i
=
0
;
i
<
psc
->
script_count
;
i
++
)
{
int
offset
=
GET_BE_WORD
(
script
->
ScriptRecord
[
i
].
Script
);
psc
->
scripts
[
i
].
tag
=
MS_MAKE_TAG
(
script
->
ScriptRecord
[
i
].
ScriptTag
[
0
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
1
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
2
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
3
]);
psc
->
scripts
[
i
].
table
=
((
const
BYTE
*
)
script
+
offset
);
}
}
}
*
pcTags
=
GET_BE_WORD
(
script
->
ScriptCount
);
TRACE
(
"%i scripts in this font
\n
"
,
*
pcTags
);
static
HRESULT
GSUB_GetFontScriptTags
(
ScriptCache
*
psc
,
OPENTYPE_TAG
searchingFor
,
int
cMaxTags
,
OPENTYPE_TAG
*
pScriptTags
,
int
*
pcTags
,
LPCVOID
*
script_table
)
{
int
i
;
HRESULT
rc
=
S_OK
;
GSUB_initialize_script_cache
(
psc
);
*
pcTags
=
psc
->
script_count
;
if
(
!
searchingFor
&&
cMaxTags
<
*
pcTags
)
rc
=
E_OUTOFMEMORY
;
else
if
(
searchingFor
)
rc
=
USP_E_SCRIPT_NOT_IN_FONT
;
for
(
i
=
0
;
i
<
*
pcTags
;
i
++
)
for
(
i
=
0
;
i
<
psc
->
script_count
;
i
++
)
{
if
(
i
<
cMaxTags
)
pScriptTags
[
i
]
=
MS_MAKE_TAG
(
script
->
ScriptRecord
[
i
].
ScriptTag
[
0
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
1
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
2
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
3
])
;
pScriptTags
[
i
]
=
psc
->
scripts
[
i
].
tag
;
if
(
searchingFor
)
{
if
(
s
trncmp
(
script
->
ScriptRecord
[
i
].
ScriptTag
,
(
char
*
)
&
searchingFor
,
4
)
==
0
)
if
(
s
earchingFor
==
psc
->
scripts
[
i
].
tag
)
{
pScriptTags
[
0
]
=
MS_MAKE_TAG
(
script
->
ScriptRecord
[
i
].
ScriptTag
[
0
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
1
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
2
],
script
->
ScriptRecord
[
i
].
ScriptTag
[
3
])
;
pScriptTags
[
0
]
=
psc
->
scripts
[
i
].
tag
;
*
pcTags
=
1
;
if
(
script_table
)
{
int
offset
=
GET_BE_WORD
(
script
->
ScriptRecord
[
i
].
Script
);
*
script_table
=
((
const
BYTE
*
)
script
+
offset
);
}
*
script_table
=
psc
->
scripts
[
i
].
table
;
rc
=
S_OK
;
break
;
}
...
...
@@ -3836,7 +3850,7 @@ HRESULT SHAPE_GetFontScriptTags( HDC hdc, ScriptCache *psc,
searching
=
MS_MAKE_TAG
(
ShapingData
[
psa
->
eScript
].
otTag
[
0
],
ShapingData
[
psa
->
eScript
].
otTag
[
1
],
ShapingData
[
psa
->
eScript
].
otTag
[
2
],
ShapingData
[
psa
->
eScript
].
otTag
[
3
]);
}
hr
=
GSUB_GetFontScriptTags
(
psc
->
GSUB_Table
,
searching
,
cMaxTags
,
pScriptTags
,
pcTags
,
NULL
);
hr
=
GSUB_GetFontScriptTags
(
psc
,
searching
,
cMaxTags
,
pScriptTags
,
pcTags
,
NULL
);
if
(
FAILED
(
hr
))
*
pcTags
=
0
;
return
hr
;
...
...
dlls/usp10/usp10.c
View file @
1090cd2f
...
...
@@ -933,6 +933,7 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
heap_free
(((
ScriptCache
*
)
*
psc
)
->
GSUB_Table
);
heap_free
(((
ScriptCache
*
)
*
psc
)
->
GDEF_Table
);
heap_free
(((
ScriptCache
*
)
*
psc
)
->
CMAP_Table
);
heap_free
(((
ScriptCache
*
)
*
psc
)
->
scripts
);
heap_free
(((
ScriptCache
*
)
*
psc
)
->
features
);
heap_free
(
*
psc
);
*
psc
=
NULL
;
...
...
dlls/usp10/usp10_internal.h
View file @
1090cd2f
...
...
@@ -132,6 +132,11 @@ typedef struct {
}
LoadedFeature
;
typedef
struct
{
OPENTYPE_TAG
tag
;
LPCVOID
table
;
}
LoadedScript
;
typedef
struct
{
LOGFONTW
lf
;
TEXTMETRICW
tm
;
BOOL
sfnt
;
...
...
@@ -143,6 +148,8 @@ typedef struct {
LPVOID
CMAP_format12_Table
;
INT
feature_count
;
LoadedFeature
*
features
;
INT
script_count
;
LoadedScript
*
scripts
;
OPENTYPE_TAG
userScript
;
OPENTYPE_TAG
userLang
;
...
...
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