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
7e0d1025
Commit
7e0d1025
authored
Aug 16, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Multiply run analysis transform by dpi scale factor.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
32b35f80
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
38 deletions
+50
-38
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-3
font.c
dlls/dwrite/font.c
+8
-9
main.c
dlls/dwrite/main.c
+41
-26
No files found.
dlls/dwrite/dwrite_private.h
View file @
7e0d1025
...
...
@@ -117,9 +117,7 @@ struct glyphrunanalysis_desc
DWRITE_MEASURING_MODE
measuring_mode
;
DWRITE_GRID_FIT_MODE
gridfit_mode
;
DWRITE_TEXT_ANTIALIAS_MODE
aa_mode
;
FLOAT
origin_x
;
FLOAT
origin_y
;
FLOAT
ppdip
;
D2D_POINT_2F
origin
;
};
struct
fontface_desc
...
...
dlls/dwrite/font.c
View file @
7e0d1025
...
...
@@ -5397,7 +5397,6 @@ HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc *desc, IDWrit
analysis
->
max_glyph_bitmap_size
=
0
;
SetRectEmpty
(
&
analysis
->
bounds
);
analysis
->
run
=
*
desc
->
run
;
analysis
->
run
.
fontEmSize
*=
desc
->
ppdip
;
IDWriteFontFace_AddRef
(
analysis
->
run
.
fontFace
);
analysis
->
glyphs
=
heap_alloc
(
desc
->
run
->
glyphCount
*
sizeof
(
*
analysis
->
glyphs
));
analysis
->
origins
=
heap_alloc
(
desc
->
run
->
glyphCount
*
sizeof
(
*
analysis
->
origins
));
...
...
@@ -5433,14 +5432,14 @@ HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc *desc, IDWrit
if
(
FAILED
(
hr
=
IDWriteFontFace_QueryInterface
(
desc
->
run
->
fontFace
,
&
IID_IDWriteFontFace1
,
(
void
**
)
&
fontface1
)))
WARN
(
"Failed to get IDWriteFontFace1, %#x.
\n
"
,
hr
);
origin
.
x
=
desc
->
origin
_x
*
desc
->
ppdip
;
origin
.
y
=
desc
->
origin
_y
*
desc
->
ppdip
;
origin
.
x
=
desc
->
origin
.
x
;
origin
.
y
=
desc
->
origin
.
y
;
for
(
i
=
0
;
i
<
desc
->
run
->
glyphCount
;
i
++
)
{
FLOAT
advance
;
/* Use nominal advances if not provided by caller. */
if
(
desc
->
run
->
glyphAdvances
)
advance
=
rtl_factor
*
desc
->
run
->
glyphAdvances
[
i
]
*
desc
->
ppdip
;
advance
=
rtl_factor
*
desc
->
run
->
glyphAdvances
[
i
];
else
{
INT32
a
;
...
...
@@ -5450,14 +5449,14 @@ HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc *desc, IDWrit
case
DWRITE_MEASURING_MODE_NATURAL
:
if
(
SUCCEEDED
(
IDWriteFontFace1_GetDesignGlyphAdvances
(
fontface1
,
1
,
desc
->
run
->
glyphIndices
+
i
,
&
a
,
desc
->
run
->
isSideways
)))
advance
=
rtl_factor
*
get_scaled_advance_width
(
a
,
desc
->
run
->
fontEmSize
,
&
metrics
)
*
desc
->
ppdip
;
advance
=
rtl_factor
*
get_scaled_advance_width
(
a
,
desc
->
run
->
fontEmSize
,
&
metrics
);
break
;
case
DWRITE_MEASURING_MODE_GDI_CLASSIC
:
case
DWRITE_MEASURING_MODE_GDI_NATURAL
:
if
(
SUCCEEDED
(
IDWriteFontFace1_GetGdiCompatibleGlyphAdvances
(
fontface1
,
desc
->
run
->
fontEmSize
,
desc
->
ppdip
,
desc
->
transform
,
desc
->
measuring_mode
==
DWRITE_MEASURING_MODE_GDI_NATURAL
,
1
.
0
f
,
desc
->
transform
,
desc
->
measuring_mode
==
DWRITE_MEASURING_MODE_GDI_NATURAL
,
desc
->
run
->
isSideways
,
1
,
desc
->
run
->
glyphIndices
+
i
,
&
a
)))
advance
=
rtl_factor
*
floorf
(
a
*
desc
->
run
->
fontEmSize
*
desc
->
ppdip
/
metrics
.
designUnitsPerEm
+
0
.
5
f
);
advance
=
rtl_factor
*
floorf
(
a
*
desc
->
run
->
fontEmSize
/
metrics
.
designUnitsPerEm
+
0
.
5
f
);
break
;
default:
;
...
...
@@ -5468,8 +5467,8 @@ HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc *desc, IDWrit
/* Offsets are optional, appled to pre-transformed origin. */
if
(
desc
->
run
->
glyphOffsets
)
{
FLOAT
advanceoffset
=
rtl_factor
*
desc
->
run
->
glyphOffsets
[
i
].
advanceOffset
*
desc
->
ppdip
;
FLOAT
ascenderoffset
=
-
desc
->
run
->
glyphOffsets
[
i
].
ascenderOffset
*
desc
->
ppdip
;
FLOAT
advanceoffset
=
rtl_factor
*
desc
->
run
->
glyphOffsets
[
i
].
advanceOffset
;
FLOAT
ascenderoffset
=
-
desc
->
run
->
glyphOffsets
[
i
].
ascenderOffset
;
if
(
desc
->
run
->
isSideways
)
{
analysis
->
origins
[
i
].
x
+=
ascenderoffset
;
...
...
dlls/dwrite/main.c
View file @
7e0d1025
...
...
@@ -1222,12 +1222,25 @@ static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory5 *if
return
create_numbersubstitution
(
method
,
locale
,
ignore_user_override
,
substitution
);
}
static
inline
void
dwrite_matrix_multiply
(
DWRITE_MATRIX
*
a
,
const
DWRITE_MATRIX
*
b
)
{
DWRITE_MATRIX
tmp
=
*
a
;
a
->
m11
=
tmp
.
m11
*
b
->
m11
+
tmp
.
m12
*
b
->
m21
;
a
->
m12
=
tmp
.
m11
*
b
->
m12
+
tmp
.
m12
*
b
->
m22
;
a
->
m21
=
tmp
.
m21
*
b
->
m11
+
tmp
.
m22
*
b
->
m21
;
a
->
m22
=
tmp
.
m21
*
b
->
m12
+
tmp
.
m22
*
b
->
m22
;
a
->
dx
=
tmp
.
dx
*
b
->
m11
+
tmp
.
dy
*
b
->
m21
+
b
->
dx
;
a
->
dy
=
tmp
.
dy
*
b
->
m12
+
tmp
.
dy
*
b
->
m22
+
b
->
dx
;
}
static
HRESULT
WINAPI
dwritefactory_CreateGlyphRunAnalysis
(
IDWriteFactory5
*
iface
,
DWRITE_GLYPH_RUN
const
*
run
,
FLOAT
ppdip
,
DWRITE_MATRIX
const
*
transform
,
DWRITE_RENDERING_MODE
rendering_mode
,
DWRITE_MEASURING_MODE
measuring_mode
,
FLOAT
originX
,
FLOAT
originY
,
IDWriteGlyphRunAnalysis
**
analysis
)
{
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory5
(
iface
);
struct
glyphrunanalysis_desc
desc
;
DWRITE_MATRIX
m
,
scale
=
{
0
};
TRACE
(
"(%p)->(%p %.2f %p %d %d %.2f %.2f %p)
\n
"
,
This
,
run
,
ppdip
,
transform
,
rendering_mode
,
measuring_mode
,
originX
,
originY
,
analysis
);
...
...
@@ -1237,15 +1250,18 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory5 *ifac
return
E_INVALIDARG
;
}
m
=
transform
?
*
transform
:
identity
;
scale
.
m11
=
ppdip
;
scale
.
m22
=
ppdip
;
dwrite_matrix_multiply
(
&
m
,
&
scale
);
desc
.
run
=
run
;
desc
.
ppdip
=
ppdip
;
desc
.
transform
=
transform
;
desc
.
transform
=
&
m
;
desc
.
rendering_mode
=
(
DWRITE_RENDERING_MODE1
)
rendering_mode
;
desc
.
measuring_mode
=
measuring_mode
;
desc
.
gridfit_mode
=
DWRITE_GRID_FIT_MODE_DEFAULT
;
desc
.
aa_mode
=
DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE
;
desc
.
origin
_
x
=
originX
;
desc
.
origin
_
y
=
originY
;
desc
.
origin
.
x
=
originX
;
desc
.
origin
.
y
=
originY
;
return
create_glyphrunanalysis
(
&
desc
,
analysis
);
}
...
...
@@ -1363,27 +1379,35 @@ static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory5
return
hr
;
}
static
HRESULT
factory_create_glyphrun_analysis
(
const
DWRITE_GLYPH_RUN
*
run
,
const
DWRITE_MATRIX
*
transform
,
DWRITE_RENDERING_MODE1
rendering_mode
,
DWRITE_MEASURING_MODE
measuring_mode
,
DWRITE_GRID_FIT_MODE
gridfit_mode
,
DWRITE_TEXT_ANTIALIAS_MODE
aa_mode
,
FLOAT
originX
,
FLOAT
originY
,
IDWriteGlyphRunAnalysis
**
analysis
)
{
struct
glyphrunanalysis_desc
desc
;
desc
.
run
=
run
;
desc
.
transform
=
transform
;
desc
.
rendering_mode
=
rendering_mode
;
desc
.
measuring_mode
=
measuring_mode
;
desc
.
gridfit_mode
=
gridfit_mode
;
desc
.
aa_mode
=
aa_mode
;
desc
.
origin
.
x
=
originX
;
desc
.
origin
.
y
=
originY
;
return
create_glyphrunanalysis
(
&
desc
,
analysis
);
}
static
HRESULT
WINAPI
dwritefactory2_CreateGlyphRunAnalysis
(
IDWriteFactory5
*
iface
,
const
DWRITE_GLYPH_RUN
*
run
,
const
DWRITE_MATRIX
*
transform
,
DWRITE_RENDERING_MODE
rendering_mode
,
DWRITE_MEASURING_MODE
measuring_mode
,
DWRITE_GRID_FIT_MODE
gridfit_mode
,
DWRITE_TEXT_ANTIALIAS_MODE
aa_mode
,
FLOAT
originX
,
FLOAT
originY
,
IDWriteGlyphRunAnalysis
**
analysis
)
{
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory5
(
iface
);
struct
glyphrunanalysis_desc
desc
;
TRACE
(
"(%p)->(%p %p %d %d %d %d %.2f %.2f %p)
\n
"
,
This
,
run
,
transform
,
rendering_mode
,
measuring_mode
,
gridfit_mode
,
aa_mode
,
originX
,
originY
,
analysis
);
desc
.
run
=
run
;
desc
.
ppdip
=
1
.
0
f
;
desc
.
transform
=
transform
;
desc
.
rendering_mode
=
(
DWRITE_RENDERING_MODE1
)
rendering_mode
;
desc
.
measuring_mode
=
measuring_mode
;
desc
.
gridfit_mode
=
gridfit_mode
;
desc
.
aa_mode
=
aa_mode
;
desc
.
origin_x
=
originX
;
desc
.
origin_y
=
originY
;
return
create_glyphrunanalysis
(
&
desc
,
analysis
);
return
factory_create_glyphrun_analysis
(
run
,
transform
,
(
DWRITE_RENDERING_MODE1
)
rendering_mode
,
measuring_mode
,
gridfit_mode
,
aa_mode
,
originX
,
originY
,
analysis
);
}
static
HRESULT
WINAPI
dwritefactory3_CreateGlyphRunAnalysis
(
IDWriteFactory5
*
iface
,
DWRITE_GLYPH_RUN
const
*
run
,
...
...
@@ -1392,21 +1416,12 @@ static HRESULT WINAPI dwritefactory3_CreateGlyphRunAnalysis(IDWriteFactory5 *ifa
IDWriteGlyphRunAnalysis
**
analysis
)
{
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory5
(
iface
);
struct
glyphrunanalysis_desc
desc
;
TRACE
(
"(%p)->(%p %p %d %d %d %d %.2f %.2f %p)
\n
"
,
This
,
run
,
transform
,
rendering_mode
,
measuring_mode
,
gridfit_mode
,
aa_mode
,
originX
,
originY
,
analysis
);
desc
.
run
=
run
;
desc
.
ppdip
=
1
.
0
f
;
desc
.
transform
=
transform
;
desc
.
rendering_mode
=
rendering_mode
;
desc
.
measuring_mode
=
measuring_mode
;
desc
.
gridfit_mode
=
gridfit_mode
;
desc
.
aa_mode
=
aa_mode
;
desc
.
origin_x
=
originX
;
desc
.
origin_y
=
originY
;
return
create_glyphrunanalysis
(
&
desc
,
analysis
);
return
factory_create_glyphrun_analysis
(
run
,
transform
,
rendering_mode
,
measuring_mode
,
gridfit_mode
,
aa_mode
,
originX
,
originY
,
analysis
);
}
static
HRESULT
WINAPI
dwritefactory3_CreateCustomRenderingParams
(
IDWriteFactory5
*
iface
,
FLOAT
gamma
,
FLOAT
contrast
,
...
...
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