本文整理汇总了C++中FT_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_ASSERT函数的具体用法?C++ FT_ASSERT怎么用?C++ FT_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cf2_getStdHW
cf2_getStdHW( CFF_Decoder* decoder )
{
FT_ASSERT( decoder && decoder->current_subfont );
return cf2_intToFixed(
decoder->current_subfont->private_dict.standard_width );
}
示例2: cf2_getScaleAndHintFlag
/* get scaling and hint flag from GlyphSlot */
static void
cf2_getScaleAndHintFlag( CFF_Decoder* decoder,
CF2_Fixed* x_scale,
CF2_Fixed* y_scale,
FT_Bool* hinted,
FT_Bool* scaled )
{
FT_ASSERT( decoder && decoder->builder.glyph );
/* note: FreeType scale includes a factor of 64 */
*hinted = decoder->builder.glyph->hint;
*scaled = decoder->builder.glyph->scaled;
if ( *hinted )
{
*x_scale = FT_DivFix( decoder->builder.glyph->x_scale,
cf2_intToFixed( 64 ) );
*y_scale = FT_DivFix( decoder->builder.glyph->y_scale,
cf2_intToFixed( 64 ) );
}
else
{
/* for unhinted outlines, `cff_slot_load' does the scaling, */
/* thus render at `unity' scale */
*x_scale = 0x0400; /* 1/64 as 16.16 */
*y_scale = 0x0400;
}
}
示例3: _ft_keydetector_safa_init
static int32_t _ft_keydetector_safa_init(struct ft_electrode_data *electrode)
{
FT_ASSERT(electrode->rom->keydetector_interface == &ft_keydetector_safa_interface);
const struct ft_keydetector_safa *rom = electrode->rom->keydetector_params.safa;
if(_ft_keydetector_safa_rom_check(rom) != FT_SUCCESS)
{
return FT_FAILURE;
}
electrode->keydetector_data.safa = (struct ft_keydetector_safa_data *) _ft_mem_alloc(sizeof(struct ft_keydetector_safa_data));
if(electrode->keydetector_data.safa == NULL)
{
return FT_OUT_OF_MEMORY;
}
electrode->keydetector_data.safa->recovery_cnt = 0;
electrode->keydetector_data.safa->base_avrg_init = rom->base_avrg;
electrode->keydetector_data.safa->noise_avrg_init = rom->base_avrg;
electrode->keydetector_data.safa->noise_avrg_init.n2_order += 2;
electrode->keydetector_data.safa->predicted_signal_avrg_init = rom->base_avrg;
if(electrode->keydetector_data.safa->predicted_signal_avrg_init.n2_order > 2)
electrode->keydetector_data.safa->predicted_signal_avrg_init.n2_order -= 2;
_ft_electrode_set_status(electrode, FT_ELECTRODE_STATE_INIT);
return FT_SUCCESS;
}
示例4: T1_Face_Done
T1_Face_Done( T1_Face face )
{
FT_Memory memory;
T1_Font type1;
if ( !face )
return;
memory = face->root.memory;
type1 = &face->type1;
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
/* release multiple masters information */
FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
if ( face->buildchar )
{
FT_FREE( face->buildchar );
face->buildchar = NULL;
face->len_buildchar = 0;
}
T1_Done_Blend( face );
face->blend = 0;
#endif
/* release font info strings */
{
PS_FontInfo info = &type1->font_info;
FT_FREE( info->version );
FT_FREE( info->notice );
FT_FREE( info->full_name );
FT_FREE( info->family_name );
FT_FREE( info->weight );
}
/* release top dictionary */
FT_FREE( type1->charstrings_len );
FT_FREE( type1->charstrings );
FT_FREE( type1->glyph_names );
FT_FREE( type1->subrs );
FT_FREE( type1->subrs_len );
FT_FREE( type1->subrs_block );
FT_FREE( type1->charstrings_block );
FT_FREE( type1->glyph_names_block );
FT_FREE( type1->encoding.char_index );
FT_FREE( type1->encoding.char_name );
FT_FREE( type1->font_name );
#ifndef T1_CONFIG_OPTION_NO_AFM
/* release afm data if present */
if ( face->afm_data )
示例5: t1_cmap_custom_init
t1_cmap_custom_init( T1_CMapCustom cmap,
FT_Pointer init_data )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Encoding encoding = &face->type1.encoding;
FT_UNUSED( init_data );
cmap->first = encoding->code_first;
cmap->count = (FT_UInt)( encoding->code_last - cmap->first );
cmap->indices = encoding->char_index;
FT_ASSERT( cmap->indices != NULL );
FT_ASSERT( encoding->code_first <= encoding->code_last );
return 0;
}
示例6: FT_Stream_EnterFrame
FT_Stream_EnterFrame( FT_Stream stream,
FT_ULong count )
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
/* check for nested frame access */
FT_ASSERT( stream && stream->cursor == 0 );
if ( stream->read )
{
/* allocate the frame in memory */
FT_Memory memory = stream->memory;
if ( FT_QALLOC( stream->base, count ) )
goto Exit;
/* read it */
read_bytes = stream->read( stream, stream->pos,
stream->base, count );
if ( read_bytes < count )
{
FT_ERROR(( "FT_Stream_EnterFrame:" ));
FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
count, read_bytes ));
FT_FREE( stream->base );
error = FT_Err_Invalid_Stream_Operation;
}
stream->cursor = stream->base;
stream->limit = stream->cursor + count;
stream->pos += read_bytes;
}
else
{
/* check current and new position */
if ( stream->pos >= stream->size ||
stream->pos + count > stream->size )
{
FT_ERROR(( "FT_Stream_EnterFrame:" ));
FT_ERROR(( " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
stream->pos, count, stream->size ));
error = FT_Err_Invalid_Stream_Operation;
goto Exit;
}
/* set cursor */
stream->cursor = stream->base + stream->pos;
stream->limit = stream->cursor + count;
stream->pos += count;
}
Exit:
return error;
}
示例7: cf2_freeSeacComponent
cf2_freeSeacComponent( CFF_Decoder* decoder,
CF2_Buffer buf )
{
FT_ASSERT( decoder );
cff_free_glyph_data( decoder->builder.face,
(FT_Byte**)&buf->start,
(FT_ULong)( buf->end - buf->start ) );
}
示例8: T1_Compute_Max_Advance
T1_Compute_Max_Advance( T1_Face face,
FT_Pos* max_advance )
{
FT_Error error;
T1_DecoderRec decoder;
FT_Int glyph_index;
T1_Font type1 = &face->type1;
PSAux_Service psaux = (PSAux_Service)face->psaux;
FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
*max_advance = 0;
/* initialize load decoder */
error = psaux->t1_decoder_funcs->init( &decoder,
(FT_Face)face,
0, /* size */
0, /* glyph slot */
(FT_Byte**)type1->glyph_names,
face->blend,
0,
FT_RENDER_MODE_NORMAL,
T1_Parse_Glyph );
if ( error )
return error;
decoder.builder.metrics_only = 1;
decoder.builder.load_points = 0;
decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs;
decoder.subrs_len = type1->subrs_len;
decoder.subrs_hash = type1->subrs_hash;
decoder.buildchar = face->buildchar;
decoder.len_buildchar = face->len_buildchar;
*max_advance = 0;
/* for each glyph, parse the glyph charstring and extract */
/* the advance width */
for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )
{
/* now get load the unscaled outline */
(void)T1_Parse_Glyph( &decoder, (FT_UInt)glyph_index );
if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
*max_advance = decoder.builder.advance.x;
/* ignore the error if one occurred - skip to next glyph */
}
psaux->t1_decoder_funcs->done( &decoder );
return FT_Err_Ok;
}
示例9: _ft_control_slider_init
static int32_t _ft_control_slider_init(struct ft_control_data *control)
{
FT_ASSERT(control != NULL);
FT_ASSERT(control->rom->interface == &ft_control_slider_interface);
control->data.slider = _ft_mem_alloc(sizeof(struct ft_control_slider_data));
if(control->data.slider == NULL)
{
return FT_OUT_OF_MEMORY;
}
if (_ft_control_check_data(control) != FT_SUCCESS)
{
return FT_FAILURE;
}
return FT_SUCCESS;
}
示例10: cf2_getBlueValues
cf2_getBlueValues( CFF_Decoder* decoder,
size_t* count,
FT_Pos* *data )
{
FT_ASSERT( decoder && decoder->current_subfont );
*count = decoder->current_subfont->private_dict.num_blue_values;
*data = (FT_Pos*)
&decoder->current_subfont->private_dict.blue_values;
}
示例11: cf2_getFamilyOtherBlues
cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
size_t* count,
FT_Pos* *data )
{
FT_ASSERT( decoder && decoder->current_subfont );
*count = decoder->current_subfont->private_dict.num_family_other_blues;
*data = (FT_Pos*)
&decoder->current_subfont->private_dict.family_other_blues;
}
示例12: cf2_arrstack_setNumElements
/* return false on memory error */
static FT_Bool
cf2_arrstack_setNumElements( CF2_ArrStack arrstack,
size_t numElements )
{
FT_ASSERT( arrstack != NULL );
{
FT_Error error = FT_Err_Ok; /* for FT_REALLOC */
FT_Memory memory = arrstack->memory; /* for FT_REALLOC */
FT_Long newSize = numElements * arrstack->sizeItem;
if ( numElements > LONG_MAX / arrstack->sizeItem )
goto exit;
FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */
if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
{
arrstack->allocated = numElements;
arrstack->totalSize = newSize;
if ( arrstack->count > numElements )
{
/* we truncated the list! */
CF2_SET_ERROR( arrstack->error, Stack_Overflow );
arrstack->count = numElements;
return FALSE;
}
return TRUE; /* success */
}
}
exit:
/* if there's not already an error, store this one */
CF2_SET_ERROR( arrstack->error, Out_Of_Memory );
return FALSE;
}
示例13: cf2_setGlyphWidth
static void
cf2_setGlyphWidth( CF2_Outline outline,
CF2_Fixed width )
{
CFF_Decoder* decoder = outline->decoder;
FT_ASSERT( decoder );
decoder->glyph_width = cf2_fixedToInt( width );
}
示例14: cf2_initLocalRegionBuffer
cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
CF2_UInt idx,
CF2_Buffer buf )
{
FT_ASSERT( decoder );
FT_ZERO( buf );
idx += decoder->locals_bias;
if ( idx >= decoder->num_locals )
return TRUE; /* error */
FT_ASSERT( decoder->locals );
buf->start =
buf->ptr = decoder->locals[idx];
buf->end = decoder->locals[idx + 1];
return FALSE; /* success */
}
示例15: cf2_outline_close
cf2_outline_close( CF2_Outline outline )
{
CFF_Decoder* decoder = outline->decoder;
FT_ASSERT( decoder );
cff_builder_close_contour( &decoder->builder );
FT_GlyphLoader_Add( decoder->builder.loader );
}