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
55439cc3
Commit
55439cc3
authored
Aug 31, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Skip variation selectors in MapCharacters().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
1f86e2c6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
14 deletions
+34
-14
analyzer.c
dlls/dwrite/analyzer.c
+34
-14
layout.c
dlls/dwrite/tests/layout.c
+0
-0
No files found.
dlls/dwrite/analyzer.c
View file @
55439cc3
...
...
@@ -2367,8 +2367,22 @@ static ULONG WINAPI fontfallback_Release(IDWriteFontFallback1 *iface)
return
IDWriteFactory7_Release
(
fallback
->
factory
);
}
static
UINT32
fallback_font_get_supported_length
(
IDWriteFont3
*
font
,
const
struct
fallback_mapping
*
mapping
,
IDWriteTextAnalysisSource
*
source
,
UINT32
position
,
UINT32
length
)
static
inline
BOOL
fallback_is_uvs
(
const
struct
text_source_context
*
context
)
{
/* MONGOLIAN FREE VARIATION SELECTOR ONE..THREE */
if
(
context
->
ch
>=
0x180b
&&
context
->
ch
<=
0x180d
)
return
TRUE
;
/* VARIATION SELECTOR-1..16 */
if
(
context
->
ch
>=
0xfe00
&&
context
->
ch
<=
0xfe0f
)
return
TRUE
;
return
FALSE
;
}
static
inline
unsigned
int
text_source_get_char_length
(
const
struct
text_source_context
*
context
)
{
return
context
->
ch
>
0xffff
?
2
:
1
;
}
static
UINT32
fallback_font_get_supported_length
(
IDWriteFont3
*
font
,
IDWriteTextAnalysisSource
*
source
,
UINT32
position
,
UINT32
length
)
{
struct
text_source_context
context
;
UINT32
mapped
=
0
;
...
...
@@ -2376,9 +2390,12 @@ static UINT32 fallback_font_get_supported_length(IDWriteFont3 *font, const struc
text_source_context_init
(
&
context
,
source
,
position
,
length
);
while
(
!
text_source_get_next_u32_char
(
&
context
))
{
if
(
mapping
&&
!
fallback_mapping_contains_character
(
mapping
,
context
.
ch
))
break
;
if
(
!
IDWriteFont3_HasCharacter
(
font
,
context
.
ch
))
break
;
mapped
+=
context
.
ch
>
0xffff
?
2
:
1
;
/* Ignore selectors that are not leading. */
if
(
!
mapped
||
!
fallback_is_uvs
(
&
context
))
{
if
(
!
IDWriteFont3_HasCharacter
(
font
,
context
.
ch
))
break
;
}
mapped
+=
text_source_get_char_length
(
&
context
);
}
return
mapped
;
...
...
@@ -2415,17 +2432,20 @@ static HRESULT fallback_map_characters(const struct dwrite_fontfallback *fallbac
/* Find a mapping for given locale. */
text_source_get_next_u32_char
(
&
context
);
if
(
!
(
mapping
=
find_fallback_mapping
(
data
,
locale
,
context
.
ch
)))
mapping
=
find_fallback_mapping
(
data
,
locale
,
context
.
ch
);
mapped
=
1
;
while
(
!
text_source_get_next_u32_char
(
&
context
))
{
*
ret_font
=
NULL
;
*
ret_length
=
0
;
return
S_OK
;
if
(
find_fallback_mapping
(
data
,
locale
,
context
.
ch
)
!=
mapping
)
break
;
mapped
+=
text_source_get_char_length
(
&
context
);
}
while
(
!
text_source_get_next_u32_char
(
&
context
)
)
if
(
!
mapping
)
{
if
(
find_fallback_mapping
(
data
,
locale
,
context
.
ch
)
!=
mapping
)
break
;
*
ret_font
=
NULL
;
*
ret_length
=
mapped
;
return
S_OK
;
}
/* Go through families in the mapping, use first family that supports some of the input. */
...
...
@@ -2434,7 +2454,7 @@ static HRESULT fallback_map_characters(const struct dwrite_fontfallback *fallbac
if
(
SUCCEEDED
(
create_matching_font
(
mapping
->
collection
?
mapping
->
collection
:
fallback
->
systemcollection
,
mapping
->
families
[
i
],
weight
,
style
,
stretch
,
&
IID_IDWriteFont3
,
(
void
**
)
&
font
)))
{
if
(
!
(
mapped
=
fallback_font_get_supported_length
(
font
,
mapping
,
source
,
position
,
length
)))
if
(
!
(
mapped
=
fallback_font_get_supported_length
(
font
,
source
,
position
,
mapped
)))
{
IDWriteFont3_Release
(
font
);
continue
;
...
...
@@ -2518,7 +2538,7 @@ static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback1 *iface, ID
if
(
SUCCEEDED
(
create_matching_font
(
basecollection
,
basefamily
,
weight
,
style
,
stretch
,
&
IID_IDWriteFont
,
(
void
**
)
&
font
)))
{
if
((
*
mapped_length
=
fallback_font_get_supported_length
(
font
,
NULL
,
source
,
position
,
length
)))
if
((
*
mapped_length
=
fallback_font_get_supported_length
(
font
,
source
,
position
,
length
)))
{
*
ret_font
=
(
IDWriteFont
*
)
font
;
*
scale
=
1
.
0
f
;
...
...
dlls/dwrite/tests/layout.c
View file @
55439cc3
This diff is collapsed.
Click to expand it.
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