X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffont.h;h=eb4b71ca2a5d73160aefde574ff9b6f76cd8a6b9;hb=98c966c64594611e469313314abd1e59524adb4a;hp=28c3a017d9ccd0f733ccaa3a517274586b0788e9;hpb=b51e368b2b3e3ddd29b3dbcdb9b07a1d911188fb;p=lyx.git diff --git a/src/font.h b/src/font.h index 28c3a017d9..eb4b71ca2a 100644 --- a/src/font.h +++ b/src/font.h @@ -1,7 +1,21 @@ // -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. + * + * ====================================================== */ + #ifndef FONT_H #define FONT_H +#ifdef __GNUG__ +#pragma interface +#endif + #include #include "LString.h" @@ -10,60 +24,69 @@ class LyXFont; //namespace lyx { //namespace font { - +/// struct lyxfont { - + /// static int maxAscent(LyXFont const & f); - + /// static int maxDescent(LyXFont const & f); - + /// static int ascent(char c, LyXFont const & f); - + /// static int descent(char c, LyXFont const & f); - + /// static int lbearing(char c, LyXFont const & f); - + /// static int rbearing(char c, LyXFont const & f); - + /// static int width(char c, LyXFont const & f) { return width(&c, 1, f); } - + /// static - int width(char const * s, int n, LyXFont const & f); - + int width(char const * s, size_t n, LyXFont const & f); + /// static int width(string const & s, LyXFont const & f) { if (s.empty()) return 0; - return width(s.c_str(), s.length(), f); - } - - static - int width(char const * s, LyXFont const & f) { - return width(s, strlen(s), f); + return width(s.data(), s.length(), f); } - + /// + //static + //int width(char const * s, LyXFont const & f) { + // return width(s, strlen(s), f); + //} + /// static int signedWidth(string const & s, LyXFont const & f); - + /// static - int XTextWidth(LyXFont const & f, char * str, int count); - + int XTextWidth(LyXFont const & f, char const * str, int count); + /// static int width(XChar2b const * s, int n, LyXFont const & f); - + /// static - int XTextWidth16(LyXFont const & f, XChar2b * str, int count); - + int XTextWidth16(LyXFont const & f, XChar2b const * str, int count); + /// static void XSetFont(Display * display, GC gc, LyXFont const & f); + // A couple of more high-level metrics + /// + static + void rectText(string const & str, LyXFont const & font, + int & width, int & ascent, int & descent); + /// + static + void buttonText(string const & str, LyXFont const & font, + int & width, int & ascent, int & descent); }; //} // end of namespace font