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

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

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

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

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

示例1: pfr_get_kerning

  pfr_get_kerning( FT_Face     pfrface,     /* PFR_Face */                   FT_UInt     left,                   FT_UInt     right,                   FT_Vector  *avector )  {    PFR_Face     face = (PFR_Face)pfrface;    PFR_PhyFont  phys = &face->phy_font;    pfr_face_get_kerning( pfrface, left, right, avector );    /* convert from metrics to outline units when necessary */    if ( phys->outline_resolution != phys->metrics_resolution )    {      if ( avector->x != 0 )        avector->x = FT_MulDiv( avector->x, phys->outline_resolution,                                            phys->metrics_resolution );      if ( avector->y != 0 )        avector->y = FT_MulDiv( avector->x, phys->outline_resolution,                                            phys->metrics_resolution );    }    return PFR_Err_Ok;  }
开发者ID:BlairArchibald,项目名称:Alexandria,代码行数:25,


示例2: pfr_get_kerning

  static FT_Error  pfr_get_kerning( PFR_Face    face,                   FT_UInt     left,                   FT_UInt     right,                   FT_Vector  *avector )  {    FT_Error  error;    error = pfr_face_get_kerning( face, left, right, avector );    if ( !error )    {      PFR_PhyFont  phys = &face->phy_font;      /* convert from metrics to outline units when necessary */      if ( phys->outline_resolution != phys->metrics_resolution )      {        if ( avector->x != 0 )          avector->x = FT_MulDiv( avector->x, phys->outline_resolution,                                              phys->metrics_resolution );        if ( avector->y != 0 )          avector->y = FT_MulDiv( avector->x, phys->outline_resolution,                                              phys->metrics_resolution );      }    }    return error;  }
开发者ID:stefanhendriks,项目名称:dune2themaker,代码行数:27,


示例3: cff_size_select

  cff_size_select( FT_Size   size,                   FT_ULong  strike_index )  {    CFF_Size           cffsize = (CFF_Size)size;    PSH_Globals_Funcs  funcs;    cffsize->strike_index = strike_index;    FT_Select_Metrics( size->face, strike_index );    funcs = cff_size_get_globals_funcs( cffsize );    if ( funcs )    {      CFF_Face      face     = (CFF_Face)size->face;      CFF_Font      font     = (CFF_Font)face->extra.data;      CFF_Internal  internal = (CFF_Internal)size->internal;      FT_ULong  top_upm  = font->top_font.font_dict.units_per_em;      FT_UInt   i;      funcs->set_scale( internal->topfont,                        size->metrics.x_scale, size->metrics.y_scale,                        0, 0 );      for ( i = font->num_subfonts; i > 0; i-- )      {        CFF_SubFont  sub     = font->subfonts[i - 1];        FT_ULong     sub_upm = sub->font_dict.units_per_em;        FT_Pos       x_scale, y_scale;        if ( top_upm != sub_upm )        {          x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );          y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );        }        else        {          x_scale = size->metrics.x_scale;          y_scale = size->metrics.y_scale;        }        funcs->set_scale( internal->subfonts[i - 1],                          x_scale, y_scale, 0, 0 );      }    }    return FT_Err_Ok;  }
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:52,


示例4: ah_test_extremum

  /* the fill direction of given bbox extremum                       */  static FT_Int  ah_test_extremum( FT_Outline*  outline,                    FT_Int       n )  {    FT_Vector  *prev, *cur, *next;    FT_Pos      product;    FT_Int      first, last, c;    FT_Int      retval;    /* we need to compute the `previous' and `next' point */    /* for this extremum; we check whether the extremum   */    /* is start or end of a contour and providing         */    /* appropriate values if so                           */    cur  = outline->points + n;    prev = cur - 1;    next = cur + 1;    first = 0;    for ( c = 0; c < outline->n_contours; c++ )    {      last = outline->contours[c];      if ( n == first )        prev = outline->points + last;      if ( n == last )        next = outline->points + first;      first = last + 1;    }    /* compute the vectorial product -- since we know that the angle */    /* is <= 180 degrees (otherwise it wouldn't be an extremum) we   */    /* can determine the filling orientation if the product is       */    /* either positive or negative                                   */    product = FT_MulDiv( cur->x  - prev->x,  /* in.x  */                         next->y - cur->y,   /* out.y */                         0x40 )              -              FT_MulDiv( cur->y  - prev->y,  /* in.y  */                         next->x - cur->x,   /* out.x */                         0x40 );    retval = 0;    if ( product )      retval = product > 0 ? 2 : 1;    return retval;  }
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:51,


