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
730b2f4c
Commit
730b2f4c
authored
Dec 09, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement IsMonospacedFont().
parent
13a10170
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
2 deletions
+82
-2
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+2
-2
freetype.c
dlls/dwrite/freetype.c
+20
-0
font.c
dlls/dwrite/tests/font.c
+59
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
730b2f4c
...
...
@@ -129,6 +129,7 @@ extern BOOL init_freetype(void) DECLSPEC_HIDDEN;
extern
void
release_freetype
(
void
)
DECLSPEC_HIDDEN
;
extern
HRESULT
freetype_get_design_glyph_metrics
(
IDWriteFontFace2
*
,
UINT16
,
UINT16
,
DWRITE_GLYPH_METRICS
*
)
DECLSPEC_HIDDEN
;
extern
void
freetype_notify_cacheremove
(
IDWriteFontFace2
*
)
DECLSPEC_HIDDEN
;
extern
BOOL
freetype_is_monospaced
(
IDWriteFontFace2
*
)
DECLSPEC_HIDDEN
;
/* Glyph shaping */
enum
SCRIPT_JUSTIFY
...
...
dlls/dwrite/font.c
View file @
730b2f4c
...
...
@@ -495,8 +495,8 @@ static HRESULT WINAPI dwritefontface1_GetUnicodeRanges(IDWriteFontFace2 *iface,
static
BOOL
WINAPI
dwritefontface1_IsMonospacedFont
(
IDWriteFontFace2
*
iface
)
{
struct
dwrite_fontface
*
This
=
impl_from_IDWriteFontFace2
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
FALSE
;
TRACE
(
"(%p)
\n
"
,
This
);
return
freetype_is_monospaced
(
iface
)
;
}
static
HRESULT
WINAPI
dwritefontface1_GetDesignGlyphAdvances
(
IDWriteFontFace2
*
iface
,
...
...
dlls/dwrite/freetype.c
View file @
730b2f4c
...
...
@@ -67,6 +67,7 @@ MAKE_FUNCPTR(FT_Load_Glyph);
MAKE_FUNCPTR
(
FT_New_Memory_Face
);
MAKE_FUNCPTR
(
FTC_Manager_New
);
MAKE_FUNCPTR
(
FTC_Manager_Done
);
MAKE_FUNCPTR
(
FTC_Manager_LookupFace
);
MAKE_FUNCPTR
(
FTC_Manager_LookupSize
);
MAKE_FUNCPTR
(
FTC_Manager_RemoveFaceID
);
#undef MAKE_FUNCPTR
...
...
@@ -135,6 +136,7 @@ BOOL init_freetype(void)
LOAD_FUNCPTR
(
FT_New_Memory_Face
)
LOAD_FUNCPTR
(
FTC_Manager_New
)
LOAD_FUNCPTR
(
FTC_Manager_Done
)
LOAD_FUNCPTR
(
FTC_Manager_LookupFace
)
LOAD_FUNCPTR
(
FTC_Manager_LookupSize
)
LOAD_FUNCPTR
(
FTC_Manager_RemoveFaceID
)
#undef LOAD_FUNCPTR
...
...
@@ -210,6 +212,19 @@ HRESULT freetype_get_design_glyph_metrics(IDWriteFontFace2 *fontface, UINT16 uni
return
S_OK
;
}
BOOL
freetype_is_monospaced
(
IDWriteFontFace2
*
fontface
)
{
BOOL
is_monospaced
=
FALSE
;
FT_Face
face
;
EnterCriticalSection
(
&
freetype_cs
);
if
(
pFTC_Manager_LookupFace
(
cache_manager
,
fontface
,
&
face
)
==
0
)
is_monospaced
=
FT_IS_FIXED_WIDTH
(
face
);
LeaveCriticalSection
(
&
freetype_cs
);
return
is_monospaced
;
}
#else
/* HAVE_FREETYPE */
BOOL
init_freetype
(
void
)
...
...
@@ -230,4 +245,9 @@ HRESULT freetype_get_design_glyph_metrics(IDWriteFontFace2 *fontface, UINT16 uni
return
E_NOTIMPL
;
}
BOOL
freetype_is_monospaced
(
IDWriteFontFace2
*
fontface
)
{
return
FALSE
;
}
#endif
/* HAVE_FREETYPE */
dlls/dwrite/tests/font.c
View file @
730b2f4c
...
...
@@ -2578,6 +2578,64 @@ static void test_GetDesignGlyphMetrics(void)
DeleteFileW
(
test_fontfile
);
}
static
void
test_IsMonospacedFont
(
void
)
{
static
const
WCHAR
courierW
[]
=
{
'C'
,
'o'
,
'u'
,
'r'
,
'i'
,
'e'
,
'r'
,
' '
,
'N'
,
'e'
,
'w'
,
0
};
IDWriteFontCollection
*
collection
;
IDWriteFactory
*
factory
;
UINT32
index
;
BOOL
exists
;
HRESULT
hr
;
factory
=
create_factory
();
hr
=
IDWriteFactory_GetSystemFontCollection
(
factory
,
&
collection
,
FALSE
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
exists
=
FALSE
;
hr
=
IDWriteFontCollection_FindFamilyName
(
collection
,
courierW
,
&
index
,
&
exists
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
exists
)
{
IDWriteFontFamily
*
family
;
IDWriteFont1
*
font1
;
IDWriteFont
*
font
;
hr
=
IDWriteFontCollection_GetFontFamily
(
collection
,
index
,
&
family
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFontFamily_Release
(
family
);
hr
=
IDWriteFont_QueryInterface
(
font
,
&
IID_IDWriteFont1
,
(
void
**
)
&
font1
);
if
(
hr
==
S_OK
)
{
IDWriteFontFace1
*
fontface1
;
IDWriteFontFace
*
fontface
;
BOOL
is_monospaced
;
is_monospaced
=
IDWriteFont1_IsMonospacedFont
(
font1
);
ok
(
is_monospaced
,
"got %d
\n
"
,
is_monospaced
);
hr
=
IDWriteFont1_CreateFontFace
(
font1
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace1
,
(
void
**
)
&
fontface1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
is_monospaced
=
IDWriteFontFace1_IsMonospacedFont
(
fontface1
);
ok
(
is_monospaced
,
"got %d
\n
"
,
is_monospaced
);
IDWriteFontFace1_Release
(
fontface1
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFont1_Release
(
font1
);
}
else
win_skip
(
"IsMonospacedFont() is not supported.
\n
"
);
}
else
skip
(
"Courier New font not found.
\n
"
);
IDWriteFontCollection_Release
(
collection
);
}
START_TEST
(
font
)
{
IDWriteFactory
*
factory
;
...
...
@@ -2612,6 +2670,7 @@ START_TEST(font)
test_CreateStreamFromKey
();
test_ReadFileFragment
();
test_GetDesignGlyphMetrics
();
test_IsMonospacedFont
();
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