⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttapi.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
                                TT_ULong        fontIndex,                                TT_Face*        aface )  {    if (!engine)      return TT_Err_Invalid_Driver_Handle;    return open_face( (FT_Library)engine, pathname, fontIndex, aface );  }  /***********************************************************************/  /*                                                                     */  /* <Function> TT_Close_Face                                            */  /*                                                                     */  /* <Description>                                                       */  /*    Destroys a given face object opened through either TT_Open_Face  */  /*    of TT_Open_Collection.                                           */  /*                                                                     */  /* <Input>                                                             */  /*    face  :: handle to the target face object                        */  /*                                                                     */  /* <Return>                                                            */  /*    TrueType error code. 0 means success                             */  /*                                                                     */  /* <MT-Note>                                                           */  /*    No.                                                              */  /*                                                                     */  /* <Note>                                                              */  /*    This API is provided for backwards compatibility. Please use     */  /*    the functions TT_New_Face/TT_Done_Face now to create and         */  /*    discard face/collection objects.                                 */  /*                                                                     */  EXPORT_DEF  TT_Error  TT_Close_Face( TT_Face  face )  {    FT_Resource  resource;        if (!face)      return TT_Err_Invalid_Face_Handle;    resource = face->root.resource;    FT_Done_Face( (FT_Face)face );    /* uninstall corresponding resource */    FT_Done_Resource( resource );    return TT_Err_Ok;  }  /***********************************************************************/  /***********************************************************************/  /***********************************************************************/  /***********************************************************************/  /***********                                                 ***********/  /***********   End of backwards compatible APIs..            ***********/  /***********                                                 ***********/  /***********************************************************************/  /***********************************************************************/  /***********************************************************************/  /***********************************************************************/  /***********************************************************************/  /*                                                                     */  /* <Function> TT_Get_Face_Properties                                   */  /*                                                                     */  /* <Description>                                                       */  /*    Return a given face's properties to the caller.                  */  /*                                                                     */  /* <Input>                                                             */  /*    face  :: handle to the source face object                        */  /*                                                                     */  /* <Output>                                                            */  /*    properties :: target properties structure                        */  /*                                                                     */  /* <Return>                                                            */  /*    TrueType error code. 0 means success.                            */  /*                                                                     */  /* <MT-Note>                                                           */  /*    Yes.                                                             */  /*                                                                     */  EXPORT_FUNC  TT_Error  TT_Get_Face_Properties( TT_Face              face,                                    TT_Face_Properties*  props )  {    props->num_Glyphs   = (TT_UShort)face->root.num_glyphs;    props->max_Points   = (TT_UShort)face->root.max_points;    props->max_Contours = (TT_UShort)face->root.max_contours;    props->num_CharMaps = (TT_UShort)face->root.num_charmaps;    props->num_Faces    = face->root.num_faces;    props->num_Names    = face->num_names;    props->header       = &face->header;    props->horizontal   = &face->horizontal;            /* The driver supports old Mac fonts where there are no OS/2  */      /* tables present in the file. However, this is not true of   */      /* FreeType 1.1. For the sake of backwards compatibility, we  */      /* always return the address of the face's os2 table, even if */      /* it is empty (in which case, the 'props.os2' field is set   */      /* to NULL..                                                  */      /*                                                            */      /* Note however, that the 'os2->version' field is set to      */      /* 0xFFFF to indicate a missing table though...               */      /*                                                            */    props->os2          = &face->os2;          props->postscript    = &face->postscript;    props->hdmx          = &face->hdmx;    props->vertical      = ( face->vertical_info ? &face->vertical : 0 );    return TT_Err_Ok;  }  /***********************************************************************/  /*                                                                     */  /* <Function> TT_Set_Face_Pointer.                                     */  /*                                                                     */  /* <Description>                                                       */  /*    Each face object contains a typeless pointer, which use is left  */  /*    to client applications (or the high-level library). This API is  */  /*    used to set this generic pointer. It is ignored by the driver.   */  /*                                                                     */  /* <Input>                                                             */  /*    face   :: target face object                                     */  /*    data   :: generic pointer's value                                */  /*                                                                     */  /* <Return>                                                            */  /*    TrueType error code. 0 means success                             */  /*                                                                     */  /* <MT-Note>                                                           */  /*    No.                                                              */  /*                                                                     */  /* <Note>                                                              */  /*    The generic pointer is used by the HLib when using the driver    */  /*    within the FreeType library.                                     */  /*                                                                     */  EXPORT_FUNC  TT_Error  TT_Set_Face_Pointer( TT_Face  face,                                 void*    data )  {    if ( !face )      return TT_Err_Invalid_Face_Handle;    else      face->root.generic.data = data;    return TT_Err_Ok;  }  /***********************************************************************/  /*                                                                     */  /* <Function> TT_Get_Face_Pointer                                      */  /*                                                                     */  /* <Description>                                                       */  /*    Each face object contains a typeless pointer, which use is left  */  /*    to client applications (or the high-level library). This API is  */  /*    used to retrieve this generic pointer, which is ignored by the   */  /*    driver.                                                          */  /*                                                                     */  /* <Input>                                                             */  /*    face    :: handle to source face object                          */  /*                                                                     */  /* <Return>                                                            */  /*    generic pointer value. NULL if the face handle is invalid..      */  /*                                                                     */  /* <MT-Note>                                                           */  /*    No.                                                              */  /*                                                                     */  EXPORT_FUNC  void*  TT_Get_Face_Pointer( TT_Face  face )  {    return ( face ? face->root.generic.data : NULL );  }  /***********************************************************************/  /*                                                                     */  /* <Function> TT_Get_Face_Metrics                                      */  /*                                                                     */  /* <Description>                                                       */  /*    Get the metrics of a given array of glyphs. Returns any number   */  /*    of metrics arrays.                                               */  /*                                                                     */  /* <Input>                                                             */  /*    face       :: handle to the source face object                   */  /*    firstGlyph :: index of first glyph in the array                  */  /*    lastGlyph  :: index of last glyph in the array                   */  /*                                                                     */  /* <Output>                                                            */  /*    leftBearings :: target array of shorts for the glyph left side   */  /*                    bearings. Set this field to NULL if you're not   */  /*                    interested in these metrics.                     */  /*                                                                     */  /*    widths :: target array of unsigned shorts for the glyph advance  */  /*              widths. Set this field to NULL if you're not           */  /*              interested in these metrics.                           */  /*                                                                     */  /*    topBearings :: target array of shorts for the glyph top side     */  /*                   bearings. Set this field to NULL if you're not    */  /*                   interested in these metrics.                      */  /*                                                                     */  /*    heights :: target array of unsigned shorts for the glyph advance */  /*               heights. Set this field to NULL if you're not         */  /*               interested in these metrics.                          */  /*                                                                     */  /* <Return>                                                            */  /*    TrueType error code. 0 means success.                            */  /*                                                                     */  /* <MT-Note>                                                           */  /*    No.                                                              */  /*                                                                     */        /********************************************************/        /* Return horizontal or vertical metrics in font units  */        /* for a given glyph.  The metrics are the left side    */        /* bearing (resp. top side bearing) and advance width   */        /* (resp. advance height).                              */        /*                                                      */        /* This function will much probably move to another     */        /* component in the short future, but I haven't decided */        /* which yet...                                         */              static          void  get_metrics( TT_HoriHeader*  header,                             TT_Int          index,                             TT_Short*       bearing,                             TT_UShort*      advance )          {            TT_LongMetrics*  longs_m;                TT_UShort  k = header->number_Of_HMetrics;                    if ( index < k )            {              longs_m = (TT_LongMetrics*)header->long_metrics + index;              *bearing = longs_m->bearing;              *advance = longs_m->advance;            }            else            {              *bearing = ((TT_ShortMetrics*)header->short_metrics)[index - k];              *advance = ((TT_LongMetrics*)header->long_metrics)[k - 1].advance;            }          }      EXPORT_FUNC  TT_Error  TT_Get_Face_Metrics( TT_Face     face,                                 TT_UShort   firstGlyph,                                 TT_UShort   lastGlyph,                                 TT_Short*   leftBearings,                                 TT_UShort*  widths,                                 TT_Short*   topBearings,                                 TT_UShort*  heights )  {    TT_UShort  num;    if ( !face )      return TT_Err_Invalid_Face_Handle;    /* Check the glyph range */    if ( lastGlyph >= face->root.num_glyphs || firstGlyph > lastGlyph )      return TT_Err_Invalid_Argument;    num = lastGlyph - firstGlyph;   /* number of elements-1 in each array */    /* store the left side bearings and advance widths first */    {      TT_UShort  n;      TT_Short   left_bearing;      TT_UShort  advance_width;      for ( n = 0; n <= num; n++ )      {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -