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
3b87839e
Commit
3b87839e
authored
Nov 04, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the rest of the font matching code out of freetype.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4cddf0d4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
61 deletions
+63
-61
font.c
dlls/gdi32/font.c
+57
-3
freetype.c
dlls/gdi32/freetype.c
+4
-54
gdi_private.h
dlls/gdi32/gdi_private.h
+2
-4
No files found.
dlls/gdi32/font.c
View file @
3b87839e
...
...
@@ -1461,8 +1461,9 @@ static struct gdi_font_face *find_best_matching_face( const struct gdi_font_fami
return
best
->
scalable
?
best
:
best_bitmap
;
}
struct
gdi_font_face
*
find_matching_face_by_name
(
const
WCHAR
*
name
,
const
WCHAR
*
subst
,
const
LOGFONTW
*
lf
,
FONTSIGNATURE
fs
,
BOOL
can_use_bitmap
)
static
struct
gdi_font_face
*
find_matching_face_by_name
(
const
WCHAR
*
name
,
const
WCHAR
*
subst
,
const
LOGFONTW
*
lf
,
FONTSIGNATURE
fs
,
BOOL
can_use_bitmap
)
{
struct
gdi_font_family
*
family
;
struct
gdi_font_face
*
face
;
...
...
@@ -1489,7 +1490,7 @@ struct gdi_font_face *find_matching_face_by_name( const WCHAR *name, const WCHAR
return
NULL
;
}
struct
gdi_font_face
*
find_any_face
(
const
LOGFONTW
*
lf
,
FONTSIGNATURE
fs
,
st
atic
st
ruct
gdi_font_face
*
find_any_face
(
const
LOGFONTW
*
lf
,
FONTSIGNATURE
fs
,
BOOL
can_use_bitmap
,
BOOL
want_vertical
)
{
struct
gdi_font_family
*
family
;
...
...
@@ -1524,6 +1525,59 @@ struct gdi_font_face *find_any_face( const LOGFONTW *lf, FONTSIGNATURE fs,
return
NULL
;
}
struct
gdi_font_face
*
find_matching_face
(
LOGFONTW
*
lf
,
CHARSETINFO
*
csi
,
BOOL
can_use_bitmap
,
const
WCHAR
**
orig_name
)
{
BOOL
want_vertical
=
(
lf
->
lfFaceName
[
0
]
==
'@'
);
struct
gdi_font_face
*
face
;
if
(
!
TranslateCharsetInfo
(
(
DWORD
*
)(
INT_PTR
)
lf
->
lfCharSet
,
csi
,
TCI_SRCCHARSET
))
{
if
(
lf
->
lfCharSet
!=
DEFAULT_CHARSET
)
FIXME
(
"Untranslated charset %d
\n
"
,
lf
->
lfCharSet
);
csi
->
fs
.
fsCsb
[
0
]
=
0
;
}
if
(
lf
->
lfFaceName
[
0
])
{
int
subst_charset
;
const
WCHAR
*
subst
=
get_gdi_font_subst
(
lf
->
lfFaceName
,
lf
->
lfCharSet
,
&
subst_charset
);
if
(
subst
)
{
TRACE
(
"substituting %s,%d -> %s,%d
\n
"
,
debugstr_w
(
lf
->
lfFaceName
),
lf
->
lfCharSet
,
debugstr_w
(
subst
),
(
subst_charset
!=
-
1
)
?
subst_charset
:
lf
->
lfCharSet
);
if
(
subst_charset
!=
-
1
)
lf
->
lfCharSet
=
subst_charset
;
*
orig_name
=
lf
->
lfFaceName
;
}
if
((
face
=
find_matching_face_by_name
(
lf
->
lfFaceName
,
subst
,
lf
,
csi
->
fs
,
can_use_bitmap
)))
return
face
;
}
*
orig_name
=
NULL
;
/* substitution is no longer relevant */
/* If requested charset was DEFAULT_CHARSET then try using charset
corresponding to the current ansi codepage */
if
(
!
csi
->
fs
.
fsCsb
[
0
])
{
INT
acp
=
GetACP
();
if
(
!
TranslateCharsetInfo
(
(
DWORD
*
)(
INT_PTR
)
acp
,
csi
,
TCI_SRCCODEPAGE
))
{
FIXME
(
"TCI failed on codepage %d
\n
"
,
acp
);
csi
->
fs
.
fsCsb
[
0
]
=
0
;
}
else
lf
->
lfCharSet
=
csi
->
ciCharset
;
}
if
((
face
=
find_any_face
(
lf
,
csi
->
fs
,
can_use_bitmap
,
want_vertical
)))
return
face
;
if
(
csi
->
fs
.
fsCsb
[
0
])
{
csi
->
fs
.
fsCsb
[
0
]
=
0
;
if
((
face
=
find_any_face
(
lf
,
csi
->
fs
,
can_use_bitmap
,
want_vertical
)))
return
face
;
}
if
(
want_vertical
&&
(
face
=
find_any_face
(
lf
,
csi
->
fs
,
can_use_bitmap
,
FALSE
)))
return
face
;
return
NULL
;
}
/* realized font objects */
#define FIRST_FONT_HANDLE 1
...
...
dlls/gdi32/freetype.c
View file @
3b87839e
...
...
@@ -2217,9 +2217,8 @@ static struct gdi_font * CDECL freetype_SelectFont( DC *dc, HFONT hfont )
{
struct
gdi_font
*
font
;
Face
*
face
;
Family
*
family
;
INT
height
;
BOOL
can_use_bitmap
,
want_vertical
;
BOOL
can_use_bitmap
;
LOGFONTW
lf
;
CHARSETINFO
csi
;
FMAT2
dcmat
;
...
...
@@ -2279,61 +2278,12 @@ static struct gdi_font * CDECL freetype_SelectFont( DC *dc, HFONT hfont )
if
(
!
strcmpiW
(
lf
.
lfFaceName
,
SymbolW
))
lf
.
lfCharSet
=
SYMBOL_CHARSET
;
if
(
!
TranslateCharsetInfo
((
DWORD
*
)(
INT_PTR
)
lf
.
lfCharSet
,
&
csi
,
TCI_SRCCHARSET
))
{
switch
(
lf
.
lfCharSet
)
{
case
DEFAULT_CHARSET
:
csi
.
fs
.
fsCsb
[
0
]
=
0
;
break
;
default:
FIXME
(
"Untranslated charset %d
\n
"
,
lf
.
lfCharSet
);
csi
.
fs
.
fsCsb
[
0
]
=
0
;
break
;
}
}
family
=
NULL
;
if
(
lf
.
lfFaceName
[
0
]
!=
'\0'
)
{
LPWSTR
FaceName
=
lf
.
lfFaceName
;
int
subst_charset
;
const
WCHAR
*
subst
=
get_gdi_font_subst
(
FaceName
,
lf
.
lfCharSet
,
&
subst_charset
);
if
(
subst
)
{
TRACE
(
"substituting %s,%d -> %s,%d
\n
"
,
debugstr_w
(
FaceName
),
lf
.
lfCharSet
,
debugstr_w
(
subst
),
(
subst_charset
!=
-
1
)
?
subst_charset
:
lf
.
lfCharSet
);
if
(
subst_charset
!=
-
1
)
lf
.
lfCharSet
=
subst_charset
;
orig_name
=
FaceName
;
}
if
((
face
=
find_matching_face_by_name
(
FaceName
,
subst
,
&
lf
,
csi
.
fs
,
can_use_bitmap
)))
goto
found_face
;
}
orig_name
=
NULL
;
/* substitution is no longer relevant */
/* If requested charset was DEFAULT_CHARSET then try using charset
corresponding to the current ansi codepage */
if
(
!
csi
.
fs
.
fsCsb
[
0
])
if
(
!
(
face
=
find_matching_face
(
&
lf
,
&
csi
,
can_use_bitmap
,
&
orig_name
)))
{
INT
acp
=
GetACP
();
if
(
!
TranslateCharsetInfo
((
DWORD
*
)(
INT_PTR
)
acp
,
&
csi
,
TCI_SRCCODEPAGE
))
{
FIXME
(
"TCI failed on codepage %d
\n
"
,
acp
);
csi
.
fs
.
fsCsb
[
0
]
=
0
;
}
else
lf
.
lfCharSet
=
csi
.
ciCharset
;
}
want_vertical
=
(
lf
.
lfFaceName
[
0
]
==
'@'
);
if
((
face
=
find_any_face
(
&
lf
,
csi
.
fs
,
can_use_bitmap
,
want_vertical
)))
goto
found_face
;
csi
.
fs
.
fsCsb
[
0
]
=
0
;
if
((
face
=
find_any_face
(
&
lf
,
csi
.
fs
,
can_use_bitmap
,
want_vertical
)))
goto
found_face
;
if
(
want_vertical
&&
(
face
=
find_any_face
(
&
lf
,
csi
.
fs
,
can_use_bitmap
,
FALSE
)))
goto
found_face
;
FIXME
(
"can't find a single appropriate font - bailing
\n
"
);
return
NULL
;
found_face:
}
height
=
lf
.
lfHeight
;
family
=
face
->
family
;
TRACE
(
"not in cache
\n
"
);
font
=
create_gdi_font
(
face
,
orig_name
,
&
lf
);
...
...
@@ -2345,7 +2295,7 @@ found_face:
font
->
codepage
=
csi
.
ciACP
;
}
else
font
->
charset
=
get_nearest_charset
(
family
->
family_name
,
face
,
&
font
->
codepage
);
font
->
charset
=
get_nearest_charset
(
fa
ce
->
fa
mily
->
family_name
,
face
,
&
font
->
codepage
);
TRACE
(
"Chosen: %s (%s/%p:%u)
\n
"
,
debugstr_w
(
face
->
full_name
),
debugstr_w
(
face
->
file
),
face
->
data_ptr
,
face
->
face_index
);
...
...
dlls/gdi32/gdi_private.h
View file @
3b87839e
...
...
@@ -459,10 +459,8 @@ extern int add_gdi_face( const WCHAR *family_name, const WCHAR *second_name,
extern
struct
gdi_font_link
*
find_gdi_font_link
(
const
WCHAR
*
name
)
DECLSPEC_HIDDEN
;
extern
void
create_child_font_list
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font_face
*
find_matching_face_by_name
(
const
WCHAR
*
name
,
const
WCHAR
*
subst
,
const
LOGFONTW
*
lf
,
FONTSIGNATURE
fs
,
BOOL
can_use_bitmap
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font_face
*
find_any_face
(
const
LOGFONTW
*
lf
,
FONTSIGNATURE
fs
,
BOOL
can_use_bitmap
,
BOOL
want_vertical
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font_face
*
find_matching_face
(
LOGFONTW
*
lf
,
CHARSETINFO
*
csi
,
BOOL
can_use_bitmap
,
const
WCHAR
**
orig_name
)
DECLSPEC_HIDDEN
;
extern
void
free_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
cache_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
...
...
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