ascent and descent
This commit is contained in:
parent
28b84d6fc0
commit
1b6e3c1750
6 changed files with 23 additions and 6 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Font.hh"
|
||||||
|
@ -152,6 +152,13 @@ unsigned int Font::height() const {
|
||||||
return m_fontimp->height();
|
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 {
|
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)
|
if (text == 0 || len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef FBTK_FONT_HH
|
||||||
#define FBTK_FONT_HH
|
#define FBTK_FONT_HH
|
||||||
|
@ -60,6 +60,8 @@ public:
|
||||||
*/
|
*/
|
||||||
unsigned int textWidth(const char * const text, unsigned int size) const;
|
unsigned int textWidth(const char * const text, unsigned int size) const;
|
||||||
unsigned int height() 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;
|
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; }
|
bool isAntialias() const { return m_antialias; }
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef FBTK_FONTIMP_HH
|
||||||
#define FBTK_FONTIMP_HH
|
#define FBTK_FONTIMP_HH
|
||||||
|
@ -42,6 +42,8 @@ public:
|
||||||
virtual bool load(const std::string &name) = 0;
|
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 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 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 unsigned int height() const = 0;
|
||||||
virtual bool loaded() const = 0;
|
virtual bool loaded() const = 0;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef XFONTIMP_HH
|
||||||
#define XFONTIMP_HH
|
#define XFONTIMP_HH
|
||||||
|
@ -33,6 +33,8 @@ public:
|
||||||
bool load(const std::string &filename);
|
bool load(const std::string &filename);
|
||||||
unsigned int textWidth(const char * const text, unsigned int size) const;
|
unsigned int textWidth(const char * const text, unsigned int size) const;
|
||||||
unsigned int height() 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;
|
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; }
|
bool loaded() const { return m_fontstruct != 0; }
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef XFTFONTIMP_HH
|
||||||
#define XFTFONTIMP_HH
|
#define XFTFONTIMP_HH
|
||||||
|
@ -35,6 +35,8 @@ public:
|
||||||
void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
|
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 textWidth(const char * const text, unsigned int len) const;
|
||||||
unsigned int height() 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; }
|
bool loaded() const { return m_xftfont != 0; }
|
||||||
private:
|
private:
|
||||||
XftFont *m_xftfont;
|
XftFont *m_xftfont;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef XMBFONTIMP_HH
|
||||||
#define XMBFONTIMP_HH
|
#define XMBFONTIMP_HH
|
||||||
|
@ -34,6 +34,8 @@ public:
|
||||||
virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
|
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 textWidth(const char * const text, unsigned int len) const;
|
||||||
unsigned int height() 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; }
|
bool loaded() const { return m_fontset != 0; }
|
||||||
private:
|
private:
|
||||||
XFontSet m_fontset;
|
XFontSet m_fontset;
|
||||||
|
|
Loading…
Reference in a new issue