X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Ffont-metric.hh;h=429801db5520800c1043afafc43306b39346f303;hb=8cf69a467ad7650f5ca9da6fe2dfd4c7c088b239;hp=4217a6e95ea14f76998f17de2803452972a0dde8;hpb=5d7f3453a3060d227d9c30b44bf66164f7a674c8;p=lilypond.git diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 4217a6e95e..429801db55 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -1,55 +1,67 @@ /* - font-metric.hh -- declare Font_metric + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1999--2015 Han-Wen Nienhuys - (c) 1999--2006 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #ifndef FONT_METRIC_HH #define FONT_METRIC_HH #include "box.hh" +#include "freetype.hh" #include "lily-proto.hh" #include "smobs.hh" #include "virtual-methods.hh" -class Font_metric +#include + +typedef std::map Index_to_charcode_map; + +class Font_metric : public Smob { - DECLARE_CLASSNAME(Font_metric); +public: + int print_smob (SCM, scm_print_state *) const; + SCM mark_smob () const; + static const char * const type_p_name_; + virtual ~Font_metric (); +private: + 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; + // Return stencil for given string. output_state may be modified to + // record the font. + virtual Stencil text_stencil (Output_def *output_state, + const string &text, + bool music, + const string &features_str) const; virtual string font_name () const; virtual size_t count () const; - virtual Offset attachment_point (string) const; + virtual Offset attachment_point (const 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 Box get_indexed_char_dimensions (size_t index) const; + virtual size_t name_to_index (string) const=0; 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. */ @@ -61,16 +73,7 @@ protected: Font_metric (); }; -int get_encoded_index (Font_metric *m, string input_coding, int code); - -class Simple_font_metric : public Font_metric -{ - DECLARE_CLASSNAME(Simple_font_metric); -public: -}; - -DECLARE_UNSMOB (Font_metric, metrics); -Box lookup_tex_text_dimension (Font_metric *font, SCM text); +vector pfb2pfa (const vector &pfb); #endif /* FONT_METRIC_HH */