Subversion Repositories Kolibri OS

Rev

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









































































Rev Author Line No. Line
4349 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
Outline Processing
42
43

Synopsis

44
45
FT_Outlineft_outline_flags
46
FT_OUTLINE_FLAGSFT_Outline_MoveToFunc
47
FT_Outline_NewFT_Outline_LineToFunc
48
FT_Outline_DoneFT_Outline_ConicToFunc
49
FT_Outline_CopyFT_Outline_CubicToFunc
50
FT_Outline_TranslateFT_Outline_Funcs
51
FT_Outline_TransformFT_Outline_Decompose
52
FT_Outline_EmboldenFT_Outline_Get_CBox
53
FT_Outline_EmboldenXYFT_Outline_Get_Bitmap
54
FT_Outline_ReverseFT_Outline_Render
55
FT_Outline_CheckFT_Orientation
56
FT_Outline_Get_BBoxFT_Outline_Get_Orientation
57


58
 
59
60

This section contains routines used to create and destroy scalable glyph images known as ‘outlines’. These can also be measured, transformed, and converted into bitmaps and pixmaps.

61

62
63

FT_Outline

64
65
Defined in FT_IMAGE_H (freetype/ftimage.h).
66

67
68
 
69
  typedef struct  FT_Outline_
70
  {
71
    short       n_contours;      /* number of contours in glyph        */
72
    short       n_points;        /* number of points in the glyph      */
73
 
74
    FT_Vector*  points;          /* the outline's points               */
75
    char*       tags;            /* the points flags                   */
76
    short*      contours;        /* the contour end points             */
77
 
78
    int         flags;           /* outline masks                      */
79
 
80
  } FT_Outline;
81
 
82
  /* Following limits must be consistent with */
83
  /* FT_Outline.{n_contours,n_points}         */
84
#define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX
85
#define FT_OUTLINE_POINTS_MAX    SHRT_MAX
86
 
87

88
89

This structure is used to describe an outline to the scan-line converter.

90

91
fields
92

93
94
n_contours
95

The number of contours in the outline.

96
97
n_points
98

The number of points in the outline.

99
100
points
101

A pointer to an array of ‘n_points’ FT_Vector elements, giving the outline's point coordinates.

102
103
tags
104

A pointer to an array of ‘n_points’ chars, giving each outline point's type.

105

If bit 0 is unset, the point is ‘off’ the curve, i.e., a Bézier control point, while it is ‘on’ if set.

106

Bit 1 is meaningful for ‘off’ points only. If set, it indicates a third-order Bézier arc control point; and a second-order control point if unset.

107

If bit 2 is set, bits 5-7 contain the drop-out mode (as defined in the OpenType specification; the value is the same as the argument to the SCANMODE instruction).

108

Bits 3 and 4 are reserved for internal purposes.

109
110
contours
111

An array of ‘n_contours’ shorts, giving the end point of each contour within the outline. For example, the first contour is defined by the points ‘0’ to ‘contours[0]’, the second one is defined by the points ‘contours[0]+1’ to ‘contours[1]’, etc.

112
113
flags
114

A set of bit flags used to characterize the outline and give hints to the scan-converter and hinter on how to convert/grid-fit it. See FT_OUTLINE_FLAGS.

115
116
117
118
note
119

The B/W rasterizer only checks bit 2 in the ‘tags’ array for the first point of each contour. The drop-out mode as given with FT_OUTLINE_IGNORE_DROPOUTS, FT_OUTLINE_SMART_DROPOUTS, and FT_OUTLINE_INCLUDE_STUBS in ‘flags’ is then overridden.

120
121
122

123
[Index]
124
125
[TOC]
126
 
127
128

FT_OUTLINE_FLAGS

129
130
Defined in FT_IMAGE_H (freetype/ftimage.h).
131

132
133
 
134
#define FT_OUTLINE_NONE             0x0
135
#define FT_OUTLINE_OWNER            0x1
136
#define FT_OUTLINE_EVEN_ODD_FILL    0x2
137
#define FT_OUTLINE_REVERSE_FILL     0x4
138
#define FT_OUTLINE_IGNORE_DROPOUTS  0x8
139
#define FT_OUTLINE_SMART_DROPOUTS   0x10
140
#define FT_OUTLINE_INCLUDE_STUBS    0x20
141
 
