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
f4790714
Commit
f4790714
authored
May 19, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added IDWriteGlyphRunAnalysis stub.
parent
0634f3b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
190 additions
and
2 deletions
+190
-2
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+104
-0
main.c
dlls/dwrite/main.c
+4
-2
font.c
dlls/dwrite/tests/font.c
+81
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
f4790714
...
@@ -117,6 +117,7 @@ extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *refer
...
@@ -117,6 +117,7 @@ extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *refer
extern
HRESULT
create_localfontfileloader
(
IDWriteLocalFontFileLoader
**
iface
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localfontfileloader
(
IDWriteLocalFontFileLoader
**
iface
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontface
(
DWRITE_FONT_FACE_TYPE
,
UINT32
,
IDWriteFontFile
*
const
*
,
UINT32
,
DWRITE_FONT_SIMULATIONS
,
IDWriteFontFace2
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontface
(
DWRITE_FONT_FACE_TYPE
,
UINT32
,
IDWriteFontFile
*
const
*
,
UINT32
,
DWRITE_FONT_SIMULATIONS
,
IDWriteFontFace2
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_font_collection
(
IDWriteFactory2
*
,
IDWriteFontFileEnumerator
*
,
BOOL
,
IDWriteFontCollection
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_font_collection
(
IDWriteFactory2
*
,
IDWriteFontFileEnumerator
*
,
BOOL
,
IDWriteFontCollection
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_glyphrunanalysis
(
DWRITE_RENDERING_MODE
,
IDWriteGlyphRunAnalysis
**
)
DECLSPEC_HIDDEN
;
extern
BOOL
is_system_collection
(
IDWriteFontCollection
*
)
DECLSPEC_HIDDEN
;
extern
BOOL
is_system_collection
(
IDWriteFontCollection
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_local_refkey
(
const
WCHAR
*
,
const
FILETIME
*
,
void
**
,
UINT32
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_local_refkey
(
const
WCHAR
*
,
const
FILETIME
*
,
void
**
,
UINT32
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_filestream_from_file
(
IDWriteFontFile
*
,
IDWriteFontFileStream
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_filestream_from_file
(
IDWriteFontFile
*
,
IDWriteFontFileStream
**
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
f4790714
...
@@ -97,6 +97,11 @@ struct dwrite_fonttable {
...
@@ -97,6 +97,11 @@ struct dwrite_fonttable {
UINT32
size
;
UINT32
size
;
};
};
struct
dwrite_glyphrunanalysis
{
IDWriteGlyphRunAnalysis
IDWriteGlyphRunAnalysis_iface
;
LONG
ref
;
};
#define GLYPH_BLOCK_SHIFT 8
#define GLYPH_BLOCK_SHIFT 8
#define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT)
#define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT)
#define GLYPH_BLOCK_MASK (GLYPH_BLOCK_SIZE - 1)
#define GLYPH_BLOCK_MASK (GLYPH_BLOCK_SIZE - 1)
...
@@ -155,6 +160,11 @@ static inline struct dwrite_fontcollection *impl_from_IDWriteFontCollection(IDWr
...
@@ -155,6 +160,11 @@ static inline struct dwrite_fontcollection *impl_from_IDWriteFontCollection(IDWr
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontcollection
,
IDWriteFontCollection_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontcollection
,
IDWriteFontCollection_iface
);
}
}
static
inline
struct
dwrite_glyphrunanalysis
*
impl_from_IDWriteGlyphRunAnalysis
(
IDWriteGlyphRunAnalysis
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_glyphrunanalysis
,
IDWriteGlyphRunAnalysis_iface
);
}
static
HRESULT
get_cached_glyph_metrics
(
struct
dwrite_fontface
*
fontface
,
UINT16
glyph
,
DWRITE_GLYPH_METRICS
*
metrics
)
static
HRESULT
get_cached_glyph_metrics
(
struct
dwrite_fontface
*
fontface
,
UINT16
glyph
,
DWRITE_GLYPH_METRICS
*
metrics
)
{
{
static
const
DWRITE_GLYPH_METRICS
nil
;
static
const
DWRITE_GLYPH_METRICS
nil
;
...
@@ -2569,3 +2579,97 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke
...
@@ -2569,3 +2579,97 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke
return
S_OK
;
return
S_OK
;
}
}
/* IDWriteGlyphRunAnalysis */
static
HRESULT
WINAPI
glyphrunanalysis_QueryInterface
(
IDWriteGlyphRunAnalysis
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
struct
dwrite_glyphrunanalysis
*
This
=
impl_from_IDWriteGlyphRunAnalysis
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppv
);
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteGlyphRunAnalysis
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
ppv
=
iface
;
IDWriteGlyphRunAnalysis_AddRef
(
iface
);
return
S_OK
;
}
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
glyphrunanalysis_AddRef
(
IDWriteGlyphRunAnalysis
*
iface
)
{
struct
dwrite_glyphrunanalysis
*
This
=
impl_from_IDWriteGlyphRunAnalysis
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
glyphrunanalysis_Release
(
IDWriteGlyphRunAnalysis
*
iface
)
{
struct
dwrite_glyphrunanalysis
*
This
=
impl_from_IDWriteGlyphRunAnalysis
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
heap_free
(
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
glyphrunanalysis_GetAlphaTextureBounds
(
IDWriteGlyphRunAnalysis
*
iface
,
DWRITE_TEXTURE_TYPE
type
,
RECT
*
bounds
)
{
struct
dwrite_glyphrunanalysis
*
This
=
impl_from_IDWriteGlyphRunAnalysis
(
iface
);
FIXME
(
"(%p)->(%d %p): stub
\n
"
,
This
,
type
,
bounds
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
glyphrunanalysis_CreateAlphaTexture
(
IDWriteGlyphRunAnalysis
*
iface
,
DWRITE_TEXTURE_TYPE
type
,
RECT
const
*
bounds
,
BYTE
*
alphaValues
,
UINT32
bufferSize
)
{
struct
dwrite_glyphrunanalysis
*
This
=
impl_from_IDWriteGlyphRunAnalysis
(
iface
);
FIXME
(
"(%p)->(%d %p %p %u): stub
\n
"
,
This
,
type
,
bounds
,
alphaValues
,
bufferSize
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
glyphrunanalysis_GetAlphaBlendParams
(
IDWriteGlyphRunAnalysis
*
iface
,
IDWriteRenderingParams
*
params
,
FLOAT
*
blendGamma
,
FLOAT
*
blendEnhancedContrast
,
FLOAT
*
blendClearTypeLevel
)
{
struct
dwrite_glyphrunanalysis
*
This
=
impl_from_IDWriteGlyphRunAnalysis
(
iface
);
FIXME
(
"(%p)->(%p %p %p %p): stub
\n
"
,
This
,
params
,
blendGamma
,
blendEnhancedContrast
,
blendClearTypeLevel
);
return
E_NOTIMPL
;
}
static
const
struct
IDWriteGlyphRunAnalysisVtbl
glyphrunanalysisvtbl
=
{
glyphrunanalysis_QueryInterface
,
glyphrunanalysis_AddRef
,
glyphrunanalysis_Release
,
glyphrunanalysis_GetAlphaTextureBounds
,
glyphrunanalysis_CreateAlphaTexture
,
glyphrunanalysis_GetAlphaBlendParams
};
HRESULT
create_glyphrunanalysis
(
DWRITE_RENDERING_MODE
rendering_mode
,
IDWriteGlyphRunAnalysis
**
ret
)
{
struct
dwrite_glyphrunanalysis
*
analysis
;
*
ret
=
NULL
;
/* check for valid rendering mode */
if
((
UINT32
)
rendering_mode
>=
DWRITE_RENDERING_MODE_OUTLINE
||
rendering_mode
==
DWRITE_RENDERING_MODE_DEFAULT
)
return
E_INVALIDARG
;
analysis
=
heap_alloc
(
sizeof
(
*
analysis
));
if
(
!
analysis
)
return
E_OUTOFMEMORY
;
analysis
->
IDWriteGlyphRunAnalysis_iface
.
lpVtbl
=
&
glyphrunanalysisvtbl
;
analysis
->
ref
=
1
;
*
ret
=
&
analysis
->
IDWriteGlyphRunAnalysis_iface
;
return
S_OK
;
}
dlls/dwrite/main.c
View file @
f4790714
...
@@ -1075,9 +1075,11 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *ifac
...
@@ -1075,9 +1075,11 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *ifac
DWRITE_MEASURING_MODE
measuring_mode
,
FLOAT
baseline_x
,
FLOAT
baseline_y
,
IDWriteGlyphRunAnalysis
**
analysis
)
DWRITE_MEASURING_MODE
measuring_mode
,
FLOAT
baseline_x
,
FLOAT
baseline_y
,
IDWriteGlyphRunAnalysis
**
analysis
)
{
{
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory2
(
iface
);
struct
dwritefactory
*
This
=
impl_from_IDWriteFactory2
(
iface
);
FIXME
(
"(%p)->(%p %f %p %d %d %f %f %p): stub
\n
"
,
This
,
glyph_run
,
pixels_per_dip
,
transform
,
rendering_mode
,
TRACE
(
"(%p)->(%p %f %p %d %d %f %f %p)
\n
"
,
This
,
glyph_run
,
pixels_per_dip
,
transform
,
rendering_mode
,
measuring_mode
,
baseline_x
,
baseline_y
,
analysis
);
measuring_mode
,
baseline_x
,
baseline_y
,
analysis
);
return
E_NOTIMPL
;
return
create_glyphrunanalysis
(
rendering_mode
,
analysis
);
}
}
static
HRESULT
WINAPI
dwritefactory1_GetEudcFontCollection
(
IDWriteFactory2
*
iface
,
IDWriteFontCollection
**
collection
,
static
HRESULT
WINAPI
dwritefactory1_GetEudcFontCollection
(
IDWriteFactory2
*
iface
,
IDWriteFontCollection
**
collection
,
...
...
dlls/dwrite/tests/font.c
View file @
f4790714
...
@@ -70,6 +70,37 @@ static IDWriteFactory *create_factory(void)
...
@@ -70,6 +70,37 @@ static IDWriteFactory *create_factory(void)
return
factory
;
return
factory
;
}
}
static
IDWriteFontFace
*
create_fontface
(
IDWriteFactory
*
factory
)
{
static
const
WCHAR
tahomaW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
0
};
IDWriteGdiInterop
*
interop
;
IDWriteFontFace
*
fontface
;
IDWriteFont
*
font
;
LOGFONTW
logfont
;
HRESULT
hr
;
hr
=
IDWriteFactory_GetGdiInterop
(
factory
,
&
interop
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
1
;
lstrcpyW
(
logfont
.
lfFaceName
,
tahomaW
);
hr
=
IDWriteGdiInterop_CreateFontFromLOGFONT
(
interop
,
&
logfont
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFont_Release
(
font
);
IDWriteGdiInterop_Release
(
interop
);
return
fontface
;
}
static
WCHAR
*
create_testfontfile
(
const
WCHAR
*
filename
)
static
WCHAR
*
create_testfontfile
(
const
WCHAR
*
filename
)
{
{
static
WCHAR
pathW
[
MAX_PATH
];
static
WCHAR
pathW
[
MAX_PATH
];
...
@@ -3238,6 +3269,55 @@ static void test_CreateRenderingParams(void)
...
@@ -3238,6 +3269,55 @@ static void test_CreateRenderingParams(void)
IDWriteFactory_Release
(
factory
);
IDWriteFactory_Release
(
factory
);
}
}
static
void
test_CreateGlyphRunAnalysis
(
void
)
{
IDWriteGlyphRunAnalysis
*
analysis
;
IDWriteFactory
*
factory
;
DWRITE_GLYPH_RUN
run
;
IDWriteFontFace
*
face
;
UINT16
index
;
FLOAT
advance
;
HRESULT
hr
;
UINT32
ch
;
factory
=
create_factory
();
face
=
create_fontface
(
factory
);
ch
=
'A'
;
hr
=
IDWriteFontFace_GetGlyphIndices
(
face
,
&
ch
,
1
,
&
index
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
run
.
fontFace
=
face
;
run
.
fontEmSize
=
24
.
0
;
run
.
glyphCount
=
1
;
run
.
glyphIndices
=
&
index
;
run
.
glyphAdvances
=
&
advance
;
run
.
glyphOffsets
=
NULL
;
run
.
isSideways
=
FALSE
;
run
.
bidiLevel
=
0
;
/* default mode is not allowed */
hr
=
IDWriteFactory_CreateGlyphRunAnalysis
(
factory
,
&
run
,
1
.
0
,
NULL
,
DWRITE_RENDERING_MODE_DEFAULT
,
DWRITE_MEASURING_MODE_NATURAL
,
0
.
0
,
0
.
0
,
&
analysis
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
/* outline too */
hr
=
IDWriteFactory_CreateGlyphRunAnalysis
(
factory
,
&
run
,
1
.
0
,
NULL
,
DWRITE_RENDERING_MODE_OUTLINE
,
DWRITE_MEASURING_MODE_NATURAL
,
0
.
0
,
0
.
0
,
&
analysis
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateGlyphRunAnalysis
(
factory
,
&
run
,
1
.
0
,
NULL
,
DWRITE_RENDERING_MODE_GDI_CLASSIC
,
DWRITE_MEASURING_MODE_NATURAL
,
0
.
0
,
0
.
0
,
&
analysis
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteGlyphRunAnalysis_Release
(
analysis
);
IDWriteFontFace_Release
(
face
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
font
)
START_TEST
(
font
)
{
{
IDWriteFactory
*
factory
;
IDWriteFactory
*
factory
;
...
@@ -3280,6 +3360,7 @@ START_TEST(font)
...
@@ -3280,6 +3360,7 @@ START_TEST(font)
test_GetGlyphCount
();
test_GetGlyphCount
();
test_GetKerningPairAdjustments
();
test_GetKerningPairAdjustments
();
test_CreateRenderingParams
();
test_CreateRenderingParams
();
test_CreateGlyphRunAnalysis
();
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