ReactOS 0.4.16-dev-1067-ge98bba2
psft.c File Reference
#include "psft.h"
#include "psfont.h"
#include "pserror.h"
#include "psobjs.h"
#include "cffdecode.h"
Include dependency graph for psft.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CF2_MAX_SIZE   cf2_intToFixed( 2000 ) /* max ppem */
 

Functions

static FT_Error cf2_checkTransform (const CF2_Matrix *transform, CF2_Int unitsPerEm)
 
static void cf2_setGlyphWidth (CF2_Outline outline, CF2_Fixed width)
 
static void cf2_free_instance (void *ptr)
 
static void cf2_builder_moveTo (CF2_OutlineCallbacks callbacks, const CF2_CallbackParams params)
 
static void cf2_builder_lineTo (CF2_OutlineCallbacks callbacks, const CF2_CallbackParams params)
 
static void cf2_builder_cubeTo (CF2_OutlineCallbacks callbacks, const CF2_CallbackParams params)
 
static void cf2_outline_init (CF2_Outline outline, FT_Memory memory, FT_Error *error)
 
static void cf2_getScaleAndHintFlag (PS_Decoder *decoder, CF2_Fixed *x_scale, CF2_Fixed *y_scale, FT_Bool *hinted, FT_Bool *scaled)
 
static FT_UShort cf2_getUnitsPerEm (PS_Decoder *decoder)
 
 cf2_decoder_parse_charstrings (PS_Decoder *decoder, FT_Byte *charstring_base, FT_ULong charstring_len)
 
 cf2_getSubfont (PS_Decoder *decoder)
 
 cf2_getVStore (PS_Decoder *decoder)
 
 cf2_getMaxstack (PS_Decoder *decoder)
 
 cf2_getPpemY (PS_Decoder *decoder)
 
 cf2_getStdVW (PS_Decoder *decoder)
 
 cf2_getStdHW (PS_Decoder *decoder)
 
 cf2_getBlueMetrics (PS_Decoder *decoder, CF2_Fixed *blueScale, CF2_Fixed *blueShift, CF2_Fixed *blueFuzz)
 
 cf2_getBlueValues (PS_Decoder *decoder, size_t *count, FT_Pos **data)
 
 cf2_getOtherBlues (PS_Decoder *decoder, size_t *count, FT_Pos **data)
 
 cf2_getFamilyBlues (PS_Decoder *decoder, size_t *count, FT_Pos **data)
 
 cf2_getFamilyOtherBlues (PS_Decoder *decoder, size_t *count, FT_Pos **data)
 
 cf2_getLanguageGroup (PS_Decoder *decoder)
 
 cf2_initGlobalRegionBuffer (PS_Decoder *decoder, CF2_Int subrNum, CF2_Buffer buf)
 
 cf2_getSeacComponent (PS_Decoder *decoder, CF2_Int code, CF2_Buffer buf)
 
 cf2_freeSeacComponent (PS_Decoder *decoder, CF2_Buffer buf)
 
 cf2_getT1SeacComponent (PS_Decoder *decoder, FT_UInt glyph_index, CF2_Buffer buf)
 
 cf2_freeT1SeacComponent (PS_Decoder *decoder, CF2_Buffer buf)
 
 cf2_initLocalRegionBuffer (PS_Decoder *decoder, CF2_Int subrNum, CF2_Buffer buf)
 
 cf2_getDefaultWidthX (PS_Decoder *decoder)
 
 cf2_getNominalWidthX (PS_Decoder *decoder)
 
 cf2_outline_reset (CF2_Outline outline)
 
 cf2_outline_close (CF2_Outline outline)
 

Macro Definition Documentation

◆ CF2_MAX_SIZE

#define CF2_MAX_SIZE   cf2_intToFixed( 2000 ) /* max ppem */

Definition at line 55 of file psft.c.

Function Documentation

◆ cf2_builder_cubeTo()

static void cf2_builder_cubeTo ( CF2_OutlineCallbacks  callbacks,
const CF2_CallbackParams  params 
)
static

Definition at line 197 of file psft.c.