142
#define FT_OUTLINE_HIGH_PRECISION   0x100
143
#define FT_OUTLINE_SINGLE_PASS      0x200
144
 
145

146
147

A list of bit-field constants use for the flags in an outline's ‘flags’ field.

148

149
values
150

151
152
FT_OUTLINE_NONE
153

Value 0 is reserved.

154
155
FT_OUTLINE_OWNER
156

If set, this flag indicates that the outline's field arrays (i.e., ‘points’, ‘flags’, and ‘contours’) are ‘owned’ by the outline object, and should thus be freed when it is destroyed.

157
158
FT_OUTLINE_EVEN_ODD_FILL
159
160

By default, outlines are filled using the non-zero winding rule. If set to 1, the outline will be filled using the even-odd fill rule (only works with the smooth rasterizer).

161
162
FT_OUTLINE_REVERSE_FILL
163
164

By default, outside contours of an outline are oriented in clock-wise direction, as defined in the TrueType specification. This flag is set if the outline uses the opposite direction (typically for Type 1 fonts). This flag is ignored by the scan converter.

165
166
FT_OUTLINE_IGNORE_DROPOUTS
167
168

By default, the scan converter will try to detect drop-outs in an outline and correct the glyph bitmap to ensure consistent shape continuity. If set, this flag hints the scan-line converter to ignore such cases. See below for more information.

169
170
FT_OUTLINE_SMART_DROPOUTS
171
172

Select smart dropout control. If unset, use simple dropout control. Ignored if FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more information.

173
174
FT_OUTLINE_INCLUDE_STUBS
175
176

If set, turn pixels on for ‘stubs’, otherwise exclude them. Ignored if FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more information.

177
178
FT_OUTLINE_HIGH_PRECISION
179
180

This flag indicates that the scan-line converter should try to convert this outline to bitmaps with the highest possible quality. It is typically set for small character sizes. Note that this is only a hint that might be completely ignored by a given scan-converter.

181
182
FT_OUTLINE_SINGLE_PASS
183

This flag is set to force a given scan-converter to only use a single pass over the outline to render a bitmap glyph image. Normally, it is set for very large character sizes. It is only a hint that might be completely ignored by a given scan-converter.

184
185
186
187
note
188

The flags FT_OUTLINE_IGNORE_DROPOUTS, FT_OUTLINE_SMART_DROPOUTS, and FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth rasterizer.

189

There exists a second mechanism to pass the drop-out mode to the B/W rasterizer; see the ‘tags’ field in FT_Outline.

190

Please refer to the description of the ‘SCANTYPE’ instruction in the OpenType specification (in file ‘ttinst1.doc’) how simple drop-outs, smart drop-outs, and stubs are defined.

191
192
193

194
[Index]
195
196
[TOC]
197
 
198
199

FT_Outline_New

200
201
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
202

203
204
 
205
  FT_EXPORT( FT_Error )
206
  FT_Outline_New( FT_Library   library,
207
                  FT_UInt      numPoints,
208
                  FT_Int       numContours,
209
                  FT_Outline  *anoutline );
210
 
211
 
212
  FT_EXPORT( FT_Error )
213
  FT_Outline_New_Internal( FT_Memory    memory,
214
                           FT_UInt      numPoints,
215
                           FT_Int       numContours,
216
                           FT_Outline  *anoutline );
217
 
218

219
220

Create a new outline of a given size.

221

222
input
223

224
225
library
226

A handle to the library object from where the outline is allocated. Note however that the new outline will not necessarily be freed, when destroying the library, by FT_Done_FreeType.

227
228
numPoints
229

The maximum number of points within the outline. Must be smaller than or equal to 0xFFFF (65535).

230
231
numContours
232

The maximum number of contours within the outline. This value must be in the range 0 to ‘numPoints’.

233
234
235
236
output
237

238
239
anoutline
240

A handle to the new outline.

241
242
243
244
return
245

FreeType error code. 0 means success.

246
247
note
248

