您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FT_MulFix函数代码示例

51自学网 2021-06-01 20:44:24
  C++
这篇教程C++ FT_MulFix函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FT_MulFix函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_MulFix函数的具体用法?C++ FT_MulFix怎么用?C++ FT_MulFix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FT_MulFix函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: 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;		}	}}
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:76,


示例2: ScaleRoundDesignUnits

// aScale is intended for a 16.16 x/y_scale of an FT_Size_Metricsstatic inline FT_LongScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale){    FT_Long fixed26dot6 = FT_MulFix(aDesignMetric, aScale);    return ROUND_26_6_TO_INT(fixed26dot6);}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:7,


示例3: pfr_slot_load

//.........这里部分代码省略.........    pfrslot->format     = FT_GLYPH_FORMAT_OUTLINE;    outline->n_points   = 0;    outline->n_contours = 0;    gps_offset          = face->header.gps_section_offset;    /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */    error = pfr_glyph_load( &slot->glyph, face->root.stream,                            gps_offset, gchar->gps_offset, gchar->gps_size );    if ( !error )    {      FT_BBox            cbox;      FT_Glyph_Metrics*  metrics = &pfrslot->metrics;      FT_Pos             advance;      FT_Int             em_metrics, em_outline;      FT_Bool            scaling;      scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );      /* copy outline data */      *outline = slot->glyph.loader->base.outline;      outline->flags &= ~FT_OUTLINE_OWNER;      outline->flags |= FT_OUTLINE_REVERSE_FILL;      if ( size && pfrsize->metrics.y_ppem < 24 )        outline->flags |= FT_OUTLINE_HIGH_PRECISION;      /* compute the advance vector */      metrics->horiAdvance = 0;      metrics->vertAdvance = 0;      advance    = gchar->advance;      em_metrics = face->phy_font.metrics_resolution;      em_outline = face->phy_font.outline_resolution;      if ( em_metrics != em_outline )        advance = FT_MulDiv( advance, em_outline, em_metrics );      if ( face->phy_font.flags & PFR_PHY_VERTICAL )        metrics->vertAdvance = advance;      else        metrics->horiAdvance = advance;      pfrslot->linearHoriAdvance = metrics->horiAdvance;      pfrslot->linearVertAdvance = metrics->vertAdvance;      /* make-up vertical metrics(?) */      metrics->vertBearingX = 0;      metrics->vertBearingY = 0;      /* Apply the font matrix, if any.                 */      /* TODO: Test existing fonts with unusual matrix  */      /* whether we have to adjust Units per EM.        */      {        FT_Matrix font_matrix;        font_matrix.xx = face->log_font.matrix[0] << 8;        font_matrix.yx = face->log_font.matrix[1] << 8;        font_matrix.xy = face->log_font.matrix[2] << 8;        font_matrix.yy = face->log_font.matrix[3] << 8;        FT_Outline_Transform( outline, &font_matrix );      }      /* scale when needed */      if ( scaling )      {        FT_Int      n;        FT_Fixed    x_scale = pfrsize->metrics.x_scale;        FT_Fixed    y_scale = pfrsize->metrics.y_scale;        FT_Vector*  vec     = outline->points;        /* scale outline points */        for ( n = 0; n < outline->n_points; n++, vec++ )        {          vec->x = FT_MulFix( vec->x, x_scale );          vec->y = FT_MulFix( vec->y, y_scale );        }        /* scale the advance */        metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );        metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );      }      /* compute the rest of the metrics */      FT_Outline_Get_CBox( outline, &cbox );      metrics->width        = cbox.xMax - cbox.xMin;      metrics->height       = cbox.yMax - cbox.yMin;      metrics->horiBearingX = cbox.xMin;      metrics->horiBearingY = cbox.yMax - metrics->height;    }  Exit:    return error;  }
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:101,


示例4: pfr_slot_load

  pfr_slot_load( PFR_Slot  slot,                 PFR_Size  size,                 FT_UInt   gindex,                 FT_Int32  load_flags )  {    FT_Error     error;    PFR_Face     face    = (PFR_Face)slot->root.face;    PFR_Char     gchar;    FT_Outline*  outline = &slot->root.outline;    FT_ULong     gps_offset;    if (gindex > 0)      gindex--;    /* check that the glyph index is correct */    FT_ASSERT( gindex < face->phy_font.num_chars );    /* try to load an embedded bitmap */    if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 )    {      error = pfr_slot_load_bitmap( slot, size, gindex );      if ( error == 0 )        goto Exit;    }    gchar               = face->phy_font.chars + gindex;    slot->root.format   = FT_GLYPH_FORMAT_OUTLINE;    outline->n_points   = 0;    outline->n_contours = 0;    gps_offset          = face->header.gps_section_offset;    /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */    error = pfr_glyph_load( &slot->glyph, face->root.stream,                            gps_offset, gchar->gps_offset, gchar->gps_size );    if ( !error )    {      FT_BBox            cbox;      FT_Glyph_Metrics*  metrics = &slot->root.metrics;      FT_Pos             advance;      FT_Int             em_metrics, em_outline;      FT_Bool            scaling;      scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );      /* copy outline data */      *outline = slot->glyph.loader->base.outline;      outline->flags &= ~FT_OUTLINE_OWNER;      outline->flags |= FT_OUTLINE_REVERSE_FILL;      if ( size && size->root.metrics.y_ppem < 24 )        outline->flags |= FT_OUTLINE_HIGH_PRECISION;      /* compute the advance vector */      metrics->horiAdvance = 0;      metrics->vertAdvance = 0;      advance    = gchar->advance;      em_metrics = face->phy_font.metrics_resolution;      em_outline = face->phy_font.outline_resolution;      if ( em_metrics != em_outline )        advance = FT_MulDiv( advance, em_outline, em_metrics );      if ( face->phy_font.flags & PFR_PHY_VERTICAL )        metrics->vertAdvance = advance;      else        metrics->horiAdvance = advance;      slot->root.linearHoriAdvance = metrics->horiAdvance;      slot->root.linearVertAdvance = metrics->vertAdvance;      /* make-up vertical metrics(?) */      metrics->vertBearingX = 0;      metrics->vertBearingY = 0;      /* scale when needed */      if ( scaling )      {        FT_Int      n;        FT_Fixed    x_scale = size->root.metrics.x_scale;        FT_Fixed    y_scale = size->root.metrics.y_scale;        FT_Vector*  vec     = outline->points;        /* scale outline points */        for ( n = 0; n < outline->n_points; n++, vec++ )        {          vec->x = FT_MulFix( vec->x, x_scale );          vec->y = FT_MulFix( vec->y, y_scale );        }        /* scale the advance */        metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );        metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );      }      /* compute the rest of the metrics *///.........这里部分代码省略.........
开发者ID:8l,项目名称:inferno,代码行数:101,


示例5: af_warper_compute_line_best

  static void  af_warper_compute_line_best( AF_Warper     warper,                               FT_Fixed      scale,                               FT_Pos        delta,                               FT_Pos        xx1,                               FT_Pos        xx2,                               AF_WarpScore  base_distort,                               AF_Segment    segments,                               FT_UInt       num_segments )  {    FT_Int        idx_min, idx_max, idx0;    FT_UInt       nn;    AF_WarpScore  scores[65];    for ( nn = 0; nn < 65; nn++ )      scores[nn] = 0;    idx0 = xx1 - warper->t1;    /* compute minimum and maximum indices */    {      FT_Pos  xx1min = warper->x1min;      FT_Pos  xx1max = warper->x1max;      FT_Pos  w      = xx2 - xx1;      if ( xx1min + w < warper->x2min )        xx1min = warper->x2min - w;      xx1max = warper->x1max;      if ( xx1max + w > warper->x2max )        xx1max = warper->x2max - w;      idx_min = xx1min - warper->t1;      idx_max = xx1max - warper->t1;      if ( idx_min < 0 || idx_min > idx_max || idx_max > 64 )      {        FT_TRACE5(( "invalid indices:/n"                    "  min=%d max=%d, xx1=%ld xx2=%ld,/n"                    "  x1min=%ld x1max=%ld, x2min=%ld x2max=%ld/n",                    idx_min, idx_max, xx1, xx2,                    warper->x1min, warper->x1max,                    warper->x2min, warper->x2max ));        return;      }    }    for ( nn = 0; nn < num_segments; nn++ )    {      FT_Pos  len = segments[nn].max_coord - segments[nn].min_coord;      FT_Pos  y0  = FT_MulFix( segments[nn].pos, scale ) + delta;      FT_Pos  y   = y0 + ( idx_min - idx0 );      FT_Int  idx;      /* score the length of the segments for the given range */      for ( idx = idx_min; idx <= idx_max; idx++, y++ )        scores[idx] += af_warper_weights[y & 63] * len;    }    /* find best score */    {      FT_Int  idx;      for ( idx = idx_min; idx <= idx_max; idx++ )      {        AF_WarpScore  score = scores[idx];        AF_WarpScore  distort = base_distort + ( idx - idx0 );        if ( score > warper->best_score         ||             ( score == warper->best_score    &&               distort < warper->best_distort ) )        {          warper->best_score   = score;          warper->best_distort = distort;          warper->best_scale   = scale;          warper->best_delta   = delta + ( idx - idx0 );        }      }    }  }
