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
78b041cf
Commit
78b041cf
authored
Jun 04, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better encapsulation of the font and metafile objects.
parent
c6476e90
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
98 additions
and
146 deletions
+98
-146
freetype.c
dlls/gdi/freetype.c
+36
-44
init.c
dlls/gdi/mfdrv/init.c
+0
-1
xfont.c
graphics/x11drv/xfont.c
+1
-0
font.h
include/font.h
+0
-46
gdi.h
include/gdi.h
+15
-2
metafile.h
include/metafile.h
+0
-47
wingdi16.h
include/wine/wingdi16.h
+33
-0
enhmetafile.c
objects/enhmetafile.c
+1
-4
font.c
objects/font.c
+6
-0
metafile.c
objects/metafile.c
+6
-2
No files found.
dlls/gdi/freetype.c
View file @
78b041cf
...
...
@@ -796,20 +796,19 @@ GdiFont WineEngCreateFontInstance(DC *dc, HFONT hfont)
GdiFont
ret
;
Face
*
face
;
Family
*
family
=
NULL
;
WCHAR
FaceName
[
LF_FACESIZE
];
BOOL
bd
,
it
;
FONTOBJ
*
font
=
GDI_GetObjPtr
(
hfont
,
FONT_MAGIC
);
LOGFONTW
*
plf
=
&
font
->
logfont
;
LOGFONTW
lf
;
if
(
!
GetObjectW
(
hfont
,
sizeof
(
lf
),
&
lf
))
return
NULL
;
TRACE
(
"%s, h=%ld, it=%d, weight=%ld, PandF=%02x, charset=%d orient %ld escapement %ld
\n
"
,
debugstr_w
(
plf
->
lfFaceName
),
plf
->
lfHeight
,
plf
->
lfItalic
,
plf
->
lfWeight
,
plf
->
lfPitchAndFamily
,
plf
->
lfCharSet
,
plf
->
lfOrientation
,
plf
->
lfEscapement
);
debugstr_w
(
lf
.
lfFaceName
),
lf
.
lfHeight
,
lf
.
lfItalic
,
lf
.
lfWeight
,
lf
.
lfPitchAndFamily
,
lf
.
lfCharSet
,
lf
.
lfOrientation
,
lf
.
lfEscapement
);
/* check the cache first */
for
(
ret
=
GdiFontList
;
ret
;
ret
=
ret
->
next
)
{
if
(
ret
->
hfont
==
hfont
)
{
GDI_ReleaseObj
(
hfont
);
TRACE
(
"returning cached gdiFont(%p) for hFont %x
\n
"
,
ret
,
hfont
);
return
ret
;
}
...
...
@@ -817,45 +816,42 @@ GdiFont WineEngCreateFontInstance(DC *dc, HFONT hfont)
if
(
!
FontList
)
/* No fonts installed */
{
GDI_ReleaseObj
(
hfont
);
TRACE
(
"No fonts installed
\n
"
);
return
NULL
;
}
ret
=
alloc_font
();
strcpyW
(
FaceName
,
plf
->
lfFaceName
);
if
(
FaceName
[
0
]
!=
'\0'
)
{
if
(
lf
.
lfFaceName
[
0
]
!=
'\0'
)
{
FontSubst
*
psub
;
for
(
psub
=
substlist
;
psub
;
psub
=
psub
->
next
)
if
(
!
strcmpiW
(
FaceName
,
psub
->
from
.
name
)
&&
if
(
!
strcmpiW
(
lf
.
lf
FaceName
,
psub
->
from
.
name
)
&&
(
psub
->
from
.
charset
==
-
1
||
psub
->
from
.
charset
==
plf
->
lfCharSet
))
psub
->
from
.
charset
==
lf
.
lfCharSet
))
break
;
if
(
psub
)
{
TRACE
(
"substituting %s -> %s
\n
"
,
debugstr_w
(
FaceName
),
TRACE
(
"substituting %s -> %s
\n
"
,
debugstr_w
(
lf
.
lf
FaceName
),
debugstr_w
(
psub
->
to
.
name
));
strcpyW
(
FaceName
,
psub
->
to
.
name
);
strcpyW
(
lf
.
lf
FaceName
,
psub
->
to
.
name
);
}
for
(
family
=
FontList
;
family
;
family
=
family
->
next
)
{
if
(
!
strcmpiW
(
family
->
FamilyName
,
FaceName
))
if
(
!
strcmpiW
(
family
->
FamilyName
,
lf
.
lf
FaceName
))
break
;
}
if
(
!
family
)
{
/* do other aliases here */
if
(
!
strcmpiW
(
FaceName
,
SystemW
))
strcpyW
(
FaceName
,
defSystem
);
else
if
(
!
strcmpiW
(
FaceName
,
MSSansSerifW
))
strcpyW
(
FaceName
,
defSans
);
else
if
(
!
strcmpiW
(
FaceName
,
HelvW
))
strcpyW
(
FaceName
,
defSans
);
if
(
!
strcmpiW
(
lf
.
lf
FaceName
,
SystemW
))
strcpyW
(
lf
.
lf
FaceName
,
defSystem
);
else
if
(
!
strcmpiW
(
lf
.
lf
FaceName
,
MSSansSerifW
))
strcpyW
(
lf
.
lf
FaceName
,
defSans
);
else
if
(
!
strcmpiW
(
lf
.
lf
FaceName
,
HelvW
))
strcpyW
(
lf
.
lf
FaceName
,
defSans
);
else
goto
not_found
;
for
(
family
=
FontList
;
family
;
family
=
family
->
next
)
{
if
(
!
strcmpiW
(
family
->
FamilyName
,
FaceName
))
if
(
!
strcmpiW
(
family
->
FamilyName
,
lf
.
lf
FaceName
))
break
;
}
}
...
...
@@ -863,17 +859,17 @@ GdiFont WineEngCreateFontInstance(DC *dc, HFONT hfont)
not_found:
if
(
!
family
)
{
if
(
plf
->
lfPitchAndFamily
&
FIXED_PITCH
||
plf
->
lfPitchAndFamily
&
FF_MODERN
)
strcpyW
(
FaceName
,
defFixed
);
else
if
(
plf
->
lfPitchAndFamily
&
FF_ROMAN
)
strcpyW
(
FaceName
,
defSerif
);
else
if
(
plf
->
lfPitchAndFamily
&
FF_SWISS
)
strcpyW
(
FaceName
,
defSans
);
if
(
lf
.
lfPitchAndFamily
&
FIXED_PITCH
||
lf
.
lfPitchAndFamily
&
FF_MODERN
)
strcpyW
(
lf
.
lf
FaceName
,
defFixed
);
else
if
(
lf
.
lfPitchAndFamily
&
FF_ROMAN
)
strcpyW
(
lf
.
lf
FaceName
,
defSerif
);
else
if
(
lf
.
lfPitchAndFamily
&
FF_SWISS
)
strcpyW
(
lf
.
lf
FaceName
,
defSans
);
else
strcpyW
(
FaceName
,
defSans
);
strcpyW
(
lf
.
lf
FaceName
,
defSans
);
for
(
family
=
FontList
;
family
;
family
=
family
->
next
)
{
if
(
!
strcmpiW
(
family
->
FamilyName
,
FaceName
))
if
(
!
strcmpiW
(
family
->
FamilyName
,
lf
.
lf
FaceName
))
break
;
}
}
...
...
@@ -883,8 +879,8 @@ not_found:
FIXME
(
"just using first face for now
\n
"
);
}
it
=
plf
->
lfItalic
?
1
:
0
;
bd
=
plf
->
lfWeight
>
550
?
1
:
0
;
it
=
lf
.
lfItalic
?
1
:
0
;
bd
=
lf
.
lfWeight
>
550
?
1
:
0
;
for
(
face
=
family
->
FirstFace
;
face
;
face
=
face
->
next
)
{
if
(
!
(
face
->
Italic
^
it
)
&&
!
(
face
->
Bold
^
bd
))
...
...
@@ -895,24 +891,22 @@ not_found:
if
(
it
&&
!
face
->
Italic
)
ret
->
fake_italic
=
TRUE
;
if
(
bd
&&
!
face
->
Bold
)
ret
->
fake_bold
=
TRUE
;
}
ret
->
charset
=
get_nearest_charset
(
face
,
plf
->
lfCharSet
);
ret
->
charset
=
get_nearest_charset
(
face
,
lf
.
lfCharSet
);
TRACE
(
"Choosen %s %s
\n
"
,
debugstr_w
(
family
->
FamilyName
),
debugstr_w
(
face
->
StyleName
));
ret
->
ft_face
=
OpenFontFile
(
ret
,
face
->
file
,
INTERNAL_YWSTODS
(
dc
,
plf
->
lfHeight
));
INTERNAL_YWSTODS
(
dc
,
lf
.
lfHeight
));
if
(
!
ret
->
ft_face
)
{
GDI_ReleaseObj
(
hfont
);
free_font
(
ret
);
return
0
;
}
if
(
ret
->
charset
==
SYMBOL_CHARSET
)
pFT_Select_Charmap
(
ret
->
ft_face
,
ft_encoding_symbol
);
ret
->
orientation
=
plf
->
lfOrientation
;
GDI_ReleaseObj
(
hfont
);
ret
->
orientation
=
lf
.
lfOrientation
;
TRACE
(
"caching: gdiFont=%p hfont=%x
\n
"
,
ret
,
hfont
);
ret
->
hfont
=
hfont
;
...
...
@@ -928,11 +922,10 @@ static void DumpGdiFontList(void)
TRACE
(
"---------- gdiFont Cache ----------
\n
"
);
for
(
gdiFont
=
GdiFontList
;
gdiFont
;
gdiFont
=
gdiFont
->
next
)
{
FONTOBJ
*
font
=
GDI_GetObjPtr
(
gdiFont
->
hfont
,
FONT_MAGIC
)
;
LOGFONTW
*
plf
=
&
font
->
logfont
;
LOGFONTW
lf
;
GetObjectW
(
gdiFont
->
hfont
,
sizeof
(
lf
),
&
lf
)
;
TRACE
(
"gdiFont=%p hfont=%x (%s)
\n
"
,
gdiFont
,
gdiFont
->
hfont
,
debugstr_w
(
plf
->
lfFaceName
));
GDI_ReleaseObj
(
gdiFont
->
hfont
);
gdiFont
,
gdiFont
->
hfont
,
debugstr_w
(
lf
.
lfFaceName
));
}
}
...
...
@@ -1867,4 +1860,3 @@ DWORD WineEngGetFontData(GdiFont font, DWORD table, DWORD offset, LPVOID buf,
return
GDI_ERROR
;
}
#endif
/* HAVE_FREETYPE */
dlls/gdi/mfdrv/init.c
View file @
78b041cf
...
...
@@ -21,7 +21,6 @@
#include "windef.h"
#include "wine/winbase16.h"
#include "gdi.h"
#include "metafile.h"
#include "mfdrv/metafiledrv.h"
#include "wine/debug.h"
...
...
graphics/x11drv/xfont.c
View file @
78b041cf
...
...
@@ -66,6 +66,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(font);
#define REMOVE_SUBSETS 1
#define UNMARK_SUBSETS 0
#define FONTCACHE 32
/* dynamic font cache size */
#define FF_FAMILY (FF_MODERN | FF_SWISS | FF_ROMAN | FF_DECORATIVE | FF_SCRIPT)
...
...
include/font.h
View file @
78b041cf
...
...
@@ -23,52 +23,6 @@
#include "gdi.h"
#include "pshpack1.h"
/* GDI logical font object */
typedef
struct
{
GDIOBJHDR
header
;
LOGFONTW
logfont
;
}
FONTOBJ
;
typedef
struct
{
WORD
dfVersion
;
DWORD
dfSize
;
CHAR
dfCopyright
[
60
];
WORD
dfType
;
WORD
dfPoints
;
WORD
dfVertRes
;
WORD
dfHorizRes
;
WORD
dfAscent
;
WORD
dfInternalLeading
;
WORD
dfExternalLeading
;
BYTE
dfItalic
;
BYTE
dfUnderline
;
BYTE
dfStrikeOut
;
WORD
dfWeight
;
BYTE
dfCharSet
;
WORD
dfPixWidth
;
WORD
dfPixHeight
;
BYTE
dfPitchAndFamily
;
WORD
dfAvgWidth
;
WORD
dfMaxWidth
;
BYTE
dfFirstChar
;
BYTE
dfLastChar
;
BYTE
dfDefaultChar
;
BYTE
dfBreakChar
;
WORD
dfWidthBytes
;
DWORD
dfDevice
;
DWORD
dfFace
;
DWORD
dfReserved
;
CHAR
szDeviceName
[
60
];
/* FIXME: length unknown */
CHAR
szFaceName
[
60
];
/* dito */
}
FONTDIR16
,
*
LPFONTDIR16
;
#include "poppack.h"
#define FONTCACHE 32
/* dynamic font cache size */
extern
BOOL
FONT_Init
(
UINT16
*
pTextCaps
);
extern
void
FONT_LogFontATo16
(
const
LOGFONTA
*
font32
,
LPLOGFONT16
font16
);
extern
void
FONT_LogFontWTo16
(
const
LOGFONTW
*
font32
,
LPLOGFONT16
font16
);
...
...
include/gdi.h
View file @
78b041cf
...
...
@@ -283,6 +283,14 @@ typedef struct tagDC_FUNCS
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
/* Metafile defines */
#define META_EOF 0x0000
/* values of mtType in METAHEADER. Note however that the disk image of a disk
based metafile has mtType == 1 */
#define METAFILE_MEMORY 1
#define METAFILE_DISK 2
/* Device <-> logical coords conversion */
/* A floating point version of the POINT structure */
...
...
@@ -595,12 +603,17 @@ extern DC * DC_GetDCUpdate( HDC hdc );
extern
void
DC_InitDC
(
DC
*
dc
);
extern
void
DC_UpdateXforms
(
DC
*
dc
);
/*
objects/
clipping.c */
/* clipping.c */
extern
void
CLIPPING_UpdateGCRegion
(
DC
*
dc
);
/*
objects/
enhmetafile.c */
/* enhmetafile.c */
extern
HENHMETAFILE
EMF_Create_HENHMETAFILE
(
ENHMETAHEADER
*
emh
,
BOOL
on_disk
);
/* metafile.c */
extern
HMETAFILE
MF_Create_HMETAFILE
(
METAHEADER
*
mh
);
extern
HMETAFILE16
MF_Create_HMETAFILE16
(
METAHEADER
*
mh
);
extern
METAHEADER
*
MF_CreateMetaHeaderDisk
(
METAHEADER
*
mr
,
LPCSTR
filename
);
/* region.c */
extern
HRGN
REGION_CropRgn
(
HRGN
hDst
,
HRGN
hSrc
,
const
RECT
*
lpRect
,
const
POINT
*
lpPt
);
extern
BOOL
REGION_FrameRgn
(
HRGN
dest
,
HRGN
src
,
INT
x
,
INT
y
);
...
...
include/metafile.h
deleted
100644 → 0
View file @
c6476e90
/*
* Metafile definitions
*
* Copyright David W. Metcalfe, 1994
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_METAFILE_H
#define __WINE_METAFILE_H
#include "gdi.h"
#include "windef.h"
#include "wingdi.h"
/* GDI32 metafile object */
typedef
struct
{
GDIOBJHDR
header
;
METAHEADER
*
mh
;
}
METAFILEOBJ
;
#define META_EOF 0x0000
/* values of mtType in METAHEADER. Note however that the disk image of a disk
based metafile has mtType == 1 */
#define METAFILE_MEMORY 1
#define METAFILE_DISK 2
extern
HMETAFILE
MF_Create_HMETAFILE
(
METAHEADER
*
mh
);
extern
HMETAFILE16
MF_Create_HMETAFILE16
(
METAHEADER
*
mh
);
extern
METAHEADER
*
MF_CreateMetaHeaderDisk
(
METAHEADER
*
mr
,
LPCSTR
filename
);
#endif
/* __WINE_METAFILE_H */
include/wine/wingdi16.h
View file @
78b041cf
...
...
@@ -140,6 +140,39 @@ typedef struct
LONG
dfReserved1
[
4
];
}
FONTINFO16
,
*
LPFONTINFO16
;
typedef
struct
{
WORD
dfVersion
;
DWORD
dfSize
;
CHAR
dfCopyright
[
60
];
WORD
dfType
;
WORD
dfPoints
;
WORD
dfVertRes
;
WORD
dfHorizRes
;
WORD
dfAscent
;
WORD
dfInternalLeading
;
WORD
dfExternalLeading
;
BYTE
dfItalic
;
BYTE
dfUnderline
;
BYTE
dfStrikeOut
;
WORD
dfWeight
;
BYTE
dfCharSet
;
WORD
dfPixWidth
;
WORD
dfPixHeight
;
BYTE
dfPitchAndFamily
;
WORD
dfAvgWidth
;
WORD
dfMaxWidth
;
BYTE
dfFirstChar
;
BYTE
dfLastChar
;
BYTE
dfDefaultChar
;
BYTE
dfBreakChar
;
WORD
dfWidthBytes
;
DWORD
dfDevice
;
DWORD
dfFace
;
DWORD
dfReserved
;
CHAR
szDeviceName
[
60
];
/* FIXME: length unknown */
CHAR
szFaceName
[
60
];
/* dito */
}
FONTDIR16
,
*
LPFONTDIR16
;
typedef
struct
{
INT16
tmHeight
;
...
...
objects/enhmetafile.c
View file @
78b041cf
...
...
@@ -40,8 +40,8 @@
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "gdi.h"
#include "wine/debug.h"
#include "metafile.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
enhmetafile
);
...
...
@@ -2189,6 +2189,3 @@ error:
return
0
;
}
objects/font.c
View file @
78b041cf
...
...
@@ -53,6 +53,12 @@ static const struct gdi_obj_funcs font_funcs =
typedef
struct
{
GDIOBJHDR
header
;
LOGFONTW
logfont
;
}
FONTOBJ
;
typedef
struct
{
LPLOGFONT16
lpLogFontParam
;
FONTENUMPROCEX16
lpEnumFunc
;
LPARAM
lpData
;
...
...
objects/metafile.c
View file @
78b041cf
...
...
@@ -52,8 +52,6 @@
#include "wine/wingdi16.h"
#include "bitmap.h"
#include "global.h"
#include "metafile.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
metafile
);
...
...
@@ -67,6 +65,12 @@ typedef struct
}
METAHEADERDISK
;
#include "poppack.h"
typedef
struct
{
GDIOBJHDR
header
;
METAHEADER
*
mh
;
}
METAFILEOBJ
;
#define MFHEADERSIZE (sizeof(METAHEADER))
#define MFVERSION 0x300
...
...
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