2000-04-04 00:19:15 +00:00
|
|
|
// -*- C++ -*-
|
2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
#ifndef FONT_H
|
|
|
|
#define FONT_H
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
class LyXFont;
|
|
|
|
|
|
|
|
//namespace lyx {
|
|
|
|
//namespace font {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
struct lyxfont {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int maxAscent(LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int maxDescent(LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int ascent(char c, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int descent(char c, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int lbearing(char c, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int rbearing(char c, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
2000-07-04 20:32:37 +00:00
|
|
|
int width(char c, LyXFont const & f) {
|
|
|
|
return width(&c, 1, f);
|
|
|
|
}
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
2000-09-27 18:13:30 +00:00
|
|
|
int width(char const * s, size_t n, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int width(string const & s, LyXFont const & f) {
|
|
|
|
if (s.empty()) return 0;
|
|
|
|
return width(s.c_str(), s.length(), f);
|
|
|
|
}
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int width(char const * s, LyXFont const & f) {
|
|
|
|
return width(s, strlen(s), f);
|
|
|
|
}
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
int signedWidth(string const & s, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
2000-09-14 17:53:12 +00:00
|
|
|
int XTextWidth(LyXFont const & f, char const * str, int count);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
static
|
|
|
|
int width(XChar2b const * s, int n, LyXFont const & f);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
static
|
2000-09-14 17:53:12 +00:00
|
|
|
int XTextWidth16(LyXFont const & f, XChar2b const * str, int count);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
static
|
|
|
|
void XSetFont(Display * display, GC gc, LyXFont const & f);
|
|
|
|
};
|
|
|
|
|
|
|
|
//} // end of namespace font
|
|
|
|
|
|
|
|
// import into namespace lyx
|
|
|
|
//using font::maxAscent;
|
|
|
|
//using font::maxDescent;
|
|
|
|
//using font::ascent;
|
|
|
|
//using font::descent;
|
|
|
|
//using font::lbearing;
|
|
|
|
//using font::rbearing;
|
|
|
|
//using font::width;
|
|
|
|
//using font::signedWidth;
|
|
|
|
//using font::XTextWidth;
|
|
|
|
//using font::XSetFont;
|
|
|
|
|
|
|
|
//} // end of namespace lyx
|
|
|
|
|
|
|
|
#endif
|