开发者ID:32767,项目名称:libgdx,代码行数:85,


示例6: af_loader_embolden_glyph_in_slot

  static FT_Error  af_loader_embolden_glyph_in_slot( AF_Loader        loader,                                    FT_Face          face,                                    AF_StyleMetrics  style_metrics )  {    FT_Error  error = FT_Err_Ok;    FT_GlyphSlot           slot    = face->glyph;    AF_FaceGlobals         globals = loader->globals;    AF_WritingSystemClass  writing_system_class;    FT_Size_Metrics*  size_metrics = &face->size->internal->autohint_metrics;    FT_Pos  stdVW = 0;    FT_Pos  stdHW = 0;    FT_Bool  size_changed = size_metrics->x_ppem !=                              globals->stem_darkening_for_ppem;    FT_Fixed  em_size  = af_intToFixed( face->units_per_EM );    FT_Fixed  em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size );    FT_Matrix  scale_down_matrix = { 0x10000L, 0, 0, 0x10000L };    /* Skip stem darkening for broken fonts. */    if ( !face->units_per_EM )    {      error = FT_ERR( Corrupted_Font_Header );      goto Exit;    }    /*     * We depend on the writing system (script analyzers) to supply     * standard widths for the script of the glyph we are looking at.  If     * it can't deliver, stem darkening is disabled.     */    writing_system_class =      af_writing_system_classes[style_metrics->style_class->writing_system];    if ( writing_system_class->style_metrics_getstdw )      writing_system_class->style_metrics_getstdw( style_metrics,                                                   &stdHW,                                                   &stdVW );    else    {      error = FT_ERR( Unimplemented_Feature );      goto Exit;    }    if ( size_changed                                               ||         ( stdVW > 0 && stdVW != globals->standard_vertical_width ) )    {      FT_Fixed  darken_by_font_units_x, darken_x;      darken_by_font_units_x =        af_intToFixed( af_loader_compute_darkening( loader,                                                    face,                                                    stdVW ) );      darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x,                                       size_metrics->x_scale ),                            em_ratio );      globals->standard_vertical_width = stdVW;      globals->stem_darkening_for_ppem = size_metrics->x_ppem;      globals->darken_x                = af_fixedToInt( darken_x );    }    if ( size_changed                                                 ||         ( stdHW > 0 && stdHW != globals->standard_horizontal_width ) )    {      FT_Fixed  darken_by_font_units_y, darken_y;      darken_by_font_units_y =        af_intToFixed( af_loader_compute_darkening( loader,                                                    face,                                                    stdHW ) );      darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y,                                       size_metrics->y_scale ),                            em_ratio );      globals->standard_horizontal_width = stdHW;      globals->stem_darkening_for_ppem   = size_metrics->x_ppem;      globals->darken_y                  = af_fixedToInt( darken_y );      /*       * Scale outlines down on the Y-axis to keep them inside their blue       * zones.  The stronger the emboldening, the stronger the downscaling       * (plus heuristical padding to prevent outlines still falling out       * their zones due to rounding).       *       * Reason: `FT_Outline_Embolden' works by shifting the rightmost       * points of stems farther to the right, and topmost points farther       * up.  This positions points on the Y-axis outside their       * pre-computed blue zones and leads to distortion when applying the       * hints in the code further below.  Code outside this emboldening       * block doesn't know we are presenting it with modified outlines the       * analyzer didn't see!//.........这里部分代码省略.........
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,


示例7: tt_size_reset

tt_size_reset( TT_Size  size ){    TT_Face           face;    FT_Error          error = FT_Err_Ok;    FT_Size_Metrics*  metrics;    size->ttmetrics.valid = FALSE;    face = (TT_Face)size->root.face;    metrics = &size->metrics;    /* copy the result from base layer */    *metrics = size->root.metrics;    if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )        return FT_THROW( Invalid_PPem );    /* This bit flag, if set, indicates that the ppems must be       */    /* rounded to integers.  Nearly all TrueType fonts have this bit */    /* set, as hinting won't work really well otherwise.             */    /*                                                               */    if ( face->header.Flags & 8 )    {        metrics->x_scale = FT_DivFix( metrics->x_ppem << 6,                                      face->root.units_per_EM );        metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,                                      face->root.units_per_EM );        metrics->ascender =            FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );        metrics->descender =            FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );        metrics->height =            FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );        metrics->max_advance =            FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,                                     metrics->x_scale ) );    }    /* compute new transformation */    if ( metrics->x_ppem >= metrics->y_ppem )    {        size->ttmetrics.scale   = metrics->x_scale;        size->ttmetrics.ppem    = metrics->x_ppem;        size->ttmetrics.x_ratio = 0x10000L;        size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem,                                             metrics->x_ppem );    }    else    {        size->ttmetrics.scale   = metrics->y_scale;        size->ttmetrics.ppem    = metrics->y_ppem;        size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem,                                             metrics->y_ppem );        size->ttmetrics.y_ratio = 0x10000L;    }#ifdef TT_USE_BYTECODE_INTERPRETER    size->cvt_ready = -1;#endif /* TT_USE_BYTECODE_INTERPRETER */    if ( !error )        size->ttmetrics.valid = TRUE;    return error;}
开发者ID:Ruw-Van,项目名称:krkrz,代码行数:68,


示例8: FT_CEIL

int PG_Font::GetFontHeight() {	return my_internaldata->FaceCache ?		FT_CEIL(FT_MulFix(my_internaldata->FaceCache->Face->height, my_internaldata->FaceCache->Face->size->metrics.y_scale)) : 0;}
开发者ID:KAMI911,项目名称:openmortal,代码行数:4,


示例9: tt_size_reset

  tt_size_reset( TT_Size  size )  {    TT_Face           face;    FT_Error          error = TT_Err_Ok;    FT_Size_Metrics*  metrics;    size->ttmetrics.valid = FALSE;    face = (TT_Face)size->root.face;    metrics = &size->metrics;    /* copy the result from base layer */    *metrics = size->root.metrics;    if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )      return TT_Err_Invalid_PPem;    /* This bit flag, if set, indicates that the ppems must be       */    /* rounded to integers.  Nearly all TrueType fonts have this bit */    /* set, as hinting won't work really well otherwise.             */    /*                                                               */    if ( face->header.Flags & 8 )    {      metrics->x_scale = FT_DivFix( metrics->x_ppem << 6,                                    face->root.units_per_EM );      metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,                                    face->root.units_per_EM );      metrics->ascender =        FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );      metrics->descender =        FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );      metrics->height =        FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );      metrics->max_advance =        FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,                                 metrics->x_scale ) );    }    /* compute new transformation */    if ( metrics->x_ppem >= metrics->y_ppem )    {      size->ttmetrics.scale   = metrics->x_scale;      size->ttmetrics.ppem    = metrics->x_ppem;      size->ttmetrics.x_ratio = 0x10000L;      size->ttmetrics.y_ratio = FT_MulDiv( metrics->y_ppem,                                           0x10000L,                                           metrics->x_ppem );    }    else    {      size->ttmetrics.scale   = metrics->y_scale;      size->ttmetrics.ppem    = metrics->y_ppem;      size->ttmetrics.x_ratio = FT_MulDiv( metrics->x_ppem,                                           0x10000L,                                           metrics->y_ppem );      size->ttmetrics.y_ratio = 0x10000L;    }#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER    {      FT_UInt  i;      /* Scale the cvt values to the new ppem.          */      /* We use by default the y ppem to scale the CVT. */      for ( i = 0; i < size->cvt_size; i++ )        size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );      /* All twilight points are originally zero */      for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )      {        size->twilight.org[i].x = 0;        size->twilight.org[i].y = 0;        size->twilight.cur[i].x = 0;        size->twilight.cur[i].y = 0;      }      /* clear storage area */      for ( i = 0; i < (FT_UInt)size->storage_size; i++ )        size->storage[i] = 0;      size->GS = tt_default_graphics_state;      error = tt_size_run_prep( size );    }#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */    if ( !error )      size->ttmetrics.valid = TRUE;    return error;  }
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:98,


