本文整理汇总了C++中PSAux_Service类的典型用法代码示例。如果您正苦于以下问题:C++ PSAux_Service类的具体用法?C++ PSAux_Service怎么用?C++ PSAux_Service使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PSAux_Service类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: T1_Parse_Glyph_And_Get_Char_String
static FT_Error
T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
FT_UInt glyph_index,
FT_Data* char_string,
FT_Bool* force_scaling )
{
T1_Face face = (T1_Face)decoder->builder.face;
T1_Font type1 = &face->type1;
FT_Error error = FT_Err_Ok;
PSAux_Service psaux = (PSAux_Service)face->psaux;
const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
PS_Decoder psdecoder;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec *inc =
face->root.internal->incremental_interface;
#endif
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
#endif
decoder->font_matrix = type1->font_matrix;
decoder->font_offset = type1->font_offset;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* For incremental fonts get the character data using the */
/* callback function. */
if ( inc )
error = inc->funcs->get_glyph_data( inc->object,
glyph_index, char_string );
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
/* For ordinary fonts get the character data stored in the face record. */
{
char_string->pointer = type1->charstrings[glyph_index];
char_string->length = (FT_Int)type1->charstrings_len[glyph_index];
}
if ( !error )
{
/* choose which renderer to use */
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
if ( driver->hinting_engine == FT_HINTING_FREETYPE ||
decoder->builder.metrics_only )
error = decoder_funcs->parse_charstrings_old(
decoder,
(FT_Byte*)char_string->pointer,
(FT_UInt)char_string->length );
#else
if ( decoder->builder.metrics_only )
error = decoder_funcs->parse_metrics(
decoder,
(FT_Byte*)char_string->pointer,
(FT_UInt)char_string->length );
#endif
else
{
CFF_SubFontRec subfont;
psaux->ps_decoder_init( &psdecoder, decoder, TRUE );
psaux->t1_make_subfont( FT_FACE( face ),
&face->type1.private_dict, &subfont );
psdecoder.current_subfont = &subfont;
error = decoder_funcs->parse_charstrings(
&psdecoder,
(FT_Byte*)char_string->pointer,
(FT_ULong)char_string->length );
/* Adobe's engine uses 16.16 numbers everywhere; */
/* as a consequence, glyphs larger than 2000ppem get rejected */
if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
{
/* this time, we retry unhinted and scale up the glyph later on */
/* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
/* 0x400 for both `x_scale' and `y_scale' in this case) */
((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE;
*force_scaling = TRUE;
error = decoder_funcs->parse_charstrings(
&psdecoder,
(FT_Byte*)char_string->pointer,
(FT_ULong)char_string->length );
}
}
}
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
if ( !error && inc && inc->funcs->get_glyph_metrics )
{
//.........这里部分代码省略.........
示例2: T1_Get_Private_Dict
T1_Get_Private_Dict( T1_Parser parser,
PSAux_Service psaux )
{
FT_Stream stream = parser->stream;
FT_Memory memory = parser->root.memory;
FT_Error error = FT_Err_Ok;
FT_ULong size;
if ( parser->in_pfb )
{
/* in the case of the PFB format, the private dictionary can be */
/* made of several segments. We thus first read the number of */
/* segments to compute the total size of the private dictionary */
/* then re-read them into memory. */
FT_Long start_pos = FT_STREAM_POS();
FT_UShort tag;
parser->private_len = 0;
for (;;)
{
error = read_pfb_tag( stream, &tag, &size );
if ( error )
goto Fail;
if ( tag != 0x8002U )
break;
parser->private_len += size;
if ( FT_STREAM_SKIP( size ) )
goto Fail;
}
/* Check that we have a private dictionary there */
/* and allocate private dictionary buffer */
if ( parser->private_len == 0 )
{
FT_ERROR(( "T1_Get_Private_Dict:"
" invalid private dictionary section\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
if ( FT_STREAM_SEEK( start_pos ) ||
FT_ALLOC( parser->private_dict, parser->private_len ) )
goto Fail;
parser->private_len = 0;
for (;;)
{
error = read_pfb_tag( stream, &tag, &size );
if ( error || tag != 0x8002U )
{
error = FT_Err_Ok;
break;
}
if ( FT_STREAM_READ( parser->private_dict + parser->private_len,
size ) )
goto Fail;
parser->private_len += size;
}
}
else
{
/* We have already `loaded' the whole PFA font file into memory; */
/* if this is a memory resource, allocate a new block to hold */
/* the private dict. Otherwise, simply overwrite into the base */
/* dictionary block in the heap. */
/* first of all, look at the `eexec' keyword */
FT_Byte* cur = parser->base_dict;
FT_Byte* limit = cur + parser->base_len;
FT_Byte c;
Again:
for (;;)
{
c = cur[0];
if ( c == 'e' && cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */
/* whitespace + 4 chars */
{
if ( cur[1] == 'e' &&
cur[2] == 'x' &&
cur[3] == 'e' &&
cur[4] == 'c' )
break;
}
cur++;
if ( cur >= limit )
{
FT_ERROR(( "T1_Get_Private_Dict:"
" could not find `eexec' keyword\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
//.........这里部分代码省略.........
示例3: cid_load_glyph
cid_load_glyph( T1_Decoder decoder,
FT_UInt glyph_index )
{
CID_Face face = (CID_Face)decoder->builder.face;
CID_FaceInfo cid = &face->cid;
FT_Byte* p;
FT_UInt fd_select;
FT_Stream stream = face->cid_stream;
FT_Error error = CID_Err_Ok;
FT_Byte* charstring = 0;
FT_Memory memory = face->root.memory;
FT_ULong glyph_length = 0;
PSAux_Service psaux = (PSAux_Service)face->psaux;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec *inc =
face->root.internal->incremental_interface;
#endif
FT_TRACE4(( "cid_load_glyph: glyph index %d\n", glyph_index ));
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* For incremental fonts get the character data using */
/* the callback function. */
if ( inc )
{
FT_Data glyph_data;
error = inc->funcs->get_glyph_data( inc->object,
glyph_index, &glyph_data );
if ( error )
goto Exit;
p = (FT_Byte*)glyph_data.pointer;
fd_select = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
if ( glyph_data.length != 0 )
{
glyph_length = glyph_data.length - cid->fd_bytes;
(void)FT_ALLOC( charstring, glyph_length );
if ( !error )
ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
glyph_length );
}
inc->funcs->free_glyph_data( inc->object, &glyph_data );
if ( error )
goto Exit;
}
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
/* For ordinary fonts read the CID font dictionary index */
/* and charstring offset from the CIDMap. */
{
FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes;
FT_ULong off1;
if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +
glyph_index * entry_len ) ||
FT_FRAME_ENTER( 2 * entry_len ) )
goto Exit;
p = (FT_Byte*)stream->cursor;
fd_select = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
off1 = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
p += cid->fd_bytes;
glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
FT_FRAME_EXIT();
if ( fd_select >= (FT_UInt)cid->num_dicts )
{
error = CID_Err_Invalid_Offset;
goto Exit;
}
if ( glyph_length == 0 )
goto Exit;
if ( FT_ALLOC( charstring, glyph_length ) )
goto Exit;
if ( FT_STREAM_READ_AT( cid->data_offset + off1,
charstring, glyph_length ) )
goto Exit;
}
/* Now set up the subrs array and parse the charstrings. */
{
CID_FaceDict dict;
CID_Subrs cid_subrs = face->subrs + fd_select;
FT_Int cs_offset;
/* Set up subrs */
decoder->num_subrs = cid_subrs->num_subrs;
//.........这里部分代码省略.........
示例4: cff_slot_load
cff_slot_load( CFF_GlyphSlot glyph,
CFF_Size size,
FT_UInt glyph_index,
FT_Int32 load_flags )
{
FT_Error error;
CFF_Decoder decoder;
PS_Decoder psdecoder;
TT_Face face = (TT_Face)glyph->root.face;
FT_Bool hinting, scaled, force_scaling;
CFF_Font cff = (CFF_Font)face->extra.data;
PSAux_Service psaux = (PSAux_Service)face->psaux;
const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs;
FT_Matrix font_matrix;
FT_Vector font_offset;
force_scaling = FALSE;
/* in a CID-keyed font, consider `glyph_index' as a CID and map */
/* it immediately to the real glyph_index -- if it isn't a */
/* subsetted font, glyph_indices and CIDs are identical, though */
if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
cff->charset.cids )
{
/* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */
if ( glyph_index != 0 )
{
glyph_index = cff_charset_cid_to_gindex( &cff->charset,
glyph_index );
if ( glyph_index == 0 )
return FT_THROW( Invalid_Argument );
}
}
else if ( glyph_index >= cff->num_glyphs )
return FT_THROW( Invalid_Argument );
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
glyph->x_scale = 0x10000L;
glyph->y_scale = 0x10000L;
if ( size )
{
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
}
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* try to load embedded bitmap if any */
/* */
/* XXX: The convention should be emphasized in */
/* the documents because it can be confusing. */
if ( size )
{
CFF_Face cff_face = (CFF_Face)size->root.face;
SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt;
FT_Stream stream = cff_face->root.stream;
if ( size->strike_index != 0xFFFFFFFFUL &&
sfnt->load_eblc &&
( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
{
TT_SBit_MetricsRec metrics;
error = sfnt->load_sbit_image( face,
size->strike_index,
glyph_index,
(FT_UInt)load_flags,
stream,
&glyph->root.bitmap,
&metrics );
if ( !error )
{
FT_Bool has_vertical_info;
FT_UShort advance;
FT_Short dummy;
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
glyph->root.metrics.width = (FT_Pos)metrics.width << 6;
glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6;
glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
//.........这里部分代码省略.........
示例5: T1_Get_Private_Dict
T1_Get_Private_Dict( T1_Parser parser,
PSAux_Service psaux )
{
FT_Stream stream = parser->stream;
FT_Memory memory = parser->root.memory;
FT_Error error = 0;
FT_Long size;
if ( parser->in_pfb )
{
/* in the case of the PFB format, the private dictionary can be */
/* made of several segments. We thus first read the number of */
/* segments to compute the total size of the private dictionary */
/* then re-read them into memory. */
FT_Long start_pos = FT_STREAM_POS();
FT_UShort tag;
parser->private_len = 0;
for (;;)
{
error = read_pfb_tag( stream, &tag, &size );
if ( error )
goto Fail;
if ( tag != 0x8002U )
break;
parser->private_len += size;
if ( FT_STREAM_SKIP( size ) )
goto Fail;
}
/* Check that we have a private dictionary there */
/* and allocate private dictionary buffer */
if ( parser->private_len == 0 )
{
FT_ERROR(( "T1_Get_Private_Dict:" ));
FT_ERROR(( " invalid private dictionary section\n" ));
error = T1_Err_Invalid_File_Format;
goto Fail;
}
if ( FT_STREAM_SEEK( start_pos ) ||
FT_ALLOC( parser->private_dict, parser->private_len ) )
goto Fail;
parser->private_len = 0;
for (;;)
{
error = read_pfb_tag( stream, &tag, &size );
if ( error || tag != 0x8002U )
{
error = T1_Err_Ok;
break;
}
if ( FT_STREAM_READ( parser->private_dict + parser->private_len, size ) )
goto Fail;
parser->private_len += size;
}
}
else
{
/* we have already `loaded' the whole PFA font file into memory; */
/* if this is a memory resource, allocate a new block to hold */
/* the private dict. Otherwise, simply overwrite into the base */
/* dictionary block in the heap. */
/* first of all, look at the `eexec' keyword */
FT_Byte* cur = parser->base_dict;
FT_Byte* limit = cur + parser->base_len;
FT_Byte c;
for (;;)
{
c = cur[0];
if ( c == 'e' && cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */
/* newline + 4 chars */
{
if ( cur[1] == 'e' && cur[2] == 'x' &&
cur[3] == 'e' && cur[4] == 'c' )
{
cur += 6; /* we skip the newling after the `eexec' */
/* XXX: Some fonts use DOS-linefeeds, i.e. \r\n; we need to */
/* skip the extra \n if we find it */
if ( cur[0] == '\n' )
cur++;
break;
}
}
cur++;
if ( cur >= limit )
{
//.........这里部分代码省略.........