示例5: BBox_Conic_Check

  static void  BBox_Conic_Check( FT_Pos   y1,                    FT_Pos   y2,                    FT_Pos   y3,                    FT_Pos*  min,                    FT_Pos*  max )  {    if ( y1 <= y3 && y2 == y1 )     /* flat arc */      goto Suite;    if ( y1 < y3 )    {      if ( y2 >= y1 && y2 <= y3 )   /* ascending arc */        goto Suite;    }    else    {      if ( y2 >= y3 && y2 <= y1 )   /* descending arc */      {        y2 = y1;        y1 = y3;        y3 = y2;        goto Suite;      }    }    y1 = y3 = y1 - FT_MulDiv( y2 - y1, y2 - y1, y1 - 2*y2 + y3 );  Suite:    if ( y1 < *min ) *min = y1;    if ( y3 > *max ) *max = y3;  }
开发者ID:03050903,项目名称:godot,代码行数:32,


示例6: _ft_face_scale_advances

  static FT_Error  _ft_face_scale_advances( FT_Face    face,                           FT_Fixed*  advances,                           FT_UInt    count,                           FT_Int32   flags )  {    FT_Fixed  scale;    FT_UInt   nn;    if ( flags & FT_LOAD_NO_SCALE )      return FT_Err_Ok;    if ( face->size == NULL )      return FT_THROW( Invalid_Size_Handle );    if ( flags & FT_LOAD_VERTICAL_LAYOUT )      scale = face->size->metrics.y_scale;    else      scale = face->size->metrics.x_scale;    /* this must be the same scaling as to get linear{Hori,Vert}Advance */    /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c)        */    for ( nn = 0; nn < count; nn++ )      advances[nn] = FT_MulDiv( advances[nn], scale, 64 );    return FT_Err_Ok;  }
开发者ID:theqvd,项目名称:vcxsrv,代码行数:29,


示例7: T1_Get_Track_Kerning

  T1_Get_Track_Kerning( FT_Face    face,                        FT_Fixed   ptsize,                        FT_Int     degree,                        FT_Fixed*  kerning )  {    AFM_FontInfo  fi = (AFM_FontInfo)( (T1_Face)face )->afm_data;    FT_Int        i;    if ( !fi )      return FT_THROW( Invalid_Argument );    for ( i = 0; i < fi->NumTrackKern; i++ )    {      AFM_TrackKern  tk = fi->TrackKerns + i;      if ( tk->degree != degree )        continue;      if ( ptsize < tk->min_ptsize )        *kerning = tk->min_kern;      else if ( ptsize > tk->max_ptsize )        *kerning = tk->max_kern;      else      {        *kerning = FT_MulDiv( ptsize - tk->min_ptsize,                              tk->max_kern - tk->min_kern,                              tk->max_ptsize - tk->min_ptsize ) +                   tk->min_kern;      }    }    return FT_Err_Ok;  }
开发者ID:dmdware,项目名称:vec,代码行数:35,


示例8: ah_test_extrema

  /* the fill direction of a given bbox extrema                      */  static FT_Int  ah_test_extrema( FT_Outline*  outline,                   FT_Int       n )  {    FT_Vector  *prev, *cur, *next;    FT_Pos      product;    FT_Int      first, last, c;    FT_Int      retval;    /* we need to compute the `previous' and `next' point */    /* for these extrema                                  */    cur  = outline->points + n;    prev = cur - 1;    next = cur + 1;    first = 0;    for ( c = 0; c < outline->n_contours; c++ )    {      last  = outline->contours[c];      if ( n == first )        prev = outline->points + last;      if ( n == last )        next = outline->points + first;      first = last + 1;    }    product = FT_MulDiv( cur->x  - prev->x,  /* in.x  */                         next->y - cur->y,   /* out.y */                         0x40 )              -              FT_MulDiv( cur->y  - prev->y,  /* in.y  */                         next->x - cur->x,   /* out.x */                         0x40 );    retval = 0;    if ( product )      retval = product > 0 ? 2 : 1;    return retval;  }
开发者ID:AudriusButkevicius,项目名称:TurboVNC,代码行数:45,


示例9: tt_size_request

