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.

119 lines
3.5KB

  1. //
  2. // "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $"
  3. //
  4. // Font definitions for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2011 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. // Two internal fltk data structures:
  28. //
  29. // Fl_Fontdesc: an entry into the fl_font() table. There is one of these
  30. // for each fltk font number.
  31. //
  32. #ifndef FL_FONT_
  33. #define FL_FONT_
  34. #include <config.h>
  35. # if USE_XFT
  36. typedef struct _XftFont XftFont;
  37. # elif !defined(WIN32) && !defined(__APPLE__)
  38. # include <FL/Xutf8.h>
  39. # endif // USE_XFT
  40. /**
  41. This a structure for an actual system font, with junk to
  42. help choose it and info on character sizes. Each Fl_Fontdesc has a
  43. linked list of these. These are created the first time each system
  44. font/size combination is used.
  45. */
  46. class Fl_Font_Descriptor {
  47. public:
  48. /** linked list for this Fl_Fontdesc */
  49. Fl_Font_Descriptor *next;
  50. Fl_Fontsize size; /**< font size */
  51. #ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc.
  52. # ifdef WIN32
  53. HFONT fid;
  54. int *width[64];
  55. TEXTMETRIC metr;
  56. int angle;
  57. FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
  58. # elif defined(__APPLE_QUARTZ__)
  59. FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
  60. ATSUTextLayout layout;
  61. # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
  62. CTFontRef fontref;
  63. // the unicode span is divided in 512 blocks of 128 characters
  64. float *width[512]; // array of arrays of character widths
  65. # endif
  66. ATSUStyle style;
  67. short ascent, descent, q_width;
  68. char *q_name;
  69. # elif USE_XFT
  70. XftFont* font;
  71. //const char* encoding;
  72. int angle;
  73. FL_EXPORT Fl_Font_Descriptor(const char* xfontname, Fl_Fontsize size, int angle);
  74. # else
  75. XUtf8FontStruct* font; // X UTF-8 font information
  76. FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
  77. # endif
  78. # if HAVE_GL
  79. unsigned int listbase;// base of display list, 0 = none
  80. #ifndef __APPLE_QUARTZ__
  81. char glok[64];
  82. #endif // __APPLE_QUARTZ__
  83. # endif // HAVE_GL
  84. FL_EXPORT ~Fl_Font_Descriptor();
  85. #endif // FL_DOXYGEN
  86. };
  87. //extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
  88. struct Fl_Fontdesc {
  89. const char *name;
  90. char fontname[128]; // "Pretty" font name
  91. Fl_Font_Descriptor *first; // linked list of sizes of this style
  92. # ifndef WIN32
  93. char **xlist; // matched X font names
  94. int n; // size of xlist, negative = don't free xlist!
  95. # endif
  96. };
  97. extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
  98. # ifndef WIN32
  99. // functions for parsing X font names:
  100. FL_EXPORT const char* fl_font_word(const char *p, int n);
  101. FL_EXPORT char *fl_find_fontsize(char *name);
  102. # endif
  103. #endif
  104. //
  105. // End of "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $".
  106. //