Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed




















































Rev Author Line No. Line
3918 Serge 1
2
"http://www.w3.org/TR/html4/loose.dtd">
3
4
5
6
FreeType-2.5.0 API Reference
7
32
33
34
 
35
[Index]
36
37
[TOC]
38

FreeType-2.5.0 API Reference

39
 
40

41
Module Management
42
43

Synopsis

44
45
FT_Module_ConstructorFT_Remove_ModuleFT_Set_Debug_Hook
46
FT_Module_DestructorFT_Property_SetFT_Add_Default_Modules
47
FT_Module_RequesterFT_Property_GetFT_Renderer_Class
48
FT_Module_ClassFT_Reference_LibraryFT_Get_Renderer
49
FT_Add_ModuleFT_New_LibraryFT_Set_Renderer
50
FT_Get_ModuleFT_Done_Library
51


52
 
53
54

The definitions below are used to manage modules within FreeType. Modules can be added, upgraded, and removed at runtime. Additionally, some module properties can be controlled also.

55

Here is a list of possible values of the ‘module_name’ field in the FT_Module_Class structure.

56
57
  autofitter
58
  bdf
59
  cff
60
  gxvalid
61
  otvalid
62
  pcf
63
  pfr
64
  psaux
65
  pshinter
66
  psnames
67
  raster1, raster5
68
  sfnt
69
  smooth, smooth-lcd, smooth-lcdv
70
  truetype
71
  type1
72
  type42
73
  t1cid
74
  winfonts
75
76

Note that the FreeType Cache sub-system is not a FreeType module.

77

78
79

FT_Module_Constructor

80
81
Defined in FT_MODULE_H (freetype/ftmodapi.h).
82

83
84
 
85
  typedef FT_Error
86
  (*FT_Module_Constructor)( FT_Module  module );
87
 
88

89
90

A function used to initialize (not create) a new module object.

91

92
input
93

94
95
module
96

The module to initialize.

97
98
99
100
101

102
[Index]
103
104
[TOC]
105
 
106
107

FT_Module_Destructor

108
109
Defined in FT_MODULE_H (freetype/ftmodapi.h).
110

111
112
 
113
  typedef void
114
  (*FT_Module_Destructor)( FT_Module  module );
115
 
116

117
118

A function used to finalize (not destroy) a given module object.

119

120
input
121

122
123
module
124

The module to finalize.

125
126
127
128
129

130
[Index]
131
132
[TOC]
133
 
134
135

FT_Module_Requester

136
137
Defined in FT_MODULE_H (freetype/ftmodapi.h).
138

139
140
 
141
  typedef FT_Module_Interface
142
  (*FT_Module_Requester)( FT_Module    module,
143
                          const char*  name );
144
 
145

146
147

A function used to query a given module for a specific interface.

148

149
input
150

151
152
module
153

The module to be searched.

154
155
name
156

The name of the interface in the module.

157
158
159
160
161

162
[Index]
163
164
[TOC]
165
 
166
167

FT_Module_Class

168
169
Defined in FT_MODULE_H (freetype/ftmodapi.h).
170

171
172
 
173
  typedef struct  FT_Module_Class_
174
  {
175
    FT_ULong               module_flags;
176
    FT_Long                module_size;
177
    const FT_String*       module_name;
178
    FT_Fixed               module_version;
179
    FT_Fixed               module_requires;
180
 
181
    const void*            module_interface;
182
 
183
    FT_Module_Constructor  module_init;
184
    FT_Module_Destructor   module_done;
185
    FT_Module_Requester    get_interface;
186
 
187
  } FT_Module_Class;
188
 
189

190
191

The module class descriptor.

192

193
fields
194

195
196
module_flags
197

Bit flags describing the module.

198
199
module_size
200

The size of one module object/instance in bytes.

201
202
module_name
203

The name of the module.

204
205
module_version
206

The version, as a 16.16 fixed number (major.minor).

207
208
module_requires
209

The version of FreeType this module requires, as a 16.16 fixed number (major.minor). Starts at version 2.0, i.e., 0x20000.

210
211
module_init
212

The initializing function.

213
214
module_done
215

The finalizing function.

216
217
get_interface
218

The interface requesting function.

219
220
221
222
223

224
[Index]
225
226
[TOC]
227
 
228
229

FT_Add_Module

