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
4094ff02
Commit
4094ff02
authored
Mar 30, 2008
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Apr 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Fix GetGlyphIndices to select properly the invalid char glyph for TrueType fonts.
parent
6ecccdb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
16 deletions
+37
-16
freetype.c
dlls/gdi32/freetype.c
+14
-7
font.c
dlls/gdi32/tests/font.c
+23
-9
No files found.
dlls/gdi32/freetype.c
View file @
4094ff02
...
...
@@ -4068,26 +4068,33 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
/*************************************************************
* WineEngGetGlyphIndices
*
* FIXME: add support for GGI_MARK_NONEXISTING_GLYPHS
*/
DWORD
WineEngGetGlyphIndices
(
GdiFont
*
font
,
LPCWSTR
lpstr
,
INT
count
,
LPWORD
pgi
,
DWORD
flags
)
{
int
i
;
WCHAR
default_char
=
0
;
TEXTMETRICW
textm
;
int
default_char
=
-
1
;
if
(
flags
&
GGI_MARK_NONEXISTING_GLYPHS
)
default_char
=
0x
001f
;
/* Indicate non existence
*/
if
(
flags
&
GGI_MARK_NONEXISTING_GLYPHS
)
default_char
=
0x
ffff
;
/* XP would use 0x1f for bitmap fonts
*/
for
(
i
=
0
;
i
<
count
;
i
++
)
{
pgi
[
i
]
=
get_glyph_index
(
font
,
lpstr
[
i
]);
if
(
pgi
[
i
]
==
0
)
{
if
(
!
default_char
)
if
(
default_char
==
-
1
)
{
WineEngGetTextMetrics
(
font
,
&
textm
);
default_char
=
textm
.
tmDefaultChar
;
if
(
FT_IS_SFNT
(
font
->
ft_face
))
{
TT_OS2
*
pOS2
=
pFT_Get_Sfnt_Table
(
font
->
ft_face
,
ft_sfnt_os2
);
default_char
=
(
pOS2
->
usDefaultChar
?
get_glyph_index
(
font
,
pOS2
->
usDefaultChar
)
:
0
);
}
else
{
TEXTMETRICW
textm
;
WineEngGetTextMetrics
(
font
,
&
textm
);
default_char
=
textm
.
tmDefaultChar
;
}
}
pgi
[
i
]
=
default_char
;
}
...
...
dlls/gdi32/tests/font.c
View file @
4094ff02
...
...
@@ -583,35 +583,49 @@ static void test_GetGlyphIndices(void)
WCHAR
testtext
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0xffff
,
0
};
WORD
glyphs
[(
sizeof
(
testtext
)
/
2
)
-
1
];
TEXTMETRIC
textm
;
HFONT
hOldFont
;
if
(
!
pGetGlyphIndicesW
)
{
skip
(
"GetGlyphIndices not available on platform
\n
"
);
return
;
}
if
(
!
is_font_installed
(
"Symbol"
))
hdc
=
GetDC
(
0
);
ok
(
GetTextMetrics
(
hdc
,
&
textm
),
"GetTextMetric failed
\n
"
);
flags
|=
GGI_MARK_NONEXISTING_GLYPHS
;
charcount
=
pGetGlyphIndicesW
(
hdc
,
testtext
,
(
sizeof
(
testtext
)
/
2
)
-
1
,
glyphs
,
flags
);
ok
(
charcount
==
5
,
"GetGlyphIndices count of glyphs should = 5 not %d
\n
"
,
charcount
);
ok
((
glyphs
[
4
]
==
0x001f
||
glyphs
[
4
]
==
0xffff
/* Vista */
),
"GetGlyphIndices should have returned a nonexistent char not %04x
\n
"
,
glyphs
[
4
]);
flags
=
0
;
charcount
=
pGetGlyphIndicesW
(
hdc
,
testtext
,
(
sizeof
(
testtext
)
/
2
)
-
1
,
glyphs
,
flags
);
ok
(
charcount
==
5
,
"GetGlyphIndices count of glyphs should = 5 not %d
\n
"
,
charcount
);
ok
(
glyphs
[
4
]
==
textm
.
tmDefaultChar
,
"GetGlyphIndices should have returned a %04x not %04x
\n
"
,
textm
.
tmDefaultChar
,
glyphs
[
4
]);
if
(
!
is_font_installed
(
"Tahoma"
))
{
skip
(
"
Symbol
is not installed so skipping this test
\n
"
);
skip
(
"
Tahoma
is not installed so skipping this test
\n
"
);
return
;
}
memset
(
&
lf
,
0
,
sizeof
(
lf
));
strcpy
(
lf
.
lfFaceName
,
"
Symbol
"
);
strcpy
(
lf
.
lfFaceName
,
"
Tahoma
"
);
lf
.
lfHeight
=
20
;
hfont
=
CreateFontIndirectA
(
&
lf
);
hdc
=
GetDC
(
0
);
hOldFont
=
SelectObject
(
hdc
,
hfont
);
ok
(
GetTextMetrics
(
hdc
,
&
textm
),
"GetTextMetric failed
\n
"
);
flags
|=
GGI_MARK_NONEXISTING_GLYPHS
;
charcount
=
pGetGlyphIndicesW
(
hdc
,
testtext
,
(
sizeof
(
testtext
)
/
2
)
-
1
,
glyphs
,
flags
);
ok
(
charcount
==
5
,
"GetGlyphIndices count of glyphs should = 5 not %d
\n
"
,
charcount
);
ok
(
(
glyphs
[
4
]
==
0x001f
||
glyphs
[
4
]
==
UNICODE_NOCHAR
/* Vista */
),
"GetGlyphIndices should have returned a nonexistent
char not %04x
\n
"
,
glyphs
[
4
]);
ok
(
glyphs
[
4
]
==
0xffff
,
"GetGlyphIndices should have returned 0xffff
char not %04x
\n
"
,
glyphs
[
4
]);
flags
=
0
;
testtext
[
0
]
=
textm
.
tmDefaultChar
;
charcount
=
pGetGlyphIndicesW
(
hdc
,
testtext
,
(
sizeof
(
testtext
)
/
2
)
-
1
,
glyphs
,
flags
);
ok
(
charcount
==
5
,
"GetGlyphIndices count of glyphs should = 5 not %d
\n
"
,
charcount
);
ok
(
glyphs
[
4
]
==
textm
.
tmDefaultChar
,
"GetGlyphIndices should have returned a %04x not %04x
\n
"
,
textm
.
tmDefaultChar
,
glyphs
[
4
]);
todo_wine
ok
(
glyphs
[
0
]
==
0
,
"GetGlyphIndices for tmDefaultChar should be 0 not %04x
\n
"
,
glyphs
[
0
]);
ok
(
glyphs
[
4
]
==
0
,
"GetGlyphIndices should have returned 0 not %04x
\n
"
,
glyphs
[
4
]);
DeleteObject
(
SelectObject
(
hdc
,
hOldFont
));
}
static
void
test_GetKerningPairs
(
void
)
...
...
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