ReactOS  0.4.14-dev-606-g14ebc0b
ftgloadr.h File Reference
#include <ft2build.h>
Include dependency graph for ftgloadr.h:

Go to the source code of this file.

Classes

struct  FT_SubGlyphRec_
 
struct  FT_GlyphLoadRec_
 
struct  FT_GlyphLoaderRec_
 

Macros

#define FT_GLYPHLOADER_CHECK_P(_loader, _count)
 
#define FT_GLYPHLOADER_CHECK_C(_loader, _count)
 
#define FT_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours)
 

Typedefs

typedef FT_BEGIN_HEADER struct FT_SubGlyphRec_ FT_SubGlyphRec
 
typedef struct FT_GlyphLoadRec_ FT_GlyphLoadRec
 
typedef struct FT_GlyphLoadRec_FT_GlyphLoad
 
typedef struct FT_GlyphLoaderRec_ FT_GlyphLoaderRec
 
typedef struct FT_GlyphLoaderRec_FT_GlyphLoader
 

Functions

 FT_GlyphLoader_New (FT_Memory memory, FT_GlyphLoader *aloader)
 
 FT_GlyphLoader_CreateExtra (FT_GlyphLoader loader)
 
 FT_GlyphLoader_Done (FT_GlyphLoader loader)
 
 FT_GlyphLoader_Reset (FT_GlyphLoader loader)
 
 FT_GlyphLoader_Rewind (FT_GlyphLoader loader)
 
 FT_GlyphLoader_CheckPoints (FT_GlyphLoader loader, FT_UInt n_points, FT_UInt n_contours)
 
 FT_GlyphLoader_CheckSubGlyphs (FT_GlyphLoader loader, FT_UInt n_subs)
 
 FT_GlyphLoader_Prepare (FT_GlyphLoader loader)
 
 FT_GlyphLoader_Add (FT_GlyphLoader loader)
 
 FT_GlyphLoader_CopyPoints (FT_GlyphLoader target, FT_GlyphLoader source)
 

Macro Definition Documentation

◆ FT_GLYPHLOADER_CHECK_C

#define FT_GLYPHLOADER_CHECK_C (   _loader,
  _count 
)
Value:
( (_count) == 0 || \
( (FT_UInt)(_loader)->base.outline.n_contours + \
(FT_UInt)(_loader)->current.outline.n_contours + \
(FT_UInt)(_count) ) <= (_loader)->max_contours )
unsigned int FT_UInt
Definition: fttypes.h:231
struct task_struct * current
Definition: linux.c:32

Definition at line 112 of file ftgloadr.h.

◆ FT_GLYPHLOADER_CHECK_P

#define FT_GLYPHLOADER_CHECK_P (   _loader,
  _count 
)
Value:
( (_count) == 0 || \
( (FT_UInt)(_loader)->base.outline.n_points + \
(FT_UInt)(_loader)->current.outline.n_points + \
(FT_UInt)(_count) ) <= (_loader)->max_points )
unsigned int FT_UInt
Definition: fttypes.h:231
struct task_struct * current
Definition: linux.c:32

Definition at line 106 of file ftgloadr.h.

◆ FT_GLYPHLOADER_CHECK_POINTS

#define FT_GLYPHLOADER_CHECK_POINTS (   _loader,
  _points,
  _contours 
)
Value:
( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \
FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \
? 0 \
(FT_UInt)(_points), \
(FT_UInt)(_contours) ) )
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_GLYPHLOADER_CHECK_P(_loader, _count)
Definition: ftgloadr.h:106
FT_GlyphLoader_CheckPoints(FT_GlyphLoader loader, FT_UInt n_points, FT_UInt n_contours)
Definition: ftgloadr.c:201

Definition at line 118 of file ftgloadr.h.

Typedef Documentation

◆ FT_GlyphLoad

◆ FT_GlyphLoader

◆ FT_GlyphLoaderRec

◆ FT_GlyphLoadRec

◆ FT_SubGlyphRec

Function Documentation

◆ FT_GlyphLoader_Add()

FT_GlyphLoader_Add ( FT_GlyphLoader  loader)

Definition at line 328 of file ftgloadr.c.