static FT_Errortt_size_request( FT_Size          size,                 FT_Size_Request  req ){    TT_Size   ttsize = (TT_Size)size;    FT_Error  error  = FT_Err_Ok;#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS    if ( FT_HAS_FIXED_SIZES( size->face ) )    {        TT_Face       ttface = (TT_Face)size->face;        SFNT_Service  sfnt   = (SFNT_Service)ttface->sfnt;        FT_ULong      strike_index;        error = sfnt->set_sbit_strike( ttface, req, &strike_index );        if ( error )            ttsize->strike_index = 0xFFFFFFFFUL;        else            return tt_size_select( size, strike_index );    }#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */    FT_Request_Metrics( size->face, req );    if ( FT_IS_SCALABLE( size->face ) )    {        error = tt_size_reset( ttsize );        ttsize->root.metrics = ttsize->metrics;#ifdef TT_USE_BYTECODE_INTERPRETER        /* for the `MPS' bytecode instruction we need the point size */        {            FT_UInt  resolution = ttsize->metrics.x_ppem > ttsize->metrics.y_ppem                                  ? req->horiResolution                                  : req->vertResolution;            /* if we don't have a resolution value, assume 72dpi */            if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES ||                    !resolution                              )                resolution = 72;            ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem,                                            64 * 72,                                            resolution );        }#endif    }    return error;}
开发者ID:android,项目名称:platform_external_freetype,代码行数:56,


示例10: BBox_Conic_Check

  static void  BBox_Conic_Check( FT_Pos   y1,                    FT_Pos   y2,                    FT_Pos   y3,                    FT_Pos*  min,                    FT_Pos*  max )  {    /* This function is only called when a control off-point is outside */    /* the bbox that contains all on-points.  It finds a local extremum */    /* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3).   */    /* Or, offsetting from y2, we get                                   */    y1 -= y2;    y3 -= y2;    y2 += FT_MulDiv( y1, y3, y1 + y3 );    if ( y2 < *min )      *min = y2;    if ( y2 > *max )      *max = y2;  }
开发者ID:ONLYOFFICE,项目名称:core,代码行数:21,


示例11: pfr_slot_load

  pfr_slot_load( FT_GlyphSlot  pfrslot,         /* PFR_Slot */                 FT_Size       pfrsize,         /* PFR_Size */                 FT_UInt       gindex,                 FT_Int32      load_flags )  {    PFR_Slot     slot    = (PFR_Slot)pfrslot;    PFR_Size     size    = (PFR_Size)pfrsize;    FT_Error     error;    PFR_Face     face    = (PFR_Face)pfrslot->face;    PFR_Char     gchar;    FT_Outline*  outline = &pfrslot->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;    }    if ( load_flags & FT_LOAD_SBITS_ONLY )    {      error = PFR_Err_Invalid_Argument;      goto Exit;    }    gchar               = face->phy_font.chars + gindex;    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 );//.........这里部分代码省略.........
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:101,


示例12: 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,


示例13: FT_Outline_Get_Orientation

//.........这里部分代码省略.........        if ( point->x > contour_xmax )          contour_xmax = point->x;        if ( point->y < contour_ymin )          contour_ymin = point->y;        if ( point->y > contour_ymax )          contour_ymax = point->y;      }      if ( contour_xmin < xmin          &&           contour_xmin != contour_xmax &&           contour_ymin != contour_ymax )      {        xmin       = contour_xmin;        xmin_ymin  = contour_ymin;        xmin_ymax  = contour_ymax;        xmin_first = first;        xmin_last  = last;      }    }    if ( xmin == 32768 )      return FT_ORIENTATION_TRUETYPE;    ray_y[0] = ( xmin_ymin * 3 + xmin_ymax     ) >> 2;    ray_y[1] = ( xmin_ymin     + xmin_ymax     ) >> 1;    ray_y[2] = ( xmin_ymin     + xmin_ymax * 3 ) >> 2;    for ( i = 0; i < 3; i++ )    {      FT_Pos      left_x;      FT_Pos      right_x;      FT_Vector*  left1;      FT_Vector*  left2;      FT_Vector*  right1;      FT_Vector*  right2;    RedoRay:      left_x  = 32768L;      right_x = -32768L;      left1 = left2 = right1 = right2 = NULL;      prev = xmin_last;      for ( point = xmin_first; point <= xmin_last; prev = point, ++point )      {        FT_Pos  tmp_x;        if ( point->y == ray_y[i] || prev->y == ray_y[i] )        {          ray_y[i]++;          goto RedoRay;        }        if ( ( point->y < ray_y[i] && prev->y < ray_y[i] ) ||             ( point->y > ray_y[i] && prev->y > ray_y[i] ) )          continue;        tmp_x = FT_MulDiv( point->x - prev->x,                           ray_y[i] - prev->y,                           point->y - prev->y ) + prev->x;        if ( tmp_x < left_x )        {          left_x = tmp_x;          left1  = prev;          left2  = point;        }        if ( tmp_x > right_x )        {          right_x = tmp_x;          right1  = prev;          right2  = point;        }      }      if ( left1 && right1 )      {        if ( left1->y < left2->y && right1->y > right2->y )          result[i] = FT_ORIENTATION_TRUETYPE;        else if ( left1->y > left2->y && right1->y < right2->y )          result[i] = FT_ORIENTATION_POSTSCRIPT;        else          result[i] = FT_ORIENTATION_NONE;      }    }    if ( result[0] != FT_ORIENTATION_NONE                     &&         ( result[0] == result[1] || result[0] == result[2] ) )      return result[0];    if ( result[1] != FT_ORIENTATION_NONE && result[1] == result[2] )      return result[1];    return FT_ORIENTATION_TRUETYPE;  }
开发者ID:ShaneIsley,项目名称:challengeq3,代码行数:101,


