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
eecb7572
Commit
eecb7572
authored
May 27, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 29, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Convert from twips to points when tomUsePoints is used.
parent
a921941a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
richole.c
dlls/riched20/richole.c
+8
-3
richole.c
dlls/riched20/tests/richole.c
+38
-0
No files found.
dlls/riched20/richole.c
View file @
eecb7572
...
...
@@ -416,6 +416,11 @@ static inline void init_textfont_prop_value(enum textfont_prop_id propid, textfo
}
}
static
inline
FLOAT
twips_to_points
(
LONG
value
)
{
return
value
*
72
.
0
/
1440
;
}
static
HRESULT
get_textfont_prop_for_pos
(
const
IRichEditOleImpl
*
reole
,
int
pos
,
enum
textfont_prop_id
propid
,
textfont_prop_val
*
value
)
{
...
...
@@ -459,7 +464,7 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
value
->
l
=
fmt
.
dwEffects
&
CFE_AUTOCOLOR
?
GetSysColor
(
COLOR_WINDOWTEXT
)
:
fmt
.
crTextColor
;
break
;
case
FONT_KERNING
:
value
->
f
=
fmt
.
wKerning
;
value
->
f
=
twips_to_points
(
fmt
.
wKerning
)
;
break
;
case
FONT_LANGID
:
value
->
l
=
fmt
.
lcid
;
...
...
@@ -471,10 +476,10 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
return
E_OUTOFMEMORY
;
break
;
case
FONT_POSITION
:
value
->
f
=
fmt
.
yOffset
;
value
->
f
=
twips_to_points
(
fmt
.
yOffset
)
;
break
;
case
FONT_SIZE
:
value
->
f
=
fmt
.
yHeight
;
value
->
f
=
twips_to_points
(
fmt
.
yHeight
)
;
break
;
case
FONT_SPACING
:
value
->
f
=
fmt
.
sSpacing
;
...
...
dlls/riched20/tests/richole.c
View file @
eecb7572
...
...
@@ -2111,11 +2111,17 @@ static void test_textfont_undefined(ITextFont *font)
ok
(
value
==
tomUndefined
,
"got %d
\n
"
,
value
);
}
static
inline
FLOAT
twips_to_points
(
LONG
value
)
{
return
value
*
72
.
0
/
1440
;
}
static
void
test_ITextFont
(
void
)
{
static
const
WCHAR
arialW
[]
=
{
'A'
,
'r'
,
'i'
,
'a'
,
'l'
,
0
};
static
const
CHAR
test_text1
[]
=
"TestSomeText"
;
ITextFont
*
font
,
*
font2
,
*
font3
;
FLOAT
size
,
position
,
kerning
;
IRichEditOle
*
reOle
=
NULL
;
ITextDocument
*
doc
=
NULL
;
ITextRange
*
range
=
NULL
;
...
...
@@ -2138,6 +2144,38 @@ static void test_ITextFont(void)
hr
=
ITextFont_GetName
(
font
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
/* default font size unit is point */
size
=
0
.
0
;
hr
=
ITextFont_GetSize
(
font
,
&
size
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* set to some non-zero values */
hr
=
ITextFont_SetPosition
(
font
,
20
.
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextFont_SetKerning
(
font
,
10
.
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
position
=
0
.
0
;
hr
=
ITextFont_GetPosition
(
font
,
&
position
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
kerning
=
0
.
0
;
hr
=
ITextFont_GetKerning
(
font
,
&
kerning
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
memset
(
&
cf
,
0
,
sizeof
(
cf
));
cf
.
cbSize
=
sizeof
(
cf
);
cf
.
dwMask
=
CFM_SIZE
|
CFM_OFFSET
|
CFM_KERNING
;
/* CHARFORMAT members are in twips */
SendMessageA
(
hwnd
,
EM_SETSEL
,
0
,
10
);
ret
=
SendMessageA
(
hwnd
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
ok
(
size
==
twips_to_points
(
cf
.
yHeight
),
"got yHeight %d, size %.2f
\n
"
,
cf
.
yHeight
,
size
);
ok
(
position
==
twips_to_points
(
cf
.
yOffset
),
"got yOffset %d, position %.2f
\n
"
,
cf
.
yOffset
,
position
);
ok
(
kerning
==
twips_to_points
(
cf
.
wKerning
),
"got wKerning %d, kerning %.2f
\n
"
,
cf
.
wKerning
,
kerning
);
/* default font name */
str
=
NULL
;
hr
=
ITextFont_GetName
(
font
,
&
str
);
...
...
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