本文整理汇总了C++中FT_Outline_Transform函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_Outline_Transform函数的具体用法?C++ FT_Outline_Transform怎么用?C++ FT_Outline_Transform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_Outline_Transform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ft_raster1_transform
/* transform a given glyph image */
static
FT_Error ft_raster1_transform(FT_Renderer render,
FT_GlyphSlot slot,
FT_Matrix *matrix,
FT_Vector *delta)
{
FT_Error error = FT_Err_Ok;
if(slot->format != render->glyph_format)
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
if(matrix)
{
FT_Outline_Transform(&slot->outline, matrix);
}
if(delta)
{
FT_Outline_Translate(&slot->outline, delta->x, delta->y);
}
Exit:
return error;
}
示例2: ft_outline_glyph_transform
static
void ft_outline_glyph_transform( FT_OutlineGlyph glyph,
FT_Matrix* matrix,
FT_Vector* delta )
{
if ( matrix )
FT_Outline_Transform( &glyph->outline, matrix );
if ( delta )
FT_Outline_Translate( &glyph->outline, delta->x, delta->y );
}
示例3: LoadTrueTypeChar
static FT_Error
LoadTrueTypeChar(Font *fnt,
int idx,
Boolean hint,
Boolean quiet)
{
FT_Error error;
int flags;
flags = FT_LOAD_DEFAULT;
if (hint)
flags |= FT_LOAD_FORCE_AUTOHINT;
error = FT_Load_Glyph(face, idx, flags);
if (!error)
{
if (fnt->efactor != 1.0 || fnt->slant != 0.0 )
FT_Outline_Transform(&face->glyph->outline, &matrix1);
if (fnt->rotate)
{
FT_Outline_Transform(&face->glyph->outline, &matrix2);
error = FT_Outline_Get_BBox(&face->glyph->outline, &bbox); /* we need the non-
grid-fitted bbox */
if (!error)
FT_Outline_Translate(&face->glyph->outline,
face->glyph->metrics.vertBearingY - bbox.xMin,
-fnt->y_offset * ppem * 64);
}
}
if (!error)
error = FT_Outline_Get_BBox(&face->glyph->outline, &bbox);
if (!error)
{
FT_Outline_Get_CBox(&face->glyph->outline, &bbox); /* for the case of BBox != CBox */
SetRasterArea(quiet);
}
return error;
}
示例4: ft_outline_glyph_transform
ft_outline_glyph_transform( FT_Glyph outline_glyph,
const FT_Matrix* matrix,
const FT_Vector* delta )
{
FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph;
if ( matrix )
FT_Outline_Transform( &glyph->outline, matrix );
if ( delta )
FT_Outline_Translate( &glyph->outline, delta->x, delta->y );
}
示例5: FT_ITALIC
void FT_ITALIC(FT_GlyphSlot slot)
{
FT_Matrix transform;
FT_Outline* outline = &slot->outline;
/* only oblique outline glyphs */
if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
return;
/* we don't touch the advance width */
/* For italic, simply apply a shear transform, with an angle */
/* of about 12 degrees. */
transform.xx = 0x10000L;
transform.yx = 0x00000L;
transform.xy = 0x03000L;
transform.yy = 0x10000L;
FT_Outline_Transform( outline, &transform );
}
示例6: mutex
const bool GDI2FT_RENDERER::generate_outline_glyph( FT_Glyph* glyph, WORD glyph_index, const FTC_Scaler scaler, FT_F26Dot6 embolden, bool is_italic ) const
/* --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- */
{
FT_Glyph cached_glyph;
{
GDI2FT_MUTEX mutex( GDI2FT_MUTEX::MUTEX_FREETYPE );
if( FTC_ImageCache_LookupScaler( ft_glyph_cache, scaler, FT_LOAD_NO_BITMAP | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_CROP_BITMAP | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_TARGET_LIGHT, glyph_index, &cached_glyph, NULL ) != 0 )
return NULL;
}
if( cached_glyph->format != FT_GLYPH_FORMAT_OUTLINE )
return NULL;
const bool oblique = ( ( context->outline_metrics->otmTextMetrics.tmItalic != 0 ) && !is_italic );
if( oblique || embolden )
{
FT_Glyph_Copy( cached_glyph, glyph );
FT_Outline* glyph_outline = &( reinterpret_cast<FT_OutlineGlyph>( *glyph )->outline );
if( oblique )
{
FT_Matrix oblique_mat = { static_cast<FT_Pos>( 65536 ), static_cast<FT_Pos>( 19661 ), 0, static_cast<FT_Pos>( 65536 ) };
FT_Outline_Transform( glyph_outline, &oblique_mat );
}
if( embolden )
FT_Outline_Embolden( glyph_outline, embolden );
return true;
}
else
*glyph = cached_glyph;
return false;
}
示例7: Py_Outline_transform
static PyObject*
Py_Outline_transform(Py_Outline* self, PyObject* args, PyObject* kwds)
{
double xx, xy, yx, yy;
FT_Matrix matrix;
const char* keywords[] = {"xOffset", "yOffset", NULL};
if (!PyArg_ParseTupleAndKeywords(
args, kwds, "((dd)(dd)):transform", (char **)keywords,
&xx, &xy, &yx, &yy)) {
return NULL;
}
matrix.xx = TO_FT_FIXED(xx);
matrix.xy = TO_FT_FIXED(xy);
matrix.yx = TO_FT_FIXED(yx);
matrix.yy = TO_FT_FIXED(yy);
FT_Outline_Transform(&self->x, &matrix);
Py_RETURN_NONE;
};
示例8: ft_smooth_transform
/* transform a given glyph image */
static FT_Error
ft_smooth_transform( FT_Renderer render,
FT_GlyphSlot slot,
const FT_Matrix* matrix,
const FT_Vector* delta )
{
FT_Error error = FT_Err_Ok;
if ( slot->format != render->glyph_format )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
}
if ( matrix )
FT_Outline_Transform( &slot->outline, matrix );
if ( delta )
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
Exit:
return error;
}
示例9: af_loader_load_g
//.........这里部分代码省略.........
{
FT_Outline dummy = gloader->base.outline;
dummy.points += num_base_points;
dummy.n_points = (short)num_new_points;
FT_Outline_Translate( &dummy, x, y );
}
}
}
break;
default:
/* we don't support other formats (yet?) */
error = AF_Err_Unimplemented_Feature;
}
Hint_Metrics:
if ( depth == 0 )
{
FT_BBox bbox;
FT_Vector vvector;
vvector.x = slot->metrics.vertBearingX - slot->metrics.horiBearingX;
vvector.y = slot->metrics.vertBearingY - slot->metrics.horiBearingY;
vvector.x = FT_MulFix( vvector.x, metrics->scaler.x_scale );
vvector.y = FT_MulFix( vvector.y, metrics->scaler.y_scale );
/* transform the hinted outline if needed */
if ( loader->transformed )
{
FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );
FT_Vector_Transform( &vvector, &loader->trans_matrix );
}
#if 1
/* we must translate our final outline by -pp1.x and compute */
/* the new metrics */
if ( loader->pp1.x )
FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );
#endif
FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
slot->metrics.width = bbox.xMax - bbox.xMin;
slot->metrics.height = bbox.yMax - bbox.yMin;
slot->metrics.horiBearingX = bbox.xMin;
slot->metrics.horiBearingY = bbox.yMax;
slot->metrics.vertBearingX = FT_PIX_FLOOR( bbox.xMin + vvector.x );
slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );
/* for mono-width fonts (like Andale, Courier, etc.) we need */
/* to keep the original rounded advance width; ditto for */
/* digits if all have the same advance width */
#if 0
if ( !FT_IS_FIXED_WIDTH( slot->face ) )
slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
else
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
x_scale );
示例10: Load_Glyph
static FT_Error Load_Glyph( TTF_Font* font, Uint16 ch, c_glyph* cached, int want )
{
FT_Face face;
FT_Error error;
FT_GlyphSlot glyph;
FT_Glyph_Metrics* metrics;
FT_Outline* outline;
if ( !font || !font->face ) {
return FT_Err_Invalid_Handle;
}
face = font->face;
/* Load the glyph */
if ( ! cached->index ) {
cached->index = FT_Get_Char_Index( face, ch );
}
error = FT_Load_Glyph( face, cached->index, FT_LOAD_DEFAULT );
if( error ) {
return error;
}
/* Get our glyph shortcuts */
glyph = face->glyph;
metrics = &glyph->metrics;
outline = &glyph->outline;
/* Get the glyph metrics if desired */
if ( (want & CACHED_METRICS) && !(cached->stored & CACHED_METRICS) ) {
if ( FT_IS_SCALABLE( face ) ) {
/* Get the bounding box */
cached->minx = FT_FLOOR(metrics->horiBearingX);
cached->maxx = cached->minx + FT_CEIL(metrics->width);
cached->maxy = FT_FLOOR(metrics->horiBearingY);
cached->miny = cached->maxy - FT_CEIL(metrics->height);
cached->yoffset = font->ascent - cached->maxy;
cached->advance = FT_CEIL(metrics->horiAdvance);
} else {
/* Get the bounding box for non-scalable format.
* Again, freetype2 fills in many of the font metrics
* with the value of 0, so some of the values we
* need must be calculated differently with certain
* assumptions about non-scalable formats.
* */
cached->minx = FT_FLOOR(metrics->horiBearingX);
cached->maxx = cached->minx + FT_CEIL(metrics->horiAdvance);
cached->maxy = FT_FLOOR(metrics->horiBearingY);
cached->miny = cached->maxy - FT_CEIL(face->available_sizes[font->font_size_family].height);
cached->yoffset = 0;
cached->advance = FT_CEIL(metrics->horiAdvance);
}
/* Adjust for bold and italic text */
if( font->style & TTF_STYLE_BOLD ) {
cached->maxx += font->glyph_overhang;
}
if( font->style & TTF_STYLE_ITALIC ) {
cached->maxx += (int)ceil(font->glyph_italics);
}
cached->stored |= CACHED_METRICS;
}
if ( ((want & CACHED_BITMAP) && !(cached->stored & CACHED_BITMAP)) ||
((want & CACHED_PIXMAP) && !(cached->stored & CACHED_PIXMAP)) ) {
int mono = (want & CACHED_BITMAP);
int i;
FT_Bitmap* src;
FT_Bitmap* dst;
/* Handle the italic style */
if( font->style & TTF_STYLE_ITALIC ) {
FT_Matrix shear;
shear.xx = 1 << 16;
shear.xy = (int) ( font->glyph_italics * ( 1 << 16 ) ) / font->height;
shear.yx = 0;
shear.yy = 1 << 16;
FT_Outline_Transform( outline, &shear );
}
/* Render the glyph */
if ( mono ) {
error = FT_Render_Glyph( glyph, ft_render_mode_mono );
} else {
error = FT_Render_Glyph( glyph, ft_render_mode_normal );
}
if( error ) {
return error;
}
/* Copy over information to cache */
src = &glyph->bitmap;
if ( mono ) {
dst = &cached->bitmap;
} else {
dst = &cached->pixmap;
}
memcpy( dst, src, sizeof( *dst ) );
//.........这里部分代码省略.........
示例11: CID_Load_Glyph
FT_LOCAL_DEF FT_Error
CID_Load_Glyph( CID_GlyphSlot glyph,
CID_Size size,
FT_Int glyph_index,
FT_Int load_flags )
{
FT_Error error;
T1_Decoder decoder;
CID_Face face = (CID_Face)glyph->root.face;
FT_Bool hinting;
PSAux_Interface* psaux = (PSAux_Interface*)face->psaux;
FT_Matrix font_matrix;
FT_Vector font_offset;
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
glyph->root.format = ft_glyph_format_outline;
{
error = psaux->t1_decoder_funcs->init( &decoder,
(FT_Face)face,
(FT_Size)size,
(FT_GlyphSlot)glyph,
0, /* glyph names -- XXX */
0, /* blend == 0 */
hinting,
cid_load_glyph );
/* set up the decoder */
decoder.builder.no_recurse = FT_BOOL(
( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
error = cid_load_glyph( &decoder, glyph_index );
font_matrix = decoder.font_matrix;
font_offset = decoder.font_offset;
/* save new glyph tables */
psaux->t1_decoder_funcs->done( &decoder );
}
/* now, set the metrics -- this is rather simple, as */
/* the left side bearing is the xMin, and the top side */
/* bearing the yMax */
if ( !error )
{
glyph->root.outline.flags &= ft_outline_owner;
glyph->root.outline.flags |= ft_outline_reverse_fill;
/* for composite glyphs, return only left side bearing and */
/* advance width */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
FT_Slot_Internal internal = glyph->root.internal;
glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
glyph->root.metrics.horiAdvance = decoder.builder.advance.x;
internal->glyph_matrix = font_matrix;
internal->glyph_delta = font_offset;
internal->glyph_transformed = 1;
}
else
{
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
/* copy the _unscaled_ advance width */
metrics->horiAdvance = decoder.builder.advance.x;
glyph->root.linearHoriAdvance = decoder.builder.advance.x;
glyph->root.internal->glyph_transformed = 0;
/* make up vertical metrics */
metrics->vertBearingX = 0;
metrics->vertBearingY = 0;
metrics->vertAdvance = 0;
glyph->root.linearVertAdvance = 0;
glyph->root.format = ft_glyph_format_outline;
if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= ft_outline_high_precision;
/* apply the font matrix */
FT_Outline_Transform( &glyph->root.outline, &font_matrix );
//.........这里部分代码省略.........
示例12: FT_Activate_Size
/*
* Class: FreetypeFont
* Method: loadGlyph0
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_sage_FreetypeFont_loadGlyph0
(JNIEnv *env, jobject jo, jlong fontPtr, jint glyphCode)
{
//FT_Face face = (FT_Face) facePtr;
FTDataStruct* fontData = (FTDataStruct*)(intptr_t) fontPtr;
FT_Activate_Size(fontData->sizePtr);
int error = FT_Load_Glyph(fontData->facePtr, glyphCode, FT_LOAD_FORCE_AUTOHINT);
if ((fontData->style & FT_STYLE_FLAG_BOLD) != 0)
{
// Apply bold effect
if (fontData->facePtr->glyph->format == FT_GLYPH_FORMAT_OUTLINE)
{
/* some reasonable strength */
FT_Pos strength = FT_MulFix(fontData->facePtr->units_per_EM,
fontData->facePtr->size->metrics.y_scale ) / 42;
FT_BBox bbox_before, bbox_after;
// The bounding box code was what XBMC was using to do this calculation; but the
// examples in the freetype library use the *4 math below which then doesn't clip
// the text when we render it.
// FT_Outline_Get_CBox(&fontData->facePtr->glyph->outline, &bbox_before);
FT_Outline_Embolden(&fontData->facePtr->glyph->outline, strength); // ignore error
// FT_Outline_Get_CBox(&fontData->facePtr->glyph->outline, &bbox_after);
// FT_Pos dx = bbox_after.xMax - bbox_before.xMax;
// FT_Pos dy = bbox_after.yMax - bbox_before.yMax;
FT_Pos dx = strength * 4;
FT_Pos dy = dx;
if (fontData->facePtr->glyph->advance.x)
fontData->facePtr->glyph->advance.x += dx;
if (fontData->facePtr->glyph->advance.y)
fontData->facePtr->glyph->advance.y += dy;
fontData->facePtr->glyph->metrics.width += dx;
fontData->facePtr->glyph->metrics.height += dy;
fontData->facePtr->glyph->metrics.horiBearingY += dy;
fontData->facePtr->glyph->metrics.horiAdvance += dx;
fontData->facePtr->glyph->metrics.vertBearingX -= dx / 2;
fontData->facePtr->glyph->metrics.vertBearingY += dy;
fontData->facePtr->glyph->metrics.vertAdvance += dy;
}
}
if ((fontData->style & FT_STYLE_FLAG_ITALIC) != 0)
{
// Apply italics effect
if (fontData->facePtr->glyph->format == FT_GLYPH_FORMAT_OUTLINE)
{
/* For italic, simply apply a shear transform, with an angle */
/* of about 12 degrees. */
FT_Matrix transform;
transform.xx = 0x10000L;
transform.yx = 0x00000L;
transform.xy = 0x06000L;
transform.yy = 0x10000L;
FT_BBox bbox_before, bbox_after;
FT_Outline_Get_CBox(&fontData->facePtr->glyph->outline, &bbox_before);
FT_Outline_Transform(&fontData->facePtr->glyph->outline, &transform);
FT_Outline_Get_CBox(&fontData->facePtr->glyph->outline, &bbox_after);
FT_Pos dx = bbox_after.xMax - bbox_before.xMax;
FT_Pos dy = bbox_after.yMax - bbox_before.yMax;
fontData->facePtr->glyph->metrics.width += dx;
fontData->facePtr->glyph->metrics.height += dy;
}
}
}
示例13: cid_slot_load_glyph
//.........这里部分代码省略.........
/* for composite glyphs, return only left side bearing and */
/* advance width */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
FT_Slot_Internal internal = cidglyph->internal;
cidglyph->metrics.horiBearingX =
FIXED_TO_INT( decoder.builder.left_bearing.x );
cidglyph->metrics.horiAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
internal->glyph_matrix = font_matrix;
internal->glyph_delta = font_offset;
internal->glyph_transformed = 1;
}
else
{
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &cidglyph->metrics;
FT_Vector advance;
/* copy the _unscaled_ advance width */
metrics->horiAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
cidglyph->linearHoriAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
cidglyph->internal->glyph_transformed = 0;
/* make up vertical ones */
metrics->vertAdvance = ( face->cid.font_bbox.yMax -
face->cid.font_bbox.yMin ) >> 16;
cidglyph->linearVertAdvance = metrics->vertAdvance;
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
if ( cidsize->metrics.y_ppem < 24 )
cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
/* apply the font matrix */
FT_Outline_Transform( &cidglyph->outline, &font_matrix );
FT_Outline_Translate( &cidglyph->outline,
font_offset.x,
font_offset.y );
advance.x = metrics->horiAdvance;
advance.y = 0;
FT_Vector_Transform( &advance, &font_matrix );
metrics->horiAdvance = advance.x + font_offset.x;
advance.x = 0;
advance.y = metrics->vertAdvance;
FT_Vector_Transform( &advance, &font_matrix );
metrics->vertAdvance = advance.y + font_offset.y;
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
/* scale the outline and the metrics */
FT_Int n;
FT_Outline* cur = decoder.builder.base;
FT_Vector* vec = cur->points;
FT_Fixed x_scale = glyph->x_scale;
FT_Fixed y_scale = glyph->y_scale;
/* First of all, scale the points */
if ( !hinting || !decoder.builder.hints_funcs )
for ( n = cur->n_points; n > 0; n--, vec++ )
{
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
/* Then scale the metrics */
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
}
/* compute the other metrics */
FT_Outline_Get_CBox( &cidglyph->outline, &cbox );
metrics->width = cbox.xMax - cbox.xMin;
metrics->height = cbox.yMax - cbox.yMin;
metrics->horiBearingX = cbox.xMin;
metrics->horiBearingY = cbox.yMax;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
/* make up vertical ones */
ft_synthesize_vertical_metrics( metrics,
metrics->vertAdvance );
}
}
Exit:
return error;
}
示例14: PalFont_RenderHarfBuzz
//.........这里部分代码省略.........
k = isArabic ? ( aHarfBuzz->n_Chars - i - 1 ) : i;
aGlyphIndex = aHarfBuzz->out_glyphs[ k ];
/* apply kerning if there is any */
if ( aPrevGlyphIndex != 0 && aGlyphIndex != 0 ) {
FT_Vector delta;
/* ignore errors */
if ( FT_Get_Kerning( ftContext->m_face,
aPrevGlyphIndex,
aGlyphIndex,
FT_KERNING_DEFAULT,
&delta ) == 0 ) {
thePen_x += ( int )( ( ( double )ftContext->m_Matrix.xx *
( double )delta.x ) / ( 65536.0 ) );
}
}
/* load glyph image into the slot (erase previous one) */
if ( FT_Load_Glyph( ftContext->m_face,
aGlyphIndex,
FT_LOAD_DEFAULT ) != 0 ) {
continue; /* ignore errors */
}
// if we are synthesising italic then shear outline
if ( ftContext->m_Synth & SynthItalic ) {
FT_Matrix m;
m.xx = 65536;
m.yy = 65536;
m.xy = 19660;
m.yx = 0;
FT_Outline_Transform( &slot->outline, &m );
}
/* if we are doing first pass of two color then fatten */
if ( ( ftContext->m_Synth & SynthTwoColor ) && j == 0 ) {
if ( FT_Outline_Embolden( &slot->outline,
ftContext->m_StrokeWidth << 2 ) != 0 ) {
continue;
}
}
// if we are doing second pass of two color then translate
if ( ( ftContext->m_Synth & SynthTwoColor ) && j == 1 ) {
FT_Outline_Translate( &slot->outline,
ftContext->m_StrokeWidth * 2,
ftContext->m_StrokeWidth * 2 );
}
/* if we are synthesising bold then perform fattening operation */
if ( ftContext->m_Synth & SynthBold ) {
if ( FT_Outline_Embolden( &slot->outline,
ftContext->m_Boldness << 1 ) != 0 ) {
continue;
}
}
/* if we are synthesising stroke font then stroke it */
if ( ftContext->m_Synth & SynthStroke ) {
if ( ft_OutlineStroke( ftContext->m_library,
&slot->outline, ftContext->m_StrokeWidth ) != 0 ) {
continue;
}
}
示例15: T1_Load_Glyph
//.........这里部分代码省略.........
glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
glyph->root.metrics.horiAdvance = decoder.builder.advance.x;
internal->glyph_matrix = font_matrix;
internal->glyph_delta = font_offset;
internal->glyph_transformed = 1;
}
else
{
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
/* copy the _unscaled_ advance width */
metrics->horiAdvance = decoder.builder.advance.x;
glyph->root.linearHoriAdvance = decoder.builder.advance.x;
glyph->root.internal->glyph_transformed = 0;
/* make up vertical metrics */
metrics->vertBearingX = 0;
metrics->vertBearingY = 0;
metrics->vertAdvance = 0;
glyph->root.linearVertAdvance = 0;
glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
#if 1
/* apply the font matrix, if any */
FT_Outline_Transform( &glyph->root.outline, &font_matrix );
FT_Outline_Translate( &glyph->root.outline,
font_offset.x,
font_offset.y );
#endif
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
/* scale the outline and the metrics */
FT_Int n;
FT_Outline* cur = decoder.builder.base;
FT_Vector* vec = cur->points;
FT_Fixed x_scale = glyph->x_scale;
FT_Fixed y_scale = glyph->y_scale;
/* First of all, scale the points, if we are not hinting */
if ( !hinting )
for ( n = cur->n_points; n > 0; n--, vec++ )
{
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
/* Then scale the metrics */
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );