~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/src/cid/cidriver.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************/
 
2
/*                                                                         */
 
3
/*  cidriver.c                                                             */
 
4
/*                                                                         */
 
5
/*    CID driver interface (body).                                         */
 
6
/*                                                                         */
 
7
/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 
8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 
9
/*                                                                         */
 
10
/*  This file is part of the FreeType project, and may only be used,       */
 
11
/*  modified, and distributed under the terms of the FreeType project      */
 
12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
 
13
/*  this file you indicate that you have read the license and              */
 
14
/*  understand and accept it fully.                                        */
 
15
/*                                                                         */
 
16
/***************************************************************************/
 
17
 
 
18
 
 
19
#include <ft2build.h>
 
20
#include "cidriver.h"
 
21
#include "cidgload.h"
 
22
#include FT_INTERNAL_DEBUG_H
 
23
#include FT_INTERNAL_STREAM_H
 
24
 
 
25
#include "ciderrs.h"
 
26
 
 
27
#include FT_SERVICE_POSTSCRIPT_NAME_H
 
28
#include FT_SERVICE_XFREE86_NAME_H
 
29
#include FT_SERVICE_POSTSCRIPT_INFO_H
 
30
 
 
31
  /*************************************************************************/
 
32
  /*                                                                       */
 
33
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
 
34
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
 
35
  /* messages during execution.                                            */
 
36
  /*                                                                       */
 
37
#undef  FT_COMPONENT
 
38
#define FT_COMPONENT  trace_ciddriver
 
39
 
 
40
 
 
41
 /*
 
42
  *  POSTSCRIPT NAME SERVICE
 
43
  *
 
44
  */
 
45
 
 
46
  static const char*
 
47
  cid_get_postscript_name( CID_Face  face )
 
48
  {
 
49
    const char*  result = face->cid.cid_font_name;
 
50
 
 
51
 
 
52
    if ( result && result[0] == '/' )
 
53
      result++;
 
54
 
 
55
    return result;
 
56
  }
 
57
 
 
58
 
 
59
  static const FT_Service_PsFontNameRec  cid_service_ps_name =
 
60
  {
 
61
    (FT_PsName_GetFunc) cid_get_postscript_name
 
62
  };
 
63
 
 
64
 
 
65
 /*
 
66
  *  POSTSCRIPT INFO SERVICE
 
67
  *
 
68
  */
 
69
 
 
70
  static FT_Error
 
71
  cid_ps_get_font_info( FT_Face          face,
 
72
                        PS_FontInfoRec*  afont_info )
 
73
  {
 
74
    *afont_info = ((CID_Face)face)->cid.font_info;
 
75
    return 0;
 
76
  }
 
77
 
 
78
 
 
79
  static const FT_Service_PsInfoRec  cid_service_ps_info =
 
80
  {
 
81
    (PS_GetFontInfoFunc)  cid_ps_get_font_info,
 
82
    (PS_HasGlyphNamesFunc)NULL          /* unsupported with CID fonts */
 
83
  };
 
84
 
 
85
 
 
86
 /*
 
87
  *  SERVICE LIST
 
88
  *
 
89
  */
 
90
 
 
91
  static const FT_ServiceDescRec  cid_services[] =
 
92
  {
 
93
    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
 
94
    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CID },
 
95
    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &cid_service_ps_info },
 
96
    { NULL, NULL }
 
97
  };
 
98
 
 
99
 
 
100
  FT_CALLBACK_DEF( FT_Module_Interface )
 
101
  cid_get_interface( FT_Module    module,
 
102
                     const char*  cid_interface )
 
103
  {
 
104
    FT_UNUSED( module );
 
105
 
 
106
    return ft_service_list_lookup( cid_services, cid_interface );
 
107
  }
 
108
 
 
109
 
 
110
 
 
111
  FT_CALLBACK_TABLE_DEF
 
112
  const FT_Driver_ClassRec  t1cid_driver_class =
 
113
  {
 
114
    /* first of all, the FT_Module_Class fields */
 
115
    {
 
116
      FT_MODULE_FONT_DRIVER       |
 
117
      FT_MODULE_DRIVER_SCALABLE   |
 
118
      FT_MODULE_DRIVER_HAS_HINTER,
 
119
 
 
120
      sizeof( FT_DriverRec ),
 
121
      "t1cid",   /* module name           */
 
122
      0x10000L,  /* version 1.0 of driver */
 
123
      0x20000L,  /* requires FreeType 2.0 */
 
124
 
 
125
      0,
 
126
 
 
127
      cid_driver_init,
 
128
      cid_driver_done,
 
129
      cid_get_interface
 
130
    },
 
131
 
 
132
    /* then the other font drivers fields */
 
133
    sizeof( CID_FaceRec ),
 
134
    sizeof( CID_SizeRec ),
 
135
    sizeof( CID_GlyphSlotRec ),
 
136
 
 
137
    cid_face_init,
 
138
    cid_face_done,
 
139
 
 
140
    cid_size_init,
 
141
    cid_size_done,
 
142
    cid_slot_init,
 
143
    cid_slot_done,
 
144
 
 
145
    cid_point_size_reset,
 
146
    cid_size_reset,
 
147
 
 
148
    cid_slot_load_glyph,
 
149
 
 
150
    0,                      /* FT_Face_GetKerningFunc  */
 
151
    0,                      /* FT_Face_AttachFunc      */
 
152
 
 
153
    0                       /* FT_Face_GetAdvancesFunc */
 
154
  };
 
155
 
 
156
 
 
157
/* END */