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
4ce3af3f
Commit
4ce3af3f
authored
Dec 02, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Dec 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add support for checking the font's gasp flags.
parent
225de02a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
1 deletion
+74
-1
font.c
dlls/gdi32/font.c
+74
-1
No files found.
dlls/gdi32/font.c
View file @
4ce3af3f
...
...
@@ -32,11 +32,18 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winternl.h"
#include "gdi_private.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#ifdef WORDS_BIGENDIAN
#define get_be_word(x) (x)
#else
#define get_be_word(x) RtlUshortByteSwap(x)
#endif
WINE_DEFAULT_DEBUG_CHANNEL
(
font
);
/* Device -> World size conversion */
...
...
@@ -258,10 +265,73 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC
memcpy
(
&
ptmA
->
ntmFontSig
,
&
ptmW
->
ntmFontSig
,
sizeof
(
FONTSIGNATURE
));
}
static
DWORD
get_font_ppem
(
HDC
hdc
)
{
TEXTMETRICW
tm
;
DWORD
ppem
;
DC
*
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
GDI_ERROR
;
GetTextMetricsW
(
hdc
,
&
tm
);
ppem
=
abs
(
INTERNAL_YWSTODS
(
dc
,
tm
.
tmAscent
+
tm
.
tmDescent
-
tm
.
tmInternalLeading
)
);
release_dc_ptr
(
dc
);
return
ppem
;
}
#define GASP_GRIDFIT 0x01
#define GASP_DOGRAY 0x02
static
BOOL
get_gasp_flags
(
HDC
hdc
,
WORD
*
flags
)
{
DWORD
size
,
gasp_tag
=
0x70736167
;
WORD
buf
[
16
];
/* Enough for seven ranges before we need to alloc */
WORD
*
alloced
=
NULL
,
*
ptr
=
buf
;
WORD
num_recs
,
version
;
DWORD
ppem
=
get_font_ppem
(
hdc
);
BOOL
ret
=
FALSE
;
*
flags
=
0
;
if
(
ppem
==
GDI_ERROR
)
return
FALSE
;
size
=
GetFontData
(
hdc
,
gasp_tag
,
0
,
NULL
,
0
);
if
(
size
==
GDI_ERROR
)
return
FALSE
;
if
(
size
<
4
*
sizeof
(
WORD
))
return
FALSE
;
if
(
size
>
sizeof
(
buf
))
{
ptr
=
alloced
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
ptr
)
return
FALSE
;
}
GetFontData
(
hdc
,
gasp_tag
,
0
,
ptr
,
size
);
version
=
get_be_word
(
*
ptr
++
);
num_recs
=
get_be_word
(
*
ptr
++
);
if
(
version
>
1
||
size
<
(
num_recs
*
2
+
2
)
*
sizeof
(
WORD
))
{
FIXME
(
"Unsupported gasp table: ver %d size %d recs %d
\n
"
,
version
,
size
,
num_recs
);
goto
done
;
}
while
(
num_recs
--
)
{
*
flags
=
get_be_word
(
*
(
ptr
+
1
)
);
if
(
ppem
<=
get_be_word
(
*
ptr
))
break
;
ptr
+=
2
;
}
TRACE
(
"got flags %04x for ppem %d
\n
"
,
*
flags
,
ppem
);
ret
=
TRUE
;
done:
HeapFree
(
GetProcessHeap
(),
0
,
alloced
);
return
ret
;
}
UINT
get_font_aa_flags
(
HDC
hdc
)
{
LOGFONTW
lf
;
WORD
gasp_flags
;
if
(
GetObjectType
(
hdc
)
==
OBJ_MEMDC
)
{
...
...
@@ -274,7 +344,10 @@ UINT get_font_aa_flags( HDC hdc )
GetObjectW
(
GetCurrentObject
(
hdc
,
OBJ_FONT
),
sizeof
(
lf
),
&
lf
);
if
(
lf
.
lfQuality
==
NONANTIALIASED_QUALITY
)
return
GGO_BITMAP
;
/* FIXME, check gasp and user prefs */
if
(
get_gasp_flags
(
hdc
,
&
gasp_flags
)
&&
!
(
gasp_flags
&
GASP_DOGRAY
))
return
GGO_BITMAP
;
/* FIXME, check user prefs */
return
GGO_GRAY4_BITMAP
;
}
...
...
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