230
231
Defined in FT_MODULE_H (freetype/ftmodapi.h).
232

233
234
 
235
  FT_EXPORT( FT_Error )
236
  FT_Add_Module( FT_Library              library,
237
                 const FT_Module_Class*  clazz );
238
 
239

240
241

Add a new module to a given library instance.

242

243
inout
244

245
246
library
247

A handle to the library object.

248
249
250
251
input
252

253
254
clazz
255

A pointer to class descriptor for the module.

256
257
258
259
return
260

FreeType error code. 0 means success.

261
262
note
263

An error will be returned if a module already exists by that name, or if the module requires a version of FreeType that is too great.

264
265
266

267
[Index]
268
269
[TOC]
270
 
271
272

FT_Get_Module

273
274
Defined in FT_MODULE_H (freetype/ftmodapi.h).
275

276
277
 
278
  FT_EXPORT( FT_Module )
279
  FT_Get_Module( FT_Library   library,
280
                 const char*  module_name );
281
 
282

283
284

Find a module by its name.

285

286
input
287

288
289
library
290

A handle to the library object.

291
292
module_name
293

The module's name (as an ASCII string).

294
295
296
297
return
298

A module handle. 0 if none was found.

299
300
note
301

FreeType's internal modules aren't documented very well, and you should look up the source code for details.

302
303
304

305
[Index]
306
307
[TOC]
308
 
309
310

FT_Remove_Module

311
312
Defined in FT_MODULE_H (freetype/ftmodapi.h).
313

314
315
 
316
  FT_EXPORT( FT_Error )
317
  FT_Remove_Module( FT_Library  library,
318
                    FT_Module   module );
319
 
320

321
322

Remove a given module from a library instance.

323

324
inout
325

326
327
library
328

A handle to a library object.

329
330
331
332
input
333

334
335
module
336

A handle to a module object.

337
338
339
340
return
341

FreeType error code. 0 means success.

342
343
note
344

The module object is destroyed by the function in case of success.

345
346
347

348
[Index]
349
350
[TOC]
351
 
352
353

FT_Property_Set

354
355
Defined in FT_MODULE_H (freetype/ftmodapi.h).
356

357
358
 
359
  FT_EXPORT( FT_Error )
360
  FT_Property_Set( FT_Library        library,
361
                   const FT_String*  module_name,
362
                   const FT_String*  property_name,
363
                   const void*       value );
364
 
365

366
367

Set a property for a given module.

368

369
input
370

371
372
library
373

A handle to the library the module is part of.

374
375
module_name
376

The module name.

377
378
property_name
379

The property name. Properties are described in the ‘Synopsis’ subsection of the module's documentation.

380

Note that only a few modules have properties.

381
382
value
383

A generic pointer to a variable or structure which gives the new value of the property. The exact definition of ‘value’ is dependent on the property; see the ‘Synopsis’ subsection of the module's documentation.

384
385
386
387
return
388

FreeType error code. 0 means success.

389
390
note
391

If ‘module_name’ isn't a valid module name, or ‘property_name’ doesn't specify a valid property, or if ‘value’ doesn't represent a valid value for the given property, an error is returned.

392

The following example sets property ‘bar’ (a simple integer) in module ‘foo’ to value 1.

393
394
  FT_UInt  bar;
395
 
396
 
397
  bar = 1;
398
  FT_Property_Set( library, "foo", "bar", &bar );
399
400

Note that the FreeType Cache sub-system doesn't recognize module property changes. To avoid glyph lookup confusion within the cache you should call FTC_Manager_Reset to completely flush the cache if a module property gets changed after FTC_Manager_New has been called.

401

It is not possible to set properties of the FreeType Cache sub-system itself with FT_Property_Set; use ?FTC_Property_Set? instead.

402
403
since
404

2.4.11

405
406
407

408
[Index]
409
410
[TOC]
411
 
412
413

FT_Property_Get

414
415
Defined in FT_MODULE_H (freetype/ftmodapi.h).
416

417
418
 
419
  FT_EXPORT( FT_Error )
420
  FT_Property_Get( FT_Library        library,
421
                   const FT_String*  module_name,
422
                   const FT_String*  property_name,
423
                   void*             value );
424
 
425

426
427

Get a module's property value.

428

429
input
430

431
432
library
433

A handle to the library the module is part of.

434
435
module_name
436

The module name.

437
438
property_name
439