The reason why this function takes a ‘library’ parameter is simply to use the library's memory allocator.

249
250
251

252
[Index]
253
254
[TOC]
255
 
256
257

FT_Outline_Done

258
259
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
260

261
262
 
263
  FT_EXPORT( FT_Error )
264
  FT_Outline_Done( FT_Library   library,
265
                   FT_Outline*  outline );
266
 
267
 
268
  FT_EXPORT( FT_Error )
269
  FT_Outline_Done_Internal( FT_Memory    memory,
270
                            FT_Outline*  outline );
271
 
272

273
274

Destroy an outline created with FT_Outline_New.

275

276
input
277

278
279
library
280

A handle of the library object used to allocate the outline.

281
282
outline
283

A pointer to the outline object to be discarded.

284
285
286
287
return
288

FreeType error code. 0 means success.

289
290
note
291

If the outline's ‘owner’ field is not set, only the outline descriptor will be released.

292

The reason why this function takes an ‘library’ parameter is simply to use ft_mem_free().

293
294
295

296
[Index]
297
298
[TOC]
299
 
300
301

FT_Outline_Copy

302
303
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
304

305
306
 
307
  FT_EXPORT( FT_Error )
308
  FT_Outline_Copy( const FT_Outline*  source,
309
                   FT_Outline        *target );
310
 
311

312
313

Copy an outline into another one. Both objects must have the same sizes (number of points & number of contours) when this function is called.

314

315
input
316

317
318
source
319

A handle to the source outline.

320
321
322
323
output
324

325
326
target
327

A handle to the target outline.

328
329
330
331
return
332

FreeType error code. 0 means success.

333
334
335

336
[Index]
337
338
[TOC]
339
 
340
341

FT_Outline_Translate

342
343
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
344

345
346
 
347
  FT_EXPORT( void )
348
  FT_Outline_Translate( const FT_Outline*  outline,
349
                        FT_Pos             xOffset,
350
                        FT_Pos             yOffset );
351
 
352

353
354

Apply a simple translation to the points of an outline.

355

356
inout
357

358
359
outline
360

A pointer to the target outline descriptor.

361
362
363
364
input
365

366
367
xOffset
368

The horizontal offset.

369
370
yOffset
371

The vertical offset.

372
373
374
375
376

377
[Index]
378
379
[TOC]
380
 
381
382

FT_Outline_Transform

383
384
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
385

386
387
 
388
  FT_EXPORT( void )
389
  FT_Outline_Transform( const FT_Outline*  outline,
390
                        const FT_Matrix*   matrix );
391
 
392

393
394

Apply a simple 2x2 matrix to all of an outline's points. Useful for applying rotations, slanting, flipping, etc.

395

396
inout
397

398
399
outline
400

A pointer to the target outline descriptor.

401
402
403
404
input
405

406
407
matrix
408

A pointer to the transformation matrix.

409
410
411
412
note
413

You can use FT_Outline_Translate if you need to translate the outline's points.

414
415
416

417
[Index]
418
419
[TOC]
420
 
421
422

FT_Outline_Embolden

423
424
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
425

426
427
 
428
  FT_EXPORT( FT_Error )
429
  FT_Outline_Embolden( FT_Outline*  outline,
430
                       FT_Pos       strength );
431
 
432

433
434

Embolden an outline. The new outline will be at most 4 times ‘strength’ pixels wider and higher. You may think of the left and bottom borders as unchanged.

435

Negative ‘strength’ values to reduce the outline thickness are possible also.

436

437
inout
438

439
440
outline
441

A handle to the target outline.

442
443
444
445
input
446

447
448
strength
449

How strong the glyph is emboldened. Expressed in 26.6 pixel format.

450
451
452
453
return
454

FreeType error code. 0 means success.

455
456
note
457

The used algorithm to increase or decrease the thickness of the glyph doesn't change the number of points; this means that certain situations like acute angles or intersections are sometimes handled incorrectly.

458

If you need ‘better’ metrics values you should call FT_Outline_Get_CBox or FT_Outline_Get_BBox.

459

Example call:

460
461
  FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );
462
  if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE )
463
    FT_Outline_Embolden( &face->slot->outline, strength );
