/src/freetype/src/base/ftfstype.c

https://bitbucket.org/cabalistic/ogredeps/ · C · 62 lines · 26 code · 16 blank · 20 comment · 8 complexity · 8b88ae005c7057e6ea96cb8d8de05c19 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftfstype.c */
  4. /* */
  5. /* FreeType utility file to access FSType data (body). */
  6. /* */
  7. /* Copyright 2008, 2009 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  10. /* This file is part of the FreeType project, and may only be used, */
  11. /* modified, and distributed under the terms of the FreeType project */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #include <ft2build.h>
  18. #include FT_TYPE1_TABLES_H
  19. #include FT_TRUETYPE_TABLES_H
  20. #include FT_INTERNAL_SERVICE_H
  21. #include FT_SERVICE_POSTSCRIPT_INFO_H
  22. /* documentation is in freetype.h */
  23. FT_EXPORT_DEF( FT_UShort )
  24. FT_Get_FSType_Flags( FT_Face face )
  25. {
  26. TT_OS2* os2;
  27. /* first, try to get the fs_type directly from the font */
  28. if ( face )
  29. {
  30. FT_Service_PsInfo service = NULL;
  31. FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
  32. if ( service && service->ps_get_font_extra )
  33. {
  34. PS_FontExtraRec extra;
  35. if ( !service->ps_get_font_extra( face, &extra ) &&
  36. extra.fs_type != 0 )
  37. return extra.fs_type;
  38. }
  39. }
  40. /* look at FSType before fsType for Type42 */
  41. if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL &&
  42. os2->version != 0xFFFFU )
  43. return os2->fsType;
  44. return 0;
  45. }
  46. /* END */