示例14: cf2_blues_init

//.........这里部分代码省略.........          diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );          if ( diff < minDiff && diff < csUnitsPerPixel )          {            blues->zone[i].csFlatEdge = flatFamilyEdge;            minDiff                   = diff;            if ( diff == 0 )              break;          }        }      }    }    /* TODO: enforce separation of zones, including BlueFuzz */    /* Adjust BlueScale; similar to AdjustBlueScale() in coretype */    /* `bcsetup.c'.                                               */    if ( maxZoneHeight > 0 )    {      if ( blues->blueScale > FT_DivFix( cf2_intToFixed( 1 ),                                         maxZoneHeight ) )      {        /* clamp at maximum scale */        blues->blueScale = FT_DivFix( cf2_intToFixed( 1 ),                                      maxZoneHeight );      }      /*       * TODO: Revisit the bug fix for 613448.  The minimum scale       *       requirement catches a number of library fonts.  For       *       example, with default BlueScale (.039625) and 0.4 minimum,       *       the test below catches any font with maxZoneHeight < 10.1.       *       There are library fonts ranging from 2 to 10 that get       *       caught, including e.g., Eurostile LT Std Medium with       *       maxZoneHeight of 6.       *       */#if 0      if ( blueScale < .4 / maxZoneHeight )      {        tetraphilia_assert( 0 );        /* clamp at minimum scale, per bug 0613448 fix */        blueScale = .4 / maxZoneHeight;      }#endif    }    /*     * Suppress overshoot and boost blue zones at small sizes.  Boost     * amount varies linearly from 0.5 pixel near 0 to 0 pixel at     * blueScale cutoff.     * Note: This boost amount is different from the coretype heuristic.     *     */    if ( blues->scale < blues->blueScale )    {      blues->suppressOvershoot = TRUE;      /* Change rounding threshold for `dsFlatEdge'.                    */      /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */      /*       10ppem Arial                                             */      blues->boost = cf2_doubleToFixed( .6 ) -                       FT_MulDiv( cf2_doubleToFixed ( .6 ),                                  blues->scale,                                  blues->blueScale );      if ( blues->boost > 0x7FFF )      {        /* boost must remain less than 0.5, or baseline could go negative */        blues->boost = 0x7FFF;      }    }    /* boost and darkening have similar effects; don't do both */    if ( font->stemDarkened )      blues->boost = 0;    /* set device space alignment for each zone;    */    /* apply boost amount before rounding flat edge */    for ( i = 0; i < blues->count; i++ )    {      if ( blues->zone[i].bottomZone )        blues->zone[i].dsFlatEdge = cf2_fixedRound(                                      FT_MulFix(                                        blues->zone[i].csFlatEdge,                                        blues->scale ) -                                      blues->boost );      else        blues->zone[i].dsFlatEdge = cf2_fixedRound(                                      FT_MulFix(                                        blues->zone[i].csFlatEdge,                                        blues->scale ) +                                      blues->boost );    }  }
开发者ID:93i,项目名称:godot,代码行数:101,


示例15: cff_face_init

