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
a254741b
Commit
a254741b
authored
Aug 12, 2014
by
Aric Stewart
Committed by
Alexandre Julliard
Aug 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement Font File Loader registration.
parent
82ce3fdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
4 deletions
+110
-4
main.c
dlls/dwrite/main.c
+51
-4
font.c
dlls/dwrite/tests/font.c
+59
-0
No files found.
dlls/dwrite/main.c
View file @
a254741b
...
...
@@ -365,6 +365,8 @@ struct dwritefactory{
IDWriteFontCollectionLoader
**
loaders
;
LONG
loader_count
;
IDWriteFontFileLoader
**
file_loaders
;
LONG
file_loader_count
;
};
static
inline
struct
dwritefactory
*
impl_from_IDWriteFactory
(
IDWriteFactory
*
iface
)
...
...
@@ -412,6 +414,10 @@ static ULONG WINAPI dwritefactory_Release(IDWriteFactory *iface)
if
(
This
->
loaders
[
i
])
IDWriteFontCollectionLoader_Release
(
This
->
loaders
[
i
]);
heap_free
(
This
->
loaders
);
for
(
i
=
0
;
i
<
This
->
file_loader_count
;
i
++
)
if
(
This
->
file_loaders
[
i
])
IDWriteFontFileLoader_Release
(
This
->
file_loaders
[
i
]);
heap_free
(
This
->
file_loaders
);
heap_free
(
This
);
}
...
...
@@ -554,16 +560,55 @@ static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory *
static
HRESULT
WINAPI
dwritefactory_RegisterFontFileLoader
(
IDWriteFactory
*
iface
,
IDWriteFontFileLoader
*
loader
)
{
int
i
;
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
loader
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
loader
);
if
(
!
loader
)
return
E_INVALIDARG
;
for
(
i
=
0
;
i
<
This
->
file_loader_count
;
i
++
)
if
(
This
->
file_loaders
[
i
]
==
loader
)
return
DWRITE_E_ALREADYREGISTERED
;
else
if
(
This
->
file_loaders
[
i
]
==
NULL
)
break
;
if
(
i
==
This
->
file_loader_count
)
{
IDWriteFontFileLoader
**
new_list
=
NULL
;
int
new_count
=
0
;
new_count
=
This
->
file_loader_count
*
2
;
new_list
=
heap_realloc
(
This
->
file_loaders
,
new_count
*
sizeof
(
*
This
->
file_loaders
));
if
(
!
new_list
)
return
E_OUTOFMEMORY
;
else
{
This
->
file_loader_count
=
new_count
;
This
->
file_loaders
=
new_list
;
}
}
IDWriteFontFileLoader_AddRef
(
loader
);
This
->
file_loaders
[
i
]
=
loader
;
return
S_OK
;
}
static
HRESULT
WINAPI
dwritefactory_UnregisterFontFileLoader
(
IDWriteFactory
*
iface
,
IDWriteFontFileLoader
*
loader
)
{
int
i
;
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
loader
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
loader
);
for
(
i
=
0
;
i
<
This
->
file_loader_count
;
i
++
)
if
(
This
->
file_loaders
[
i
]
==
loader
)
break
;
if
(
i
==
This
->
file_loader_count
)
return
E_INVALIDARG
;
IDWriteFontFileLoader_Release
(
This
->
file_loaders
[
i
]);
This
->
file_loaders
[
i
]
=
NULL
;
return
S_OK
;
}
static
HRESULT
WINAPI
dwritefactory_CreateTextFormat
(
IDWriteFactory
*
iface
,
WCHAR
const
*
family_name
,
...
...
@@ -687,6 +732,8 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno
This
->
ref
=
1
;
This
->
loader_count
=
2
;
This
->
loaders
=
heap_alloc_zero
(
sizeof
(
*
This
->
loaders
)
*
2
);
This
->
file_loader_count
=
2
;
This
->
file_loaders
=
heap_alloc_zero
(
sizeof
(
*
This
->
file_loaders
)
*
2
);
*
factory
=
(
IUnknown
*
)
&
This
->
IDWriteFactory_iface
;
...
...
dlls/dwrite/tests/font.c
View file @
a254741b
...
...
@@ -722,6 +722,64 @@ static void test_CustomFontCollection(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
}
static
HRESULT
WINAPI
fontfileloader_QueryInterface
(
IDWriteFontFileLoader
*
iface
,
REFIID
riid
,
void
**
obj
)
{
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDWriteFontFileLoader
))
{
*
obj
=
iface
;
IDWriteFontFileLoader_AddRef
(
iface
);
return
S_OK
;
}
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
fontfileloader_AddRef
(
IDWriteFontFileLoader
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
fontfileloader_Release
(
IDWriteFontFileLoader
*
iface
)
{
return
1
;
}
static
HRESULT
WINAPI
fontfileloader_CreateStreamFromKey
(
IDWriteFontFileLoader
*
iface
,
const
void
*
fontFileReferenceKey
,
UINT32
fontFileReferenceKeySize
,
IDWriteFontFileStream
**
fontFileStream
)
{
return
0x8faecafe
;
}
static
const
struct
IDWriteFontFileLoaderVtbl
dwritefontfileloadervtbl
=
{
fontfileloader_QueryInterface
,
fontfileloader_AddRef
,
fontfileloader_Release
,
fontfileloader_CreateStreamFromKey
};
static
void
test_FontLoader
(
void
)
{
IDWriteFontFileLoader
floader
=
{
&
dwritefontfileloadervtbl
};
IDWriteFontFileLoader
floader2
=
{
&
dwritefontfileloadervtbl
};
HRESULT
hr
;
hr
=
IDWriteFactory_RegisterFontFileLoader
(
factory
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_RegisterFontFileLoader
(
factory
,
&
floader
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_RegisterFontFileLoader
(
factory
,
&
floader2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_RegisterFontFileLoader
(
factory
,
&
floader
);
ok
(
hr
==
DWRITE_E_ALREADYREGISTERED
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_UnregisterFontFileLoader
(
factory
,
&
floader
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_UnregisterFontFileLoader
(
factory
,
&
floader
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_UnregisterFontFileLoader
(
factory
,
&
floader2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
}
START_TEST
(
font
)
{
HRESULT
hr
;
...
...
@@ -743,6 +801,7 @@ START_TEST(font)
test_system_fontcollection
();
test_ConvertFontFaceToLOGFONT
();
test_CustomFontCollection
();
test_FontLoader
();
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