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
c67f930a
Commit
c67f930a
authored
Sep 19, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added IDWriteTypography implementation.
parent
8aa11375
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
176 additions
and
2 deletions
+176
-2
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
layout.c
dlls/dwrite/layout.c
+127
-0
main.c
dlls/dwrite/main.c
+2
-2
layout.c
dlls/dwrite/tests/layout.c
+46
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
c67f930a
...
@@ -88,6 +88,7 @@ extern HRESULT create_textformat(const WCHAR*,IDWriteFontCollection*,DWRITE_FONT
...
@@ -88,6 +88,7 @@ extern HRESULT create_textformat(const WCHAR*,IDWriteFontCollection*,DWRITE_FONT
FLOAT
,
const
WCHAR
*
,
IDWriteTextFormat
**
)
DECLSPEC_HIDDEN
;
FLOAT
,
const
WCHAR
*
,
IDWriteTextFormat
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_textlayout
(
const
WCHAR
*
,
UINT32
,
IDWriteTextFormat
*
,
FLOAT
,
FLOAT
,
IDWriteTextLayout
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_textlayout
(
const
WCHAR
*
,
UINT32
,
IDWriteTextFormat
*
,
FLOAT
,
FLOAT
,
IDWriteTextLayout
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_trimmingsign
(
IDWriteInlineObject
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_trimmingsign
(
IDWriteInlineObject
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_typography
(
IDWriteTypography
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_gdiinterop
(
IDWriteGdiInterop
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_gdiinterop
(
IDWriteGdiInterop
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
add_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
add_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/layout.c
View file @
c67f930a
...
@@ -122,6 +122,15 @@ struct dwrite_trimmingsign {
...
@@ -122,6 +122,15 @@ struct dwrite_trimmingsign {
LONG
ref
;
LONG
ref
;
};
};
struct
dwrite_typography
{
IDWriteTypography
IDWriteTypography_iface
;
LONG
ref
;
DWRITE_FONT_FEATURE
*
features
;
UINT32
allocated
;
UINT32
count
;
};
static
const
IDWriteTextFormatVtbl
dwritetextformatvtbl
;
static
const
IDWriteTextFormatVtbl
dwritetextformatvtbl
;
static
void
release_format_data
(
struct
dwrite_textformat_data
*
data
)
static
void
release_format_data
(
struct
dwrite_textformat_data
*
data
)
...
@@ -152,6 +161,11 @@ static inline struct dwrite_trimmingsign *impl_from_IDWriteInlineObject(IDWriteI
...
@@ -152,6 +161,11 @@ static inline struct dwrite_trimmingsign *impl_from_IDWriteInlineObject(IDWriteI
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_trimmingsign
,
IDWriteInlineObject_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_trimmingsign
,
IDWriteInlineObject_iface
);
}
}
static
inline
struct
dwrite_typography
*
impl_from_IDWriteTypography
(
IDWriteTypography
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_typography
,
IDWriteTypography_iface
);
}
/* To be used in IDWriteTextLayout methods to validate and fix passed range */
/* To be used in IDWriteTextLayout methods to validate and fix passed range */
static
inline
BOOL
validate_text_range
(
struct
dwrite_textlayout
*
layout
,
DWRITE_TEXT_RANGE
*
r
)
static
inline
BOOL
validate_text_range
(
struct
dwrite_textlayout
*
layout
,
DWRITE_TEXT_RANGE
*
r
)
{
{
...
@@ -1787,3 +1801,116 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
...
@@ -1787,3 +1801,116 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
dwritetypography_QueryInterface
(
IDWriteTypography
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
typography
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteTypography
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
IDWriteTypography_AddRef
(
iface
);
return
S_OK
;
}
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
dwritetypography_AddRef
(
IDWriteTypography
*
iface
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
typography
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
typography
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
dwritetypography_Release
(
IDWriteTypography
*
iface
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
typography
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
typography
,
ref
);
if
(
!
ref
)
{
heap_free
(
typography
->
features
);
heap_free
(
typography
);
}
return
ref
;
}
static
HRESULT
WINAPI
dwritetypography_AddFontFeature
(
IDWriteTypography
*
iface
,
DWRITE_FONT_FEATURE
feature
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)->(%x %u)
\n
"
,
typography
,
feature
.
nameTag
,
feature
.
parameter
);
if
(
typography
->
count
==
typography
->
allocated
)
{
DWRITE_FONT_FEATURE
*
ptr
=
heap_realloc
(
typography
->
features
,
2
*
typography
->
allocated
*
sizeof
(
DWRITE_FONT_FEATURE
));
if
(
!
ptr
)
return
E_OUTOFMEMORY
;
typography
->
features
=
ptr
;
typography
->
allocated
*=
2
;
}
typography
->
features
[
typography
->
count
++
]
=
feature
;
return
S_OK
;
}
static
UINT32
WINAPI
dwritetypography_GetFontFeatureCount
(
IDWriteTypography
*
iface
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)
\n
"
,
typography
);
return
typography
->
count
;
}
static
HRESULT
WINAPI
dwritetypography_GetFontFeature
(
IDWriteTypography
*
iface
,
UINT32
index
,
DWRITE_FONT_FEATURE
*
feature
)
{
struct
dwrite_typography
*
typography
=
impl_from_IDWriteTypography
(
iface
);
TRACE
(
"(%p)->(%u %p)
\n
"
,
typography
,
index
,
feature
);
if
(
index
>=
typography
->
count
)
return
E_INVALIDARG
;
*
feature
=
typography
->
features
[
index
];
return
S_OK
;
}
static
const
IDWriteTypographyVtbl
dwritetypographyvtbl
=
{
dwritetypography_QueryInterface
,
dwritetypography_AddRef
,
dwritetypography_Release
,
dwritetypography_AddFontFeature
,
dwritetypography_GetFontFeatureCount
,
dwritetypography_GetFontFeature
};
HRESULT
create_typography
(
IDWriteTypography
**
ret
)
{
struct
dwrite_typography
*
typography
;
*
ret
=
NULL
;
typography
=
heap_alloc
(
sizeof
(
*
typography
));
if
(
!
typography
)
return
E_OUTOFMEMORY
;
typography
->
IDWriteTypography_iface
.
lpVtbl
=
&
dwritetypographyvtbl
;
typography
->
ref
=
1
;
typography
->
allocated
=
2
;
typography
->
count
=
0
;
typography
->
features
=
heap_alloc
(
typography
->
allocated
*
sizeof
(
DWRITE_FONT_FEATURE
));
if
(
!
typography
->
features
)
{
heap_free
(
typography
);
return
E_OUTOFMEMORY
;
}
*
ret
=
&
typography
->
IDWriteTypography_iface
;
return
S_OK
;
}
dlls/dwrite/main.c
View file @
c67f930a
...
@@ -696,8 +696,8 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHA
...
@@ -696,8 +696,8 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHA
static
HRESULT
WINAPI
dwritefactory_CreateTypography
(
IDWriteFactory
*
iface
,
IDWriteTypography
**
typography
)
static
HRESULT
WINAPI
dwritefactory_CreateTypography
(
IDWriteFactory
*
iface
,
IDWriteTypography
**
typography
)
{
{
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory
(
iface
);
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
typography
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
typography
);
return
E_NOTIMPL
;
return
create_typography
(
typography
)
;
}
}
static
HRESULT
WINAPI
dwritefactory_GetGdiInterop
(
IDWriteFactory
*
iface
,
IDWriteGdiInterop
**
gdi_interop
)
static
HRESULT
WINAPI
dwritefactory_GetGdiInterop
(
IDWriteFactory
*
iface
,
IDWriteGdiInterop
**
gdi_interop
)
...
...
dlls/dwrite/tests/layout.c
View file @
c67f930a
...
@@ -750,6 +750,51 @@ todo_wine
...
@@ -750,6 +750,51 @@ todo_wine
IDWriteTextLayout_Release
(
layout
);
IDWriteTextLayout_Release
(
layout
);
}
}
static
void
test_typography
(
void
)
{
DWRITE_FONT_FEATURE
feature
;
IDWriteTypography
*
typography
;
UINT32
count
;
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTypography
(
factory
,
&
typography
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
feature
.
nameTag
=
DWRITE_FONT_FEATURE_TAG_KERNING
;
feature
.
parameter
=
1
;
hr
=
IDWriteTypography_AddFontFeature
(
typography
,
feature
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
count
=
IDWriteTypography_GetFontFeatureCount
(
typography
);
ok
(
count
==
1
,
"got %u
\n
"
,
count
);
/* duplicated features work just fine */
feature
.
nameTag
=
DWRITE_FONT_FEATURE_TAG_KERNING
;
feature
.
parameter
=
0
;
hr
=
IDWriteTypography_AddFontFeature
(
typography
,
feature
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
count
=
IDWriteTypography_GetFontFeatureCount
(
typography
);
ok
(
count
==
2
,
"got %u
\n
"
,
count
);
memset
(
&
feature
,
0
,
sizeof
(
feature
));
hr
=
IDWriteTypography_GetFontFeature
(
typography
,
0
,
&
feature
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
feature
.
nameTag
==
DWRITE_FONT_FEATURE_TAG_KERNING
,
"got tag %x
\n
"
,
feature
.
nameTag
);
ok
(
feature
.
parameter
==
1
,
"got %u
\n
"
,
feature
.
parameter
);
memset
(
&
feature
,
0
,
sizeof
(
feature
));
hr
=
IDWriteTypography_GetFontFeature
(
typography
,
1
,
&
feature
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
feature
.
nameTag
==
DWRITE_FONT_FEATURE_TAG_KERNING
,
"got tag %x
\n
"
,
feature
.
nameTag
);
ok
(
feature
.
parameter
==
0
,
"got %u
\n
"
,
feature
.
parameter
);
hr
=
IDWriteTypography_GetFontFeature
(
typography
,
2
,
&
feature
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
IDWriteTypography_Release
(
typography
);
}
START_TEST
(
layout
)
START_TEST
(
layout
)
{
{
HRESULT
hr
;
HRESULT
hr
;
...
@@ -773,6 +818,7 @@ START_TEST(layout)
...
@@ -773,6 +818,7 @@ START_TEST(layout)
test_fontweight
();
test_fontweight
();
test_SetInlineObject
();
test_SetInlineObject
();
test_draw_sequence
();
test_draw_sequence
();
test_typography
();
IDWriteFactory_Release
(
factory
);
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