X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Ffont-metric.hh;h=793c0e14a9e065ecb9cd543c05c41585b5fc5baf;hb=b50ab1c348bba9622c85ab9f53a1519d94a3f1b7;hp=2878cfc38b4b14f4cefc2e0402a31858d9b7fa88;hpb=75be12aa75a535af753d6125bfc03da3ee303b36;p=lilypond.git diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 2878cfc38b..793c0e14a9 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -1,36 +1,84 @@ -/* +/* font-metric.hh -- declare Font_metric - + source file of the GNU LilyPond music typesetter - - (c) 1999 Han-Wen Nienhuys - - */ + + (c) 1999--2007 Han-Wen Nienhuys +*/ #ifndef FONT_METRIC_HH #define FONT_METRIC_HH #include "box.hh" -/* - sigh. +#include "lily-proto.hh" +#include "smobs.hh" +#include "virtual-methods.hh" +#include "freetype.hh" - signature -> Internal compiler error -*/ +#include +using namespace std; + +typedef map Index_to_charcode_map; -struct Character_metric +class Font_metric { - virtual Box dimensions () const=0; - virtual ~Character_metric () {} + DECLARE_CLASSNAME(Font_metric); + +public: + SCM description_; + string file_name_; + + virtual Stencil text_stencil (string) const; + virtual Stencil word_stencil (string) const; + + // ugh. + virtual Box text_dimension (string) const; + + virtual string font_name () const; + virtual size_t count () const; + virtual Offset attachment_point (string) const; + virtual Offset get_indexed_wxwy (size_t) const; + virtual Box get_indexed_char (size_t index) const; + virtual Box get_ascii_char (size_t ascii) const; + + /* + WTF are these vsize ? + + Font_metric is not related to vector<> + */ + virtual size_t name_to_index (string) const; + virtual size_t index_to_charcode (size_t) const; + virtual size_t index_to_ascii (size_t) const; + virtual Real design_size () const; + virtual Stencil find_by_name (string) const; + virtual Stencil get_indexed_char_stencil (size_t k) const; + virtual Stencil get_ascii_char_stencil (size_t k) const; + virtual SCM sub_fonts () const; + virtual SCM font_file_name () const; + DECLARE_SMOBS (Font_metric); + +private: + /* No copying, no implicit copy constructor. */ + Font_metric (Font_metric const &); + +protected: + virtual void derived_mark () const; + + Font_metric (); }; -struct Font_metric +int get_encoded_index (Font_metric *m, string input_coding, int code); + +class Simple_font_metric : public Font_metric { - virtual Character_metric *get_char (int ascii, bool warn) const=0; - virtual ~Font_metric () {} + DECLARE_CLASSNAME(Simple_font_metric); +public: }; +DECLARE_UNSMOB (Font_metric, metrics); +Box lookup_tex_text_dimension (Font_metric *font, SCM text); +char *pfb2pfa (Byte const *pfb, int length); #endif /* FONT_METRIC_HH */ -