ReactOS  0.4.13-dev-235-g7373cb3
font.c File Reference
#include <stdarg.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "pshpack2.h"
#include "poppack.h"
Include dependency graph for font.c:

Go to the source code of this file.

Classes

struct  font_data
 
struct  enum_font_data
 
struct  enum_fullname_data
 
struct  enum_font_dataW
 
struct  TT_OS2_V4
 
struct  cmap_header
 
struct  cmap_encoding_record
 
struct  cmap_format_0
 
struct  cmap_format_4
 
struct  cmap_format_4_seg
 
struct  sfnt_name
 

Macros

#define match_off_by_1(a, b, exact)   match_off_by_n((a), (b), (exact) ? 0 : 1)
 
#define near_match(a, b)   match_off_by_n((a), (b), 6)
 
#define expect(expected, got)   ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 
#define GET_BE_WORD(x)   MAKEWORD(HIBYTE(x), LOBYTE(x))
 
#define GET_BE_DWORD(x)   MAKELONG(GET_BE_WORD(HIWORD(x)), GET_BE_WORD(LOWORD(x)));
 
#define MS_MAKE_TAG(ch0, ch1, ch2, ch3)
 
#define MS_OS2_TAG   MS_MAKE_TAG('O','S','/','2')
 
#define MS_CMAP_TAG   MS_MAKE_TAG('c','m','a','p')
 
#define MS_NAME_TAG   MS_MAKE_TAG('n','a','m','e')
 
#define FH_SCALE   0x80000000
 
#define TT_OS2_V0_SIZE   (FIELD_OFFSET(TT_OS2_V4, ulCodePageRange1))
 
#define TT_PLATFORM_APPLE_UNICODE   0
 
#define TT_PLATFORM_MACINTOSH   1
 
#define TT_PLATFORM_MICROSOFT   3
 
#define TT_APPLE_ID_DEFAULT   0
 
#define TT_APPLE_ID_ISO_10646   2
 
#define TT_APPLE_ID_UNICODE_2_0   3
 
#define TT_MS_ID_SYMBOL_CS   0
 
#define TT_MS_ID_UNICODE_CS   1
 
#define TT_MS_LANGID_ENGLISH_UNITED_STATES   0x0409
 
#define TT_NAME_ID_FONT_FAMILY   1
 
#define TT_NAME_ID_FONT_SUBFAMILY   2
 
#define TT_NAME_ID_UNIQUE_ID   3
 
#define TT_NAME_ID_FULL_NAME   4
 
#define TT_MAC_ID_SIMPLIFIED_CHINESE   25
 

Typedefs

typedef struct sfnt_name sfnt_name
 

Enumerations

enum  cmap_type { cmap_none, cmap_ms_unicode, cmap_ms_symbol }
 

Functions

static BOOL match_off_by_n (int a, int b, unsigned int n)
 
static LONG (WINAPI *pGdiGetCharDimensions)(HDC hdc
 
static DWORD (WINAPI *pGdiGetCodePage)(HDC hdc)
 
static BOOL (WINAPI *pGetCharABCWidthsI)(HDC hdc
 
static DWORD *static HFONT (WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
 
static HANDLE (WINAPI *pAddFontMemResourceEx)(PVOID
 
static INT (WINAPI *pAddFontResourceExA)(LPCSTR
 
static void init (void)
 
static INT CALLBACK is_truetype_font_installed_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_truetype_font_installed (const char *name)
 
static INT CALLBACK is_font_installed_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_font_installed (const char *name)
 
static voidget_res_data (const char *fontname, DWORD *rsrc_size)
 
static BOOL write_tmp_file (const void *data, DWORD *size, char *tmp_name)
 
static BOOL write_ttf_file (const char *fontname, char *tmp_name)
 
static void check_font (const char *test, const LOGFONTA *lf, HFONT hfont)
 
static HFONT create_font (const char *test, const LOGFONTA *lf)
 
static void test_logfont (void)
 
static INT CALLBACK font_enum_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void compare_tm (const TEXTMETRICA *tm, const TEXTMETRICA *otm)
 
static void test_font_metrics (HDC hdc, HFONT hfont, LONG lfHeight, LONG lfWidth, const char *test_str, INT test_str_len, const TEXTMETRICA *tm_orig, const SIZE *size_orig, INT width_of_A_orig, INT scale_x, INT scale_y)
 
static void test_bitmap_font (void)
 
static void test_outline_font (void)
 
static INT CALLBACK find_font_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_CJK (void)
 
static void test_bitmap_font_metrics (void)
 
static void test_GdiGetCharDimensions (void)
 
static int CALLBACK create_font_proc (const LOGFONTA *lpelfe, const TEXTMETRICA *lpntme, DWORD FontType, LPARAM lParam)
 
static void ABCWidths_helper (const char *description, HDC hdc, WORD *glyphs, const ABC *base_abci, const ABC *base_abcw, const ABCFLOAT *base_abcf)
 
static void test_GetCharABCWidths (void)
 
static void test_text_extents (void)
 
static void test_GetGlyphIndices (void)
 
static void test_GetKerningPairs (void)
 
static void test_height (HDC hdc, const struct font_data *fd)
 
static voidfind_ttf_table (void *ttf, DWORD size, DWORD tag)
 
static void test_height_selection_vdmx (HDC hdc)
 
static void test_height_selection (void)
 
static UINT get_font_fsselection (LOGFONTA *lf)
 
static void test_GetOutlineTextMetrics (void)
 
static void testJustification (HDC hdc, PCSTR str, RECT *clientArea)
 
static void test_SetTextJustification (void)
 
static BOOL get_glyph_indices (INT charset, UINT code_page, WORD *idx, UINT count, BOOL unicode)
 
static void test_font_charset (void)
 
static void test_GdiGetCodePage (void)
 
static void test_GetFontUnicodeRanges (void)
 
static INT CALLBACK arial_enum_proc (const LOGFONTA *lf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam)
 
static INT CALLBACK arial_enum_procw (const LOGFONTW *lf, const TEXTMETRICW *tm, DWORD type, LPARAM lParam)
 
static void get_charset_stats (struct enum_font_data *efd, int *ansi_charset, int *symbol_charset, int *russian_charset)
 
static void get_charset_statsW (struct enum_font_dataW *efd, int *ansi_charset, int *symbol_charset, int *russian_charset)
 
static void test_EnumFontFamilies (const char *font_name, INT font_charset)
 
static INT CALLBACK enum_multi_charset_font_proc (const LOGFONTA *lf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam)
 
static INT CALLBACK enum_font_data_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static INT CALLBACK enum_fullname_data_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void test_EnumFontFamiliesEx_default_charset (void)
 
static void test_negative_width (HDC hdc, const LOGFONTA *lf)
 
static void expect_ff (const TEXTMETRICA *tmA, const TT_OS2_V4 *os2, WORD family, const char *name)
 
static BOOL get_first_last_from_cmap0 (void *ptr, DWORD *first, DWORD *last)
 
static void get_seg4 (cmap_format_4 *cmap, USHORT seg_num, cmap_format_4_seg *seg)
 
static BOOL get_first_last_from_cmap4 (void *ptr, DWORD *first, DWORD *last, DWORD limit)
 
static voidget_cmap (cmap_header *header, USHORT plat_id, USHORT enc_id)
 
static BOOL get_first_last_from_cmap (HDC hdc, DWORD *first, DWORD *last, cmap_type *cmap_type)
 
static WORD get_mac_code_page (const sfnt_name *name)
 
static int match_name_table_language (const sfnt_name *name, LANGID lang)
 
static BOOL get_ttf_nametable_entry (HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_T out_size, LCID language_id)
 
static void test_text_metrics (const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
 
static INT CALLBACK enum_truetype_font_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void test_GetTextMetrics (void)
 
static void test_nonexistent_font (void)
 
static void test_RealizationInfo (void)
 
static void test_GetTextFace (void)
 
static void test_orientation (void)
 
static void test_oemcharset (void)
 
static int CALLBACK create_fixed_pitch_font_proc (const LOGFONTA *lpelfe, const TEXTMETRICA *lpntme, DWORD FontType, LPARAM lParam)
 
static void test_GetGlyphOutline (void)
 
static void test_GetTextMetrics2 (const char *fontname, int font_height)
 
static void test_GetCharacterPlacement (void)
 
static void test_CreateFontIndirect (void)
 
static void test_CreateFontIndirectEx (void)
 
static void free_font (void *font)
 
static voidload_font (const char *font_name, DWORD *font_size)
 
static void test_AddFontMemResource (void)
 
static INT CALLBACK enum_fonts_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lparam)
 
static INT CALLBACK enum_all_fonts_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lparam)
 
static INT CALLBACK enum_with_magic_retval_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lparam)
 
static void test_EnumFonts (void)
 
static INT CALLBACK enum_ms_shell_dlg_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static INT CALLBACK enum_ms_shell_dlg2_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void test_EnumFonts_subst (void)
 
static INT CALLBACK is_font_installed_fullname_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_font_installed_fullname (const char *family, const char *fullname)
 
static void test_fullname (void)
 
static WCHARprepend_at (WCHAR *family)
 
static void test_fullname2_helper (const char *Family)
 
static void test_fullname2 (void)
 
static void test_GetGlyphOutline_empty_contour (void)
 
static void test_GetGlyphOutline_metric_clipping (void)
 
static void test_fstype_fixup (void)
 
static void test_CreateScalableFontResource (void)
 
static void check_vertical_font (const char *name, BOOL *installed, BOOL *selected, GLYPHMETRICS *gm, WORD *gi)
 
static void check_vertical_metrics (const char *face)
 
static void test_vertical_font (void)
 
static INT CALLBACK has_vertical_font_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void test_east_asian_font_selection (void)
 
static int get_font_dpi (const LOGFONTA *lf, int *height)
 
static void test_stock_fonts (void)
 
static void test_max_height (void)
 
static void test_vertical_order (void)
 
static void test_GetCharWidth32 (void)
 
static void test_fake_bold_font (void)
 
static void test_bitmap_font_glyph_index (void)
 
static void test_GetCharWidthI (void)
 
static INT CALLBACK long_enum_proc (const LOGFONTA *lf, const TEXTMETRICA *tm, DWORD type, LPARAM lparam)
 
static void test_long_names (void)
 
 START_TEST (font)
 

Variables

static LPTEXTMETRICW lptm
 
static LPTEXTMETRICW LONGheight
 
static UINT first
 
static UINT UINT count
 
static UINT UINT LPWORD glyphs
 
static UINT UINT LPWORD LPABC abc
 
static UINT UINT last
 
static UINT UINT LPINT buffer
 
static LPGLYPHSET lpgs
 
static LPCSTR lpstr
 
static LPCSTR INT LPWORD pgi
 
static LPCSTR INT LPWORD DWORD flags
 
static const WORDindices
 
static const WORD INT INT max_ext
 
static const WORD INT INT LPINT nfit
 
static const WORD INT INT LPINT LPINT dxs
 
static const WORD INT INT LPINT LPINT LPSIZE size
 
static DWORD
 
static PVOID
 
static DWORD *static void DWORD *static ULONGLONG
 
static HMODULE hgdi32 = 0
 
static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} }
 
static WORD system_lang_id
 
static const LANGID mac_langid_table []
 

Macro Definition Documentation

◆ expect

#define expect (   expected,
  got 
)    ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)

Definition at line 40 of file font.c.

◆ FH_SCALE

#define FH_SCALE   0x80000000

Definition at line 756 of file font.c.

◆ GET_BE_DWORD

#define GET_BE_DWORD (   x)    MAKELONG(GET_BE_WORD(HIWORD(x)), GET_BE_WORD(LOWORD(x)));

Definition at line 74 of file font.c.

◆ GET_BE_WORD

#define GET_BE_WORD (   x)    MAKEWORD(HIBYTE(x), LOBYTE(x))

Definition at line 73 of file font.c.

◆ match_off_by_1

#define match_off_by_1 (   a,
  b,
  exact 
)    match_off_by_n((a), (b), (exact) ? 0 : 1)

Definition at line 38 of file font.c.

◆ MS_CMAP_TAG

#define MS_CMAP_TAG   MS_MAKE_TAG('c','m','a','p')

Definition at line 81 of file font.c.

◆ MS_MAKE_TAG

#define MS_MAKE_TAG (   ch0,
  ch1,
  ch2,
  ch3 
)
Value:
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24))
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
static DWORD
Definition: font.c:57

Definition at line 77 of file font.c.

◆ MS_NAME_TAG

#define MS_NAME_TAG   MS_MAKE_TAG('n','a','m','e')

Definition at line 82 of file font.c.

◆ MS_OS2_TAG

#define MS_OS2_TAG   MS_MAKE_TAG('O','S','/','2')

Definition at line 80 of file font.c.

◆ near_match

#define near_match (   a,
  b 
)    match_off_by_n((a), (b), 6)

Definition at line 39 of file font.c.

◆ TT_APPLE_ID_DEFAULT

#define TT_APPLE_ID_DEFAULT   0

Definition at line 3530 of file font.c.

◆ TT_APPLE_ID_ISO_10646

#define TT_APPLE_ID_ISO_10646   2

Definition at line 3531 of file font.c.

◆ TT_APPLE_ID_UNICODE_2_0

#define TT_APPLE_ID_UNICODE_2_0   3

Definition at line 3532 of file font.c.

◆ TT_MAC_ID_SIMPLIFIED_CHINESE

#define TT_MAC_ID_SIMPLIFIED_CHINESE   25

Definition at line 3540 of file font.c.

◆ TT_MS_ID_SYMBOL_CS

#define TT_MS_ID_SYMBOL_CS   0

Definition at line 3533 of file font.c.

◆ TT_MS_ID_UNICODE_CS

#define TT_MS_ID_UNICODE_CS   1

Definition at line 3534 of file font.c.

◆ TT_MS_LANGID_ENGLISH_UNITED_STATES

#define TT_MS_LANGID_ENGLISH_UNITED_STATES   0x0409

Definition at line 3535 of file font.c.

◆ TT_NAME_ID_FONT_FAMILY

#define TT_NAME_ID_FONT_FAMILY   1

Definition at line 3536 of file font.c.

◆ TT_NAME_ID_FONT_SUBFAMILY

#define TT_NAME_ID_FONT_SUBFAMILY   2

Definition at line 3537 of file font.c.

◆ TT_NAME_ID_FULL_NAME

#define TT_NAME_ID_FULL_NAME   4

Definition at line 3539 of file font.c.

◆ TT_NAME_ID_UNIQUE_ID

#define TT_NAME_ID_UNIQUE_ID   3

Definition at line 3538 of file font.c.

◆ TT_OS2_V0_SIZE

#define TT_OS2_V0_SIZE   (FIELD_OFFSET(TT_OS2_V4, ulCodePageRange1))

