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
45a9560e
Commit
45a9560e
authored
Oct 07, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added IDWriteLocalizedStrings stub.
parent
89561b92
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
1 deletion
+171
-1
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+2
-1
main.c
dlls/dwrite/main.c
+121
-0
font.c
dlls/dwrite/tests/font.c
+47
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
45a9560e
...
...
@@ -46,3 +46,4 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
extern
HRESULT
create_font_from_logfont
(
const
LOGFONTW
*
,
IDWriteFont
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_textlayout
(
IDWriteTextLayout
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_gdiinterop
(
IDWriteGdiInterop
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
dlls/dwrite/font.c
View file @
45a9560e
...
...
@@ -256,8 +256,9 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily *iface, UINT32
static
HRESULT
WINAPI
dwritefontfamily_GetFamilyNames
(
IDWriteFontFamily
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
names
);
return
E_NOTIMPL
;
return
create_localizedstrings
(
names
)
;
}
static
HRESULT
WINAPI
dwritefontfamily_GetFirstMatchingFont
(
IDWriteFontFamily
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
...
...
dlls/dwrite/main.c
View file @
45a9560e
...
...
@@ -172,6 +172,127 @@ static HRESULT create_renderingparams(FLOAT gamma, FLOAT enhancedContrast, FLOAT
return
S_OK
;
}
struct
localizedstrings
{
IDWriteLocalizedStrings
IDWriteLocalizedStrings_iface
;
LONG
ref
;
};
static
inline
struct
localizedstrings
*
impl_from_IDWriteLocalizedStrings
(
IDWriteLocalizedStrings
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
localizedstrings
,
IDWriteLocalizedStrings_iface
);
}
static
HRESULT
WINAPI
localizedstrings_QueryInterface
(
IDWriteLocalizedStrings
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDWriteLocalizedStrings
))
{
*
obj
=
iface
;
IDWriteLocalizedStrings_AddRef
(
iface
);
return
S_OK
;
}
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
localizedstrings_AddRef
(
IDWriteLocalizedStrings
*
iface
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
localizedstrings_Release
(
IDWriteLocalizedStrings
*
iface
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
if
(
!
ref
)
heap_free
(
This
);
return
S_OK
;
}
static
UINT32
WINAPI
localizedstrings_GetCount
(
IDWriteLocalizedStrings
*
iface
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
0
;
}
static
HRESULT
WINAPI
localizedstrings_FindLocaleName
(
IDWriteLocalizedStrings
*
iface
,
WCHAR
const
*
locale_name
,
UINT32
*
index
,
BOOL
*
exists
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
FIXME
(
"(%p)->(%s %p %p): stub
\n
"
,
This
,
debugstr_w
(
locale_name
),
index
,
exists
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
localizedstrings_GetLocaleNameLength
(
IDWriteLocalizedStrings
*
iface
,
UINT32
index
,
UINT32
*
length
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
FIXME
(
"(%p)->(%u %p): stub
\n
"
,
This
,
index
,
length
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
localizedstrings_GetLocaleName
(
IDWriteLocalizedStrings
*
iface
,
UINT32
index
,
WCHAR
*
locale_name
,
UINT32
size
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
FIXME
(
"(%p)->(%u %p %u): stub
\n
"
,
This
,
index
,
locale_name
,
size
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
localizedstrings_GetStringLength
(
IDWriteLocalizedStrings
*
iface
,
UINT32
index
,
UINT32
*
length
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
FIXME
(
"(%p)->(%u %p): stub
\n
"
,
This
,
index
,
length
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
localizedstrings_GetString
(
IDWriteLocalizedStrings
*
iface
,
UINT32
index
,
WCHAR
*
buffer
,
UINT32
size
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
FIXME
(
"(%p)->(%u %p %u): stub
\n
"
,
This
,
index
,
buffer
,
size
);
return
E_NOTIMPL
;
}
static
const
IDWriteLocalizedStringsVtbl
localizedstringsvtbl
=
{
localizedstrings_QueryInterface
,
localizedstrings_AddRef
,
localizedstrings_Release
,
localizedstrings_GetCount
,
localizedstrings_FindLocaleName
,
localizedstrings_GetLocaleNameLength
,
localizedstrings_GetLocaleName
,
localizedstrings_GetStringLength
,
localizedstrings_GetString
};
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
strings
)
{
struct
localizedstrings
*
This
;
*
strings
=
NULL
;
This
=
heap_alloc
(
sizeof
(
struct
localizedstrings
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IDWriteLocalizedStrings_iface
.
lpVtbl
=
&
localizedstringsvtbl
;
This
->
ref
=
1
;
*
strings
=
&
This
->
IDWriteLocalizedStrings_iface
;
return
S_OK
;
}
static
HRESULT
WINAPI
dwritefactory_QueryInterface
(
IDWriteFactory
*
iface
,
REFIID
riid
,
void
**
obj
)
{
TRACE
(
"(%s %p)
\n
"
,
debugstr_guid
(
riid
),
obj
);
...
...
dlls/dwrite/tests/font.c
View file @
45a9560e
...
...
@@ -312,6 +312,52 @@ if (0) /* crashes on native */
IDWriteGdiInterop_Release
(
interop
);
}
static
void
test_GetFamilyNames
(
void
)
{
static
const
WCHAR
arialW
[]
=
{
'A'
,
'r'
,
'i'
,
'a'
,
'l'
,
0
};
IDWriteFontFamily
*
family
;
IDWriteLocalizedStrings
*
names
,
*
names2
;
IDWriteGdiInterop
*
interop
;
IDWriteFont
*
font
;
LOGFONTW
logfont
;
HRESULT
hr
;
hr
=
IDWriteFactory_GetGdiInterop
(
factory
,
&
interop
);
EXPECT_HR
(
hr
,
S_OK
);
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
1
;
lstrcpyW
(
logfont
.
lfFaceName
,
arialW
);
hr
=
IDWriteGdiInterop_CreateFontFromLOGFONT
(
interop
,
&
logfont
,
&
font
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IDWriteFont_GetFontFamily
(
font
,
&
family
);
EXPECT_HR
(
hr
,
S_OK
);
if
(
0
)
/* crashes on native */
hr
=
IDWriteFontFamily_GetFamilyNames
(
family
,
NULL
);
hr
=
IDWriteFontFamily_GetFamilyNames
(
family
,
&
names
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
EXPECT_REF
(
names
,
1
);
hr
=
IDWriteFontFamily_GetFamilyNames
(
family
,
&
names2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
EXPECT_REF
(
names2
,
1
);
ok
(
names
!=
names2
,
"got %p, was %p
\n
"
,
names2
,
names
);
IDWriteLocalizedStrings_Release
(
names
);
IDWriteLocalizedStrings_Release
(
names2
);
IDWriteFontFamily_Release
(
family
);
IDWriteFont_Release
(
font
);
IDWriteGdiInterop_Release
(
interop
);
}
START_TEST
(
font
)
{
HRESULT
hr
;
...
...
@@ -327,6 +373,7 @@ START_TEST(font)
test_CreateFontFromLOGFONT
();
test_CreateBitmapRenderTarget
();
test_GetFontFamily
();
test_GetFamilyNames
();
IDWriteFactory_Release
(
factory
);
}
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