ftmm.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /***************************************************************************/
  2. /* */
  3. /* ftmm.c */
  4. /* */
  5. /* Multiple Master font support (body). */
  6. /* */
  7. /* Copyright 1996-2001 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_MULTIPLE_MASTERS_H
  19. #include FT_INTERNAL_OBJECTS_H
  20. /*************************************************************************/
  21. /* */
  22. /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
  23. /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
  24. /* messages during execution. */
  25. /* */
  26. #undef FT_COMPONENT
  27. #define FT_COMPONENT trace_mm
  28. /* documentation is in ftmm.h */
  29. FT_EXPORT_DEF( FT_Error )
  30. FT_Get_Multi_Master( FT_Face face,
  31. FT_Multi_Master *amaster )
  32. {
  33. FT_Error error;
  34. if ( !face )
  35. return FT_Err_Invalid_Face_Handle;
  36. error = FT_Err_Invalid_Argument;
  37. if ( FT_HAS_MULTIPLE_MASTERS( face ) )
  38. {
  39. FT_Driver driver = face->driver;
  40. FT_Get_MM_Func func;
  41. func = (FT_Get_MM_Func)driver->root.clazz->get_interface(
  42. FT_MODULE( driver ), "get_mm" );
  43. if ( func )
  44. error = func( face, amaster );
  45. }
  46. return error;
  47. }
  48. /* documentation is in ftmm.h */
  49. FT_EXPORT_DEF( FT_Error )
  50. FT_Set_MM_Design_Coordinates( FT_Face face,
  51. FT_UInt num_coords,
  52. FT_Long* coords )
  53. {
  54. FT_Error error;
  55. if ( !face )
  56. return FT_Err_Invalid_Face_Handle;
  57. error = FT_Err_Invalid_Argument;
  58. if ( FT_HAS_MULTIPLE_MASTERS( face ) )
  59. {
  60. FT_Driver driver = face->driver;
  61. FT_Set_MM_Design_Func func;
  62. func = (FT_Set_MM_Design_Func)driver->root.clazz->get_interface(
  63. FT_MODULE( driver ), "set_mm_design" );
  64. if ( func )
  65. error = func( face, num_coords, coords );
  66. }
  67. return error;
  68. }
  69. /* documentation is in ftmm.h */
  70. FT_EXPORT_DEF( FT_Error )
  71. FT_Set_MM_Blend_Coordinates( FT_Face face,
  72. FT_UInt num_coords,
  73. FT_Fixed* coords )
  74. {
  75. FT_Error error;
  76. if ( !face )
  77. return FT_Err_Invalid_Face_Handle;
  78. error = FT_Err_Invalid_Argument;
  79. if ( FT_HAS_MULTIPLE_MASTERS( face ) )
  80. {
  81. FT_Driver driver = face->driver;
  82. FT_Set_MM_Blend_Func func;
  83. func = (FT_Set_MM_Blend_Func)driver->root.clazz->get_interface(
  84. FT_MODULE( driver ), "set_mm_blend" );
  85. if ( func )
  86. error = func( face, num_coords, coords );
  87. }
  88. return error;
  89. }
  90. /* END */