199 {
201
202 /* downcast the object pointer */
204 PS_Builder* builder;
205
206
207 FT_ASSERT( outline && outline->decoder );
209
210 builder = &outline->decoder->builder;
211
212 if ( !builder->path_begun )
213 {
214 /* record the move before the line; also check points and set */
215 /* `path_begun' */
216 error = ps_builder_start_point( builder,
217 params->pt0.x,
218 params->pt0.y );
219 if ( error )
220 {
221 if ( !*callbacks->error )
222 *callbacks->error = error;
223 return;
224 }
225 }
226
227 /* prepare room for 3 points: 2 off-curve, 1 on-curve */
228 error = ps_builder_check_points( builder, 3 );
229 if ( error )
230 {
231 if ( !*callbacks->error )
232 *callbacks->error = error;
233 return;
234 }
235
236 ps_builder_add_point( builder,
237 params->pt1.x,
238 params->pt1.y, 0 );
239 ps_builder_add_point( builder,
240 params->pt2.x,
241 params->pt2.y, 0 );
242 ps_builder_add_point( builder,
243 params->pt3.x,
244 params->pt3.y, 1 );
245 }
#define FT_ASSERT(condition)
Definition: ftdebug.h:239
int FT_Error
Definition: fttypes.h:299
GLenum const GLfloat * params
Definition: glext.h:5645
#define error(str)
Definition: mkdosfs.c:1605
struct CF2_OutlineRec_ * CF2_Outline
@ CF2_PathOpCubeTo
Definition: psglue.h:70
ps_builder_add_point(PS_Builder *builder, FT_Pos x, FT_Pos y, FT_Byte flag)
Definition: psobjs.c:2217
ps_builder_start_point(PS_Builder *builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:2319
ps_builder_check_points(PS_Builder *builder, FT_Int count)
Definition: psobjs.c:2208
FT_Bool path_begun
Definition: psaux.h:580
Definition: mesh.c:5330
static int callbacks
Definition: xmllint.c:838

Referenced by cf2_outline_init().

◆ cf2_builder_lineTo()

static void cf2_builder_lineTo ( CF2_OutlineCallbacks  callbacks,
const CF2_CallbackParams  params 
)
static

Definition at line 153 of file psft.c.

155 {
157
158 /* downcast the object pointer */
160 PS_Builder* builder;
161
162
163 FT_ASSERT( outline && outline->decoder );
165
166 builder = &outline->decoder->builder;
167
168 if ( !builder->path_begun )
169 {
170 /* record the move before the line; also check points and set */
171 /* `path_begun' */
172 error = ps_builder_start_point( builder,
173 params->pt0.x,
174 params->pt0.y );
175 if ( error )
176 {
177 if ( !*callbacks->error )
178 *callbacks->error = error;
179 return;
180 }
181 }
182
183 /* `ps_builder_add_point1' includes a check_points call for one point */
184 error = ps_builder_add_point1( builder,
185 params->pt1.x,
186 params->pt1.y );
187 if ( error )
188 {
189 if ( !*callbacks->error )
190 *callbacks->error = error;
191 return;
192 }
193 }
@ CF2_PathOpLineTo
Definition: psglue.h:68
ps_builder_add_point1(PS_Builder *builder, FT_Pos x, FT_Pos y)
Definition: psobjs.c:2267

Referenced by cf2_outline_init().

◆ cf2_builder_moveTo()

static void cf2_builder_moveTo ( CF2_OutlineCallbacks  callbacks,
const CF2_CallbackParams  params 
)
static

Definition at line 131 of file psft.c.

133 {
134 /* downcast the object pointer */
136 PS_Builder* builder;
137
138 (void)params; /* only used in debug mode */
139
140
141 FT_ASSERT( outline && outline->decoder );
143
144 builder = &outline->decoder->builder;
145
146 /* note: two successive moves simply close the contour twice */
147 ps_builder_close_contour( builder );
148 builder->path_begun = 0;
149 }
@ CF2_PathOpMoveTo
Definition: psglue.h:67
ps_builder_close_contour(PS_Builder *builder)
Definition: psobjs.c:2341

Referenced by cf2_outline_init().

◆ cf2_checkTransform()

static FT_Error cf2_checkTransform ( const CF2_Matrix transform,
CF2_Int  unitsPerEm 
)
static

Definition at line 65 of file psft.c.

67 {
68 CF2_Fixed maxScale;
69
70
71 FT_ASSERT( unitsPerEm > 0 );
72
73 if ( transform->a <= 0 || transform->d <= 0 )
74 return FT_THROW( Invalid_Size_Handle );
75
76 FT_ASSERT( transform->b == 0 && transform->c == 0 );
77 FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
78
79 if ( unitsPerEm > 0x7FFF )
80 return FT_THROW( Glyph_Too_Big );
81
82 maxScale = FT_DivFix( CF2_MAX_SIZE, cf2_intToFixed( unitsPerEm ) );
83
84 if ( transform->a > maxScale || transform->d > maxScale )
85 return FT_THROW( Glyph_Too_Big );
86
87 return FT_Err_Ok;
88 }
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_THROW(e)
Definition: ftdebug.h:241
GLuint GLenum GLenum transform
Definition: glext.h:9407
#define cf2_intToFixed(i)
Definition: psfixed.h:60
#define CF2_Fixed
Definition: psfixed.h:48
#define CF2_MAX_SIZE
Definition: psft.c:55

Referenced by cf2_decoder_parse_charstrings().

◆ cf2_decoder_parse_charstrings()

cf2_decoder_parse_charstrings ( PS_Decoder decoder,
FT_Byte charstring_base,
FT_ULong  charstring_len 
)

Definition at line 308 of file psft.c.

311 {
315
316 FT_Bool is_t1 = decoder->builder.is_t1;
317
318
320 ( is_t1 || decoder->cff ) );
321
322 if ( is_t1 && !decoder->current_subfont )
323 {
324 FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): "
325 "SubFont missing. Use `t1_make_subfont' first\n" ));
326 return FT_THROW( Invalid_Table );
327 }
328
329 memory = decoder->builder.memory;
330
331 /* CF2 data is saved here across glyphs */
332 font = (CF2_Font)decoder->cf2_instance->data;
333
334 /* on first glyph, allocate instance structure */
335 if ( !decoder->cf2_instance->data )
336 {
337 decoder->cf2_instance->finalizer =
339
340 if ( FT_ALLOC( decoder->cf2_instance->data,
341 sizeof ( CF2_FontRec ) ) )
342 return FT_THROW( Out_Of_Memory );
343
344 font = (CF2_Font)decoder->cf2_instance->data;
345
346 font->memory = memory;
347
348 if ( !is_t1 )
349 font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload;
350
351 /* initialize a client outline, to be shared by each glyph rendered */
352 cf2_outline_init( &font->outline, font->memory, &font->error );
353 }
354
355 /* save decoder; it is a stack variable and will be different on each */
356 /* call */
357 font->decoder = decoder;
358 font->outline.decoder = decoder;
359
360 {
361 /* build parameters for Adobe engine */
362
363 PS_Builder* builder = &decoder->builder;
365
366 FT_Bool no_stem_darkening_driver =
367 driver->no_stem_darkening;
368 FT_Char no_stem_darkening_font =
370
371 /* local error */
375 CF2_F16Dot16 glyphWidth;
376
377 FT_Bool hinted;
378 FT_Bool scaled;
379
380
381 /* FreeType has already looked up the GID; convert to */
382 /* `RegionBuffer', assuming that the input has been validated */
383 FT_ASSERT( charstring_base + charstring_len >= charstring_base );
384
385 FT_ZERO( &buf );
386 buf.start =
387 buf.ptr = charstring_base;
388 buf.end = charstring_base + charstring_len;
389
390 FT_ZERO( &transform );
391
393 &transform.a,
394 &transform.d,
395 &hinted,
396 &scaled );
397
398 if ( is_t1 )
399 font->isCFF2 = FALSE;
400 else
401 {
402 /* copy isCFF2 boolean from TT_Face to CF2_Font */
403 font->isCFF2 = ((TT_Face)builder->face)->is_cff2;
404 }
405 font->isT1 = is_t1;
406
407 font->renderingFlags = 0;
408 if ( hinted )
409 font->renderingFlags |= CF2_FlagsHinted;
410 if ( scaled && ( !no_stem_darkening_font ||
411 ( no_stem_darkening_font < 0 &&
412 !no_stem_darkening_driver ) ) )
413 font->renderingFlags |= CF2_FlagsDarkened;
414
415 font->darkenParams[0] = driver->darken_params[0];
416 font->darkenParams[1] = driver->darken_params[1];
417 font->darkenParams[2] = driver->darken_params[2];
418 font->darkenParams[3] = driver->darken_params[3];
419 font->darkenParams[4] = driver->darken_params[4];
420 font->darkenParams[5] = driver->darken_params[5];
421 font->darkenParams[6] = driver->darken_params[6];
422 font->darkenParams[7] = driver->darken_params[7];
423
424 /* now get an outline for this glyph; */
425 /* also get units per em to validate scale */
426 font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
427
428 if ( scaled )
429 {
430 error2 = cf2_checkTransform( &transform, font->unitsPerEm );
431 if ( error2 )
432 return error2;
433 }
434
435 error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
436 if ( error2 )
437 return FT_ERR( Invalid_File_Format );
438
439 cf2_setGlyphWidth( &font->outline, glyphWidth );
440
441 return FT_Err_Ok;
442 }
443 }
#define FALSE
Definition: types.h:117
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:302
#define FT_ZERO(p)
Definition: ftmemory.h:237
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:603
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
signed char FT_Char
Definition: fttypes.h:143
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_ERR(e)
Definition: fttypes.h:599
void(* FT_Generic_Finalizer)(void *object)
Definition: fttypes.h:435
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CF2_Int
Definition: pstypes.h:65
FT_Int32 CF2_F16Dot16
Definition: pstypes.h:69
if(dx< 0)
Definition: linetemp.h:194
static char memory[1024 *256]
Definition: process.c:116
struct @1717::@1718 driver
Definition: mk_font.cpp:20
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver
cf2_getGlyphOutline(CF2_Font font, CF2_Buffer charstring, const CF2_Matrix *transform, CF2_F16Dot16 *glyphWidth)
Definition: psfont.c:487
static FT_UShort cf2_getUnitsPerEm(PS_Decoder *decoder)
Definition: psft.c:297
static void cf2_free_instance(void *ptr)
Definition: psft.c:107
static void cf2_setGlyphWidth(CF2_Outline outline, CF2_Fixed width)
Definition: psft.c:92
static void cf2_outline_init(CF2_Outline outline, FT_Memory memory, FT_Error *error)
Definition: psft.c:249
static void cf2_getScaleAndHintFlag(PS_Decoder *decoder, CF2_Fixed *x_scale, CF2_Fixed *y_scale, FT_Bool *hinted, FT_Bool *scaled)
Definition: psft.c:266
static FT_Error cf2_checkTransform(const CF2_Matrix *transform, CF2_Int unitsPerEm)
Definition: psft.c:65
#define CF2_FlagsDarkened
Definition: psglue.h:58
#define CF2_FlagsHinted
Definition: psglue.h:56
struct CF2_FontRec_ * CF2_Font
Definition: psglue.h:90
FT_BEGIN_HEADER struct CF2_BufferRec_ CF2_BufferRec
#define error2(s, a, b)
Definition: debug.h:126
FT_Face_Internal internal
Definition: freetype.h:1093
FT_Char no_stem_darkening
Definition: ftobjs.h:371
FT_Face face
Definition: psaux.h:567
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:1064
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ cf2_free_instance()

