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
f2f90fae
Commit
f2f90fae
authored
Apr 18, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineps: Handle font selection in spool files.
parent
16a8da44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
6 deletions
+63
-6
Makefile.in
dlls/wineps.drv/Makefile.in
+1
-1
printproc.c
dlls/wineps.drv/printproc.c
+62
-5
No files found.
dlls/wineps.drv/Makefile.in
View file @
f2f90fae
MODULE
=
wineps.drv
MODULE
=
wineps.drv
IMPORTS
=
user32 gdi32 winspool advapi32
IMPORTS
=
user32 gdi32 winspool advapi32
win32u
C_SRCS
=
\
C_SRCS
=
\
afm.c
\
afm.c
\
...
...
dlls/wineps.drv/printproc.c
View file @
f2f90fae
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <windows.h>
#include <windows.h>
#include <ntgdi.h>
#include <winspool.h>
#include <winspool.h>
#include <ddk/winsplp.h>
#include <ddk/winsplp.h>
...
@@ -40,7 +41,10 @@ struct pp_data
...
@@ -40,7 +41,10 @@ struct pp_data
HANDLE
hport
;
HANDLE
hport
;
WCHAR
*
doc_name
;
WCHAR
*
doc_name
;
WCHAR
*
out_file
;
WCHAR
*
out_file
;
PSDRV_PDEVICE
*
pdev
;
PSDRV_PDEVICE
*
pdev
;
struct
gdi_physdev
font_dev
;
struct
brush_pattern
*
patterns
;
struct
brush_pattern
*
patterns
;
BOOL
path
;
BOOL
path
;
};
};
...
@@ -133,6 +137,50 @@ static struct pp_data* get_handle_data(HANDLE pp)
...
@@ -133,6 +137,50 @@ static struct pp_data* get_handle_data(HANDLE pp)
return
ret
;
return
ret
;
}
}
static
BOOL
CDECL
font_EnumFonts
(
PHYSDEV
dev
,
LOGFONTW
*
lf
,
FONTENUMPROCW
proc
,
LPARAM
lp
)
{
return
EnumFontFamiliesExW
(
dev
->
hdc
,
lf
,
proc
,
lp
,
0
);
}
static
BOOL
CDECL
font_GetCharWidth
(
PHYSDEV
dev
,
UINT
first
,
UINT
count
,
const
WCHAR
*
chars
,
INT
*
buffer
)
{
XFORM
old
,
xform
=
{
.
eM11
=
1
.
0
f
};
BOOL
ret
;
GetWorldTransform
(
dev
->
hdc
,
&
old
);
SetWorldTransform
(
dev
->
hdc
,
&
xform
);
ret
=
NtGdiGetCharWidthW
(
dev
->
hdc
,
first
,
count
,
(
WCHAR
*
)
chars
,
NTGDI_GETCHARWIDTH_INT
,
buffer
);
SetWorldTransform
(
dev
->
hdc
,
&
old
);
return
ret
;
}
static
BOOL
CDECL
font_GetTextExtentExPoint
(
PHYSDEV
dev
,
const
WCHAR
*
str
,
INT
count
,
INT
*
dxs
)
{
SIZE
size
;
return
GetTextExtentExPointW
(
dev
->
hdc
,
str
,
count
,
-
1
,
NULL
,
dxs
,
&
size
);
}
static
BOOL
CDECL
font_GetTextMetrics
(
PHYSDEV
dev
,
TEXTMETRICW
*
metrics
)
{
return
GetTextMetricsW
(
dev
->
hdc
,
metrics
);
}
static
HFONT
CDECL
font_SelectFont
(
PHYSDEV
dev
,
HFONT
hfont
,
UINT
*
aa_flags
)
{
*
aa_flags
=
GGO_BITMAP
;
return
SelectObject
(
dev
->
hdc
,
hfont
)
?
hfont
:
0
;
}
static
const
struct
gdi_dc_funcs
font_funcs
=
{
.
pEnumFonts
=
font_EnumFonts
,
.
pGetCharWidth
=
font_GetCharWidth
,
.
pGetTextExtentExPoint
=
font_GetTextExtentExPoint
,
.
pGetTextMetrics
=
font_GetTextMetrics
,
.
pSelectFont
=
font_SelectFont
,
.
priority
=
GDI_PRIORITY_FONT_DRV
};
static
inline
INT
GDI_ROUND
(
double
val
)
static
inline
INT
GDI_ROUND
(
double
val
)
{
{
return
(
int
)
floor
(
val
+
0
.
5
);
return
(
int
)
floor
(
val
+
0
.
5
);
...
@@ -1114,18 +1162,23 @@ static int WINAPI hmf_proc(HDC hdc, HANDLETABLE *htable,
...
@@ -1114,18 +1162,23 @@ static int WINAPI hmf_proc(HDC hdc, HANDLETABLE *htable,
{
{
HDC
hdc
=
data
->
pdev
->
dev
.
hdc
;
HDC
hdc
=
data
->
pdev
->
dev
.
hdc
;
int
ret
=
PlayEnhMetaFileRecord
(
hdc
,
htable
,
rec
,
handle_count
);
int
ret
=
PlayEnhMetaFileRecord
(
hdc
,
htable
,
rec
,
handle_count
);
UINT
aa_flags
;
select_hbrush
(
data
,
htable
,
handle_count
,
GetCurrentObject
(
hdc
,
OBJ_BRUSH
));
if
(
ret
)
/* TODO: reselect font */
{
PSDRV_SelectPen
(
&
data
->
pdev
->
dev
,
GetCurrentObject
(
hdc
,
OBJ_PEN
),
NULL
);
select_hbrush
(
data
,
htable
,
handle_count
,
GetCurrentObject
(
hdc
,
OBJ_BRUSH
));
PSDRV_SetBkColor
(
&
data
->
pdev
->
dev
,
GetBkColor
(
hdc
));
PSDRV_SelectFont
(
&
data
->
pdev
->
dev
,
GetCurrentObject
(
hdc
,
OBJ_FONT
),
&
aa_flags
);
PSDRV_SetTextColor
(
&
data
->
pdev
->
dev
,
GetTextColor
(
hdc
));
PSDRV_SelectPen
(
&
data
->
pdev
->
dev
,
GetCurrentObject
(
hdc
,
OBJ_PEN
),
NULL
);
PSDRV_SetBkColor
(
&
data
->
pdev
->
dev
,
GetBkColor
(
hdc
));
PSDRV_SetTextColor
(
&
data
->
pdev
->
dev
,
GetTextColor
(
hdc
));
}
return
ret
;
return
ret
;
}
}
case
EMR_SELECTOBJECT
:
case
EMR_SELECTOBJECT
:
{
{
const
EMRSELECTOBJECT
*
so
=
(
const
EMRSELECTOBJECT
*
)
rec
;
const
EMRSELECTOBJECT
*
so
=
(
const
EMRSELECTOBJECT
*
)
rec
;
struct
brush_pattern
*
pattern
;
struct
brush_pattern
*
pattern
;
UINT
aa_flags
;
HGDIOBJ
obj
;
HGDIOBJ
obj
;
obj
=
get_object_handle
(
data
,
htable
,
so
->
ihObject
,
&
pattern
);
obj
=
get_object_handle
(
data
,
htable
,
so
->
ihObject
,
&
pattern
);
...
@@ -1135,6 +1188,7 @@ static int WINAPI hmf_proc(HDC hdc, HANDLETABLE *htable,
...
@@ -1135,6 +1188,7 @@ static int WINAPI hmf_proc(HDC hdc, HANDLETABLE *htable,
{
{
case
OBJ_PEN
:
return
PSDRV_SelectPen
(
&
data
->
pdev
->
dev
,
obj
,
NULL
)
!=
NULL
;
case
OBJ_PEN
:
return
PSDRV_SelectPen
(
&
data
->
pdev
->
dev
,
obj
,
NULL
)
!=
NULL
;
case
OBJ_BRUSH
:
return
PSDRV_SelectBrush
(
&
data
->
pdev
->
dev
,
obj
,
pattern
)
!=
NULL
;
case
OBJ_BRUSH
:
return
PSDRV_SelectBrush
(
&
data
->
pdev
->
dev
,
obj
,
pattern
)
!=
NULL
;
case
OBJ_FONT
:
return
PSDRV_SelectFont
(
&
data
->
pdev
->
dev
,
obj
,
&
aa_flags
)
!=
NULL
;
default:
default:
FIXME
(
"unhandled object type %ld
\n
"
,
GetObjectType
(
obj
));
FIXME
(
"unhandled object type %ld
\n
"
,
GetObjectType
(
obj
));
return
1
;
return
1
;
...
@@ -1749,6 +1803,9 @@ HANDLE WINAPI OpenPrintProcessor(WCHAR *port, PRINTPROCESSOROPENDATA *open_data)
...
@@ -1749,6 +1803,9 @@ HANDLE WINAPI OpenPrintProcessor(WCHAR *port, PRINTPROCESSOROPENDATA *open_data)
return
NULL
;
return
NULL
;
}
}
data
->
pdev
->
dev
.
hdc
=
hdc
;
data
->
pdev
->
dev
.
hdc
=
hdc
;
data
->
pdev
->
dev
.
next
=
&
data
->
font_dev
;
data
->
font_dev
.
funcs
=
&
font_funcs
;
data
->
font_dev
.
hdc
=
hdc
;
PSDRV_SetTextColor
(
&
data
->
pdev
->
dev
,
GetTextColor
(
hdc
));
PSDRV_SetTextColor
(
&
data
->
pdev
->
dev
,
GetTextColor
(
hdc
));
PSDRV_SetBkColor
(
&
data
->
pdev
->
dev
,
GetBkColor
(
hdc
));
PSDRV_SetBkColor
(
&
data
->
pdev
->
dev
,
GetBkColor
(
hdc
));
...
...
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