The property name. Properties are described in the ‘Synopsis’ subsection of the module's documentation.

440
441
442
443
inout
444

445
446
value
447

A generic pointer to a variable or structure which gives the value of the property. The exact definition of ‘value’ is dependent on the property; see the ‘Synopsis’ subsection of the module's documentation.

448
449
450
451
return
452

FreeType error code. 0 means success.

453
454
note
455

If ‘module_name’ isn't a valid module name, or ‘property_name’ doesn't specify a valid property, or if ‘value’ doesn't represent a valid value for the given property, an error is returned.

456

The following example gets property ‘baz’ (a range) in module ‘foo’.

457
458
  typedef  range_
459
  {
460
    FT_Int32  min;
461
    FT_Int32  max;
462
 
463
  } range;
464
 
465
  range  baz;
466
 
467
 
468
  FT_Property_Get( library, "foo", "baz", &baz );
469
470

It is not possible to retrieve properties of the FreeType Cache sub-system with FT_Property_Get; use ?FTC_Property_Get? instead.

471
472
since
473

2.4.11

474
475
476

477
[Index]
478
479
[TOC]
480
 
481
482

FT_Reference_Library

483
484
Defined in FT_MODULE_H (freetype/ftmodapi.h).
485

486
487
 
488
  FT_EXPORT( FT_Error )
489
  FT_Reference_Library( FT_Library  library );
490
 
491

492
493

A counter gets initialized to 1 at the time an FT_Library structure is created. This function increments the counter. FT_Done_Library then only destroys a library if the counter is 1, otherwise it simply decrements the counter.

494

This function helps in managing life-cycles of structures which reference FT_Library objects.

495

496
input
497

498
499
library
500

A handle to a target library object.

501
502
503
504
return
505

FreeType error code. 0 means success.

506
507
since
508

2.4.2

509
510
511

512
[Index]
513
514
[TOC]
515
 
516
517

FT_New_Library

518
519
Defined in FT_MODULE_H (freetype/ftmodapi.h).
520

521
522
 
523
  FT_EXPORT( FT_Error )
524
  FT_New_Library( FT_Memory    memory,
525
                  FT_Library  *alibrary );
526
 
527

528
529

This function is used to create a new FreeType library instance from a given memory object. It is thus possible to use libraries with distinct memory allocators within the same program.

530

Normally, you would call this function (followed by a call to FT_Add_Default_Modules or a series of calls to FT_Add_Module) instead of FT_Init_FreeType to initialize the FreeType library.

531

Don't use FT_Done_FreeType but FT_Done_Library to destroy a library instance.

532

533
input
534

535
536
memory
537

A handle to the original memory object.

538
539
540
541
output
542

543
544
alibrary
545

A pointer to handle of a new library object.

546
547
548
549
return
550

FreeType error code. 0 means success.

551
552
note
553

See the discussion of reference counters in the description of FT_Reference_Library.

554
555
556

557
[Index]
558
559
[TOC]
560
 
561
562

FT_Done_Library

563
564
Defined in FT_MODULE_H (freetype/ftmodapi.h).
565

566
567
 
568
  FT_EXPORT( FT_Error )
569
  FT_Done_Library( FT_Library  library );
570
 
571

572
573

Discard a given library object. This closes all drivers and discards all resource objects.

574

575
input
576

577
578
library
579

A handle to the target library.

580
581
582
583
return
584

FreeType error code. 0 means success.

585
586
note
587

See the discussion of reference counters in the description of FT_Reference_Library.

588
589
590

591
[Index]
592
593
[TOC]
594
 
595
596

FT_Set_Debug_Hook

597
598
Defined in FT_MODULE_H (freetype/ftmodapi.h).
599

600
601
 
602
  FT_EXPORT( void )
603
  FT_Set_Debug_Hook( FT_Library         library,
604
                     FT_UInt            hook_index,
605
                     FT_DebugHook_Func  debug_hook );
606
 
607

608
609

Set a debug hook function for debugging the interpreter of a font format.

610

611
inout
612

613
614
library
615

A handle to the library object.

616
617
618
619
input
620

621
622
hook_index
623

The index of the debug hook. You should use the values defined in ‘ftobjs.h’, e.g., ‘FT_DEBUG_HOOK_TRUETYPE’.

624
625
debug_hook
626

The function used to debug the interpreter.

627
628
629
630
note
631