static void cf2_free_instance ( void ptr)
static

Definition at line 107 of file psft.c.

108 {
110
111
112 if ( font )
113 {
114 FT_Memory memory = font->memory;
115
116
117 FT_FREE( font->blend.lastNDV );
118 FT_FREE( font->blend.BV );
119 }
120 }
#define FT_FREE(ptr)
Definition: ftmemory.h:328
static PVOID ptr
Definition: dispmode.c:27

Referenced by cf2_decoder_parse_charstrings().

◆ cf2_freeSeacComponent()

cf2_freeSeacComponent ( PS_Decoder decoder,
CF2_Buffer  buf 
)

Definition at line 708 of file psft.c.

710 {
712 FT_ASSERT( !decoder->builder.is_t1 );
713
714 decoder->free_glyph_callback( (TT_Face)decoder->builder.face,
715 (FT_Byte**)&buf->start,
716 (FT_ULong)( buf->end - buf->start ) );
717 }
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154

Referenced by cf2_interpT2CharString().

◆ cf2_freeT1SeacComponent()

cf2_freeT1SeacComponent ( PS_Decoder decoder,
CF2_Buffer  buf 
)

Definition at line 767 of file psft.c.

769 {
770#ifdef FT_CONFIG_OPTION_INCREMENTAL
771
774
775
777
778 face = (T1_Face)decoder->builder.face;
779
780 data.pointer = buf->start;
781 data.length = (FT_Int)( buf->end - buf->start );
782
783 if ( face->root.internal->incremental_interface )
784 face->root.internal->incremental_interface->funcs->free_glyph_data(
785 face->root.internal->incremental_interface->object,
786 &data );
787
788#else /* !FT_CONFIG_OPTION_INCREMENTAL */
789
791 FT_UNUSED( buf );
792
793#endif /* !FT_CONFIG_OPTION_INCREMENTAL */
794 }
WORD face[3]
Definition: mesh.c:4747
#define FT_UNUSED(arg)
Definition: ftconfig.h:100
signed int FT_Int
Definition: fttypes.h:220
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:199