464
465
466
467

468
[Index]
469
470
[TOC]
471
 
472
473

FT_Outline_EmboldenXY

474
475
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
476

477
478
 
479
  FT_EXPORT( FT_Error )
480
  FT_Outline_EmboldenXY( FT_Outline*  outline,
481
                         FT_Pos       xstrength,
482
                         FT_Pos       ystrength );
483
 
484

485
486

Embolden an outline. The new outline will be ‘xstrength’ pixels wider and ‘ystrength’ pixels higher. Otherwise, it is similar to FT_Outline_Embolden, which uses the same strength in both directions.

487

488
489

490
[Index]
491
492
[TOC]
493
 
494
495

FT_Outline_Reverse

496
497
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
498

499
500
 
501
  FT_EXPORT( void )
502
  FT_Outline_Reverse( FT_Outline*  outline );
503
 
504

505
506

Reverse the drawing direction of an outline. This is used to ensure consistent fill conventions for mirrored glyphs.

507

508
inout
509

510
511
outline
512

A pointer to the target outline descriptor.

513
514
515
516
note
517

This function toggles the bit flag FT_OUTLINE_REVERSE_FILL in the outline's ‘flags’ field.

518

It shouldn't be used by a normal client application, unless it knows what it is doing.

519
520
521

522
[Index]
523
524
[TOC]
525
 
526
527

FT_Outline_Check

528
529
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
530

531
532
 
533
  FT_EXPORT( FT_Error )
534
  FT_Outline_Check( FT_Outline*  outline );
535
 
536

537
538

Check the contents of an outline descriptor.

539

540
input
541

542
543
outline
544

A handle to a source outline.

545
546
547
548
return
549

FreeType error code. 0 means success.

550
551
552

553
[Index]
554
555
[TOC]
556
 
557
558

FT_Outline_Get_BBox

559
560
Defined in FT_BBOX_H (freetype/ftbbox.h).
561

562
563
 
564
  FT_EXPORT( FT_Error )
565
  FT_Outline_Get_BBox( FT_Outline*  outline,
566
                       FT_BBox     *abbox );
567
 
568

569
570

Compute the exact bounding box of an outline. This is slower than computing the control box. However, it uses an advanced algorithm which returns very quickly when the two boxes coincide. Otherwise, the outline Bézier arcs are traversed to extract their extrema.

571

572
input
573

574
575
outline
576

A pointer to the source outline.

577
578
579
580
output
581

582
583
abbox
584

The outline's exact bounding box.

585
586
587
588
return
589

FreeType error code. 0 means success.

590
591
note
592

If the font is tricky and the glyph has been loaded with FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get reasonable values for the BBox it is necessary to load the glyph at a large ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting the BBox which can be eventually converted back to font units.

593
594
595

596
[Index]
597
598
[TOC]
599
 
600
601

ft_outline_flags

602
603
Defined in FT_IMAGE_H (freetype/ftimage.h).
604

605
606
 
607
#define ft_outline_none             FT_OUTLINE_NONE
608
#define ft_outline_owner            FT_OUTLINE_OWNER
609
#define ft_outline_even_odd_fill    FT_OUTLINE_EVEN_ODD_FILL
610
#define ft_outline_reverse_fill     FT_OUTLINE_REVERSE_FILL
611
#define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS
612
#define ft_outline_high_precision   FT_OUTLINE_HIGH_PRECISION
613
#define ft_outline_single_pass      FT_OUTLINE_SINGLE_PASS
614
 
615

616
617

These constants are deprecated. Please use the corresponding FT_OUTLINE_FLAGS values.

618

619
values
620

621
622
ft_outline_none
623

See FT_OUTLINE_NONE.

624
625
ft_outline_owner
626

See FT_OUTLINE_OWNER.

627
628
ft_outline_even_odd_fill
629
630

See FT_OUTLINE_EVEN_ODD_FILL.

631
632
ft_outline_reverse_fill
633
634

See FT_OUTLINE_REVERSE_FILL.

635
636
ft_outline_ignore_dropouts
637
638

See FT_OUTLINE_IGNORE_DROPOUTS.

