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
d1711850
Commit
d1711850
authored
Jan 26, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Reuse linebreaking isSoftHyphen flag for cluster metrics.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
00766538
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
9 deletions
+30
-9
analyzer.c
dlls/dwrite/analyzer.c
+1
-1
layout.c
dlls/dwrite/layout.c
+3
-2
analyzer.c
dlls/dwrite/tests/analyzer.c
+18
-0
layout.c
dlls/dwrite/tests/layout.c
+8
-6
No files found.
dlls/dwrite/analyzer.c
View file @
d1711850
...
...
@@ -348,7 +348,7 @@ static HRESULT analyze_linebreaks(const WCHAR *text, UINT32 count, DWRITE_LINE_B
breakpoints
[
i
].
breakConditionBefore
=
DWRITE_BREAK_CONDITION_CAN_BREAK
;
breakpoints
[
i
].
breakConditionAfter
=
DWRITE_BREAK_CONDITION_CAN_BREAK
;
breakpoints
[
i
].
isWhitespace
=
!!
isspaceW
(
text
[
i
]);
breakpoints
[
i
].
isSoftHyphen
=
FALSE
;
breakpoints
[
i
].
isSoftHyphen
=
text
[
i
]
==
0x00ad
/* Unicode Soft Hyphen */
;
breakpoints
[
i
].
padding
=
0
;
/* LB1 - resolve some classes. TODO: use external algorithms for these classes. */
...
...
dlls/dwrite/layout.c
View file @
d1711850
...
...
@@ -612,9 +612,10 @@ static inline void init_cluster_metrics(const struct dwrite_textlayout *layout,
metrics
->
canWrapLineAfter
=
breakcondition
==
DWRITE_BREAK_CONDITION_CAN_BREAK
||
breakcondition
==
DWRITE_BREAK_CONDITION_MUST_BREAK
;
if
(
metrics
->
length
==
1
)
{
metrics
->
isWhitespace
=
get_effective_breakpoint
(
layout
,
position
).
isWhitespace
;
DWRITE_LINE_BREAKPOINT
bp
=
get_effective_breakpoint
(
layout
,
position
);
metrics
->
isWhitespace
=
bp
.
isWhitespace
;
metrics
->
isNewline
=
FALSE
/* FIXME */
;
metrics
->
isSoftHyphen
=
layout
->
str
[
position
]
==
0x00ad
/* Unicode Soft Hyphen */
;
metrics
->
isSoftHyphen
=
bp
.
isSoftHyphen
;
}
else
{
metrics
->
isWhitespace
=
FALSE
;
...
...
dlls/dwrite/tests/analyzer.c
View file @
d1711850
...
...
@@ -988,6 +988,24 @@ static struct linebreaks_test linebreaks_tests[] = {
{
DWRITE_BREAK_CONDITION_MUST_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
}
},
/* Soft hyphen, visible word dividers */
{
{
'A'
,
0xad
,
'B'
,
0x5be
,
'C'
,
0xf0b
,
'D'
,
0x1361
,
'E'
,
0x17d8
,
'F'
,
0x17da
,
'G'
,
0
},
{
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
1
},
{
DWRITE_BREAK_CONDITION_CAN_BREAK
,
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_CAN_BREAK
,
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_CAN_BREAK
,
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_CAN_BREAK
,
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_CAN_BREAK
,
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_MAY_NOT_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
{
DWRITE_BREAK_CONDITION_CAN_BREAK
,
DWRITE_BREAK_CONDITION_CAN_BREAK
,
0
,
0
},
}
},
{
{
0
}
}
};
...
...
dlls/dwrite/tests/layout.c
View file @
d1711850
...
...
@@ -1666,13 +1666,13 @@ static void test_GetClusterMetrics(void)
/* SP - SPACE */
0x20
};
static
const
WCHAR
str5W
[]
=
{
'a'
,
'\r'
,
'b'
,
'\n'
,
'c'
,
'\n'
,
'\r'
,
'd'
,
'\r'
,
'\n'
,
'e'
,
0xb
,
'f'
,
0xc
,
'g'
,
0x0085
,
'h'
,
0x2028
,
'i'
,
0x2029
,
0
};
'g'
,
0x0085
,
'h'
,
0x2028
,
'i'
,
0x2029
,
0
xad
,
0
};
static
const
WCHAR
str3W
[]
=
{
0x2066
,
')'
,
')'
,
0x661
,
'('
,
0x627
,
')'
,
0
};
static
const
WCHAR
str2W
[]
=
{
0x202a
,
0x202c
,
'a'
,
0
};
static
const
WCHAR
strW
[]
=
{
'a'
,
'b'
,
'c'
,
'd'
,
0
};
static
const
WCHAR
str4W
[]
=
{
'a'
,
' '
,
0
};
DWRITE_INLINE_OBJECT_METRICS
inline_metrics
;
DWRITE_CLUSTER_METRICS
metrics
[
2
0
];
DWRITE_CLUSTER_METRICS
metrics
[
2
1
];
IDWriteTextLayout1
*
layout1
;
IDWriteInlineObject
*
trimm
;
IDWriteTextFormat
*
format
;
...
...
@@ -1955,14 +1955,14 @@ todo_wine
IDWriteTextLayout_Release
(
layout
);
/* isNewline tests */
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
str5W
,
20
,
format
,
100
.
0
,
200
.
0
,
&
layout
);
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
str5W
,
lstrlenW
(
str5W
),
format
,
100
.
0
f
,
200
.
0
f
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
count
=
0
;
memset
(
metrics
,
0
,
sizeof
(
metrics
));
hr
=
IDWriteTextLayout_GetClusterMetrics
(
layout
,
metrics
,
20
,
&
count
);
hr
=
IDWriteTextLayout_GetClusterMetrics
(
layout
,
metrics
,
sizeof
(
metrics
)
/
sizeof
(
metrics
[
0
])
,
&
count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
count
==
2
0
,
"got %u
\n
"
,
count
);
ok
(
count
==
2
1
,
"got %u
\n
"
,
count
);
todo_wine
{
ok
(
metrics
[
1
].
isNewline
==
1
,
"got %d
\n
"
,
metrics
[
1
].
isNewline
);
...
...
@@ -1987,8 +1987,10 @@ todo_wine {
ok
(
metrics
[
16
].
isNewline
==
0
,
"got %d
\n
"
,
metrics
[
16
].
isNewline
);
ok
(
metrics
[
18
].
isNewline
==
0
,
"got %d
\n
"
,
metrics
[
18
].
isNewline
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
ok
(
metrics
[
i
].
length
==
1
,
"%d: got %d
\n
"
,
i
,
metrics
[
i
].
length
);
ok
(
metrics
[
i
].
isSoftHyphen
==
(
i
==
count
-
1
),
"%d: got %d
\n
"
,
i
,
metrics
[
i
].
isSoftHyphen
);
}
IDWriteTextLayout_Release
(
layout
);
...
...
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