Referenced by cf2_interpT2CharString().

◆ cf2_getBlueMetrics()

cf2_getBlueMetrics ( PS_Decoder decoder,
CF2_Fixed blueScale,
CF2_Fixed blueShift,
CF2_Fixed blueFuzz 
)

Definition at line 549 of file psft.c.

553 {
554 FT_ASSERT( decoder && decoder->current_subfont );
555
556 *blueScale = FT_DivFix(
557 decoder->current_subfont->private_dict.blue_scale,
558 cf2_intToFixed( 1000 ) );
559 *blueShift = cf2_intToFixed(
560 decoder->current_subfont->private_dict.blue_shift );
561 *blueFuzz = cf2_intToFixed(
562 decoder->current_subfont->private_dict.blue_fuzz );
563 }

Referenced by cf2_blues_init().

◆ cf2_getBlueValues()

cf2_getBlueValues ( PS_Decoder decoder,
size_t count,
FT_Pos **  data 
)

Definition at line 569 of file psft.c.

572 {
573 FT_ASSERT( decoder && decoder->current_subfont );
574
575 *count = decoder->current_subfont->private_dict.num_blue_values;
576 *data = (FT_Pos*)
577 &decoder->current_subfont->private_dict.blue_values;
578 }
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by cf2_blues_init().