639
640
ft_outline_high_precision
641
642

See FT_OUTLINE_HIGH_PRECISION.

643
644
ft_outline_single_pass
645

See FT_OUTLINE_SINGLE_PASS.

646
647
648
649
650

651
[Index]
652
653
[TOC]
654
 
655
656

FT_Outline_MoveToFunc

657
658
Defined in FT_IMAGE_H (freetype/ftimage.h).
659

660
661
 
662
  typedef int
663
  (*FT_Outline_MoveToFunc)( const FT_Vector*  to,
664
                            void*             user );
665
 
666
#define FT_Outline_MoveTo_Func  FT_Outline_MoveToFunc
667
 
668

669
670

A function pointer type used to describe the signature of a ‘move to’ function during outline walking/decomposition.

671

A ‘move to’ is emitted to start a new contour in an outline.

672

673
input
674

675
676
to
677

A pointer to the target point of the ‘move to’.

678
679
user
680

A typeless pointer which is passed from the caller of the decomposition function.

681
682
683
684
return
685

Error code. 0 means success.

686
687
688

689
[Index]
690
691
[TOC]
692
 
693
694

FT_Outline_LineToFunc

695
696
Defined in FT_IMAGE_H (freetype/ftimage.h).
697

698
699
 
700
  typedef int
701
  (*FT_Outline_LineToFunc)( const FT_Vector*  to,
702
                            void*             user );
703
 
704
#define FT_Outline_LineTo_Func  FT_Outline_LineToFunc
705
 
706

707
708

A function pointer type used to describe the signature of a ‘line to’ function during outline walking/decomposition.

709

A ‘line to’ is emitted to indicate a segment in the outline.

710

711
input
712

713
714
to
715

A pointer to the target point of the ‘line to’.

716
717
user
718

A typeless pointer which is passed from the caller of the decomposition function.

719
720
721
722
return
723

Error code. 0 means success.

724
725
726

727
[Index]
728
729
[TOC]
730
 
731
732

FT_Outline_ConicToFunc

733
734
Defined in FT_IMAGE_H (freetype/ftimage.h).
735

736
737
 
738
  typedef int
739
  (*FT_Outline_ConicToFunc)( const FT_Vector*  control,
740
                             const FT_Vector*  to,
741
                             void*             user );
742
 
743
#define FT_Outline_ConicTo_Func  FT_Outline_ConicToFunc
744
 
745

746
747

A function pointer type used to describe the signature of a ‘conic to’ function during outline walking or decomposition.

748

A ‘conic to’ is emitted to indicate a second-order Bézier arc in the outline.

749

750
input
751

752
753
control
754

An intermediate control point between the last position and the new target in ‘to’.

755
756
to
757

A pointer to the target end point of the conic arc.

758
759
user
760

A typeless pointer which is passed from the caller of the decomposition function.

761
762
763
764
return
765

Error code. 0 means success.

766
767
768

769
[Index]
770
771
[TOC]
772
 
773
774

FT_Outline_CubicToFunc

775
776
Defined in FT_IMAGE_H (freetype/ftimage.h).
777

778
779
 
780
  typedef int
781
  (*FT_Outline_CubicToFunc)( const FT_Vector*  control1,
782
                             const FT_Vector*  control2,
783
                             const FT_Vector*  to,
784
                             void*             user );
785
 
786
#define FT_Outline_CubicTo_Func  FT_Outline_CubicToFunc
787
 
788

789
790

A function pointer type used to describe the signature of a ‘cubic to’ function during outline walking or decomposition.

791

A ‘cubic to’ is emitted to indicate a third-order Bézier arc.

792

793
input
794

795
796
control1
797

A pointer to the first Bézier control point.

798
799
control2
800

A pointer to the second Bézier control point.

801
802
to
803

A pointer to the target end point.

804
805
user
806

A typeless pointer which is passed from the caller of the decomposition function.

807
808
809
810
return
811

Error code. 0 means success.

812
813
814

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

FT_Outline_Funcs

821
822
Defined in FT_IMAGE_H (freetype/ftimage.h).
823

824
825
 
826
  typedef struct  FT_Outline_Funcs_
