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
5a318c3e
Commit
5a318c3e
authored
Feb 19, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Set facename field of a LOGFONT in ConvertFontFaceToLOGFONT().
parent
5196be77
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
47 deletions
+75
-47
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+14
-45
gdiinterop.c
dlls/dwrite/gdiinterop.c
+60
-1
font.c
dlls/dwrite/tests/font.c
+0
-1
No files found.
dlls/dwrite/dwrite_private.h
View file @
5a318c3e
...
...
@@ -121,6 +121,7 @@ extern BOOL is_system_collection(IDWriteFontCollection*) 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
BOOL
is_face_type_supported
(
DWRITE_FONT_FACE_TYPE
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_family_names_from_stream
(
IDWriteFontFileStream
*
,
UINT32
,
DWRITE_FONT_FACE_TYPE
,
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
/* Opentype font table functions */
extern
HRESULT
opentype_analyze_font
(
IDWriteFontFileStream
*
,
UINT32
*
,
DWRITE_FONT_FILE_TYPE
*
,
DWRITE_FONT_FACE_TYPE
*
,
BOOL
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
5a318c3e
...
...
@@ -773,45 +773,22 @@ static const IDWriteFontFace2Vtbl dwritefontfacevtbl = {
dwritefontface2_GetRecommendedRenderingMode
};
HRESULT
convert_fontface_to_logfont
(
IDWriteFontFace
*
face
,
LOGFONTW
*
logfont
)
HRESULT
get_family_names_from_stream
(
IDWriteFontFileStream
*
stream
,
UINT32
index
,
DWRITE_FONT_FACE_TYPE
facetype
,
IDWriteLocalizedStrings
**
names
)
{
DWRITE_FONT_SIMULATIONS
simulations
;
DWRITE_FONT_FACE_TYPE
face_type
;
IDWriteFontFileStream
*
stream
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_WEIGHT
weight
;
IDWriteFontFile
*
file
=
NULL
;
UINT32
index
;
HRESULT
hr
;
memset
(
logfont
,
0
,
sizeof
(
*
logfont
));
index
=
1
;
hr
=
IDWriteFontFace_GetFiles
(
face
,
&
index
,
&
file
);
if
(
FAILED
(
hr
)
||
!
file
)
return
hr
;
const
void
*
name_table
=
NULL
;
void
*
name_context
;
HRESULT
hr
=
S_OK
;
hr
=
get_filestream_from_file
(
file
,
&
stream
);
if
(
FAILED
(
hr
)
)
{
IDWriteFontFile_Release
(
file
);
return
hr
;
opentype_get_font_table
(
stream
,
facetype
,
index
,
MS_NAME_TAG
,
&
name_table
,
&
name_context
,
NULL
,
NULL
);
if
(
name_table
)
{
hr
=
opentype_get_font_strings_from_id
(
name_table
,
DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES
,
names
);
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
name_context
)
;
}
else
names
=
NULL
;
index
=
IDWriteFontFace_GetIndex
(
face
);
face_type
=
IDWriteFontFace_GetType
(
face
);
opentype_get_font_properties
(
stream
,
face_type
,
index
,
&
stretch
,
&
weight
,
&
style
);
IDWriteFontFileStream_Release
(
stream
);
simulations
=
IDWriteFontFace_GetSimulations
(
face
);
logfont
->
lfCharSet
=
DEFAULT_CHARSET
;
logfont
->
lfWeight
=
weight
;
logfont
->
lfItalic
=
style
==
DWRITE_FONT_STYLE_ITALIC
||
(
simulations
&
DWRITE_FONT_SIMULATIONS_OBLIQUE
);
logfont
->
lfOutPrecision
=
OUT_OUTLINE_PRECIS
;
/* TODO: set facename */
return
S_OK
;
return
hr
;
}
static
HRESULT
get_fontface_from_font
(
struct
dwrite_font
*
font
,
IDWriteFontFace2
**
fontface
)
...
...
@@ -1730,8 +1707,6 @@ HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerat
for
(
i
=
0
;
i
<
face_count
;
i
++
)
{
IDWriteLocalizedStrings
*
family_name
=
NULL
;
struct
dwrite_font_data
*
font_data
;
const
void
*
name_table
;
void
*
name_context
;
IDWriteFontFileStream
*
stream
;
WCHAR
buffer
[
255
];
UINT32
index
;
...
...
@@ -1742,15 +1717,9 @@ HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerat
break
;
/* get family name from font file */
name_table
=
NULL
;
opentype_get_font_table
(
stream
,
face_type
,
i
,
MS_NAME_TAG
,
&
name_table
,
&
name_context
,
NULL
,
NULL
);
if
(
name_table
)
{
hr
=
opentype_get_font_strings_from_id
(
name_table
,
DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES
,
&
family_name
);
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
name_context
);
}
hr
=
get_family_names_from_stream
(
stream
,
i
,
face_type
,
&
family_name
);
IDWriteFontFileStream_Release
(
stream
);
if
(
FAILED
(
hr
)
||
!
family_name
)
{
if
(
FAILED
(
hr
))
{
WARN
(
"unable to get family name from font
\n
"
);
release_font_data
(
font_data
);
continue
;
...
...
dlls/dwrite/gdiinterop.c
View file @
5a318c3e
...
...
@@ -406,9 +406,68 @@ static HRESULT WINAPI gdiinterop_ConvertFontToLOGFONT(IDWriteGdiInterop *iface,
static
HRESULT
WINAPI
gdiinterop_ConvertFontFaceToLOGFONT
(
IDWriteGdiInterop
*
iface
,
IDWriteFontFace
*
fontface
,
LOGFONTW
*
logfont
)
{
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
};
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop
(
iface
);
IDWriteLocalizedStrings
*
familynames
;
DWRITE_FONT_SIMULATIONS
simulations
;
DWRITE_FONT_FACE_TYPE
face_type
;
IDWriteFontFileStream
*
stream
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_WEIGHT
weight
;
IDWriteFontFile
*
file
=
NULL
;
UINT32
index
;
BOOL
exists
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
fontface
,
logfont
);
return
convert_fontface_to_logfont
(
fontface
,
logfont
);
memset
(
logfont
,
0
,
sizeof
(
*
logfont
));
index
=
1
;
hr
=
IDWriteFontFace_GetFiles
(
fontface
,
&
index
,
&
file
);
if
(
FAILED
(
hr
)
||
!
file
)
return
hr
;
hr
=
get_filestream_from_file
(
file
,
&
stream
);
if
(
FAILED
(
hr
))
{
IDWriteFontFile_Release
(
file
);
return
hr
;
}
index
=
IDWriteFontFace_GetIndex
(
fontface
);
face_type
=
IDWriteFontFace_GetType
(
fontface
);
opentype_get_font_properties
(
stream
,
face_type
,
index
,
&
stretch
,
&
weight
,
&
style
);
hr
=
get_family_names_from_stream
(
stream
,
index
,
face_type
,
&
familynames
);
IDWriteFontFile_Release
(
file
);
IDWriteFontFileStream_Release
(
stream
);
if
(
FAILED
(
hr
))
return
hr
;
simulations
=
IDWriteFontFace_GetSimulations
(
fontface
);
logfont
->
lfCharSet
=
DEFAULT_CHARSET
;
logfont
->
lfWeight
=
weight
;
logfont
->
lfItalic
=
style
==
DWRITE_FONT_STYLE_ITALIC
||
(
simulations
&
DWRITE_FONT_SIMULATIONS_OBLIQUE
);
logfont
->
lfOutPrecision
=
OUT_OUTLINE_PRECIS
;
logfont
->
lfFaceName
[
0
]
=
0
;
exists
=
FALSE
;
hr
=
IDWriteLocalizedStrings_FindLocaleName
(
familynames
,
enusW
,
&
index
,
&
exists
);
if
(
FAILED
(
hr
)
||
!
exists
)
{
/* fallback to 0 index */
if
(
IDWriteLocalizedStrings_GetCount
(
familynames
)
>
0
)
index
=
0
;
else
{
IDWriteLocalizedStrings_Release
(
familynames
);
return
E_FAIL
;
}
}
hr
=
IDWriteLocalizedStrings_GetString
(
familynames
,
index
,
logfont
->
lfFaceName
,
sizeof
(
logfont
->
lfFaceName
)
/
sizeof
(
WCHAR
));
IDWriteLocalizedStrings_Release
(
familynames
);
return
hr
;
}
static
HRESULT
WINAPI
gdiinterop_CreateFontFaceFromHdc
(
IDWriteGdiInterop
*
iface
,
...
...
dlls/dwrite/tests/font.c
View file @
5a318c3e
...
...
@@ -1467,7 +1467,6 @@ if (0) /* crashes on native */
ok
(
logfont
.
lfItalic
==
1
,
"got %d
\n
"
,
logfont
.
lfItalic
);
ok
(
logfont
.
lfUnderline
==
0
,
"got %d
\n
"
,
logfont
.
lfUnderline
);
ok
(
logfont
.
lfStrikeOut
==
0
,
"got %d
\n
"
,
logfont
.
lfStrikeOut
);
todo_wine
ok
(
!
lstrcmpW
(
logfont
.
lfFaceName
,
tahomaW
),
"got %s
\n
"
,
wine_dbgstr_w
(
logfont
.
lfFaceName
));
IDWriteGdiInterop_Release
(
interop
);
...
...
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