//.........这里部分代码省略.........      for ( i = cff->num_subfonts; i > 0; i-- )      {        CFF_FontRecDict  sub = &cff->subfonts[i - 1]->font_dict;        CFF_FontRecDict  top = &cff->top_font.font_dict;        FT_Matrix*  matrix;        FT_Vector*  offset;        FT_ULong*   upm;        FT_Fixed    temp;        if ( sub->has_font_matrix )        {          FT_Long  scaling;          /* if we have a top-level matrix, */          /* concatenate the subfont matrix */          if ( top->has_font_matrix )          {            if ( top->units_per_em > 1 && sub->units_per_em > 1 )              scaling = FT_MIN( top->units_per_em, sub->units_per_em );            else              scaling = 1;            FT_Matrix_Multiply_Scaled( &top->font_matrix,                                       &sub->font_matrix,                                       scaling );            FT_Vector_Transform_Scaled( &sub->font_offset,                                        &top->font_matrix,                                        scaling );            sub->units_per_em = FT_MulDiv( sub->units_per_em,                                           top->units_per_em,                                           scaling );          }        }        else        {          sub->font_matrix = top->font_matrix;          sub->font_offset = top->font_offset;          sub->units_per_em = top->units_per_em;        }        matrix = &sub->font_matrix;        offset = &sub->font_offset;        upm    = &sub->units_per_em;        temp   = FT_ABS( matrix->yy );        if ( temp != 0x10000L )        {          *upm = FT_DivFix( *upm, temp );          matrix->xx = FT_DivFix( matrix->xx, temp );          matrix->yx = FT_DivFix( matrix->yx, temp );          matrix->xy = FT_DivFix( matrix->xy, temp );          matrix->yy = FT_DivFix( matrix->yy, temp );          offset->x  = FT_DivFix( offset->x,  temp );          offset->y  = FT_DivFix( offset->y,  temp );        }        offset->x >>= 16;        offset->y >>= 16;      }
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:67,


示例16: 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,


