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
c027f427
Commit
c027f427
authored
Jul 03, 2008
by
Adam Petaccia
Committed by
Alexandre Julliard
Jul 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Use a better framework for filling out FontFamilies.
parent
25e4fd7d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
21 deletions
+21
-21
font.c
dlls/gdiplus/font.c
+20
-20
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+1
-1
No files found.
dlls/gdiplus/font.c
View file @
c027f427
...
...
@@ -95,7 +95,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
{
WCHAR
facename
[
LF_FACESIZE
];
LOGFONTW
*
lfw
;
const
TEXTMETRICW
*
tmw
;
const
NEW
TEXTMETRICW
*
tmw
;
GpStatus
stat
;
if
(
!
fontFamily
||
!
fontFamily
->
FamilyName
||
!
font
)
...
...
@@ -333,19 +333,31 @@ GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi,
return
NotImplemented
;
}
/* Borrowed from GDI32 */
/***********************************************************************
* Borrowed from GDI32:
*
* Elf is really an ENUMLOGFONTEXW, and ntm is a NEWTEXTMETRICEXW.
* We have to use other types because of the FONTENUMPROCW definition.
*/
static
INT
CALLBACK
is_font_installed_proc
(
const
LOGFONTW
*
elf
,
const
TEXTMETRICW
*
ntm
,
DWORD
type
,
LPARAM
lParam
)
{
if
(
!
ntm
)
{
return
1
;
}
*
(
NEWTEXTMETRICW
*
)
lParam
=
*
(
const
NEWTEXTMETRICW
*
)
ntm
;
return
0
;
}
static
BOOL
is_font_installed
(
const
WCHAR
*
name
)
static
BOOL
find_installed_font
(
const
WCHAR
*
name
,
NEWTEXTMETRICW
*
ntm
)
{
HDC
hdc
=
GetDC
(
0
);
BOOL
ret
=
FALSE
;
if
(
!
EnumFontFamiliesW
(
hdc
,
name
,
is_font_installed_proc
,
0
))
if
(
!
EnumFontFamiliesW
(
hdc
,
name
,
is_font_installed_proc
,
(
LPARAM
)
ntm
))
ret
=
TRUE
;
ReleaseDC
(
0
,
hdc
);
...
...
@@ -377,9 +389,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
GpFontFamily
**
FontFamily
)
{
GpFontFamily
*
ffamily
;
HDC
hdc
;
HFONT
hFont
,
hfont_old
;
LOGFONTW
lfw
;
NEWTEXTMETRICW
ntm
;
TRACE
(
"%s, %p %p
\n
"
,
debugstr_w
(
name
),
fontCollection
,
FontFamily
);
...
...
@@ -387,35 +397,25 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
return
InvalidParameter
;
if
(
fontCollection
)
FIXME
(
"No support for FontCollections yet!
\n
"
);
if
(
!
is_font_installed
(
name
))
if
(
!
find_installed_font
(
name
,
&
ntm
))
return
FontFamilyNotFound
;
ffamily
=
GdipAlloc
(
sizeof
(
GpFontFamily
));
if
(
!
ffamily
)
return
OutOfMemory
;
hdc
=
GetDC
(
0
);
lstrcpynW
(
lfw
.
lfFaceName
,
name
,
sizeof
(
WCHAR
)
*
LF_FACESIZE
);
lfw
.
lfCharSet
=
DEFAULT_CHARSET
;
lfw
.
lfEscapement
=
lfw
.
lfOrientation
=
0
;
hFont
=
CreateFontIndirectW
(
&
lfw
);
hfont_old
=
SelectObject
(
hdc
,
hFont
);
GetTextMetricsW
(
hdc
,
&
ffamily
->
tmw
);
DeleteObject
(
SelectObject
(
hdc
,
hfont_old
));
ffamily
->
tmw
=
ntm
;
ffamily
->
FamilyName
=
GdipAlloc
(
LF_FACESIZE
*
sizeof
(
WCHAR
));
if
(
!
ffamily
->
FamilyName
)
{
GdipFree
(
ffamily
);
ReleaseDC
(
0
,
hdc
);
return
OutOfMemory
;
}
lstrcpynW
(
ffamily
->
FamilyName
,
name
,
sizeof
(
WCHAR
)
*
LF_FACESIZE
);
*
FontFamily
=
ffamily
;
ReleaseDC
(
0
,
hdc
);
return
Ok
;
}
...
...
dlls/gdiplus/gdiplus_private.h
View file @
c027f427
...
...
@@ -192,7 +192,7 @@ struct GpFontCollection{
};
struct
GpFontFamily
{
TEXTMETRICW
tmw
;
NEW
TEXTMETRICW
tmw
;
WCHAR
*
FamilyName
;
};
...
...
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