Currently, four debug hook slots are available, but only two (for the TrueType and the Type 1 interpreter) are defined.

632

Since the internal headers of FreeType are no longer installed, the symbol ‘FT_DEBUG_HOOK_TRUETYPE’ isn't available publicly. This is a bug and will be fixed in a forthcoming release.

633
634
635

636
[Index]
637
638
[TOC]
639
 
640
641

FT_Add_Default_Modules

642
643
Defined in FT_MODULE_H (freetype/ftmodapi.h).
644

645
646
 
647
  FT_EXPORT( void )
648
  FT_Add_Default_Modules( FT_Library  library );
649
 
650

651
652

Add the set of default drivers to a given library object. This is only useful when you create a library object with FT_New_Library (usually to plug a custom memory manager).

653

654
inout
655

656
657
library
658

A handle to a new library object.

659
660
661
662
663

664
[Index]
665
666
[TOC]
667
 
668
669

FT_Renderer_Class

670
671
Defined in FT_RENDER_H (freetype/ftrender.h).
672

673
674
 
675
  typedef struct  FT_Renderer_Class_
676
  {
677
    FT_Module_Class            root;
678
 
679
    FT_Glyph_Format            glyph_format;
680
 
681
    FT_Renderer_RenderFunc     render_glyph;
682
    FT_Renderer_TransformFunc  transform_glyph;
683
    FT_Renderer_GetCBoxFunc    get_glyph_cbox;
684
    FT_Renderer_SetModeFunc    set_mode;
685
 
686
    FT_Raster_Funcs*           raster_class;
687
 
688
  } FT_Renderer_Class;
689
 
690

691
692

The renderer module class descriptor.

693

694
fields
695

696
697
root
698

The root FT_Module_Class fields.

699
700
glyph_format
701

The glyph image format this renderer handles.

702
703
render_glyph
704

A method used to render the image that is in a given glyph slot into a bitmap.

705
706
transform_glyph
707

A method used to transform the image that is in a given glyph slot.

708
709
get_glyph_cbox
710

A method used to access the glyph's cbox.

711
712
set_mode
713

A method used to pass additional parameters.

714
715
raster_class
716

For FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to its raster's class.

717
718
719
720
721

722
[Index]
723
724
[TOC]
725
 
726
727

FT_Get_Renderer

728
729
Defined in FT_RENDER_H (freetype/ftrender.h).
730

731
732
 
733
  FT_EXPORT( FT_Renderer )
734
  FT_Get_Renderer( FT_Library       library,
735
                   FT_Glyph_Format  format );
736
 
737

738
739

Retrieve the current renderer for a given glyph format.

740

741
input
742

743
744
library
745

A handle to the library object.

746
747
format
748

The glyph format.

749
750
751
752
return
753

A renderer handle. 0 if none found.

754
755
note
756

An error will be returned if a module already exists by that name, or if the module requires a version of FreeType that is too great.

757

To add a new renderer, simply use FT_Add_Module. To retrieve a renderer by its name, use FT_Get_Module.

758
759
760

761
[Index]
762
763
[TOC]
764
 
765
766

FT_Set_Renderer

767
768
Defined in FT_RENDER_H (freetype/ftrender.h).
769

770
771
 
772
  FT_EXPORT( FT_Error )
773
  FT_Set_Renderer( FT_Library     library,
774
                   FT_Renderer    renderer,
775
                   FT_UInt        num_params,
776
                   FT_Parameter*  parameters );
777
 
778

779
780

Set the current renderer to use, and set additional mode.

781

782
inout
783

784
785
library
786

A handle to the library object.

787
788
789
790
input
791

792
793
renderer
794

A handle to the renderer object.

795
796
num_params
797

The number of additional parameters.

798
799
parameters
800

Additional parameters.

801
802
803
804
return
805

FreeType error code. 0 means success.

806
807
note
808

In case of success, the renderer will be used to convert glyph images in the renderer's known format into bitmaps.

809

This doesn't change the current renderer for other formats.

810

Currently, only the B/W renderer, if compiled with FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels anti-aliasing mode; this option must be set directly in ‘ftraster.c’ and is undefined by default) accepts a single tag ‘pal5’ to set its gray palette as a character string with 5 elements. Consequently, the third and fourth argument are zero normally.

811
812
813

814
[Index]
815
816
[TOC]
817
 
818
819