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
2fdee67d
Commit
2fdee67d
authored
Oct 19, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Scale glyph run analysis advances and offsets with ppdip factor.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6262cc32
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
16 deletions
+43
-16
font.c
dlls/dwrite/font.c
+21
-7
font.c
dlls/dwrite/tests/font.c
+22
-9
No files found.
dlls/dwrite/font.c
View file @
2fdee67d
...
...
@@ -4381,6 +4381,7 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEA
FLOAT
ppdip
,
DWRITE_GRID_FIT_MODE
gridfit_mode
,
DWRITE_TEXT_ANTIALIAS_MODE
aa_mode
,
FLOAT
originX
,
FLOAT
originY
,
IDWriteGlyphRunAnalysis
**
ret
)
{
struct
dwrite_glyphrunanalysis
*
analysis
;
UINT32
i
;
*
ret
=
NULL
;
...
...
@@ -4425,12 +4426,17 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEA
memcpy
(
analysis
->
glyphs
,
run
->
glyphIndices
,
run
->
glyphCount
*
sizeof
(
*
run
->
glyphIndices
));
if
(
run
->
glyphAdvances
)
memcpy
(
analysis
->
advances
,
run
->
glyphAdvances
,
run
->
glyphCount
*
sizeof
(
*
run
->
glyphAdvances
));
if
(
run
->
glyphAdvances
)
{
if
(
ppdip
==
1
.
0
f
)
memcpy
(
analysis
->
advances
,
run
->
glyphAdvances
,
run
->
glyphCount
*
sizeof
(
*
run
->
glyphAdvances
));
else
{
for
(
i
=
0
;
i
<
run
->
glyphCount
;
i
++
)
analysis
->
advances
[
i
]
=
run
->
glyphAdvances
[
i
]
*
ppdip
;
}
}
else
{
DWRITE_FONT_METRICS
metrics
;
IDWriteFontFace1
*
fontface1
;
UINT32
i
;
IDWriteFontFace_GetMetrics
(
run
->
fontFace
,
&
metrics
);
IDWriteFontFace_QueryInterface
(
run
->
fontFace
,
&
IID_IDWriteFontFace1
,
(
void
**
)
&
fontface1
);
...
...
@@ -4445,7 +4451,7 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEA
hr
=
IDWriteFontFace1_GetDesignGlyphAdvances
(
fontface1
,
1
,
run
->
glyphIndices
+
i
,
&
a
,
run
->
isSideways
);
if
(
FAILED
(
hr
))
a
=
0
;
analysis
->
advances
[
i
]
=
get_scaled_advance_width
(
a
,
run
->
fontEmSize
,
&
metrics
);
analysis
->
advances
[
i
]
=
get_scaled_advance_width
(
a
,
run
->
fontEmSize
,
&
metrics
)
*
ppdip
;
break
;
case
DWRITE_MEASURING_MODE_GDI_CLASSIC
:
case
DWRITE_MEASURING_MODE_GDI_NATURAL
:
...
...
@@ -4454,7 +4460,7 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEA
if
(
FAILED
(
hr
))
analysis
->
advances
[
i
]
=
0
.
0
;
else
analysis
->
advances
[
i
]
=
floorf
(
a
*
run
->
fontEmSize
*
ppdip
/
metrics
.
designUnitsPerEm
+
0
.
5
f
)
/
ppdip
;
analysis
->
advances
[
i
]
=
floorf
(
a
*
run
->
fontEmSize
*
ppdip
/
metrics
.
designUnitsPerEm
+
0
.
5
f
);
break
;
default:
;
...
...
@@ -4464,8 +4470,16 @@ HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEA
IDWriteFontFace1_Release
(
fontface1
);
}
if
(
run
->
glyphOffsets
)
memcpy
(
analysis
->
offsets
,
run
->
glyphOffsets
,
run
->
glyphCount
*
sizeof
(
*
run
->
glyphOffsets
));
if
(
run
->
glyphOffsets
)
{
if
(
ppdip
==
1
.
0
f
)
memcpy
(
analysis
->
offsets
,
run
->
glyphOffsets
,
run
->
glyphCount
*
sizeof
(
*
run
->
glyphOffsets
));
else
{
for
(
i
=
0
;
i
<
run
->
glyphCount
;
i
++
)
{
analysis
->
offsets
[
i
].
advanceOffset
=
run
->
glyphOffsets
[
i
].
advanceOffset
*
ppdip
;
analysis
->
offsets
[
i
].
ascenderOffset
=
run
->
glyphOffsets
[
i
].
ascenderOffset
*
ppdip
;
}
}
}
*
ret
=
&
analysis
->
IDWriteGlyphRunAnalysis_iface
;
return
S_OK
;
...
...
dlls/dwrite/tests/font.c
View file @
2fdee67d
...
...
@@ -3497,11 +3497,11 @@ static void test_CreateGlyphRunAnalysis(void)
DWRITE_GLYPH_RUN
run
;
IDWriteFontFace
*
face
;
UINT16
glyph
,
glyphs
[
10
];
FLOAT
advance
;
FLOAT
advance
s
[
2
]
;
HRESULT
hr
;
UINT32
ch
;
RECT
rect
,
rect2
;
DWRITE_GLYPH_OFFSET
offset
;
DWRITE_GLYPH_OFFSET
offset
s
[
2
]
;
DWRITE_GLYPH_METRICS
metrics
;
DWRITE_FONT_METRICS
fm
;
int
i
;
...
...
@@ -3517,17 +3517,17 @@ static void test_CreateGlyphRunAnalysis(void)
hr
=
IDWriteFontFace_GetDesignGlyphMetrics
(
face
,
&
glyph
,
1
,
&
metrics
,
FALSE
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
advance
=
metrics
.
advanceWidth
;
advance
s
[
0
]
=
metrics
.
advanceWidth
;
offset
.
advanceOffset
=
0
.
0
;
offset
.
ascenderOffset
=
0
.
0
;
offset
s
[
0
]
.
advanceOffset
=
0
.
0
;
offset
s
[
0
]
.
ascenderOffset
=
0
.
0
;
run
.
fontFace
=
face
;
run
.
fontEmSize
=
24
.
0
;
run
.
glyphCount
=
1
;
run
.
glyphIndices
=
&
glyph
;
run
.
glyphAdvances
=
&
advance
;
run
.
glyphOffsets
=
&
offset
;
run
.
glyphAdvances
=
advances
;
run
.
glyphOffsets
=
offsets
;
run
.
isSideways
=
FALSE
;
run
.
bidiLevel
=
0
;
...
...
@@ -3680,7 +3680,7 @@ static void test_CreateGlyphRunAnalysis(void)
run
.
fontEmSize
=
24
.
0
;
run
.
glyphCount
=
1
;
run
.
glyphIndices
=
&
glyph
;
run
.
glyphAdvances
=
&
advance
;
run
.
glyphAdvances
=
advances
;
run
.
glyphOffsets
=
NULL
;
run
.
isSideways
=
FALSE
;
run
.
bidiLevel
=
0
;
...
...
@@ -3719,12 +3719,14 @@ static void test_CreateGlyphRunAnalysis(void)
IDWriteGlyphRunAnalysis_Release
(
analysis
);
/* test that advances are scaled according to ppdip too */
glyphs
[
0
]
=
glyphs
[
1
]
=
glyph
;
advances
[
0
]
=
advances
[
1
]
=
100
.
0
f
;
run
.
fontFace
=
face
;
run
.
fontEmSize
=
24
.
0
;
run
.
glyphCount
=
2
;
run
.
glyphIndices
=
glyphs
;
run
.
glyphAdvances
=
NULL
;
run
.
glyphAdvances
=
advances
;
run
.
glyphOffsets
=
NULL
;
run
.
isSideways
=
FALSE
;
run
.
bidiLevel
=
0
;
...
...
@@ -3739,7 +3741,18 @@ static void test_CreateGlyphRunAnalysis(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
IsRectEmpty
(
&
rect2
),
"got empty bounds
\n
"
);
ok
(
!
EqualRect
(
&
rect
,
&
rect2
),
"got wrong rect2
\n
"
);
ok
((
rect2
.
right
-
rect
.
left
)
>
advances
[
0
],
"got rect width %d for advance %f
\n
"
,
rect
.
right
-
rect
.
left
,
advances
[
0
]);
IDWriteGlyphRunAnalysis_Release
(
analysis
);
hr
=
IDWriteFactory_CreateGlyphRunAnalysis
(
factory
,
&
run
,
2
.
0
,
NULL
,
DWRITE_RENDERING_MODE_ALIASED
,
DWRITE_MEASURING_MODE_NATURAL
,
0
.
0
,
0
.
0
,
&
analysis
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
SetRectEmpty
(
&
rect
);
hr
=
IDWriteGlyphRunAnalysis_GetAlphaTextureBounds
(
analysis
,
DWRITE_TEXTURE_ALIASED_1x1
,
&
rect
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
((
rect
.
right
-
rect
.
left
)
>
2
*
advances
[
0
],
"got rect width %d for advance %f
\n
"
,
rect
.
right
-
rect
.
left
,
advances
[
0
]);
IDWriteGlyphRunAnalysis_Release
(
analysis
);
IDWriteFontFace_Release
(
face
);
...
...
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