Definition at line 3343 of file font.c.

◆ TT_PLATFORM_APPLE_UNICODE

#define TT_PLATFORM_APPLE_UNICODE   0

Definition at line 3527 of file font.c.

◆ TT_PLATFORM_MACINTOSH

#define TT_PLATFORM_MACINTOSH   1

Definition at line 3528 of file font.c.

◆ TT_PLATFORM_MICROSOFT

#define TT_PLATFORM_MICROSOFT   3

Definition at line 3529 of file font.c.

Typedef Documentation

◆ sfnt_name

Enumeration Type Documentation

◆ cmap_type

Enumerator
cmap_none 
cmap_ms_unicode 
cmap_ms_symbol 

Definition at line 3470 of file font.c.

3471 {
3472  cmap_none,
3475 } cmap_type;
cmap_type
Definition: font.c:3470

Function Documentation

◆ ABCWidths_helper()

static void ABCWidths_helper ( const char description,
HDC  hdc,
WORD glyphs,
const ABC base_abci,
const ABC base_abcw,
const ABCFLOAT base_abcf 
)
static

Definition at line 1131 of file font.c.

1132 {
1133  ABC abc[1];
1134  ABCFLOAT abcf[1];
1135  BOOL ret = FALSE;
1136 
1137  ret = pGetCharABCWidthsI(hdc, 0, 1, glyphs, abc);
1138  ok(ret, "%s: GetCharABCWidthsI should have succeeded\n", description);
1139  ok ((INT)abc->abcB > 0, "%s: abcB should be positive\n", description);
1140  ok(abc->abcA * base_abci->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
1141  ok(abc->abcC * base_abci->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
1142 
1143  ret = pGetCharABCWidthsW(hdc, 'i', 'i', abc);
1144  ok(ret, "%s: GetCharABCWidthsW should have succeeded\n", description);
1145  ok ((INT)abc->abcB > 0, "%s: abcB should be positive\n", description);
1146  ok(abc->abcA * base_abcw->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
1147  ok(abc->abcC * base_abcw->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
1148 
1149  ret = pGetCharABCWidthsFloatW(hdc, 'i', 'i', abcf);
1150  ok(ret, "%s: GetCharABCWidthsFloatW should have succeeded\n", description);
1151  ok (abcf->abcfB > 0.0, "%s: abcfB should be positive\n", description);
1152  ok(abcf->abcfA * base_abcf->abcfA >= 0.0, "%s: abcfA's sign should be unchanged\n", description);
1153  ok(abcf->abcfC * base_abcf->abcfC >= 0.0, "%s: abcfC's sign should be unchanged\n", description);
1154 }
Definition: wingdi.h:1388
int abcC
Definition: wingdi.h:1391
const char * description
Definition: directx.c:2502
static UINT UINT LPWORD glyphs
Definition: font.c:44
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
FLOAT abcfA
Definition: wingdi.h:1394
UINT abcB
Definition: wingdi.h:1390
int abcA
Definition: wingdi.h:1389
int ret
HDC hdc
Definition: main.c:9
FLOAT abcfC
Definition: wingdi.h:1396
FLOAT abcfB
Definition: wingdi.h:1395
static UINT UINT LPWORD LPABC abc
Definition: font.c:44

Referenced by test_GetCharABCWidths().

◆ arial_enum_proc()

static INT CALLBACK arial_enum_proc ( const LOGFONTA lf,
const TEXTMETRICA tm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 2804 of file font.c.

2805 {
2806  struct enum_font_data *efd = (struct enum_font_data *)lParam;
2807  const NEWTEXTMETRICA *ntm = (const NEWTEXTMETRICA *)tm;
2808 
2809  ok(lf->lfHeight == tm->tmHeight, "lfHeight %d != tmHeight %d\n", lf->lfHeight, tm->tmHeight);
2810  ok(lf->lfHeight > 0 && lf->lfHeight < 200, "enumerated font height %d\n", lf->lfHeight);
2811 
2812  if (type != TRUETYPE_FONTTYPE) return 1;
2813 
2814  ok(ntm->ntmCellHeight + ntm->ntmCellHeight/5 >= ntm->ntmSizeEM, "ntmCellHeight %d should be close to ntmSizeEM %d\n", ntm->ntmCellHeight, ntm->ntmSizeEM);
2815 
2816  if (0) /* Disabled to limit console spam */
2817  trace("enumed font \"%s\", charset %d, height %d, weight %d, italic %d\n",
2819  if (efd->total >= efd->size)
2820  {
2821  efd->size = max( (efd->total + 1) * 2, 256 );
2822  efd->lf = heap_realloc( efd->lf, efd->size * sizeof(*efd->lf) );
2823  if (!efd->lf) return 0;
2824  }
2825  efd->lf[efd->total++] = *lf;
2826 
2827  return 1;
2828 }
BYTE lfItalic
Definition: dimm.idl:47
#define trace(...)
Definition: kmt_test.h:217
#define max(a, b)
Definition: svc.c:63
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BYTE lfCharSet
Definition: dimm.idl:50
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
UINT ntmCellHeight
Definition: wingdi.h:2618
LONG lfHeight
Definition: dimm.idl:42
#define ok(value,...)
LONG lfWeight
Definition: dimm.idl:46
LOGFONTA * lf
Definition: font.c:2789
Definition: time.h:76
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFontFamilies().

◆ arial_enum_procw()

static INT CALLBACK arial_enum_procw ( const LOGFONTW lf,
const TEXTMETRICW tm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 2830 of file font.c.

2831 {
2832  struct enum_font_dataW *efd = (struct enum_font_dataW *)lParam;
2833  const NEWTEXTMETRICW *ntm = (const NEWTEXTMETRICW *)tm;
2834 
2835  ok(lf->lfHeight == tm->tmHeight, "lfHeight %d != tmHeight %d\n", lf->lfHeight, tm->tmHeight);
2836  ok(lf->lfHeight > 0 && lf->lfHeight < 200, "enumerated font height %d\n", lf->lfHeight);
2837 
2838  if (type != TRUETYPE_FONTTYPE) return 1;
2839 
2840  ok(ntm->ntmCellHeight + ntm->ntmCellHeight/5 >= ntm->ntmSizeEM, "ntmCellHeight %d should be close to ntmSizeEM %d\n", ntm->ntmCellHeight, ntm->ntmSizeEM);
2841 
2842  if (0) /* Disabled to limit console spam */
2843  trace("enumed font %s, charset %d, height %d, weight %d, italic %d\n",
2845  if (efd->total >= efd->size)
2846  {
2847  efd->size = max( (efd->total + 1) * 2, 256 );
2848  efd->lf = heap_realloc( efd->lf, efd->size * sizeof(*efd->lf) );
2849  if (!efd->lf) return 0;
2850  }
2851  efd->lf[efd->total++] = *lf;
2852 
2853  return 1;
2854 }
#define trace(...)
Definition: kmt_test.h:217
#define max(a, b)
Definition: svc.c:63
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
#define wine_dbgstr_w
Definition: kernel32.h:34
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
LOGFONTW * lf
Definition: font.c:2801
#define ok(value,...)
Definition: time.h:76
UINT ntmCellHeight
Definition: wingdi.h:2644
BYTE lfItalic
Definition: dimm.idl:64
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfWeight
Definition: dimm.idl:63
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFontFamilies().

◆ BOOL()

static BOOL ( WINAPI pGetCharABCWidthsI)
static

◆ check_font()

static void check_font ( const char test,
const LOGFONTA lf,
HFONT  hfont 
)
static

Definition at line 195 of file font.c.

196 {
197  LOGFONTA getobj_lf;
198  int ret, minlen = 0;
199 
200  if (!hfont)
201  return;
202 
203  ret = GetObjectA(hfont, sizeof(getobj_lf), &getobj_lf);
204  /* NT4 tries to be clever and only returns the minimum length */
205  while (lf->lfFaceName[minlen] && minlen < LF_FACESIZE-1)
206  minlen++;
207  minlen += FIELD_OFFSET(LOGFONTA, lfFaceName) + 1;
208  ok(ret == sizeof(LOGFONTA) || ret == minlen, "%s: GetObject returned %d\n", test, ret);
209  ok(lf->lfHeight == getobj_lf.lfHeight ||
210  broken((SHORT)lf->lfHeight == getobj_lf.lfHeight), /* win9x */
211  "lfHeight: expect %08x got %08x\n", lf->lfHeight, getobj_lf.lfHeight);
212  ok(lf->lfWidth == getobj_lf.lfWidth ||
213  broken((SHORT)lf->lfWidth == getobj_lf.lfWidth), /* win9x */
214  "lfWidth: expect %08x got %08x\n", lf->lfWidth, getobj_lf.lfWidth);
215  ok(lf->lfEscapement == getobj_lf.lfEscapement ||
216  broken((SHORT)lf->lfEscapement == getobj_lf.lfEscapement), /* win9x */
217  "lfEscapement: expect %08x got %08x\n", lf->lfEscapement, getobj_lf.lfEscapement);
218  ok(lf->lfOrientation == getobj_lf.lfOrientation ||
219  broken((SHORT)lf->lfOrientation == getobj_lf.lfOrientation), /* win9x */
220  "lfOrientation: expect %08x got %08x\n", lf->lfOrientation, getobj_lf.lfOrientation);
221  ok(lf->lfWeight == getobj_lf.lfWeight ||
222  broken((SHORT)lf->lfWeight == getobj_lf.lfWeight), /* win9x */
223  "lfWeight: expect %08x got %08x\n", lf->lfWeight, getobj_lf.lfWeight);
224  ok(lf->lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf->lfItalic, getobj_lf.lfItalic);
225  ok(lf->lfUnderline == getobj_lf.lfUnderline, "lfUnderline: expect %02x got %02x\n", lf->lfUnderline, getobj_lf.lfUnderline);
226  ok(lf->lfStrikeOut == getobj_lf.lfStrikeOut, "lfStrikeOut: expect %02x got %02x\n", lf->lfStrikeOut, getobj_lf.lfStrikeOut);
227  ok(lf->lfCharSet == getobj_lf.lfCharSet, "lfCharSet: expect %02x got %02x\n", lf->lfCharSet, getobj_lf.lfCharSet);
228  ok(lf->lfOutPrecision == getobj_lf.lfOutPrecision, "lfOutPrecision: expect %02x got %02x\n", lf->lfOutPrecision, getobj_lf.lfOutPrecision);
229  ok(lf->lfClipPrecision == getobj_lf.lfClipPrecision, "lfClipPrecision: expect %02x got %02x\n", lf->lfClipPrecision, getobj_lf.lfClipPrecision);
230  ok(lf->lfQuality == getobj_lf.lfQuality, "lfQuality: expect %02x got %02x\n", lf->lfQuality, getobj_lf.lfQuality);
231  ok(lf->lfPitchAndFamily == getobj_lf.lfPitchAndFamily, "lfPitchAndFamily: expect %02x got %02x\n", lf->lfPitchAndFamily, getobj_lf.lfPitchAndFamily);
232  ok(!lstrcmpA(lf->lfFaceName, getobj_lf.lfFaceName) ||
233  broken(!memcmp(lf->lfFaceName, getobj_lf.lfFaceName, LF_FACESIZE-1)), /* win9x doesn't ensure '\0' termination */
234  "%s: font names don't match: %s != %s\n", test, lf->lfFaceName, getobj_lf.lfFaceName);
235 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BYTE lfItalic
Definition: dimm.idl:47
#define LF_FACESIZE
Definition: dimm.idl:39
BYTE lfPitchAndFamily
Definition: dimm.idl:71
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BYTE lfStrikeOut
Definition: dimm.idl:49
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfClipPrecision
Definition: dimm.idl:69
BYTE lfUnderline
Definition: dimm.idl:48
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfCharSet
Definition: dimm.idl:50
#define test
Definition: rosglue.h:37
BYTE lfOutPrecision
Definition: dimm.idl:51
LOGFONTW * lf
Definition: font.c:2801
short SHORT
Definition: pedump.c:59
LONG lfHeight
Definition: dimm.idl:42
LONG lfOrientation
Definition: dimm.idl:62
#define ok(value,...)
LONG lfWeight
Definition: dimm.idl:46
LONG lfWidth
Definition: dimm.idl:60
BYTE lfPitchAndFamily
Definition: dimm.idl:54
static HFONT hfont
BYTE lfOutPrecision
Definition: dimm.idl:68
LONG lfWidth
Definition: dimm.idl:43
LONG lfOrientation
Definition: dimm.idl:45
int ret
BYTE lfQuality
Definition: dimm.idl:70
#define broken(x)
Definition: _sntprintf.h:21
BYTE lfQuality
Definition: dimm.idl:53
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfClipPrecision
Definition: dimm.idl:52
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
BYTE lfItalic
Definition: dimm.idl:64
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG lfWeight
Definition: dimm.idl:63
BYTE lfUnderline
Definition: dimm.idl:65
LONG lfEscapement
Definition: dimm.idl:44

Referenced by create_font(), test_CreateFontIndirectEx(), test_logfont(), and test_negative_width().

◆ check_vertical_font()

static void check_vertical_font ( const char name,
BOOL installed,
BOOL selected,
GLYPHMETRICS gm,
WORD gi 
)
static

Definition at line 5903 of file font.c.

5904 {
5905  LOGFONTA lf;
5906  HFONT hfont, hfont_prev;
5907  HDC hdc;
5908  char facename[100];
5909  DWORD ret;
5910  static const WCHAR str[] = { 0x2025 };
5911 
5912  *installed = is_truetype_font_installed(name);
5913 
5914  lf.lfHeight = -18;
5915  lf.lfWidth = 0;
5916  lf.lfEscapement = 0;
5917  lf.lfOrientation = 0;
5919  lf.lfItalic = 0;
5920  lf.lfUnderline = 0;
5921  lf.lfStrikeOut = 0;
5928 
5930  ok(hfont != NULL, "CreateFontIndirectA failed\n");
5931 
5932  hdc = GetDC(NULL);
5933 
5934  hfont_prev = SelectObject(hdc, hfont);
5935  ok(hfont_prev != NULL, "SelectObject failed\n");
5936 
5937  ret = GetTextFaceA(hdc, sizeof facename, facename);
5938  ok(ret, "GetTextFaceA failed\n");
5939  *selected = !strcmp(facename, name);
5940 
5941  ret = GetGlyphOutlineW(hdc, 0x2025, GGO_METRICS, gm, 0, NULL, &mat);
5942  ok(ret != GDI_ERROR, "GetGlyphOutlineW failed\n");
5943  if (!*selected)
5944  memset(gm, 0, sizeof *gm);
5945 
5946  ret = pGetGlyphIndicesW(hdc, str, 1, gi, 0);
5947  ok(ret != GDI_ERROR, "GetGlyphIndicesW failed\n");
5948 
5949  SelectObject(hdc, hfont_prev);
5951  ReleaseDC(NULL, hdc);
5952 }
BYTE lfPitchAndFamily
Definition: dimm.idl:71
#define GGO_METRICS
Definition: wingdi.h:847
#define DEFAULT_QUALITY
Definition: wingdi.h:435
#define FF_DONTCARE
Definition: wingdi.h:447
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
HDC WINAPI GetDC(_In_opt_ HWND)
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfClipPrecision
Definition: dimm.idl:69
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG lfEscapement
Definition: dimm.idl:61
static const MAT2 mat
Definition: font.c:66
#define DEFAULT_CHARSET
Definition: wingdi.h:383
LOGFONTW * lf
Definition: font.c:2801
LONG lfOrientation
Definition: dimm.idl:62
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ok(value,...)
const WCHAR * str
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
Definition: font.c:1161
static HFONT hfont
BYTE lfOutPrecision
Definition: dimm.idl:68
#define DEFAULT_PITCH
Definition: wingdi.h:442
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BYTE lfQuality
Definition: dimm.idl:70
HDC hdc
Definition: main.c:9
#define FW_DONTCARE
Definition: wingdi.h:367
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: name.c:36
int WINAPI GetTextFaceA(_In_ HDC hdc, _In_ int c, _Out_writes_to_opt_(c, return) LPSTR lpName)
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static BOOL is_truetype_font_installed(const char *name)
Definition: font.c:120
LONG lfWeight
Definition: dimm.idl:63
#define OUT_TT_ONLY_PRECIS
Definition: wingdi.h:421
#define GDI_ERROR
Definition: wingdi.h:1291
BYTE lfUnderline
Definition: dimm.idl:65
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_vertical_font().

◆ check_vertical_metrics()

static void check_vertical_metrics ( const char face)
static

Definition at line 5954 of file font.c.

5955 {
5956  LOGFONTA lf;
5957  HFONT hfont, hfont_prev;
5958  HDC hdc;
5959  DWORD ret;
5960  GLYPHMETRICS rgm, vgm;
5961  const UINT code = 0x5EAD, height = 1000;
5962  WORD idx;
5963  ABC abc, vabc;
5964  OUTLINETEXTMETRICA otm;
5965  USHORT numOfLongVerMetrics;
5966 
5967  hdc = GetDC(NULL);
5968 
5969  memset(&lf, 0, sizeof(lf));
5971  lf.lfHeight = -height;
5973  lf.lfEscapement = lf.lfOrientation = 900;
5975  hfont_prev = SelectObject(hdc, hfont);
5976  ret = GetGlyphOutlineW(hdc, code, GGO_METRICS, &rgm, 0, NULL, &mat);
5977  ok(ret != GDI_ERROR, "GetGlyphOutlineW failed\n");
5979  ok(ret, "GetCharABCWidthsW failed\n");
5980  DeleteObject(SelectObject(hdc, hfont_prev));
5981 
5982  memset(&lf, 0, sizeof(lf));
5983  strcpy(lf.lfFaceName, "@");
5985  lf.lfHeight = -height;
5988  hfont_prev = SelectObject(hdc, hfont);
5989  ret = GetGlyphOutlineW(hdc, code, GGO_METRICS, &vgm, 0, NULL, &mat);
5990  ok(ret != GDI_ERROR, "GetGlyphOutlineW failed\n");
5991  ret = GetCharABCWidthsW(hdc, code, code, &vabc);
5992  ok(ret, "GetCharABCWidthsW failed\n");
5993  ok(vabc.abcA == vgm.gmptGlyphOrigin.x, "expected %d, got %d\n",
5994  vabc.abcA, vgm.gmptGlyphOrigin.x);
5995  ok(vabc.abcB == vgm.gmBlackBoxX, "expected %d, got %d\n",
5996  vabc.abcB, vgm.gmBlackBoxX);
5997  ok(vabc.abcA + vabc.abcB + vabc.abcC == vgm.gmCellIncX,
5998  "expected %d, got %d\n",
5999  vabc.abcA + vabc.abcB + vabc.abcC, vgm.gmCellIncX);
6000 
6001  memset(&otm, 0, sizeof(otm));
6002  otm.otmSize = sizeof(otm);
6003  ret = GetOutlineTextMetricsA(hdc, sizeof(otm), &otm);
6004  ok(ret != 0, "GetOutlineTextMetricsA failed\n");
6005 
6006  if (GetFontData(hdc, MS_MAKE_TAG('v','h','e','a'), sizeof(SHORT) * 17,
6007  &numOfLongVerMetrics, sizeof(numOfLongVerMetrics)) != GDI_ERROR) {
6008  int offset;
6009  SHORT topSideBearing;
6010 
6011  if (!pGetGlyphIndicesW) {
6012  win_skip("GetGlyphIndices is not available on this platform\n");
6013  }
6014  else {
6015  ret = pGetGlyphIndicesW(hdc, (LPCWSTR)&code, 1, &idx, 0);
6016  ok(ret != 0, "GetGlyphIndicesW failed\n");
6017  numOfLongVerMetrics = GET_BE_WORD(numOfLongVerMetrics);
6018  if (numOfLongVerMetrics > idx)
6019  offset = idx * 2 + 1;
6020  else
6021  offset = numOfLongVerMetrics * 2 + (idx - numOfLongVerMetrics);
6022  ret = GetFontData(hdc, MS_MAKE_TAG('v','m','t','x'), offset * sizeof(SHORT),
6023  &topSideBearing, sizeof(SHORT));
6024  ok(ret != GDI_ERROR, "GetFontData(vmtx) failed\n");
6025  topSideBearing = GET_BE_WORD(topSideBearing);
6027  MulDiv(topSideBearing, height, otm.otmEMSquare), FALSE),
6028  "expected %d, got %d\n",
6029  MulDiv(topSideBearing, height, otm.otmEMSquare), vgm.gmptGlyphOrigin.x);
6030  }
6031  }
6032  else
6033  {
6034  ok(vgm.gmptGlyphOrigin.x == rgm.gmptGlyphOrigin.x + vgm.gmCellIncX + otm.otmDescent,
6035  "got %d, expected rgm.origin.x(%d) + vgm.cellIncX(%d) + descent(%d)\n",
6037  }
6038 
6039  ok(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB + otm.otmDescent ||
6040  broken(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB - otm.otmTextMetrics.tmDescent) /* win2k */,
6041  "got %d, expected abcA(%d) + abcB(%u) + descent(%d)\n",
6042  (INT)vgm.gmptGlyphOrigin.y, abc.abcA, abc.abcB, otm.otmDescent);
6043 
6044  DeleteObject(SelectObject(hdc, hfont_prev));
6045  ReleaseDC(NULL, hdc);
6046 }
Definition: wingdi.h:1388
#define GGO_METRICS
Definition: wingdi.h:847
long y
Definition: polytest.cpp:48
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
int abcC
Definition: wingdi.h:1391
UINT APIENTRY GetOutlineTextMetricsA(HDC hdc, UINT cbData, LPOUTLINETEXTMETRICA lpOTM)
Definition: font.c:1202
long x
Definition: polytest.cpp:48
HDC WINAPI GetDC(_In_opt_ HWND)
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
static HDC
Definition: imagelist.c:92
GLintptr offset
Definition: glext.h:5920
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG lfEscapement
Definition: dimm.idl:61
static const MAT2 mat
Definition: font.c:66
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:56
TEXTMETRICA otmTextMetrics
Definition: wingdi.h:2458
LOGFONTW * lf
Definition: font.c:2801
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
Definition: font.c:2654
short SHORT
Definition: pedump.c:59
LONG lfOrientation
Definition: dimm.idl:62
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ok(value,...)
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
Definition: font.c:1161
static LPTEXTMETRICW LONG * height
Definition: font.c:42
static HFONT hfont
UINT abcB
Definition: wingdi.h:1390
BOOL WINAPI GetCharABCWidthsW(HDC hdc, UINT FirstChar, UINT LastChar, LPABC lpabc)
Definition: font.c:787
POINT gmptGlyphOrigin
Definition: wingdi.h:2422
int abcA
Definition: wingdi.h:1389
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG tmDescent
Definition: wingdi.h:2341
int ret
HDC hdc
Definition: main.c:9
#define MS_MAKE_TAG(ch0, ch1, ch2, ch3)
Definition: font.c:77
short gmCellIncX
Definition: wingdi.h:2423
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define broken(x)
Definition: _sntprintf.h:21
#define match_off_by_1(a, b, exact)
Definition: font.c:38
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
UINT gmBlackBoxX
Definition: wingdi.h:2420
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
static UINT UINT LPWORD LPABC abc
Definition: font.c:44
#define GDI_ERROR
Definition: wingdi.h:1291
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define GET_BE_WORD(x)
Definition: font.c:73

Referenced by test_vertical_font().

◆ compare_tm()

static void compare_tm ( const TEXTMETRICA tm,
const TEXTMETRICA otm 
)
static

Definition at line 285 of file font.c.

286 {
287  ok(tm->tmHeight == otm->tmHeight, "tmHeight %d != %d\n", tm->tmHeight, otm->tmHeight);
288  ok(tm->tmAscent == otm->tmAscent, "tmAscent %d != %d\n", tm->tmAscent, otm->tmAscent);
289  ok(tm->tmDescent == otm->tmDescent, "tmDescent %d != %d\n", tm->tmDescent, otm->tmDescent);
290  ok(tm->tmInternalLeading == otm->tmInternalLeading, "tmInternalLeading %d != %d\n", tm->tmInternalLeading, otm->tmInternalLeading);
291  ok(tm->tmExternalLeading == otm->tmExternalLeading, "tmExternalLeading %d != %d\n", tm->tmExternalLeading, otm->tmExternalLeading);
292  ok(tm->tmAveCharWidth == otm->tmAveCharWidth, "tmAveCharWidth %d != %d\n", tm->tmAveCharWidth, otm->tmAveCharWidth);
293  ok(tm->tmMaxCharWidth == otm->tmMaxCharWidth, "tmMaxCharWidth %d != %d\n", tm->tmMaxCharWidth, otm->tmMaxCharWidth);
294  ok(tm->tmWeight == otm->tmWeight, "tmWeight %d != %d\n", tm->tmWeight, otm->tmWeight);
295  ok(tm->tmOverhang == otm->tmOverhang, "tmOverhang %d != %d\n", tm->tmOverhang, otm->tmOverhang);
296  ok(tm->tmDigitizedAspectX == otm->tmDigitizedAspectX, "tmDigitizedAspectX %d != %d\n", tm->tmDigitizedAspectX, otm->tmDigitizedAspectX);
297  ok(tm->tmDigitizedAspectY == otm->tmDigitizedAspectY, "tmDigitizedAspectY %d != %d\n", tm->tmDigitizedAspectY, otm->tmDigitizedAspectY);
298  ok(tm->tmFirstChar == otm->tmFirstChar, "tmFirstChar %d != %d\n", tm->tmFirstChar, otm->tmFirstChar);
299  ok(tm->tmLastChar == otm->tmLastChar, "tmLastChar %d != %d\n", tm->tmLastChar, otm->tmLastChar);
300  ok(tm->tmDefaultChar == otm->tmDefaultChar, "tmDefaultChar %d != %d\n", tm->tmDefaultChar, otm->tmDefaultChar);
301  ok(tm->tmBreakChar == otm->tmBreakChar, "tmBreakChar %d != %d\n", tm->tmBreakChar, otm->tmBreakChar);
302  ok(tm->tmItalic == otm->tmItalic, "tmItalic %d != %d\n", tm->tmItalic, otm->tmItalic);
303  ok(tm->tmUnderlined == otm->tmUnderlined, "tmUnderlined %d != %d\n", tm->tmUnderlined, otm->tmUnderlined);
304  ok(tm->tmStruckOut == otm->tmStruckOut, "tmStruckOut %d != %d\n", tm->tmStruckOut, otm->tmStruckOut);
305  ok(tm->tmPitchAndFamily == otm->tmPitchAndFamily, "tmPitchAndFamily %d != %d\n", tm->tmPitchAndFamily, otm->tmPitchAndFamily);
306  ok(tm->tmCharSet == otm->tmCharSet, "tmCharSet %d != %d\n", tm->tmCharSet, otm->tmCharSet);
307 }
LONG tmAveCharWidth
Definition: wingdi.h:2344
BYTE tmLastChar
Definition: wingdi.h:2351
LONG tmWeight
Definition: wingdi.h:2346
LONG tmDigitizedAspectY
Definition: wingdi.h:2349
BYTE tmPitchAndFamily
Definition: wingdi.h:2357
BYTE tmUnderlined
Definition: wingdi.h:2355
BYTE tmCharSet
Definition: wingdi.h:2358
BYTE tmFirstChar
Definition: wingdi.h:2350
#define ok(value,...)
BYTE tmDefaultChar
Definition: wingdi.h:2352
LONG tmHeight
Definition: wingdi.h:2339
LONG tmInternalLeading
Definition: wingdi.h:2342
LONG tmExternalLeading
Definition: wingdi.h:2343
LONG tmDescent
Definition: wingdi.h:2341
Definition: time.h:76
LONG tmAscent
Definition: wingdi.h:2340
LONG tmMaxCharWidth
Definition: wingdi.h:2345
BYTE tmStruckOut
Definition: wingdi.h:2356
BYTE tmItalic
Definition: wingdi.h:2354
LONG tmOverhang
Definition: wingdi.h:2347
LONG tmDigitizedAspectX
Definition: wingdi.h:2348
BYTE tmBreakChar
Definition: wingdi.h:2353

Referenced by test_font_metrics().

◆ create_fixed_pitch_font_proc()

static int CALLBACK create_fixed_pitch_font_proc ( const LOGFONTA lpelfe,
const TEXTMETRICA lpntme,
DWORD  FontType,
LPARAM  lParam 
)
static

Definition at line 4574 of file font.c.

4577 {
4578  const NEWTEXTMETRICEXA *lpntmex = (const NEWTEXTMETRICEXA *)lpntme;
4579  CHARSETINFO csi;
4580  LOGFONTA lf = *lpelfe;
4581  HFONT hfont;
4582  DWORD found_subset;
4583 
4584  /* skip bitmap, proportional or vertical font */
4585  if ((FontType & TRUETYPE_FONTTYPE) == 0 ||
4586  (lf.lfPitchAndFamily & 0xf) != FIXED_PITCH ||
4587  lf.lfFaceName[0] == '@')
4588  return 1;
4589 
4590  /* skip linked font */
4591  if (!TranslateCharsetInfo((DWORD*)(INT_PTR)lpelfe->lfCharSet, &csi, TCI_SRCCHARSET) ||
4592  (lpntmex->ntmFontSig.fsCsb[0] & csi.fs.fsCsb[0]) == 0)
4593  return 1;
4594 
4595  /* skip linked font, like SimSun-ExtB */
4596  switch (lpelfe->lfCharSet) {
4597  case SHIFTJIS_CHARSET:
4598  found_subset = lpntmex->ntmFontSig.fsUsb[1] & (1 << 17); /* Hiragana */
4599  break;
4600  case GB2312_CHARSET:
4601  case CHINESEBIG5_CHARSET:
4602  found_subset = lpntmex->ntmFontSig.fsUsb[1] & (1 << 16); /* CJK Symbols And Punctuation */
4603  break;
4604  case HANGEUL_CHARSET:
4605  found_subset = lpntmex->ntmFontSig.fsUsb[1] & (1 << 24); /* Hangul Syllables */
4606  break;
4607  default:
4608  found_subset = lpntmex->ntmFontSig.fsUsb[0] & (1 << 0); /* Basic Latin */
4609  break;
4610  }
4611  if (!found_subset)
4612  return 1;
4613 
4614  /* test with an odd height */
4615  lf.lfHeight = -19;
4616  lf.lfWidth = 0;
4618  if (hfont)
4619  {
4620  *(HFONT *)lParam = hfont;
4621  return 0;
4622  }
4623  return 1;
4624 }
FONTSIGNATURE fs
Definition: wingdi.h:1526
BYTE lfPitchAndFamily
Definition: dimm.idl:71
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
LONG lfHeight
Definition: dimm.idl:59
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:389
BYTE lfCharSet
Definition: dimm.idl:50
int32_t INT_PTR
Definition: typedefs.h:62
LOGFONTW * lf
Definition: font.c:2801
#define FIXED_PITCH
Definition: wingdi.h:443
LONG lfWidth
Definition: dimm.idl:60
static HFONT hfont
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:2650
#define SHIFTJIS_CHARSET
Definition: wingdi.h:385
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GB2312_CHARSET
Definition: wingdi.h:388
DWORD fsUsb[4]
Definition: wingdi.h:1520
BOOL WINAPI TranslateCharsetInfo(LPDWORD lpSrc, LPCHARSETINFO lpCs, DWORD flags)
Definition: font.c:2186
DWORD fsCsb[2]
Definition: wingdi.h:1521
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define HANGEUL_CHARSET
Definition: wingdi.h:386
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091
#define TCI_SRCCHARSET
Definition: wingdi.h:960

Referenced by test_GetGlyphOutline().

◆ create_font()

static HFONT create_font ( const char test,
const LOGFONTA lf 
)
static

Definition at line 237 of file font.c.

238 {
240  ok(hfont != 0, "%s: CreateFontIndirect failed\n", test);
241  if (hfont)
242  check_font(test, lf, hfont);
243  return hfont;
244 }
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
#define test
Definition: rosglue.h:37
LOGFONTW * lf
Definition: font.c:2801
#define ok(value,...)
static void check_font(const char *test, const LOGFONTA *lf, HFONT hfont)
Definition: font.c:195
static HFONT hfont
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)

Referenced by test_bitmap_font(), test_bitmap_font_metrics(), test_GetFontUnicodeRanges(), test_logfont(), test_orientation(), test_outline_font(), and test_SetTextJustification().

◆ create_font_proc()

static int CALLBACK create_font_proc ( const LOGFONTA lpelfe,
const TEXTMETRICA lpntme,
DWORD  FontType,
LPARAM  lParam 
)
static

Definition at line 1112 of file font.c.

1115 {
1116  if (FontType & TRUETYPE_FONTTYPE)
1117  {
1118  HFONT hfont;
1119 
1120  hfont = CreateFontIndirectA(lpelfe);
1121  if (hfont)
1122  {
1123  *(HFONT *)lParam = hfont;
1124  return 0;
1125  }
1126  }
1127 
1128  return 1;
1129 }
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
static HFONT hfont
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_GetCharABCWidths(), and test_GetGlyphOutline().

◆ DWORD()

static DWORD ( WINAPI pGdiGetCodePage)
static

◆ enum_all_fonts_proc()

static INT CALLBACK enum_all_fonts_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lparam 
)
static

Definition at line 5203 of file font.c.

5204 {
5205  int ret;
5206  LOGFONTA *lf;
5207 
5208  if (type != TRUETYPE_FONTTYPE) return 1;
5209 
5210  lf = (LOGFONTA *)lparam;
5211  ret = strcmp(lf->lfFaceName, elf->lfFaceName);
5212  if(ret == 0)
5213  {
5214  ok(ntm->tmWeight == elf->lfWeight, "expected %d got %d\n", ntm->tmWeight, elf->lfWeight);
5215  *lf = *elf;
5216  return 0;
5217  }
5218  return 1;
5219 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG tmWeight
Definition: wingdi.h:2346
LOGFONTW * lf
Definition: font.c:2801
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define ok(value,...)
LONG lfWeight
Definition: dimm.idl:46
int ret
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFonts().

◆ enum_font_data_proc()

static INT CALLBACK enum_font_data_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 3141 of file font.c.

3142 {
3143  struct enum_font_data *efd = (struct enum_font_data *)lParam;
3144 
3145  if (type != TRUETYPE_FONTTYPE) return 1;
3146 
3147  if (efd->total >= efd->size)
3148  {
3149  efd->size = max( (efd->total + 1) * 2, 256 );
3150  efd->lf = heap_realloc( efd->lf, efd->size * sizeof(*efd->lf) );
3151  if (!efd->lf) return 0;
3152  }
3153  efd->lf[efd->total++] = *lf;
3154 
3155  return 1;
3156 }
#define max(a, b)
Definition: svc.c:63
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
LOGFONTA * lf
Definition: font.c:2789
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFontFamiliesEx_default_charset(), and test_vertical_order().

◆ enum_fonts_proc()

static INT CALLBACK enum_fonts_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lparam 
)
static

Definition at line 5190 of file font.c.

5191 {
5192  LOGFONTA *lf;
5193 
5194  if (type != TRUETYPE_FONTTYPE) return 1;
5195 
5196  ok(ntm->tmWeight == elf->lfWeight, "expected %d got %d\n", ntm->tmWeight, elf->lfWeight);
5197 
5198  lf = (LOGFONTA *)lparam;
5199  *lf = *elf;
5200  return 0;
5201 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG tmWeight
Definition: wingdi.h:2346
ENUMLOGFONTA elf[MAX_ENUM_FONTS]
Definition: usp10.c:2410
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define ok(value,...)
LOGFONTA * lf
Definition: font.c:2789
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFonts().

◆ enum_fullname_data_proc()

static INT CALLBACK enum_fullname_data_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 3158 of file font.c.

3159 {
3160  struct enum_fullname_data *efnd = (struct enum_fullname_data *)lParam;
3161 
3162  if (type != TRUETYPE_FONTTYPE) return 1;
3163 
3164  if (efnd->total >= efnd->size)
3165  {
3166  efnd->size = max( (efnd->total + 1) * 2, 256 );
3167  efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) );
3168  if (!efnd->elf) return 0;
3169  }
3170  efnd->elf[efnd->total++] = *(ENUMLOGFONTA *)lf;
3171 
3172  return 1;
3173 }
#define max(a, b)
Definition: svc.c:63
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
ENUMLOGFONTA * elf
Definition: font.c:2795
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_fullname2_helper().

◆ enum_ms_shell_dlg2_proc()

static INT CALLBACK enum_ms_shell_dlg2_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 5315 of file font.c.

5316 {
5317  struct enum_fullname_data *efnd = (struct enum_fullname_data *)lParam;
5318 
5319 if (0) /* Disabled to limit console spam */
5320  trace("enumed font \"%s\", charset %d, height %d, weight %d, italic %d\n",
5321  lf->lfFaceName, lf->lfCharSet, lf->lfHeight, lf->lfWeight, lf->lfItalic);
5322 
5323  if (type != TRUETYPE_FONTTYPE) return 1;
5324  if (strcmp(lf->lfFaceName, "MS Shell Dlg 2") != 0) return 1;
5325 
5326  if (efnd->total >= efnd->size)
5327  {
5328  efnd->size = max( (efnd->total + 1) * 2, 256 );
5329  efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) );
5330  if (!efnd->elf) return 0;
5331  }
5332  efnd->elf[efnd->total++] = *(ENUMLOGFONTA *)lf;
5333  return 0;
5334 }
BYTE lfItalic
Definition: dimm.idl:47
#define trace(...)
Definition: kmt_test.h:217
#define max(a, b)
Definition: svc.c:63
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BYTE lfCharSet
Definition: dimm.idl:50
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
LONG lfHeight
Definition: dimm.idl:42
LONG lfWeight
Definition: dimm.idl:46
ENUMLOGFONTA * elf
Definition: font.c:2795
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFonts_subst().

◆ enum_ms_shell_dlg_proc()

static INT CALLBACK enum_ms_shell_dlg_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 5294 of file font.c.

5295 {
5296  struct enum_fullname_data *efnd = (struct enum_fullname_data *)lParam;
5297 
5298 if (0) /* Disabled to limit console spam */
5299  trace("enumed font \"%s\", charset %d, height %d, weight %d, italic %d\n",
5300  lf->lfFaceName, lf->lfCharSet, lf->lfHeight, lf->lfWeight, lf->lfItalic);
5301 
5302  if (type != TRUETYPE_FONTTYPE) return 1;
5303  if (strcmp(lf->lfFaceName, "MS Shell Dlg") != 0) return 1;
5304 
5305  if (efnd->total >= efnd->size)
5306  {
5307  efnd->size = max( (efnd->total + 1) * 2, 256 );
5308  efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) );
5309  if (!efnd->elf) return 0;
5310  }
5311  efnd->elf[efnd->total++] = *(ENUMLOGFONTA *)lf;
5312  return 0;
5313 }
BYTE lfItalic
Definition: dimm.idl:47
#define trace(...)
Definition: kmt_test.h:217
#define max(a, b)
Definition: svc.c:63
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BYTE lfCharSet
Definition: dimm.idl:50
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
LONG lfHeight
Definition: dimm.idl:42
LONG lfWeight
Definition: dimm.idl:46
ENUMLOGFONTA * elf
Definition: font.c:2795
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_EnumFonts_subst().

◆ enum_multi_charset_font_proc()

static INT CALLBACK enum_multi_charset_font_proc ( const LOGFONTA lf,
const TEXTMETRICA tm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 3120 of file font.c.

3121 {
3122  const NEWTEXTMETRICEXA *ntm = (const NEWTEXTMETRICEXA *)tm;
3124  const DWORD valid_bits = 0x003f01ff;
3125  CHARSETINFO csi;
3126  DWORD fs;
3127 
3128  if (type != TRUETYPE_FONTTYPE) return TRUE;
3129 
3130  if (TranslateCharsetInfo(ULongToPtr(target->lfCharSet), &csi, TCI_SRCCHARSET)) {
3131  fs = ntm->ntmFontSig.fsCsb[0] & valid_bits;
3132  if ((fs & csi.fs.fsCsb[0]) && (fs & ~csi.fs.fsCsb[0]) && (fs & FS_LATIN1)) {
3133  *target = *lf;
3134  return FALSE;
3135  }
3136  }
3137 
3138  return TRUE;
3139 }
FONTSIGNATURE fs
Definition: wingdi.h:1526
#define TRUE
Definition: types.h:120
#define ULongToPtr(ul)
Definition: basetsd.h:92
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: fs.h:235
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:2650
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: time.h:76
BOOL WINAPI TranslateCharsetInfo(LPDWORD lpSrc, LPCHARSETINFO lpCs, DWORD flags)
Definition: font.c:2186
DWORD fsCsb[2]
Definition: wingdi.h:1521
#define fs
Definition: i386-dis.c:435
#define FS_LATIN1
Definition: wingdi.h:559
GLenum target
Definition: glext.h:7315
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091
#define TCI_SRCCHARSET
Definition: wingdi.h:960

Referenced by test_EnumFontFamiliesEx_default_charset().

◆ enum_truetype_font_proc()

static INT CALLBACK enum_truetype_font_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 4031 of file font.c.

4032 {
4033  INT *enumed = (INT *)lParam;
4034 
4035  if (type == TRUETYPE_FONTTYPE)
4036  {
4037  (*enumed)++;
4038  test_text_metrics(lf, (const NEWTEXTMETRICA *)ntm);
4039  }
4040  return 1;
4041 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
Definition: font.c:3811
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by test_GetTextMetrics().

◆ enum_with_magic_retval_proc()

static INT CALLBACK enum_with_magic_retval_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lparam 
)
static

Definition at line 5221 of file font.c.

5222 {
5223  return lparam;
5224 }
static UINT WPARAM LPARAM lparam
Definition: combo.c:716

Referenced by test_EnumFonts().

◆ expect_ff()

static void expect_ff ( const TEXTMETRICA tmA,
const TT_OS2_V4 os2,
WORD  family,
const char name 
)
static

Definition at line 3396 of file font.c.

3397 {
3398  ok((tmA->tmPitchAndFamily & 0xf0) == family ||
3400  "%s: expected family %02x got %02x. panose %d-%d-%d-%d-...\n",
3401  name, family, tmA->tmPitchAndFamily, os2->panose.bFamilyType, os2->panose.bSerifStyle,
3402  os2->panose.bWeight, os2->panose.bProportion);
3403 }
BYTE bWeight
Definition: wingdi.h:1849
BYTE bFamilyType
Definition: wingdi.h:1847
BYTE tmPitchAndFamily
Definition: wingdi.h:2357
#define ok(value,...)
BYTE bSerifStyle
Definition: wingdi.h:1848
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: lang.c:751
#define LANG_ENGLISH
Definition: nls.h:52
BYTE bProportion
Definition: wingdi.h:1850
#define broken(x)
Definition: _sntprintf.h:21
PANOSE panose
Definition: font.c:3310
Definition: name.c:36
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by test_text_metrics().

◆ find_font_proc()

static INT CALLBACK find_font_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 739 of file font.c.

740 {
741  LOGFONTA *lf = (LOGFONTA *)lParam;
742 
743  if (elf->lfHeight == lf->lfHeight && !strcmp(elf->lfFaceName, lf->lfFaceName))
744  {
745  *lf = *elf;
746  return 0; /* stop enumeration */
747  }
748  return 1; /* continue enumeration */
749 }
LONG lfHeight
Definition: dimm.idl:42
ENUMLOGFONTA * elf
Definition: font.c:2795
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LPARAM lParam
Definition: combotst.c:139

Referenced by test_bitmap_font_metrics().

◆ find_ttf_table()

static void* find_ttf_table ( void ttf,
DWORD  size,
DWORD  tag 
)
static

Definition at line 1942 of file font.c.

1943 {
1944  WORD i, num_tables = GET_BE_WORD(*((WORD *)ttf + 2));
1945  DWORD *table = (DWORD *)ttf + 3;
1946 
1947  for (i = 0; i < num_tables; i++)
1948  {
1949  if (table[0] == tag)
1950  return (BYTE *)ttf + GET_BE_DWORD(table[2]);
1951  table += 4;
1952  }
1953  return NULL;
1954 }
Definition: ecma_167.h:138
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GET_BE_DWORD(x)
Definition: font.c:74
unsigned char BYTE
Definition: mem.h:68
#define GET_BE_WORD(x)
Definition: font.c:73

Referenced by test_height_selection_vdmx().

◆ font_enum_proc()

static INT CALLBACK font_enum_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 273 of file font.c.

274 {
275  if (type & RASTER_FONTTYPE)
276  {
277  LOGFONTA *lf = (LOGFONTA *)lParam;
278  *lf = *elf;
279  return 0; /* stop enumeration */
280  }
281 
282  return 1; /* continue enumeration */
283 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
ENUMLOGFONTA * elf
Definition: font.c:2795
#define RASTER_FONTTYPE
Definition: wingdi.h:1089
LPARAM lParam
Definition: combotst.c:139

Referenced by test_bitmap_font().

◆ free_font()

static void free_font ( void font)
static

Definition at line 5039 of file font.c.

5040 {
5042 }
Definition: mk_font.cpp:20
#define UnmapViewOfFile
Definition: compat.h:403

Referenced by test_AddFontMemResource().

◆ get_charset_stats()

static void get_charset_stats ( struct enum_font_data efd,
int ansi_charset,
int symbol_charset,
int russian_charset 
)
static

Definition at line 2856 of file font.c.

2859 {
2860  int i;
2861 
2862  *ansi_charset = 0;
2863  *symbol_charset = 0;
2864  *russian_charset = 0;
2865 
2866  for (i = 0; i < efd->total; i++)
2867  {
2868  switch (efd->lf[i].lfCharSet)
2869  {
2870  case ANSI_CHARSET:
2871  (*ansi_charset)++;
2872  break;
2873  case SYMBOL_CHARSET:
2874  (*symbol_charset)++;
2875  break;
2876  case RUSSIAN_CHARSET:
2877  (*russian_charset)++;
2878  break;
2879  }
2880  }
2881 }
#define SYMBOL_CHARSET
Definition: wingdi.h:384
BYTE lfCharSet
Definition: dimm.idl:50
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LOGFONTA * lf
Definition: font.c:2789
#define RUSSIAN_CHARSET
Definition: wingdi.h:395
#define ANSI_CHARSET
Definition: wingdi.h:382

Referenced by test_EnumFontFamilies().

◆ get_charset_statsW()

static void get_charset_statsW ( struct enum_font_dataW efd,
int ansi_charset,
int symbol_charset,
int russian_charset 
)
static

Definition at line 2883 of file font.c.

2886 {
2887  int i;
2888 
2889  *ansi_charset = 0;
2890  *symbol_charset = 0;
2891  *russian_charset = 0;
2892 
2893  for (i = 0; i < efd->total; i++)
2894  {
2895  switch (efd->lf[i].lfCharSet)
2896  {
2897  case ANSI_CHARSET:
2898  (*ansi_charset)++;
2899  break;
2900  case SYMBOL_CHARSET:
2901  (*symbol_charset)++;
2902  break;
2903  case RUSSIAN_CHARSET:
2904  (*russian_charset)++;
2905  break;
2906  }
2907  }
2908 }
#define SYMBOL_CHARSET
Definition: wingdi.h:384
BYTE lfCharSet
Definition: dimm.idl:67
LOGFONTW * lf
Definition: font.c:2801
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RUSSIAN_CHARSET
Definition: wingdi.h:395
#define ANSI_CHARSET
Definition: wingdi.h:382

Referenced by test_EnumFontFamilies().

◆ get_cmap()

static void* get_cmap ( cmap_header header,
USHORT  plat_id,
USHORT  enc_id 
)
static

Definition at line 3456 of file font.c.

3457 {
3458  USHORT i;
3460 
3461  for(i = 0; i < GET_BE_WORD(header->num_tables); i++)
3462  {
3463  if(GET_BE_WORD(record->plat_id) == plat_id && GET_BE_WORD(record->enc_id) == enc_id)
3464  return (BYTE *)header + GET_BE_DWORD(record->offset);
3465  record++;
3466  }
3467  return NULL;
3468 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define GET_BE_DWORD(x)
Definition: font.c:74
unsigned char BYTE
Definition: mem.h:68
unsigned short USHORT
Definition: pedump.c:61
struct CFHEADER header
Definition: fdi.c:109
#define GET_BE_WORD(x)
Definition: font.c:73

Referenced by get_first_last_from_cmap().

◆ get_first_last_from_cmap()

static BOOL get_first_last_from_cmap ( HDC  hdc,
DWORD first,
DWORD last,
cmap_type cmap_type 
)
static

Definition at line 3477 of file font.c.

3478 {
3479  LONG size, ret;
3481  void *cmap;
3482  BOOL r = FALSE;
3483  WORD format;
3484 
3485  size = GetFontData(hdc, MS_CMAP_TAG, 0, NULL, 0);
3486  ok(size != GDI_ERROR, "no cmap table found\n");
3487  if(size == GDI_ERROR) return FALSE;
3488 
3491  ok(ret == size, "GetFontData should return %u not %u\n", size, ret);
3492  ok(GET_BE_WORD(header->version) == 0, "got cmap version %d\n", GET_BE_WORD(header->version));
3493 
3494  cmap = get_cmap(header, 3, 1);
3495  if(cmap)
3497  else
3498  {
3499  cmap = get_cmap(header, 3, 0);
3500  if(cmap) *cmap_type = cmap_ms_symbol;
3501  }
3502  if(!cmap)
3503  {
3504  *cmap_type = cmap_none;
3505  goto end;
3506  }
3507 
3508  format = GET_BE_WORD(*(WORD *)cmap);
3509  switch(format)
3510  {
3511  case 0:
3513  break;
3514  case 4:
3516  break;
3517  default:
3518  trace("unhandled cmap format %d\n", format);
3519  break;
3520  }
3521 
3522 end:
3524  return r;
3525 }
#define trace(...)
Definition: kmt_test.h:217
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLint * first
Definition: glext.h:5794
GLuint GLuint end
Definition: gl.h:1545
static UINT UINT last
Definition: font.c:45
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static BOOL get_first_last_from_cmap0(void *ptr, DWORD *first, DWORD *last)
Definition: font.c:3405
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
Definition: font.c:2654
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define MS_CMAP_TAG
Definition: font.c:81
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static void * get_cmap(cmap_header *header, USHORT plat_id, USHORT enc_id)
Definition: font.c:3456
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned short WORD
Definition: ntddk_ex.h:93
int ret
HDC hdc
Definition: main.c:9
static const WORD INT INT LPINT LPINT LPSIZE size
Definition: font.c:53
cmap_type
Definition: font.c:3470
#define GDI_ERROR
Definition: wingdi.h:1291
#define HeapFree(x, y, z)
Definition: compat.h:394
struct CFHEADER header
Definition: fdi.c:109
#define GET_BE_WORD(x)
Definition: font.c:73
static BOOL get_first_last_from_cmap4(void *ptr, DWORD *first, DWORD *last, DWORD limit)
Definition: font.c:3431

Referenced by test_text_metrics().

◆ get_first_last_from_cmap0()

static BOOL get_first_last_from_cmap0 ( void ptr,
DWORD first,
DWORD last 
)
static

Definition at line 3405 of file font.c.

3406 {
3407  int i;
3408  cmap_format_0 *cmap = (cmap_format_0*)ptr;
3409 
3410  *first = 256;
3411 
3412  for(i = 0; i < 256; i++)
3413  {
3414  if(cmap->glyph_ids[i] == 0) continue;
3415  *last = i;
3416  if(*first == 256) *first = i;
3417  }
3418  if(*first == 256) return FALSE;
3419  return TRUE;
3420 }
#define TRUE
Definition: types.h:120
const GLint * first
Definition: glext.h:5794
static UINT UINT last
Definition: font.c:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
BYTE glyph_ids[256]
Definition: font.c:3364

Referenced by get_first_last_from_cmap().

◆ get_first_last_from_cmap4()

static BOOL get_first_last_from_cmap4 ( void ptr,
DWORD first,
DWORD last,
DWORD  limit 
)
static

Definition at line 3431 of file font.c.

3432 {
3433  int i;
3434  cmap_format_4 *cmap = (cmap_format_4*)ptr;
3435  USHORT seg_count = GET_BE_WORD(cmap->seg_countx2) / 2;
3436 
3437  *first = 0x10000;
3438 
3439  for(i = 0; i < seg_count; i++)
3440  {
3442 
3443  get_seg4(cmap, i, &seg);
3444 
3445  if(seg.start_count > 0xfffe) break;
3446 
3447  if(*first == 0x10000) *first = seg.start_count;
3448 
3449  *last = min(seg.end_count, 0xfffe);
3450  }
3451 
3452  if(*first == 0x10000) return FALSE;
3453  return TRUE;
3454 }
#define TRUE
Definition: types.h:120
const GLint * first
Definition: glext.h:5794
static UINT UINT last
Definition: font.c:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
seg
Definition: i386-dis.c:3857
USHORT seg_countx2
Definition: font.c:3373
unsigned short USHORT
Definition: pedump.c:61
#define min(a, b)
Definition: monoChain.cc:55
static void get_seg4(cmap_format_4 *cmap, USHORT seg_num, cmap_format_4_seg *seg)
Definition: font.c:3422
#define GET_BE_WORD(x)
Definition: font.c:73

Referenced by get_first_last_from_cmap().

◆ get_font_dpi()

static int get_font_dpi ( const LOGFONTA lf,
int height 
)
static

Definition at line 6165 of file font.c.

6166 {
6167  HDC hdc = CreateCompatibleDC(0);
6168  HFONT hfont;
6169  TEXTMETRICA tm;
6170  int ret;
6171 
6172  hfont = CreateFontIndirectA(lf);
6173  ok(hfont != 0, "CreateFontIndirect failed\n");
6174 
6176  ret = GetTextMetricsA(hdc, &tm);
6177  ok(ret, "GetTextMetrics failed\n");
6178  ret = tm.tmDigitizedAspectX;
6179  if (height) *height = tm.tmHeight;
6180 
6181  DeleteDC(hdc);
6183 
6184  return ret;
6185 }
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define ok(value,...)
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
static HFONT hfont
int ret
HDC hdc
Definition: main.c:9
Definition: time.h:76
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
BOOL WINAPI DeleteDC(_In_ HDC)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)

Referenced by test_stock_fonts().

◆ get_font_fsselection()

static UINT get_font_fsselection ( LOGFONTA lf)
static

Definition at line 2154 of file font.c.

2155 {
2156  OUTLINETEXTMETRICA *otm;
2157  HFONT hfont, hfont_old;
2158  DWORD ret, otm_size;
2159  UINT fsSelection;
2160  HDC hdc;
2161 
2162  hdc = GetDC(0);
2163  hfont = CreateFontIndirectA(lf);
2164  ok(hfont != NULL, "failed to create a font\n");
2165 
2166  hfont_old = SelectObject(hdc, hfont);
2167 
2168  otm_size = GetOutlineTextMetricsA(hdc, 0, NULL);
2169  otm = HeapAlloc(GetProcessHeap(), 0, otm_size);
2170  otm->otmSize = sizeof(*otm);
2171  ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
2172  ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
2173  fsSelection = otm->otmfsSelection;
2174  HeapFree(GetProcessHeap(), 0, otm);
2175  SelectObject(hdc, hfont_old);
2177  ReleaseDC(0, hdc);
2178 
2179  return fsSelection;
2180 }
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
UINT APIENTRY GetOutlineTextMetricsA(HDC hdc, UINT cbData, LPOUTLINETEXTMETRICA lpOTM)
Definition: font.c:1202
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static HFONT hfont
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HDC hdc
Definition: main.c:9
unsigned int UINT
Definition: ndis.h:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_GetOutlineTextMetrics().

◆ get_glyph_indices()

static BOOL get_glyph_indices ( INT  charset,
UINT  code_page,
WORD idx,
UINT  count,
BOOL  unicode 
)
static

Definition at line 2496 of file font.c.

2497 {
2498  HDC hdc;
2499  LOGFONTA lf;
2500  HFONT hfont, hfont_old;
2501  CHARSETINFO csi;
2502  FONTSIGNATURE fs;
2503  INT cs;
2504  DWORD i, ret;
2505  char name[64];
2506 
2507  assert(count <= 128);
2508 
2509  memset(&lf, 0, sizeof(lf));
2510 
2511  lf.lfCharSet = charset;
2512  lf.lfHeight = 10;
2513  lstrcpyA(lf.lfFaceName, "Arial");
2514  SetLastError(0xdeadbeef);
2515  hfont = CreateFontIndirectA(&lf);
2516  ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
2517 
2518  hdc = GetDC(0);
2519  hfont_old = SelectObject(hdc, hfont);
2520 
2521  cs = GetTextCharsetInfo(hdc, &fs, 0);
2522  ok(cs == charset, "expected %d, got %d\n", charset, cs);
2523 
2524  SetLastError(0xdeadbeef);
2525  ret = GetTextFaceA(hdc, sizeof(name), name);
2526  ok(ret, "GetTextFaceA error %u\n", GetLastError());
2527 
2528  if (charset == SYMBOL_CHARSET)
2529  {
2530  ok(strcmp("Arial", name), "face name should NOT be Arial\n");
2531  ok(fs.fsCsb[0] & (1u << 31), "symbol encoding should be available\n");
2532  }
2533  else
2534  {
2535  ok(!strcmp("Arial", name), "face name should be Arial, not %s\n", name);
2536  ok(!(fs.fsCsb[0] & (1u << 31)), "symbol encoding should NOT be available\n");
2537  }
2538 
2540  {
2541  trace("Can't find codepage for charset %d\n", cs);
2542  ReleaseDC(0, hdc);
2543  return FALSE;
2544  }
2545  ok(csi.ciACP == code_page, "expected %d, got %d\n", code_page, csi.ciACP);
2546 
2547  if (pGdiGetCodePage != NULL && pGdiGetCodePage(hdc) != code_page)
2548  {
2549  skip("Font code page %d, looking for code page %d\n",
2550  pGdiGetCodePage(hdc), code_page);
2551  ReleaseDC(0, hdc);
2552  return FALSE;
2553  }
2554 
2555  if (unicode)
2556  {
2557  char ansi_buf[128];
2558  WCHAR unicode_buf[128];
2559 
2560  for (i = 0; i < count; i++) ansi_buf[i] = (BYTE)(i + 128);
2561 
2562  MultiByteToWideChar(code_page, 0, ansi_buf, count, unicode_buf, count);
2563 
2564  SetLastError(0xdeadbeef);
2565  ret = pGetGlyphIndicesW(hdc, unicode_buf, count, idx, 0);
2566  ok(ret == count, "GetGlyphIndicesW expected %d got %d, error %u\n",
2567  count, ret, GetLastError());
2568  }
2569  else
2570  {
2571  char ansi_buf[128];
2572 
2573  for (i = 0; i < count; i++) ansi_buf[i] = (BYTE)(i + 128);
2574 
2575  SetLastError(0xdeadbeef);
2576  ret = pGetGlyphIndicesA(hdc, ansi_buf, count, idx, 0);
2577  ok(ret == count, "GetGlyphIndicesA expected %d got %d, error %u\n",
2578  count, ret, GetLastError());
2579  }
2580 
2581  SelectObject(hdc, hfont_old);
2583 
2584  ReleaseDC(0, hdc);
2585 
2586  return TRUE;
2587 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define trace(...)
Definition: kmt_test.h:217
#define TRUE
Definition: types.h:120
CFF_Charset charset
Definition: cffcmap.c:138
HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf)
Definition: font.c:1699
HDC WINAPI GetDC(_In_opt_ HWND)
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SYMBOL_CHARSET
Definition: wingdi.h:384
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BYTE lfCharSet
Definition: dimm.idl:50
int32_t INT_PTR
Definition: typedefs.h:62
Definition: fs.h:235
int32_t INT
Definition: typedefs.h:56
uint32_t cs
Definition: isohybrid.c:75
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG lfHeight
Definition: dimm.idl:42
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ok(value,...)
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
int WINAPI GetTextCharsetInfo(_In_ HDC, _Out_opt_ LPFONTSIGNATURE, _In_ DWORD)
static HFONT hfont
__wchar_t WCHAR
Definition: xmlstorage.h:180
static UINT UINT count
Definition: font.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int ret
HDC hdc
Definition: main.c:9
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI TranslateCharsetInfo(LPDWORD lpSrc, LPCHARSETINFO lpCs, DWORD flags)
Definition: font.c:2186
#define fs
Definition: i386-dis.c:435
#define MultiByteToWideChar
Definition: compat.h:100
#define skip(...)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: name.c:36
int WINAPI GetTextFaceA(_In_ HDC hdc, _In_ int c, _Out_writes_to_opt_(c, return) LPSTR lpName)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define memset(x, y, z)
Definition: compat.h:39
#define TCI_SRCCHARSET
Definition: wingdi.h:960

Referenced by test_font_charset().

◆ get_mac_code_page()

static WORD get_mac_code_page ( const sfnt_name name)
inlinestatic

Definition at line 3676 of file font.c.

3677 {
3678  if (GET_BE_WORD(name->encoding_id) == TT_MAC_ID_SIMPLIFIED_CHINESE) return 10008; /* special case */
3679  return 10000 + GET_BE_WORD(name->encoding_id);
3680 }
#define TT_MAC_ID_SIMPLIFIED_CHINESE
Definition: font.c:3540
Definition: name.c:36
#define GET_BE_WORD(x)
Definition: font.c:73

Referenced by match_name_table_language().

◆ get_res_data()

static void* get_res_data ( const char fontname,
DWORD rsrc_size 
)
static

Definition at line 149 of file font.c.

150 {
151  HRSRC rsrc;
152  void *rsrc_data;
153 
154  rsrc = FindResourceA(GetModuleHandleA(NULL), fontname, (LPCSTR)RT_RCDATA);
155  if (!rsrc) return NULL;
156 
157  rsrc_data = LockResource(LoadResource(GetModuleHandleA(NULL), rsrc));
158  if (!rsrc_data) return NULL;
159 
160  *rsrc_size = SizeofResource(GetModuleHandleA(NULL), rsrc);
161  if (!*rsrc_size) return NULL;
162 
163  return rsrc_data;
164 }
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define RT_RCDATA
Definition: pedump.c:372
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568

Referenced by test_height_selection_vdmx(), and write_ttf_file().

◆ get_seg4()

static void get_seg4 ( cmap_format_4 cmap,
USHORT  seg_num,
cmap_format_4_seg seg 
)
static

Definition at line 3422 of file font.c.

3423 {
3424  USHORT segs = GET_BE_WORD(cmap->seg_countx2) / 2;
3425  seg->end_count = GET_BE_WORD(cmap->end_count[seg_num]);
3426  seg->start_count = GET_BE_WORD(cmap->end_count[segs + 1 + seg_num]);
3427  seg->id_delta = GET_BE_WORD(cmap->end_count[2 * segs + 1 + seg_num]);
3428  seg->id_range_offset = GET_BE_WORD(cmap->end_count[3 * segs + 1 + seg_num]);
3429 }
USHORT end_count[1]
Definition: font.c:3378
seg
Definition: i386-dis.c:3857
USHORT seg_countx2
Definition: font.c:3373
unsigned short USHORT
Definition: pedump.c:61
#define GET_BE_WORD(x)
Definition: font.c:73

Referenced by get_first_last_from_cmap4().

◆ get_ttf_nametable_entry()

static BOOL get_ttf_nametable_entry ( HDC  hdc,
WORD  name_id,
WCHAR out_buf,
SIZE_T  out_size,
LCID  language_id 
)
static

Definition at line 3729 of file font.c.

3730 {
3731  struct sfnt_name_header
3732  {
3733  USHORT format;
3734  USHORT number_of_record;
3735  USHORT storage_offset;
3736  } *header;
3737  sfnt_name *entry;
3738  BOOL r = FALSE;
3739  LONG size, offset, length;
3740  LONG c, ret;
3741  WCHAR *name;
3742  BYTE *data;
3743  USHORT i;
3744  int res, best_lang = 0, best_index = -1;
3745 
3746  size = GetFontData(hdc, MS_NAME_TAG, 0, NULL, 0);
3747  ok(size != GDI_ERROR, "no name table found\n");
3748  if(size == GDI_ERROR) return FALSE;
3749 
3750  data = HeapAlloc(GetProcessHeap(), 0, size);
3752  ok(ret == size, "GetFontData should return %u not %u\n", size, ret);
3753 
3754  header = (void *)data;
3755  header->format = GET_BE_WORD(header->format);
3756  header->number_of_record = GET_BE_WORD(header->number_of_record);
3757  header->storage_offset = GET_BE_WORD(header->storage_offset);
3758  if (header->format != 0)
3759  {
3760  trace("got format %u\n", header->format);
3761  goto out;
3762  }
3763  if (header->number_of_record == 0 || sizeof(*header) + header->number_of_record * sizeof(*entry) > size)
3764  {
3765  trace("number records out of range: %d\n", header->number_of_record);
3766  goto out;
3767  }
3768  if (header->storage_offset >= size)
3769  {
3770  trace("storage_offset %u > size %u\n", header->storage_offset, size);
3771  goto out;
3772  }
3773 
3774  entry = (void *)&header[1];
3775  for (i = 0; i < header->number_of_record; i++)
3776  {
3777  if (GET_BE_WORD(entry[i].name_id) != name_id) continue;
3778  res = match_name_table_language( &entry[i], language_id);
3779  if (res > best_lang)
3780  {
3781  best_lang = res;
3782  best_index = i;
3783  }
3784  }
3785 
3786  offset = header->storage_offset + GET_BE_WORD(entry[best_index].offset);
3787  length = GET_BE_WORD(entry[best_index].length);
3788  if (offset + length > size)
3789  {
3790  trace("entry %d is out of range\n", best_index);
3791  goto out;
3792  }
3793  if (length >= out_size)
3794  {
3795  trace("buffer too small for entry %d\n", best_index);
3796  goto out;
3797  }
3798 
3799  name = (WCHAR *)(data + offset);
3800  for (c = 0; c < length / 2; c++)
3801  out_buf[c] = GET_BE_WORD(name[c]);
3802  out_buf[c] = 0;
3803 
3804  r = TRUE;
3805 
3806 out:
3807  HeapFree(GetProcessHeap(), 0, data);
3808  return r;
3809 }
#define trace(...)
Definition: kmt_test.h:217
#define TRUE
Definition: types.h:120
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLintptr offset
Definition: glext.h:5920
static int match_name_table_language(const sfnt_name *name, LANGID lang)
Definition: font.c:3682
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
Definition: font.c:2654
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MS_NAME_TAG
Definition: font.c:82
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
const GLubyte * c
Definition: glext.h:8905
static FILE * out
Definition: regtests2xml.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
HDC hdc
Definition: main.c:9
uint32_t entry
Definition: isohybrid.c:63
unsigned char BYTE
Definition: mem.h:68
static const WORD INT INT LPINT LPINT LPSIZE size
Definition: font.c:53
unsigned short USHORT
Definition: pedump.c:61
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define c
Definition: ke_i.h:80
#define GDI_ERROR
Definition: wingdi.h:1291
#define HeapFree(x, y, z)
Definition: compat.h:394
struct CFHEADER header
Definition: fdi.c:109
#define GET_BE_WORD(x)
Definition: font.c:73
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by test_fullname(), and test_fullname2_helper().

◆ HANDLE()

static HANDLE ( WINAPI pAddFontMemResourceEx)
static

◆ has_vertical_font_proc()

static INT CALLBACK has_vertical_font_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 6108 of file font.c.

6110 {
6111  if (lf->lfFaceName[0] == '@') {
6112  return 0;
6113  }
6114  return 1;
6115 }
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55

Referenced by test_east_asian_font_selection().

◆ HFONT()

static DWORD* static HFONT ( WINAPI pCreateFontIndirectExA) const
static

Referenced by add_ruler_units(), AddCharToSelection(), AdvAppearanceDlg_Init(), BuildFont(), BUTTON_CalcLabelRect(), BUTTON_WindowProc(), ButtonWndProc_common(), Pane::calc_single_width(), calc_single_width(), Pane::calc_widths(), calc_widths(), CB_Paint(), CB_ThemedPaint(), CBGetTextAreaHeight(), CBPaintText(), CFn_WMMeasureItem(), CFn_WMPaint(), check_height_font_enumproc(), check_item_height(), check_vertical_font(), check_vertical_metrics(), CheckListWndProc(), ChildWndProc(), choose_font(), COMBO_WindowProc(), COMBOEX_Create(), COMBOEX_GetComboFontSize(), COMBOEX_WindowProc(), ComboWndProc_common(), COMCTL32_GetFontMetrics(), ConfirmMsgBox_Init(), ConfirmMsgBox_Paint(), create_fixed_pitch_font_proc(), create_font(), create_font_proc(), CreateBoldFont(), CreateFontA(), CCharMapWindow::CreateFontComboBox(), CreateFontset(), CreateLayoutIcon(), CreateMonospaceFont(), CreateStockFonts(), CreateTitleFont(), CreateTrayIcon(), ctrl_container_reparent(), ctrl_resize(), D3DXCreateTextW(), DATETIME_Refresh(), DATETIME_WindowProc(), DC_hSelectFont(), default_page_paint_hook(), DIALOG_CreateIndirect(), DIALOG_FilePrint(), DIALOG_SelectFont(), Display_DrawText(), DlgProc(), DoEntry(), draw_para_number(), draw_space(), draw_text_2(), CGridView::DrawGrid(), DrawProc(), DrawShadowText(), DrawThemeText(), DRIVER_Dispatch(), DRIVER_SelectFont(), DumpFont(), EDIT_EM_SetMargins(), EDIT_PaintText(), EDIT_UpdateUniscribeData(), EDIT_UpdateUniscribeData_linedef(), EDIT_WindowProc(), EDIT_WM_Paint(), EDIT_WM_SetFont(), EditTypeDlg_OnDrawItem(), EnumEnhMetaFile(), EnumMetaFile(), FILEDLG95_LOOKIN_Init(), FillFontSizeComboList(), FillFontStyleComboList(), FillGrid(), find_installed_font(), fnIMLangFontLink2_GetFontCodePages(), fnIMLangFontLink2_MapFont(), font_height(), ftGdiGetGlyphOutline(), ftGdiGetTextCharsetInfo(), GB_Paint(), GB_ThemedPaint(), GDI32_GdipDrawDriverString(), gdi_get_font_metrics(), GdiFlushUserBatch(), GdipCreateFont(), GdipCreateFontFromDC(), GdipCreateFontFromLogfontW(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureDriverString(), GdipMeasureString(), GdiRealizationInfo(), GdiSelectFont(), get_button_font(), get_current_font_height(), get_font_dpi(), get_font_fsselection(), get_font_hfont(), get_glyph_indices(), get_text_metr_size(), get_tmheight(), GetButtonHeight(), GetDialogFont(), ATL::CWindow::GetFont(), GetFontCellSize(), GetThemeTextExtent(), GetThemeTextMetrics(), Graph_DrawCpuUsageGraph(), Graph_DrawMemUsageGraph(), GraphCtrl_InvalidateCtrl(), GuiConsoleHandleNcCreate(), GuiPaintTextModeBuffer(), HEADER_Create(), HEADER_CreateDragImage(), HEADER_Refresh(), HEADER_SetFont(), HEADER_WindowProc(), HEXEDIT_WM_PAINT(), HEXEDIT_WM_SETFONT(), HexEditWndProc(), HfontCreate(), HOTKEY_DrawHotKey(), HOTKEY_SetFont(), HOTKEY_WindowProc(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), init(), init_output(), InitEditWnd(), InitFonts(), IntDrawMenuBarTemp(), IntDrawState(), IntGrayString(), IntPaintDesktop(), IPADDRESS_Create(), is_font_available(), LISTBOX_DrawFocusRect(), LISTBOX_Paint(), LISTBOX_RepaintItem(), LISTBOX_SetFont(), LISTBOX_WindowProc(), ListBoxWndProc_common(), LISTVIEW_Command(), LISTVIEW_CreateDragImage(), LISTVIEW_EditLabelT(), LISTVIEW_GetItemMetrics(), LISTVIEW_GetStringWidthT(), LISTVIEW_Refresh(), LISTVIEW_SaveTextMetrics(), LISTVIEW_SetColumnWidth(), LISTVIEW_SetFont(), LISTVIEW_ShowFocusRect(), LISTVIEW_WindowProc(), LoadDialog(), LoadIniFile(), LrgCellWndProc(), MainFrameBase::MainFrameBase(), MainWndProc(), font::MakeFont(), map_font(), MDIChildWndProc(), ME_MakeFirstParagraph(), ME_SelectStyleFont(), CTrayClockWnd::MeasureLines(), MENU_CalcItemSize(), MENU_DrawMenuBar(), MENU_DrawMenuItem(), MENU_DrawPopupGlyph(), MonitorSelWndProc(), MonSelChangeFont(), MonSelGetMonitorFont(), MonSelPaintMonitor(), MONTHCAL_PaintTodayTitle(), MONTHCAL_Refresh(), MONTHCAL_SetFont(), MONTHCAL_UpdateSize(), MONTHCAL_WindowProc(), MonthCalChangeFont(), MonthCalPaint(), MonthCalWndProc(), msi_dialog_get_sans_serif_height(), MyDrawFrameCaption(), MyDrawFrameScroll(), MyEnumFontFamExProc(), NOTEPAD_LoadSettingsFromRegistry(), NT5_DrawLogoffCaptionText(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), NtGdiGetFontData(), NtGdiGetFontUnicodeRanges(), NtGdiGetGlyphIndicesW(), NtGdiGetOutlineTextMetricsInternalW(), NtGdiGetTextFaceW(), NtGdiSelectFont(), OB_Paint(), OleCreatePropertyFrameIndirect(), OLEFontImpl_QueryTextMetrics(), OleMetafilePictFromIconAndLabel(), on_wm_initdialog(), OnCreate(), CBaseBarSite::OnCustomDraw(), OnMeasureItem(), CTrayClockWnd::OnPaint(), OnPaint(), CTrayClockWnd::OnSetFont(), CTrayClockWnd::OnThemeChanged(), paint_text(), PaintControl(), PaintText(), para_num_init(), PB_Paint(), PB_ThemedPaint(), PlotCharacter(), PreviewWndProc(), PROGRESS_SetFont(), ProgressWindowProc(), PROPSHEET_Paint(), realize_font(), REBAR_DrawBand(), REBAR_NCCreate(), REBAR_ValidateBand(), REBAR_WindowProc(), RetChangeControlFont(), RosImageProc(), ScriptStringAnalyse(), CGridView::SetFont(), SetFontStylesToCombo2(), SetLrgFont(), SetMessageFont(), SetupControls(), shape_run(), SoftModalMessageBox(), SOFTWARE_GdipDrawDriverString(), SS_ItemOut(), START_TEST(), STATIC_PaintOwnerDrawfn(), STATIC_PaintTextfn(), STATUSBAR_Refresh(), StatusWindowProc(), SYSLINK_Draw(), SYSLINK_SetFont(), SysLinkWindowProc(), TAB_Create(), TAB_DrawItemInterior(), TAB_Refresh(), TAB_SetItemBounds(), TAB_WindowProc(), taskdialog_get_text_extent(), test_AddRefHfont(), test_bcm_get_ideal_size(), test_bitmap_font(), test_bitmap_font_glyph_index(), test_bitmap_font_metrics(), test_button_messages(), test_combo_setfont(), Test_CreateFontA(), test_CreateFontIndirect(), Test_CreateFontIndirectA(), test_CreateFontIndirectEx(), Test_CreateFontIndirectExA(), Test_CreateFontIndirectExW(), Test_CreateFontIndirectW(), test_DrawTextCalcRect(), test_dtm_get_ideal_size(), test_dtm_set_and_get_mcfont(), test_east_asian_font_selection(), test_EM_GETMODIFY(), test_emf_ExtTextOut_on_path(), test_ExtTextOut(), test_fake_bold_font(), Test_Font(), test_font_caps(), test_font_substitution(), Test_FontSelectionEntry(), test_fontsize(), test_fstype_fixup(), test_fullname(), test_fullname2_helper(), Test_GdiConvertFont(), Test_GdiGetCharDimensions(), test_GdiGetCodePage(), test_GetCharABCWidths(), test_GetCharWidth32(), test_GetCharWidthI(), test_GetCurrentObject(), test_GetFontUnicodeRanges(), test_GetGlyphIndices(), test_GetGlyphOutline(), test_GetGlyphOutline_empty_contour(), test_GetGlyphOutline_metric_clipping(), Test_GetIdealSizeNoThemes(), test_GetKerningPairs(), test_GetOutlineTextMetrics(), test_GetTextFace(), Test_GetTextFaceAliasW(), test_GetTextMetrics2(), test_height(), test_hfont_lifetime(), test_ifont_size(), test_item_count(), test_item_height(), test_logfont(), test_long_names(), test_MapFont(), test_margins_font_change(), test_margins_usefontinfo(), test_max_height(), test_MessageBoxFontTest(), test_mf_SaveDC(), test_negative_width(), test_nonexistent_font(), test_oemcharset(), test_orientation(), test_outline_font(), test_RealizationInfo(), test_ReleaseHfont(), test_SaveDC(), test_script_cache_reuse(), test_ScriptCacheGetHeight(), test_ScriptGetFontProperties(), test_ScriptGetGlyphABCWidth(), test_ScriptShape(), test_ScriptShapeOpenType(), test_setfont(), test_SetTextJustification(), test_size(), test_stock_fonts(), test_tab(), test_text_extents(), test_text_metrics(), test_text_position_style(), test_WM_SETFONT(), Text(), TextProc(), ThemeDrawCaptionText(), TOOLBAR_CalcStrings(), TOOLBAR_DrawString(), TOOLBAR_LayoutToolbar(), ToolbarWindowProc(), ToolTipProc(), TOOLTIPS_CalcTipSize(), TOOLTIPS_Refresh(), TOOLTIPS_WindowProc(), TreeListEditLabel(), TreeListProc(), TREEVIEW_Command(), TREEVIEW_ComputeTextWidth(), TREEVIEW_CreateDragImage(), TREEVIEW_DrawItem(), TREEVIEW_EditLabel(), TREEVIEW_NaturalHeight(), TREEVIEW_UpdateSubTree(), TREEVIEW_WindowProc(), UB_Paint(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), UserDrawCaptionText(), VfdToolTip(), wglUseFontOutlines_common(), WINHELP_InitFonts(), WndProc(), and HyperlinkCtrl::WndProc().

◆ init()

static void init ( void  )
static

Definition at line 84 of file font.c.

85 {
86  hgdi32 = GetModuleHandleA("gdi32.dll");
87 
88  pGdiGetCharDimensions = (void *)GetProcAddress(hgdi32, "GdiGetCharDimensions");
89  pGdiGetCodePage = (void *) GetProcAddress(hgdi32,"GdiGetCodePage");
90  pGetCharABCWidthsI = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsI");
91  pGetCharABCWidthsA = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsA");
92  pGetCharABCWidthsW = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsW");
93  pGetCharABCWidthsFloatW = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsFloatW");
94  pGetCharWidth32A = (void *)GetProcAddress(hgdi32, "GetCharWidth32A");
95  pGetCharWidth32W = (void *)GetProcAddress(hgdi32, "GetCharWidth32W");
96  pGetFontUnicodeRanges = (void *)GetProcAddress(hgdi32, "GetFontUnicodeRanges");
97  pGetGlyphIndicesA = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesA");
98  pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
99  pGetTextExtentExPointI = (void *)GetProcAddress(hgdi32, "GetTextExtentExPointI");
100  pGdiRealizationInfo = (void *)GetProcAddress(hgdi32, "GdiRealizationInfo");
101  pCreateFontIndirectExA = (void *)GetProcAddress(hgdi32, "CreateFontIndirectExA");
102  pAddFontMemResourceEx = (void *)GetProcAddress(hgdi32, "AddFontMemResourceEx");
103  pRemoveFontMemResourceEx = (void *)GetProcAddress(hgdi32, "RemoveFontMemResourceEx");
104  pAddFontResourceExA = (void *)GetProcAddress(hgdi32, "AddFontResourceExA");
105  pRemoveFontResourceExA = (void *)GetProcAddress(hgdi32, "RemoveFontResourceExA");
106  pGetFontRealizationInfo = (void *)GetProcAddress(hgdi32, "GetFontRealizationInfo");
107  pGetFontFileInfo = (void *)GetProcAddress(hgdi32, "GetFontFileInfo");
108  pGetFontFileData = (void *)GetProcAddress(hgdi32, "GetFontFileData");
109 
111 }
static HMODULE hgdi32
Definition: font.c:65
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: lang.c:751
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define GetProcAddress(x, y)
Definition: compat.h:410
static WORD system_lang_id
Definition: font.c:67
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by START_TEST().

◆ INT()

◆ is_CJK()

static BOOL is_CJK ( void  )
static

Definition at line 751 of file font.c.

752 {
754 }
#define LANG_JAPANESE
Definition: nls.h:76
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_KOREAN
Definition: nls.h:84
static WORD system_lang_id
Definition: font.c:67

Referenced by test_bitmap_font_metrics().

◆ is_font_installed()

static BOOL is_font_installed ( const char name)
static

Definition at line 137 of file font.c.

138 {
139  HDC hdc = GetDC(0);
140  BOOL ret = FALSE;
141 
143  ret = TRUE;
144 
145  ReleaseDC(0, hdc);
146  return ret;
147 }
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
int ret
HDC hdc
Definition: main.c:9
Definition: name.c:36
static INT CALLBACK is_font_installed_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: font.c:132
int WINAPI EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc, LPARAM lParam)
Definition: font.c:480

Referenced by test_EnumFonts_subst(), test_font_charset(), test_GdiGetCodePage(), test_GetGlyphIndices(), test_GetKerningPairs(), test_GetOutlineTextMetrics(), test_GetTextFace(), test_nonexistent_font(), and test_SetTextJustification().

◆ is_font_installed_fullname()

static BOOL is_font_installed_fullname ( const char family,
const char fullname 
)
static

Definition at line 5408 of file font.c.

5409 {
5410  HDC hdc = GetDC(0);
5411  BOOL ret = FALSE;
5412 
5414  ret = TRUE;
5415 
5416  ReleaseDC(0, hdc);
5417  return ret;
5418 }
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG_PTR LPARAM
Definition: windef.h:208
int ret
HDC hdc
Definition: main.c:9
static INT CALLBACK is_font_installed_fullname_proc(const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: font.c:5398
int WINAPI EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc, LPARAM lParam)
Definition: font.c:480

Referenced by test_fullname().

◆ is_font_installed_fullname_proc()

static INT CALLBACK is_font_installed_fullname_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 5398 of file font.c.

5399 {
5400  const ENUMLOGFONTA *elf = (const ENUMLOGFONTA *)lf;
5401  const char *fullname = (const char *)lParam;
5402 
5403  if (!strcmp((const char *)elf->elfFullName, fullname)) return 0;
5404 
5405  return 1;
5406 }
BYTE elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2665
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
LPARAM lParam
Definition: combotst.c:139

Referenced by is_font_installed_fullname().

◆ is_font_installed_proc()

static INT CALLBACK is_font_installed_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 132 of file font.c.

133 {
134  return 0;
135 }

Referenced by is_font_installed().

◆ is_truetype_font_installed()

static BOOL is_truetype_font_installed ( const char name)
static

Definition at line 120 of file font.c.

121 {
122  HDC hdc = GetDC(0);
123  BOOL ret = FALSE;
124 
126  ret = TRUE;
127 
128  ReleaseDC(0, hdc);
129  return ret;
130 }
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static INT CALLBACK is_truetype_font_installed_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: font.c:113
int ret
HDC hdc
Definition: main.c:9
Definition: name.c:36
int WINAPI EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc, LPARAM lParam)
Definition: font.c:480

Referenced by check_vertical_font(), START_TEST(), test_CreateFontIndirectEx(), test_CreateScalableFontResource(), test_EnumFontFamilies(), test_EnumFonts(), test_EnumFonts_subst(), test_GetCharABCWidths(), test_GetGlyphOutline(), test_GetTextMetrics2(), test_height(), test_height_selection_vdmx(), test_nonexistent_font(), test_orientation(), test_outline_font(), test_RealizationInfo(), and test_vertical_font().

◆ is_truetype_font_installed_proc()

static INT CALLBACK is_truetype_font_installed_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 113 of file font.c.

114 {
115  if (type != TRUETYPE_FONTTYPE) return 1;
116 
117  return 0;
118 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by is_truetype_font_installed().

◆ load_font()

static void* load_font ( const char font_name,
DWORD font_size 
)
static

Definition at line 5044 of file font.c.

5045 {
5046  char file_name[MAX_PATH];
5047  HANDLE file, mapping;
5048  void *font;
5049 
5050  if (!GetWindowsDirectoryA(file_name, sizeof(file_name))) return NULL;
5051  strcat(file_name, "\\fonts\\");
5052  strcat(file_name, font_name);
5053 
5055  if (file == INVALID_HANDLE_VALUE) return NULL;
5056 
5058 
5060  if (!mapping)
5061  {
5062  CloseHandle(file);
5063  return NULL;
5064  }
5065 
5066  font = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
5067 
5068  CloseHandle(file);
5070  return font;
5071 }
#define CloseHandle
Definition: compat.h:398
#define MapViewOfFile
Definition: compat.h:402
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
Definition: mk_font.cpp:20
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
smooth NULL
Definition: ftsmooth.c:416
#define FILE_MAP_READ
Definition: compat.h:427
#define OPEN_EXISTING
Definition: compat.h:426
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
static FT_F26Dot6 font_size
Definition: ftrandom.c:89
#define GENERIC_READ
Definition: compat.h:124
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
#define PAGE_READONLY
Definition: compat.h:127
static LPCWSTR file_name
Definition: protocol.c:146
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
Definition: filemap.c:23
Definition: fci.c:126

Referenced by test_AddFontMemResource().

◆ LONG()

static LONG ( WINAPI pGdiGetCharDimensions)
static

◆ long_enum_proc()

static INT CALLBACK long_enum_proc ( const LOGFONTA lf,
const TEXTMETRICA tm,
DWORD  type,
LPARAM  lparam 
)
static

Definition at line 6805 of file font.c.

6806 {
6807  BOOL *found_font = (BOOL *)lparam;
6808  *found_font = TRUE;
6809  return 1;
6810 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
static UINT WPARAM LPARAM lparam
Definition: combo.c:716

Referenced by test_long_names().

◆ match_name_table_language()

static int match_name_table_language ( const sfnt_name name,
LANGID  lang 
)
static

Definition at line 3682 of file font.c.

3683 {
3684  LANGID name_lang;
3685  int res = 0;
3686 
3687  switch (GET_BE_WORD(name->platform_id))
3688  {
3689  case TT_PLATFORM_MICROSOFT:
3690  res += 5; /* prefer the Microsoft name */
3691  switch (GET_BE_WORD(name->encoding_id))
3692  {
3693  case TT_MS_ID_UNICODE_CS:
3694  case TT_MS_ID_SYMBOL_CS:
3695  name_lang = GET_BE_WORD(name->language_id);
3696  break;
3697  default:
3698  return 0;
3699  }
3700  break;
3701  case TT_PLATFORM_MACINTOSH:
3702  if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
3703  if (GET_BE_WORD(name->language_id) >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
3704  name_lang = mac_langid_table[GET_BE_WORD(name->language_id)];
3705  break;
3707  res += 2; /* prefer Unicode encodings */
3708  switch (GET_BE_WORD(name->encoding_id))
3709  {
3710  case TT_APPLE_ID_DEFAULT:
3711  case TT_APPLE_ID_ISO_10646:
3713  if (GET_BE_WORD(name->language_id) >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
3714  name_lang = mac_langid_table[GET_BE_WORD(name->language_id)];
3715  break;
3716  default:
3717  return 0;
3718  }
3719  break;
3720  default:
3721  return 0;
3722  }
3723  if (name_lang == lang) res += 30;
3724  else if (PRIMARYLANGID( name_lang ) == PRIMARYLANGID( lang )) res += 20;
3725  else if (name_lang == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )) res += 10;
3726  return res;
3727 }
#define TT_APPLE_ID_UNICODE_2_0
Definition: font.c:3532
#define TT_MS_ID_SYMBOL_CS
Definition: font.c:3533
#define SUBLANG_DEFAULT
Definition: nls.h:168
WORD LANGID
Definition: typedefs.h:79
#define TT_MS_ID_UNICODE_CS
Definition: font.c:3534
static const LANGID mac_langid_table[]
Definition: font.c:3552
#define TT_APPLE_ID_DEFAULT
Definition: font.c:3530
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define LANG_ENGLISH
Definition: nls.h:52
#define TT_PLATFORM_MICROSOFT
Definition: font.c:3529
#define TT_PLATFORM_MACINTOSH
Definition: font.c:3528
static WORD get_mac_code_page(const sfnt_name *name)
Definition: font.c:3676
BOOL WINAPI IsValidCodePage(UINT CodePage)
Definition: nls.c:1468
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define MAKELANGID(p, s)
Definition: nls.h:15
#define TT_APPLE_ID_ISO_10646
Definition: font.c:3531
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:3527
#define GET_BE_WORD(x)
Definition: font.c:73
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by get_ttf_nametable_entry().

◆ match_off_by_n()

static BOOL match_off_by_n ( int  a,
int  b,
unsigned int  n 
)
inlinestatic

Definition at line 34 of file font.c.

35 {
36  return abs(a - b) <= n;
37 }
#define abs(i)
Definition: fconv.c:206
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

◆ prepend_at()

static WCHAR* prepend_at ( WCHAR family)
static

Definition at line 5468 of file font.c.

5469 {
5470  if (!family)
5471  return NULL;
5472 
5473  memmove(family + 1, family, (lstrlenW(family) + 1) * sizeof(WCHAR));
5474  family[0] = '@';
5475  return family;
5476 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define lstrlenW
Definition: compat.h:407
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_fullname2_helper().

◆ START_TEST()

START_TEST ( font  )

Definition at line 6858 of file font.c.

6859 {
6860  init();
6861 
6862  test_stock_fonts();
6863  test_logfont();
6864  test_bitmap_font();
6878  test_orientation();
6881  test_EnumFonts();
6883 
6884  /* On Windows Arial has a lot of default charset aliases such as Arial Cyr,
6885  * I'd like to avoid them in this test.
6886  */
6887  test_EnumFontFamilies("Arial Black", ANSI_CHARSET);
6889  if (is_truetype_font_installed("Arial Black") &&
6890  (is_truetype_font_installed("Symbol") || is_truetype_font_installed("Wingdings")))
6891  {
6895  }
6896  else
6897  skip("Arial Black or Symbol/Wingdings is not installed\n");
6901  test_GetTextFace();
6903  test_GetTextMetrics2("Tahoma", -11);
6904  test_GetTextMetrics2("Tahoma", -55);
6905  test_GetTextMetrics2("Tahoma", -110);
6906  test_GetTextMetrics2("Arial", -11);
6907  test_GetTextMetrics2("Arial", -55);
6908  test_GetTextMetrics2("Arial", -110);
6912  test_oemcharset();
6913  test_fullname();
6914  test_fullname2();
6916  test_max_height();
6922  test_long_names();
6923 
6924  /* These tests should be last test until RemoveFontResource
6925  * is properly implemented.
6926  */
6929 }
static void test_GetCharWidth32(void)
Definition: font.c:6402
static void test_EnumFontFamiliesEx_default_charset(void)
Definition: font.c:3175
static void test_max_height(void)
Definition: font.c:6308
static void test_fullname2(void)
Definition: font.c:5590
static void test_CreateFontIndirect(void)
Definition: font.c:4973
static void test_SetTextJustification(void)
Definition: font.c:2382
static void test_GetTextFace(void)
Definition: font.c:4424
static void test_oemcharset(void)
Definition: font.c:4546
#define SYMBOL_CHARSET
Definition: wingdi.h:384
static void test_GetOutlineTextMetrics(void)
Definition: font.c:2182
static void test_long_names(void)
Definition: font.c:6812
static void test_font_charset(void)
Definition: font.c:2589
#define DEFAULT_CHARSET
Definition: wingdi.h:383
static void test_outline_font(void)
Definition: font.c:489
static void test_GetFontUnicodeRanges(void)
Definition: font.c:2741
static void test_EnumFonts_subst(void)
Definition: font.c:5336
static void test_logfont(void)
Definition: font.c:246
static void test_vertical_order(void)
Definition: font.c:6366
static void test_bitmap_font(void)
Definition: font.c:401
static void test_nonexistent_font(void)
Definition: font.c:4064
static void test_text_extents(void)
Definition: font.c:1455
static void init(void)
Definition: font.c:84
static void test_GdiGetCharDimensions(void)
Definition: font.c:1074
static void test_bitmap_font_metrics(void)
Definition: font.c:757
static void test_GetCharacterPlacement(void)
Definition: font.c:4942
static void test_RealizationInfo(void)
Definition: font.c:4257
static void test_EnumFontFamilies(const char *font_name, INT font_charset)
Definition: font.c:2910
static void test_EnumFonts(void)
Definition: font.c:5226
static void test_GetKerningPairs(void)
Definition: font.c:1679
static void test_GetCharWidthI(void)
Definition: font.c:6763
static void test_orientation(void)
Definition: font.c:4517
static void test_fullname(void)
Definition: font.c:5420
static void test_GetCharABCWidths(void)
Definition: font.c:1156
static void test_GetTextMetrics(void)
Definition: font.c:4043
static void test_height_selection(void)
Definition: font.c:2129
static void test_GetGlyphIndices(void)
Definition: font.c:1611
static void test_bitmap_font_glyph_index(void)
Definition: font.c:6630
static void test_GdiGetCodePage(void)
Definition: font.c:2641
#define skip(...)
static void test_fake_bold_font(void)
Definition: font.c:6506
static void test_AddFontMemResource(void)
Definition: font.c:5073
static void test_vertical_font(void)
Definition: font.c:6048
static void test_east_asian_font_selection(void)
Definition: font.c:6117
static BOOL is_truetype_font_installed(const char *name)
Definition: font.c:120
static void test_stock_fonts(void)
Definition: font.c:6187
#define ANSI_CHARSET
Definition: wingdi.h:382
static void test_CreateScalableFontResource(void)
Definition: font.c:5756
static void test_GetTextMetrics2(const char *fontname, int font_height)
Definition: font.c:4885
static void test_GetGlyphOutline(void)
Definition: font.c:4626
static void test_CreateFontIndirectEx(void)
Definition: font.c:5008

◆ test_AddFontMemResource()

static void test_AddFontMemResource ( void  )
static

Definition at line 5073 of file font.c.

5074 {
5075  void *font;
5076  DWORD font_size, num_fonts;
5077  HANDLE ret;
5078  BOOL bRet;
5079 
5080  if (!pAddFontMemResourceEx || !pRemoveFontMemResourceEx)
5081  {
5082  win_skip("AddFontMemResourceEx is not available on this platform\n");
5083  return;
5084  }
5085 
5086  font = load_font("sserife.fon", &font_size);
5087  if (!font)
5088  {
5089  skip("Unable to locate and load font sserife.fon\n");
5090  return;
5091  }
5092 
5093  SetLastError(0xdeadbeef);
5094  ret = pAddFontMemResourceEx(NULL, 0, NULL, NULL);
5095  ok(!ret, "AddFontMemResourceEx should fail\n");
5097  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5098  GetLastError());
5099 
5100  SetLastError(0xdeadbeef);
5101  ret = pAddFontMemResourceEx(NULL, 10, NULL, NULL);
5102  ok(!ret, "AddFontMemResourceEx should fail\n");
5104  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5105  GetLastError());
5106 
5107  SetLastError(0xdeadbeef);
5108  ret = pAddFontMemResourceEx(NULL, 0, NULL, &num_fonts);
5109  ok(!ret, "AddFontMemResourceEx should fail\n");
5111  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5112  GetLastError());
5113 
5114  SetLastError(0xdeadbeef);
5115  ret = pAddFontMemResourceEx(NULL, 10, NULL, &num_fonts);
5116  ok(!ret, "AddFontMemResourceEx should fail\n");
5118  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5119  GetLastError());
5120 
5121  SetLastError(0xdeadbeef);
5122  ret = pAddFontMemResourceEx(font, 0, NULL, NULL);
5123  ok(!ret, "AddFontMemResourceEx should fail\n");
5125  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5126  GetLastError());
5127 
5128  SetLastError(0xdeadbeef);
5129  ret = pAddFontMemResourceEx(font, 10, NULL, NULL);
5130  ok(!ret, "AddFontMemResourceEx should fail\n");
5132  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5133  GetLastError());
5134 
5135  num_fonts = 0xdeadbeef;
5136  SetLastError(0xdeadbeef);
5137  ret = pAddFontMemResourceEx(font, 0, NULL, &num_fonts);
5138  ok(!ret, "AddFontMemResourceEx should fail\n");
5140  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5141  GetLastError());
5142  ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
5143 
5144  if (0) /* hangs under windows 2000 */
5145  {
5146  num_fonts = 0xdeadbeef;
5147  SetLastError(0xdeadbeef);
5148  ret = pAddFontMemResourceEx(font, 10, NULL, &num_fonts);
5149  ok(!ret, "AddFontMemResourceEx should fail\n");
5150  ok(GetLastError() == 0xdeadbeef,
5151  "Expected GetLastError() to return 0xdeadbeef, got %u\n",
5152  GetLastError());
5153  ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
5154  }
5155 
5156  num_fonts = 0xdeadbeef;
5157  SetLastError(0xdeadbeef);
5158  ret = pAddFontMemResourceEx(font, font_size, NULL, &num_fonts);
5159  ok(ret != 0, "AddFontMemResourceEx error %d\n", GetLastError());
5160  ok(num_fonts != 0xdeadbeef, "number of loaded fonts should not be 0xdeadbeef\n");
5161  ok(num_fonts != 0, "number of loaded fonts should not be 0\n");
5162 
5163  free_font(font);
5164 
5165  SetLastError(0xdeadbeef);
5166  bRet = pRemoveFontMemResourceEx(ret);
5167  ok(bRet, "RemoveFontMemResourceEx error %d\n", GetLastError());
5168 
5169  /* test invalid pointer to number of loaded fonts */
5170  font = load_font("sserife.fon", &font_size);
5171  ok(font != NULL, "Unable to locate and load font sserife.fon\n");
5172 
5173  SetLastError(0xdeadbeef);
5174  ret = pAddFontMemResourceEx(font, font_size, NULL, (void *)0xdeadbeef);
5175  ok(!ret, "AddFontMemResourceEx should fail\n");
5176  ok(GetLastError() == 0xdeadbeef,
5177  "Expected GetLastError() to return 0xdeadbeef, got %u\n",
5178  GetLastError());
5179 
5180  SetLastError(0xdeadbeef);
5181  ret = pAddFontMemResourceEx(font, font_size, NULL, NULL);
5182  ok(!ret, "AddFontMemResourceEx should fail\n");
5184  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
5185  GetLastError());
5186 
5187  free_font(font);
5188 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
Definition: mk_font.cpp:20
static void free_font(void *font)
Definition: font.c:5039
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
static FT_F26Dot6 font_size
Definition: ftrandom.c:89
#define skip(...)
#define win_skip
Definition: test.h:141
static void * load_font(const char *font_name, DWORD *font_size)
Definition: font.c:5044

