Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
1.8 KiB

  1. /***
  2. **
  3. ** Module: MReader
  4. **
  5. ** Description:
  6. ** This is a module of the T1 to TT font converter. The module
  7. ** will extract information from a T1 font metrics file, by parsing
  8. ** the data/commands found in PFM and AFM files.
  9. **
  10. ** Author: Michael Jansson
  11. **
  12. ** Created: 5/26/93
  13. **
  14. ***/
  15. /**** INCLUDES */
  16. /* General types and definitions. */
  17. #include <string.h>
  18. /* Special types and definitions. */
  19. #include "titott.h"
  20. #include "types.h"
  21. /* Module dependent types and prototypes. */
  22. #include "pfm.h"
  23. /***** CONSTANTS */
  24. /*-none-*/
  25. /***** LOCAL TYPES */
  26. enum MType {t1_afm, t1_pfm, t1_unknown};
  27. /***** MACROS */
  28. /*-none-*/
  29. /***** STATIC FUNCTIONS */
  30. /***
  31. ** Function: MetricsType
  32. **
  33. ** Description:
  34. ** This function determines the type of the
  35. ** metrics file that is associated to the
  36. ** main Adobe Type 1 outline file.
  37. ***/
  38. static enum MType MetricsType(const char *metrics)
  39. {
  40. enum MType type;
  41. if (metrics==NULL || strlen(metrics)<5)
  42. type = t1_unknown;
  43. else if (!_strnicmp(&metrics[strlen(metrics)-3], "AFM", 3))
  44. type = t1_afm;
  45. else if (!_strnicmp(&metrics[strlen(metrics)-3], "PFM", 3))
  46. type = t1_pfm;
  47. else
  48. type = t1_unknown;
  49. return type;
  50. }
  51. /***** FUNCTIONS */
  52. /***
  53. ** Function: ReadFontMetrics
  54. **
  55. ** Description:
  56. ** Read a font metrics file that associated to a type 1 font.
  57. ***/
  58. errcode ReadFontMetrics(const char *metrics, struct T1Metrics *t1m)
  59. {
  60. errcode status = SUCCESS;
  61. switch(MetricsType(metrics)) {
  62. case t1_pfm:
  63. status = ReadPFMMetrics(metrics, t1m);
  64. break;
  65. case t1_afm:
  66. /* status = ReadAFMMetrics(metrics, t1m); */
  67. break;
  68. case t1_unknown:
  69. default:
  70. status = BADMETRICS;
  71. break;
  72. }
  73. return status;
  74. }