827
  {
828
    FT_Outline_MoveToFunc   move_to;
829
    FT_Outline_LineToFunc   line_to;
830
    FT_Outline_ConicToFunc  conic_to;
831
    FT_Outline_CubicToFunc  cubic_to;
832
 
833
    int                     shift;
834
    FT_Pos                  delta;
835
 
836
  } FT_Outline_Funcs;
837
 
838

839
840

A structure to hold various function pointers used during outline decomposition in order to emit segments, conic, and cubic Béziers.

841

842
fields
843

844
845
move_to
846

The ‘move to’ emitter.

847
848
line_to
849

The segment emitter.

850
851
conic_to
852

The second-order Bézier arc emitter.

853
854
cubic_to
855

The third-order Bézier arc emitter.

856
857
shift
858

The shift that is applied to coordinates before they are sent to the emitter.

859
860
delta
861

The delta that is applied to coordinates before they are sent to the emitter, but after the shift.

862
863
864
865
note
866

The point coordinates sent to the emitters are the transformed version of the original coordinates (this is important for high accuracy during scan-conversion). The transformation is simple:

867
868
  x' = (x << shift) - delta
869
  y' = (x << shift) - delta
870
871

Set the values of ‘shift’ and ‘delta’ to 0 to get the original point coordinates.

872
873
874

875
[Index]
876
877
[TOC]
878
 
879
880

FT_Outline_Decompose

881
882
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
883

884
885
 
886
  FT_EXPORT( FT_Error )
887
  FT_Outline_Decompose( FT_Outline*              outline,
888
                        const FT_Outline_Funcs*  func_interface,
889
                        void*                    user );
890
 
891

892
893

Walk over an outline's structure to decompose it into individual segments and Bézier arcs. This function also emits ‘move to’ operations to indicate the start of new contours in the outline.

894

895
input
896

897
898
outline
899

A pointer to the source target.

900
901
func_interface
902

A table of ‘emitters’, i.e., function pointers called during decomposition to indicate path operations.

903
904
905
906
inout
907

908
909
user
910

A typeless pointer which is passed to each emitter during the decomposition. It can be used to store the state during the decomposition.

911
912
913
914
return
915

FreeType error code. 0 means success.

916
917
918

919
[Index]
920
921
[TOC]
922
 
923
924

FT_Outline_Get_CBox

925
926
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
927

928
929
 
930
  FT_EXPORT( void )
931
  FT_Outline_Get_CBox( const FT_Outline*  outline,
932
                       FT_BBox           *acbox );
933
 
934

935
936

Return an outline's ‘control box’. The control box encloses all the outline's points, including Bézier control points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some situations (like when rotating an outline which contains Bézier outside arcs).

937

Computing the control box is very fast, while getting the bounding box can take much more time as it needs to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component which is dedicated to this single task.

938

939
input
940

941
942
outline
943

A pointer to the source outline descriptor.

944
945
946
947
output
948

949
950
acbox
951

The outline's control box.

952
953
954
955
note
956

See FT_Glyph_Get_CBox for a discussion of tricky fonts.

957
958
959

960
[Index]
961
962
[TOC]
963
 
964
965

FT_Outline_Get_Bitmap

966
967
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
968

969
970
 
971
  FT_EXPORT( FT_Error )
972
  FT_Outline_Get_Bitmap( FT_Library        library,
973
                         FT_Outline*       outline,
974
                         const FT_Bitmap  *abitmap );
975
 
976

977
978

Render an outline within a bitmap. The outline's image is simply OR-ed to the target bitmap.

979

980
input
981

982
983
library
984

A handle to a FreeType library object.

985
986
outline
987

A pointer to the source outline descriptor.

988
989
990
991
inout
992

993
994
abitmap
995

A pointer to the target bitmap descriptor.

996
997
998
999
return
1000

FreeType error code. 0 means success.

1001
1002
note
1003

This function does NOT CREATE the bitmap, it only renders an outline image within the one you pass to it! Consequently, the various fields in ‘abitmap’ should be set accordingly.

1004

It will use the raster corresponding to the default glyph format.

1005

