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
35e9b6d8
Commit
35e9b6d8
authored
Oct 24, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Pass raw NAME table pointer to table reading code.
parent
23006025
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
39 deletions
+44
-39
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-1
font.c
dlls/dwrite/font.c
+17
-4
main.c
dlls/dwrite/main.c
+21
-18
opentype.c
dlls/dwrite/opentype.c
+3
-12
font.c
dlls/dwrite/tests/font.c
+2
-4
No files found.
dlls/dwrite/dwrite_private.h
View file @
35e9b6d8
...
...
@@ -113,7 +113,7 @@ extern HRESULT opentype_get_font_table(IDWriteFontFileStream*,DWRITE_FONT_FACE_T
extern
void
opentype_cmap_get_glyphindex
(
void
*
,
UINT32
,
UINT16
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_cmap_get_unicode_ranges
(
void
*
,
UINT32
,
DWRITE_UNICODE_RANGE
*
,
UINT32
*
)
DECLSPEC_HIDDEN
;
extern
VOID
get_font_properties
(
LPCVOID
os2
,
LPCVOID
head
,
LPCVOID
post
,
DWRITE_FONT_METRICS
*
metrics
,
DWRITE_FONT_STRETCH
*
stretch
,
DWRITE_FONT_WEIGHT
*
weight
,
DWRITE_FONT_STYLE
*
style
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_font_strings_from_id
(
IDWriteFontFace2
*
,
DWRITE_INFORMATIONAL_STRING_ID
,
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_font_strings_from_id
(
const
void
*
,
DWRITE_INFORMATIONAL_STRING_ID
,
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
bidi_computelevels
(
const
WCHAR
*
,
UINT32
,
UINT8
,
UINT8
*
,
UINT8
*
)
DECLSPEC_HIDDEN
;
extern
WCHAR
bidi_get_mirrored_char
(
WCHAR
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
35e9b6d8
...
...
@@ -29,6 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
#define MS_OS2_TAG DWRITE_MAKE_OPENTYPE_TAG('O','S','/','2')
#define MS_POST_TAG DWRITE_MAKE_OPENTYPE_TAG('p','o','s','t')
#define MS_CMAP_TAG DWRITE_MAKE_OPENTYPE_TAG('c','m','a','p')
#define MS_NAME_TAG DWRITE_MAKE_OPENTYPE_TAG('n','a','m','e')
struct
dwrite_fontface_data
{
LONG
ref
;
...
...
@@ -986,14 +987,26 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont2 *iface,
if
(
!
data
->
info_strings
[
stringid
])
{
IDWriteFontFace2
*
fontface
;
const
void
*
table_data
;
BOOL
table_exists
;
void
*
context
;
UINT32
size
;
hr
=
get_fontface_from_font
(
This
,
&
fontface
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
opentype_get_font_strings_from_id
(
fontface
,
stringid
,
&
data
->
info_strings
[
stringid
]);
if
(
FAILED
(
hr
)
||
!
data
->
info_strings
[
stringid
])
return
hr
;
table_exists
=
FALSE
;
hr
=
IDWriteFontFace2_TryGetFontTable
(
fontface
,
MS_NAME_TAG
,
&
table_data
,
&
size
,
&
context
,
&
table_exists
);
if
(
FAILED
(
hr
)
||
!
table_exists
)
WARN
(
"no NAME table found.
\n
"
);
if
(
table_exists
)
{
hr
=
opentype_get_font_strings_from_id
(
table_data
,
stringid
,
&
data
->
info_strings
[
stringid
]);
if
(
FAILED
(
hr
)
||
!
data
->
info_strings
[
stringid
])
return
hr
;
IDWriteFontFace2_ReleaseFontTable
(
fontface
,
context
);
}
}
hr
=
clone_localizedstring
(
data
->
info_strings
[
stringid
],
strings
);
...
...
@@ -1001,7 +1014,7 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont2 *iface,
return
hr
;
*
exists
=
TRUE
;
return
hr
;
return
S_OK
;
}
static
DWRITE_FONT_SIMULATIONS
WINAPI
dwritefont_GetSimulations
(
IDWriteFont2
*
iface
)
...
...
dlls/dwrite/main.c
View file @
35e9b6d8
...
...
@@ -361,33 +361,36 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
return
S_OK
;
}
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
struct
localizedstrings
*
New
;
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
ret
)
{
struct
localizedstrings
*
strings
,
*
strings_clone
;
int
i
;
*
strings
=
NULL
;
*
ret
=
NULL
;
if
(
!
iface
)
return
S_FALSE
;
New
=
heap_alloc
(
sizeof
(
struct
localizedstrings
));
if
(
!
New
)
return
E_OUTOFMEMORY
;
strings
=
impl_from_IDWriteLocalizedStrings
(
iface
);
strings_clone
=
heap_alloc
(
sizeof
(
struct
localizedstrings
));
if
(
!
strings_clone
)
return
E_OUTOFMEMORY
;
New
->
IDWriteLocalizedStrings_iface
.
lpVtbl
=
&
localizedstringsvtbl
;
New
->
ref
=
1
;
New
->
count
=
Thi
s
->
count
;
New
->
data
=
heap_alloc
(
sizeof
(
struct
localizedpair
)
*
New
->
count
);
if
(
!
New
->
data
)
{
heap_free
(
New
);
strings_clone
->
IDWriteLocalizedStrings_iface
.
lpVtbl
=
&
localizedstringsvtbl
;
strings_clone
->
ref
=
1
;
strings_clone
->
count
=
string
s
->
count
;
strings_clone
->
data
=
heap_alloc
(
sizeof
(
struct
localizedpair
)
*
strings_clone
->
count
);
if
(
!
strings_clone
->
data
)
{
heap_free
(
strings_clone
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
New
->
count
;
i
++
)
for
(
i
=
0
;
i
<
strings_clone
->
count
;
i
++
)
{
New
->
data
[
i
].
locale
=
heap_strdupW
(
Thi
s
->
data
[
i
].
locale
);
New
->
data
[
i
].
string
=
heap_strdupW
(
Thi
s
->
data
[
i
].
string
);
strings_clone
->
data
[
i
].
locale
=
heap_strdupW
(
string
s
->
data
[
i
].
locale
);
strings_clone
->
data
[
i
].
string
=
heap_strdupW
(
string
s
->
data
[
i
].
string
);
}
New
->
alloc
=
New
->
count
;
strings_clone
->
alloc
=
strings_clone
->
count
;
*
strings
=
&
New
->
IDWriteLocalizedStrings_iface
;
*
ret
=
&
strings_clone
->
IDWriteLocalizedStrings_iface
;
return
S_OK
;
}
...
...
dlls/dwrite/opentype.c
View file @
35e9b6d8
...
...
@@ -26,7 +26,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
#define MS_TTCF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','t','c','f')
#define MS_OTTO_TAG DWRITE_MAKE_OPENTYPE_TAG('O','T','T','O')
#define MS_NAME_TAG DWRITE_MAKE_OPENTYPE_TAG('n','a','m','e')
#ifdef WORDS_BIGENDIAN
#define GET_BE_WORD(x) (x)
...
...
@@ -615,24 +614,18 @@ VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_ME
}
}
HRESULT
opentype_get_font_strings_from_id
(
IDWriteFontFace2
*
fontface
,
DWRITE_INFORMATIONAL_STRING_ID
id
,
IDWriteLocalizedStrings
**
strings
)
HRESULT
opentype_get_font_strings_from_id
(
const
void
*
table_data
,
DWRITE_INFORMATIONAL_STRING_ID
id
,
IDWriteLocalizedStrings
**
strings
)
{
const
void
*
table_data
=
NULL
;
void
*
name_context
=
NULL
;
const
TT_NAME_V0
*
header
;
BYTE
*
storage_area
=
0
;
BOOL
exists
=
FALSE
;
USHORT
count
=
0
;
UINT16
name_id
;
UINT32
size
;
BOOL
exists
;
HRESULT
hr
;
int
i
;
hr
=
IDWriteFontFace2_TryGetFontTable
(
fontface
,
MS_NAME_TAG
,
&
table_data
,
&
size
,
&
name_context
,
&
exists
);
if
(
FAILED
(
hr
)
||
!
exists
)
{
FIXME
(
"failed to get NAME table
\n
"
);
if
(
!
table_data
)
return
E_FAIL
;
}
hr
=
create_localizedstrings
(
strings
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -727,8 +720,6 @@ HRESULT opentype_get_font_strings_from_id(IDWriteFontFace2 *fontface, DWRITE_INF
}
}
IDWriteFontFace2_ReleaseFontTable
(
fontface
,
name_context
);
if
(
!
exists
)
{
IDWriteLocalizedStrings_Release
(
*
strings
);
*
strings
=
NULL
;
...
...
dlls/dwrite/tests/font.c
View file @
35e9b6d8
...
...
@@ -1521,10 +1521,9 @@ static void test_GetInformationalStrings(void)
exists
=
FALSE
;
strings
=
NULL
;
hr
=
IDWriteFont_GetInformationalStrings
(
font
,
DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES
,
&
strings
,
&
exists
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
exists
==
TRUE
,
"got %d
\n
"
,
exists
);
}
exists
=
TRUE
;
strings
=
NULL
;
hr
=
IDWriteFont_GetInformationalStrings
(
font
,
DWRITE_INFORMATIONAL_STRING_NONE
,
&
strings
,
&
exists
);
...
...
@@ -1534,10 +1533,9 @@ todo_wine {
/* strings instance is not reused */
strings2
=
NULL
;
hr
=
IDWriteFont_GetInformationalStrings
(
font
,
DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES
,
&
strings2
,
&
exists
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
strings2
!=
strings
,
"got %p, %p
\n
"
,
strings2
,
strings
);
}
if
(
strings
)
IDWriteLocalizedStrings_Release
(
strings
);
...
...
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