329  {
332 
333  FT_Int n_curr_contours;
334  FT_Int n_base_points;
335  FT_Int n;
336 
337 
338  if ( !loader )
339  return;
340 
341  base = &loader->base;
342  current = &loader->current;
343 
344  n_curr_contours = current->outline.n_contours;
345  n_base_points = base->outline.n_points;
346 
347  base->outline.n_points =
348  (short)( base->outline.n_points + current->outline.n_points );
349  base->outline.n_contours =
350  (short)( base->outline.n_contours + current->outline.n_contours );
351 
352  base->num_subglyphs += current->num_subglyphs;
353 
354  /* adjust contours count in newest outline */
355  for ( n = 0; n < n_curr_contours; n++ )
356  current->outline.contours[n] =
357  (short)( current->outline.contours[n] + n_base_points );
358 
359  /* prepare for another new glyph image */
360  FT_GlyphLoader_Prepare( loader );
361  }
signed int FT_Int
Definition: fttypes.h:220
GLdouble n
Definition: glext.h:7729
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
GLuint base
Definition: 3dtext.c:35
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
FT_GlyphLoader_Prepare(FT_GlyphLoader loader)
Definition: ftgloadr.c:312
struct task_struct * current
Definition: linux.c:32

Referenced by cf2_outline_close(), load_truetype_glyph(), and pfr_glyph_end().

◆ FT_GlyphLoader_CheckPoints()

FT_GlyphLoader_CheckPoints ( FT_GlyphLoader  loader,
FT_UInt  n_points,
FT_UInt  n_contours 
)

Definition at line 201 of file ftgloadr.c.