The value of the ‘num_grays’ field in ‘abitmap’ is ignored. If you select the gray-level rasterizer, and you want less than 256 gray levels, you have to use FT_Outline_Render directly.

1006
1007
1008

1009
[Index]
1010
1011
[TOC]
1012
 
1013
1014

FT_Outline_Render

1015
1016
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
1017

1018
1019
 
1020
  FT_EXPORT( FT_Error )
1021
  FT_Outline_Render( FT_Library         library,
1022
                     FT_Outline*        outline,
1023
                     FT_Raster_Params*  params );
1024
 
1025

1026
1027

Render an outline within a bitmap using the current scan-convert. This function uses an FT_Raster_Params structure as an argument, allowing advanced features like direct composition, translucency, etc.

1028

1029
input
1030

1031
1032
library
1033

A handle to a FreeType library object.

1034
1035
outline
1036

A pointer to the source outline descriptor.

1037
1038
1039
1040
inout
1041

1042
1043
params
1044

A pointer to an FT_Raster_Params structure used to describe the rendering operation.

1045
1046
1047
1048
return
1049

FreeType error code. 0 means success.

1050
1051
note
1052

You should know what you are doing and how FT_Raster_Params works to use this function.

1053

The field ‘params.source’ will be set to ‘outline’ before the scan converter is called, which means that the value you give to it is actually ignored.

1054

The gray-level rasterizer always uses 256 gray levels. If you want less gray levels, you have to provide your own span callback. See the FT_RASTER_FLAG_DIRECT value of the ‘flags’ field in the FT_Raster_Params structure for more details.

1055
1056
1057

1058
[Index]
1059
1060
[TOC]
1061
 
1062
1063

FT_Orientation

1064
1065
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
1066

1067
1068
 
1069
  typedef enum  FT_Orientation_
1070
  {
1071
    FT_ORIENTATION_TRUETYPE   = 0,
1072
    FT_ORIENTATION_POSTSCRIPT = 1,
1073
    FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
1074
    FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT,
1075
    FT_ORIENTATION_NONE
1076
 
1077
  } FT_Orientation;
1078
 
1079

1080
1081

A list of values used to describe an outline's contour orientation.

1082

The TrueType and PostScript specifications use different conventions to determine whether outline contours should be filled or unfilled.

1083

1084
values
1085

1086
1087
FT_ORIENTATION_TRUETYPE
1088
1089

According to the TrueType specification, clockwise contours must be filled, and counter-clockwise ones must be unfilled.

1090
1091
FT_ORIENTATION_POSTSCRIPT
1092
1093

According to the PostScript specification, counter-clockwise contours must be filled, and clockwise ones must be unfilled.

1094
1095
FT_ORIENTATION_FILL_RIGHT
1096
1097

This is identical to FT_ORIENTATION_TRUETYPE, but is used to remember that in TrueType, everything that is to the right of the drawing direction of a contour must be filled.

1098
1099
FT_ORIENTATION_FILL_LEFT
1100
1101

This is identical to FT_ORIENTATION_POSTSCRIPT, but is used to remember that in PostScript, everything that is to the left of the drawing direction of a contour must be filled.

1102
1103
FT_ORIENTATION_NONE
1104

The orientation cannot be determined. That is, different parts of the glyph have different orientation.

1105
1106
1107
1108
1109

1110
[Index]
1111
1112
[TOC]
1113
 
1114
1115

FT_Outline_Get_Orientation

1116
1117
Defined in FT_OUTLINE_H (freetype/ftoutln.h).
1118

1119
1120
 
1121
  FT_EXPORT( FT_Orientation )
1122
  FT_Outline_Get_Orientation( FT_Outline*  outline );
1123
 
1124

1125
1126

This function analyzes a glyph outline and tries to compute its fill orientation (see FT_Orientation). This is done by computing the direction of each global horizontal and/or vertical extrema within the outline.

1127

Note that this will return FT_ORIENTATION_TRUETYPE for empty outlines.

1128

1129
input
1130

1131
1132
outline
1133

A handle to the source outline.

1134
1135
1136
1137
return
1138

The orientation.

1139
1140
1141

1142
[Index]
1143
1144
[TOC]
1145
 
1146
1147