◆ cf2_getDefaultWidthX()

cf2_getDefaultWidthX ( PS_Decoder decoder)

Definition at line 850 of file psft.c.

851 {
852 FT_ASSERT( decoder && decoder->current_subfont );
853
854 return cf2_intToFixed(
855 decoder->current_subfont->private_dict.default_width );
856 }

Referenced by cf2_interpT2CharString().

◆ cf2_getFamilyBlues()

cf2_getFamilyBlues ( PS_Decoder decoder,
size_t count,
FT_Pos **  data 
)

Definition at line 595 of file psft.c.

598 {
599 FT_ASSERT( decoder && decoder->current_subfont );
600
601 *count = decoder->current_subfont->private_dict.num_family_blues;
602 *data = (FT_Pos*)
603 &decoder->current_subfont->private_dict.family_blues;
604 }

Referenced by cf2_blues_init().

◆ cf2_getFamilyOtherBlues()

cf2_getFamilyOtherBlues ( PS_Decoder decoder,
size_t count,
FT_Pos **  data 
)

Definition at line 608 of file psft.c.

611 {
612 FT_ASSERT( decoder && decoder->current_subfont );
613
614 *count = decoder->current_subfont->private_dict.num_family_other_blues;
615 *data = (FT_Pos*)
616 &decoder->current_subfont->private_dict.family_other_blues;
617 }

Referenced by cf2_blues_init().

◆ cf2_getLanguageGroup()

cf2_getLanguageGroup ( PS_Decoder decoder)

Definition at line 621 of file psft.c.

622 {
623 FT_ASSERT( decoder && decoder->current_subfont );
624
625 return decoder->current_subfont->private_dict.language_group;
626 }

Referenced by cf2_blues_init().

◆ cf2_getMaxstack()

cf2_getMaxstack ( PS_Decoder decoder)