示例10: insertPlaceholderGlyph

bool Font::insertGlyph(Char character) {		if(!m_size) {		insertPlaceholderGlyph(character);		return false;	}		FT_UInt glyphIndex = FT_Get_Char_Index(m_size->face, character);	if(!glyphIndex) {		insertPlaceholderGlyph(character);		return false;	}		FT_Int32 flags = FT_LOAD_TARGET_LIGHT;	if(m_info.weight != 0) {		flags |= FT_LOAD_FORCE_AUTOHINT;	}	if(FT_Load_Glyph(m_size->face, glyphIndex, flags)) {		insertPlaceholderGlyph(character);		return false;	}		FT_GlyphSlot ftGlyph = m_size->face->glyph;		if(m_info.weight != 0 && ftGlyph->format == FT_GLYPH_FORMAT_OUTLINE) {		FT_Pos strength = FT_MulFix(m_size->face->units_per_EM, m_size->metrics.y_scale) / 24 * m_info.weight / 4;		FT_Outline_Embolden(&ftGlyph->outline, strength);	}		if(FT_Render_Glyph(ftGlyph, FT_RENDER_MODE_NORMAL)) {		insertPlaceholderGlyph(character);		return false;	}		// Fill in info for this glyph.	Glyph & glyph = m_glyphs[character];	glyph.index = glyphIndex;	glyph.size.x = ftGlyph->bitmap.width;	glyph.size.y = ftGlyph->bitmap.rows;	glyph.advance.x = float(ftGlyph->linearHoriAdvance) / 65536.f;	glyph.advance.y = float(ftGlyph->linearVertAdvance) / 65536.f;	glyph.lsb_delta = ftGlyph->lsb_delta;	glyph.rsb_delta = ftGlyph->rsb_delta;	glyph.draw_offset.x = ftGlyph->bitmap_left;	glyph.draw_offset.y = ftGlyph->bitmap_top - ftGlyph->bitmap.rows;	glyph.uv_start = Vec2f(0.f);	glyph.uv_end = Vec2f(0.f);	glyph.texture = 0;		// Some glyphs like spaces have a size of 0...	if(glyph.size.x != 0 && glyph.size.y != 0) {				Image imgGlyph;		imgGlyph.create(size_t(glyph.size.x), size_t(glyph.size.y), Image::Format_A8);				FT_Bitmap & srcBitmap = ftGlyph->bitmap;		arx_assert(srcBitmap.pitch >= 0);		arx_assert(unsigned(srcBitmap.pitch) == unsigned(srcBitmap.width));				// Copy pixels		unsigned char * src = srcBitmap.buffer;		unsigned char * dst = imgGlyph.getData();		memcpy(dst, src, glyph.size.x * glyph.size.y);				Vec2i offset;		if(!m_textures->insertImage(imgGlyph, glyph.texture, offset)) {			LogWarning << "Could not upload glyph for character U+" << std::hex << character			           << " (" << util::encode<util::UTF8>(character) << ") in font "			           << m_info.name;			insertPlaceholderGlyph(character);			return false;		}				// Compute UV mapping for each glyph.		const float textureSize = float(m_textures->getTextureSize());		glyph.uv_start = Vec2f(offset) / Vec2f(textureSize);		glyph.uv_end = Vec2f(offset + glyph.size) / Vec2f(textureSize);			}		return true;}
开发者ID:nikos-maximus,项目名称:ArxLibertatis,代码行数:82,


示例11: CID_Load_Glyph

//.........这里部分代码省略.........      /* 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 );        FT_Outline_Translate( &glyph->root.outline,                              font_offset.x,                              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 )            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 );          if ( hinting )          {            metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64;            metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64;            metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64;            metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64;          }        }        /* compute the other metrics */        FT_Outline_Get_CBox( &glyph->root.outline, &cbox );        /* grid fit the bounding box if necessary */        if ( hinting )        {          cbox.xMin &= -64;          cbox.yMin &= -64;          cbox.xMax  = ( cbox.xMax + 63 ) & -64;          cbox.yMax  = ( cbox.yMax + 63 ) & -64;        }        metrics->width  = cbox.xMax - cbox.xMin;        metrics->height = cbox.yMax - cbox.yMin;        metrics->horiBearingX = cbox.xMin;        metrics->horiBearingY = cbox.yMax;      }    }    return error;  }
开发者ID:1007650105,项目名称:aseprite,代码行数:101,


示例12: af_warper_compute

  af_warper_compute( AF_Warper      warper,                     AF_GlyphHints  hints,                     AF_Dimension   dim,                     FT_Fixed      *a_scale,                     FT_Pos        *a_delta )  {    AF_AxisHints  axis;    AF_Point      points;    FT_Fixed      org_scale;    FT_Pos        org_delta;    FT_UInt       nn, num_points, num_segments;    FT_Int        X1, X2;    FT_Int        w;    AF_WarpScore  base_distort;    AF_Segment    segments;    /* get original scaling transformation */    if ( dim == AF_DIMENSION_VERT )    {      org_scale = hints->y_scale;      org_delta = hints->y_delta;    }    else    {      org_scale = hints->x_scale;      org_delta = hints->x_delta;    }    warper->best_scale   = org_scale;    warper->best_delta   = org_delta;    warper->best_score   = 0;    warper->best_distort = 0;    axis         = &hints->axis[dim];    segments     = axis->segments;    num_segments = axis->num_segments;    points       = hints->points;    num_points   = hints->num_points;    *a_scale = org_scale;    *a_delta = org_delta;    /* get X1 and X2, minimum and maximum in original coordinates */    if ( axis->num_segments < 1 )      return;#if 1    X1 = X2 = points[0].fx;    for ( nn = 1; nn < num_points; nn++ )    {      FT_Int  X = points[nn].fx;      if ( X < X1 )        X1 = X;      if ( X > X2 )        X2 = X;    }#else    X1 = X2 = segments[0].pos;    for ( nn = 1; nn < num_segments; nn++ )    {      FT_Int  X = segments[nn].pos;      if ( X < X1 )        X1 = X;      if ( X > X2 )        X2 = X;    }#endif    if ( X1 >= X2 )      return;    warper->x1 = FT_MulFix( X1, org_scale ) + org_delta;    warper->x2 = FT_MulFix( X2, org_scale ) + org_delta;    warper->t1 = AF_WARPER_FLOOR( warper->x1 );    warper->t2 = AF_WARPER_CEIL( warper->x2 );    warper->x1min = warper->x1 & ~31;    warper->x1max = warper->x1min + 32;    warper->x2min = warper->x2 & ~31;    warper->x2max = warper->x2min + 32;    if ( warper->x1max > warper->x2 )      warper->x1max = warper->x2;    if ( warper->x2min < warper->x1 )      warper->x2min = warper->x1;    warper->w0 = warper->x2 - warper->x1;    if ( warper->w0 <= 64 )    {//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,


示例13: t1_decoder_parse_charstrings

//.........这里部分代码省略.........            {              FT_ERROR(( "t1_decoder_parse_charstrings: " ));              FT_ERROR(( "incorrect number of mm arguments/n" ));              goto Syntax_Error;            }            top -= blend->num_designs * num_points;            if ( top < decoder->stack )              goto Stack_Underflow;            /* we want to compute:                                   */            /*                                                       */            /*  a0*w0 + a1*w1 + ... + ak*wk                          */            /*                                                       */            /* but we only have the a0, a1-a0, a2-a0, .. ak-a0       */            /* however, given that w0 + w1 + ... + wk == 1, we can   */            /* rewrite it easily as:                                 */            /*                                                       */            /*  a0 + (a1-a0)*w1 + (a2-a0)*w2 + .. + (ak-a0)*wk       */            /*                                                       */            /* where k == num_designs-1                              */            /*                                                       */            /* I guess that's why it's written in this `compact'     */            /* form.                                                 */            /*                                                       */            delta  = top + num_points;            values = top;            for ( nn = 0; nn < num_points; nn++ )            {              FT_Long  tmp = values[0];              for ( mm = 1; mm < blend->num_designs; mm++ )                tmp += FT_MulFix( *delta++, blend->weight_vector[mm] );              *values++ = tmp;            }            /* note that `top' will be incremented later by calls to `pop' */            break;          }        default:        Unexpected_OtherSubr:          FT_ERROR(( "t1_decoder_parse_charstrings: "                     "invalid othersubr [%d %d]!/n", top[0], top[1] ));          goto Syntax_Error;        }        decoder->top = top;      }      else  /* general operator */      {        FT_Int  num_args = t1_args_count[op];        if ( top - decoder->stack < num_args )          goto Stack_Underflow;        top -= num_args;        switch ( op )        {        case op_endchar:          FT_TRACE4(( " endchar" ));          close_contour( builder );
开发者ID:gzwplato,项目名称:VersyPDF,代码行数:66,


示例14: af_loader_load_glyph

  af_loader_load_glyph( AF_Loader  loader,                        AF_Module  module,                        FT_Face    face,                        FT_UInt    glyph_index,                        FT_Int32   load_flags )  {    FT_Error  error;    FT_Size           size          = face->size;    FT_Size_Internal  size_internal = size->internal;    FT_GlyphSlot      slot          = face->glyph;    FT_Slot_Internal  slot_internal = slot->internal;    FT_GlyphLoader    gloader       = slot_internal->loader;    AF_GlyphHints          hints         = loader->hints;    AF_ScalerRec           scaler;    AF_StyleMetrics        style_metrics;    FT_UInt                style_options = AF_STYLE_NONE_DFLT;    AF_StyleClass          style_class;    AF_WritingSystemClass  writing_system_class;    if ( !size )      return FT_THROW( Invalid_Size_Handle );    FT_ZERO( &scaler );    if ( !size_internal->autohint_metrics.x_scale                          ||         size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) )    {      /* switching between hinting modes usually means different scaling */      /* values; this later on enforces recomputation of everything      */      /* related to the current size                                     */      size_internal->autohint_mode    = FT_LOAD_TARGET_MODE( load_flags );      size_internal->autohint_metrics = size->metrics;#ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS      {        FT_Size_Metrics*  size_metrics = &size_internal->autohint_metrics;        /* set metrics to integer values and adjust scaling accordingly; */        /* this is the same setup as with TrueType fonts, cf. function   */        /* `tt_size_reset' in file `ttobjs.c'                            */        size_metrics->ascender  = FT_PIX_ROUND(                                    FT_MulFix( face->ascender,                                               size_metrics->y_scale ) );        size_metrics->descender = FT_PIX_ROUND(                                    FT_MulFix( face->descender,                                               size_metrics->y_scale ) );        size_metrics->height    = FT_PIX_ROUND(                                    FT_MulFix( face->height,                                               size_metrics->y_scale ) );        size_metrics->x_scale     = FT_DivFix( size_metrics->x_ppem << 6,                                               face->units_per_EM );        size_metrics->y_scale     = FT_DivFix( size_metrics->y_ppem << 6,                                               face->units_per_EM );        size_metrics->max_advance = FT_PIX_ROUND(                                      FT_MulFix( face->max_advance_width,                                                 size_metrics->x_scale ) );      }#endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */    }    /*     * TODO: This code currently doesn't support fractional advance widths,     * i.e., placing hinted glyphs at anything other than integer     * x-positions.  This is only relevant for the warper code, which     * scales and shifts glyphs to optimize blackness of stems (hinting on     * the x-axis by nature places things on pixel integers, hinting on the     * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis).  The delta     * values of the scaler would need to be adjusted.     */    scaler.face    = face;    scaler.x_scale = size_internal->autohint_metrics.x_scale;    scaler.x_delta = 0;    scaler.y_scale = size_internal->autohint_metrics.y_scale;    scaler.y_delta = 0;    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );    scaler.flags       = 0;    /* note that the fallback style can't be changed anymore */    /* after the first call of `af_loader_load_glyph'        */    error = af_loader_reset( loader, module, face );    if ( error )      goto Exit;#ifdef FT_OPTION_AUTOFIT2    /* XXX: undocumented hook to activate the latin2 writing system. */    if ( load_flags & ( 1UL << 20 ) )      style_options = AF_STYLE_LTN2_DFLT;#endif    /*     * Glyphs (really code points) are assigned to scripts.  Script     * analysis is done lazily: For each glyph that passes through here,     * the corresponding script analyzer is called, but returns immediately//.........这里部分代码省略.........
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,


示例15: BBox_Cubic_Check

//.........这里部分代码省略.........            /* _most_ at position 23.                                    */            /*                                                           */            /* We begin by computing `t1' as the bitwise `OR' of the     */            /* absolute values of `a', `b', `c'.                         */            t1  = (FT_ULong)( ( a >= 0 ) ? a : -a );            t2  = (FT_ULong)( ( b >= 0 ) ? b : -b );            t1 |= t2;            t2  = (FT_ULong)( ( c >= 0 ) ? c : -c );            t1 |= t2;            /* Now we can be sure that the most significant bit of `t1'  */            /* is the most significant bit of either `a', `b', or `c',   */            /* depending on the greatest integer range of the particular */            /* variable.                                                 */            /*                                                           */            /* Next, we compute the `shift', by shifting `t1' as many    */            /* times as necessary to move its MSB to position 23.  This  */            /* corresponds to a value of `t1' that is in the range       */            /* 0x40_0000..0x7F_FFFF.                                     */            /*                                                           */            /* Finally, we shift `a', `b', and `c' by the same amount.   */            /* This ensures that all values are now in the range         */            /* -2^23..2^23, i.e., they are now expressed as 8.16         */            /* fixed-float numbers.  This also means that we are using   */            /* 24 bits of precision to compute the zeros, independently  */            /* of the range of the original polynomial coefficients.     */            /*                                                           */            /* This algorithm should ensure reasonably accurate values   */            /* for the zeros.  Note that they are only expressed with    */            /* 16 bits when computing the extrema (the zeros need to     */            /* be in 0..1 exclusive to be considered part of the arc).   */            if ( t1 == 0 )  /* all coefficients are 0! */                return;            if ( t1 > 0x7FFFFFUL )            {                do                {                    shift++;                    t1 >>= 1;                } while ( t1 > 0x7FFFFFUL );                /* this loses some bits of precision, but we use 24 of them */                /* for the computation anyway                               */                a >>= shift;                b >>= shift;                c >>= shift;            }            else if ( t1 < 0x400000UL )            {                do                {                    shift++;                    t1 <<= 1;                } while ( t1 < 0x400000UL );                a <<= shift;                b <<= shift;                c <<= shift;            }        }        /* handle a == 0 */        if ( a == 0 )        {            if ( b != 0 )            {                t = - FT_DivFix( c, b ) / 2;                test_cubic_extrema( y1, y2, y3, y4, t, min, max );            }        }        else        {            /* solve the equation now */            d = FT_MulFix( b, b ) - FT_MulFix( a, c );            if ( d < 0 )                return;            if ( d == 0 )            {                /* there is a single split point at -b/a */                t = - FT_DivFix( b, a );                test_cubic_extrema( y1, y2, y3, y4, t, min, max );            }            else            {                /* there are two solutions; we need to filter them */                d = FT_SqrtFixed( (FT_Int32)d );                t = - FT_DivFix( b - d, a );                test_cubic_extrema( y1, y2, y3, y4, t, min, max );                t = - FT_DivFix( b + d, a );                test_cubic_extrema( y1, y2, y3, y4, t, min, max );            }        }    }
开发者ID:prestocore,项目名称:browser,代码行数:101,


示例16: af_loader_compute_darkening

  af_loader_compute_darkening( AF_Loader  loader,                               FT_Face    face,                               FT_Pos     standard_width )  {    AF_Module  module = loader->globals->module;    FT_UShort  units_per_EM;    FT_Fixed   ppem, em_ratio;    FT_Fixed   stem_width, stem_width_per_1000, scaled_stem, darken_amount;    FT_Int     log_base_2;    FT_Int     x1, y1, x2, y2, x3, y3, x4, y4;    ppem         = FT_MAX( af_intToFixed( 4 ),                           af_intToFixed( face->size->metrics.x_ppem ) );    units_per_EM = face->units_per_EM;    em_ratio = FT_DivFix( af_intToFixed( 1000 ),                          af_intToFixed ( units_per_EM ) );    if ( em_ratio < af_floatToFixed( .01 ) )    {      /* If something goes wrong, don't embolden. */      return 0;    }    x1 = module->darken_params[0];    y1 = module->darken_params[1];    x2 = module->darken_params[2];    y2 = module->darken_params[3];    x3 = module->darken_params[4];    y3 = module->darken_params[5];    x4 = module->darken_params[6];    y4 = module->darken_params[7];    if ( standard_width <= 0 )    {      stem_width          = af_intToFixed( 75 ); /* taken from cf2font.c */      stem_width_per_1000 = stem_width;    }    else    {      stem_width          = af_intToFixed( standard_width );      stem_width_per_1000 = FT_MulFix( stem_width, em_ratio );    }    log_base_2 = FT_MSB( (FT_UInt32)stem_width_per_1000 ) +                 FT_MSB( (FT_UInt32)ppem );    if ( log_base_2 >= 46 )    {      /* possible overflow */      scaled_stem = af_intToFixed( x4 );    }    else      scaled_stem = FT_MulFix( stem_width_per_1000, ppem );    /* now apply the darkening parameters */    if ( scaled_stem < af_intToFixed( x1 ) )      darken_amount = FT_DivFix( af_intToFixed( y1 ), ppem );    else if ( scaled_stem < af_intToFixed( x2 ) )    {      FT_Int  xdelta = x2 - x1;      FT_Int  ydelta = y2 - y1;      FT_Int  x      = stem_width_per_1000 -                       FT_DivFix( af_intToFixed( x1 ), ppem );      if ( !xdelta )        goto Try_x3;      darken_amount = FT_MulDiv( x, ydelta, xdelta ) +                      FT_DivFix( af_intToFixed( y1 ), ppem );    }    else if ( scaled_stem < af_intToFixed( x3 ) )    {    Try_x3:      {        FT_Int  xdelta = x3 - x2;        FT_Int  ydelta = y3 - y2;        FT_Int  x      = stem_width_per_1000 -                         FT_DivFix( af_intToFixed( x2 ), ppem );        if ( !xdelta )          goto Try_x4;        darken_amount = FT_MulDiv( x, ydelta, xdelta ) +                        FT_DivFix( af_intToFixed( y2 ), ppem );      }    }    else if ( scaled_stem < af_intToFixed( x4 ) )    {    Try_x4:      {        FT_Int  xdelta = x4 - x3;        FT_Int  ydelta = y4 - y3;        FT_Int  x      = stem_width_per_1000 -//.........这里部分代码省略.........
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,


示例17: FT_GlyphSlot_Embolden

  FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )  {    FT_Library  library = slot->library;    FT_Face     face    = slot->face;    FT_Error    error;    FT_Pos      xstr, ystr;    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&         slot->format != FT_GLYPH_FORMAT_BITMAP )      return;    /* some reasonable strength */    xstr = FT_MulFix( face->units_per_EM,                      face->size->metrics.y_scale ) / 24;    ystr = xstr;    if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )    {      error = FT_Outline_Embolden( &slot->outline, xstr );      /* ignore error */      /* this is more than enough for most glyphs; if you need accurate */      /* values, you have to call FT_Outline_Get_CBox                   */      xstr = xstr * 2;      ystr = xstr;    }    else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )    {      /* round to full pixels */      xstr &= ~63;      if ( xstr == 0 )        xstr = 1 << 6;      ystr &= ~63;      error = FT_GlyphSlot_Own_Bitmap( slot );      if ( error )        return;      error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );      if ( error )        return;    }    if ( slot->advance.x )      slot->advance.x += xstr;    if ( slot->advance.y )      slot->advance.y += ystr;    slot->metrics.width        += xstr;    slot->metrics.height       += ystr;    slot->metrics.horiBearingY += ystr;    slot->metrics.horiAdvance  += xstr;    slot->metrics.vertBearingX -= xstr / 2;    slot->metrics.vertBearingY += ystr;    slot->metrics.vertAdvance  += ystr;    if ( slot->format == FT_GLYPH_FORMAT_BITMAP )      slot->bitmap_top += ystr >> 6;  }
开发者ID:0uyangsheng,项目名称:xbmc,代码行数:61,


示例18: af_cjk_hints_compute_edges

  static FT_Error  af_cjk_hints_compute_edges( AF_GlyphHints  hints,                              AF_Dimension   dim )  {    AF_AxisHints  axis   = &hints->axis[dim];    FT_Error      error  = AF_Err_Ok;    FT_Memory     memory = hints->memory;    AF_LatinAxis  laxis  = &((AF_LatinMetrics)hints->metrics)->axis[dim];    AF_Segment    segments      = axis->segments;    AF_Segment    segment_limit = segments + axis->num_segments;    AF_Segment    seg;    FT_Fixed      scale;    FT_Pos        edge_distance_threshold;    axis->num_edges = 0;    scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale                                         : hints->y_scale;    /*********************************************************************/    /*                                                                   */    /* We begin by generating a sorted table of edges for the current    */    /* direction.  To do so, we simply scan each segment and try to find */    /* an edge in our table that corresponds to its position.            */    /*                                                                   */    /* If no edge is found, we create and insert a new edge in the       */    /* sorted table.  Otherwise, we simply add the segment to the edge's */    /* list which is then processed in the second step to compute the    */    /* edge's properties.                                                */    /*                                                                   */    /* Note that the edges table is sorted along the segment/edge        */    /* position.                                                         */    /*                                                                   */    /*********************************************************************/    edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold,                                         scale );    if ( edge_distance_threshold > 64 / 4 )      edge_distance_threshold = FT_DivFix( 64 / 4, scale );    else      edge_distance_threshold = laxis->edge_distance_threshold;    for ( seg = segments; seg < segment_limit; seg++ )    {      AF_Edge  found = 0;      FT_Pos   best  = 0xFFFFU;      FT_Int   ee;      /* look for an edge corresponding to the segment */      for ( ee = 0; ee < axis->num_edges; ee++ )      {        AF_Edge  edge = axis->edges + ee;        FT_Pos   dist;        if ( edge->dir != seg->dir )          continue;        dist = seg->pos - edge->fpos;        if ( dist < 0 )          dist = -dist;        if ( dist < edge_distance_threshold && dist < best )        {          AF_Segment  link = seg->link;          /* check whether all linked segments of the candidate edge */          /* can make a single edge.                                 */          if ( link )          {            AF_Segment  seg1 = edge->first;            AF_Segment  link1;            FT_Pos      dist2 = 0;            do            {              link1 = seg1->link;              if ( link1 )              {                dist2 = AF_SEGMENT_DIST( link, link1 );                if ( dist2 >= edge_distance_threshold )                  break;              }            } while ( ( seg1 = seg1->edge_next ) != edge->first );            if ( dist2 >= edge_distance_threshold )              continue;          }          best  = dist;          found = edge;        }      }//.........这里部分代码省略.........
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:101,


示例19: cf2_blues_init

  cf2_blues_init( CF2_Blues  blues,                  CF2_Font   font )  {    /* pointer to parsed font object */    CFF_Decoder*  decoder = font->decoder;    CF2_Fixed  zoneHeight;    CF2_Fixed  maxZoneHeight = 0;    CF2_Fixed  csUnitsPerPixel;    size_t  numBlueValues;    size_t  numOtherBlues;    size_t  numFamilyBlues;    size_t  numFamilyOtherBlues;    FT_Pos*  blueValues;    FT_Pos*  otherBlues;    FT_Pos*  familyBlues;    FT_Pos*  familyOtherBlues;    size_t     i;    CF2_Fixed  emBoxBottom, emBoxTop;    CF2_Int  unitsPerEm = font->unitsPerEm;    if ( unitsPerEm == 0 )      unitsPerEm = 1000;    FT_ZERO( blues );    blues->scale = font->innerTransform.d;    cf2_getBlueMetrics( decoder,                        &blues->blueScale,                        &blues->blueShift,                        &blues->blueFuzz );    cf2_getBlueValues( decoder, &numBlueValues, &blueValues );    cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues );    cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues );    cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues );    /*     * synthetic em box hint heuristic     *     * Apply this when ideographic dictionary (LanguageGroup 1) has no     * real alignment zones.  Adobe tools generate dummy zones at -250 and     * 1100 for a 1000 unit em.  Fonts with ICF-based alignment zones     * should not enable the heuristic.  When the heuristic is enabled,     * the font's blue zones are ignored.     *     */    /* get em box from OS/2 typoAscender/Descender                      */    /* TODO: FreeType does not parse these metrics.  Skip them for now. */#if 0    FCM_getHorizontalLineMetrics( &e,                                  font->font,                                  &ascender,                                  &descender,                                  &linegap );    if ( ascender - descender == unitsPerEm )    {      emBoxBottom = cf2_intToFixed( descender );      emBoxTop    = cf2_intToFixed( ascender );    }    else#endif    {      emBoxBottom = CF2_ICF_Bottom;      emBoxTop    = CF2_ICF_Top;    }    if ( cf2_getLanguageGroup( decoder ) == 1                   &&         ( numBlueValues == 0                                 ||           ( numBlueValues == 4                             &&             cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&             cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&             cf2_blueToFixed( blueValues[2] ) > emBoxTop    &&             cf2_blueToFixed( blueValues[3] ) > emBoxTop    ) ) )    {      /*       * Construct hint edges suitable for synthetic ghost hints at top       * and bottom of em box.  +-CF2_MIN_COUNTER allows for unhinted       * features above or below the last hinted edge.  This also gives a       * net 1 pixel boost to the height of ideographic glyphs.       *       * Note: Adjust synthetic hints outward by epsilon (0x.0001) to       *       avoid interference.  E.g., some fonts have real hints at       *       880 and -120.       */      blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON;      blues->emBoxBottomEdge.dsCoord = cf2_fixedRound(                                         FT_MulFix(                                           blues->emBoxBottomEdge.csCoord,                                           blues->scale ) ) -                                       CF2_MIN_COUNTER;      blues->emBoxBottomEdge.scale   = blues->scale;      blues->emBoxBottomEdge.flags   = CF2_GhostBottom |//.........这里部分代码省略.........
