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
5bdc6e0f
Commit
5bdc6e0f
authored
Oct 22, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the GetGlyphIndices() implementation out of freetype.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2d15ea50
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
71 deletions
+76
-71
font.c
dlls/gdi32/font.c
+41
-3
freetype.c
dlls/gdi32/freetype.c
+33
-67
gdi_private.h
dlls/gdi32/gdi_private.h
+2
-1
No files found.
dlls/gdi32/font.c
View file @
5bdc6e0f
...
@@ -1103,17 +1103,55 @@ static DWORD CDECL font_GetFontUnicodeRanges( PHYSDEV dev, GLYPHSET *glyphset )
...
@@ -1103,17 +1103,55 @@ static DWORD CDECL font_GetFontUnicodeRanges( PHYSDEV dev, GLYPHSET *glyphset )
static
DWORD
CDECL
font_GetGlyphIndices
(
PHYSDEV
dev
,
const
WCHAR
*
str
,
INT
count
,
WORD
*
gi
,
DWORD
flags
)
static
DWORD
CDECL
font_GetGlyphIndices
(
PHYSDEV
dev
,
const
WCHAR
*
str
,
INT
count
,
WORD
*
gi
,
DWORD
flags
)
{
{
struct
font_physdev
*
physdev
=
get_font_dev
(
dev
);
struct
font_physdev
*
physdev
=
get_font_dev
(
dev
);
DWORD
ret
;
UINT
default_char
;
char
ch
;
BOOL
used
,
got_default
=
FALSE
;
int
i
;
if
(
!
physdev
->
font
)
if
(
!
physdev
->
font
)
{
{
dev
=
GET_NEXT_PHYSDEV
(
dev
,
pGetGlyphIndices
);
dev
=
GET_NEXT_PHYSDEV
(
dev
,
pGetGlyphIndices
);
return
dev
->
funcs
->
pGetGlyphIndices
(
dev
,
str
,
count
,
gi
,
flags
);
return
dev
->
funcs
->
pGetGlyphIndices
(
dev
,
str
,
count
,
gi
,
flags
);
}
}
if
(
flags
&
GGI_MARK_NONEXISTING_GLYPHS
)
{
default_char
=
0xffff
;
/* XP would use 0x1f for bitmap fonts */
got_default
=
TRUE
;
}
EnterCriticalSection
(
&
font_cs
);
EnterCriticalSection
(
&
font_cs
);
ret
=
font_funcs
->
pGetGlyphIndices
(
physdev
->
font
,
str
,
count
,
gi
,
flags
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
UINT
glyph
=
str
[
i
];
if
(
!
font_funcs
->
get_glyph_index
(
physdev
->
font
,
&
glyph
))
{
glyph
=
0
;
if
(
physdev
->
font
->
codepage
==
CP_SYMBOL
)
{
if
(
str
[
i
]
>=
0xf020
&&
str
[
i
]
<=
0xf100
)
glyph
=
str
[
i
]
-
0xf000
;
else
if
(
str
[
i
]
<
0x100
)
glyph
=
str
[
i
];
}
else
if
(
WideCharToMultiByte
(
physdev
->
font
->
codepage
,
0
,
&
str
[
i
],
1
,
&
ch
,
1
,
NULL
,
&
used
)
&&
!
used
)
glyph
=
(
unsigned
char
)
ch
;
}
if
(
!
glyph
)
{
if
(
!
got_default
)
{
default_char
=
font_funcs
->
get_default_glyph
(
physdev
->
font
);
got_default
=
TRUE
;
}
glyph
=
default_char
;
}
gi
[
i
]
=
glyph
;
}
LeaveCriticalSection
(
&
font_cs
);
LeaveCriticalSection
(
&
font_cs
);
return
re
t
;
return
coun
t
;
}
}
...
...
dlls/gdi32/freetype.c
View file @
5bdc6e0f
...
@@ -5661,89 +5661,54 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
...
@@ -5661,89 +5661,54 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
return
pFT_Get_Char_Index
(
font
->
ft_face
,
glyph
);
return
pFT_Get_Char_Index
(
font
->
ft_face
,
glyph
);
}
}
/* helper for freetype_GetGlyphIndices */
/*************************************************************
static
FT_UInt
get_gdi_glyph_index
(
const
GdiFont
*
font
,
UINT
glyph
)
* freetype_get_glyph_index
*/
static
BOOL
CDECL
freetype_get_glyph_index
(
struct
gdi_font
*
gdi_font
,
UINT
*
glyph
)
{
{
struct
gdi_font
*
gdi_font
=
font
->
gdi_font
;
GdiFont
*
font
=
get_font_ptr
(
gdi_font
);
WCHAR
wc
=
(
WCHAR
)
glyph
;
BOOL
default_used
=
FALSE
;
BOOL
*
default_used_pointer
=
NULL
;
FT_UInt
ret
;
char
buf
;
if
(
font
->
ft_face
->
charmap
->
encoding
!=
FT_ENCODING_NONE
)
if
(
font
->
ft_face
->
charmap
->
encoding
==
FT_ENCODING_NONE
)
return
FALSE
;
return
get_glyph_index
(
font
,
glyph
);
if
(
codepage_sets_default_used
(
gdi_font
->
codepage
))
if
(
font
->
ft_face
->
charmap
->
encoding
==
FT_ENCODING_MS_SYMBOL
)
default_used_pointer
=
&
default_used
;
if
(
!
WideCharToMultiByte
(
gdi_font
->
codepage
,
0
,
&
wc
,
1
,
&
buf
,
sizeof
(
buf
),
NULL
,
default_used_pointer
)
||
default_used
)
{
{
if
(
gdi_font
->
codepage
==
CP_SYMBOL
&&
wc
<
0x100
)
if
(
!
(
*
glyph
=
get_glyph_index_symbol
(
font
,
*
glyph
)))
ret
=
(
unsigned
char
)
wc
;
{
else
WCHAR
wc
=
*
glyph
;
ret
=
0
;
char
ch
;
}
else
ret
=
(
unsigned
char
)
buf
;
TRACE
(
"%04x (%02x) -> ret %d def_used %d
\n
"
,
glyph
,
(
unsigned
char
)
buf
,
ret
,
default_used
);
return
ret
;
}
static
FT_UInt
get_default_char_index
(
GdiFont
*
font
)
{
FT_UInt
default_char
;
if
(
FT_IS_SFNT
(
font
->
ft_face
))
if
(
WideCharToMultiByte
(
CP_ACP
,
0
,
&
wc
,
1
,
&
ch
,
1
,
NULL
,
NULL
))
{
*
glyph
=
get_glyph_index_symbol
(
font
,
(
unsigned
char
)
ch
);
TT_OS2
*
pOS2
=
pFT_Get_Sfnt_Table
(
font
->
ft_face
,
ft_sfnt_os2
);
}
default_char
=
(
pOS2
->
usDefaultChar
?
get_glyph_index
(
font
,
pOS2
->
usDefaultChar
)
:
0
);
return
TRUE
;
}
else
{
TEXTMETRICW
textm
;
get_text_metrics
(
font
,
&
textm
);
default_char
=
textm
.
tmDefaultChar
;
}
}
return
default_char
;
if
((
*
glyph
=
pFT_Get_Char_Index
(
font
->
ft_face
,
*
glyph
)))
*
glyph
=
get_GSUB_vert_glyph
(
font
,
*
glyph
);
return
TRUE
;
}
}
/*************************************************************
/*************************************************************
* freetype_
GetGlyphIndices
* freetype_
get_default_glyph
*/
*/
static
DWORD
CDECL
freetype_GetGlyphIndices
(
struct
gdi_font
*
gdi_font
,
LPCWSTR
lpstr
,
static
UINT
CDECL
freetype_get_default_glyph
(
struct
gdi_font
*
gdi_font
)
INT
count
,
LPWORD
pgi
,
DWORD
flags
)
{
{
GdiFont
*
font
=
get_font_ptr
(
gdi_font
);
GdiFont
*
font
=
get_font_ptr
(
gdi_font
);
int
i
;
FT_WinFNT_HeaderRec
winfnt
;
WORD
default_char
;
TT_OS2
*
pOS2
;
BOOL
got_default
=
FALSE
;
if
(
flags
&
GGI_MARK_NONEXISTING_GLYPHS
)
{
default_char
=
0xffff
;
/* XP would use 0x1f for bitmap fonts */
got_default
=
TRUE
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
if
((
pOS2
=
pFT_Get_Sfnt_Table
(
font
->
ft_face
,
ft_sfnt_os2
))
)
{
{
pgi
[
i
]
=
get_gdi_glyph_index
(
font
,
lpstr
[
i
]);
UINT
glyph
=
pOS2
->
usDefaultChar
;
if
(
pgi
[
i
]
==
0
)
freetype_get_glyph_index
(
gdi_font
,
&
glyph
);
{
return
glyph
;
if
(
!
got_default
)
{
default_char
=
get_default_char_index
(
font
);
got_default
=
TRUE
;
}
pgi
[
i
]
=
default_char
;
}
else
pgi
[
i
]
=
get_GSUB_vert_glyph
(
font
,
pgi
[
i
]);
}
}
return
count
;
if
(
!
pFT_Get_WinFNT_Header
(
font
->
ft_face
,
&
winfnt
))
return
winfnt
.
default_char
+
winfnt
.
first_char
;
return
32
;
}
}
static
inline
BOOL
is_identity_FMAT2
(
const
FMAT2
*
matrix
)
static
inline
BOOL
is_identity_FMAT2
(
const
FMAT2
*
matrix
)
{
{
static
const
FMAT2
identity
=
{
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
};
static
const
FMAT2
identity
=
{
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
};
...
@@ -7838,7 +7803,6 @@ static const struct font_backend_funcs font_funcs =
...
@@ -7838,7 +7803,6 @@ static const struct font_backend_funcs font_funcs =
freetype_FontIsLinked
,
freetype_FontIsLinked
,
freetype_GetCharWidthInfo
,
freetype_GetCharWidthInfo
,
freetype_GetFontUnicodeRanges
,
freetype_GetFontUnicodeRanges
,
freetype_GetGlyphIndices
,
freetype_GetKerningPairs
,
freetype_GetKerningPairs
,
freetype_GetOutlineTextMetrics
,
freetype_GetOutlineTextMetrics
,
freetype_GetTextMetrics
,
freetype_GetTextMetrics
,
...
@@ -7849,6 +7813,8 @@ static const struct font_backend_funcs font_funcs =
...
@@ -7849,6 +7813,8 @@ static const struct font_backend_funcs font_funcs =
freetype_CreateScalableFontResource
,
freetype_CreateScalableFontResource
,
freetype_alloc_font
,
freetype_alloc_font
,
freetype_get_font_data
,
freetype_get_font_data
,
freetype_get_glyph_index
,
freetype_get_default_glyph
,
freetype_get_glyph_outline
,
freetype_get_glyph_outline
,
freetype_destroy_font
freetype_destroy_font
};
};
...
...
dlls/gdi32/gdi_private.h
View file @
5bdc6e0f
...
@@ -356,7 +356,6 @@ struct font_backend_funcs
...
@@ -356,7 +356,6 @@ struct font_backend_funcs
BOOL
(
CDECL
*
pFontIsLinked
)(
struct
gdi_font
*
font
);
BOOL
(
CDECL
*
pFontIsLinked
)(
struct
gdi_font
*
font
);
BOOL
(
CDECL
*
pGetCharWidthInfo
)(
struct
gdi_font
*
font
,
struct
char_width_info
*
info
);
BOOL
(
CDECL
*
pGetCharWidthInfo
)(
struct
gdi_font
*
font
,
struct
char_width_info
*
info
);
DWORD
(
CDECL
*
pGetFontUnicodeRanges
)(
struct
gdi_font
*
font
,
GLYPHSET
*
glyphset
);
DWORD
(
CDECL
*
pGetFontUnicodeRanges
)(
struct
gdi_font
*
font
,
GLYPHSET
*
glyphset
);
DWORD
(
CDECL
*
pGetGlyphIndices
)(
struct
gdi_font
*
font
,
const
WCHAR
*
str
,
INT
count
,
WORD
*
gi
,
DWORD
flags
);
DWORD
(
CDECL
*
pGetKerningPairs
)(
struct
gdi_font
*
font
,
DWORD
count
,
KERNINGPAIR
*
pairs
);
DWORD
(
CDECL
*
pGetKerningPairs
)(
struct
gdi_font
*
font
,
DWORD
count
,
KERNINGPAIR
*
pairs
);
UINT
(
CDECL
*
pGetOutlineTextMetrics
)(
struct
gdi_font
*
font
,
UINT
size
,
OUTLINETEXTMETRICW
*
metrics
);
UINT
(
CDECL
*
pGetOutlineTextMetrics
)(
struct
gdi_font
*
font
,
UINT
size
,
OUTLINETEXTMETRICW
*
metrics
);
BOOL
(
CDECL
*
pGetTextMetrics
)(
struct
gdi_font
*
font
,
TEXTMETRICW
*
metrics
);
BOOL
(
CDECL
*
pGetTextMetrics
)(
struct
gdi_font
*
font
,
TEXTMETRICW
*
metrics
);
...
@@ -371,6 +370,8 @@ struct font_backend_funcs
...
@@ -371,6 +370,8 @@ struct font_backend_funcs
BOOL
(
CDECL
*
alloc_font
)(
struct
gdi_font
*
font
);
BOOL
(
CDECL
*
alloc_font
)(
struct
gdi_font
*
font
);
DWORD
(
CDECL
*
get_font_data
)(
struct
gdi_font
*
gdi_font
,
DWORD
table
,
DWORD
offset
,
DWORD
(
CDECL
*
get_font_data
)(
struct
gdi_font
*
gdi_font
,
DWORD
table
,
DWORD
offset
,
void
*
buf
,
DWORD
count
);
void
*
buf
,
DWORD
count
);
BOOL
(
CDECL
*
get_glyph_index
)(
struct
gdi_font
*
gdi_font
,
UINT
*
glyph
);
UINT
(
CDECL
*
get_default_glyph
)(
struct
gdi_font
*
gdi_font
);
DWORD
(
CDECL
*
get_glyph_outline
)(
struct
gdi_font
*
font
,
UINT
glyph
,
UINT
format
,
DWORD
(
CDECL
*
get_glyph_outline
)(
struct
gdi_font
*
font
,
UINT
glyph
,
UINT
format
,
GLYPHMETRICS
*
gm
,
ABC
*
abc
,
DWORD
buflen
,
void
*
buf
,
const
MAT2
*
mat
);
GLYPHMETRICS
*
gm
,
ABC
*
abc
,
DWORD
buflen
,
void
*
buf
,
const
MAT2
*
mat
);
void
(
CDECL
*
destroy_font
)(
struct
gdi_font
*
font
);
void
(
CDECL
*
destroy_font
)(
struct
gdi_font
*
font
);
...
...
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