Definition at line 468 of file psft.c.

469 {
470 FT_ASSERT( decoder && decoder->cff );
471
472 return decoder->cff->top_font.font_dict.maxstack;
473 }

Referenced by cf2_interpT2CharString().

◆ cf2_getNominalWidthX()

cf2_getNominalWidthX ( PS_Decoder decoder)

Definition at line 860 of file psft.c.

861 {
862 FT_ASSERT( decoder && decoder->current_subfont );
863
864 return cf2_intToFixed(
865 decoder->current_subfont->private_dict.nominal_width );
866 }

Referenced by cf2_doStems(), and cf2_interpT2CharString().

◆ cf2_getOtherBlues()

cf2_getOtherBlues ( PS_Decoder decoder,
size_t count,
FT_Pos **  data 
)

Definition at line 582 of file psft.c.

585 {
586 FT_ASSERT( decoder && decoder->current_subfont );
587
588 *count = decoder->current_subfont->private_dict.num_other_blues;
589 *data = (FT_Pos*)
590 &decoder->current_subfont->private_dict.other_blues;
591 }

Referenced by cf2_blues_init().

◆ cf2_getPpemY()

cf2_getPpemY ( PS_Decoder decoder)

Definition at line 504 of file psft.c.

505 {
507 decoder->builder.face &&
508 decoder->builder.face->size );
509
510 /*
511 * Note that `y_ppem' can be zero if there wasn't a call to
512 * `FT_Set_Char_Size' or something similar. However, this isn't a
513 * problem since we come to this place in the code only if
514 * FT_LOAD_NO_SCALE is set (the other case gets caught by
515 * `cf2_checkTransform'). The ppem value is needed to compute the stem
516 * darkening, which is disabled for getting the unscaled outline.
517 *
518 */
519 return cf2_intToFixed(
520 decoder->builder.face->size->metrics.y_ppem );
521 }

Referenced by cf2_font_setup().

◆ cf2_getScaleAndHintFlag()

static void cf2_getScaleAndHintFlag ( PS_Decoder decoder,
CF2_Fixed x_scale,
CF2_Fixed y_scale,
FT_Bool hinted,
FT_Bool scaled 
)
static

Definition at line 266 of file psft.c.

271 {
272 FT_ASSERT( decoder && decoder->builder.glyph );
273
274 /* note: FreeType scale includes a factor of 64 */
275 *hinted = decoder->builder.glyph->hint;
276 *scaled = decoder->builder.glyph->scaled;
277
278 if ( *hinted )
279 {
280 *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64;
281 *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64;
282 }
283 else
284 {
285 /* for unhinted outlines, `cff_slot_load' does the scaling, */
286 /* thus render at `unity' scale */
287
288 *x_scale = 0x0400; /* 1/64 as 16.16 */
289 *y_scale = 0x0400;
290 }
291 }
#define ADD_INT32(a, b)
Definition: ftcalc.h:482

Referenced by cf2_decoder_parse_charstrings().

◆ cf2_getSeacComponent()

cf2_getSeacComponent ( PS_Decoder decoder,
CF2_Int  code,
CF2_Buffer  buf 
)

Definition at line 660 of file psft.c.

663 {
664 CF2_Int gid;
665 FT_Byte* charstring;
668
669
671 FT_ASSERT( !decoder->builder.is_t1 );
672
673 FT_ZERO( buf );
674
675#ifdef FT_CONFIG_OPTION_INCREMENTAL
676 /* Incremental fonts don't necessarily have valid charsets. */
677 /* They use the character code, not the glyph index, in this case. */
678 if ( decoder->builder.face->internal->incremental_interface )
679 gid = code;
680 else
681#endif /* FT_CONFIG_OPTION_INCREMENTAL */
682 {
684 if ( gid < 0 )
685 return FT_THROW( Invalid_Glyph_Format );
686 }
687
688 error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face,
689 (CF2_UInt)gid,
690 &charstring,
691 &len );
692 /* TODO: for now, just pass the FreeType error through */
693 if ( error )
694 return error;
695
696 /* assume input has been validated */
697 FT_ASSERT( charstring + len >= charstring );
698
699 buf->start = charstring;
700 buf->end = charstring + len;
701 buf->ptr = buf->start;
702
703 return FT_Err_Ok;
704 }
cff_lookup_glyph_by_stdcharcode(CFF_Font cff, FT_Int charcode)
Definition: cffdecode.c:422
GLenum GLsizei len
Definition: glext.h:6722
#define CF2_UInt
Definition: pstypes.h:64
Definition: inflate.c:139

Referenced by cf2_interpT2CharString().

◆ cf2_getStdHW()

cf2_getStdHW ( PS_Decoder decoder)

Definition at line 538 of file psft.c.

539 {
540 FT_ASSERT( decoder && decoder->current_subfont );
541
542 return cf2_intToFixed(
543 decoder->current_subfont->private_dict.standard_width );
544 }

Referenced by cf2_font_setup().

◆ cf2_getStdVW()

cf2_getStdVW ( PS_Decoder decoder)

Definition at line 528 of file psft.c.

529 {
530 FT_ASSERT( decoder && decoder->current_subfont );
531
532 return cf2_intToFixed(
533 decoder->current_subfont->private_dict.standard_height );
534 }

Referenced by cf2_font_setup().

◆ cf2_getSubfont()

cf2_getSubfont ( PS_Decoder decoder)

Definition at line 448 of file psft.c.

449 {
450 FT_ASSERT( decoder && decoder->current_subfont );
451
452 return decoder->current_subfont;
453 }

Referenced by cf2_font_setup().

◆ cf2_getT1SeacComponent()

cf2_getT1SeacComponent ( PS_Decoder decoder,
FT_UInt  glyph_index,
CF2_Buffer  buf 
)

Definition at line 721 of file psft.c.

724 {
725 FT_Data glyph_data;
727 T1_Face face = (T1_Face)decoder->builder.face;
728 T1_Font type1 = &face->type1;
729
732 face->root.internal->incremental_interface;
733
734
735 /* For incremental fonts get the character data using the */
736 /* callback function. */
737 if ( inc )
738 error = inc->funcs->get_glyph_data( inc->object,
739 glyph_index, &glyph_data );
740 else
741#endif
742 /* For ordinary fonts get the character data stored in the face record. */
743 {
744 glyph_data.pointer = type1->charstrings[glyph_index];
745 glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index];
746 }
747
748 if ( !error )
749 {
750 FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer;
751 FT_ULong charstring_len = (FT_ULong)glyph_data.length;
752
753
754 FT_ASSERT( charstring_base + charstring_len >= charstring_base );
755
756 FT_ZERO( buf );
757 buf->start =
758 buf->ptr = charstring_base;
759 buf->end = charstring_base + charstring_len;
760 }
761
762 return error;
763 }
#define FT_CONFIG_OPTION_INCREMENTAL
Definition: ftoption.h:385
const FT_Byte * pointer
Definition: fttypes.h:415
FT_Int length
Definition: fttypes.h:416

Referenced by cf2_interpT2CharString().

◆ cf2_getUnitsPerEm()

static FT_UShort cf2_getUnitsPerEm ( PS_Decoder decoder)
static

Definition at line 297 of file psft.c.

298 {
299 FT_ASSERT( decoder && decoder->builder.face );
300 FT_ASSERT( decoder->builder.face->units_per_EM );
301
302 return decoder->builder.face->units_per_EM;
303 }

Referenced by cf2_decoder_parse_charstrings().

◆ cf2_getVStore()

cf2_getVStore ( PS_Decoder decoder)

Definition at line 458 of file psft.c.

459 {
460 FT_ASSERT( decoder && decoder->cff );
461
462 return &decoder->cff->vstore;
463 }

Referenced by cf2_font_setup().

◆ cf2_initGlobalRegionBuffer()

cf2_initGlobalRegionBuffer ( PS_Decoder decoder,
CF2_Int  subrNum,
CF2_Buffer  buf 
)

Definition at line 632 of file psft.c.

635 {
637
638
640
641 FT_ZERO( buf );
642
643 idx = (CF2_UInt)( subrNum + decoder->globals_bias );
644 if ( idx >= decoder->num_globals )
645 return TRUE; /* error */
646
647 FT_ASSERT( decoder->globals );
648
649 buf->start =
650 buf->ptr = decoder->globals[idx];
651 buf->end = decoder->globals[idx + 1];
652
653 return FALSE; /* success */
654 }
#define TRUE
Definition: types.h:120
unsigned int idx
Definition: utils.c:41