204  {
205  FT_Memory memory = loader->memory;
207  FT_Outline* base = &loader->base.outline;
208  FT_Outline* current = &loader->current.outline;
209  FT_Bool adjust = 0;
210 
211  FT_UInt new_max, old_max;
212 
213 
214  /* check points & tags */
215  new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points +
216  n_points;
217  old_max = loader->max_points;
218 
219  if ( new_max > old_max )
220  {
221  new_max = FT_PAD_CEIL( new_max, 8 );
222 
223  if ( new_max > FT_OUTLINE_POINTS_MAX )
224  return FT_THROW( Array_Too_Large );
225 
226  if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
227  FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
228  goto Exit;
229 
230  if ( loader->use_extra )
231  {
232  if ( FT_RENEW_ARRAY( loader->base.extra_points,
233  old_max * 2, new_max * 2 ) )
234  goto Exit;
235 
236  FT_ARRAY_MOVE( loader->base.extra_points + new_max,
237  loader->base.extra_points + old_max,
238  old_max );
239 
240  loader->base.extra_points2 = loader->base.extra_points + new_max;
241  }
242 
243  adjust = 1;
244  loader->max_points = new_max;
245  }
246 
247  /* check contours */
248  old_max = loader->max_contours;
249  new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours +
250  n_contours;
251  if ( new_max > old_max )
252  {
253  new_max = FT_PAD_CEIL( new_max, 4 );
254 
255  if ( new_max > FT_OUTLINE_CONTOURS_MAX )
256  return FT_THROW( Array_Too_Large );
257 
258  if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
259  goto Exit;
260 
261  adjust = 1;
262  loader->max_contours = new_max;
263  }
264 
265  if ( adjust )
267 
268  Exit:
269  if ( error )
270  FT_GlyphLoader_Reset( loader );
271 
272  return error;
273  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_Vector * extra_points
Definition: ftgloadr.h:53
FT_Memory memory
Definition: ftgloadr.h:63
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_PAD_CEIL(x, n)
Definition: ftobjs.h:90
FT_Outline outline
Definition: ftgloadr.h:52
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_UInt max_points
Definition: ftgloadr.h:64
#define FT_OUTLINE_POINTS_MAX
Definition: ftimage.h:352
FT_GlyphLoader_Reset(FT_GlyphLoader loader)
Definition: ftgloadr.c:105
FT_Vector * extra_points2
Definition: ftgloadr.h:54
#define FT_ARRAY_MOVE(dest, source, count)
Definition: ftmemory.h:249
static void Exit(void)
Definition: sock.c:1331
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
Definition: ftmemory.h:336
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
FT_UInt max_contours
Definition: ftgloadr.h:65
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
static void FT_GlyphLoader_Adjust_Points(FT_GlyphLoader loader)
Definition: ftgloadr.c:143
unsigned int FT_UInt
Definition: fttypes.h:231
FT_Bool use_extra
Definition: ftgloadr.h:67
struct task_struct * current
Definition: linux.c:32
#define FT_OUTLINE_CONTOURS_MAX
Definition: ftimage.h:351

Referenced by FT_GlyphLoader_CopyPoints().

◆ FT_GlyphLoader_CheckSubGlyphs()

FT_GlyphLoader_CheckSubGlyphs ( FT_GlyphLoader  loader,
FT_UInt  n_subs 
)

Definition at line 281 of file ftgloadr.c.

283  {
284  FT_Memory memory = loader->memory;
286  FT_UInt new_max, old_max;
287 
288  FT_GlyphLoad base = &loader->base;
289  FT_GlyphLoad current = &loader->current;
290 
291 
292  new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
293  old_max = loader->max_subglyphs;
294  if ( new_max > old_max )
295  {
296  new_max = FT_PAD_CEIL( new_max, 2 );
297  if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
298  goto Exit;
299 
300  loader->max_subglyphs = new_max;
301 
303  }
304 
305  Exit:
306  return error;
307  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_Memory memory
Definition: ftgloadr.h:63
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
#define FT_PAD_CEIL(x, n)
Definition: ftobjs.h:90
static void Exit(void)
Definition: sock.c:1331
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
Definition: ftmemory.h:336
FT_UInt max_subglyphs
Definition: ftgloadr.h:66
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
unsigned int FT_UInt
Definition: fttypes.h:231
static void FT_GlyphLoader_Adjust_Subglyphs(FT_GlyphLoader loader)
Definition: ftgloadr.c:186
struct task_struct * current
Definition: linux.c:32

Referenced by cf2_interpT2CharString(), and TT_Load_Composite_Glyph().

◆ FT_GlyphLoader_CopyPoints()

FT_GlyphLoader_CopyPoints ( FT_GlyphLoader  target,
FT_GlyphLoader  source 
)

Definition at line 365 of file ftgloadr.c.

367  {
368  FT_Error error;
369  FT_UInt num_points = (FT_UInt)source->base.outline.n_points;
370  FT_UInt num_contours = (FT_UInt)source->base.outline.n_contours;
371 
372 
373  error = FT_GlyphLoader_CheckPoints( target, num_points, num_contours );
374  if ( !error )
375  {
376  FT_Outline* out = &target->base.outline;
377  FT_Outline* in = &source->base.outline;
378 
379 
380  FT_ARRAY_COPY( out->points, in->points,
381  num_points );
382  FT_ARRAY_COPY( out->tags, in->tags,
383  num_points );
384  FT_ARRAY_COPY( out->contours, in->contours,
385  num_contours );
386 
387  /* do we need to copy the extra points? */
388  if ( target->use_extra && source->use_extra )
389  {
390  FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points,
391  num_points );
392  FT_ARRAY_COPY( target->base.extra_points2, source->base.extra_points2,
393  num_points );
394  }
395 
396  out->n_points = (short)num_points;
397  out->n_contours = (short)num_contours;
398 
400  }
401 
402  return error;
403  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
#define FT_ARRAY_COPY(dest, source, count)
Definition: ftmemory.h:244
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
FT_GlyphLoader_CheckPoints(FT_GlyphLoader loader, FT_UInt n_points, FT_UInt n_contours)
Definition: ftgloadr.c:201
LONGLONG base
Definition: pdh_main.c:178
static FILE * out
Definition: regtests2xml.c:44
static void FT_GlyphLoader_Adjust_Points(FT_GlyphLoader loader)
Definition: ftgloadr.c:143
GLuint in
Definition: glext.h:9616
unsigned int FT_UInt
Definition: fttypes.h:231
GLenum target
Definition: glext.h:7315

◆ FT_GlyphLoader_CreateExtra()

FT_GlyphLoader_CreateExtra ( FT_GlyphLoader  loader)

Definition at line 166 of file ftgloadr.c.

167  {
168  FT_Error error;
169  FT_Memory memory = loader->memory;
170 
171 
172  if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) )
173  {
174  loader->use_extra = 1;
175  loader->base.extra_points2 = loader->base.extra_points +
176  loader->max_points;
177 
179  }
180  return error;
181  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_Vector * extra_points
Definition: ftgloadr.h:53
FT_Memory memory
Definition: ftgloadr.h:63
static char memory[1024 *256]
Definition: process.c:116
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
FT_UInt max_points
Definition: ftgloadr.h:64
FT_Vector * extra_points2
Definition: ftgloadr.h:54
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:333
static void FT_GlyphLoader_Adjust_Points(FT_GlyphLoader loader)
Definition: ftgloadr.c:143
FT_Bool use_extra
Definition: ftgloadr.h:67

Referenced by tt_slot_init().

◆ FT_GlyphLoader_Done()

FT_GlyphLoader_Done ( FT_GlyphLoader  loader)

Definition at line 128 of file ftgloadr.c.

129  {
130  if ( loader )
131  {
132  FT_Memory memory = loader->memory;
133 
134 
135  FT_GlyphLoader_Reset( loader );
136  FT_FREE( loader );
137  }
138  }
FT_Memory memory
Definition: ftgloadr.h:63
static char memory[1024 *256]
Definition: process.c:116
FT_GlyphLoader_Reset(FT_GlyphLoader loader)
Definition: ftgloadr.c:105
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66

Referenced by ft_glyphslot_done().

◆ FT_GlyphLoader_New()

FT_GlyphLoader_New ( FT_Memory  memory,
FT_GlyphLoader aloader 
)

Definition at line 70 of file ftgloadr.c.

72  {
73  FT_GlyphLoader loader = NULL;
75 
76 
77  if ( !FT_NEW( loader ) )
78  {
79  loader->memory = memory;
80  *aloader = loader;
81  }
82  return error;
83  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_Memory memory
Definition: ftgloadr.h:63
static char memory[1024 *256]
Definition: process.c:116
smooth NULL
Definition: ftsmooth.c:416
#define FT_NEW(ptr)
Definition: ftmemory.h:331

Referenced by ft_glyphslot_init().

◆ FT_GlyphLoader_Prepare()

FT_GlyphLoader_Prepare ( FT_GlyphLoader  loader)

Definition at line 312 of file ftgloadr.c.

313  {
314  FT_GlyphLoad current = &loader->current;
315 
316 
317  current->outline.n_points = 0;
318  current->outline.n_contours = 0;
319  current->num_subglyphs = 0;
320 
321  FT_GlyphLoader_Adjust_Points ( loader );
323  }
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
static void FT_GlyphLoader_Adjust_Points(FT_GlyphLoader loader)
Definition: ftgloadr.c:143
static void FT_GlyphLoader_Adjust_Subglyphs(FT_GlyphLoader loader)
Definition: ftgloadr.c:186
struct task_struct * current
Definition: linux.c:32

Referenced by cf2_interpT2CharString(), and FT_GlyphLoader_Add().

◆ FT_GlyphLoader_Reset()

FT_GlyphLoader_Reset ( FT_GlyphLoader  loader)

Definition at line 105 of file ftgloadr.c.

106  {
107  FT_Memory memory = loader->memory;
108 
109 
110  FT_FREE( loader->base.outline.points );
111  FT_FREE( loader->base.outline.tags );
112  FT_FREE( loader->base.outline.contours );
113  FT_FREE( loader->base.extra_points );
114  FT_FREE( loader->base.subglyphs );
115 
116  loader->base.extra_points2 = NULL;
117 
118  loader->max_points = 0;
119  loader->max_contours = 0;
120  loader->max_subglyphs = 0;
121 
122  FT_GlyphLoader_Rewind( loader );
123  }
char * tags
Definition: ftimage.h:340
FT_Vector * extra_points
Definition: ftgloadr.h:53
FT_SubGlyph subglyphs
Definition: ftgloadr.h:56
FT_Memory memory
Definition: ftgloadr.h:63
static char memory[1024 *256]
Definition: process.c:116
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
FT_Vector * points
Definition: ftimage.h:339
FT_Outline outline
Definition: ftgloadr.h:52
FT_GlyphLoader_Rewind(FT_GlyphLoader loader)
Definition: ftgloadr.c:88
FT_UInt max_points
Definition: ftgloadr.h:64
FT_Vector * extra_points2
Definition: ftgloadr.h:54
smooth NULL
Definition: ftsmooth.c:416
#define FT_FREE(ptr)
Definition: ftmemory.h:329
FT_UInt max_subglyphs
Definition: ftgloadr.h:66
FT_UInt max_contours
Definition: ftgloadr.h:65
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
short * contours
Definition: ftimage.h:341

Referenced by FT_GlyphLoader_CheckPoints(), and FT_GlyphLoader_Done().

◆ FT_GlyphLoader_Rewind()

FT_GlyphLoader_Rewind ( FT_GlyphLoader  loader)

Definition at line 88 of file ftgloadr.c.

89  {
90  FT_GlyphLoad base = &loader->base;
91  FT_GlyphLoad current = &loader->current;
92 
93 
94  base->outline.n_points = 0;
95  base->outline.n_contours = 0;
96  base->num_subglyphs = 0;
97 
98  *current = *base;
99  }
FT_GlyphLoadRec base
Definition: ftgloadr.h:69
GLuint base
Definition: 3dtext.c:35
FT_GlyphLoadRec current
Definition: ftgloadr.h:70
struct task_struct * current
Definition: linux.c:32

Referenced by cf2_outline_reset(), cff_builder_init(), FT_GlyphLoader_Reset(), pfr_glyph_init(), pfr_glyph_load(), t1_builder_init(), and tt_loader_init().