示例17: cf2_computeDarkening

  /* Compute a stem darkening amount in character space. */  static void  cf2_computeDarkening( CF2_Fixed   emRatio,                        CF2_Fixed   ppem,                        CF2_Fixed   stemWidth,                        CF2_Fixed*  darkenAmount,                        CF2_Fixed   boldenAmount,                        FT_Bool     stemDarkened,                        FT_Int*     darkenParams )  {    /*     * Total darkening amount is computed in 1000 unit character space     * using the modified 5 part curve as Adobe's Avalon rasterizer.     * The darkening amount is smaller for thicker stems.     * It becomes zero when the stem is thicker than 2.333 pixels.     *     * By default, we use     *     *   darkenAmount = 0.4 pixels   if scaledStem <= 0.5 pixels,     *   darkenAmount = 0.275 pixels if 1 <= scaledStem <= 1.667 pixels,     *   darkenAmount = 0 pixel      if scaledStem >= 2.333 pixels,     *     * and piecewise linear in-between:     *     *     *   darkening     *       ^     *       |     *       |      (x1,y1)     *       |--------+     *       |         /     *       |          /     *       |           /          (x3,y3)     *       |            +----------+     *       |        (x2,y2)         /     *       |                         /     *       |                          /     *       |                           +-----------------     *       |                         (x4,y4)     *       +--------------------------------------------->   stem     *                                                       thickness     *     *     * This corresponds to the following values for the     * `darkening-parameters' property:     *     *   (x1, y1) = (500, 400)     *   (x2, y2) = (1000, 275)     *   (x3, y3) = (1667, 275)     *   (x4, y4) = (2333, 0)     *     */    /* Internal calculations are done in units per thousand for */    /* convenience. The x axis is scaled stem width in          */    /* thousandths of a pixel. That is, 1000 is 1 pixel.        */    /* The y axis is darkening amount in thousandths of a pixel.*/    /* In the code, below, dividing by ppem and                 */    /* adjusting for emRatio converts darkenAmount to character */    /* space (font units).                                      */    CF2_Fixed  stemWidthPer1000, scaledStem;    FT_Int     logBase2;    *darkenAmount = 0;    if ( boldenAmount == 0 && !stemDarkened )      return;    /* protect against range problems and divide by zero */    if ( emRatio < cf2_floatToFixed( .01 ) )      return;    if ( stemDarkened )    {      FT_Int  x1 = darkenParams[0];      FT_Int  y1 = darkenParams[1];      FT_Int  x2 = darkenParams[2];      FT_Int  y2 = darkenParams[3];      FT_Int  x3 = darkenParams[4];      FT_Int  y3 = darkenParams[5];      FT_Int  x4 = darkenParams[6];      FT_Int  y4 = darkenParams[7];      /* convert from true character space to 1000 unit character space; */      /* add synthetic emboldening effect                                */      /* `stemWidthPer1000' will not overflow for a legitimate font      */      stemWidthPer1000 = FT_MulFix( stemWidth + boldenAmount, emRatio );      /* `scaledStem' can easily overflow, so we must clamp its maximum  */      /* value; the test doesn't need to be precise, but must be         */      /* conservative.  The clamp value (default 2333) where             */      /* `darkenAmount' is zero is well below the overflow value of      */      /* 32767.                                                          */      /*                                                                 */      /* FT_MSB computes the integer part of the base 2 logarithm.  The  */      /* number of bits for the product is 1 or 2 more than the sum of   *///.........这里部分代码省略.........
开发者ID:structuresound,项目名称:freetype,代码行数:101,


示例18: af_cjk_hint_edges

//.........这里部分代码省略.........        edge1 = edges;        edge2 = edges + 2;        edge3 = edges + 4;      }      else      {        edge1 = edges + 1;        edge2 = edges + 5;        edge3 = edges + 9;      }      dist1 = edge2->opos - edge1->opos;      dist2 = edge3->opos - edge2->opos;      span = dist1 - dist2;      if ( span < 0 )        span = -span;      if ( edge1->link == edge1 + 1 &&           edge2->link == edge2 + 1 &&           edge3->link == edge3 + 1 && span < 8 )      {        delta = edge3->pos - ( 2 * edge2->pos - edge1->pos );        edge3->pos -= delta;        if ( edge3->link )          edge3->link->pos -= delta;        /* move the serifs along with the stem */        if ( n_edges == 12 )        {          ( edges + 8 )->pos -= delta;          ( edges + 11 )->pos -= delta;        }        edge3->flags |= AF_EDGE_DONE;        if ( edge3->link )          edge3->link->flags |= AF_EDGE_DONE;      }    }    if ( !skipped )      return;    /*     *  now hint the remaining edges (serifs and single) in order     *  to complete our processing     */    for ( edge = edges; edge < edge_limit; edge++ )    {      if ( edge->flags & AF_EDGE_DONE )        continue;      if ( edge->serif )      {        af_cjk_align_serif_edge( hints, edge->serif, edge );        edge->flags |= AF_EDGE_DONE;        skipped--;      }    }    if ( !skipped )      return;    for ( edge = edges; edge < edge_limit; edge++ )    {      AF_Edge  before, after;      if ( edge->flags & AF_EDGE_DONE )        continue;      before = after = edge;      while ( --before >= edges )        if ( before->flags & AF_EDGE_DONE )          break;      while ( ++after < edge_limit )        if ( after->flags & AF_EDGE_DONE )          break;      if ( before >= edges || after < edge_limit )      {        if ( before < edges )          af_cjk_align_serif_edge( hints, after, edge );        else if ( after >= edge_limit )          af_cjk_align_serif_edge( hints, before, edge );        else        {          if ( after->fpos == before->fpos )            edge->pos = before->pos;          else            edge->pos = before->pos +                        FT_MulDiv( edge->fpos - before->fpos,                                   after->pos - before->pos,                                   after->fpos - before->fpos );        }      }    }  }
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:101,


示例19: 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,


示例20: 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,


示例21: FT_Outline_EmboldenXY

  FT_Outline_EmboldenXY( FT_Outline*  outline,                         FT_Pos       xstrength,                         FT_Pos       ystrength )  {    FT_Vector*  points;    FT_Int      c, first, last;    FT_Int      orientation;    if ( !outline )      return FT_THROW( Invalid_Outline );    xstrength /= 2;    ystrength /= 2;    if ( xstrength == 0 && ystrength == 0 )      return FT_Err_Ok;    orientation = FT_Outline_Get_Orientation( outline );    if ( orientation == FT_ORIENTATION_NONE )    {      if ( outline->n_contours )        return FT_THROW( Invalid_Argument );      else        return FT_Err_Ok;    }    points = outline->points;    first = 0;    for ( c = 0; c < outline->n_contours; c++ )    {      FT_Vector  in, out, anchor, shift;      FT_Fixed   l_in, l_out, l_anchor = 0, l, q, d;      FT_Int     i, j, k;      l_in = 0;      last = outline->contours[c];      /* pacify compiler */      in.x = in.y = anchor.x = anchor.y = 0;      /* Counter j cycles though the points; counter i advances only  */      /* when points are moved; anchor k marks the first moved point. */      for ( i = last, j = first, k = -1;            j != i && i != k;            j = j < last ? j + 1 : first )      {        if ( j != k )        {          out.x = points[j].x - points[i].x;          out.y = points[j].y - points[i].y;          l_out = (FT_Fixed)FT_Vector_NormLen( &out );          if ( l_out == 0 )            continue;        }        else        {          out   = anchor;          l_out = l_anchor;        }        if ( l_in != 0 )        {          if ( k < 0 )          {            k        = i;            anchor   = in;            l_anchor = l_in;          }          d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );          /* shift only if turn is less than ~160 degrees */          if ( d > -0xF000L )          {            d = d + 0x10000L;            /* shift components along lateral bisector in proper orientation */            shift.x = in.y + out.y;            shift.y = in.x + out.x;            if ( orientation == FT_ORIENTATION_TRUETYPE )              shift.x = -shift.x;            else              shift.y = -shift.y;            /* restrict shift magnitude to better handle collapsing segments */            q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x );            if ( orientation == FT_ORIENTATION_TRUETYPE )              q = -q;            l = FT_MIN( l_in, l_out );            /* non-strict inequalities avoid divide-by-zero when q == l == 0 */            if ( FT_MulFix( xstrength, q ) <= FT_MulFix( l, d ) )              shift.x = FT_MulDiv( shift.x, xstrength, d );            else              shift.x = FT_MulDiv( shift.x, l, q );//.........这里部分代码省略.........
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:101,


示例22: FT_Outline_EmboldenXY

  FT_Outline_EmboldenXY( FT_Outline*  outline,                         FT_Pos       xstrength,                         FT_Pos       ystrength )  {    FT_Vector*  points;    FT_Vector   v_prev, v_first, v_next, v_cur;    FT_Int      c, n, first;    FT_Int      orientation;    if ( !outline )      return FT_Err_Invalid_Argument;    xstrength /= 2;    ystrength /= 2;    if ( xstrength == 0 && ystrength == 0 )      return FT_Err_Ok;    orientation = FT_Outline_Get_Orientation( outline );    if ( orientation == FT_ORIENTATION_NONE )    {      if ( outline->n_contours )        return FT_Err_Invalid_Argument;      else        return FT_Err_Ok;    }    points = outline->points;    first = 0;    for ( c = 0; c < outline->n_contours; c++ )    {      FT_Vector  in, out, shift;      FT_Fixed   l_in, l_out, l, q, d;      int        last = outline->contours[c];      v_first = points[first];      v_prev  = points[last];      v_cur   = v_first;      /* compute the incoming vector and its length */      in.x = v_cur.x - v_prev.x;      in.y = v_cur.y - v_prev.y;      l_in = FT_Vector_Length( &in );      for ( n = first; n <= last; n++ )      {        if ( n < last )          v_next = points[n + 1];        else          v_next = v_first;        /* compute the outgoing vector and its length */        out.x = v_next.x - v_cur.x;        out.y = v_next.y - v_cur.y;        l_out = FT_Vector_Length( &out );        d = l_in * l_out + in.x * out.x + in.y * out.y;        /* shift only if turn is less then ~160 degrees */        if ( 16 * d > l_in * l_out )        {          /* shift components are aligned along bisector        */          /* and directed according to the outline orientation. */          shift.x = l_out * in.y + l_in * out.y;          shift.y = l_out * in.x + l_in * out.x;          if ( orientation == FT_ORIENTATION_TRUETYPE )            shift.x = -shift.x;          else            shift.y = -shift.y;          /* threshold strength to better handle collapsing segments */          l = FT_MIN( l_in, l_out );          q = out.x * in.y - out.y * in.x;          if ( orientation == FT_ORIENTATION_TRUETYPE )            q = -q;          if ( FT_MulDiv( xstrength, q, l ) < d )            shift.x = FT_MulDiv( shift.x, xstrength, d );          else            shift.x = FT_MulDiv( shift.x, l, q );                    if ( FT_MulDiv( ystrength, q, l ) < d )            shift.y = FT_MulDiv( shift.y, ystrength, d );          else            shift.y = FT_MulDiv( shift.y, l, q );        }        else          shift.x = shift.y = 0;        outline->points[n].x = v_cur.x + xstrength + shift.x;        outline->points[n].y = v_cur.y + ystrength + shift.y;        in    = out;        l_in  = l_out;        v_cur = v_next;      }//.........这里部分代码省略.........
开发者ID:568210356,项目名称:fancy2d,代码行数:101,


示例23: cff_size_request

  cff_size_request( FT_Size          size,                    FT_Size_Request  req )  {    CFF_Size           cffsize = (CFF_Size)size;    PSH_Globals_Funcs  funcs;#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS    if ( FT_HAS_FIXED_SIZES( size->face ) )    {      CFF_Face      cffface = (CFF_Face)size->face;      SFNT_Service  sfnt    = (SFNT_Service)cffface->sfnt;      FT_ULong      strike_index;      if ( sfnt->set_sbit_strike( cffface, req, &strike_index ) )        cffsize->strike_index = 0xFFFFFFFFUL;      else        return cff_size_select( size, strike_index );    }#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */    FT_Request_Metrics( size->face, req );    funcs = cff_size_get_globals_funcs( cffsize );    if ( funcs )    {      CFF_Face      cffface  = (CFF_Face)size->face;      CFF_Font      font     = (CFF_Font)cffface->extra.data;      CFF_Internal  internal = (CFF_Internal)size->internal;      FT_ULong  top_upm  = font->top_font.font_dict.units_per_em;      FT_UInt   i;      funcs->set_scale( internal->topfont,                        size->metrics.x_scale, size->metrics.y_scale,                        0, 0 );      for ( i = font->num_subfonts; i > 0; i-- )      {        CFF_SubFont  sub     = font->subfonts[i - 1];        FT_ULong     sub_upm = sub->font_dict.units_per_em;        FT_Pos       x_scale, y_scale;        if ( top_upm != sub_upm )        {          x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );          y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );        }        else        {          x_scale = size->metrics.x_scale;          y_scale = size->metrics.y_scale;        }        funcs->set_scale( internal->subfonts[i - 1],                          x_scale, y_scale, 0, 0 );      }    }    return FT_Err_Ok;  }
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:67,


示例24: cff_slot_load

//.........这里部分代码省略.........        }      }    }#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */    /* return immediately if we only want the embedded bitmaps */    if ( load_flags & FT_LOAD_SBITS_ONLY )      return FT_THROW( Invalid_Argument );    /* if we have a CID subfont, use its matrix (which has already */    /* been multiplied with the root matrix)                       */    /* this scaling is only relevant if the PS hinter isn't active */    if ( cff->num_subfonts )    {      FT_Long  top_upm, sub_upm;      FT_Byte  fd_index = cff_fd_select_get( &cff->fd_select,                                             glyph_index );      if ( fd_index >= cff->num_subfonts )        fd_index = (FT_Byte)( cff->num_subfonts - 1 );      top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;      sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;      font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;      font_offset = cff->subfonts[fd_index]->font_dict.font_offset;      if ( top_upm != sub_upm )      {        glyph->x_scale = FT_MulDiv( glyph->x_scale, top_upm, sub_upm );        glyph->y_scale = FT_MulDiv( glyph->y_scale, top_upm, sub_upm );        force_scaling = TRUE;      }    }    else    {      font_matrix = cff->top_font.font_dict.font_matrix;      font_offset = cff->top_font.font_dict.font_offset;    }    glyph->root.outline.n_points   = 0;    glyph->root.outline.n_contours = 0;    /* top-level code ensures that FT_LOAD_NO_HINTING is set */    /* if FT_LOAD_NO_SCALE is active                         */    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );    scaled  = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 );    glyph->hint        = hinting;    glyph->scaled      = scaled;    glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;  /* by default */    {#ifdef CFF_CONFIG_OPTION_OLD_ENGINE      PS_Driver  driver = (PS_Driver)FT_FACE_DRIVER( face );#endif      FT_Byte*  charstring;      FT_ULong  charstring_len;
开发者ID:93i,项目名称:godot,代码行数:66,


示例25: cff_face_init

//.........这里部分代码省略.........        offset->x >>= 16;        offset->y >>= 16;      }      for ( i = cff->num_subfonts; i > 0; i-- )      {        CFF_FontRecDict  sub = &cff->subfonts[i - 1]->font_dict;        CFF_FontRecDict  top = &cff->top_font.font_dict;        FT_Matrix*  matrix;        FT_Vector*  offset;        FT_ULong*   upm;        FT_Fixed    temp;        if ( sub->units_per_em )        {          FT_Int  scaling;          if ( top->units_per_em > 1 && sub->units_per_em > 1 )            scaling = FT_MIN( top->units_per_em, sub->units_per_em );          else            scaling = 1;          FT_Matrix_Multiply_Scaled( &top->font_matrix,                                     &sub->font_matrix,                                     scaling );          FT_Vector_Transform_Scaled( &sub->font_offset,                                      &top->font_matrix,                                      scaling );          sub->units_per_em = FT_MulDiv( sub->units_per_em,                                         top->units_per_em,                                         scaling );        }        else        {          sub->font_matrix = top->font_matrix;          sub->font_offset = top->font_offset;          sub->units_per_em = top->units_per_em;        }        matrix = &sub->font_matrix;        offset = &sub->font_offset;        upm    = &sub->units_per_em;        temp   = FT_ABS( matrix->yy );        if ( temp != 0x10000L )        {          *upm = FT_DivFix( *upm, temp );          /* if *upm is larger than 100*1000 we divide by 1000 --     */          /* this can happen if e.g. there is no top-font FontMatrix  */          /* and the subfont FontMatrix already contains the complete */          /* scaling for the subfont (see section 5.11 of the PLRM)   */          /* 100 is a heuristic value */          if ( *upm > 100L * 1000L )            *upm = ( *upm + 500 ) / 1000;          matrix->xx = FT_DivFix( matrix->xx, temp );          matrix->yx = FT_DivFix( matrix->yx, temp );
开发者ID:AVarfolomeev,项目名称:picasso-graphic,代码行数:67,



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


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