summaryrefslogtreecommitdiffstats
path: root/private/windows/diamond/ttfver.h
blob: ba19baccddd58dea7bb39414980c1589b4164555 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***    ttfver.h - Definitions for getting TrueType File version
 *
 *      Microsoft Confidential
 *      Copyright (C) Microsoft Corporation 1993-1994
 *      All Rights Reserved.
 *
 *  Author:
 *      ACME group(?)
 *
 *  History:
 *      04-Jun-1994 bens    Copied from ACME project (courtesy alanr)
 *
 *  Exported Functions:
 *      FGetTTFVersion - Get TrueType File version number
 */

typedef unsigned short uint16;
typedef long int32;
typedef unsigned long uint32;

#define SWAPW(a)        (unsigned short)(((unsigned char)((a) >> 8)) | ((unsigned char)(a) << 8))
#define SWAPL(a)        ((((a)&0xff) << 24) | (((a)&0xff00) << 8) | (((a)&0xff0000) >> 8) | ((a) >> 24))

typedef long sfnt_TableTag;

#define tag_NamingTable         0x656d616e        /* 'name' */

typedef struct {
    sfnt_TableTag   tag;
    uint32          checkSum;
    uint32          offset;
    uint32          length;
} sfnt_DirectoryEntry;

typedef struct {
    int32  version;                 /* 0x10000 (1.0) */
    uint16 numOffsets;              /* number of tables */
    uint16 searchRange;             /* (max2 <= numOffsets)*16 */
    uint16 entrySelector;           /* log2 (max2 <= numOffsets) */
    uint16 rangeShift;              /* numOffsets*16-searchRange*/
    sfnt_DirectoryEntry table[1];   /* table[numOffsets] */
} sfnt_OffsetTable;

typedef struct {
    uint16 platformID;
    uint16 specificID;
    uint16 languageID;
    uint16 nameID;
    uint16 length;
    uint16 offset;
} sfnt_NameRecord;

typedef struct {
    uint16 format;
    uint16 count;
    uint16 stringOffset;
} sfnt_NamingTable;


int _cdecl FGetTTFVersion(char const * szFile, unsigned long * pdwVer);