mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 10:23:31 +00:00

This fixes tons of font rendering issues for many localizations, brings the set of fonts closer to the 2k3sp2 stock fonts, and adapts some font substitutions. Best of all is that it shrinks the iso size by ~13MB on average and stabilizes ros by consuming significantly less memory. It is a squashed backport of the following commits: 0.4.15-dev-5287-g4615c824db
[SETUP][INF] Delete obsolete font substitutions "DejaVu Serif" (#4827) 0.4.14-dev-1515-g30fae1a2df
[MEDIA][FONTS] Fix French glyphs of Tahoma font CORE-16899 (#2607) 0.4.14-dev-586-g9525593660
[MEDIA][FONTS] Improve tahomabd.ttf (Latin) No.35 CORE-8408 0.4.14-dev-584-g94f92b0b2e
[MEDIA][FONTS] Improve tahomabd.ttf (Latin) No.34 CORE-8408 0.4.14-dev-469-g0b938a35bd
[MEDIA][FONTS] Improve tahomabd.ttf (Latin and Punctuation) No.33 CORE-8408 0.4.14-dev-467-gc3da027012
[MEDIA][FONTS] Improve tahomabd.ttf (Punctuations) No.32 CORE-8408 0.4.14-dev-462-g591b2b807c
[MEDIA][FONTS] Improve tahomabd.ttf (Punctuations) No.31 CORE-8408 0.4.14-dev-456-gd8187d33be
[MEDIA][FONTS] Improve tahomabd.ttf (Punctuations) No.30 CORE-8408 0.4.14-dev-430-gf41366daad
[MEDIA][FONTS] Improve tahoma.ttf (Punctuations) No.29 CORE-8408 0.4.14-dev-426-g55251a0a8e
[MEDIA][FONTS] Improve tahomabd.ttf (Latin, Greek and Cyrillic) No.28 CORE-8408 0.4.14-dev-400-gb7076dc2bc
[MEDIA][FONTS] Improve tahoma.ttf (Latin) No.27 CORE-8408 0.4.14-dev-397-g551b101720
[MEDIA][FONTS] Improve tahomabd.ttf (Latin) No.26 CORE-8408 0.4.14-dev-396-g8cbcb172f6
[MEDIA][FONTS] Improve tahoma.ttf (Latin and Cyrillic) No.25 CORE-8408 0.4.14-dev-395-g65cbadf2d6
[MEDIA][FONTS] Improve tahoma.ttf (Cyrillic, Greek and Latin) No.24 CORE-8408 0.4.14-dev-391-g454ea3d85b
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin and Greek) No.23 CORE-8408 0.4.14-dev-389-g9ef61bb887
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin and Greek) No.22 CORE-8408 0.4.14-dev-385-g6f2662688b
[MEDIA][FONTS] Improve UniVGA16.ttf (VGA) font CORE-8408 0.4.14-dev-378-g871d322f92
[MEDIA][FONTS] Improve tahoma.ttf (Cyrillic and Latin) No.21 CORE-8408 0.4.14-dev-377-g21f4e69ee8
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin) No.20 CORE-8408 0.4.14-dev-374-ge4de098127
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin) No.19 CORE-8408 0.4.14-dev-370-gdda8185297
[MEDIA][FONTS] Improve tahoma.ttf (Cyrillic and Latin) No.18 CORE-8408 0.4.14-dev-367-g36163a235b
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin) No.17 CORE-8408 0.4.14-dev-357-g203a6babdf
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin) No.16 CORE-8408 0.4.14-dev-356-g7d7f134f94
[MEDIA][FONTS] Improve tahoma.ttf (Cyrillic and Latin) No.15 CORE-8408 0.4.14-dev-339-g54c8cc66ab
[MEDIA][FONTS] Improve tahoma.ttf (Cyrillic) No.14 CORE-8408 0.4.14-dev-338-g9f803ab091
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin) No.13 CORE-8408 0.4.14-dev-333-g67c78d88c8
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic and Latin) No.12 CORE-8408 0.4.14-dev-330-g15748cf03a
[MEDIA][FONTS] Improve tahomabd.ttf (Cyrillic) No.11 CORE-8408 0.4.14-dev-329-g463a3f8c06
[MEDIA][FONTS] Improve tahoma.ttf (Cyrillic) No.10 0.4.14-dev-328-gc58eced19b
[MEDIA][FONTS] Improve Cyrillic glyphs of tahoma.ttf a bit 0.4.14-dev-327-gff715073ca
[MEDIA][FONTS] More improve Cyrillic glyphs of tahomabd.ttf 0.4.14-dev-325-g6b1ca2895b
[MEDIA][FONTS] Improve Cyrillic glyphs of tahomabd.ttf 0.4.14-dev-324-gff77ddff5e
[MEDIA][FONTS] Improve Cylliric glyphs of tahoma.ttf more 0.4.14-dev-323-g6fe6a88b04
[MEDIA][FONTS] Improve Cyrillic bitmap glyphs of tahoma.ttf 0.4.14-dev-231-g2627b52d95
[MEDIA][FONTS] Improve Tahoma font (tahoma.ttf) for Hungarian (#2018) CORE-16480 0.4.14-dev-20-g2f4fb903b4
(partially) [MEDIA][FONTS] Delete many fonts CORE-16407 (#1955) 0.4.14-dev-6-gf45dd65773
[MEDIA][FONTS] Replace 'Verdana' fonts CORE-16400 (#1948) 0.4.13-dev-799-g10c08e1d62
[SETUP][BOOTDATA][INF] Helvetica-to-Arial substitutes (#1809) CORE-16264 0.4.13-dev-798-g257aed0e69
[SETUP][BOOTDATA][INF] Delete Tahoma-to-Tahoma substitutes (#1808) CORE-16264 0.4.13-dev-785-g3f1ab92d3a
[SETUP][INF] Helvetica must be substitute to Arial font (#1803) 0.4.13-dev-784-g01a1348325
[MEDIA][FONTS] Replace Georgia fonts (#1802) CORE-16293 0.4.13-dev-783-g6f796ab043
[MEDIA][FONTS] Replace 'Palatino Linotype' fonts (#1800) CORE-16292 0.4.13-dev-769-g5bbc2c6308
(partially) [SETUP][INF] Fix font substitutes (#1794) CORE-16264 0.4.13-dev-765-g04a361d091
[FONTS][SETUP] Add Trebuchet MS fonts (#1791) CORE-16272 0.4.13-dev-764-gdbb4432b25
[FONTS][SETUP][BOOTDATA] Add Times New Roman fonts (#1790) CORE-16272 0.4.13-dev-753-gbb1878157b
[FONTS][SETUP] Add Palatino Linotype fonts (#1785) CORE-16272 0.4.13-dev-752-g5ce98c8519
[FONTS] s/Geogia/Georgia/ 0.4.13-dev-751-ge282f99ce5
[FONTS][SETUP] Add Geogia fonts (#1784) CORE-16272 0.4.13-dev-749-g1463f4b02a
[FONTS][SETUP][BOOTDATA] Add Arial fonts (#1781) CORE-16272 0.4.13-dev-742-g4cfe7f84bb
(partially) [SETUP] Add codepage-specific font substitutes (#1772) CORE-16266 0.4.13-dev-737-gf054844f33
[SETUP] Sort font substitutes (#1770) 0.4.10-dev-626-g8a407b5c60
(partially) [FONTS] Update Hebrew font subtitutions (#795) CORE-14880, CORE-14943
362 lines
15 KiB
C
362 lines
15 KiB
C
/*
|
|
* PROJECT: ReactOS api tests
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
|
* PURPOSE: Test for GetTextMetrics and GetTextExtentPoint32
|
|
* COPYRIGHT: Copyright 2018 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
|
|
*/
|
|
|
|
#include "precomp.h"
|
|
|
|
/* #define EMIT_TESTCASES */
|
|
|
|
typedef struct TEST_ENTRY
|
|
{
|
|
int line;
|
|
LONG lfHeight;
|
|
LONG lfWidth;
|
|
LONG cxText;
|
|
LONG cyText;
|
|
LONG tmHeight;
|
|
LONG tmAscent;
|
|
LONG tmDescent;
|
|
LONG tmInternalLeading;
|
|
LONG tmExternalLeading;
|
|
} TEST_ENTRY;
|
|
|
|
#ifdef EMIT_TESTCASES
|
|
static const TEST_ENTRY g_test_entries[] =
|
|
{
|
|
{ __LINE__, 400, 0 },
|
|
{ __LINE__, 300, 0 },
|
|
{ __LINE__, 200, 0 },
|
|
{ __LINE__, 100, 0 },
|
|
{ __LINE__, 64, 0 },
|
|
{ __LINE__, 32, 0 },
|
|
{ __LINE__, 16, 0 },
|
|
{ __LINE__, 15, 0 },
|
|
{ __LINE__, 14, 0 },
|
|
{ __LINE__, 13, 0 },
|
|
{ __LINE__, 12, 0 },
|
|
{ __LINE__, 11, 0 },
|
|
{ __LINE__, 10, 0 },
|
|
{ __LINE__, 9, 0 },
|
|
{ __LINE__, 8, 0 },
|
|
{ __LINE__, 7, 0 },
|
|
{ __LINE__, 6, 0 },
|
|
{ __LINE__, 5, 0 },
|
|
{ __LINE__, 4, 0 },
|
|
{ __LINE__, 3, 0 },
|
|
{ __LINE__, 2, 0 },
|
|
{ __LINE__, 1, 0 },
|
|
{ __LINE__, 0, 0 },
|
|
{ __LINE__, -1, 0 },
|
|
{ __LINE__, -2, 0 },
|
|
{ __LINE__, -3, 0 },
|
|
{ __LINE__, -4, 0 },
|
|
{ __LINE__, -5, 0 },
|
|
{ __LINE__, -6, 0 },
|
|
{ __LINE__, -7, 0 },
|
|
{ __LINE__, -8, 0 },
|
|
{ __LINE__, -9, 0 },
|
|
{ __LINE__, -10, 0 },
|
|
{ __LINE__, -11, 0 },
|
|
{ __LINE__, -12, 0 },
|
|
{ __LINE__, -13, 0 },
|
|
{ __LINE__, -14, 0 },
|
|
{ __LINE__, -15, 0 },
|
|
{ __LINE__, -16, 0 },
|
|
{ __LINE__, -32, 0 },
|
|
{ __LINE__, -64, 0 },
|
|
{ __LINE__, -100, 0 },
|
|
{ __LINE__, -200, 0 },
|
|
{ __LINE__, -300, 0 },
|
|
{ __LINE__, -400, 0 },
|
|
};
|
|
#define g_test_entry_count _countof(g_test_entries)
|
|
#else
|
|
static const TEST_ENTRY g_FREEMONO[] =
|
|
{
|
|
{ __LINE__, 400, 0, 3600, 400, 400, 320, 80, 0, 0 },
|
|
{ __LINE__, 300, 0, 2700, 300, 300, 240, 60, 0, 0 },
|
|
{ __LINE__, 200, 0, 1800, 200, 200, 160, 40, 0, 0 },
|
|
{ __LINE__, 100, 0, 900, 100, 100, 80, 20, 0, 0 },
|
|
{ __LINE__, 64, 0, 570, 64, 64, 51, 13, 0, 0 },
|
|
{ __LINE__, 32, 0, 285, 32, 32, 26, 6, 0, 0 },
|
|
{ __LINE__, 16, 0, 150, 16, 16, 13, 3, 0, 0 },
|
|
{ __LINE__, 15, 0, 135, 15, 15, 12, 3, 0, 0 },
|
|
{ __LINE__, 14, 0, 120, 14, 14, 11, 3, 0, 0 },
|
|
{ __LINE__, 13, 0, 120, 13, 13, 10, 3, 0, 0 },
|
|
{ __LINE__, 12, 0, 105, 12, 12, 10, 2, 0, 0 },
|
|
{ __LINE__, 11, 0, 105, 11, 11, 9, 2, 0, 0 },
|
|
{ __LINE__, 10, 0, 90, 10, 10, 8, 2, 0, 0 },
|
|
{ __LINE__, 9, 0, 77, 9, 9, 7, 2, 0, 0 },
|
|
{ __LINE__, 8, 0, 75, 8, 8, 6, 2, 0, 0 },
|
|
{ __LINE__, 7, 0, 60, 7, 7, 6, 1, 0, 0 },
|
|
{ __LINE__, 6, 0, 60, 6, 6, 5, 1, 0, 0 },
|
|
{ __LINE__, 5, 0, 45, 5, 5, 4, 1, 0, 0 },
|
|
{ __LINE__, 4, 0, 30, 4, 4, 3, 1, 0, 0 },
|
|
{ __LINE__, 3, 0, 30, 3, 3, 2, 1, 0, 0 },
|
|
{ __LINE__, 2, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, 1, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, 0, 0, -165, -18, -18, -14, -4, 0, 0 },
|
|
{ __LINE__, -1, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, -2, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, -3, 0, 30, 3, 3, 2, 1, 0, 0 },
|
|
{ __LINE__, -4, 0, 30, 4, 4, 3, 1, 0, 0 },
|
|
{ __LINE__, -5, 0, 45, 5, 5, 4, 1, 0, 0 },
|
|
{ __LINE__, -6, 0, 60, 6, 6, 5, 1, 0, 0 },
|
|
{ __LINE__, -7, 0, 60, 7, 7, 6, 1, 0, 0 },
|
|
{ __LINE__, -8, 0, 75, 8, 8, 6, 2, 0, 0 },
|
|
{ __LINE__, -9, 0, 77, 9, 9, 7, 2, 0, 0 },
|
|
{ __LINE__, -10, 0, 90, 10, 10, 8, 2, 0, 0 },
|
|
{ __LINE__, -11, 0, 105, 11, 11, 9, 2, 0, 0 },
|
|
{ __LINE__, -12, 0, 105, 12, 12, 10, 2, 0, 0 },
|
|
{ __LINE__, -13, 0, 120, 13, 13, 10, 3, 0, 0 },
|
|
{ __LINE__, -14, 0, 120, 14, 14, 11, 3, 0, 0 },
|
|
{ __LINE__, -15, 0, 135, 15, 15, 12, 3, 0, 0 },
|
|
{ __LINE__, -16, 0, 150, 16, 16, 13, 3, 0, 0 },
|
|
{ __LINE__, -32, 0, 285, 32, 32, 26, 6, 0, 0 },
|
|
{ __LINE__, -64, 0, 570, 64, 64, 51, 13, 0, 0 },
|
|
{ __LINE__, -100, 0, 900, 100, 100, 80, 20, 0, 0 },
|
|
{ __LINE__, -200, 0, 1800, 200, 200, 160, 40, 0, 0 },
|
|
{ __LINE__, -300, 0, 2700, 300, 300, 240, 60, 0, 0 },
|
|
{ __LINE__, -400, 0, 3600, 400, 400, 320, 80, 0, 0 },
|
|
};
|
|
#define g_FREEMONO_count _countof(g_FREEMONO)
|
|
|
|
static const TEST_ENTRY g_MSGOTHIC[] =
|
|
{
|
|
{ __LINE__, 400, 0, 3000, 400, 400, 344, 56, 0, 0 },
|
|
{ __LINE__, 300, 0, 2250, 300, 300, 258, 42, 0, 0 },
|
|
{ __LINE__, 200, 0, 1500, 200, 200, 172, 28, 0, 0 },
|
|
{ __LINE__, 100, 0, 750, 100, 100, 86, 14, 0, 0 },
|
|
{ __LINE__, 64, 0, 480, 64, 64, 55, 9, 0, 0 },
|
|
{ __LINE__, 32, 0, 240, 33, 33, 28, 5, 1, 0 },
|
|
{ __LINE__, 16, 0, 120, 16, 16, 14, 2, 0, 0 },
|
|
{ __LINE__, 15, 0, 120, 15, 15, 13, 2, 0, 0 },
|
|
{ __LINE__, 14, 0, 105, 14, 14, 12, 2, 0, 0 },
|
|
{ __LINE__, 13, 0, 105, 13, 13, 11, 2, 0, 0 },
|
|
{ __LINE__, 12, 0, 90, 12, 12, 10, 2, 0, 0 },
|
|
{ __LINE__, 11, 0, 90, 11, 11, 9, 2, 0, 0 },
|
|
{ __LINE__, 10, 0, 75, 10, 10, 9, 1, 0, 0 },
|
|
{ __LINE__, 9, 0, 75, 9, 9, 8, 1, 0, 0 },
|
|
{ __LINE__, 8, 0, 60, 8, 8, 7, 1, 0, 0 },
|
|
{ __LINE__, 7, 0, 60, 7, 7, 6, 1, 0, 0 },
|
|
{ __LINE__, 6, 0, 45, 6, 6, 5, 1, 0, 0 },
|
|
{ __LINE__, 5, 0, 45, 5, 5, 4, 1, 0, 0 },
|
|
{ __LINE__, 4, 0, 30, 4, 4, 3, 1, 0, 0 },
|
|
{ __LINE__, 3, 0, 30, 3, 3, 3, 0, 0, 0 },
|
|
{ __LINE__, 2, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, 1, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, 0, 0, -135, -18, -18, -15, -3, 0, 0 },
|
|
{ __LINE__, -1, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, -2, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, -3, 0, 30, 3, 3, 3, 0, 0, 0 },
|
|
{ __LINE__, -4, 0, 30, 4, 4, 3, 1, 0, 0 },
|
|
{ __LINE__, -5, 0, 45, 5, 5, 4, 1, 0, 0 },
|
|
{ __LINE__, -6, 0, 45, 6, 6, 5, 1, 0, 0 },
|
|
{ __LINE__, -7, 0, 60, 7, 7, 6, 1, 0, 0 },
|
|
{ __LINE__, -8, 0, 60, 8, 8, 7, 1, 0, 0 },
|
|
{ __LINE__, -9, 0, 75, 9, 9, 8, 1, 0, 0 },
|
|
{ __LINE__, -10, 0, 75, 10, 10, 9, 1, 0, 0 },
|
|
{ __LINE__, -11, 0, 90, 11, 11, 9, 2, 0, 0 },
|
|
{ __LINE__, -12, 0, 90, 12, 12, 10, 2, 0, 0 },
|
|
{ __LINE__, -13, 0, 105, 13, 13, 11, 2, 0, 0 },
|
|
{ __LINE__, -14, 0, 105, 14, 14, 12, 2, 0, 0 },
|
|
{ __LINE__, -15, 0, 120, 15, 15, 13, 2, 0, 0 },
|
|
{ __LINE__, -16, 0, 120, 16, 16, 14, 2, 0, 0 },
|
|
{ __LINE__, -32, 0, 240, 33, 33, 28, 5, 1, 0 },
|
|
{ __LINE__, -64, 0, 480, 64, 64, 55, 9, 0, 0 },
|
|
{ __LINE__, -100, 0, 750, 100, 100, 86, 14, 0, 0 },
|
|
{ __LINE__, -200, 0, 1500, 200, 200, 172, 28, 0, 0 },
|
|
{ __LINE__, -300, 0, 2250, 300, 300, 258, 42, 0, 0 },
|
|
{ __LINE__, -400, 0, 3000, 400, 400, 344, 56, 0, 0 },
|
|
};
|
|
#define g_MSGOTHIC_count _countof(g_MSGOTHIC)
|
|
|
|
static const TEST_ENTRY g_MSMINCHO[] =
|
|
{
|
|
{ __LINE__, 400, 0, 3000, 400, 400, 344, 56, 0, 0 },
|
|
{ __LINE__, 300, 0, 2250, 300, 300, 258, 42, 0, 0 },
|
|
{ __LINE__, 200, 0, 1500, 200, 200, 172, 28, 0, 0 },
|
|
{ __LINE__, 100, 0, 750, 100, 100, 86, 14, 0, 0 },
|
|
{ __LINE__, 64, 0, 480, 64, 64, 55, 9, 0, 0 },
|
|
{ __LINE__, 32, 0, 240, 33, 33, 28, 5, 1, 0 },
|
|
{ __LINE__, 16, 0, 120, 16, 16, 14, 2, 0, 0 },
|
|
{ __LINE__, 15, 0, 120, 15, 15, 13, 2, 0, 0 },
|
|
{ __LINE__, 14, 0, 105, 14, 14, 12, 2, 0, 0 },
|
|
{ __LINE__, 13, 0, 105, 13, 13, 11, 2, 0, 0 },
|
|
{ __LINE__, 12, 0, 90, 12, 12, 10, 2, 0, 0 },
|
|
{ __LINE__, 11, 0, 90, 11, 11, 9, 2, 0, 0 },
|
|
{ __LINE__, 10, 0, 75, 10, 10, 9, 1, 0, 0 },
|
|
{ __LINE__, 9, 0, 75, 9, 9, 8, 1, 0, 0 },
|
|
{ __LINE__, 8, 0, 60, 8, 8, 7, 1, 0, 0 },
|
|
{ __LINE__, 7, 0, 60, 7, 7, 6, 1, 0, 0 },
|
|
{ __LINE__, 6, 0, 45, 6, 6, 5, 1, 0, 0 },
|
|
{ __LINE__, 5, 0, 45, 5, 5, 4, 1, 0, 0 },
|
|
{ __LINE__, 4, 0, 30, 4, 4, 3, 1, 0, 0 },
|
|
{ __LINE__, 3, 0, 30, 3, 3, 3, 0, 0, 0 },
|
|
{ __LINE__, 2, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, 1, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, 0, 0, -135, -18, -18, -15, -3, 0, 0 },
|
|
{ __LINE__, -1, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, -2, 0, 15, 2, 2, 2, 0, 0, 0 },
|
|
{ __LINE__, -3, 0, 30, 3, 3, 3, 0, 0, 0 },
|
|
{ __LINE__, -4, 0, 30, 4, 4, 3, 1, 0, 0 },
|
|
{ __LINE__, -5, 0, 45, 5, 5, 4, 1, 0, 0 },
|
|
{ __LINE__, -6, 0, 45, 6, 6, 5, 1, 0, 0 },
|
|
{ __LINE__, -7, 0, 60, 7, 7, 6, 1, 0, 0 },
|
|
{ __LINE__, -8, 0, 60, 8, 8, 7, 1, 0, 0 },
|
|
{ __LINE__, -9, 0, 75, 9, 9, 8, 1, 0, 0 },
|
|
{ __LINE__, -10, 0, 75, 10, 10, 9, 1, 0, 0 },
|
|
{ __LINE__, -11, 0, 90, 11, 11, 9, 2, 0, 0 },
|
|
{ __LINE__, -12, 0, 90, 12, 12, 10, 2, 0, 0 },
|
|
{ __LINE__, -13, 0, 105, 13, 13, 11, 2, 0, 0 },
|
|
{ __LINE__, -14, 0, 105, 14, 14, 12, 2, 0, 0 },
|
|
{ __LINE__, -15, 0, 120, 15, 15, 13, 2, 0, 0 },
|
|
{ __LINE__, -16, 0, 120, 16, 16, 14, 2, 0, 0 },
|
|
{ __LINE__, -32, 0, 240, 33, 33, 28, 5, 1, 0 },
|
|
{ __LINE__, -64, 0, 480, 64, 64, 55, 9, 0, 0 },
|
|
{ __LINE__, -100, 0, 750, 100, 100, 86, 14, 0, 0 },
|
|
{ __LINE__, -200, 0, 1500, 200, 200, 172, 28, 0, 0 },
|
|
{ __LINE__, -300, 0, 2250, 300, 300, 258, 42, 0, 0 },
|
|
{ __LINE__, -400, 0, 3000, 400, 400, 344, 56, 0, 0 },
|
|
};
|
|
#define g_MSMINCHO_count _countof(g_MSMINCHO)
|
|
#endif
|
|
|
|
typedef struct FONT_ENTRY
|
|
{
|
|
const char *entry_name;
|
|
const char *font_name;
|
|
const char *font_file;
|
|
size_t test_count;
|
|
const TEST_ENTRY *tests;
|
|
} FONT_ENTRY;
|
|
|
|
static FONT_ENTRY g_font_entries[] =
|
|
{
|
|
#ifdef EMIT_TESTCASES
|
|
{ "FREEMONO", "FreeMono", "FreeMono.ttf" },
|
|
{ "MSGOTHIC", "MS Gothic", "msgothic.ttc" },
|
|
{ "MSMINCHO", "MS Mincho", "msmincho.ttc" },
|
|
#else
|
|
{ "FREEMONO", "FreeMono", "FreeMono.ttf", g_FREEMONO_count, g_FREEMONO },
|
|
{ "MSGOTHIC", "MS Gothic", "msgothic.ttc", g_MSGOTHIC_count, g_MSGOTHIC },
|
|
{ "MSMINCHO", "MS Mincho", "msmincho.ttc", g_MSMINCHO_count, g_MSMINCHO },
|
|
#endif
|
|
};
|
|
static size_t g_font_entry_count = _countof(g_font_entries);
|
|
|
|
START_TEST(GetTextMetrics)
|
|
{
|
|
size_t i, k;
|
|
LOGFONTA lf;
|
|
HFONT hFont;
|
|
HDC hDC;
|
|
HGDIOBJ hFontOld;
|
|
SIZE siz;
|
|
TEXTMETRIC tm;
|
|
char szPath[MAX_PATH];
|
|
static const char *text = "This is a test.";
|
|
|
|
hDC = CreateCompatibleDC(NULL);
|
|
for (i = 0; i < g_font_entry_count; ++i)
|
|
{
|
|
FONT_ENTRY *font = &g_font_entries[i];
|
|
ZeroMemory(&lf, sizeof(lf));
|
|
lf.lfCharSet = DEFAULT_CHARSET;
|
|
lstrcpyA(lf.lfFaceName, font->font_name);
|
|
|
|
GetWindowsDirectoryA(szPath, MAX_PATH);
|
|
lstrcatA(szPath, "\\Fonts\\");
|
|
lstrcatA(szPath, font->font_file);
|
|
if (GetFileAttributesA(szPath) == 0xFFFFFFFF)
|
|
{
|
|
skip("Font file '%s' doesn't exists\n", font->font_file);
|
|
continue;
|
|
}
|
|
|
|
#ifdef EMIT_TESTCASES
|
|
printf("static const TEST_ENTRY g_%s[] =\n", font->entry_name);
|
|
printf("{\n");
|
|
for (k = 0; k < g_test_entry_count; ++k)
|
|
{
|
|
const TEST_ENTRY *test = &g_test_entries[k];
|
|
|
|
lf.lfHeight = test->lfHeight;
|
|
lf.lfWidth = test->lfWidth;
|
|
|
|
hFont = CreateFontIndirectA(&lf);
|
|
hFontOld = SelectObject(hDC, hFont);
|
|
{
|
|
GetTextExtentPoint32A(hDC, text, lstrlenA(text), &siz);
|
|
GetTextMetrics(hDC, &tm);
|
|
}
|
|
SelectObject(hDC, hFontOld);
|
|
DeleteObject(hFont);
|
|
|
|
printf(" { __LINE__, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld },\n",
|
|
lf.lfHeight, lf.lfWidth,
|
|
siz.cx, siz.cy,
|
|
tm.tmHeight, tm.tmAscent, tm.tmDescent, tm.tmInternalLeading, tm.tmExternalLeading);
|
|
}
|
|
printf("};\n");
|
|
printf("#define g_%s_count _countof(g_%s)\n\n", font->entry_name, font->entry_name);
|
|
#else
|
|
for (k = 0; k < font->test_count; ++k)
|
|
{
|
|
const TEST_ENTRY *test = &font->tests[k];
|
|
|
|
lf.lfHeight = test->lfHeight;
|
|
lf.lfWidth = test->lfWidth;
|
|
|
|
hFont = CreateFontIndirectA(&lf);
|
|
hFontOld = SelectObject(hDC, hFont);
|
|
{
|
|
GetTextExtentPoint32A(hDC, text, lstrlenA(text), &siz);
|
|
GetTextMetrics(hDC, &tm);
|
|
}
|
|
SelectObject(hDC, hFontOld);
|
|
DeleteObject(hFont);
|
|
|
|
if (test->cxText > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->cxText - siz.cx) <= 1, "%s (%ld): cxText: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->cxText, siz.cx);
|
|
ok_(__FILE__, test->line)(labs(test->cxText - siz.cx) == 0, "%s (%ld): cxText: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->cxText, siz.cx);
|
|
}
|
|
if (test->cyText > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->cyText - siz.cy) <= 1, "%s (%ld): cyText: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->cyText, siz.cy);
|
|
ok_(__FILE__, test->line)(labs(test->cyText - siz.cy) == 0, "%s (%ld): cyText: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->cyText, siz.cy);
|
|
}
|
|
if (test->tmHeight > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->tmHeight - tm.tmHeight) <= 1, "%s (%ld): tmHeight: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmHeight, tm.tmHeight);
|
|
ok_(__FILE__, test->line)(labs(test->tmHeight - tm.tmHeight) == 0, "%s (%ld): tmHeight: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmHeight, tm.tmHeight);
|
|
}
|
|
if (test->tmAscent > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->tmAscent - tm.tmAscent) <= 1, "%s (%ld): tmAscent: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmAscent, tm.tmAscent);
|
|
ok_(__FILE__, test->line)(labs(test->tmAscent - tm.tmAscent) == 0, "%s (%ld): tmAscent: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmAscent, tm.tmAscent);
|
|
}
|
|
if (test->tmDescent > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->tmDescent - tm.tmDescent) <= 1, "%s (%ld): tmDescent: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmDescent, tm.tmDescent);
|
|
ok_(__FILE__, test->line)(labs(test->tmDescent - tm.tmDescent) == 0, "%s (%ld): tmDescent: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmDescent, tm.tmDescent);
|
|
}
|
|
if (test->tmInternalLeading > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->tmInternalLeading - tm.tmInternalLeading) <= 1, "%s (%ld): tmInternalLeading: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmInternalLeading, tm.tmInternalLeading);
|
|
ok_(__FILE__, test->line)(labs(test->tmInternalLeading - tm.tmInternalLeading) == 0, "%s (%ld): tmInternalLeading: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmInternalLeading, tm.tmInternalLeading);
|
|
}
|
|
if (test->tmExternalLeading > 0)
|
|
{
|
|
ok_(__FILE__, test->line)(labs(test->tmExternalLeading - tm.tmExternalLeading) <= 1, "%s (%ld): tmExternalLeading: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmExternalLeading, tm.tmExternalLeading);
|
|
ok_(__FILE__, test->line)(labs(test->tmExternalLeading - tm.tmExternalLeading) == 0, "%s (%ld): tmExternalLeading: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmExternalLeading, tm.tmExternalLeading);
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
DeleteDC(hDC);
|
|
}
|