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
7e480d3c
Commit
7e480d3c
authored
Mar 13, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement GetKerningPairAdjustments().
parent
23c2ef2f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
3 deletions
+90
-3
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+18
-3
freetype.c
dlls/dwrite/freetype.c
+25
-0
font.c
dlls/dwrite/tests/font.c
+46
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
7e480d3c
...
...
@@ -163,6 +163,7 @@ extern HRESULT freetype_get_glyph_outline(IDWriteFontFace2*,FLOAT,UINT16,USHORT,
extern
UINT16
freetype_get_glyphcount
(
IDWriteFontFace2
*
)
DECLSPEC_HIDDEN
;
extern
UINT16
freetype_get_glyphindex
(
IDWriteFontFace2
*
,
UINT32
)
DECLSPEC_HIDDEN
;
extern
BOOL
freetype_has_kerning_pairs
(
IDWriteFontFace2
*
)
DECLSPEC_HIDDEN
;
extern
INT32
freetype_get_kerning_pair_adjustment
(
IDWriteFontFace2
*
,
UINT16
,
UINT16
)
DECLSPEC_HIDDEN
;
/* Glyph shaping */
enum
SCRIPT_JUSTIFY
...
...
dlls/dwrite/font.c
View file @
7e480d3c
...
...
@@ -658,12 +658,27 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleGlyphAdvances(IDWriteFontF
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritefontface1_GetKerningPairAdjustments
(
IDWriteFontFace2
*
iface
,
UINT32
glyph_
count
,
static
HRESULT
WINAPI
dwritefontface1_GetKerningPairAdjustments
(
IDWriteFontFace2
*
iface
,
UINT32
count
,
const
UINT16
*
indices
,
INT32
*
adjustments
)
{
struct
dwrite_fontface
*
This
=
impl_from_IDWriteFontFace2
(
iface
);
FIXME
(
"(%p)->(%u %p %p): stub
\n
"
,
This
,
glyph_count
,
indices
,
adjustments
);
return
E_NOTIMPL
;
UINT32
i
;
TRACE
(
"(%p)->(%u %p %p)
\n
"
,
This
,
count
,
indices
,
adjustments
);
if
(
!
(
indices
||
adjustments
)
||
!
count
)
return
E_INVALIDARG
;
if
(
!
indices
||
count
==
1
)
{
memset
(
adjustments
,
0
,
count
*
sizeof
(
INT32
));
return
E_INVALIDARG
;
}
for
(
i
=
0
;
i
<
count
-
1
;
i
++
)
adjustments
[
i
]
=
freetype_get_kerning_pair_adjustment
(
iface
,
indices
[
i
],
indices
[
i
+
1
]);
adjustments
[
count
-
1
]
=
0
;
return
S_OK
;
}
static
BOOL
WINAPI
dwritefontface1_HasKerningPairs
(
IDWriteFontFace2
*
iface
)
...
...
dlls/dwrite/freetype.c
View file @
7e480d3c
...
...
@@ -63,6 +63,7 @@ typedef struct
#define MAKE_FUNCPTR(f) static typeof(f) * p##f = NULL
MAKE_FUNCPTR
(
FT_Done_FreeType
);
MAKE_FUNCPTR
(
FT_Get_Kerning
);
MAKE_FUNCPTR
(
FT_Init_FreeType
);
MAKE_FUNCPTR
(
FT_Library_Version
);
MAKE_FUNCPTR
(
FT_Load_Glyph
);
...
...
@@ -135,6 +136,7 @@ BOOL init_freetype(void)
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(ft_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f); goto sym_not_found;}
LOAD_FUNCPTR
(
FT_Done_FreeType
)
LOAD_FUNCPTR
(
FT_Get_Kerning
)
LOAD_FUNCPTR
(
FT_Init_FreeType
)
LOAD_FUNCPTR
(
FT_Library_Version
)
LOAD_FUNCPTR
(
FT_Load_Glyph
)
...
...
@@ -420,6 +422,24 @@ BOOL freetype_has_kerning_pairs(IDWriteFontFace2 *fontface)
return
has_kerning_pairs
;
}
INT32
freetype_get_kerning_pair_adjustment
(
IDWriteFontFace2
*
fontface
,
UINT16
left
,
UINT16
right
)
{
INT32
adjustment
=
0
;
FT_Face
face
;
EnterCriticalSection
(
&
freetype_cs
);
if
(
pFTC_Manager_LookupFace
(
cache_manager
,
fontface
,
&
face
)
==
0
)
{
FT_Vector
kern
;
if
(
FT_HAS_KERNING
(
face
))
{
pFT_Get_Kerning
(
face
,
left
,
right
,
FT_KERNING_UNSCALED
,
&
kern
);
adjustment
=
kern
.
x
;
}
}
LeaveCriticalSection
(
&
freetype_cs
);
return
adjustment
;
}
#else
/* HAVE_FREETYPE */
BOOL
init_freetype
(
void
)
...
...
@@ -466,4 +486,9 @@ BOOL freetype_has_kerning_pairs(IDWriteFontFace2 *fontface)
return
FALSE
;
}
INT32
freetype_get_kerning_pair_adjustment
(
IDWriteFontFace2
*
fontface
,
UINT16
left
,
UINT16
right
)
{
return
0
;
}
#endif
/* HAVE_FREETYPE */
dlls/dwrite/tests/font.c
View file @
7e480d3c
...
...
@@ -3136,6 +3136,51 @@ static void test_GetGlyphCount(void)
DELETE_FONTFILE
(
path
);
}
static
void
test_GetKerningPairAdjustments
(
void
)
{
IDWriteFontFace1
*
fontface1
;
IDWriteFontFace
*
fontface
;
IDWriteFactory
*
factory
;
IDWriteFontFile
*
file
;
WCHAR
*
path
;
HRESULT
hr
;
path
=
create_testfontfile
(
test_fontfile
);
factory
=
create_factory
();
hr
=
IDWriteFactory_CreateFontFileReference
(
factory
,
path
,
NULL
,
&
file
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateFontFace
(
factory
,
DWRITE_FONT_FACE_TYPE_TRUETYPE
,
1
,
&
file
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFontFile_Release
(
file
);
hr
=
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace1
,
(
void
**
)
&
fontface1
);
if
(
hr
==
S_OK
)
{
INT32
adjustments
[
1
];
hr
=
IDWriteFontFace1_GetKerningPairAdjustments
(
fontface1
,
0
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
||
broken
(
hr
==
S_OK
)
/* win8 */
,
"got 0x%08x
\n
"
,
hr
);
if
(
0
)
/* crashes on native */
hr
=
IDWriteFontFace1_GetKerningPairAdjustments
(
fontface1
,
1
,
NULL
,
NULL
);
adjustments
[
0
]
=
1
;
hr
=
IDWriteFontFace1_GetKerningPairAdjustments
(
fontface1
,
1
,
NULL
,
adjustments
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
ok
(
adjustments
[
0
]
==
0
,
"got %d
\n
"
,
adjustments
[
0
]);
IDWriteFontFace1_Release
(
fontface1
);
}
else
win_skip
(
"GetKerningPairAdjustments() is not supported.
\n
"
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFactory_Release
(
factory
);
DELETE_FONTFILE
(
path
);
}
START_TEST
(
font
)
{
IDWriteFactory
*
factory
;
...
...
@@ -3176,6 +3221,7 @@ START_TEST(font)
test_GetEudcFontCollection
();
test_GetCaretMetrics
();
test_GetGlyphCount
();
test_GetKerningPairAdjustments
();
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