Replaced badly named type Fl_FontSize with Fl_Font_Descriptor. This type is only used in the core files and not available to the user.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6162 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
e63c50b2d1
commit
b6b746cd69
@ -30,7 +30,7 @@
|
||||
// Fl_Fontdesc: an entry into the fl_font() table. There is one of these
|
||||
// for each fltk font number.
|
||||
//
|
||||
// Fl_FontSize: a structure for an actual system font, with junk to
|
||||
// Fl_Font_Descriptor: a structure for an actual system font, with junk to
|
||||
// help choose it and info on character sizes. Each Fl_Fontdesc has a
|
||||
// linked list of these. These are created the first time each system
|
||||
// font/size combination is used.
|
||||
@ -44,22 +44,22 @@
|
||||
typedef struct _XftFont XftFont;
|
||||
# endif // USE_XFT
|
||||
|
||||
class Fl_FontSize {
|
||||
class Fl_Font_Descriptor {
|
||||
public:
|
||||
Fl_FontSize *next; // linked list for this Fl_Fontdesc
|
||||
Fl_Font_Descriptor *next; // linked list for this Fl_Fontdesc
|
||||
# ifdef WIN32
|
||||
HFONT fid;
|
||||
int width[256];
|
||||
TEXTMETRIC metr;
|
||||
FL_EXPORT Fl_FontSize(const char* fontname, Fl_Fontsize size);
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
||||
# elif defined(__APPLE_QD__)
|
||||
FL_EXPORT Fl_FontSize(const char* fontname, Fl_Fontsize size);
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
||||
short font, face, size;
|
||||
short ascent, descent;
|
||||
short width[256];
|
||||
bool knowMetrics;
|
||||
# elif defined(__APPLE_QUARTZ__)
|
||||
FL_EXPORT Fl_FontSize(const char* fontname, Fl_Fontsize size);
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
||||
ATSUTextLayout layout;
|
||||
ATSUStyle style;
|
||||
short ascent, descent, q_width;
|
||||
@ -71,25 +71,25 @@ public:
|
||||
XftFont* font;
|
||||
const char* encoding;
|
||||
Fl_Fontsize size;
|
||||
FL_EXPORT Fl_FontSize(const char* xfontname);
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
|
||||
# else
|
||||
XFontStruct* font; // X font information
|
||||
FL_EXPORT Fl_FontSize(const char* xfontname);
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
|
||||
# endif
|
||||
Fl_Fontsize minsize; // smallest point size that should use this
|
||||
Fl_Fontsize maxsize; // largest point size that should use this
|
||||
# if HAVE_GL
|
||||
unsigned int listbase;// base of display list, 0 = none
|
||||
# endif
|
||||
FL_EXPORT ~Fl_FontSize();
|
||||
FL_EXPORT ~Fl_Font_Descriptor();
|
||||
};
|
||||
|
||||
extern FL_EXPORT Fl_FontSize *fl_fontsize; // the currently selected one
|
||||
extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
|
||||
|
||||
struct Fl_Fontdesc {
|
||||
const char *name;
|
||||
char fontname[128]; // "Pretty" font name
|
||||
Fl_FontSize *first; // linked list of sizes of this style
|
||||
Fl_Font_Descriptor *first; // linked list of sizes of this style
|
||||
# ifndef WIN32
|
||||
char **xlist; // matched X font names
|
||||
int n; // size of xlist, negative = don't free xlist!
|
||||
|
@ -2192,8 +2192,8 @@ void Fl_Window::make_current()
|
||||
// helper function to manage the current CGContext fl_gc
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
extern Fl_Color fl_color_;
|
||||
extern class Fl_FontSize *fl_fontsize;
|
||||
extern void fl_font(class Fl_FontSize*);
|
||||
extern class Fl_Font_Descriptor *fl_fontsize;
|
||||
extern void fl_font(class Fl_Font_Descriptor*);
|
||||
extern void fl_quartz_restore_line_style_();
|
||||
|
||||
// FLTK has only one global graphics state. This function copies the FLTK state into the
|
||||
|
@ -1595,11 +1595,11 @@ void Fl_Window::make_current() {
|
||||
will not automatically free any fonts. */
|
||||
void fl_free_fonts(void)
|
||||
{
|
||||
// remove the Fl_FontSize chains
|
||||
// remove the Fl_Font_Descriptor chains
|
||||
int i;
|
||||
Fl_Fontdesc * s;
|
||||
Fl_FontSize * f;
|
||||
Fl_FontSize * ff;
|
||||
Fl_Font_Descriptor * f;
|
||||
Fl_Font_Descriptor * ff;
|
||||
for (i=0; i<FL_FREE_FONT; i++) {
|
||||
s = fl_fonts + i;
|
||||
for (f=s->first; f; f=ff) {
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
Fl_FontSize::Fl_FontSize(const char* name, Fl_Fontsize Size) {
|
||||
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
|
||||
next = 0;
|
||||
# if HAVE_GL
|
||||
listbase = 0;
|
||||
@ -114,9 +114,9 @@ Fl_FontSize::Fl_FontSize(const char* name, Fl_Fontsize Size) {
|
||||
#endif
|
||||
}
|
||||
|
||||
Fl_FontSize* fl_fontsize = 0L;
|
||||
Fl_Font_Descriptor* fl_fontsize = 0L;
|
||||
|
||||
Fl_FontSize::~Fl_FontSize() {
|
||||
Fl_Font_Descriptor::~Fl_Font_Descriptor() {
|
||||
/*
|
||||
#if HAVE_GL
|
||||
// ++ todo: remove OpenGL font alocations
|
||||
@ -221,7 +221,7 @@ UniChar *fl_macToUtf16(const char *txt, int len)
|
||||
|
||||
Fl_Fontdesc* fl_fonts = built_in_table;
|
||||
|
||||
void fl_font(Fl_FontSize* s) {
|
||||
void fl_font(Fl_Font_Descriptor* s) {
|
||||
fl_fontsize = s;
|
||||
#ifdef __APPLE_QD__
|
||||
if (fl_window) SetPort( GetWindowPort(fl_window) );
|
||||
@ -245,13 +245,13 @@ void fl_font(Fl_FontSize* s) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static Fl_FontSize* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
static Fl_Font_Descriptor* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
Fl_Fontdesc* s = fl_fonts+fnum;
|
||||
if (!s->name) s = fl_fonts; // use 0 if fnum undefined
|
||||
Fl_FontSize* f;
|
||||
Fl_Font_Descriptor* f;
|
||||
for (f = s->first; f; f = f->next)
|
||||
if (f->minsize <= size && f->maxsize >= size) return f;
|
||||
f = new Fl_FontSize(s->name, size);
|
||||
f = new Fl_Font_Descriptor(s->name, size);
|
||||
f->next = s->first;
|
||||
s->first = f;
|
||||
return f;
|
||||
|
@ -25,7 +25,7 @@
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
Fl_FontSize::Fl_FontSize(const char* name, Fl_Fontsize size) {
|
||||
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize size) {
|
||||
int weight = FW_NORMAL;
|
||||
int italic = 0;
|
||||
switch (*name++) {
|
||||
@ -63,9 +63,9 @@ Fl_FontSize::Fl_FontSize(const char* name, Fl_Fontsize size) {
|
||||
minsize = maxsize = size;
|
||||
}
|
||||
|
||||
Fl_FontSize* fl_fontsize;
|
||||
Fl_Font_Descriptor* fl_fontsize;
|
||||
|
||||
Fl_FontSize::~Fl_FontSize() {
|
||||
Fl_Font_Descriptor::~Fl_Font_Descriptor() {
|
||||
#if HAVE_GL
|
||||
// Delete list created by gl_draw(). This is not done by this code
|
||||
// as it will link in GL unnecessarily. There should be some kind
|
||||
@ -106,13 +106,13 @@ static Fl_Fontdesc built_in_table[] = {
|
||||
|
||||
Fl_Fontdesc* fl_fonts = built_in_table;
|
||||
|
||||
static Fl_FontSize* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
static Fl_Font_Descriptor* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
Fl_Fontdesc* s = fl_fonts+fnum;
|
||||
if (!s->name) s = fl_fonts; // use 0 if fnum undefined
|
||||
Fl_FontSize* f;
|
||||
Fl_Font_Descriptor* f;
|
||||
for (f = s->first; f; f = f->next)
|
||||
if (f->minsize <= size && f->maxsize >= size) return f;
|
||||
f = new Fl_FontSize(s->name, size);
|
||||
f = new Fl_Font_Descriptor(s->name, size);
|
||||
f->next = s->first;
|
||||
s->first = f;
|
||||
return f;
|
||||
|
@ -25,7 +25,7 @@
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
Fl_FontSize::Fl_FontSize(const char* name) {
|
||||
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name) {
|
||||
font = XLoadQueryFont(fl_display, name);
|
||||
if (!font) {
|
||||
Fl::warning("bad font: %s", name);
|
||||
@ -36,9 +36,9 @@ Fl_FontSize::Fl_FontSize(const char* name) {
|
||||
# endif
|
||||
}
|
||||
|
||||
Fl_FontSize* fl_fontsize;
|
||||
Fl_Font_Descriptor* fl_fontsize;
|
||||
|
||||
Fl_FontSize::~Fl_FontSize() {
|
||||
Fl_Font_Descriptor::~Fl_Font_Descriptor() {
|
||||
# if HAVE_GL
|
||||
// Delete list created by gl_draw(). This is not done by this code
|
||||
// as it will link in GL unnecessarily. There should be some kind
|
||||
@ -112,18 +112,18 @@ int fl_correct_encoding(const char* name) {
|
||||
return (*c++ && !strcmp(c,fl_encoding));
|
||||
}
|
||||
|
||||
// locate or create an Fl_FontSize for a given Fl_Fontdesc and size:
|
||||
static Fl_FontSize* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
// locate or create an Fl_Font_Descriptor for a given Fl_Fontdesc and size:
|
||||
static Fl_Font_Descriptor* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
Fl_Fontdesc* s = fl_fonts+fnum;
|
||||
if (!s->name) s = fl_fonts; // use font 0 if still undefined
|
||||
Fl_FontSize* f;
|
||||
Fl_Font_Descriptor* f;
|
||||
for (f = s->first; f; f = f->next)
|
||||
if (f->minsize <= size && f->maxsize >= size) return f;
|
||||
fl_open_display();
|
||||
if (!s->xlist) {
|
||||
s->xlist = XListFonts(fl_display, s->name, 100, &(s->n));
|
||||
if (!s->xlist) { // use fixed if no matching font...
|
||||
s->first = new Fl_FontSize("fixed");
|
||||
s->first = new Fl_Font_Descriptor("fixed");
|
||||
s->first->minsize = 0;
|
||||
s->first->maxsize = 32767;
|
||||
return s->first;
|
||||
@ -181,7 +181,7 @@ static Fl_FontSize* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
}
|
||||
|
||||
// okay, we definately have some name, make the font:
|
||||
f = new Fl_FontSize(name);
|
||||
f = new Fl_Font_Descriptor(name);
|
||||
if (ptsize < size) {f->minsize = ptsize; f->maxsize = size;}
|
||||
else {f->minsize = size; f->maxsize = ptsize;}
|
||||
f->next = s->first;
|
||||
@ -206,7 +206,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size) {
|
||||
}
|
||||
if (fnum == fl_font_ && size == fl_size_) return;
|
||||
fl_font_ = fnum; fl_size_ = size;
|
||||
Fl_FontSize* f = find(fnum, size);
|
||||
Fl_Font_Descriptor* f = find(fnum, size);
|
||||
if (f != fl_fontsize) {
|
||||
fl_fontsize = f;
|
||||
fl_xfont = f->font;
|
||||
|
@ -93,7 +93,7 @@ Fl_Fontsize fl_size_ = 0;
|
||||
XFontStruct* fl_xfont = 0;
|
||||
void *fl_xftfont = 0;
|
||||
const char* fl_encoding_ = "iso8859-1";
|
||||
Fl_FontSize* fl_fontsize = 0;
|
||||
Fl_Font_Descriptor* fl_fontsize = 0;
|
||||
|
||||
void fl_font(Fl_Font fnum, Fl_Fontsize size) {
|
||||
if (fnum==-1) { // special case to stop font caching
|
||||
@ -106,14 +106,14 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size) {
|
||||
return;
|
||||
fl_font_ = fnum; fl_size_ = size;
|
||||
Fl_Fontdesc *font = fl_fonts + fnum;
|
||||
Fl_FontSize* f;
|
||||
Fl_Font_Descriptor* f;
|
||||
// search the fontsizes we have generated already
|
||||
for (f = font->first; f; f = f->next) {
|
||||
if (f->size == size && !strcasecmp(f->encoding, fl_encoding_))
|
||||
break;
|
||||
}
|
||||
if (!f) {
|
||||
f = new Fl_FontSize(font->name);
|
||||
f = new Fl_Font_Descriptor(font->name);
|
||||
f->next = font->first;
|
||||
font->first = f;
|
||||
}
|
||||
@ -231,7 +231,7 @@ static XftFont* fontopen(const char* name, bool core) {
|
||||
}
|
||||
} // end of fontopen
|
||||
|
||||
Fl_FontSize::Fl_FontSize(const char* name) {
|
||||
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name) {
|
||||
encoding = fl_encoding_;
|
||||
size = fl_size_;
|
||||
#if HAVE_GL
|
||||
@ -240,7 +240,7 @@ Fl_FontSize::Fl_FontSize(const char* name) {
|
||||
font = fontopen(name, false);
|
||||
}
|
||||
|
||||
Fl_FontSize::~Fl_FontSize() {
|
||||
Fl_Font_Descriptor::~Fl_Font_Descriptor() {
|
||||
if (this == fl_fontsize) fl_fontsize = 0;
|
||||
// XftFontClose(fl_display, font);
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ void Fl::set_font(Fl_Font fnum, const char* name) {
|
||||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
if (s->xlist && s->n >= 0) XFreeFontNames(s->xlist);
|
||||
#endif
|
||||
for (Fl_FontSize* f = s->first; f;) {
|
||||
Fl_FontSize* n = f->next; delete f; f = n;
|
||||
for (Fl_Font_Descriptor* f = s->first; f;) {
|
||||
Fl_Font_Descriptor* n = f->next; delete f; f = n;
|
||||
}
|
||||
s->first = 0;
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ void gl_remove_displaylist_fonts()
|
||||
|
||||
for (int j = 0 ; j < FL_FREE_FONT ; ++j)
|
||||
{
|
||||
Fl_FontSize* past = 0;
|
||||
Fl_Font_Descriptor* past = 0;
|
||||
Fl_Fontdesc* s = fl_fonts + j ;
|
||||
Fl_FontSize* f = s->first;
|
||||
Fl_Font_Descriptor* f = s->first;
|
||||
while (f != 0) {
|
||||
if(f->listbase) {
|
||||
if(f == s->first) {
|
||||
@ -113,7 +113,7 @@ void gl_remove_displaylist_fonts()
|
||||
// It would be nice if this next line was in a descturctor somewhere
|
||||
glDeleteLists(f->listbase, 256);
|
||||
|
||||
Fl_FontSize* tmp = f;
|
||||
Fl_Font_Descriptor* tmp = f;
|
||||
f = f->next;
|
||||
delete tmp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user