all repos — fluxbox @ 1b6e3c1750aa199719a6165276ae858c1b89096e

custom fork of the fluxbox windowmanager

ascent and descent
fluxgen fluxgen
commit

1b6e3c1750aa199719a6165276ae858c1b89096e

parent

28b84d6fc03587ffacfcc575323e9113ae172be3

6 files changed, 23 insertions(+), 6 deletions(-)

jump to
M src/Font.ccsrc/Font.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.cc,v 1.15 2002/10/16 23:22:45 fluxgen Exp $ +//$Id: Font.cc,v 1.16 2002/10/19 14:01:05 fluxgen Exp $ #include "Font.hh"

@@ -152,6 +152,13 @@ unsigned int Font::height() const {

return m_fontimp->height(); } +int Font::ascent() const { + return m_fontimp->ascent(); +} + +int Font::descent() const { + return m_fontimp->descent(); +} void Font::drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const { if (text == 0 || len == 0) return;
M src/Font.hhsrc/Font.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.hh,v 1.7 2002/10/16 23:26:41 fluxgen Exp $ +//$Id: Font.hh,v 1.8 2002/10/19 14:00:37 fluxgen Exp $ #ifndef FBTK_FONT_HH #define FBTK_FONT_HH

@@ -60,6 +60,8 @@ @return size of text in pixels

*/ unsigned int textWidth(const char * const text, unsigned int size) const; unsigned int height() const; + int ascent() const; + int descent() const; void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; bool isAntialias() const { return m_antialias; } private:
M src/FontImp.hhsrc/FontImp.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FontImp.hh,v 1.2 2002/10/15 16:43:15 fluxgen Exp $ +// $Id: FontImp.hh,v 1.3 2002/10/19 13:57:48 fluxgen Exp $ #ifndef FBTK_FONTIMP_HH #define FBTK_FONTIMP_HH

@@ -42,6 +42,8 @@ virtual ~FontImp() { }

virtual bool load(const std::string &name) = 0; virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const = 0; virtual unsigned int textWidth(const char * const text, unsigned int size) const = 0; + virtual int ascent() const = 0; + virtual int descent() const = 0; virtual unsigned int height() const = 0; virtual bool loaded() const = 0; protected:
M src/XFontImp.hhsrc/XFontImp.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XFontImp.hh,v 1.2 2002/10/15 16:44:26 fluxgen Exp $ +// $Id: XFontImp.hh,v 1.3 2002/10/19 13:58:47 fluxgen Exp $ #ifndef XFONTIMP_HH #define XFONTIMP_HH

@@ -33,6 +33,8 @@ ~XFontImp();

bool load(const std::string &filename); unsigned int textWidth(const char * const text, unsigned int size) const; unsigned int height() const; + int ascent() const { return m_fontstruct ? m_fontstruct->ascent : 0; } + int descent() const { return m_fontstruct ? m_fontstruct->descent : 0; } void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; bool loaded() const { return m_fontstruct != 0; } private:
M src/XftFontImp.hhsrc/XftFontImp.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: XftFontImp.hh,v 1.3 2002/10/16 23:13:54 fluxgen Exp $ +//$Id: XftFontImp.hh,v 1.4 2002/10/19 13:58:21 fluxgen Exp $ #ifndef XFTFONTIMP_HH #define XFTFONTIMP_HH

@@ -35,6 +35,8 @@ bool load(const std::string &name);

void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; unsigned int textWidth(const char * const text, unsigned int len) const; unsigned int height() const; + int ascent() const { return m_xftfont ? m_xftfont->ascent : 0; } + int descent() const { return m_xftfont ? m_xftfont->descent : 0; } bool loaded() const { return m_xftfont != 0; } private: XftFont *m_xftfont;
M src/XmbFontImp.hhsrc/XmbFontImp.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XmbFontImp.hh,v 1.3 2002/10/16 23:30:17 fluxgen Exp $ +// $Id: XmbFontImp.hh,v 1.4 2002/10/19 13:58:58 fluxgen Exp $ #ifndef XMBFONTIMP_HH #define XMBFONTIMP_HH

@@ -34,6 +34,8 @@ bool load(const std::string &name);

virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; unsigned int textWidth(const char * const text, unsigned int len) const; unsigned int height() const; + int ascent() const { return m_setextents ? -m_setextents->max_ink_extent.y : 0; } + int descent() const { return m_setextents ? m_setextents->max_ink_extent.height + m_setextents->max_ink_extent.y : 0; } bool loaded() const { return m_fontset != 0; } private: XFontSet m_fontset;