开发者ID:DjinCN,项目名称:libFreeType2,代码行数:101,


示例20: ah_outline_load

  ah_outline_load( AH_Outline  outline,                   FT_Fixed    x_scale,                   FT_Fixed    y_scale,                   FT_Face     face )  {    FT_Memory    memory       = outline->memory;    FT_Error     error        = AH_Err_Ok;    FT_Outline*  source       = &face->glyph->outline;    FT_Int       num_points   = source->n_points;    FT_Int       num_contours = source->n_contours;    AH_Point     points;    /* check arguments */    if ( !face                                          ||         !face->size                                    ||         face->glyph->format != FT_GLYPH_FORMAT_OUTLINE )      return AH_Err_Invalid_Argument;    /* first of all, reallocate the contours array if necessary */    if ( num_contours > outline->max_contours )    {      FT_Int  new_contours = ( num_contours + 3 ) & -4;      if ( FT_RENEW_ARRAY( outline->contours,                           outline->max_contours,                           new_contours ) )        goto Exit;      outline->max_contours = new_contours;    }    /* then, reallocate the points, segments & edges arrays if needed -- */    /* note that we reserved two additional point positions, used to     */    /* hint metrics appropriately                                        */    /*                                                                   */    if ( num_points + 2 > outline->max_points )    {      FT_Int  news = ( num_points + 2 + 7 ) & -8;      FT_Int  max  = outline->max_points;      if ( FT_RENEW_ARRAY( outline->points,        max,     news     ) ||           FT_RENEW_ARRAY( outline->horz_edges,    max * 2, news * 2 ) ||           FT_RENEW_ARRAY( outline->horz_segments, max * 2, news * 2 ) )        goto Exit;      /* readjust some pointers */      outline->vert_edges    = outline->horz_edges    + news;      outline->vert_segments = outline->horz_segments + news;      outline->max_points    = news;    }    outline->num_points   = num_points;    outline->num_contours = num_contours;    outline->num_hedges    = 0;    outline->num_vedges    = 0;    outline->num_hsegments = 0;    outline->num_vsegments = 0;    /* We can't rely on the value of `FT_Outline.flags' to know the fill  */    /* direction used for a glyph, given that some fonts are broken (e.g. */    /* the Arphic ones). We thus recompute it each time we need to.       */    /*                                                                    */    outline->vert_major_dir = AH_DIR_UP;    outline->horz_major_dir = AH_DIR_LEFT;    if ( ah_get_orientation( source ) > 1 )    {      outline->vert_major_dir = AH_DIR_DOWN;      outline->horz_major_dir = AH_DIR_RIGHT;    }    outline->x_scale = x_scale;    outline->y_scale = y_scale;    points = outline->points;    if ( outline->num_points == 0 )      goto Exit;    {      /* do one thing at a time -- it is easier to understand, and */      /* the code is clearer                                       */      AH_Point  point;      AH_Point  point_limit = points + outline->num_points;      /* compute coordinates */      {        FT_Vector*  vec     = source->points;        for ( point = points; point < point_limit; vec++, point++ )        {          point->fx = vec->x;          point->fy = vec->y;          point->ox = point->x = FT_MulFix( vec->x, x_scale );          point->oy = point->y = FT_MulFix( vec->y, y_scale );//.........这里部分代码省略.........
开发者ID:AudriusButkevicius,项目名称:TurboVNC,代码行数:101,


示例21: af_warper_compute

  af_warper_compute( AF_Warper      warper,                     AF_GlyphHints  hints,                     AF_Dimension   dim,                     FT_Fixed      *a_scale,                     FT_Pos        *a_delta )  {    AF_AxisHints  axis;    AF_Point      points;    FT_Fixed      org_scale;    FT_Pos        org_delta;    FT_UInt       nn, num_points, num_segments;    FT_Int        X1, X2;    FT_Int        w;    AF_WarpScore  base_distort;    AF_Segment    segments;    /* get original scaling transformation */    if ( dim == AF_DIMENSION_VERT )    {      org_scale = hints->y_scale;      org_delta = hints->y_delta;    }    else    {      org_scale = hints->x_scale;      org_delta = hints->x_delta;    }    warper->best_scale   = org_scale;    warper->best_delta   = org_delta;    warper->best_score   = INT_MIN;    warper->best_distort = 0;    axis         = &hints->axis[dim];    segments     = axis->segments;    num_segments = axis->num_segments;    points       = hints->points;    num_points   = hints->num_points;    *a_scale = org_scale;    *a_delta = org_delta;    /* get X1 and X2, minimum and maximum in original coordinates */    if ( num_segments < 1 )      return;#if 1    X1 = X2 = points[0].fx;    for ( nn = 1; nn < num_points; nn++ )    {      FT_Int  X = points[nn].fx;      if ( X < X1 )        X1 = X;      if ( X > X2 )        X2 = X;    }#else    X1 = X2 = segments[0].pos;    for ( nn = 1; nn < num_segments; nn++ )    {      FT_Int  X = segments[nn].pos;      if ( X < X1 )        X1 = X;      if ( X > X2 )        X2 = X;    }#endif    if ( X1 >= X2 )      return;    warper->x1 = FT_MulFix( X1, org_scale ) + org_delta;    warper->x2 = FT_MulFix( X2, org_scale ) + org_delta;    warper->t1 = AF_WARPER_FLOOR( warper->x1 );    warper->t2 = AF_WARPER_CEIL( warper->x2 );    /* examine a half pixel wide range around the maximum coordinates */    warper->x1min = warper->x1 & ~31;    warper->x1max = warper->x1min + 32;    warper->x2min = warper->x2 & ~31;    warper->x2max = warper->x2min + 32;    if ( warper->x1max > warper->x2 )      warper->x1max = warper->x2;    if ( warper->x2min < warper->x1 )      warper->x2min = warper->x1;    warper->w0 = warper->x2 - warper->x1;    if ( warper->w0 <= 64 )//.........这里部分代码省略.........
开发者ID:32767,项目名称:libgdx,代码行数:101,


示例22: af_loader_load_g

  static FT_Error  af_loader_load_g( AF_Loader  loader,                    AF_Scaler  scaler,                    FT_UInt    glyph_index,                    FT_Int32   load_flags,                    FT_UInt    depth )  {    FT_Error          error;    FT_Face           face     = loader->face;    FT_GlyphLoader    gloader  = loader->gloader;    AF_ScriptMetrics  metrics  = loader->metrics;    AF_GlyphHints     hints    = &loader->hints;    FT_GlyphSlot      slot     = face->glyph;    FT_Slot_Internal  internal = slot->internal;    FT_Int32          flags;    flags = load_flags | FT_LOAD_LINEAR_DESIGN;    error = FT_Load_Glyph( face, glyph_index, flags );    if ( error )      goto Exit;    loader->transformed = internal->glyph_transformed;    if ( loader->transformed )    {      FT_Matrix  inverse;      loader->trans_matrix = internal->glyph_matrix;      loader->trans_delta  = internal->glyph_delta;      inverse = loader->trans_matrix;      FT_Matrix_Invert( &inverse );      FT_Vector_Transform( &loader->trans_delta, &inverse );    }    switch ( slot->format )    {    case FT_GLYPH_FORMAT_OUTLINE:      /* translate the loaded glyph when an internal transform is needed */      if ( loader->transformed )        FT_Outline_Translate( &slot->outline,                              loader->trans_delta.x,                              loader->trans_delta.y );      /* copy the outline points in the loader's current                */      /* extra points which are used to keep original glyph coordinates */      error = FT_GLYPHLOADER_CHECK_POINTS( gloader,                                           slot->outline.n_points + 4,                                           slot->outline.n_contours );      if ( error )        goto Exit;      FT_ARRAY_COPY( gloader->current.outline.points,                     slot->outline.points,                     slot->outline.n_points );      FT_ARRAY_COPY( gloader->current.outline.contours,                     slot->outline.contours,                     slot->outline.n_contours );      FT_ARRAY_COPY( gloader->current.outline.tags,                     slot->outline.tags,                     slot->outline.n_points );      gloader->current.outline.n_points   = slot->outline.n_points;      gloader->current.outline.n_contours = slot->outline.n_contours;      /* compute original horizontal phantom points (and ignore */      /* vertical ones)                                         */      loader->pp1.x = hints->x_delta;      loader->pp1.y = hints->y_delta;      loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,                                 hints->x_scale ) + hints->x_delta;      loader->pp2.y = hints->y_delta;      /* be sure to check for spacing glyphs */      if ( slot->outline.n_points == 0 )        goto Hint_Metrics;      /* now load the slot image into the auto-outline and run the */      /* automatic hinting process                                 */      if ( metrics->clazz->script_hints_apply )        metrics->clazz->script_hints_apply( hints,                                            &gloader->current.outline,                                            metrics );      /* we now need to adjust the metrics according to the change in */      /* width/positioning that occurred during the hinting process   */      if ( scaler->render_mode != FT_RENDER_MODE_LIGHT )      {        FT_Pos        old_rsb, old_lsb, new_lsb;        FT_Pos        pp1x_uh, pp2x_uh;        AF_AxisHints  axis  = &hints->axis[AF_DIMENSION_HORZ];        AF_Edge       edge1 = axis->edges;         /* leftmost edge  */        AF_Edge       edge2 = edge1 +                              axis->num_edges - 1; /* rightmost edge */        if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )//.........这里部分代码省略.........
开发者ID:2or3,项目名称:PlaygroundOSS,代码行数:101,


示例23: cff_slot_load

//.........这里部分代码省略.........          FT_Short   vertBearingY = 0;          FT_UShort  vertAdvance  = 0;          ( (SFNT_Service)face->sfnt )->get_metrics( face, 1,                                                     glyph_index,                                                     &vertBearingY,                                                     &vertAdvance );          metrics->vertBearingY = vertBearingY;          metrics->vertAdvance  = vertAdvance;        }        else        {          /* make up vertical ones */          if ( face->os2.version != 0xFFFFU )            metrics->vertAdvance = (FT_Pos)( face->os2.sTypoAscender -                                             face->os2.sTypoDescender );          else            metrics->vertAdvance = (FT_Pos)( face->horizontal.Ascender -                                             face->horizontal.Descender );        }        glyph->root.linearVertAdvance = metrics->vertAdvance;        glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;        glyph->root.outline.flags = 0;        if ( size && size->root.metrics.y_ppem < 24 )          glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;        glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;        /* apply the font matrix, if any */        if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||             font_matrix.xy != 0        || font_matrix.yx != 0        )        {          FT_Outline_Transform( &glyph->root.outline, &font_matrix );          metrics->horiAdvance = FT_MulFix( metrics->horiAdvance,                                            font_matrix.xx );          metrics->vertAdvance = FT_MulFix( metrics->vertAdvance,                                            font_matrix.yy );        }        if ( font_offset.x || font_offset.y )        {          FT_Outline_Translate( &glyph->root.outline,                                font_offset.x,                                font_offset.y );          metrics->horiAdvance += font_offset.x;          metrics->vertAdvance += font_offset.y;        }        if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )        {          /* scale the outline and the metrics */          FT_Int       n;          FT_Outline*  cur     = &glyph->root.outline;          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( &glyph->root.outline, &cbox );        metrics->width  = cbox.xMax - cbox.xMin;        metrics->height = cbox.yMax - cbox.yMin;        metrics->horiBearingX = cbox.xMin;        metrics->horiBearingY = cbox.yMax;        if ( has_vertical_info )          metrics->vertBearingX = metrics->horiBearingX -                                    metrics->horiAdvance / 2;        else        {          if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )            ft_synthesize_vertical_metrics( metrics,                                            metrics->vertAdvance );        }      }    }    return error;  }
开发者ID:93i,项目名称:godot,代码行数:101,


示例24: TTF_OpenFontIndexRW

TTF_Font *TTF_OpenFontIndexRW(SDL_RWops * src, int freesrc, int ptsize, long index){    TTF_Font *font;    FT_Error error;    FT_Face face;    FT_Fixed scale;    FT_Stream stream;    int position;    if(!TTF_initialized)    {        TTF_SetError("Library not initialized");        return NULL;    }    /* Check to make sure we can seek in this stream */    position = SDL_RWtell(src);    if(position < 0)    {        TTF_SetError("Can't seek in stream");        return NULL;    }    font = (TTF_Font *) malloc(sizeof *font);    if(font == NULL)    {        TTF_SetError("Out of memory");        return NULL;    }    memset(font, 0, sizeof(*font));    font->src = src;    font->freesrc = freesrc;    stream = (FT_Stream) malloc(sizeof(*stream));    if(stream == NULL)    {        TTF_SetError("Out of memory");        TTF_CloseFont(font);        return NULL;    }    memset(stream, 0, sizeof(*stream));    /* 090303 Chase - Newer FT2 version sets this internally so we don't    				have to. (Can't anyway, Don't have a definition for FT_Library)    */    // stream->memory = library->memory;    stream->read = RWread;    stream->descriptor.pointer = src;    stream->pos = (unsigned long) position;    SDL_RWseek(src, 0, SEEK_END);    stream->size = (unsigned long) (SDL_RWtell(src) - position);    SDL_RWseek(src, position, SEEK_SET);    font->args.flags = FT_OPEN_STREAM;    font->args.stream = stream;    error = FT_Open_Face(library, &font->args, index, &font->face);    if(error)    {        TTF_SetFTError("Couldn't load font file", error);        TTF_CloseFont(font);        return NULL;    }    face = font->face;    /* Make sure that our font face is scalable (global metrics) */    if(FT_IS_SCALABLE(face))    {        /* Set the character size and use default DPI (72) */        error = FT_Set_Char_Size(font->face, 0, ptsize * 64, 0, 0);        if(error)        {            TTF_SetFTError("Couldn't set font size", error);            TTF_CloseFont(font);            return NULL;        }        /* Get the scalable font metrics for this font */        scale = face->size->metrics.y_scale;        font->ascent = FT_CEIL(FT_MulFix(face->bbox.yMax, scale));        font->descent = FT_CEIL(FT_MulFix(face->bbox.yMin, scale));        font->height = font->ascent - font->descent + /* baseline */ 1;        font->lineskip = FT_CEIL(FT_MulFix(face->height, scale));        font->underline_offset =            FT_FLOOR(FT_MulFix(face->underline_position, scale));        font->underline_height =            FT_FLOOR(FT_MulFix(face->underline_thickness, scale));    }    else    {        /* Non-scalable font case.  ptsize determines which family         * or series of fonts to grab from the non-scalable format.         * It is not the point size of the font.         * */        if(ptsize >= font->face->num_fixed_sizes)//.........这里部分代码省略.........
开发者ID:McManning,项目名称:fro_client,代码行数:101,


示例25: TT_Reset_Size

LOCAL_DEFFT_Error  TT_Reset_Size(TT_Size size){	TT_Face face;	FT_Error error = TT_Err_Ok;	FT_Size_Metrics  *metrics;	if(size->ttmetrics.valid)	{		return TT_Err_Ok;	}	face = (TT_Face)size->root.face;	metrics = &size->root.metrics;	if(metrics->x_ppem < 1 || metrics->y_ppem < 1)	{		return TT_Err_Invalid_PPem;	}	/* compute new transformation */	if(metrics->x_ppem >= metrics->y_ppem)	{		size->ttmetrics.scale   = metrics->x_scale;		size->ttmetrics.ppem    = metrics->x_ppem;		size->ttmetrics.x_ratio = 0x10000L;		size->ttmetrics.y_ratio = FT_MulDiv(metrics->y_ppem,		                                    0x10000L,		                                    metrics->x_ppem);	}	else	{		size->ttmetrics.scale   = metrics->y_scale;		size->ttmetrics.ppem    = metrics->y_ppem;		size->ttmetrics.x_ratio = FT_MulDiv(metrics->x_ppem,		                                    0x10000L,		                                    metrics->y_ppem);		size->ttmetrics.y_ratio = 0x10000L;	}	/* Compute root ascender, descender, test height, and max_advance */	metrics->ascender    = (FT_MulFix(face->root.ascender,	                                  metrics->y_scale) + 32) & - 64;	metrics->descender   = (FT_MulFix(face->root.descender,	                                  metrics->y_scale) + 32) & - 64;	metrics->height      = (FT_MulFix(face->root.height,	                                  metrics->y_scale) + 32) & - 64;	metrics->max_advance = (FT_MulFix(face->root.max_advance_width,	                                  metrics->x_scale) + 32) & - 64;#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER	{		TT_ExecContext exec;		FT_UInt i, j;		/* Scale the cvt values to the new ppem.          */		/* We use by default the y ppem to scale the CVT. */		for(i = 0; i < size->cvt_size; i++)			size->cvt[i] = FT_MulFix(face->cvt[i], size->ttmetrics.scale);		/* All twilight points are originally zero */		for(j = 0; j < size->twilight.n_points; j++)		{			size->twilight.org[j].x = 0;			size->twilight.org[j].y = 0;			size->twilight.cur[j].x = 0;			size->twilight.cur[j].y = 0;		}		/* clear storage area */		for(i = 0; i < size->storage_size; i++)			size->storage[i] = 0;		size->GS = tt_default_graphics_state;		/* get execution context and run prep program */		if(size->debug)		{			exec = size->context;		}		else		{			exec = TT_New_Context(face);		}		/* debugging instances have their own context */		if(!exec)		{			return TT_Err_Could_Not_Find_Context;		}		TT_Load_Context(exec, face, size);		TT_Set_CodeRange(exec,//.........这里部分代码省略.........
开发者ID:Diskutant,项目名称:RTCW-SP,代码行数:101,


示例26: GetTextBaseLine

bool CGUIFontTTFBase::Load(const std::string& strFilename, float height, float aspect, float lineSpacing, bool border){  // we now know that this object is unique - only the GUIFont objects are non-unique, so no need  // for reference tracking these fonts  m_face = g_freeTypeLibrary.GetFont(strFilename, height, aspect, m_fontFileInMemory);  if (!m_face)    return false;  /*   the values used are described below      XBMC coords                                     Freetype coords                0  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  bbox.yMax, ascender                        A                 /                       A A                |                      A   A               |                      AAAAA  pppp   cellAscender                      A   A  p   p        |                      A   A  p   p        |   m_cellBaseLine  _ _A_ _A_ pppp_ _ _ _ _/_ _ _ _ _  0, base line.                             p            /                             p      cellDescender     m_cellHeight  _ _ _ _ _ p _ _ _ _ _ _/_ _ _ _ _  bbox.yMin, descender   */  int cellDescender = std::min<int>(m_face->bbox.yMin, m_face->descender);  int cellAscender  = std::max<int>(m_face->bbox.yMax, m_face->ascender);  if (border)  {    /*     add on the strength of any border - the non-bordered font needs     aligning with the bordered font by utilising GetTextBaseLine()     */    FT_Pos strength = FT_MulFix( m_face->units_per_EM, m_face->size->metrics.y_scale) / 12;    if (strength < 128)      strength = 128;    cellDescender -= strength;    cellAscender  += strength;    m_stroker = g_freeTypeLibrary.GetStroker();    if (m_stroker)      FT_Stroker_Set(m_stroker, strength, FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0);  }  // scale to pixel sizing, rounding so that maximal extent is obtained  float scaler  = height / m_face->units_per_EM;  cellDescender = MathUtils::round_int(cellDescender * scaler - 0.5f);   // round down  cellAscender  = MathUtils::round_int(cellAscender  * scaler + 0.5f);   // round up  m_cellBaseLine = cellAscender;  m_cellHeight   = cellAscender - cellDescender;  m_height = height;  delete(m_texture);  m_texture = NULL;  delete[] m_char;  m_char = NULL;  m_maxChars = 0;  m_numChars = 0;  m_strFilename = strFilename;  m_textureHeight = 0;  m_textureWidth = ((m_cellHeight * CHARS_PER_TEXTURE_LINE) & ~63) + 64;  m_textureWidth = CBaseTexture::PadPow2(m_textureWidth);  if (m_textureWidth > g_Windowing.GetMaxTextureSize())    m_textureWidth = g_Windowing.GetMaxTextureSize();  m_textureScaleX = 1.0f / m_textureWidth;  // set the posX and posY so that our texture will be created on first character write.  m_posX = m_textureWidth;  m_posY = -(int)GetTextureLineHeight();  // cache the ellipses width  Character *ellipse = GetCharacter(L'.');  if (ellipse) m_ellipsesWidth = ellipse->advance;  return true;}
开发者ID:Elzevir,项目名称:xbmc,代码行数:87,


示例27: psh_blues_scale_zones

  /* reset the blues table when the device transform changes */  static void  psh_blues_scale_zones( PSH_Blues  blues,                         FT_Fixed   scale,                         FT_Pos     delta )  {    FT_UInt         count;    FT_UInt         num;    PSH_Blue_Table  table = 0;    /*                                                        */    /* Determine whether we need to suppress overshoots or    */    /* not.  We simply need to compare the vertical scale     */    /* parameter to the raw bluescale value.  Here is why:    */    /*                                                        */    /*   We need to suppress overshoots for all pointsizes.   */    /*   At 300dpi that satisfies:                            */    /*                                                        */    /*      pointsize < 240*bluescale + 0.49                  */    /*                                                        */    /*   This corresponds to:                                 */    /*                                                        */    /*      pixelsize < 1000*bluescale + 49/24                */    /*                                                        */    /*      scale*EM_Size < 1000*bluescale + 49/24            */    /*                                                        */    /*   However, for normal Type 1 fonts, EM_Size is 1000!   */    /*   We thus only check:                                  */    /*                                                        */    /*      scale < bluescale + 49/24000                      */    /*                                                        */    /*   which we shorten to                                  */    /*                                                        */    /*      "scale < bluescale"                               */    /*                                                        */    /* Note that `blue_scale' is stored 1000 times its real   */    /* value, and that `scale' converts from font units to    */    /* fractional pixels.                                     */    /*                                                        */    /* 1000 / 64 = 125 / 8 */    if ( scale >= 0x20C49BAL )      blues->no_overshoots = FT_BOOL( scale < blues->blue_scale * 8 / 125 );    else      blues->no_overshoots = FT_BOOL( scale * 125 < blues->blue_scale * 8 );    /*                                                        */    /*  The blue threshold is the font units distance under   */    /*  which overshoots are suppressed due to the BlueShift  */    /*  even if the scale is greater than BlueScale.          */    /*                                                        */    /*  It is the smallest distance such that                 */    /*                                                        */    /*    dist <= BlueShift && dist*scale <= 0.5 pixels       */    /*                                                        */    {      FT_Int  threshold = blues->blue_shift;      while ( threshold > 0 && FT_MulFix( threshold, scale ) > 32 )        threshold--;      blues->blue_threshold = threshold;    }    for ( num = 0; num < 4; num++ )    {      PSH_Blue_Zone  zone;      switch ( num )      {      case 0:        table = &blues->normal_top;        break;      case 1:        table = &blues->normal_bottom;        break;      case 2:        table = &blues->family_top;        break;      default:        table = &blues->family_bottom;        break;      }      zone  = table->zones;      count = table->count;      for ( ; count > 0; count--, zone++ )      {        zone->cur_top    = FT_MulFix( zone->org_top,    scale ) + delta;        zone->cur_bottom = FT_MulFix( zone->org_bottom, scale ) + delta;        zone->cur_ref    = FT_MulFix( zone->org_ref,    scale ) + delta;        zone->cur_delta  = FT_MulFix( zone->org_delta,  scale );        /* round scaled reference position */        zone->cur_ref = FT_PIX_ROUND( zone->cur_ref );#if 0        if ( zone->cur_ref > zone->cur_top )//.........这里部分代码省略.........
开发者ID:gzwplato,项目名称:VersyPDF,代码行数:101,



注:本文中的FT_MulFix函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FT_NEW函数代码示例
C++ FT_MulDiv函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。