summaryrefslogtreecommitdiff
path: root/include/freetype/internal/tfm.h
blob: 1a91eb49763aa6e429cbb10737d2329bc2380803 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/****************************************************************************
 *
 * tfm.h
 *
 *   Auxiliary functions and data structures related to TFM metric files
 *   (specification).
 *
 * Copyright 1996-2018 by
 * David Turner, Robert Wilhelm, and Werner Lemberg.
 *
 * This file is part of the FreeType project, and may only be used,
 * modified, and distributed under the terms of the FreeType project
 * license, LICENSE.TXT.  By continuing to use, modify, or distribute
 * this file you indicate that you have read the license and
 * understand and accept it fully.
 *
 */


#ifndef TFM_H_
#define TFM_H_


#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_HASH_H
#include FT_INTERNAL_TRUETYPE_TYPES_H



FT_BEGIN_HEADER


  /*************************************************************************/
  /*************************************************************************/
  /*************************************************************************/
  /***                                                                   ***/
  /***                                                                   ***/
  /***                TFM FONT INFORMATION STRUCTURES                    ***/
  /***                                                                   ***/
  /***                                                                   ***/
  /*************************************************************************/
  /*************************************************************************/
  /*************************************************************************/

  typedef struct  TFM_FontInfoRec_
  {
    /* Font Info */
    FT_Long        cs; /* Check Sum */
    /* Metrics */
    FT_ULong       ds, fs; /* Design Size */
    FT_UInt        design_size;
    FT_ULong       slant;
    FT_UInt        begin_char, end_char;
    FT_Long        *width, *height, *depth;
    /* Font bounding box */
    FT_Long        font_bbx_w, font_bbx_h;
    FT_Long        font_bbx_xoff, font_bbx_yoff;

  } TFM_FontInfoRec, *TFM_FontInfo;

  #define RDS2PT(rds)    (tfm->design_size * ((FT_Long)(rds)/(FT_Long)(1<<20)))

  /*************************************************************************/
  /*************************************************************************/
  /*****                                                               *****/
  /*****                            TFM PARSER                         *****/
  /*****                                                               *****/
  /*************************************************************************/
  /*************************************************************************/

  typedef struct TFM_ParserRec_*  TFM_Parser;

  typedef struct  TFM_Parser_FuncsRec_
  {
    FT_Error
    (*init)( TFM_Parser  parser,
             FT_Memory   memory,
             FT_Stream   stream );

    FT_Error
    (*parse_metrics)( TFM_Parser  parser );

    void
    (*done)( TFM_Parser  parser );

  } TFM_Parser_FuncsRec;



  /**************************************************************************
   *
   * @struct:
   *   TFM_ParserRec
   *
   * @description:
   *   An TFM_Parser is a parser for the TFM files.
   *
   * @fields:
   *   memory ::
   *     The object used for memory operations (alloc and
   *     realloc).
   *
   *   stream ::
   *     This is an FT_Stream object.
   *
   *   FontInfo ::
   *     The result will be stored here.
   */
  typedef struct  TFM_ParserRec_
  {
    FT_Memory     memory;
    FT_Stream     stream;

    TFM_FontInfo  FontInfo;

    void*         user_data;  /* To be checked for compatibility */

  } TFM_ParserRec;


  /*************************************************************************/
  /*************************************************************************/
  /*****                                                               *****/
  /*****                        TFM Module Interface                   *****/
  /*****                                                               *****/
  /*************************************************************************/
  /*************************************************************************/

  typedef struct  TFM_ServiceRec_
  {
    const TFM_Parser_FuncsRec* tfm_parser_funcs;

  } TFM_ServiceRec, *TFM_Service;

  /* backward compatible type definition */
  typedef TFM_ServiceRec   TFM_Interface;


FT_END_HEADER

#endif /* PSAUX_H_ */


/* END */