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
c44a0e86
Commit
c44a0e86
authored
Jun 02, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Partially implement GetBaseline().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4f7f3b7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
33 deletions
+92
-33
analyzer.c
dlls/dwrite/analyzer.c
+54
-4
analyzer.c
dlls/dwrite/tests/analyzer.c
+38
-29
No files found.
dlls/dwrite/analyzer.c
View file @
c44a0e86
...
...
@@ -1539,13 +1539,63 @@ static HRESULT WINAPI dwritetextanalyzer1_ApplyCharacterSpacing(IDWriteTextAnaly
return
S_OK
;
}
static
HRESULT
WINAPI
dwritetextanalyzer1_GetBaseline
(
IDWriteTextAnalyzer2
*
iface
,
IDWriteFontFace
*
face
,
static
HRESULT
WINAPI
dwritetextanalyzer1_GetBaseline
(
IDWriteTextAnalyzer2
*
iface
,
IDWriteFontFace
*
f
ontf
ace
,
DWRITE_BASELINE
baseline
,
BOOL
vertical
,
BOOL
is_simulation_allowed
,
DWRITE_SCRIPT_ANALYSIS
sa
,
const
WCHAR
*
localeName
,
INT32
*
baseline_coord
,
BOOL
*
exists
)
{
FIXME
(
"(%p %d %d %u %s %p %p): stub
\n
"
,
face
,
vertical
,
is_simulation_allowed
,
sa
.
script
,
debugstr_w
(
localeName
),
baseline_coord
,
exists
);
return
E_NOTIMPL
;
struct
dwrite_fontface
*
font_obj
;
const
DWRITE_FONT_METRICS1
*
metrics
;
TRACE
(
"%p, %d, %d, %u, %s, %p, %p.
\n
"
,
fontface
,
vertical
,
is_simulation_allowed
,
sa
.
script
,
debugstr_w
(
localeName
),
baseline_coord
,
exists
);
*
exists
=
FALSE
;
*
baseline_coord
=
0
;
if
(
baseline
==
DWRITE_BASELINE_DEFAULT
)
baseline
=
vertical
?
DWRITE_BASELINE_CENTRAL
:
DWRITE_BASELINE_ROMAN
;
if
((
unsigned
int
)
baseline
>
DWRITE_BASELINE_MAXIMUM
)
return
E_INVALIDARG
;
/* TODO: fetch BASE table data if available. */
if
(
!*
exists
&&
is_simulation_allowed
)
{
font_obj
=
unsafe_impl_from_IDWriteFontFace
(
fontface
);
metrics
=
&
font_obj
->
metrics
;
switch
(
baseline
)
{
case
DWRITE_BASELINE_ROMAN
:
*
baseline_coord
=
vertical
?
metrics
->
descent
:
0
;
break
;
case
DWRITE_BASELINE_CENTRAL
:
*
baseline_coord
=
vertical
?
(
metrics
->
ascent
+
metrics
->
descent
)
/
2
:
-
(
metrics
->
ascent
-
metrics
->
descent
)
/
2
;
break
;
case
DWRITE_BASELINE_MATH
:
*
baseline_coord
=
vertical
?
(
metrics
->
ascent
+
metrics
->
descent
)
/
2
:
-
(
metrics
->
ascent
+
metrics
->
descent
)
/
2
;
break
;
case
DWRITE_BASELINE_HANGING
:
/* FIXME: this one isn't accurate, but close. */
*
baseline_coord
=
vertical
?
metrics
->
capHeight
*
6
/
7
+
metrics
->
descent
:
metrics
->
capHeight
*
6
/
7
;
break
;
case
DWRITE_BASELINE_IDEOGRAPHIC_BOTTOM
:
case
DWRITE_BASELINE_MINIMUM
:
*
baseline_coord
=
vertical
?
0
:
metrics
->
descent
;
break
;
case
DWRITE_BASELINE_IDEOGRAPHIC_TOP
:
case
DWRITE_BASELINE_MAXIMUM
:
*
baseline_coord
=
vertical
?
metrics
->
ascent
+
metrics
->
descent
:
-
metrics
->
ascent
;
break
;
default:
;
}
}
return
S_OK
;
}
static
HRESULT
WINAPI
dwritetextanalyzer1_AnalyzeVerticalGlyphOrientation
(
IDWriteTextAnalyzer2
*
iface
,
...
...
dlls/dwrite/tests/analyzer.c
View file @
c44a0e86
...
...
@@ -2484,39 +2484,48 @@ static void test_GetBaseline(void)
fontface
=
create_fontface
();
/* Tahoma doesn't have BASE table, it doesn't work even with simulation enabled */
/* Tahoma does not have a BASE table. */
exists
=
TRUE
;
baseline
=
456
;
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_DEFAULT
,
FALSE
,
TRUE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
baseline
==
0
,
"got %d
\n
"
,
baseline
);
ok
(
exists
==
FALSE
,
"got %d
\n
"
,
exists
);
}
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_DEFAULT
,
FALSE
,
TRUE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
baseline
,
"Unexpected baseline %d.
\n
"
,
baseline
);
ok
(
!
exists
,
"Unexpected flag %d.
\n
"
,
exists
);
exists
=
TRUE
;
baseline
=
456
;
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_ROMAN
,
FALSE
,
TRUE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
baseline
==
0
,
"got %d
\n
"
,
baseline
);
ok
(
exists
==
FALSE
,
"got %d
\n
"
,
exists
);
}
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_DEFAULT
,
FALSE
,
FALSE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
baseline
,
"Unexpected baseline %d.
\n
"
,
baseline
);
ok
(
!
exists
,
"Unexpected flag %d.
\n
"
,
exists
);
exists
=
TRUE
;
baseline
=
0
;
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_CENTRAL
,
FALSE
,
TRUE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
baseline
!=
0
,
"Unexpected baseline %d.
\n
"
,
baseline
);
ok
(
!
exists
,
"Unexpected flag %d.
\n
"
,
exists
);
exists
=
TRUE
;
baseline
=
0
;
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_CENTRAL
,
FALSE
,
FALSE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
baseline
,
"Unexpected baseline %d.
\n
"
,
baseline
);
ok
(
!
exists
,
"Unexpected flag %d.
\n
"
,
exists
);
exists
=
TRUE
;
baseline
=
456
;
hr
=
IDWriteTextAnalyzer1_GetBaseline
(
analyzer1
,
fontface
,
DWRITE_BASELINE_DEFAULT
+
100
,
FALSE
,
TRUE
,
sa
,
NULL
,
&
baseline
,
&
exists
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
baseline
,
"Unexpected baseline %d.
\n
"
,
baseline
);
ok
(
!
exists
,
"Unexpected flag %d.
\n
"
,
exists
);
IDWriteFontFace_Release
(
fontface
);
IDWriteTextAnalyzer1_Release
(
analyzer1
);
}
...
...
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