Referenced by START_TEST().

◆ test_bitmap_font()

static void test_bitmap_font ( void  )
static

Definition at line 401 of file font.c.

402 {
403  static const char test_str[11] = "Test String";
404  HDC hdc;
405  LOGFONTA bitmap_lf;
406  HFONT hfont, old_hfont;
407  TEXTMETRICA tm_orig;
408  SIZE size_orig;
409  INT ret, i, width_orig, height_orig, scale, lfWidth;
410 
411  hdc = CreateCompatibleDC(0);
412 
413  /* "System" has only 1 pixel size defined, otherwise the test breaks */
414  ret = EnumFontFamiliesA(hdc, "System", font_enum_proc, (LPARAM)&bitmap_lf);
415  if (ret)
416  {
417  ReleaseDC(0, hdc);
418  trace("no bitmap fonts were found, skipping the test\n");
419  return;
420  }
421 
422  trace("found bitmap font %s, height %d\n", bitmap_lf.lfFaceName, bitmap_lf.lfHeight);
423 
424  height_orig = bitmap_lf.lfHeight;
425  lfWidth = bitmap_lf.lfWidth;
426 
427  hfont = create_font("bitmap", &bitmap_lf);
428  old_hfont = SelectObject(hdc, hfont);
429  ok(GetTextMetricsA(hdc, &tm_orig), "GetTextMetricsA failed\n");
430  ok(GetTextExtentPoint32A(hdc, test_str, sizeof(test_str), &size_orig), "GetTextExtentPoint32A failed\n");
431  ok(GetCharWidthA(hdc, 'A', 'A', &width_orig), "GetCharWidthA failed\n");
432  SelectObject(hdc, old_hfont);
434 
435  bitmap_lf.lfHeight = 0;
436  bitmap_lf.lfWidth = 4;
437  hfont = create_font("bitmap", &bitmap_lf);
438  old_hfont = SelectObject(hdc, hfont);
439  test_font_metrics(hdc, hfont, 0, 4, test_str, sizeof(test_str), &tm_orig, &size_orig, width_orig, 1, 1);
440  SelectObject(hdc, old_hfont);
442 
443  bitmap_lf.lfHeight = height_orig;
444  bitmap_lf.lfWidth = lfWidth;
445 
446  /* test fractional scaling */
447  for (i = 1; i <= height_orig * 6; i++)
448  {
449