页次: 1
int ftfont_rander(unsigned long u32c, FontCharRec *fcr){
struct FTContext *ctx = &g_ftctx;
FT_UInt glyph_index;
FTC_SBitRec *ftsbrec;
if(ctx->ftmgr == NULL){
return 1;
}
/* Request face object from cache
if (FTC_Manager_LookupFace(ctx->ftmgr, ctx, &ctx->ftface)) {
return 2;
}*/
// Request size object from cache
if (FTC_Manager_LookupSize(ctx->ftmgr, &ctx->ftscaler, &ctx->ftsize)) {
return 3;
}
// Request glyph index from cache
glyph_index = FTC_CMapCache_Lookup(ctx->ftcache, ctx, 0, u32c);
// Request bitmap from cache
if (FTC_SBitCache_Lookup(ctx->ftsbcache, &ctx->ftitype, glyph_index, &ftsbrec, NULL)) {
return 4;
}
fcr->w = ftsbrec->width;
fcr->h = ftsbrec->height;
fcr->left = ftsbrec->left;
fcr->top = ftsbrec->top;
fcr->pitch = ftsbrec->pitch;
fcr->w_adv = ftsbrec->xadvance;
fcr->h_adv = ftsbrec->yadvance;
fcr->buffer = ftsbrec->buffer;
return 0;
}
页次: 1