368 FT_Char no_stem_darkening_font =
369 builder->face->internal->no_stem_darkening;
370
371 /* local error */
372 FT_Error error2 = FT_Err_Ok;
373 CF2_BufferRec buf;
374 CF2_Matrix transform;
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
392 cf2_getScaleAndHintFlag( decoder,
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 )
680 else
681 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
682 {
683 gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );
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 }
705
706
707 FT_LOCAL_DEF( void )
708 cf2_freeSeacComponent( PS_Decoder* decoder,
709 CF2_Buffer buf )
710 {
711 FT_ASSERT( decoder );
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 }
718
719
720 FT_LOCAL_DEF( FT_Error )
803
804
805 FT_ASSERT( decoder );
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;
|
368 FT_Char no_stem_darkening_font =
369 builder->face->internal->no_stem_darkening;
370
371 /* local error */
372 FT_Error error2 = FT_Err_Ok;
373 CF2_BufferRec buf;
374 CF2_Matrix transform;
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 = FT_OFFSET( charstring_base, charstring_len );
389
390 FT_ZERO( &transform );
391
392 cf2_getScaleAndHintFlag( decoder,
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 )
680 else
681 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
682 {
683 gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );
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 = FT_OFFSET( charstring, len );
701 buf->ptr = buf->start;
702
703 return FT_Err_Ok;
704 }
705
706
707 FT_LOCAL_DEF( void )
708 cf2_freeSeacComponent( PS_Decoder* decoder,
709 CF2_Buffer buf )
710 {
711 FT_ASSERT( decoder );
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 }
718
719
720 FT_LOCAL_DEF( FT_Error )
803
804
805 FT_ASSERT( decoder );
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 = FT_OFFSET( 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;
|