Referenced by cf2_interpT2CharString().

◆ cf2_initLocalRegionBuffer()

cf2_initLocalRegionBuffer ( PS_Decoder decoder,
CF2_Int  subrNum,
CF2_Buffer  buf 
)

Definition at line 798 of file psft.c.

801 {
803
804
806
807 FT_ZERO( buf );
808
809 idx = (CF2_UInt)( subrNum + decoder->locals_bias );
810 if ( idx >= decoder->num_locals )
811 return TRUE; /* error */
812
813 FT_ASSERT( decoder->locals );
814
815 buf->start = decoder->locals[idx];
816
817 if ( decoder->builder.is_t1 )
818 {
819 /* The Type 1 driver stores subroutines without the seed bytes. */
820 /* The CID driver stores subroutines with seed bytes. This */
821 /* case is taken care of when decoder->subrs_len == 0. */
822 if ( decoder->locals_len )
823 buf->end = buf->start + decoder->locals_len[idx];
824 else
825 {
826 /* We are using subroutines from a CID font. We must adjust */
827 /* for the seed bytes. */
828 buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
829 buf->end = decoder->locals[idx + 1];
830 }
831
832 if ( !buf->start )
833 {
834 FT_ERROR(( "cf2_initLocalRegionBuffer (Type 1 mode):"
835 " invoking empty subrs\n" ));
836 }
837 }
838 else
839 {
840 buf->end = decoder->locals[idx + 1];
841 }
842
843 buf->ptr = buf->start;
844
845 return FALSE; /* success */
846 }

Referenced by cf2_interpT2CharString().

◆ cf2_outline_close()

cf2_outline_close ( CF2_Outline  outline)

Definition at line 884 of file psft.c.

885 {
886 PS_Decoder* decoder = outline->decoder;
887
888
890
892
893 FT_GlyphLoader_Add( decoder->builder.loader );
894 }
FT_GlyphLoader_Add(FT_GlyphLoader loader)
Definition: ftgloadr.c:328

Referenced by cf2_getGlyphOutline().

◆ cf2_outline_init()

static void cf2_outline_init ( CF2_Outline  outline,
FT_Memory  memory,
FT_Error error 
)
static

Definition at line 249 of file psft.c.

252 {
253 FT_ZERO( outline );
254
255 outline->root.memory = memory;
256 outline->root.error = error;
257
258 outline->root.moveTo = cf2_builder_moveTo;
259 outline->root.lineTo = cf2_builder_lineTo;
260 outline->root.cubeTo = cf2_builder_cubeTo;
261 }
static void cf2_builder_cubeTo(CF2_OutlineCallbacks callbacks, const CF2_CallbackParams params)
Definition: psft.c:197
static void cf2_builder_moveTo(CF2_OutlineCallbacks callbacks, const CF2_CallbackParams params)
Definition: psft.c:131
static void cf2_builder_lineTo(CF2_OutlineCallbacks callbacks, const CF2_CallbackParams params)
Definition: psft.c:153

Referenced by cf2_decoder_parse_charstrings().

◆ cf2_outline_reset()

cf2_outline_reset ( CF2_Outline  outline)

Definition at line 870 of file psft.c.

871 {
872 PS_Decoder* decoder = outline->decoder;
873
874
876
877 outline->root.windingMomentum = 0;
878
879 FT_GlyphLoader_Rewind( decoder->builder.loader );
880 }
FT_GlyphLoader_Rewind(FT_GlyphLoader loader)
Definition: ftgloadr.c:88

Referenced by cf2_getGlyphOutline().

◆ cf2_setGlyphWidth()

static void cf2_setGlyphWidth ( CF2_Outline  outline,
CF2_Fixed  width 
)
static

Definition at line 92 of file psft.c.

94 {
95 PS_Decoder* decoder = outline->decoder;
96
97
99
100 if ( !decoder->builder.is_t1 )
101 *decoder->glyph_width = cf2_fixedToInt( width );
102 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define cf2_fixedToInt(x)
Definition: psfixed.h:62

Referenced by cf2_decoder_parse_charstrings().