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
2d8f32be
Commit
2d8f32be
authored
Mar 10, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Look for English name strings in mac platform records.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0d07d1ec
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
19 deletions
+37
-19
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
main.c
dlls/dwrite/main.c
+7
-3
opentype.c
dlls/dwrite/opentype.c
+29
-16
No files found.
dlls/dwrite/dwrite_private.h
View file @
2d8f32be
...
...
@@ -298,6 +298,7 @@ extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const W
extern
HRESULT
clone_localizedstrings
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
DECLSPEC_HIDDEN
;
extern
void
set_en_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
void
sort_localizedstrings
(
IDWriteLocalizedStrings
*
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
get_localizedstrings_count
(
IDWriteLocalizedStrings
*
strings
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_system_fontcollection
(
IDWriteFactory7
*
factory
,
IDWriteFontCollection1
**
collection
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_eudc_fontcollection
(
IDWriteFactory7
*
factory
,
IDWriteFontCollection3
**
collection
)
DECLSPEC_HIDDEN
;
extern
IDWriteTextAnalyzer2
*
get_text_analyzer
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/main.c
View file @
2d8f32be
...
...
@@ -323,11 +323,9 @@ static ULONG WINAPI localizedstrings_Release(IDWriteLocalizedStrings *iface)
static
UINT32
WINAPI
localizedstrings_GetCount
(
IDWriteLocalizedStrings
*
iface
)
{
struct
localizedstrings
*
strings
=
impl_from_IDWriteLocalizedStrings
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
strings
->
count
;
return
get_localizedstrings_count
(
iface
)
;
}
static
HRESULT
WINAPI
localizedstrings_FindLocaleName
(
IDWriteLocalizedStrings
*
iface
,
...
...
@@ -559,6 +557,12 @@ void sort_localizedstrings(IDWriteLocalizedStrings *iface)
qsort
(
strings
->
data
,
strings
->
count
,
sizeof
(
*
strings
->
data
),
localizedstrings_sorting_compare
);
}
unsigned
int
get_localizedstrings_count
(
IDWriteLocalizedStrings
*
iface
)
{
struct
localizedstrings
*
strings
=
impl_from_IDWriteLocalizedStrings
(
iface
);
return
strings
->
count
;
}
struct
collectionloader
{
struct
list
entry
;
...
...
dlls/dwrite/opentype.c
View file @
2d8f32be
...
...
@@ -2288,9 +2288,21 @@ static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT la
}
}
static
BOOL
opentype_is_english_namerecord
(
const
struct
dwrite_fonttable
*
table
,
unsigned
int
idx
)
{
const
struct
name_header
*
header
=
(
const
struct
name_header
*
)
table
->
data
;
const
struct
name_record
*
record
;
record
=
&
header
->
records
[
idx
];
return
GET_BE_WORD
(
record
->
platformID
)
==
OPENTYPE_PLATFORM_MAC
&&
GET_BE_WORD
(
record
->
languageID
)
==
TT_NAME_MAC_LANGID_ENGLISH
;
}
static
BOOL
opentype_decode_namerecord
(
const
struct
dwrite_fonttable
*
table
,
unsigned
int
idx
,
IDWriteLocalizedStrings
*
strings
)
{
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'U'
,
'S'
,
0
};
USHORT
lang_id
,
length
,
offset
,
encoding
,
platform
;
const
struct
name_header
*
header
=
(
const
struct
name_header
*
)
table
->
data
;
const
struct
name_record
*
record
;
...
...
@@ -2338,7 +2350,8 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns
TRACE
(
"string %s for locale %s found
\n
"
,
debugstr_w
(
name_string
),
debugstr_w
(
locale
));
add_localizedstring
(
strings
,
locale
,
name_string
);
heap_free
(
name_string
);
ret
=
TRUE
;
ret
=
!
lstrcmpW
(
locale
,
enusW
);
}
else
FIXME
(
"handle NAME format 1
\n
"
);
...
...
@@ -2349,10 +2362,10 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns
static
HRESULT
opentype_get_font_strings_from_id
(
const
struct
dwrite_fonttable
*
table
,
enum
OPENTYPE_STRING_ID
id
,
IDWriteLocalizedStrings
**
strings
)
{
int
i
,
count
,
candidate_mac
,
candidate_unicode
;
int
i
,
count
,
candidate_mac
,
candidate_
mac_en
,
candidate_
unicode
;
const
struct
name_record
*
records
;
BOOL
has_english
;
WORD
format
;
BOOL
exists
;
HRESULT
hr
;
if
(
!
table
->
data
)
...
...
@@ -2374,8 +2387,8 @@ static HRESULT opentype_get_font_strings_from_id(const struct dwrite_fonttable *
count
=
0
;
}
exists
=
FALSE
;
candidate_unicode
=
candidate_mac
=
-
1
;
has_english
=
FALSE
;
candidate_unicode
=
candidate_mac
=
candidate_mac_en
=
-
1
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -2398,10 +2411,11 @@ static HRESULT opentype_get_font_strings_from_id(const struct dwrite_fonttable *
case
OPENTYPE_PLATFORM_MAC
:
if
(
candidate_mac
==
-
1
)
candidate_mac
=
i
;
if
(
candidate_mac_en
==
-
1
&&
opentype_is_english_namerecord
(
table
,
i
))
candidate_mac_en
=
i
;
break
;
case
OPENTYPE_PLATFORM_WIN
:
if
(
opentype_decode_namerecord
(
table
,
i
,
*
strings
))
exists
=
TRUE
;
has_english
|=
opentype_decode_namerecord
(
table
,
i
,
*
strings
);
break
;
default:
FIXME
(
"platform %i not supported
\n
"
,
platform
);
...
...
@@ -2409,24 +2423,23 @@ static HRESULT opentype_get_font_strings_from_id(const struct dwrite_fonttable *
}
}
if
(
!
exists
)
{
if
(
candidate_mac
!=
-
1
)
exists
=
opentype_decode_namerecord
(
table
,
candidate_mac
,
*
strings
);
if
(
!
exists
&&
candidate_unicode
!=
-
1
)
exists
=
opentype_decode_namerecord
(
table
,
candidate_unicode
,
*
strings
);
if
(
!
get_localizedstrings_count
(
*
strings
)
&&
candidate_mac
!=
-
1
)
has_english
|=
opentype_decode_namerecord
(
table
,
candidate_mac
,
*
strings
);
if
(
!
get_localizedstrings_count
(
*
strings
)
&&
candidate_unicode
!=
-
1
)
has_english
|=
opentype_decode_namerecord
(
table
,
candidate_unicode
,
*
strings
);
if
(
!
has_english
&&
candidate_mac_en
!=
-
1
)
opentype_decode_namerecord
(
table
,
candidate_mac_en
,
*
strings
);
if
(
!
exists
)
if
(
!
get_localizedstrings_count
(
*
strings
)
)
{
IDWriteLocalizedStrings_Release
(
*
strings
);
*
strings
=
NULL
;
}
}
if
(
*
strings
)
sort_localizedstrings
(
*
strings
);
return
exist
s
?
S_OK
:
E_FAIL
;
return
*
string
s
?
S_OK
:
E_FAIL
;
}
static
WCHAR
*
meta_get_lng_name
(
WCHAR
*
str
,
WCHAR
**
ctx
)
...
...
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