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
a22d5ed9
Commit
a22d5ed9
authored
Sep 01, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Force reported English family/face names to resolved values.
parent
d2d64bd7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
11 deletions
+39
-11
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+22
-10
main.c
dlls/dwrite/main.c
+16
-1
No files found.
dlls/dwrite/dwrite_private.h
View file @
a22d5ed9
...
...
@@ -122,6 +122,7 @@ extern void release_gdiinterop(IDWriteGdiInterop*) DECLSPEC_HIDDEN;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
add_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
DECLSPEC_HIDDEN
;
extern
void
set_en_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_system_fontcollection
(
IDWriteFactory2
*
,
IDWriteFontCollection
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_eudc_fontcollection
(
IDWriteFactory2
*
,
IDWriteFontCollection
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_textanalyzer
(
IDWriteTextAnalyzer
**
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
a22d5ed9
...
...
@@ -1985,7 +1985,8 @@ static int trim_spaces(WCHAR *in, WCHAR *ret)
struct
name_token
{
struct
list
entry
;
const
WCHAR
*
ptr
;
INT
len
;
INT
len
;
/* token length */
INT
fulllen
;
/* full length including following separators */
};
static
inline
BOOL
is_name_separator_char
(
WCHAR
ch
)
...
...
@@ -2406,7 +2407,7 @@ static inline void font_name_token_to_str(const struct name_token *name, WCHAR *
strW
[
name
->
len
]
=
0
;
}
static
void
font_apply_differentiation_rules
(
struct
dwrite_font_data
*
font
,
WCHAR
*
familyW
,
WCHAR
*
faceW
)
static
BOOL
font_apply_differentiation_rules
(
struct
dwrite_font_data
*
font
,
WCHAR
*
familyW
,
WCHAR
*
faceW
)
{
static
const
WCHAR
bookW
[]
=
{
'B'
,
'o'
,
'o'
,
'k'
,
0
};
static
const
WCHAR
normalW
[]
=
{
'N'
,
'o'
,
'r'
,
'm'
,
'a'
,
'l'
,
0
};
...
...
@@ -2473,15 +2474,19 @@ static void font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
struct
name_token
*
token
=
heap_alloc
(
sizeof
(
*
token
));
token
->
ptr
=
ptr
;
token
->
len
=
0
;
token
->
fulllen
=
0
;
while
(
*
ptr
&&
!
is_name_separator_char
(
*
ptr
))
{
token
->
len
++
;
token
->
fulllen
++
;
ptr
++
;
}
/* skip separators */
while
(
is_name_separator_char
(
*
ptr
))
while
(
is_name_separator_char
(
*
ptr
))
{
token
->
fulllen
++
;
ptr
++
;
}
list_add_head
(
&
tokens
,
&
token
->
entry
);
}
...
...
@@ -2526,19 +2531,22 @@ static void font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
/* get final combined string from what's left in token list, list is released */
ptrW
=
finalW
;
*
ptrW
=
0
;
LIST_FOR_EACH_ENTRY_SAFE_REV
(
token
,
token2
,
&
tokens
,
struct
name_token
,
entry
)
{
if
(
*
finalW
)
*
(
ptrW
++
)
=
' '
;
memcpy
(
ptrW
,
token
->
ptr
,
token
->
len
*
sizeof
(
WCHAR
));
ptrW
+=
token
->
len
;
int
len
;
list_remove
(
&
token
->
entry
);
/* don't include last separator */
len
=
list_empty
(
&
tokens
)
?
token
->
len
:
token
->
fulllen
;
memcpy
(
ptrW
,
token
->
ptr
,
len
*
sizeof
(
WCHAR
));
ptrW
+=
len
;
heap_free
(
token
);
}
*
ptrW
=
0
;
if
(
!
strcmpW
(
familyW
,
finalW
))
return
;
return
FALSE
;
/* construct face name */
strcpyW
(
familyW
,
finalW
);
...
...
@@ -2620,6 +2628,7 @@ static void font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
}
TRACE
(
"resolved family %s, face %s
\n
"
,
debugstr_w
(
familyW
),
debugstr_w
(
faceW
));
return
TRUE
;
}
static
HRESULT
init_font_data
(
IDWriteFactory2
*
factory
,
IDWriteFontFile
*
file
,
DWRITE_FONT_FACE_TYPE
face_type
,
UINT32
face_index
,
...
...
@@ -2670,7 +2679,10 @@ static HRESULT init_font_data(IDWriteFactory2 *factory, IDWriteFontFile *file, D
fontstrings_get_en_string
(
*
family_name
,
familyW
,
sizeof
(
familyW
)
/
sizeof
(
WCHAR
));
fontstrings_get_en_string
(
data
->
names
,
faceW
,
sizeof
(
faceW
)
/
sizeof
(
WCHAR
));
font_apply_differentiation_rules
(
data
,
familyW
,
faceW
);
if
(
font_apply_differentiation_rules
(
data
,
familyW
,
faceW
))
{
set_en_localizedstring
(
*
family_name
,
familyW
);
set_en_localizedstring
(
data
->
names
,
faceW
);
}
init_font_prop_vec
(
data
->
weight
,
data
->
stretch
,
data
->
style
,
&
data
->
propvec
);
...
...
dlls/dwrite/main.c
View file @
a22d5ed9
...
...
@@ -438,7 +438,7 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
}
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
ret
)
{
{
struct
localizedstrings
*
strings
,
*
strings_clone
;
int
i
;
...
...
@@ -471,6 +471,21 @@ HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedSt
return
S_OK
;
}
void
set_en_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
const
WCHAR
*
string
)
{
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'U'
,
'S'
,
0
};
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
UINT32
i
;
for
(
i
=
0
;
i
<
This
->
count
;
i
++
)
{
if
(
!
strcmpiW
(
This
->
data
[
i
].
locale
,
enusW
))
{
heap_free
(
This
->
data
[
i
].
string
);
This
->
data
[
i
].
string
=
heap_strdupW
(
string
);
break
;
}
}
}
struct
collectionloader
{
struct
list
entry
;
...
...
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