1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2000-02-04 09:38:32 +00:00
|
|
|
* Copyright 1997 Asger Alstrup
|
|
|
|
* and the LyX Team.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-15 12:01:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
#ifndef FONTLOADER_H_
|
|
|
|
#define FONTLOADER_H_
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-02-14 22:14:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
#include "lyxfont.h"
|
1999-11-22 16:19:48 +00:00
|
|
|
#include "LString.h"
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
class FontInfo;
|
|
|
|
|
1999-10-23 13:22:09 +00:00
|
|
|
/** This class takes care of loading fonts. It uses FontInfo to make
|
|
|
|
intelligent guesses about matching font size, and it tries different tags
|
|
|
|
itself in order to match the font loading demands. Later, I plan to extend
|
|
|
|
this with support for T1Lib, probably via a new class building on this.
|
|
|
|
(Asger) */
|
1999-09-27 18:44:28 +00:00
|
|
|
class FontLoader {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
FontLoader();
|
|
|
|
|
|
|
|
///
|
|
|
|
~FontLoader();
|
|
|
|
|
|
|
|
/// Update fonts after zoom, dpi, font names, or norm change
|
|
|
|
void update();
|
|
|
|
|
|
|
|
/// Load font
|
2000-02-04 09:38:32 +00:00
|
|
|
XFontStruct * load(LyXFont::FONT_FAMILY family,
|
|
|
|
LyXFont::FONT_SERIES series,
|
|
|
|
LyXFont::FONT_SHAPE shape,
|
|
|
|
LyXFont::FONT_SIZE size) {
|
|
|
|
if (fontstruct[family][series][shape][size] != 0)
|
1999-09-27 18:44:28 +00:00
|
|
|
return fontstruct[family][series][shape][size];
|
|
|
|
else
|
1999-11-15 12:01:38 +00:00
|
|
|
return doLoad(family, series, shape, size);
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
private:
|
|
|
|
/// Array of font structs
|
2000-02-04 09:38:32 +00:00
|
|
|
XFontStruct * fontstruct[4][2][4][10];
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Array of font infos
|
|
|
|
FontInfo * fontinfo[4][2][4];
|
|
|
|
|
|
|
|
/// Reset font handler
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
/// Unload all fonts
|
|
|
|
void unload();
|
|
|
|
|
|
|
|
/// Get font info
|
|
|
|
void getFontinfo(LyXFont::FONT_FAMILY family,
|
|
|
|
LyXFont::FONT_SERIES series,
|
|
|
|
LyXFont::FONT_SHAPE shape);
|
|
|
|
|
|
|
|
/** Does the actual loading of a font. Updates fontstruct. */
|
2000-02-04 09:38:32 +00:00
|
|
|
XFontStruct * doLoad(LyXFont::FONT_FAMILY family,
|
|
|
|
LyXFont::FONT_SERIES series,
|
|
|
|
LyXFont::FONT_SHAPE shape,
|
|
|
|
LyXFont::FONT_SIZE size);
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
#endif
|