rename LyXFont to Font except in tex2lyx

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18095 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-29 18:17:15 +00:00
parent ef4578ab6e
commit fc6ce7cd08
109 changed files with 901 additions and 904 deletions

View File

@ -12,7 +12,7 @@
#include "Bidi.h"
#include "Buffer.h"
#include "LyXFont.h"
#include "Font.h"
#include "Row.h"
#include "LyXRC.h"
#include "Paragraph.h"
@ -100,11 +100,11 @@ void Bidi::computeTables(Paragraph const & par,
!par.isLineSeparator(lpos + 1) &&
!par.isNewline(lpos + 1))
? lpos + 1 : lpos;
LyXFont font = par.getFontSettings(bufparams, pos);
Font font = par.getFontSettings(bufparams, pos);
if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
font.number() == LyXFont::ON &&
font.number() == Font::ON &&
par.getFontSettings(bufparams, lpos - 1).number()
== LyXFont::ON) {
== Font::ON) {
font = par.getFontSettings(bufparams, lpos);
is_space = false;
}
@ -196,7 +196,7 @@ bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par,
bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par,
pos_type pos, LyXFont const & font) const
pos_type pos, Font const & font) const
{
if (!lyxrc.rtl_support)
return false; // This is just for speedup

View File

@ -21,7 +21,7 @@ namespace lyx {
class Buffer;
class Paragraph;
class Row;
class LyXFont;
class Font;
/// bidi stuff
@ -32,7 +32,7 @@ public:
pos_type pos) const;
///
bool isBoundary(Buffer const &, Paragraph const & par,
pos_type pos, LyXFont const & font) const;
pos_type pos, Font const & font) const;
///
pos_type log2vis(pos_type pos) const;
/** Maps positions in the logical string to positions

View File

@ -517,9 +517,9 @@ bool Buffer::readDocument(Lexer & lex)
// needed to insert the selection
void Buffer::insertStringAsLines(ParagraphList & pars,
pit_type & pit, pos_type & pos,
LyXFont const & fn, docstring const & str, bool autobreakrows)
Font const & fn, docstring const & str, bool autobreakrows)
{
LyXFont font = fn;
Font font = fn;
// insert the string, don't insert doublespace
bool space_inserted = true;

View File

@ -40,7 +40,7 @@ class ErrorItem;
class FuncRequest;
class Inset;
class InsetText;
class LyXFont;
class Font;
class Lexer;
class LyXRC;
class LyXText;
@ -122,7 +122,7 @@ public:
///
void insertStringAsLines(ParagraphList & plist,
pit_type &, pos_type &,
LyXFont const &, docstring const &, bool);
Font const &, docstring const &, bool);
///
ParIterator getParFromID(int id) const;
/// do we have a paragraph with this id?

View File

@ -26,7 +26,7 @@
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Color.h"
#include "LyXFont.h"
#include "Font.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "LyXTextClassList.h"
@ -1173,16 +1173,16 @@ LyXTextClass const & BufferParams::getLyXTextClass() const
}
LyXFont const BufferParams::getFont() const
Font const BufferParams::getFont() const
{
LyXFont f = getLyXTextClass().defaultfont();
Font f = getLyXTextClass().defaultfont();
f.setLanguage(language);
if (fontsDefaultFamily == "rmdefault")
f.setFamily(LyXFont::ROMAN_FAMILY);
f.setFamily(Font::ROMAN_FAMILY);
else if (fontsDefaultFamily == "sfdefault")
f.setFamily(LyXFont::SANS_FAMILY);
f.setFamily(Font::SANS_FAMILY);
else if (fontsDefaultFamily == "ttdefault")
f.setFamily(LyXFont::TYPEWRITER_FAMILY);
f.setFamily(Font::TYPEWRITER_FAMILY);
return f;
}

View File

@ -100,7 +100,7 @@ public:
LyXTextClass const & getLyXTextClass() const;
/// returns the main font for the buffer (document)
LyXFont const getFont() const;
Font const getFont() const;
/* this are for the PaperLayout */
/// the papersize

View File

@ -24,7 +24,7 @@
#include "FuncRequest.h"
#include "Language.h"
#include "lfuns.h"
#include "LyXFont.h"
#include "Font.h"
#include "LyXFunc.h" // only for setMessage()
#include "LyXRC.h"
#include "Row.h"
@ -1234,7 +1234,7 @@ Encoding const * Cursor::getEncoding() const
break;
CursorSlice const & sl = operator[](s);
LyXText const & text = *sl.text();
LyXFont font = text.getPar(sl.pit()).getFont(
Font font = text.getPar(sl.pit()).getFont(
bv().buffer()->params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
return font.language()->encoding();
}
@ -1264,7 +1264,7 @@ void Cursor::noUpdate()
}
LyXFont Cursor::getFont() const
Font Cursor::getFont() const
{
// HACK. far from being perfect...
int s = 0;
@ -1275,7 +1275,7 @@ LyXFont Cursor::getFont() const
break;
CursorSlice const & sl = operator[](s);
LyXText const & text = *sl.text();
LyXFont font = text.getPar(sl.pit()).getFont(
Font font = text.getPar(sl.pit()).getFont(
bv().buffer()->params(),
sl.pos(),
outerFont(sl.pit(), text.paragraphs()));

View File

@ -25,7 +25,7 @@ class Buffer;
class BufferView;
class FuncStatus;
class FuncRequest;
class LyXFont;
class Font;
class Row;
// these should go
@ -306,7 +306,7 @@ public:
///
Encoding const * getEncoding() const;
/// font at cursor position
LyXFont getFont() const;
Font getFont() const;
///
bool isRTL() const;
};

View File

@ -626,7 +626,7 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack)
Paragraph par;
BufferParams const & bp = cur.buffer().params();
par.layout(bp.getLyXTextClass().defaultLayout());
par.insert(0, grabSelection(cur), LyXFont(), Change(Change::UNCHANGED));
par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
pars.push_back(par);
cutstack.push(make_pair(pars, bp.textclass));
}
@ -653,7 +653,7 @@ void copySelection(Cursor & cur, docstring const & plaintext)
Paragraph par;
BufferParams const & bp = cur.buffer().params();
par.layout(bp.getLyXTextClass().defaultLayout());
par.insert(0, plaintext, LyXFont(), Change(Change::UNCHANGED));
par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
pars.push_back(par);
theCuts.push(make_pair(pars, bp.textclass));
} else
@ -789,7 +789,7 @@ void replaceSelectionWithString(Cursor & cur, docstring const & str, bool backwa
DocIterator selbeg = cur.selectionBegin();
// Get font setting before we cut
LyXFont const font =
Font const font =
selbeg.paragraph().getFontSettings(cur.buffer().params(), selbeg.pos());
// Insert the new string

View File

@ -1,5 +1,5 @@
/**
* \file src/LyXFont.cpp
* \file src/Font.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -14,7 +14,7 @@
#include <config.h>
#include "LyXFont.h"
#include "Font.h"
#include "BufferParams.h" // stateText
#include "debug.h"
@ -48,7 +48,7 @@ using std::strlen;
namespace {
char const * GUIFamilyNames[LyXFont::NUM_FAMILIES + 2 /* default & error */] =
char const * GUIFamilyNames[Font::NUM_FAMILIES + 2 /* default & error */] =
{ N_("Roman"), N_("Sans Serif"), N_("Typewriter"), N_("Symbol"),
"cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "wasy", "esint",
N_("Inherit"), N_("Ignore") };
@ -72,7 +72,7 @@ char const * GUIMiscNames[5] =
//
// Strings used to read and write .lyx format files
//
char const * LyXFamilyNames[LyXFont::NUM_FAMILIES + 2 /* default & error */] =
char const * LyXFamilyNames[Font::NUM_FAMILIES + 2 /* default & error */] =
{ "roman", "sans", "typewriter", "symbol",
"cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "wasy", "esint",
"default", "error" };
@ -111,7 +111,7 @@ char const * LaTeXSizeNames[14] =
// Initialize static member
LyXFont::FontBits LyXFont::sane = {
Font::FontBits Font::sane = {
ROMAN_FAMILY,
MEDIUM_SERIES,
UP_SHAPE,
@ -123,7 +123,7 @@ LyXFont::FontBits LyXFont::sane = {
OFF };
// Initialize static member
LyXFont::FontBits LyXFont::inherit = {
Font::FontBits Font::inherit = {
INHERIT_FAMILY,
INHERIT_SERIES,
INHERIT_SHAPE,
@ -135,7 +135,7 @@ LyXFont::FontBits LyXFont::inherit = {
OFF };
// Initialize static member
LyXFont::FontBits LyXFont::ignore = {
Font::FontBits Font::ignore = {
IGNORE_FAMILY,
IGNORE_SERIES,
IGNORE_SHAPE,
@ -147,8 +147,8 @@ LyXFont::FontBits LyXFont::ignore = {
IGNORE };
bool operator==(LyXFont::FontBits const & lhs,
LyXFont::FontBits const & rhs)
bool operator==(Font::FontBits const & lhs,
Font::FontBits const & rhs)
{
return lhs.family == rhs.family &&
lhs.series == rhs.series &&
@ -162,123 +162,123 @@ bool operator==(LyXFont::FontBits const & lhs,
}
LyXFont::LyXFont()
Font::Font()
: bits(sane), lang(default_language)
{}
LyXFont::LyXFont(LyXFont::FONT_INIT1)
Font::Font(Font::FONT_INIT1)
: bits(inherit), lang(default_language)
{}
LyXFont::LyXFont(LyXFont::FONT_INIT2)
Font::Font(Font::FONT_INIT2)
: bits(ignore), lang(ignore_language)
{}
LyXFont::LyXFont(LyXFont::FONT_INIT3)
Font::Font(Font::FONT_INIT3)
: bits(sane), lang(default_language)
{}
LyXFont::LyXFont(LyXFont::FONT_INIT1, Language const * l)
Font::Font(Font::FONT_INIT1, Language const * l)
: bits(inherit), lang(l)
{}
LyXFont::LyXFont(LyXFont::FONT_INIT2, Language const * l)
Font::Font(Font::FONT_INIT2, Language const * l)
: bits(ignore), lang(l)
{}
LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
Font::Font(Font::FONT_INIT3, Language const * l)
: bits(sane), lang(l)
{}
Color_color LyXFont::color() const
Color_color Font::color() const
{
return Color::color(bits.color);
}
bool LyXFont::isRightToLeft() const
bool Font::isRightToLeft() const
{
return lang->rightToLeft();
}
bool LyXFont::isVisibleRightToLeft() const
bool Font::isVisibleRightToLeft() const
{
return (lang->rightToLeft() &&
number() != ON);
}
void LyXFont::setFamily(LyXFont::FONT_FAMILY f)
void Font::setFamily(Font::FONT_FAMILY f)
{
bits.family = f;
}
void LyXFont::setSeries(LyXFont::FONT_SERIES s)
void Font::setSeries(Font::FONT_SERIES s)
{
bits.series = s;
}
void LyXFont::setShape(LyXFont::FONT_SHAPE s)
void Font::setShape(Font::FONT_SHAPE s)
{
bits.shape = s;
}
void LyXFont::setSize(LyXFont::FONT_SIZE s)
void Font::setSize(Font::FONT_SIZE s)
{
bits.size = s;
}
void LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
void Font::setEmph(Font::FONT_MISC_STATE e)
{
bits.emph = e;
}
void LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
void Font::setUnderbar(Font::FONT_MISC_STATE u)
{
bits.underbar = u;
}
void LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
void Font::setNoun(Font::FONT_MISC_STATE n)
{
bits.noun = n;
}
void LyXFont::setColor(Color_color c)
void Font::setColor(Color_color c)
{
bits.color = int(c);
}
void LyXFont::setLanguage(Language const * l)
void Font::setLanguage(Language const * l)
{
lang = l;
}
void LyXFont::setNumber(LyXFont::FONT_MISC_STATE n)
void Font::setNumber(Font::FONT_MISC_STATE n)
{
bits.number = n;
}
/// Decreases font size by one
LyXFont & LyXFont::decSize()
Font & Font::decSize()
{
switch (size()) {
case SIZE_HUGER: setSize(SIZE_HUGE); break;
@ -292,16 +292,16 @@ LyXFont & LyXFont::decSize()
case SIZE_SCRIPT: setSize(SIZE_TINY); break;
case SIZE_TINY: break;
case INCREASE_SIZE:
lyxerr << "Can't LyXFont::decSize on INCREASE_SIZE" << endl;
lyxerr << "Can't Font::decSize on INCREASE_SIZE" << endl;
break;
case DECREASE_SIZE:
lyxerr <<"Can't LyXFont::decSize on DECREASE_SIZE" << endl;
lyxerr <<"Can't Font::decSize on DECREASE_SIZE" << endl;
break;
case INHERIT_SIZE:
lyxerr <<"Can't LyXFont::decSize on INHERIT_SIZE" << endl;
lyxerr <<"Can't Font::decSize on INHERIT_SIZE" << endl;
break;
case IGNORE_SIZE:
lyxerr <<"Can't LyXFont::decSize on IGNORE_SIZE" << endl;
lyxerr <<"Can't Font::decSize on IGNORE_SIZE" << endl;
break;
}
return *this;
@ -309,7 +309,7 @@ LyXFont & LyXFont::decSize()
/// Increases font size by one
LyXFont & LyXFont::incSize()
Font & Font::incSize()
{
switch (size()) {
case SIZE_HUGER: break;
@ -323,16 +323,16 @@ LyXFont & LyXFont::incSize()
case SIZE_SCRIPT: setSize(SIZE_FOOTNOTE); break;
case SIZE_TINY: setSize(SIZE_SCRIPT); break;
case INCREASE_SIZE:
lyxerr <<"Can't LyXFont::incSize on INCREASE_SIZE" << endl;
lyxerr <<"Can't Font::incSize on INCREASE_SIZE" << endl;
break;
case DECREASE_SIZE:
lyxerr <<"Can't LyXFont::incSize on DECREASE_SIZE" << endl;
lyxerr <<"Can't Font::incSize on DECREASE_SIZE" << endl;
break;
case INHERIT_SIZE:
lyxerr <<"Can't LyXFont::incSize on INHERIT_SIZE" << endl;
lyxerr <<"Can't Font::incSize on INHERIT_SIZE" << endl;
break;
case IGNORE_SIZE:
lyxerr <<"Can't LyXFont::incSize on IGNORE_SIZE" << endl;
lyxerr <<"Can't Font::incSize on IGNORE_SIZE" << endl;
break;
}
return *this;
@ -340,7 +340,7 @@ LyXFont & LyXFont::incSize()
/// Updates a misc setting according to request
LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
Font::FONT_MISC_STATE Font::setMisc(FONT_MISC_STATE newfont,
FONT_MISC_STATE org)
{
if (newfont == TOGGLE) {
@ -349,7 +349,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
else if (org == OFF)
return ON;
else {
lyxerr <<"LyXFont::setMisc: Need state"
lyxerr <<"Font::setMisc: Need state"
" ON or OFF to toggle. Setting to ON" << endl;
return ON;
}
@ -361,7 +361,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
/// Updates font settings according to request
void LyXFont::update(LyXFont const & newfont,
void Font::update(Font const & newfont,
Language const * document_language,
bool toggleall)
{
@ -424,7 +424,7 @@ void LyXFont::update(LyXFont const & newfont,
/// Reduce font to fall back to template where possible
void LyXFont::reduce(LyXFont const & tmplt)
void Font::reduce(Font const & tmplt)
{
if (family() == tmplt.family())
setFamily(INHERIT_FAMILY);
@ -446,7 +446,7 @@ void LyXFont::reduce(LyXFont const & tmplt)
/// Realize font from a template
LyXFont & LyXFont::realize(LyXFont const & tmplt)
Font & Font::realize(Font const & tmplt)
{
if (bits == inherit) {
bits = tmplt.bits;
@ -482,7 +482,7 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
/// Is font resolved?
bool LyXFont::resolved() const
bool Font::resolved() const
{
return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
@ -492,7 +492,7 @@ bool LyXFont::resolved() const
}
docstring const LyXFont::stateText(BufferParams * params) const
docstring const Font::stateText(BufferParams * params) const
{
odocstringstream os;
if (family() != INHERIT_FAMILY)
@ -527,7 +527,7 @@ docstring const LyXFont::stateText(BufferParams * params) const
// Set family according to lyx format string
LyXFont & LyXFont::setLyXFamily(string const & fam)
Font & Font::setLyXFamily(string const & fam)
{
string const s = ascii_lowercase(fam);
@ -536,16 +536,16 @@ LyXFont & LyXFont::setLyXFamily(string const & fam)
LyXFamilyNames[i] != string("error"))
++i;
if (s == LyXFamilyNames[i])
setFamily(LyXFont::FONT_FAMILY(i));
setFamily(Font::FONT_FAMILY(i));
else
lyxerr << "LyXFont::setLyXFamily: Unknown family `"
lyxerr << "Font::setLyXFamily: Unknown family `"
<< s << '\'' << endl;
return *this;
}
// Set series according to lyx format string
LyXFont & LyXFont::setLyXSeries(string const & ser)
Font & Font::setLyXSeries(string const & ser)
{
string const s = ascii_lowercase(ser);
@ -553,16 +553,16 @@ LyXFont & LyXFont::setLyXSeries(string const & ser)
while (LyXSeriesNames[i] != s &&
LyXSeriesNames[i] != string("error")) ++i;
if (s == LyXSeriesNames[i]) {
setSeries(LyXFont::FONT_SERIES(i));
setSeries(Font::FONT_SERIES(i));
} else
lyxerr << "LyXFont::setLyXSeries: Unknown series `"
lyxerr << "Font::setLyXSeries: Unknown series `"
<< s << '\'' << endl;
return *this;
}
// Set shape according to lyx format string
LyXFont & LyXFont::setLyXShape(string const & sha)
Font & Font::setLyXShape(string const & sha)
{
string const s = ascii_lowercase(sha);
@ -570,32 +570,32 @@ LyXFont & LyXFont::setLyXShape(string const & sha)
while (LyXShapeNames[i] != s && LyXShapeNames[i] != string("error"))
++i;
if (s == LyXShapeNames[i])
setShape(LyXFont::FONT_SHAPE(i));
setShape(Font::FONT_SHAPE(i));
else
lyxerr << "LyXFont::setLyXShape: Unknown shape `"
lyxerr << "Font::setLyXShape: Unknown shape `"
<< s << '\'' << endl;
return *this;
}
// Set size according to lyx format string
LyXFont & LyXFont::setLyXSize(string const & siz)
Font & Font::setLyXSize(string const & siz)
{
string const s = ascii_lowercase(siz);
int i = 0;
while (LyXSizeNames[i] != s && LyXSizeNames[i] != string("error"))
++i;
if (s == LyXSizeNames[i]) {
setSize(LyXFont::FONT_SIZE(i));
setSize(Font::FONT_SIZE(i));
} else
lyxerr << "LyXFont::setLyXSize: Unknown size `"
lyxerr << "Font::setLyXSize: Unknown size `"
<< s << '\'' << endl;
return *this;
}
// Set size according to lyx format string
LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
Font::FONT_MISC_STATE Font::setLyXMisc(string const & siz)
{
string const s = ascii_lowercase(siz);
int i = 0;
@ -603,14 +603,14 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
LyXMiscNames[i] != string("error")) ++i;
if (s == LyXMiscNames[i])
return FONT_MISC_STATE(i);
lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `"
lyxerr << "Font::setLyXMisc: Unknown misc flag `"
<< s << '\'' << endl;
return OFF;
}
/// Sets color after LyX text format
LyXFont & LyXFont::setLyXColor(string const & col)
Font & Font::setLyXColor(string const & col)
{
setColor(lcolor.getFromLyXName(col));
return *this;
@ -618,7 +618,7 @@ LyXFont & LyXFont::setLyXColor(string const & col)
// Returns size in latex format
string const LyXFont::latexSize() const
string const Font::latexSize() const
{
return LaTeXSizeNames[size()];
}
@ -626,7 +626,7 @@ string const LyXFont::latexSize() const
// Read a font definition from given file in lyx format
// Used for layouts
LyXFont & LyXFont::lyxRead(Lexer & lex)
Font & Font::lyxRead(Lexer & lex)
{
bool error = false;
bool finished = false;
@ -687,7 +687,7 @@ LyXFont & LyXFont::lyxRead(Lexer & lex)
/// Writes the changes from this font to orgfont in .lyx format in file
void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
void Font::lyxWriteChanges(Font const & orgfont,
ostream & os) const
{
os << "\n";
@ -708,12 +708,12 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
switch (underbar()) {
case OFF: os << "\\bar no\n"; break;
case ON: os << "\\bar under\n"; break;
case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: "
case TOGGLE: lyxerr << "Font::lyxWriteFontChanges: "
"TOGGLE should not appear here!"
<< endl;
break;
case INHERIT: os << "\\bar default\n"; break;
case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: "
case IGNORE: lyxerr << "Font::lyxWriteFontChanges: "
"IGNORE should not appear here!"
<< endl;
break;
@ -736,8 +736,8 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
/// Writes the head of the LaTeX needed to impose this font
// Returns number of chars written.
int LyXFont::latexWriteStartChanges(odocstream & os, LyXFont const & base,
LyXFont const & prev) const
int Font::latexWriteStartChanges(odocstream & os, Font const & base,
Font const & prev) const
{
bool env = false;
@ -767,7 +767,7 @@ int LyXFont::latexWriteStartChanges(odocstream & os, LyXFont const & base,
count += 9;
}
LyXFont f = *this;
Font f = *this;
f.reduce(base);
if (f.family() != INHERIT_FAMILY) {
@ -832,8 +832,8 @@ int LyXFont::latexWriteStartChanges(odocstream & os, LyXFont const & base,
/// Writes ending block of LaTeX needed to close use of this font
// Returns number of chars written
// This one corresponds to latexWriteStartChanges(). (Asger)
int LyXFont::latexWriteEndChanges(odocstream & os, LyXFont const & base,
LyXFont const & next) const
int Font::latexWriteEndChanges(odocstream & os, Font const & base,
Font const & next) const
{
int count = 0;
bool env = false;
@ -841,7 +841,7 @@ int LyXFont::latexWriteEndChanges(odocstream & os, LyXFont const & base,
// reduce the current font to changes against the base
// font (of the layout). We use a temporary for this to
// avoid changing this font instance, as that would break
LyXFont f = *this;
Font f = *this;
f.reduce(base);
if (f.family() != INHERIT_FAMILY) {
@ -902,7 +902,7 @@ int LyXFont::latexWriteEndChanges(odocstream & os, LyXFont const & base,
}
Color_color LyXFont::realColor() const
Color_color Font::realColor() const
{
if (color() == Color::none)
return Color::foreground;
@ -910,13 +910,13 @@ Color_color LyXFont::realColor() const
}
ostream & operator<<(ostream & os, LyXFont::FONT_MISC_STATE fms)
ostream & operator<<(ostream & os, Font::FONT_MISC_STATE fms)
{
return os << int(fms);
}
std::ostream & operator<<(std::ostream & os, LyXFont const & font)
std::ostream & operator<<(std::ostream & os, Font const & font)
{
return os << "font:"
<< " family " << font.bits.family

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file src/LyXFont.h
* \file src/Font.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -12,8 +12,8 @@
* Full author contact details are available in file CREDITS.
*/
#ifndef LYXFONT_H
#define LYXFONT_H
#ifndef FONT_H
#define FONT_H
#include "Color.h"
#include "support/docstream.h"
@ -28,12 +28,12 @@ class Language;
///
class LyXFont {
class Font {
public:
/** The value INHERIT_* means that the font attribute is
inherited from the layout. In the case of layout fonts, the
attribute is inherited from the default font.
The value IGNORE_* is used with LyXFont::update() when the
The value IGNORE_* is used with Font::update() when the
attribute should not be changed.
*/
enum FONT_FAMILY {
@ -184,28 +184,25 @@ public:
FONT_MISC_STATE number;
};
///
LyXFont();
Font();
/// Shortcut initialization
explicit
LyXFont(LyXFont::FONT_INIT1);
explicit Font(Font::FONT_INIT1);
/// Shortcut initialization
explicit
LyXFont(LyXFont::FONT_INIT2);
explicit Font(Font::FONT_INIT2);
/// Shortcut initialization
explicit
LyXFont(LyXFont::FONT_INIT3);
explicit Font(Font::FONT_INIT3);
/// Shortcut initialization
LyXFont(LyXFont::FONT_INIT1, Language const * l);
Font(Font::FONT_INIT1, Language const * l);
/// Shortcut initialization
LyXFont(LyXFont::FONT_INIT2, Language const * l);
Font(Font::FONT_INIT2, Language const * l);
/// Shortcut initialization
LyXFont(LyXFont::FONT_INIT3, Language const * l);
Font(Font::FONT_INIT3, Language const * l);
/// Decreases font size by one
LyXFont & decSize();
Font & decSize();
/// Increases font size by one
LyXFont & incSize();
Font & incSize();
///
FONT_FAMILY family() const { return bits.family; }
///
@ -234,34 +231,34 @@ public:
bool isSymbolFont() const;
///
void setFamily(LyXFont::FONT_FAMILY f);
void setSeries(LyXFont::FONT_SERIES s);
void setShape(LyXFont::FONT_SHAPE s);
void setSize(LyXFont::FONT_SIZE s);
void setEmph(LyXFont::FONT_MISC_STATE e);
void setUnderbar(LyXFont::FONT_MISC_STATE u);
void setNoun(LyXFont::FONT_MISC_STATE n);
void setNumber(LyXFont::FONT_MISC_STATE n);
void setFamily(Font::FONT_FAMILY f);
void setSeries(Font::FONT_SERIES s);
void setShape(Font::FONT_SHAPE s);
void setSize(Font::FONT_SIZE s);
void setEmph(Font::FONT_MISC_STATE e);
void setUnderbar(Font::FONT_MISC_STATE u);
void setNoun(Font::FONT_MISC_STATE n);
void setNumber(Font::FONT_MISC_STATE n);
void setColor(Color_color c);
void setLanguage(Language const * l);
/// Set family after LyX text format
LyXFont & setLyXFamily(std::string const &);
Font & setLyXFamily(std::string const &);
/// Set series after LyX text format
LyXFont & setLyXSeries(std::string const &);
Font & setLyXSeries(std::string const &);
/// Set shape after LyX text format
LyXFont & setLyXShape(std::string const &);
Font & setLyXShape(std::string const &);
/// Set size after LyX text format
LyXFont & setLyXSize(std::string const &);
Font & setLyXSize(std::string const &);
/// Returns misc flag after LyX text format
LyXFont::FONT_MISC_STATE setLyXMisc(std::string const &);
Font::FONT_MISC_STATE setLyXMisc(std::string const &);
/// Sets color after LyX text format
LyXFont & setLyXColor(std::string const &);
Font & setLyXColor(std::string const &);
/// Returns size of font in LaTeX text notation
std::string const latexSize() const;
@ -275,39 +272,39 @@ public:
a INHERIT_FAMILY was asked for. This is necessary for the
toggle-user-defined-style button on the toolbar.
*/
void update(LyXFont const & newfont,
void update(Font const & newfont,
Language const * default_lang,
bool toggleall = false);
/** Reduce font to fall back to template where possible.
Equal fields are reduced to INHERIT */
void reduce(LyXFont const & tmplt);
void reduce(Font const & tmplt);
/// Realize font from a template (INHERIT are realized)
LyXFont & realize(LyXFont const & tmplt);
Font & realize(Font const & tmplt);
/// Is a given font fully resolved?
bool resolved() const;
/// Read a font specification from Lexer. Used for layout files.
LyXFont & lyxRead(Lexer &);
Font & lyxRead(Lexer &);
/// Writes the changes from this font to orgfont in .lyx format in file
void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const;
void lyxWriteChanges(Font const & orgfont, std::ostream &) const;
/** Writes the head of the LaTeX needed to change to this font.
Writes to string, the head of the LaTeX needed to change
to this font. Returns number of chars written. Base is the
font state active now.
*/
int latexWriteStartChanges(odocstream &, LyXFont const & base,
LyXFont const & prev) const;
int latexWriteStartChanges(odocstream &, Font const & base,
Font const & prev) const;
/** Writes the tail of the LaTeX needed to change to this font.
Returns number of chars written. Base is the font state we want
to achieve.
*/
int latexWriteEndChanges(odocstream &, LyXFont const & base,
LyXFont const & next) const;
int latexWriteEndChanges(odocstream &, Font const & base,
Font const & next) const;
/// Build GUI description of font state
@ -318,14 +315,14 @@ public:
///
friend
bool operator==(LyXFont const & font1, LyXFont const & font2);
bool operator==(Font const & font1, Font const & font2);
///
friend
std::ostream & operator<<(std::ostream & os, LyXFont const & font);
std::ostream & operator<<(std::ostream & os, Font const & font);
/// Converts logical attributes to concrete shape attribute
// Try hard to inline this as it shows up with 4.6 % in the profiler.
LyXFont::FONT_SHAPE realShape() const {
inline Font::FONT_SHAPE realShape() const {
if (bits.noun == ON)
return SMALLCAPS_SHAPE;
if (bits.emph == ON)
@ -349,40 +346,40 @@ private:
/// All ignore font
static FontBits ignore;
/// Updates a misc setting according to request
LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
LyXFont::FONT_MISC_STATE org);
Font::FONT_MISC_STATE setMisc(Font::FONT_MISC_STATE newfont,
Font::FONT_MISC_STATE org);
};
/** \c LyXFont_size is a wrapper for LyXFont::FONT_SIZE.
/** \c Font_size is a wrapper for Font::FONT_SIZE.
* It can be forward-declared and passed as a function argument without
* having to expose LyXFont.h.
* having to expose Font.h.
*/
class LyXFont_size {
class Font_size {
public:
///
LyXFont_size(LyXFont::FONT_SIZE val) : val_(val) {}
Font_size(Font::FONT_SIZE val) : val_(val) {}
///
operator LyXFont::FONT_SIZE() const { return val_; }
operator Font::FONT_SIZE() const { return val_; }
private:
///
LyXFont::FONT_SIZE val_;
Font::FONT_SIZE val_;
};
inline
bool LyXFont::isSymbolFont() const
bool Font::isSymbolFont() const
{
switch (family()) {
case LyXFont::SYMBOL_FAMILY:
case LyXFont::CMSY_FAMILY:
case LyXFont::CMM_FAMILY:
case LyXFont::CMEX_FAMILY:
case LyXFont::MSA_FAMILY:
case LyXFont::MSB_FAMILY:
case LyXFont::WASY_FAMILY:
case LyXFont::ESINT_FAMILY:
case Font::SYMBOL_FAMILY:
case Font::CMSY_FAMILY:
case Font::CMM_FAMILY:
case Font::CMEX_FAMILY:
case Font::MSA_FAMILY:
case Font::MSB_FAMILY:
case Font::WASY_FAMILY:
case Font::ESINT_FAMILY:
return true;
default:
return false;
@ -390,26 +387,26 @@ bool LyXFont::isSymbolFont() const
}
///
std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
std::ostream & operator<<(std::ostream &, Font::FONT_MISC_STATE);
bool operator==(LyXFont::FontBits const & lhs, LyXFont::FontBits const & rhs);
bool operator==(Font::FontBits const & lhs, Font::FontBits const & rhs);
inline
bool operator!=(LyXFont::FontBits const & lhs, LyXFont::FontBits const & rhs)
bool operator!=(Font::FontBits const & lhs, Font::FontBits const & rhs)
{
return !(lhs == rhs);
}
///
inline
bool operator==(LyXFont const & font1, LyXFont const & font2)
bool operator==(Font const & font1, Font const & font2)
{
return font1.bits == font2.bits && font1.lang == font2.lang;
}
///
inline
bool operator!=(LyXFont const & font1, LyXFont const & font2)
bool operator!=(Font const & font1, Font const & font2)
{
return !(font1 == font2);
}

View File

@ -31,13 +31,13 @@ FontIterator::FontIterator(Buffer const & buffer, LyXText const & text,
{}
LyXFont const & FontIterator::operator*() const
Font const & FontIterator::operator*() const
{
return font_;
}
LyXFont * FontIterator::operator->()
Font * FontIterator::operator->()
{
return &font_;
}

View File

@ -20,7 +20,7 @@
#ifndef FONTITERATOR_H
#define FONTITERATOR_H
#include "LyXFont.h"
#include "Font.h"
#include "support/types.h"
@ -32,18 +32,18 @@ class LyXText;
class Paragraph;
class FontIterator : std::iterator<std::forward_iterator_tag, LyXFont>
class FontIterator : std::iterator<std::forward_iterator_tag, Font>
{
public:
///
FontIterator(Buffer const & buffer, LyXText const & text,
Paragraph const & par, pos_type pos);
///
LyXFont const & operator*() const;
Font const & operator*() const;
///
FontIterator & operator++();
///
LyXFont * operator->();
Font * operator->();
private:
///
@ -55,7 +55,7 @@ private:
///
pos_type pos_;
///
LyXFont font_;
Font font_;
///
pos_type endspan_;
///

View File

@ -153,7 +153,7 @@ int Length::inPixels(int text_width, int em_width_base) const
? em_width_base
: 10*(dpi/72.27)*zoom;
// A different estimate for em_width is
// theFontMetrics(LyXFont(LyXFont::ALL_SANE)).width('M')
// theFontMetrics(Font(Font::ALL_SANE)).width('M')
// but this estimate might not be more accurate as the screen font
// is different then the latex font.

View File

@ -103,10 +103,10 @@ LyXLayout::LyXLayout ()
optionalargs = 0;
needprotect = false;
keepempty = false;
font = LyXFont(LyXFont::ALL_INHERIT);
labelfont = LyXFont(LyXFont::ALL_INHERIT);
resfont = LyXFont(LyXFont::ALL_SANE);
reslabelfont = LyXFont(LyXFont::ALL_SANE);
font = Font(Font::ALL_INHERIT);
labelfont = Font(Font::ALL_INHERIT);
resfont = Font(Font::ALL_SANE);
reslabelfont = Font(Font::ALL_SANE);
nextnoindent = false;
parskip = 0.0;
itemsep = 0;

View File

@ -14,7 +14,7 @@
#ifndef LYX_LAYOUT_H
#define LYX_LAYOUT_H
#include "LyXFont.h"
#include "Font.h"
#include "layout.h"
#include "Spacing.h"
#include "support/docstring.h"
@ -78,30 +78,30 @@ public:
}
/** Default font for this layout/environment.
The main font for this kind of environment. If an attribute has
LyXFont::INHERITED_*, it means that the value is specified by
Font::INHERITED_*, it means that the value is specified by
the defaultfont for the entire layout. If we are nested, the
font is inherited from the font in the environment one level
up until the font is resolved. The values LyXFont::IGNORE_*
and LyXFont::TOGGLE are illegal here.
up until the font is resolved. The values Font::IGNORE_*
and Font::TOGGLE are illegal here.
*/
LyXFont font;
Font font;
/** Default font for labels.
Interpretation the same as for font above
*/
LyXFont labelfont;
Font labelfont;
/** Resolved version of the font for this layout/environment.
This is a resolved version the default font. The font is resolved
against the defaultfont of the entire layout.
*/
LyXFont resfont;
Font resfont;
/** Resolved version of the font used for labels.
This is a resolved version the label font. The font is resolved
against the defaultfont of the entire layout.
*/
LyXFont reslabelfont;
Font reslabelfont;
/// Text that dictates how wide the left margin is on the screen
std::string leftmargin;

View File

@ -28,7 +28,7 @@
#include "Session.h"
#include "Color.h"
#include "Lexer.h"
#include "LyXFont.h"
#include "Font.h"
#include "Mover.h"
#include "graphics/GraphicsTypes.h"
@ -222,16 +222,16 @@ void LyXRC::setDefaults() {
geometry_height = 0;
geometry_xysaved = true;
// Default LaTeX font size:
font_sizes[LyXFont::SIZE_TINY] = "5.0";
font_sizes[LyXFont::SIZE_SCRIPT] = "7.0";
font_sizes[LyXFont::SIZE_FOOTNOTE] = "8.0";
font_sizes[LyXFont::SIZE_SMALL] = "9.0";
font_sizes[LyXFont::SIZE_NORMAL] = "10.0";
font_sizes[LyXFont::SIZE_LARGE] = "12.0";
font_sizes[LyXFont::SIZE_LARGER] = "14.4";
font_sizes[LyXFont::SIZE_LARGEST] = "17.26";
font_sizes[LyXFont::SIZE_HUGE] = "20.74";
font_sizes[LyXFont::SIZE_HUGER] = "24.88";
font_sizes[Font::SIZE_TINY] = "5.0";
font_sizes[Font::SIZE_SCRIPT] = "7.0";
font_sizes[Font::SIZE_FOOTNOTE] = "8.0";
font_sizes[Font::SIZE_SMALL] = "9.0";
font_sizes[Font::SIZE_NORMAL] = "10.0";
font_sizes[Font::SIZE_LARGE] = "12.0";
font_sizes[Font::SIZE_LARGER] = "14.4";
font_sizes[Font::SIZE_LARGEST] = "17.26";
font_sizes[Font::SIZE_HUGE] = "20.74";
font_sizes[Font::SIZE_HUGER] = "24.88";
use_scalable_fonts = true;
roman_font_name = "";
sans_font_name = "";
@ -649,43 +649,43 @@ int LyXRC::read(Lexer & lexrc)
case RC_SCREEN_FONT_SIZES:
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_TINY] =
font_sizes[Font::SIZE_TINY] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_SCRIPT] =
font_sizes[Font::SIZE_SCRIPT] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_FOOTNOTE] =
font_sizes[Font::SIZE_FOOTNOTE] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_SMALL] =
font_sizes[Font::SIZE_SMALL] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_NORMAL] =
font_sizes[Font::SIZE_NORMAL] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGE] =
font_sizes[Font::SIZE_LARGE] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGER] =
font_sizes[Font::SIZE_LARGER] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_LARGEST] =
font_sizes[Font::SIZE_LARGEST] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_HUGE] =
font_sizes[Font::SIZE_HUGE] =
lexrc.getString();
}
if (lexrc.next()) {
font_sizes[LyXFont::SIZE_HUGER] =
font_sizes[Font::SIZE_HUGER] =
lexrc.getString();
}
break;
@ -1545,39 +1545,39 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
}
case RC_SCREEN_FONT_SIZES:
if (ignore_system_lyxrc ||
font_sizes[LyXFont::SIZE_TINY]
!= system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
font_sizes[LyXFont::SIZE_SCRIPT]
!= system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
font_sizes[LyXFont::SIZE_FOOTNOTE]
!= system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
font_sizes[LyXFont::SIZE_SMALL]
!= system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
font_sizes[LyXFont::SIZE_NORMAL]
!= system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
font_sizes[LyXFont::SIZE_LARGE]
!= system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
font_sizes[LyXFont::SIZE_LARGER]
!= system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
font_sizes[LyXFont::SIZE_LARGEST]
!= system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
font_sizes[LyXFont::SIZE_HUGE]
!= system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
font_sizes[LyXFont::SIZE_HUGER]
!= system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
font_sizes[Font::SIZE_TINY]
!= system_lyxrc.font_sizes[Font::SIZE_TINY] ||
font_sizes[Font::SIZE_SCRIPT]
!= system_lyxrc.font_sizes[Font::SIZE_SCRIPT] ||
font_sizes[Font::SIZE_FOOTNOTE]
!= system_lyxrc.font_sizes[Font::SIZE_FOOTNOTE] ||
font_sizes[Font::SIZE_SMALL]
!= system_lyxrc.font_sizes[Font::SIZE_SMALL] ||
font_sizes[Font::SIZE_NORMAL]
!= system_lyxrc.font_sizes[Font::SIZE_NORMAL] ||
font_sizes[Font::SIZE_LARGE]
!= system_lyxrc.font_sizes[Font::SIZE_LARGE] ||
font_sizes[Font::SIZE_LARGER]
!= system_lyxrc.font_sizes[Font::SIZE_LARGER] ||
font_sizes[Font::SIZE_LARGEST]
!= system_lyxrc.font_sizes[Font::SIZE_LARGEST] ||
font_sizes[Font::SIZE_HUGE]
!= system_lyxrc.font_sizes[Font::SIZE_HUGE] ||
font_sizes[Font::SIZE_HUGER]
!= system_lyxrc.font_sizes[Font::SIZE_HUGER]) {
os.setf(ios::fixed);
os.precision(2);
os << "\\screen_font_sizes"
<< ' ' << font_sizes[LyXFont::SIZE_TINY]
<< ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
<< ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
<< ' ' << font_sizes[LyXFont::SIZE_SMALL]
<< ' ' << font_sizes[LyXFont::SIZE_NORMAL]
<< ' ' << font_sizes[LyXFont::SIZE_LARGE]
<< ' ' << font_sizes[LyXFont::SIZE_LARGER]
<< ' ' << font_sizes[LyXFont::SIZE_LARGEST]
<< ' ' << font_sizes[LyXFont::SIZE_HUGE]
<< ' ' << font_sizes[LyXFont::SIZE_HUGER]
<< ' ' << font_sizes[Font::SIZE_TINY]
<< ' ' << font_sizes[Font::SIZE_SCRIPT]
<< ' ' << font_sizes[Font::SIZE_FOOTNOTE]
<< ' ' << font_sizes[Font::SIZE_SMALL]
<< ' ' << font_sizes[Font::SIZE_NORMAL]
<< ' ' << font_sizes[Font::SIZE_LARGE]
<< ' ' << font_sizes[Font::SIZE_LARGER]
<< ' ' << font_sizes[Font::SIZE_LARGEST]
<< ' ' << font_sizes[Font::SIZE_HUGE]
<< ' ' << font_sizes[Font::SIZE_HUGER]
<< '\n';
}

View File

@ -16,7 +16,7 @@
#include "Bidi.h"
#include "DispatchResult.h"
#include "LyXFont.h"
#include "Font.h"
#include "layout.h"
#include "lyxlayout_ptr_fwd.h"
#include "ParagraphList.h"
@ -50,18 +50,18 @@ public:
explicit LyXText();
///
LyXFont getFont(Buffer const & buffer, Paragraph const & par,
Font getFont(Buffer const & buffer, Paragraph const & par,
pos_type pos) const;
///
void applyOuterFont(Buffer const & buffer, LyXFont &) const;
void applyOuterFont(Buffer const & buffer, Font &) const;
///
LyXFont getLayoutFont(Buffer const & buffer, pit_type pit) const;
Font getLayoutFont(Buffer const & buffer, pit_type pit) const;
///
LyXFont getLabelFont(Buffer const & buffer,
Font getLabelFont(Buffer const & buffer,
Paragraph const & par) const;
///
void setCharFont(Buffer const & buffer, pit_type pit, pos_type pos,
LyXFont const & font);
Font const & font);
/// what you expect when pressing \<enter\> at cursor position
void breakParagraph(Cursor & cur, bool keep_layout = false);
@ -88,10 +88,10 @@ public:
/// Set font over selection paragraphs and rebreak.
/// FIXME: replace Cursor with DocIterator.
void setFont(Cursor & cur, LyXFont const &, bool toggleall = false);
void setFont(Cursor & cur, Font const &, bool toggleall = false);
///
void toggleFree(Cursor & cur, LyXFont const &, bool toggleall = false);
void toggleFree(Cursor & cur, Font const &, bool toggleall = false);
/// ???
/// FIXME: replace Cursor with DocIterator.
@ -293,7 +293,7 @@ public:
///
/// FIXME: move to TextMetrics.
int singleWidth(Paragraph const & par, pos_type pos, char_type c,
LyXFont const & Font) const;
Font const & Font) const;
/// return the color of the canvas
Color_color backgroundColor() const;
@ -358,9 +358,9 @@ public:
public:
/// the current font settings
LyXFont current_font;
Font current_font;
/// the current font
LyXFont real_current_font;
Font real_current_font;
///
int background_color_;
@ -371,7 +371,7 @@ public:
/// our 'outermost' font. This is handed down from the surrounding
// inset through the pi/mi parameter (pi.base.font)
LyXFont font_;
Font font_;
///
bool autoBreakRows_;

View File

@ -110,7 +110,7 @@ LyXTextClass::LyXTextClass(string const & fn, string const & cln,
secnumdepth_ = 3;
tocdepth_ = 3;
pagestyle_ = "default";
defaultfont_ = LyXFont(LyXFont::ALL_SANE);
defaultfont_ = Font(Font::ALL_SANE);
opt_fontsize_ = "10|11|12";
opt_pagestyle_ = "empty|plain|headings|fancy";
titletype_ = TITLE_COMMAND_AFTER;
@ -353,7 +353,7 @@ bool LyXTextClass::read(FileName const & filename, bool merge)
if (!defaultfont_.resolved()) {
lexrc.printError("Warning: defaultfont should "
"be fully instantiated!");
defaultfont_.realize(LyXFont(LyXFont::ALL_SANE));
defaultfont_.realize(Font(Font::ALL_SANE));
}
break;
@ -614,8 +614,8 @@ void LyXTextClass::readCharStyle(Lexer & lexrc, string const & name)
string latextype;
string latexname;
string latexparam;
LyXFont font(LyXFont::ALL_INHERIT);
LyXFont labelfont(LyXFont::ALL_INHERIT);
Font font(Font::ALL_INHERIT);
Font labelfont(Font::ALL_INHERIT);
string preamble;
bool getout = false;
@ -832,7 +832,7 @@ void LyXTextClass::readCounter(Lexer & lexrc)
}
LyXFont const & LyXTextClass::defaultfont() const
Font const & LyXTextClass::defaultfont() const
{
return defaultfont_;
}

View File

@ -34,8 +34,8 @@ public:
std::string latextype;
std::string latexname;
std::string latexparam;
LyXFont font;
LyXFont labelfont;
Font font;
Font labelfont;
docstring preamble;
};
@ -149,7 +149,7 @@ public:
OutputType outputType() const;
///
LyXFont const & defaultfont() const;
Font const & defaultfont() const;
/// Text that dictates how wide the left margin is on the screen
std::string const & leftmargin() const;
@ -209,10 +209,10 @@ private:
OutputType outputType_;
/** Base font. The paragraph and layout fonts are resolved against
this font. This has to be fully instantiated. Attributes
LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
Font::INHERIT, Font::IGNORE, and Font::TOGGLE are
extremely illegal.
*/
LyXFont defaultfont_;
Font defaultfont_;
/// Text that dictates how wide the left margin is on the screen
std::string leftmargin_;

View File

@ -126,6 +126,8 @@ lyx_SOURCES = \
Floating.h \
FloatList.cpp \
FloatList.h \
Font.cpp \
Font.h \
FontIterator.cpp \
FontIterator.h \
Format.cpp \
@ -172,8 +174,6 @@ lyx_SOURCES = \
LyX.cpp \
lyxfind.cpp \
lyxfind.h \
LyXFont.cpp \
LyXFont.h \
LyXFunc.cpp \
LyXFunc.h \
LyX.h \

View File

@ -32,7 +32,7 @@ MetricsBase::MetricsBase()
{}
MetricsBase::MetricsBase(BufferView * b, LyXFont const & f, int w)
MetricsBase::MetricsBase(BufferView * b, Font const & f, int w)
: bv(b), font(f), style(LM_ST_TEXT), fontname("mathnormal"),
textwidth(w)
{}
@ -43,7 +43,7 @@ MetricsInfo::MetricsInfo()
{}
MetricsInfo::MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth)
MetricsInfo::MetricsInfo(BufferView * bv, Font const & font, int textwidth)
: base(bv, font, textwidth)
{}
@ -114,8 +114,8 @@ ArrayChanger::ArrayChanger(MetricsBase & mb)
ShapeChanger::ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape)
: Changer<LyXFont, LyXFont::FONT_SHAPE>(font)
ShapeChanger::ShapeChanger(Font & font, Font::FONT_SHAPE shape)
: Changer<Font, Font::FONT_SHAPE>(font)
{
save_ = orig_.shape();
orig_.setShape(shape);
@ -160,9 +160,9 @@ FontSetChanger::FontSetChanger(MetricsBase & mb, char const * name)
: Changer<MetricsBase>(mb)
{
save_ = mb;
LyXFont::FONT_SIZE oldsize = save_.font.size();
Font::FONT_SIZE oldsize = save_.font.size();
mb.fontname = name;
mb.font = LyXFont();
mb.font = Font();
augmentFont(mb.font, from_ascii(name));
mb.font.setSize(oldsize);
}
@ -172,9 +172,9 @@ FontSetChanger::FontSetChanger(MetricsBase & mb, docstring const & name)
: Changer<MetricsBase>(mb)
{
save_ = mb;
LyXFont::FONT_SIZE oldsize = save_.font.size();
Font::FONT_SIZE oldsize = save_.font.size();
mb.fontname = to_utf8(name);
mb.font = LyXFont();
mb.font = Font();
augmentFont(mb.font, name);
mb.font.setSize(oldsize);
}
@ -202,8 +202,8 @@ WidthChanger::~WidthChanger()
ColorChanger::ColorChanger(LyXFont & font, string const & color)
: Changer<LyXFont, string>(font)
ColorChanger::ColorChanger(Font & font, string const & color)
: Changer<Font, string>(font)
{
save_ = lcolor.getFromLyXName(color);
font.setColor(lcolor.getFromLyXName(color));

View File

@ -12,7 +12,7 @@
#ifndef METRICSINFO_H
#define METRICSINFO_H
#include "LyXFont.h"
#include "Font.h"
#include "support/docstring.h"
#include <string>
@ -44,12 +44,12 @@ public:
///
MetricsBase();
///
MetricsBase(BufferView * bv, LyXFont const & font, int textwidth);
MetricsBase(BufferView * bv, Font const & font, int textwidth);
/// the current view
BufferView * bv;
/// current font
LyXFont font;
Font font;
/// current math style (display/text/script/..)
Styles style;
/// name of current font - mathed specific
@ -68,7 +68,7 @@ public:
///
MetricsInfo();
///
MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth);
MetricsInfo(BufferView * bv, Font const & font, int textwidth);
///
MetricsBase base;
@ -147,10 +147,10 @@ protected:
// temporarily change some aspect of a font
class FontChanger : public Changer<LyXFont> {
class FontChanger : public Changer<Font> {
public:
///
FontChanger(LyXFont & orig, docstring const & font);
FontChanger(Font & orig, docstring const & font);
FontChanger(MetricsBase & mb, char const * const font);
///
~FontChanger();
@ -204,10 +204,10 @@ public:
// temporarily change the shape of a font
class ShapeChanger : public Changer<LyXFont, LyXFont::FONT_SHAPE> {
class ShapeChanger : public Changer<Font, Font::FONT_SHAPE> {
public:
///
ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
ShapeChanger(Font & font, Font::FONT_SHAPE shape);
///
~ShapeChanger();
};
@ -225,10 +225,10 @@ public:
// temporarily change the used color
class ColorChanger : public Changer<LyXFont, std::string> {
class ColorChanger : public Changer<Font, std::string> {
public:
///
ColorChanger(LyXFont & font, std::string const & color);
ColorChanger(Font & font, std::string const & color);
///
~ColorChanger();
};

View File

@ -23,7 +23,7 @@ namespace lyx {
class Encoding;
class ExportData;
class LyXFont;
class Font;
class OutputParams {
@ -63,7 +63,7 @@ public:
/** the font at the point where the inset is
*/
LyXFont const * local_font;
Font const * local_font;
/** Document language babel name
*/

View File

@ -29,7 +29,7 @@
#include "LaTeXFeatures.h"
#include "Color.h"
#include "Length.h"
#include "LyXFont.h"
#include "Font.h"
#include "LyXRC.h"
#include "Row.h"
#include "Messages.h"
@ -132,7 +132,7 @@ public:
class FontTable {
public:
///
FontTable(pos_type p, LyXFont const & f)
FontTable(pos_type p, Font const & f)
: pos_(p), font_(f)
{}
///
@ -140,22 +140,22 @@ public:
///
void pos(pos_type p) { pos_ = p; }
///
LyXFont const & font() const { return font_; }
Font const & font() const { return font_; }
///
void font(LyXFont const & f) { font_ = f;}
void font(Font const & f) { font_ = f;}
private:
/// End position of paragraph this font attribute covers
pos_type pos_;
/** Font. Interpretation of the font values:
If a value is LyXFont::INHERIT_*, it means that the font
If a value is Font::INHERIT_*, it means that the font
attribute is inherited from either the layout of this
paragraph or, in the case of nested paragraphs, from the
layout in the environment one level up until completely
resolved.
The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT
The values Font::IGNORE_* and Font::TOGGLE are NOT
allowed in these font tables.
*/
LyXFont font_;
Font font_;
};
///
friend class matchFT;
@ -184,15 +184,15 @@ public:
odocstream &, TexRow & texrow,
pos_type & i,
unsigned int & column,
LyXFont const & font,
Font const & font,
LyXLayout const & style);
///
void simpleTeXSpecialChars(Buffer const &, BufferParams const &,
odocstream &,
TexRow & texrow, OutputParams const &,
LyXFont & running_font,
LyXFont & basefont,
LyXFont const & outerfont,
Font & running_font,
Font & basefont,
Font const & outerfont,
bool & open_font,
Change::Type & running_change,
LyXLayout const & style,
@ -444,7 +444,7 @@ void Paragraph::Pimpl::insertChar(pos_type pos, value_type c, Change const & cha
owner_->text_.insert(owner_->text_.begin() + pos, c);
// Update the font table.
FontTable search_font(pos, LyXFont());
FontTable search_font(pos, Font());
for (FontList::iterator it
= lower_bound(fontlist.begin(), fontlist.end(), search_font, matchFT());
it != fontlist.end(); ++it)
@ -512,7 +512,7 @@ bool Paragraph::Pimpl::eraseChar(pos_type pos, bool trackChanges)
owner_->text_.erase(owner_->text_.begin() + pos);
// Erase entries in the tables.
FontTable search_font(pos, LyXFont());
FontTable search_font(pos, Font());
FontList::iterator it =
lower_bound(fontlist.begin(),
@ -583,7 +583,7 @@ bool Paragraph::Pimpl::simpleTeXBlanks(Encoding const & encoding,
odocstream & os, TexRow & texrow,
pos_type & i,
unsigned int & column,
LyXFont const & font,
Font const & font,
LyXLayout const & style)
{
if (style.pass_thru)
@ -608,7 +608,7 @@ bool Paragraph::Pimpl::simpleTeXBlanks(Encoding const & encoding,
&& !owner_->isFreeSpacing()
// In typewriter mode, we want to avoid
// ! . ? : at the end of a line
&& !(font.family() == LyXFont::TYPEWRITER_FAMILY
&& !(font.family() == Font::TYPEWRITER_FAMILY
&& (getChar(i - 1) == '.'
|| getChar(i - 1) == '?'
|| getChar(i - 1) == ':'
@ -661,9 +661,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
odocstream & os,
TexRow & texrow,
OutputParams const & runparams,
LyXFont & running_font,
LyXFont & basefont,
LyXFont const & outerfont,
Font & running_font,
Font & basefont,
Font const & outerfont,
bool & open_font,
Change::Type & running_change,
LyXLayout const & style,
@ -706,7 +706,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
open_font = false;
}
if (running_font.family() == LyXFont::TYPEWRITER_FAMILY)
if (running_font.family() == Font::TYPEWRITER_FAMILY)
os << '~';
basefont = owner_->getLayoutFont(bparams, outerfont);
@ -809,7 +809,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
break;
}
// Typewriter font also has them
if (running_font.family() == LyXFont::TYPEWRITER_FAMILY) {
if (running_font.family() == Font::TYPEWRITER_FAMILY) {
os.put(c);
break;
}
@ -834,7 +834,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
case '-': // "--" in Typewriter mode -> "-{}-"
if (i <= size() - 2 &&
getChar(i + 1) == '-' &&
running_font.family() == LyXFont::TYPEWRITER_FAMILY) {
running_font.family() == Font::TYPEWRITER_FAMILY) {
os << "-{}";
column += 2;
} else {
@ -886,7 +886,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
// I assume this is hack treating typewriter as verbatim
// FIXME UNICODE: This can fail if c cannot be encoded
// in the current encoding.
if (running_font.family() == LyXFont::TYPEWRITER_FAMILY) {
if (running_font.family() == Font::TYPEWRITER_FAMILY) {
if (c != '\0') {
os.put(c);
}
@ -959,7 +959,7 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features,
FontList::const_iterator fcit = fontlist.begin();
FontList::const_iterator fend = fontlist.end();
for (; fcit != fend; ++fcit) {
if (fcit->font().noun() == LyXFont::ON) {
if (fcit->font().noun() == Font::ON) {
LYXERR(Debug::LATEX) << "font.noun: "
<< fcit->font().noun()
<< endl;
@ -1113,7 +1113,7 @@ void Paragraph::write(Buffer const & buf, ostream & os,
params().write(os);
LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
Font font1(Font::ALL_INHERIT, bparams.language);
Change running_change = Change(Change::UNCHANGED);
@ -1128,7 +1128,7 @@ void Paragraph::write(Buffer const & buf, ostream & os,
break;
// Write font changes
LyXFont font2 = getFontSettings(bparams, i);
Font font2 = getFontSettings(bparams, i);
if (font2 != font1) {
font2.lyxWriteChanges(font1, os);
column = 0;
@ -1210,7 +1210,7 @@ int Paragraph::eraseChars(pos_type start, pos_type end, bool trackChanges)
void Paragraph::insert(pos_type start, docstring const & str,
LyXFont const & font, Change const & change)
Font const & font, Change const & change)
{
for (size_t i = 0, n = str.size(); i != n ; ++i)
insertChar(start + i, str[i], font, change);
@ -1226,7 +1226,7 @@ void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
LyXFont const & font, bool trackChanges)
Font const & font, bool trackChanges)
{
pimpl_->insertChar(pos, c, Change(trackChanges ?
Change::INSERTED : Change::UNCHANGED));
@ -1235,7 +1235,7 @@ void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
LyXFont const & font, Change const & change)
Font const & font, Change const & change)
{
pimpl_->insertChar(pos, c, change);
setFont(pos, font);
@ -1250,7 +1250,7 @@ void Paragraph::insertInset(pos_type pos, Inset * inset,
void Paragraph::insertInset(pos_type pos, Inset * inset,
LyXFont const & font, Change const & change)
Font const & font, Change const & change)
{
pimpl_->insertInset(pos, inset, change);
setFont(pos, font);
@ -1264,7 +1264,7 @@ bool Paragraph::insetAllowed(Inset_code code)
// Gets uninstantiated font setting at position.
LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
Font const Paragraph::getFontSettings(BufferParams const & bparams,
pos_type pos) const
{
if (pos > size()) {
@ -1284,7 +1284,7 @@ LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
if (pos == size() && !empty())
return getFontSettings(bparams, pos - 1);
return LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams));
return Font(Font::ALL_INHERIT, getParLanguage(bparams));
}
@ -1316,12 +1316,12 @@ FontSpan Paragraph::fontSpan(pos_type pos) const
// Gets uninstantiated font setting at position 0
LyXFont const Paragraph::getFirstFontSettings(BufferParams const & bparams) const
Font const Paragraph::getFirstFontSettings(BufferParams const & bparams) const
{
if (!empty() && !pimpl_->fontlist.empty())
return pimpl_->fontlist[0].font();
return LyXFont(LyXFont::ALL_INHERIT, bparams.language);
return Font(Font::ALL_INHERIT, bparams.language);
}
@ -1330,8 +1330,8 @@ LyXFont const Paragraph::getFirstFontSettings(BufferParams const & bparams) cons
// The difference is that this one is used for generating the LaTeX file,
// and thus cosmetic "improvements" are disallowed: This has to deliver
// the true picture of the buffer. (Asger)
LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
LyXFont const & outerfont) const
Font const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
Font const & outerfont) const
{
BOOST_ASSERT(pos >= 0);
@ -1339,13 +1339,13 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
pos_type const body_pos = beginOfBody();
LyXFont layoutfont;
Font layoutfont;
if (pos < body_pos)
layoutfont = lout->labelfont;
else
layoutfont = lout->font;
LyXFont font = getFontSettings(bparams, pos);
Font font = getFontSettings(bparams, pos);
font.realize(layoutfont);
font.realize(outerfont);
font.realize(bparams.getFont());
@ -1354,10 +1354,10 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
}
LyXFont const Paragraph::getLabelFont
(BufferParams const & bparams, LyXFont const & outerfont) const
Font const Paragraph::getLabelFont
(BufferParams const & bparams, Font const & outerfont) const
{
LyXFont tmpfont = layout()->labelfont;
Font tmpfont = layout()->labelfont;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getFont());
@ -1365,10 +1365,10 @@ LyXFont const Paragraph::getLabelFont
}
LyXFont const Paragraph::getLayoutFont
(BufferParams const & bparams, LyXFont const & outerfont) const
Font const Paragraph::getLayoutFont
(BufferParams const & bparams, Font const & outerfont) const
{
LyXFont tmpfont = layout()->font;
Font tmpfont = layout()->font;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getFont());
@ -1377,8 +1377,8 @@ LyXFont const Paragraph::getLayoutFont
/// Returns the height of the highest font in range
LyXFont_size Paragraph::highestFontInRange
(pos_type startpos, pos_type endpos, LyXFont_size def_size) const
Font_size Paragraph::highestFontInRange
(pos_type startpos, pos_type endpos, Font_size def_size) const
{
if (pimpl_->fontlist.empty())
return def_size;
@ -1399,12 +1399,12 @@ LyXFont_size Paragraph::highestFontInRange
break;
}
LyXFont::FONT_SIZE maxsize = LyXFont::SIZE_TINY;
Font::FONT_SIZE maxsize = Font::SIZE_TINY;
for (; cit != end_it; ++cit) {
LyXFont::FONT_SIZE size = cit->font().size();
if (size == LyXFont::INHERIT_SIZE)
Font::FONT_SIZE size = cit->font().size();
if (size == Font::INHERIT_SIZE)
size = def_size;
if (size > maxsize && size <= LyXFont::SIZE_HUGER)
if (size > maxsize && size <= Font::SIZE_HUGER)
maxsize = size;
}
return maxsize;
@ -1452,7 +1452,7 @@ Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
}
void Paragraph::setFont(pos_type pos, LyXFont const & font)
void Paragraph::setFont(pos_type pos, Font const & font)
{
BOOST_ASSERT(pos <= size());
@ -1897,7 +1897,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
// This one spits out the text of the paragraph
bool Paragraph::simpleTeXOnePar(Buffer const & buf,
BufferParams const & bparams,
LyXFont const & outerfont,
Font const & outerfont,
odocstream & os, TexRow & texrow,
OutputParams const & runparams) const
{
@ -1926,7 +1926,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
// As long as we are in the label, this font is the base font of the
// label. Before the first body character it is set to the base font
// of the body.
LyXFont basefont;
Font basefont;
// output change tracking marks only if desired,
// if dvipost is installed,
@ -1950,7 +1950,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
}
// Which font is currently active?
LyXFont running_font(basefont);
Font running_font(basefont);
// Do we have an open font change?
bool open_font = false;
@ -2017,9 +2017,9 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
value_type const c = getChar(i);
// Fully instantiated font
LyXFont const font = getFont(bparams, i, outerfont);
Font const font = getFont(bparams, i, outerfont);
LyXFont const last_font = running_font;
Font const last_font = running_font;
// Do we need to close the previous font?
if (open_font &&
@ -2224,12 +2224,12 @@ pos_type Paragraph::getFirstWord(Buffer const & buf, odocstream & os, OutputPara
}
bool Paragraph::onlyText(Buffer const & buf, LyXFont const & outerfont, pos_type initial) const
bool Paragraph::onlyText(Buffer const & buf, Font const & outerfont, pos_type initial) const
{
LyXFont font_old;
Font font_old;
for (pos_type i = initial; i < size(); ++i) {
LyXFont font = getFont(buf.params(), i, outerfont);
Font font = getFont(buf.params(), i, outerfont);
if (isInset(i))
return false;
if (i != initial && font != font_old)
@ -2244,13 +2244,13 @@ bool Paragraph::onlyText(Buffer const & buf, LyXFont const & outerfont, pos_type
void Paragraph::simpleDocBookOnePar(Buffer const & buf,
odocstream & os,
OutputParams const & runparams,
LyXFont const & outerfont,
Font const & outerfont,
pos_type initial) const
{
bool emph_flag = false;
LyXLayout_ptr const & style = layout();
LyXFont font_old =
Font font_old =
style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
if (style->pass_thru && !onlyText(buf, outerfont, initial))
@ -2258,11 +2258,11 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
// parsing main loop
for (pos_type i = initial; i < size(); ++i) {
LyXFont font = getFont(buf.params(), i, outerfont);
Font font = getFont(buf.params(), i, outerfont);
// handle <emphasis> tag
if (font_old.emph() != font.emph()) {
if (font.emph() == LyXFont::ON) {
if (font.emph() == Font::ON) {
os << "<emphasis>";
emph_flag = true;
} else if (i != initial) {
@ -2349,7 +2349,7 @@ void Paragraph::changeLanguage(BufferParams const & bparams,
{
// change language including dummy font change at the end
for (pos_type i = 0; i <= size(); ++i) {
LyXFont font = getFontSettings(bparams, i);
Font font = getFontSettings(bparams, i);
if (font.language() == from) {
font.setLanguage(to);
setFont(i, font);

View File

@ -36,8 +36,8 @@ class InsetBibitem;
class LaTeXFeatures;
class Inset_code;
class Language;
class LyXFont;
class LyXFont_size;
class Font;
class Font_size;
class MetricsInfo;
class OutputParams;
class PainterInfo;
@ -125,7 +125,7 @@ public:
///
bool simpleTeXOnePar(Buffer const &, BufferParams const &,
LyXFont const & outerfont, odocstream &,
Font const & outerfont, odocstream &,
TexRow & texrow, OutputParams const &) const;
/// Can we drop the standard paragraph wrapper?
@ -141,14 +141,14 @@ public:
OutputParams const & runparams) const;
/// Checks if the paragraph contains only text and no inset or font change.
bool onlyText(Buffer const & buf, LyXFont const & outerfont,
bool onlyText(Buffer const & buf, Font const & outerfont,
pos_type initial) const;
/// Writes to stream the docbook representation
void simpleDocBookOnePar(Buffer const & buf,
odocstream &,
OutputParams const & runparams,
LyXFont const & outerfont,
Font const & outerfont,
pos_type initial = 0) const;
///
@ -256,24 +256,24 @@ public:
between the characters font and the layoutfont.
This is what is stored in the fonttable
*/
LyXFont const
Font const
getFontSettings(BufferParams const &, pos_type pos) const;
///
LyXFont const getFirstFontSettings(BufferParams const &) const;
Font const getFirstFontSettings(BufferParams const &) const;
/** Get fully instantiated font. If pos == -1, use the layout
font attached to this paragraph.
If pos == -2, use the label font of the layout attached here.
In all cases, the font is instantiated, i.e. does not have any
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
LyXFont::TOGGLE.
attributes with values Font::INHERIT, Font::IGNORE or
Font::TOGGLE.
*/
LyXFont const getFont(BufferParams const &, pos_type pos,
LyXFont const & outerfont) const;
LyXFont const getLayoutFont(BufferParams const &,
LyXFont const & outerfont) const;
LyXFont const getLabelFont(BufferParams const &,
LyXFont const & outerfont) const;
Font const getFont(BufferParams const &, pos_type pos,
Font const & outerfont) const;
Font const getLayoutFont(BufferParams const &,
Font const & outerfont) const;
Font const getLabelFont(BufferParams const &,
Font const & outerfont) const;
/**
* The font returned by the above functions is the same in a
* span of characters. This method will return the first and
@ -287,27 +287,27 @@ public:
/// Get the char, but mirror all bracket characters if it is right-to-left
value_type getUChar(BufferParams const &, pos_type pos) const;
/// pos <= size() (there is a dummy font change at the end of each par)
void setFont(pos_type pos, LyXFont const & font);
void setFont(pos_type pos, Font const & font);
/// Returns the height of the highest font in range
LyXFont_size highestFontInRange(pos_type startpos,
pos_type endpos, LyXFont_size def_size) const;
Font_size highestFontInRange(pos_type startpos,
pos_type endpos, Font_size def_size) const;
///
void insert(pos_type pos, docstring const & str,
LyXFont const & font, Change const & change);
Font const & font, Change const & change);
///
void insertChar(pos_type pos, value_type c, bool trackChanges);
///
void insertChar(pos_type pos, value_type c,
LyXFont const &, bool trackChanges);
Font const &, bool trackChanges);
///
void insertChar(pos_type pos, value_type c,
LyXFont const &, Change const & change);
Font const &, Change const & change);
///
void insertInset(pos_type pos, Inset * inset,
Change const & change);
///
void insertInset(pos_type pos, Inset * inset,
LyXFont const &, Change const & change);
Font const &, Change const & change);
///
bool insetAllowed(Inset_code code);
///

View File

@ -27,7 +27,7 @@
#include "gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "LyXFont.h"
#include "Font.h"
#include "LyXRC.h"
#include "Row.h"
#include "OutputParams.h"

View File

@ -47,7 +47,7 @@ string const & Section::afterskip() const
}
LyXFont const & Section::style() const
Font const & Section::style() const
{
return style_;
}

View File

@ -12,7 +12,7 @@
#ifndef SECTION_H
#define SECTION_H
#include "LyXFont.h"
#include "Font.h"
#include <map>
@ -34,7 +34,7 @@ public:
///
std::string const & afterskip() const;
///
LyXFont const & style() const;
Font const & style() const;
///
bool display() const;
private:
@ -49,7 +49,7 @@ private:
///
std::string afterskip_;
///
LyXFont style_;
Font style_;
};

View File

@ -202,14 +202,14 @@ bool TextMetrics::redoParagraph(pit_type const pit)
// redo insets
// FIXME: We should always use getFont(), see documentation of
// noFontChange() in Inset.h.
LyXFont const bufferfont = buffer.params().getFont();
Font const bufferfont = buffer.params().getFont();
InsetList::const_iterator ii = par.insetlist.begin();
InsetList::const_iterator iend = par.insetlist.end();
for (; ii != iend; ++ii) {
Dimension dim;
int const w = max_width_ - text_->leftMargin(buffer, max_width_, pit, ii->pos)
- right_margin;
LyXFont const & font = ii->inset->noFontChange() ?
Font const & font = ii->inset->noFontChange() ?
bufferfont : text_->getFont(buffer, par, ii->pos);
MetricsInfo mi(bv_, font, w);
changed |= ii->inset->metrics(mi, dim);
@ -613,13 +613,13 @@ void TextMetrics::setHeightOfRow(pit_type const pit,
// start with so we don't have to do the assignment below too
// often.
Buffer const & buffer = *bv_->buffer();
LyXFont font = text_->getFont(buffer, par, row.pos());
LyXFont::FONT_SIZE const tmpsize = font.size();
Font font = text_->getFont(buffer, par, row.pos());
Font::FONT_SIZE const tmpsize = font.size();
font = text_->getLayoutFont(buffer, pit);
LyXFont::FONT_SIZE const size = font.size();
Font::FONT_SIZE const size = font.size();
font.setSize(tmpsize);
LyXFont labelfont = text_->getLabelFont(buffer, par);
Font labelfont = text_->getLabelFont(buffer, par);
FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
FontMetrics const & fontmetrics = theFontMetrics(font);
@ -647,7 +647,7 @@ void TextMetrics::setHeightOfRow(pit_type const pit,
int labeladdon = 0;
pos_type const pos_end = row.endpos();
LyXFont::FONT_SIZE maxsize =
Font::FONT_SIZE maxsize =
par.highestFontInRange(row.pos(), pos_end, size);
if (maxsize > font.size()) {
font.setSize(maxsize);
@ -945,7 +945,7 @@ pos_type TextMetrics::x2pos(pit_type pit, int row, int x) const
int defaultRowHeight()
{
return int(theFontMetrics(LyXFont(LyXFont::ALL_SANE)).maxHeight() * 1.2);
return int(theFontMetrics(Font(Font::ALL_SANE)).maxHeight() * 1.2);
}
} // namespace lyx

View File

@ -56,7 +56,7 @@ namespace bv_funcs {
// Set data using font and toggle
// If successful, returns true
bool font2string(LyXFont const & font, bool const toggle, string & data)
bool font2string(Font const & font, bool const toggle, string & data)
{
string lang = "ignore";
if (font.language())
@ -81,7 +81,7 @@ bool font2string(LyXFont const & font, bool const toggle, string & data)
// Set font and toggle using data
// If successful, returns true
bool string2font(string const & data, LyXFont & font, bool & toggle)
bool string2font(string const & data, Font & font, bool & toggle)
{
istringstream is(data);
Lexer lex(0,0);
@ -98,26 +98,26 @@ bool string2font(string const & data, LyXFont & font, bool & toggle)
if (token == "family") {
int const next = lex.getInteger();
font.setFamily(LyXFont::FONT_FAMILY(next));
font.setFamily(Font::FONT_FAMILY(next));
} else if (token == "series") {
int const next = lex.getInteger();
font.setSeries(LyXFont::FONT_SERIES(next));
font.setSeries(Font::FONT_SERIES(next));
} else if (token == "shape") {
int const next = lex.getInteger();
font.setShape(LyXFont::FONT_SHAPE(next));
font.setShape(Font::FONT_SHAPE(next));
} else if (token == "size") {
int const next = lex.getInteger();
font.setSize(LyXFont::FONT_SIZE(next));
font.setSize(Font::FONT_SIZE(next));
} else if (token == "emph" || token == "underbar" ||
token == "noun" || token == "number") {
int const next = lex.getInteger();
LyXFont::FONT_MISC_STATE const misc =
LyXFont::FONT_MISC_STATE(next);
Font::FONT_MISC_STATE const misc =
Font::FONT_MISC_STATE(next);
if (token == "emph")
font.setEmph(misc);

View File

@ -23,15 +23,15 @@ class Point;
class BufferView;
class DocIterator;
class Inset_code;
class LyXFont;
class Font;
namespace bv_funcs {
/// Set \param data using \param font and \param toggle. Return success.
bool font2string(LyXFont const & font, bool toggle, std::string & data);
bool font2string(Font const & font, bool toggle, std::string & data);
/// Set \param font and \param toggle using \param data. Return success.
bool string2font(std::string const & data, LyXFont & font, bool & toggle);
bool string2font(std::string const & data, Font & font, bool & toggle);
/** Returns the current freefont, encoded as a std::string to be passed to the
* frontends.

View File

@ -23,7 +23,7 @@
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "LyX.h" // for lyx::use_gui
#include "LyXFont.h"
#include "Font.h"
#include "LyXFunc.h"
#include "LyXRC.h"
@ -101,7 +101,7 @@ frontend::FontLoader & theFontLoader()
}
frontend::FontMetrics const & theFontMetrics(LyXFont const & f)
frontend::FontMetrics const & theFontMetrics(Font const & f)
{
static frontend::NoGuiFontMetrics no_gui_font_metrics;

View File

@ -14,7 +14,7 @@
namespace lyx {
class LyXFont;
class Font;
namespace frontend {
@ -33,10 +33,10 @@ public:
virtual void update() = 0;
/// Is the given font available ?
virtual bool available(LyXFont const & f) = 0;
virtual bool available(Font const & f) = 0;
/// Get the Font metrics for this LyXFont
virtual FontMetrics const & metrics(LyXFont const & f) = 0;
/// Get the Font metrics for this Font
virtual FontMetrics const & metrics(Font const & f) = 0;
};

View File

@ -116,10 +116,10 @@ public:
} // namespace frontend
class LyXFont;
class Font;
/// Implementation is in Application.cpp
frontend::FontMetrics const & theFontMetrics(LyXFont const & f);
frontend::FontMetrics const & theFontMetrics(Font const & f);
} // namespace lyx

View File

@ -36,7 +36,7 @@ class Menubar;
class BufferView;
class Dialogs;
class LyXFunc;
class LyXFont;
class Font;
class Timeout;
class FuncRequest;

View File

@ -32,10 +32,10 @@ public:
virtual void update() {};
/// Is the given font available ?
virtual bool available(LyXFont const &) { return false; };
virtual bool available(Font const &) { return false; };
/// Get the Font metrics for this LyXFont
virtual FontMetrics const & metrics(LyXFont const &) { return metrics_; }
/// Get the Font metrics for this Font
virtual FontMetrics const & metrics(Font const &) { return metrics_; }
private:
///

View File

@ -16,7 +16,7 @@
#include "frontends/FontMetrics.h"
#include "Color.h"
#include "LyXFont.h"
#include "Font.h"
using lyx::docstring;
@ -47,7 +47,7 @@ void Painter::buttonFrame(int x, int y, int w, int h)
void Painter::rectText(int x, int y,
docstring const & str,
LyXFont const & font,
Font const & font,
Color_color back,
Color_color frame)
{
@ -70,7 +70,7 @@ void Painter::rectText(int x, int y,
void Painter::buttonText(int x, int y, docstring const & str,
LyXFont const & font, bool mouseHover)
Font const & font, bool mouseHover)
{
int width;
int ascent;
@ -85,9 +85,9 @@ void Painter::buttonText(int x, int y, docstring const & str,
int Painter::preeditText(int x, int y, char_type c,
LyXFont const & font, preedit_style style)
Font const & font, preedit_style style)
{
LyXFont temp_font = font;
Font temp_font = font;
FontMetrics const & fm = theFontMetrics(font);
int ascent = fm.maxAscent();
int descent = fm.maxDescent();
@ -117,7 +117,7 @@ int Painter::preeditText(int x, int y, char_type c,
}
void Painter::underline(LyXFont const & f, int x, int y, int width)
void Painter::underline(Font const & f, int x, int y, int width)
{
FontMetrics const & fm = theFontMetrics(f);
@ -131,7 +131,7 @@ void Painter::underline(LyXFont const & f, int x, int y, int width)
}
void Painter::dashedUnderline(LyXFont const & f, int x, int y, int width)
void Painter::dashedUnderline(Font const & f, int x, int y, int width)
{
FontMetrics const & fm = theFontMetrics(f);

View File

@ -18,7 +18,7 @@
namespace lyx {
class Color_color;
class LyXFont;
class Font;
namespace graphics { class Image; }
@ -138,7 +138,7 @@ public:
* \return the width of the drawn text.
*/
virtual int text(int x, int y,
docstring const & str, LyXFont const & f) = 0;
docstring const & str, Font const & f) = 0;
void setDrawingEnabled(bool drawing_enabled = true)
{ drawing_enabled_ = drawing_enabled; }
@ -147,7 +147,7 @@ public:
/**
* \return the width of the drawn text.
*/
virtual int text(int x, int y, char_type c, LyXFont const & f) = 0;
virtual int text(int x, int y, char_type c, Font const & f) = 0;
/**
* Draw a string and enclose it inside a rectangle. If
@ -157,25 +157,25 @@ public:
*/
void rectText(int x, int baseline,
docstring const & str,
LyXFont const & font,
Font const & font,
Color_color back,
Color_color frame);
/// draw a string and enclose it inside a button frame
void buttonText(int x, int baseline, docstring const & s,
LyXFont const & font, bool mouseHover);
Font const & font, bool mouseHover);
/// draw a character of a preedit string for cjk support.
int preeditText(int x, int y,
char_type c, LyXFont const & f, preedit_style style);
char_type c, Font const & f, preedit_style style);
protected:
/// check the font, and if set, draw an underline
void underline(LyXFont const & f,
void underline(Font const & f,
int x, int y, int width);
/// check the font, and if set, draw an dashed underline
void dashedUnderline(LyXFont const & f,
void dashedUnderline(Font const & f,
int x, int y, int width);
/// draw a bevelled button border

View File

@ -30,7 +30,7 @@
#include "debug.h"
#include "Language.h"
#include "Color.h"
#include "LyXFont.h"
#include "Font.h"
#include "LyXRC.h"
#include "Row.h"
#include "LyXText.h"
@ -281,7 +281,7 @@ void WorkArea::showCursor()
CursorShape shape = BAR_SHAPE;
LyXText const & text = *buffer_view_->cursor().innerText();
LyXFont const & realfont = text.real_current_font;
Font const & realfont = text.real_current_font;
BufferParams const & bp = buffer_view_->buffer()->params();
bool const samelang = realfont.language() == bp.language;
bool const isrtl = realfont.isVisibleRightToLeft();
@ -296,7 +296,7 @@ void WorkArea::showCursor()
if (realfont.language() == latex_language)
shape = BAR_SHAPE;
LyXFont const font = buffer_view_->cursor().getFont();
Font const font = buffer_view_->cursor().getFont();
FontMetrics const & fm = theFontMetrics(font);
int const asc = fm.maxAscent();
int const des = fm.maxDescent();

View File

@ -36,13 +36,13 @@ bool ControlCharacter::initialiseParams(string const &)
{
// Do this the first time only.
if (!font_.get())
font_.reset(new LyXFont(LyXFont::ALL_IGNORE));
font_.reset(new Font(Font::ALL_IGNORE));
// so that the user can press Ok
if (getFamily() != LyXFont::IGNORE_FAMILY ||
getSeries() != LyXFont::IGNORE_SERIES ||
getShape() != LyXFont::IGNORE_SHAPE ||
getSize() != LyXFont::IGNORE_SIZE ||
if (getFamily() != Font::IGNORE_FAMILY ||
getSeries() != Font::IGNORE_SERIES ||
getShape() != Font::IGNORE_SHAPE ||
getSize() != Font::IGNORE_SIZE ||
getBar() != IGNORE ||
getColor() != Color::ignore ||
font_->language() != ignore_language)
@ -69,57 +69,57 @@ void ControlCharacter::dispatchParams()
}
LyXFont::FONT_FAMILY ControlCharacter::getFamily() const
Font::FONT_FAMILY ControlCharacter::getFamily() const
{
if (!font_.get())
return LyXFont::IGNORE_FAMILY;
return Font::IGNORE_FAMILY;
return font_->family();
}
void ControlCharacter::setFamily(LyXFont::FONT_FAMILY val)
void ControlCharacter::setFamily(Font::FONT_FAMILY val)
{
font_->setFamily(val);
}
LyXFont::FONT_SERIES ControlCharacter::getSeries() const
Font::FONT_SERIES ControlCharacter::getSeries() const
{
if (!font_.get())
return LyXFont::IGNORE_SERIES;
return Font::IGNORE_SERIES;
return font_->series();
}
void ControlCharacter::setSeries(LyXFont::FONT_SERIES val)
void ControlCharacter::setSeries(Font::FONT_SERIES val)
{
font_->setSeries(val);
}
LyXFont::FONT_SHAPE ControlCharacter::getShape() const
Font::FONT_SHAPE ControlCharacter::getShape() const
{
if (!font_.get())
return LyXFont::IGNORE_SHAPE;
return Font::IGNORE_SHAPE;
return font_->shape();
}
void ControlCharacter::setShape(LyXFont::FONT_SHAPE val)
void ControlCharacter::setShape(Font::FONT_SHAPE val)
{
font_->setShape(val);
}
LyXFont::FONT_SIZE ControlCharacter::getSize() const
Font::FONT_SIZE ControlCharacter::getSize() const
{
if (!font_.get())
return LyXFont::IGNORE_SIZE;
return Font::IGNORE_SIZE;
return font_->size();
}
void ControlCharacter::setSize(LyXFont::FONT_SIZE val)
void ControlCharacter::setSize(Font::FONT_SIZE val)
{
font_->setSize(val);
}
@ -130,18 +130,18 @@ FONT_STATE ControlCharacter::getBar() const
if (!font_.get())
return IGNORE;
if (font_->emph() == LyXFont::TOGGLE)
if (font_->emph() == Font::TOGGLE)
return EMPH_TOGGLE;
if (font_->underbar() == LyXFont::TOGGLE)
if (font_->underbar() == Font::TOGGLE)
return UNDERBAR_TOGGLE;
if (font_->noun() == LyXFont::TOGGLE)
if (font_->noun() == Font::TOGGLE)
return NOUN_TOGGLE;
if (font_->emph() == LyXFont::IGNORE &&
font_->underbar() == LyXFont::IGNORE &&
font_->noun() == LyXFont::IGNORE)
if (font_->emph() == Font::IGNORE &&
font_->underbar() == Font::IGNORE &&
font_->noun() == Font::IGNORE)
return IGNORE;
return INHERIT;
@ -152,27 +152,27 @@ void ControlCharacter::setBar(FONT_STATE val)
{
switch (val) {
case IGNORE:
font_->setEmph(LyXFont::IGNORE);
font_->setUnderbar(LyXFont::IGNORE);
font_->setNoun(LyXFont::IGNORE);
font_->setEmph(Font::IGNORE);
font_->setUnderbar(Font::IGNORE);
font_->setNoun(Font::IGNORE);
break;
case EMPH_TOGGLE:
font_->setEmph(LyXFont::TOGGLE);
font_->setEmph(Font::TOGGLE);
break;
case UNDERBAR_TOGGLE:
font_->setUnderbar(LyXFont::TOGGLE);
font_->setUnderbar(Font::TOGGLE);
break;
case NOUN_TOGGLE:
font_->setNoun(LyXFont::TOGGLE);
font_->setNoun(Font::TOGGLE);
break;
case INHERIT:
font_->setEmph(LyXFont::INHERIT);
font_->setUnderbar(LyXFont::INHERIT);
font_->setNoun(LyXFont::INHERIT);
font_->setEmph(Font::INHERIT);
font_->setUnderbar(Font::INHERIT);
font_->setNoun(Font::INHERIT);
break;
}
}

View File

@ -39,13 +39,13 @@ public:
virtual kb_action getLfun() const { return LFUN_FONT_FREE_UPDATE; }
///
void setFamily(LyXFont::FONT_FAMILY);
void setFamily(Font::FONT_FAMILY);
///
void setSeries(LyXFont::FONT_SERIES);
void setSeries(Font::FONT_SERIES);
///
void setShape(LyXFont::FONT_SHAPE);
void setShape(Font::FONT_SHAPE);
///
void setSize(LyXFont::FONT_SIZE);
void setSize(Font::FONT_SIZE);
///
void setBar(FONT_STATE);
///
@ -56,13 +56,13 @@ public:
void setToggleAll(bool);
///
LyXFont::FONT_FAMILY getFamily() const;
Font::FONT_FAMILY getFamily() const;
///
LyXFont::FONT_SERIES getSeries() const;
Font::FONT_SERIES getSeries() const;
///
LyXFont::FONT_SHAPE getShape() const;
Font::FONT_SHAPE getShape() const;
///
LyXFont::FONT_SIZE getSize() const;
Font::FONT_SIZE getSize() const;
///
FONT_STATE getBar() const;
///
@ -73,7 +73,7 @@ public:
bool getToggleAll() const;
private:
///
boost::scoped_ptr<LyXFont> font_;
boost::scoped_ptr<Font> font_;
///
bool toggleall_;
/// If true the language should be reset.

View File

@ -46,25 +46,25 @@ ControlMath::ControlMath(Dialog & dialog)
math_symbols_["["] = MathSymbol('[');
math_symbols_["]"] = MathSymbol(']');
math_symbols_["|"] = MathSymbol('|');
math_symbols_["/"] = MathSymbol('/', 54, LyXFont::CMSY_FAMILY);
math_symbols_["backslash"] = MathSymbol('\\', 110, LyXFont::CMSY_FAMILY);
math_symbols_["lceil"] = MathSymbol(0x2308, 100, LyXFont::CMSY_FAMILY);
math_symbols_["rceil"] = MathSymbol(0x2309, 101, LyXFont::CMSY_FAMILY);
math_symbols_["lfloor"] = MathSymbol(0x230A, 98, LyXFont::CMSY_FAMILY);
math_symbols_["rfloor"] = MathSymbol(0x230B, 99, LyXFont::CMSY_FAMILY);
math_symbols_["langle"] = MathSymbol(0x2329, 104, LyXFont::CMSY_FAMILY);
math_symbols_["rangle"] = MathSymbol(0x232A, 105, LyXFont::CMSY_FAMILY);
math_symbols_["uparrow"] = MathSymbol(0x2191, 34, LyXFont::CMSY_FAMILY);
math_symbols_["Uparrow"] = MathSymbol(0x21D1, 42, LyXFont::CMSY_FAMILY);
math_symbols_["updownarrow"] = MathSymbol(0x2195, 108, LyXFont::CMSY_FAMILY);
math_symbols_["Updownarrow"] = MathSymbol(0x21D5, 109, LyXFont::CMSY_FAMILY);
math_symbols_["downarrow"] = MathSymbol(0x2193, 35, LyXFont::CMSY_FAMILY);
math_symbols_["Downarrow"] = MathSymbol(0x21D3, 43, LyXFont::CMSY_FAMILY);
math_symbols_["downdownarrows"] = MathSymbol(0x21CA, 184, LyXFont::MSA_FAMILY);
math_symbols_["downharpoonleft"] = MathSymbol(0x21C3, 188, LyXFont::MSA_FAMILY);
math_symbols_["downharpoonright"] = MathSymbol(0x21C2, 186, LyXFont::MSA_FAMILY);
math_symbols_["vert"] = MathSymbol(0x007C, 106, LyXFont::CMSY_FAMILY);
math_symbols_["Vert"] = MathSymbol(0x2016, 107, LyXFont::CMSY_FAMILY);
math_symbols_["/"] = MathSymbol('/', 54, Font::CMSY_FAMILY);
math_symbols_["backslash"] = MathSymbol('\\', 110, Font::CMSY_FAMILY);
math_symbols_["lceil"] = MathSymbol(0x2308, 100, Font::CMSY_FAMILY);
math_symbols_["rceil"] = MathSymbol(0x2309, 101, Font::CMSY_FAMILY);
math_symbols_["lfloor"] = MathSymbol(0x230A, 98, Font::CMSY_FAMILY);
math_symbols_["rfloor"] = MathSymbol(0x230B, 99, Font::CMSY_FAMILY);
math_symbols_["langle"] = MathSymbol(0x2329, 104, Font::CMSY_FAMILY);
math_symbols_["rangle"] = MathSymbol(0x232A, 105, Font::CMSY_FAMILY);
math_symbols_["uparrow"] = MathSymbol(0x2191, 34, Font::CMSY_FAMILY);
math_symbols_["Uparrow"] = MathSymbol(0x21D1, 42, Font::CMSY_FAMILY);
math_symbols_["updownarrow"] = MathSymbol(0x2195, 108, Font::CMSY_FAMILY);
math_symbols_["Updownarrow"] = MathSymbol(0x21D5, 109, Font::CMSY_FAMILY);
math_symbols_["downarrow"] = MathSymbol(0x2193, 35, Font::CMSY_FAMILY);
math_symbols_["Downarrow"] = MathSymbol(0x21D3, 43, Font::CMSY_FAMILY);
math_symbols_["downdownarrows"] = MathSymbol(0x21CA, 184, Font::MSA_FAMILY);
math_symbols_["downharpoonleft"] = MathSymbol(0x21C3, 188, Font::MSA_FAMILY);
math_symbols_["downharpoonright"] = MathSymbol(0x21C2, 186, Font::MSA_FAMILY);
math_symbols_["vert"] = MathSymbol(0x007C, 106, Font::CMSY_FAMILY);
math_symbols_["Vert"] = MathSymbol(0x2016, 107, Font::CMSY_FAMILY);
std::map<string, MathSymbol>::const_iterator it = math_symbols_.begin();
std::map<string, MathSymbol>::const_iterator end = math_symbols_.end();

View File

@ -15,7 +15,7 @@
#include "Dialog.h"
#include "lfuns.h" // for kb_action
#include "LyXFont.h"
#include "Font.h"
#include <map>
@ -24,12 +24,12 @@ namespace frontend {
struct MathSymbol {
MathSymbol(char_type uc = '?', unsigned char fc = 0,
LyXFont::FONT_FAMILY ff = LyXFont::SYMBOL_FAMILY)
Font::FONT_FAMILY ff = Font::SYMBOL_FAMILY)
: unicode(uc), fontcode(fc), fontfamily(ff)
{}
char_type unicode;
unsigned char fontcode;
LyXFont::FONT_FAMILY fontfamily;
Font::FONT_FAMILY fontfamily;
};
class ControlMath : public Dialog::Controller {

View File

@ -864,23 +864,23 @@ vector<FamilyPair> const getFamilyData()
FamilyPair pr;
pr.first = _("No change");
pr.second = LyXFont::IGNORE_FAMILY;
pr.second = Font::IGNORE_FAMILY;
family[0] = pr;
pr.first = _("Roman");
pr.second = LyXFont::ROMAN_FAMILY;
pr.second = Font::ROMAN_FAMILY;
family[1] = pr;
pr.first = _("Sans Serif");
pr.second = LyXFont::SANS_FAMILY;
pr.second = Font::SANS_FAMILY;
family[2] = pr;
pr.first = _("Typewriter");
pr.second = LyXFont::TYPEWRITER_FAMILY;
pr.second = Font::TYPEWRITER_FAMILY;
family[3] = pr;
pr.first = _("Reset");
pr.second = LyXFont::INHERIT_FAMILY;
pr.second = Font::INHERIT_FAMILY;
family[4] = pr;
return family;
@ -894,19 +894,19 @@ vector<SeriesPair> const getSeriesData()
SeriesPair pr;
pr.first = _("No change");
pr.second = LyXFont::IGNORE_SERIES;
pr.second = Font::IGNORE_SERIES;
series[0] = pr;
pr.first = _("Medium");
pr.second = LyXFont::MEDIUM_SERIES;
pr.second = Font::MEDIUM_SERIES;
series[1] = pr;
pr.first = _("Bold");
pr.second = LyXFont::BOLD_SERIES;
pr.second = Font::BOLD_SERIES;
series[2] = pr;
pr.first = _("Reset");
pr.second = LyXFont::INHERIT_SERIES;
pr.second = Font::INHERIT_SERIES;
series[3] = pr;
return series;
@ -920,27 +920,27 @@ vector<ShapePair> const getShapeData()
ShapePair pr;
pr.first = _("No change");
pr.second = LyXFont::IGNORE_SHAPE;
pr.second = Font::IGNORE_SHAPE;
shape[0] = pr;
pr.first = _("Upright");
pr.second = LyXFont::UP_SHAPE;
pr.second = Font::UP_SHAPE;
shape[1] = pr;
pr.first = _("Italic");
pr.second = LyXFont::ITALIC_SHAPE;
pr.second = Font::ITALIC_SHAPE;
shape[2] = pr;
pr.first = _("Slanted");
pr.second = LyXFont::SLANTED_SHAPE;
pr.second = Font::SLANTED_SHAPE;
shape[3] = pr;
pr.first = _("Small Caps");
pr.second = LyXFont::SMALLCAPS_SHAPE;
pr.second = Font::SMALLCAPS_SHAPE;
shape[4] = pr;
pr.first = _("Reset");
pr.second = LyXFont::INHERIT_SHAPE;
pr.second = Font::INHERIT_SHAPE;
shape[5] = pr;
return shape;
@ -954,59 +954,59 @@ vector<SizePair> const getSizeData()
SizePair pr;
pr.first = _("No change");
pr.second = LyXFont::IGNORE_SIZE;
pr.second = Font::IGNORE_SIZE;
size[0] = pr;
pr.first = _("Tiny");
pr.second = LyXFont::SIZE_TINY;
pr.second = Font::SIZE_TINY;
size[1] = pr;
pr.first = _("Smallest");
pr.second = LyXFont::SIZE_SCRIPT;
pr.second = Font::SIZE_SCRIPT;
size[2] = pr;
pr.first = _("Smaller");
pr.second = LyXFont::SIZE_FOOTNOTE;
pr.second = Font::SIZE_FOOTNOTE;
size[3] = pr;
pr.first = _("Small");
pr.second = LyXFont::SIZE_SMALL;
pr.second = Font::SIZE_SMALL;
size[4] = pr;
pr.first = _("Normal");
pr.second = LyXFont::SIZE_NORMAL;
pr.second = Font::SIZE_NORMAL;
size[5] = pr;
pr.first = _("Large");
pr.second = LyXFont::SIZE_LARGE;
pr.second = Font::SIZE_LARGE;
size[6] = pr;
pr.first = _("Larger");
pr.second = LyXFont::SIZE_LARGER;
pr.second = Font::SIZE_LARGER;
size[7] = pr;
pr.first = _("Largest");
pr.second = LyXFont::SIZE_LARGEST;
pr.second = Font::SIZE_LARGEST;
size[8] = pr;
pr.first = _("Huge");
pr.second = LyXFont::SIZE_HUGE;
pr.second = Font::SIZE_HUGE;
size[9] = pr;
pr.first = _("Huger");
pr.second = LyXFont::SIZE_HUGER;
pr.second = Font::SIZE_HUGER;
size[10] = pr;
pr.first = _("Increase");
pr.second = LyXFont::INCREASE_SIZE;
pr.second = Font::INCREASE_SIZE;
size[11] = pr;
pr.first = _("Decrease");
pr.second = LyXFont::DECREASE_SIZE;
pr.second = Font::DECREASE_SIZE;
size[12] = pr;
pr.first = _("Reset");
pr.second = LyXFont::INHERIT_SIZE;
pr.second = Font::INHERIT_SIZE;
size[13] = pr;
return size;

View File

@ -13,7 +13,7 @@
#ifndef FRONTEND_HELPERS_H
#define FRONTEND_HELPERS_H
#include "LyXFont.h"
#include "Font.h"
#include "support/docstring.h"
#include <utility>
@ -196,13 +196,13 @@ enum FONT_STATE {
};
///
typedef std::pair<docstring, LyXFont::FONT_FAMILY> FamilyPair;
typedef std::pair<docstring, Font::FONT_FAMILY> FamilyPair;
///
typedef std::pair<docstring, LyXFont::FONT_SERIES> SeriesPair;
typedef std::pair<docstring, Font::FONT_SERIES> SeriesPair;
///
typedef std::pair<docstring, LyXFont::FONT_SHAPE> ShapePair;
typedef std::pair<docstring, Font::FONT_SHAPE> ShapePair;
///
typedef std::pair<docstring, LyXFont::FONT_SIZE> SizePair;
typedef std::pair<docstring, Font::FONT_SIZE> SizePair;
///
typedef std::pair<docstring, FONT_STATE> BarPair;
///

View File

@ -48,49 +48,49 @@ namespace frontend {
namespace {
struct symbol_font {
LyXFont::FONT_FAMILY lyx_family;
Font::FONT_FAMILY lyx_family;
string family;
string xlfd;
};
symbol_font symbol_fonts[] = {
{ LyXFont::SYMBOL_FAMILY,
{ Font::SYMBOL_FAMILY,
"symbol",
"-*-symbol-*-*-*-*-*-*-*-*-*-*-adobe-fontspecific" },
{ LyXFont::CMR_FAMILY,
{ Font::CMR_FAMILY,
"cmr10",
"-*-cmr10-medium-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::CMSY_FAMILY,
{ Font::CMSY_FAMILY,
"cmsy10",
"-*-cmsy10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::CMM_FAMILY,
{ Font::CMM_FAMILY,
"cmmi10",
"-*-cmmi10-medium-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::CMEX_FAMILY,
{ Font::CMEX_FAMILY,
"cmex10",
"-*-cmex10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::MSA_FAMILY,
{ Font::MSA_FAMILY,
"msam10",
"-*-msam10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::MSB_FAMILY,
{ Font::MSB_FAMILY,
"msbm10",
"-*-msbm10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::EUFRAK_FAMILY,
{ Font::EUFRAK_FAMILY,
"eufm10",
"-*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::WASY_FAMILY,
{ Font::WASY_FAMILY,
"wasy10",
"-*-wasy10-medium-*-*-*-*-*-*-*-*-*-*-*" },
{ LyXFont::ESINT_FAMILY,
{ Font::ESINT_FAMILY,
"esint10",
"-*-esint10-medium-*-*-*-*-*-*-*-*-*-*-*" }
};
@ -109,7 +109,7 @@ string getRawName(string const & family)
}
string const symbolFamily(LyXFont::FONT_FAMILY family)
string const symbolFamily(Font::FONT_FAMILY family)
{
for (size_t i = 0; i < nr_symbol_fonts; ++i) {
if (family == symbol_fonts[i].lyx_family)
@ -119,10 +119,10 @@ string const symbolFamily(LyXFont::FONT_FAMILY family)
}
bool isSymbolFamily(LyXFont::FONT_FAMILY family)
bool isSymbolFamily(Font::FONT_FAMILY family)
{
return family >= LyXFont::SYMBOL_FAMILY &&
family <= LyXFont::ESINT_FAMILY;
return family >= Font::SYMBOL_FAMILY &&
family <= Font::ESINT_FAMILY;
}
@ -189,7 +189,7 @@ pair<QFont, bool> const getSymbolFont(string const & family)
GuiFontLoader::GuiFontLoader()
{
for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
for (int i1 = 0; i1 < Font::NUM_FAMILIES; ++i1)
for (int i2 = 0; i2 < 2; ++i2)
for (int i3 = 0; i3 < 4; ++i3)
for (int i4 = 0; i4 < 10; ++i4)
@ -199,7 +199,7 @@ GuiFontLoader::GuiFontLoader()
void GuiFontLoader::update()
{
for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1)
for (int i1 = 0; i1 < Font::NUM_FAMILIES; ++i1)
for (int i2 = 0; i2 < 2; ++i2)
for (int i3 = 0; i3 < 4; ++i3)
for (int i4 = 0; i4 < 10; ++i4) {
@ -212,7 +212,7 @@ void GuiFontLoader::update()
/////////////////////////////////////////////////
QLFontInfo::QLFontInfo(LyXFont const & f)
QLFontInfo::QLFontInfo(Font const & f)
{
font.setKerning(false);
string const pat = symbolFamily(f.family());
@ -221,15 +221,15 @@ QLFontInfo::QLFontInfo(LyXFont const & f)
boost::tie(font, tmp) = getSymbolFont(pat);
} else {
switch (f.family()) {
case LyXFont::ROMAN_FAMILY:
case Font::ROMAN_FAMILY:
font.setFamily(toqstr(makeFontName(lyxrc.roman_font_name,
lyxrc.roman_font_foundry)));
break;
case LyXFont::SANS_FAMILY:
case Font::SANS_FAMILY:
font.setFamily(toqstr(makeFontName(lyxrc.sans_font_name,
lyxrc.sans_font_foundry)));
break;
case LyXFont::TYPEWRITER_FAMILY:
case Font::TYPEWRITER_FAMILY:
font.setFamily(toqstr(makeFontName(lyxrc.typewriter_font_name,
lyxrc.typewriter_font_foundry)));
break;
@ -239,10 +239,10 @@ QLFontInfo::QLFontInfo(LyXFont const & f)
}
switch (f.series()) {
case LyXFont::MEDIUM_SERIES:
case Font::MEDIUM_SERIES:
font.setWeight(QFont::Normal);
break;
case LyXFont::BOLD_SERIES:
case Font::BOLD_SERIES:
font.setWeight(QFont::Bold);
break;
default:
@ -250,8 +250,8 @@ QLFontInfo::QLFontInfo(LyXFont const & f)
}
switch (f.realShape()) {
case LyXFont::ITALIC_SHAPE:
case LyXFont::SLANTED_SHAPE:
case Font::ITALIC_SHAPE:
case Font::SLANTED_SHAPE:
font.setItalic(true);
break;
default:
@ -276,13 +276,13 @@ QLFontInfo::QLFontInfo(LyXFont const & f)
LYXERR(Debug::FONT) << "The font has size: "
<< font.pointSizeF() << endl;
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
if (f.realShape() != Font::SMALLCAPS_SHAPE) {
metrics.reset(new GuiFontMetrics(font));
}
else {
// handle small caps ourselves ...
LyXFont smallfont = f;
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
Font smallfont = f;
smallfont.decSize().decSize().setShape(Font::UP_SHAPE);
QFont font2(font);
font2.setKerning(false);
font2.setPointSizeF(convert<double>(lyxrc.font_sizes[smallfont.size()])
@ -294,12 +294,12 @@ QLFontInfo::QLFontInfo(LyXFont const & f)
}
bool GuiFontLoader::available(LyXFont const & f)
bool GuiFontLoader::available(Font const & f)
{
static vector<int> cache_set(LyXFont::NUM_FAMILIES, false);
static vector<int> cache(LyXFont::NUM_FAMILIES, false);
static vector<int> cache_set(Font::NUM_FAMILIES, false);
static vector<int> cache(Font::NUM_FAMILIES, false);
LyXFont::FONT_FAMILY family = f.family();
Font::FONT_FAMILY family = f.family();
if (cache_set[family])
return cache[family];
cache_set[family] = true;

View File

@ -17,7 +17,7 @@
#include "GuiFontMetrics.h"
#include "Encoding.h"
#include "LyXFont.h"
#include "Font.h"
#include <QFont>
@ -25,12 +25,12 @@ namespace lyx {
namespace frontend {
/**
* Qt font loader for LyX. Matches LyXFonts against
* Qt font loader for LyX. Matches Fonts against
* actual QFont instances, and also caches metrics.
*/
class QLFontInfo {
public:
QLFontInfo(LyXFont const & f);
QLFontInfo(Font const & f);
/// The font instance
QFont font;
@ -50,19 +50,19 @@ public:
virtual ~GuiFontLoader() {}
virtual void update();
virtual bool available(LyXFont const & f);
inline virtual FontMetrics const & metrics(LyXFont const & f) {
virtual bool available(Font const & f);
inline virtual FontMetrics const & metrics(Font const & f) {
return *fontinfo(f).metrics.get();
}
/// Get the QFont for this LyXFont
QFont const & get(LyXFont const & f) {
/// Get the QFont for this Font
QFont const & get(Font const & f) {
return fontinfo(f).font;
}
/// Get font info (font + metrics) for the given LyX font.
QLFontInfo & fontinfo(LyXFont const & f) {
QLFontInfo & fontinfo(Font const & f) {
// fi is a reference to the pointer type (QLFontInfo *) in the
// fontinfo_ table.
QLFontInfo * & fi =
@ -74,7 +74,7 @@ public:
private:
/// BUTT ugly !
QLFontInfo * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
QLFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10];
};

View File

@ -479,7 +479,7 @@ void GuiWorkArea::doGreyOut(QLPainter & pain)
// The font used to display the version info
font.setStyleHint(QFont::SansSerif);
font.setWeight(QFont::Bold);
font.setPointSize(convert<int>(lyxrc.font_sizes[LyXFont::SIZE_LARGE]));
font.setPointSize(convert<int>(lyxrc.font_sizes[Font::SIZE_LARGE]));
int const w = pm.width();
int const h = pm.height();
@ -618,7 +618,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
QLPainter pain(&screen_);
buffer_view_->updateMetrics(false);
paintText(*buffer_view_, pain);
LyXFont font = buffer_view_->cursor().getFont();
Font font = buffer_view_->cursor().getFont();
FontMetrics const & fm = theFontMetrics(font);
int height = fm.maxHeight();
int cur_x = cursor_->rect().left();

View File

@ -23,7 +23,7 @@
namespace lyx {
class LyXFont;
class Font;
namespace frontend {

View File

@ -126,7 +126,7 @@ QDelimiterDialog::QDelimiterDialog(QMathDelimiter * form, QWidget * parent)
QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
QListWidgetItem * lwi = new QListWidgetItem(symbol);
lwi->setToolTip(toqstr(delim));
LyXFont lyxfont;
Font lyxfont;
lyxfont.setFamily(ms.fontfamily);
QFont const & symbol_font = guiApp->guiFontLoader().get(lyxfont);
lwi->setFont(symbol_font);

View File

@ -179,7 +179,7 @@ void QLPainter::image(int x, int y, int w, int h, graphics::Image const & i)
}
int QLPainter::text(int x, int y, char_type c, LyXFont const & f)
int QLPainter::text(int x, int y, char_type c, Font const & f)
{
docstring s(1, c);
return text(x, y, s, f);
@ -187,10 +187,10 @@ int QLPainter::text(int x, int y, char_type c, LyXFont const & f)
int QLPainter::smallCapsText(int x, int y,
QString const & s, LyXFont const & f)
QString const & s, Font const & f)
{
LyXFont smallfont(f);
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
Font smallfont(f);
smallfont.decSize().decSize().setShape(Font::UP_SHAPE);
QFont const & qfont = guiApp->guiFontLoader().get(f);
QFont const & qsmallfont = guiApp->guiFontLoader().get(smallfont);
@ -214,7 +214,7 @@ int QLPainter::smallCapsText(int x, int y,
int QLPainter::text(int x, int y, docstring const & s,
LyXFont const & f)
Font const & f)
{
/* Caution: The following ucs4 to QString conversions work for symbol fonts
only because they are no real conversions but simple casts in reality.
@ -240,7 +240,7 @@ int QLPainter::text(int x, int y, docstring const & s,
int textwidth;
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
if (f.realShape() != Font::SMALLCAPS_SHAPE) {
setQPainterPen(f.realColor());
if (font() != fi.font)
setFont(fi.font);
@ -273,7 +273,7 @@ int QLPainter::text(int x, int y, docstring const & s,
textwidth = smallCapsText(x, y, str, f);
}
if (f.underbar() == LyXFont::ON) {
if (f.underbar() == Font::ON) {
underline(f, x, y, textwidth);
}

View File

@ -23,7 +23,7 @@ class QString;
namespace lyx {
class LyXFont;
class Font;
namespace frontend {
@ -90,10 +90,10 @@ public:
/// draw a string at position x, y (y is the baseline)
virtual int text(int x, int y,
docstring const & str, LyXFont const & f);
docstring const & str, Font const & f);
/// draw a char at position x, y (y is the baseline)
virtual int text(int x, int y, char_type c, LyXFont const & f);
virtual int text(int x, int y, char_type c, Font const & f);
private:
/// draw small caps text
@ -101,7 +101,7 @@ private:
\return width of the drawn text.
*/
int smallCapsText(int x, int y,
QString const & str, LyXFont const & f);
QString const & str, Font const & f);
/// set pen parameters
void setQPainterPen(Color_color col,

View File

@ -19,7 +19,7 @@
#include "Session.h"
#include "debug.h"
#include "Color.h"
#include "LyXFont.h"
#include "Font.h"
#include "PanelStack.h"
#include "QFontExample.h"
#include "gettext.h"
@ -437,16 +437,16 @@ void PrefScreenFonts::apply(LyXRC & rc) const
rc.zoom = screenZoomSB->value();
rc.dpi = screenDpiSB->value();
rc.font_sizes[LyXFont::SIZE_TINY] = fromqstr(screenTinyED->text());
rc.font_sizes[LyXFont::SIZE_SCRIPT] = fromqstr(screenSmallestED->text());
rc.font_sizes[LyXFont::SIZE_FOOTNOTE] = fromqstr(screenSmallerED->text());
rc.font_sizes[LyXFont::SIZE_SMALL] = fromqstr(screenSmallED->text());
rc.font_sizes[LyXFont::SIZE_NORMAL] = fromqstr(screenNormalED->text());
rc.font_sizes[LyXFont::SIZE_LARGE] = fromqstr(screenLargeED->text());
rc.font_sizes[LyXFont::SIZE_LARGER] = fromqstr(screenLargerED->text());
rc.font_sizes[LyXFont::SIZE_LARGEST] = fromqstr(screenLargestED->text());
rc.font_sizes[LyXFont::SIZE_HUGE] = fromqstr(screenHugeED->text());
rc.font_sizes[LyXFont::SIZE_HUGER] = fromqstr(screenHugerED->text());
rc.font_sizes[Font::SIZE_TINY] = fromqstr(screenTinyED->text());
rc.font_sizes[Font::SIZE_SCRIPT] = fromqstr(screenSmallestED->text());
rc.font_sizes[Font::SIZE_FOOTNOTE] = fromqstr(screenSmallerED->text());
rc.font_sizes[Font::SIZE_SMALL] = fromqstr(screenSmallED->text());
rc.font_sizes[Font::SIZE_NORMAL] = fromqstr(screenNormalED->text());
rc.font_sizes[Font::SIZE_LARGE] = fromqstr(screenLargeED->text());
rc.font_sizes[Font::SIZE_LARGER] = fromqstr(screenLargerED->text());
rc.font_sizes[Font::SIZE_LARGEST] = fromqstr(screenLargestED->text());
rc.font_sizes[Font::SIZE_HUGE] = fromqstr(screenHugeED->text());
rc.font_sizes[Font::SIZE_HUGER] = fromqstr(screenHugerED->text());
if (rc.font_sizes != oldrc.font_sizes
|| rc.roman_font_name != oldrc.roman_font_name
@ -473,16 +473,16 @@ void PrefScreenFonts::update(LyXRC const & rc)
screenZoomSB->setValue(rc.zoom);
screenDpiSB->setValue(rc.dpi);
screenTinyED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_TINY]));
screenSmallestED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_SCRIPT]));
screenSmallerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_FOOTNOTE]));
screenSmallED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_SMALL]));
screenNormalED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_NORMAL]));
screenLargeED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGE]));
screenLargerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGER]));
screenLargestED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_LARGEST]));
screenHugeED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_HUGE]));
screenHugerED->setText(toqstr(rc.font_sizes[LyXFont::SIZE_HUGER]));
screenTinyED->setText(toqstr(rc.font_sizes[Font::SIZE_TINY]));
screenSmallestED->setText(toqstr(rc.font_sizes[Font::SIZE_SCRIPT]));
screenSmallerED->setText(toqstr(rc.font_sizes[Font::SIZE_FOOTNOTE]));
screenSmallED->setText(toqstr(rc.font_sizes[Font::SIZE_SMALL]));
screenNormalED->setText(toqstr(rc.font_sizes[Font::SIZE_NORMAL]));
screenLargeED->setText(toqstr(rc.font_sizes[Font::SIZE_LARGE]));
screenLargerED->setText(toqstr(rc.font_sizes[Font::SIZE_LARGER]));
screenLargestED->setText(toqstr(rc.font_sizes[Font::SIZE_LARGEST]));
screenHugeED->setText(toqstr(rc.font_sizes[Font::SIZE_HUGE]));
screenHugerED->setText(toqstr(rc.font_sizes[Font::SIZE_HUGER]));
}
void PrefScreenFonts::select_roman(const QString& name)

View File

@ -16,7 +16,7 @@
#include "BufferView.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "LyXFont.h"
#include "Font.h"
#include "Lexer.h"
#include "Paragraph.h"
#include "ParagraphList.h"
@ -143,13 +143,13 @@ docstring const bibitemWidest(Buffer const & buffer)
to use a hardcoded font like "Times" or so.
It is very important that the result of this function is the same both with
and without GUI. After thinking about this it is clear that no LyXFont
and without GUI. After thinking about this it is clear that no Font
metrics should be used here, since these come from the gui. If we can't
easily get the LaTeX font metrics we should make our own poor mans front
metrics replacement, e.g. by hardcoding the metrics of the standard TeX
font.
*/
LyXFont font;
Font font;
ParagraphList::const_iterator it = buffer.paragraphs().begin();
ParagraphList::const_iterator end = buffer.paragraphs().end();

View File

@ -143,7 +143,7 @@ void InsetBox::read(Buffer const & buf, Lexer & lex)
void InsetBox::setButtonLabel()
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();

View File

@ -93,7 +93,7 @@ void InsetBranch::read(Buffer const & buf, Lexer & lex)
void InsetBranch::setButtonLabel()
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();

View File

@ -99,8 +99,8 @@ void InsetCharStyle::setUndefined()
params_.latextype.clear();
params_.latexname.clear();
params_.latexparam.clear();
params_.font = LyXFont(LyXFont::ALL_INHERIT);
params_.labelfont = LyXFont(LyXFont::ALL_INHERIT);
params_.font = Font(Font::ALL_INHERIT);
params_.labelfont = Font(Font::ALL_INHERIT);
params_.labelfont.setColor(Color::error);
params_.show_label = true;
}
@ -140,17 +140,17 @@ void InsetCharStyle::read(Buffer const & buf, Lexer & lex)
bool InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
Font tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.font.reduce(LyXFont(LyXFont::ALL_SANE));
mi.base.font.reduce(Font(Font::ALL_SANE));
mi.base.font.realize(tmpfont);
mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
InsetText::metrics(mi, dim);
mi.base.font = tmpfont;
if (params_.show_label) {
// consider width of the inset label
LyXFont font(params_.labelfont);
font.realize(LyXFont(LyXFont::ALL_SANE));
Font font(params_.labelfont);
font.realize(Font(Font::ALL_SANE));
font.decSize();
font.decSize();
int w = 0;
@ -179,7 +179,7 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
LyXFont tmpfont = pi.base.font;
Font tmpfont = pi.base.font;
getDrawFont(pi.base.font);
// I don't understand why the above .reduce and .realize aren't
//needed, or even wanted, here. It just works. -- MV 10.04.2005
@ -198,8 +198,8 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
// the name of the charstyle. Can be toggled.
if (params_.show_label) {
LyXFont font(params_.labelfont);
font.realize(LyXFont(LyXFont::ALL_SANE));
Font font(params_.labelfont);
font.realize(Font(Font::ALL_SANE));
font.decSize();
font.decSize();
int w = 0;
@ -228,7 +228,7 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
}
void InsetCharStyle::getDrawFont(LyXFont & font) const
void InsetCharStyle::getDrawFont(Font & font) const
{
font = params_.font;
}

View File

@ -35,9 +35,9 @@ public:
///
std::string latexparam;
///
LyXFont font;
Font font;
///
LyXFont labelfont;
Font labelfont;
///
bool show_label;
};
@ -74,7 +74,7 @@ public:
///
void draw(PainterInfo &, int, int) const;
///
void getDrawFont(LyXFont &) const;
void getDrawFont(Font &) const;
///
bool forceDefaultParagraphs(idx_type) const { return true; }
///

View File

@ -448,7 +448,7 @@ void InsetCollapsable::setStatus(Cursor & cur, CollapseStatus status)
}
void InsetCollapsable::setLabelFont(LyXFont & font)
void InsetCollapsable::setLabelFont(Font & font)
{
labelfont_ = font;
}

View File

@ -18,7 +18,7 @@
#include "InsetText.h"
#include "Box.h"
#include "LyXFont.h"
#include "Font.h"
#include <string>
@ -71,7 +71,7 @@ public:
///
virtual void setButtonLabel() {}
///
void setLabelFont(LyXFont & f);
void setLabelFont(Font & f);
///
bool isOpen() const { return status_ == Open || status_ == Inlined; }
///
@ -105,7 +105,7 @@ protected:
protected:
///
LyXFont labelfont_;
Font labelfont_;
///
mutable Box button_dim;
///

View File

@ -53,7 +53,7 @@ using std::string;
void InsetERT::init()
{
setButtonLabel();
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::latex);
@ -88,7 +88,7 @@ InsetERT::InsetERT(BufferParams const & bp,
Language const *, string const & contents, CollapseStatus status)
: InsetCollapsable(bp, status)
{
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
Font font(Font::ALL_INHERIT, latex_language);
paragraphs().begin()->insert(0, contents, font);
// the init has to be after the initialization of the paragraph
@ -122,7 +122,7 @@ void InsetERT::read(Buffer const & buf, Lexer & lex)
// inherits the language from the last position of the existing text.
// As a side effect this makes us also robust against bugs in LyX
// that might lead to font changes in ERT in .lyx files.
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
Font font(Font::ALL_INHERIT, latex_language);
ParagraphList::iterator par = paragraphs().begin();
ParagraphList::iterator const end = paragraphs().end();
while (par != end) {
@ -226,7 +226,7 @@ void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
BufferParams const & bp = cur.buffer().params();
LyXLayout_ptr const layout =
bp.getLyXTextClass().defaultLayout();
LyXFont font = layout->font;
Font font = layout->font;
// ERT contents has always latex_language
font.setLanguage(latex_language);
ParagraphList::iterator const end = paragraphs().end();
@ -396,7 +396,7 @@ bool InsetERT::insetAllowed(Inset::Code /* code */) const
bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
Font tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.font.realize(tmpfont);
InsetCollapsable::metrics(mi, dim);
@ -409,7 +409,7 @@ bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetERT::draw(PainterInfo & pi, int x, int y) const
{
LyXFont tmpfont = pi.base.font;
Font tmpfont = pi.base.font;
getDrawFont(pi.base.font);
pi.base.font.realize(tmpfont);
InsetCollapsable::draw(pi, x, y);
@ -424,10 +424,10 @@ bool InsetERT::showInsetDialog(BufferView * bv) const
}
void InsetERT::getDrawFont(LyXFont & font) const
void InsetERT::getDrawFont(Font & font) const
{
font = LyXFont(LyXFont::ALL_INHERIT, latex_language);
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
font = Font(Font::ALL_INHERIT, latex_language);
font.setFamily(Font::TYPEWRITER_FAMILY);
font.setColor(Color::latex);
}

View File

@ -71,7 +71,7 @@ public:
///
bool showInsetDialog(BufferView *) const;
///
void getDrawFont(LyXFont &) const;
void getDrawFont(Font &) const;
///
bool forceDefaultParagraphs(idx_type) const { return true; }
/// should paragraph indendation be ommitted in any case?

View File

@ -119,7 +119,7 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
: InsetCollapsable(bp), name_(from_utf8(type))
{
setLabel(_("float: ") + floatName(type, bp));
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::collapsable);

View File

@ -25,7 +25,7 @@ namespace lyx {
InsetFootlike::InsetFootlike(BufferParams const & bp)
: InsetCollapsable(bp)
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::collapsable);
@ -36,7 +36,7 @@ InsetFootlike::InsetFootlike(BufferParams const & bp)
InsetFootlike::InsetFootlike(InsetFootlike const & in)
: InsetCollapsable(in)
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::collapsable);
@ -46,7 +46,7 @@ InsetFootlike::InsetFootlike(InsetFootlike const & in)
bool InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
Font tmpfont = mi.base.font;
mi.base.font = mi.base.bv->buffer()->params().getFont();
InsetCollapsable::metrics(mi, dim);
mi.base.font = tmpfont;
@ -58,7 +58,7 @@ bool InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
{
LyXFont tmpfont = pi.base.font;
Font tmpfont = pi.base.font;
pi.base.font = pi.base.bv->buffer()->params().getFont();
InsetCollapsable::draw(pi, x, y);
pi.base.font = tmpfont;

View File

@ -169,7 +169,7 @@ void InsetNote::setButtonLabel()
docstring const label = notetranslator_loc().find(params_.type);
setLabel(label);
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();

View File

@ -31,7 +31,7 @@ using std::ostringstream;
InsetOptArg::InsetOptArg(BufferParams const & ins)
: InsetCollapsable(ins)
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.setColor(Color::collapsable);
setLabelFont(font);
setLabel(_("opt"));
@ -41,7 +41,7 @@ InsetOptArg::InsetOptArg(BufferParams const & ins)
InsetOptArg::InsetOptArg(InsetOptArg const & in)
: InsetCollapsable(in)
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.setColor(Color::collapsable);
setLabelFont(font);
setLabel(_("opt"));

View File

@ -57,7 +57,7 @@ bool InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
{
LyXFont font;
Font font;
font.setColor(Color::pagebreak);
font.decSize();

View File

@ -219,7 +219,7 @@ docstring const InsetQuotes::dispString(Language const * loclang) const
bool InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont & font = mi.base.font;
Font & font = mi.base.font;
frontend::FontMetrics const & fm =
theFontMetrics(font);
dim.asc = fm.maxAscent();
@ -242,12 +242,12 @@ bool InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
#if 0
LyXFont const InsetQuotes::convertFont(LyXFont const & f) const
Font const InsetQuotes::convertFont(Font const & f) const
{
#if 1
return f;
#else
LyXFont font(f);
Font font(f);
return font;
#endif
}

View File

@ -81,7 +81,7 @@ public:
void draw(PainterInfo & pi, int x, int y) const;
#if 0
///
LyXFont const convertFont(LyXFont const & font) const;
Font const convertFont(Font const & font) const;
#endif
///
void write(Buffer const &, std::ostream &) const;

View File

@ -69,7 +69,7 @@ bool InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
{
LyXFont font = pi.base.font;
Font font = pi.base.font;
switch (kind_) {
case HYPHENATION:

View File

@ -4725,7 +4725,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
if (cols < columns) {
shared_ptr<InsetText> inset = loctab->getCellInset(cell);
Paragraph & par = inset->text_.getPar(0);
LyXFont const font = inset->text_.getFont(buffer, par, 0);
Font const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, p - op), font,
buffer.params().trackChanges);
++cols;
@ -4737,7 +4737,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
if (cols < columns) {
shared_ptr<InsetText> inset = tabular.getCellInset(cell);
Paragraph & par = inset->text_.getPar(0);
LyXFont const font = inset->text_.getFont(buffer, par, 0);
Font const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, p - op), font,
buffer.params().trackChanges);
}
@ -4754,7 +4754,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
if (cell < cells && op < len) {
shared_ptr<InsetText> inset = loctab->getCellInset(cell);
Paragraph & par = inset->text_.getPar(0);
LyXFont const font = inset->text_.getFont(buffer, par, 0);
Font const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, len - op), font,
buffer.params().trackChanges);
}

View File

@ -357,7 +357,7 @@ bool InsetText::showInsetDialog(BufferView *) const
}
void InsetText::setText(docstring const & data, LyXFont const & font, bool trackChanges)
void InsetText::setText(docstring const & data, Font const & font, bool trackChanges)
{
clear();
Paragraph & first = paragraphs().front();

View File

@ -14,7 +14,7 @@
#include "Inset.h"
#include "RowList_fwd.h"
#include "LyXFont.h"
#include "Font.h"
#include "LyXText.h"
#include "support/types.h"
@ -81,7 +81,7 @@ public:
///
Code lyxCode() const { return TEXT_CODE; }
///
void setText(docstring const &, LyXFont const &, bool trackChanges);
void setText(docstring const &, Font const &, bool trackChanges);
///
void setAutoBreakRows(bool);
///
@ -162,7 +162,7 @@ public:
///
mutable LyXText text_;
///
mutable LyXFont font_;
mutable Font font_;
///
static int border_;
};

View File

@ -15,7 +15,7 @@
#include "debug.h"
#include "gettext.h"
#include "LyXFont.h"
#include "Font.h"
#include "LyXText.h"
#include "MetricsInfo.h"
@ -39,7 +39,7 @@ Inset.heorem::InsetTheorem()
: InsetCollapsable()
{
setLabel(_("theorem"));
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::collapsable);

View File

@ -123,7 +123,7 @@ bool InsetVSpace::metrics(MetricsInfo & mi, Dimension & dim) const
if (space_.length().len().value() >= 0.0)
height = max(height, space_.inPixels(*mi.base.bv));
LyXFont font;
Font font;
font.decSize();
font.decSize();
@ -178,7 +178,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
int a = 0;
int d = 0;
LyXFont font;
Font font;
font.setColor(Color::added_space);
font.decSize();
font.decSize();

View File

@ -47,7 +47,7 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
: InsetCollapsable(bp), name_(from_utf8(type))
{
setLabel(_("wrap: ") + floatName(type, bp));
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::collapsable);

View File

@ -45,7 +45,7 @@ void RenderButton::update(docstring const & text, bool editable)
bool RenderButton::metrics(MetricsInfo &, Dimension & dim) const
{
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.decSize();
frontend::FontMetrics const & fm =
theFontMetrics(font);
@ -66,7 +66,7 @@ bool RenderButton::metrics(MetricsInfo &, Dimension & dim) const
void RenderButton::draw(PainterInfo & pi, int x, int y) const
{
// Draw it as a box with the LaTeX text
LyXFont font(LyXFont::ALL_SANE);
Font font(Font::ALL_SANE);
font.setColor(Color::command);
font.decSize();

View File

@ -153,21 +153,21 @@ bool RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
} else {
int font_width = 0;
LyXFont msgFont(mi.base.font);
msgFont.setFamily(LyXFont::SANS_FAMILY);
Font msgFont(mi.base.font);
msgFont.setFamily(Font::SANS_FAMILY);
// FIXME UNICODE
docstring const justname =
from_utf8(onlyFilename(params_.filename.absFilename()));
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
msgFont.setSize(Font::SIZE_FOOTNOTE);
font_width = theFontMetrics(msgFont)
.width(justname);
}
docstring const msg = statusMessage(params_, loader_.status());
if (!msg.empty()) {
msgFont.setSize(LyXFont::SIZE_TINY);
msgFont.setSize(Font::SIZE_TINY);
font_width = std::max(font_width,
theFontMetrics(msgFont).width(msg));
}
@ -208,12 +208,12 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
Color::foreground);
// Print the file name.
LyXFont msgFont = pi.base.font;
msgFont.setFamily(LyXFont::SANS_FAMILY);
Font msgFont = pi.base.font;
msgFont.setFamily(Font::SANS_FAMILY);
string const justname = onlyFilename(params_.filename.absFilename());
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
msgFont.setSize(Font::SIZE_FOOTNOTE);
pi.pain.text(x + Inset::TEXT_TO_INSET_OFFSET + 6,
y - theFontMetrics(msgFont).maxAscent() - 4,
from_utf8(justname), msgFont);
@ -222,7 +222,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
// Print the message.
docstring const msg = statusMessage(params_, loader_.status());
if (!msg.empty()) {
msgFont.setSize(LyXFont::SIZE_TINY);
msgFont.setSize(Font::SIZE_TINY);
pi.pain.text(x + Inset::TEXT_TO_INSET_OFFSET + 6,
y - 4, msg, msgFont);
}

View File

@ -128,9 +128,9 @@ bool RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const
dim.asc = 50;
dim.des = 0;
LyXFont font(mi.base.font);
font.setFamily(LyXFont::SANS_FAMILY);
font.setSize(LyXFont::SIZE_FOOTNOTE);
Font font(mi.base.font);
font.setFamily(Font::SANS_FAMILY);
font.setSize(Font::SIZE_FOOTNOTE);
docstring const stat = statusMessage(mi.base.bv, snippet_);
dim.wid = 15 + theFontMetrics(font).width(stat);
}
@ -162,9 +162,9 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
dim_.asc + dim_.des,
Color::foreground);
LyXFont font(pi.base.font);
font.setFamily(LyXFont::SANS_FAMILY);
font.setSize(LyXFont::SIZE_FOOTNOTE);
Font font(pi.base.font);
font.setFamily(Font::SANS_FAMILY);
font.setSize(Font::SIZE_FOOTNOTE);
docstring const stat = statusMessage(pi.base.bv, snippet_);
pi.pain.text(x + offset + 6,

View File

@ -179,7 +179,7 @@ int replaceAll(BufferView * bv,
DocIterator cur = doc_iterator_begin(buf.inset());
while (findForward(cur, match)) {
pos_type pos = cur.pos();
LyXFont const font
Font const font
= cur.paragraph().getFontSettings(buf.params(), pos);
int striked = ssize - cur.paragraph().eraseChars(pos, pos + ssize,
buf.params().trackChanges);

View File

@ -144,7 +144,7 @@ bool InsetFormulaMacro::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetFormulaMacro::draw(PainterInfo & p, int x, int y) const
{
// label
LyXFont font = p.base.font;
Font font = p.base.font;
font.setColor(Color::math);
PainterInfo pi(p.base.bv, p.pain);

View File

@ -20,7 +20,7 @@
namespace lyx {
class LyXFont;
class Font;
/// Support for \\mbox

View File

@ -62,7 +62,7 @@ bool InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
{
LyXFont font = pi.base.font;
Font font = pi.base.font;
font.setColor(Color::latex);
Dimension t = theFontMetrics(font).dimension('{');
pi.pain.text(x, y, '{', font);

View File

@ -73,7 +73,7 @@ bool InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
FontSetChanger dummy(mi.base, "cmm");
dim = theFontMetrics(mi.base.font).dimension(char_);
} else if (!slanted(char_) && mi.base.fontname == "mathnormal") {
ShapeChanger dummy(mi.base.font, LyXFont::UP_SHAPE);
ShapeChanger dummy(mi.base.font, Font::UP_SHAPE);
dim = theFontMetrics(mi.base.font).dimension(char_);
} else {
frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
@ -113,7 +113,7 @@ void InsetMathChar::draw(PainterInfo & pi, int x, int y) const
FontSetChanger dummy(pi.base, "cmm");
pi.draw(x, y, char_);
} else if (!slanted(char_) && pi.base.fontname == "mathnormal") {
ShapeChanger dummy(pi.base.font, LyXFont::UP_SHAPE);
ShapeChanger dummy(pi.base.font, Font::UP_SHAPE);
pi.draw(x, y, char_);
} else {
pi.draw(x, y, char_);

View File

@ -14,7 +14,7 @@
#include "InsetMath.h"
#include "LyXFont.h"
#include "Font.h"
namespace lyx {
@ -56,7 +56,7 @@ private:
/// cached kerning for superscript
mutable int kerning_;
///
mutable LyXFont font_cache_;
mutable Font font_cache_;
};
} // namespace lyx

View File

@ -162,7 +162,7 @@ InsetMathHull::InsetMathHull()
//lyxerr << "sizeof InsetMath: " << sizeof(InsetMath) << endl;
//lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << endl;
//lyxerr << "sizeof InsetMathChar: " << sizeof(InsetMathChar) << endl;
//lyxerr << "sizeof LyXFont: " << sizeof(LyXFont) << endl;
//lyxerr << "sizeof Font: " << sizeof(Font) << endl;
initMath();
setDefaults();
}
@ -1304,7 +1304,7 @@ void InsetMathHull::handleFont(Cursor & cur, docstring const & arg,
void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg)
{
recordUndo(cur);
LyXFont font;
Font font;
bool b;
bv_funcs::string2font(to_utf8(arg), font, b);
if (font.color() != Color::inherit) {

View File

@ -404,7 +404,7 @@ void InsetMathNest::handleFont
void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
{
recordUndo(cur, Undo::ATOMIC);
LyXFont font;
Font font;
bool b;
bv_funcs::string2font(to_utf8(arg), font, b);
if (font.color() != Color::inherit) {

View File

@ -29,18 +29,18 @@ using std::auto_ptr;
InsetMathSymbol::InsetMathSymbol(latexkeys const * l)
: sym_(l), h_(0), scriptable_(false), font_cache_(LyXFont::ALL_IGNORE)
: sym_(l), h_(0), scriptable_(false), font_cache_(Font::ALL_IGNORE)
{}
InsetMathSymbol::InsetMathSymbol(char const * name)
: sym_(in_word_set(from_ascii(name))), h_(0), scriptable_(false),
font_cache_(LyXFont::ALL_IGNORE)
font_cache_(Font::ALL_IGNORE)
{}
InsetMathSymbol::InsetMathSymbol(docstring const & name)
: sym_(in_word_set(name)), h_(0), scriptable_(false), font_cache_(LyXFont::ALL_IGNORE)
: sym_(in_word_set(name)), h_(0), scriptable_(false), font_cache_(Font::ALL_IGNORE)
{}

View File

@ -14,7 +14,7 @@
#include "InsetMath.h"
#include "LyXFont.h"
#include "Font.h"
namespace lyx {
@ -82,7 +82,7 @@ private:
///
mutable bool scriptable_;
///
mutable LyXFont font_cache_;
mutable Font font_cache_;
};
} // namespace lyx

View File

@ -56,7 +56,7 @@ public:
///
mutable MetricsInfo mi_;
///
mutable LyXFont font_;
mutable Font font_;
///
mutable InsetMathXYMatrix const * target_;
};

View File

@ -87,7 +87,7 @@ WordList theWordList;
bool math_font_available(docstring & name)
{
LyXFont f;
Font f;
augmentFont(f, name);
// Do we have the font proper?

View File

@ -119,7 +119,7 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
} else if (editing(mi.base.bv)) {
// FIXME UNICODE
asArray(macro.def(), tmpl_);
LyXFont font = mi.base.font;
Font font = mi.base.font;
augmentFont(font, from_ascii("lyxtex"));
tmpl_.metrics(mi, dim);
// FIXME UNICODE
@ -164,7 +164,7 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
// FIXME UNICODE
drawStrRed(pi, x, y, "Self reference: " + name());
} else if (editing(pi.base.bv)) {
LyXFont font = pi.base.font;
Font font = pi.base.font;
augmentFont(font, from_ascii("lyxtex"));
int h = y - dim_.ascent() + 2 + tmpl_.ascent();
pi.pain.text(x + 3, h, name(), font);

View File

@ -142,7 +142,7 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const
setPosCache(p, x, y);
// label
LyXFont font = p.base.font;
Font font = p.base.font;
font.setColor(Color::math);
PainterInfo pi(p.base.bv, p.pain);

View File

@ -369,20 +369,20 @@ deco_struct const * search_deco(docstring const & name)
} // namespace anon
int mathed_char_width(LyXFont const & font, char_type c)
int mathed_char_width(Font const & font, char_type c)
{
return theFontMetrics(font).width(c);
}
int mathed_char_kerning(LyXFont const & font, char_type c)
int mathed_char_kerning(Font const & font, char_type c)
{
frontend::FontMetrics const & fm = theFontMetrics(font);
return fm.rbearing(c) - fm.width(c);
}
void mathed_string_dim(LyXFont const & font,
void mathed_string_dim(Font const & font,
docstring const & s,
Dimension & dim)
{
@ -399,7 +399,7 @@ void mathed_string_dim(LyXFont const & font,
}
int mathed_string_width(LyXFont const & font, docstring const & s)
int mathed_string_width(Font const & font, docstring const & s)
{
return theFontMetrics(font).width(s);
}
@ -477,7 +477,7 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
{
LyXFont f = pi.base.font;
Font f = pi.base.font;
f.setColor(Color::latex);
pi.pain.text(x, y, str, f);
}
@ -485,13 +485,13 @@ void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str)
{
LyXFont f = pi.base.font;
Font f = pi.base.font;
f.setColor(Color::foreground);
pi.pain.text(x, y, str, f);
}
void math_font_max_dim(LyXFont const & font, int & asc, int & des)
void math_font_max_dim(Font const & font, int & asc, int & des)
{
frontend::FontMetrics const & fm = theFontMetrics(font);
asc = fm.maxAscent();
@ -501,82 +501,82 @@ void math_font_max_dim(LyXFont const & font, int & asc, int & des)
struct fontinfo {
std::string cmd_;
LyXFont::FONT_FAMILY family_;
LyXFont::FONT_SERIES series_;
LyXFont::FONT_SHAPE shape_;
Font::FONT_FAMILY family_;
Font::FONT_SERIES series_;
Font::FONT_SHAPE shape_;
Color::color color_;
};
LyXFont::FONT_FAMILY const inh_family = LyXFont::INHERIT_FAMILY;
LyXFont::FONT_SERIES const inh_series = LyXFont::INHERIT_SERIES;
LyXFont::FONT_SHAPE const inh_shape = LyXFont::INHERIT_SHAPE;
Font::FONT_FAMILY const inh_family = Font::INHERIT_FAMILY;
Font::FONT_SERIES const inh_series = Font::INHERIT_SERIES;
Font::FONT_SHAPE const inh_shape = Font::INHERIT_SHAPE;
// mathnormal should be the first, otherwise the fallback further down
// does not work
fontinfo fontinfos[] = {
// math fonts
{"mathnormal", LyXFont::ROMAN_FAMILY, LyXFont::MEDIUM_SERIES,
LyXFont::ITALIC_SHAPE, Color::math},
{"mathbf", inh_family, LyXFont::BOLD_SERIES,
{"mathnormal", Font::ROMAN_FAMILY, Font::MEDIUM_SERIES,
Font::ITALIC_SHAPE, Color::math},
{"mathbf", inh_family, Font::BOLD_SERIES,
inh_shape, Color::math},
{"mathcal", LyXFont::CMSY_FAMILY, inh_series,
{"mathcal", Font::CMSY_FAMILY, inh_series,
inh_shape, Color::math},
{"mathfrak", LyXFont::EUFRAK_FAMILY, inh_series,
{"mathfrak", Font::EUFRAK_FAMILY, inh_series,
inh_shape, Color::math},
{"mathrm", LyXFont::ROMAN_FAMILY, inh_series,
LyXFont::UP_SHAPE, Color::math},
{"mathsf", LyXFont::SANS_FAMILY, inh_series,
{"mathrm", Font::ROMAN_FAMILY, inh_series,
Font::UP_SHAPE, Color::math},
{"mathsf", Font::SANS_FAMILY, inh_series,
inh_shape, Color::math},
{"mathbb", LyXFont::MSB_FAMILY, inh_series,
{"mathbb", Font::MSB_FAMILY, inh_series,
inh_shape, Color::math},
{"mathtt", LyXFont::TYPEWRITER_FAMILY, inh_series,
{"mathtt", Font::TYPEWRITER_FAMILY, inh_series,
inh_shape, Color::math},
{"mathit", inh_family, inh_series,
LyXFont::ITALIC_SHAPE, Color::math},
{"cmex", LyXFont::CMEX_FAMILY, inh_series,
Font::ITALIC_SHAPE, Color::math},
{"cmex", Font::CMEX_FAMILY, inh_series,
inh_shape, Color::math},
{"cmm", LyXFont::CMM_FAMILY, inh_series,
{"cmm", Font::CMM_FAMILY, inh_series,
inh_shape, Color::math},
{"cmr", LyXFont::CMR_FAMILY, inh_series,
{"cmr", Font::CMR_FAMILY, inh_series,
inh_shape, Color::math},
{"cmsy", LyXFont::CMSY_FAMILY, inh_series,
{"cmsy", Font::CMSY_FAMILY, inh_series,
inh_shape, Color::math},
{"eufrak", LyXFont::EUFRAK_FAMILY, inh_series,
{"eufrak", Font::EUFRAK_FAMILY, inh_series,
inh_shape, Color::math},
{"msa", LyXFont::MSA_FAMILY, inh_series,
{"msa", Font::MSA_FAMILY, inh_series,
inh_shape, Color::math},
{"msb", LyXFont::MSB_FAMILY, inh_series,
{"msb", Font::MSB_FAMILY, inh_series,
inh_shape, Color::math},
{"wasy", LyXFont::WASY_FAMILY, inh_series,
{"wasy", Font::WASY_FAMILY, inh_series,
inh_shape, Color::none},
{"esint", LyXFont::ESINT_FAMILY, inh_series,
{"esint", Font::ESINT_FAMILY, inh_series,
inh_shape, Color::none},
// Text fonts
{"text", inh_family, inh_series,
inh_shape, Color::foreground},
{"textbf", inh_family, LyXFont::BOLD_SERIES,
{"textbf", inh_family, Font::BOLD_SERIES,
inh_shape, Color::foreground},
{"textit", inh_family, inh_series,
LyXFont::ITALIC_SHAPE, Color::foreground},
{"textmd", inh_family, LyXFont::MEDIUM_SERIES,
Font::ITALIC_SHAPE, Color::foreground},
{"textmd", inh_family, Font::MEDIUM_SERIES,
inh_shape, Color::foreground},
{"textnormal", inh_family, inh_series,
LyXFont::UP_SHAPE, Color::foreground},
{"textrm", LyXFont::ROMAN_FAMILY,
inh_series, LyXFont::UP_SHAPE,Color::foreground},
Font::UP_SHAPE, Color::foreground},
{"textrm", Font::ROMAN_FAMILY,
inh_series, Font::UP_SHAPE,Color::foreground},
{"textsc", inh_family, inh_series,
LyXFont::SMALLCAPS_SHAPE, Color::foreground},
{"textsf", LyXFont::SANS_FAMILY, inh_series,
Font::SMALLCAPS_SHAPE, Color::foreground},
{"textsf", Font::SANS_FAMILY, inh_series,
inh_shape, Color::foreground},
{"textsl", inh_family, inh_series,
LyXFont::SLANTED_SHAPE, Color::foreground},
{"texttt", LyXFont::TYPEWRITER_FAMILY, inh_series,
Font::SLANTED_SHAPE, Color::foreground},
{"texttt", Font::TYPEWRITER_FAMILY, inh_series,
inh_shape, Color::foreground},
{"textup", inh_family, inh_series,
LyXFont::UP_SHAPE, Color::foreground},
Font::UP_SHAPE, Color::foreground},
// TIPA support
{"textipa", inh_family, inh_series,
@ -584,21 +584,21 @@ fontinfo fontinfos[] = {
// LyX internal usage
{"lyxtex", inh_family, inh_series,
LyXFont::UP_SHAPE, Color::latex},
{"lyxsymbol", LyXFont::SYMBOL_FAMILY, inh_series,
Font::UP_SHAPE, Color::latex},
{"lyxsymbol", Font::SYMBOL_FAMILY, inh_series,
inh_shape, Color::math},
{"lyxboldsymbol", LyXFont::SYMBOL_FAMILY, LyXFont::BOLD_SERIES,
{"lyxboldsymbol", Font::SYMBOL_FAMILY, Font::BOLD_SERIES,
inh_shape, Color::math},
{"lyxblacktext", LyXFont::ROMAN_FAMILY, LyXFont::MEDIUM_SERIES,
LyXFont::UP_SHAPE, Color::foreground},
{"lyxblacktext", Font::ROMAN_FAMILY, Font::MEDIUM_SERIES,
Font::UP_SHAPE, Color::foreground},
{"lyxnochange", inh_family, inh_series,
inh_shape, Color::foreground},
{"lyxfakebb", LyXFont::TYPEWRITER_FAMILY, LyXFont::BOLD_SERIES,
LyXFont::UP_SHAPE, Color::math},
{"lyxfakecal", LyXFont::SANS_FAMILY, LyXFont::MEDIUM_SERIES,
LyXFont::ITALIC_SHAPE, Color::math},
{"lyxfakefrak", LyXFont::ROMAN_FAMILY, LyXFont::BOLD_SERIES,
LyXFont::ITALIC_SHAPE, Color::math}
{"lyxfakebb", Font::TYPEWRITER_FAMILY, Font::BOLD_SERIES,
Font::UP_SHAPE, Color::math},
{"lyxfakecal", Font::SANS_FAMILY, Font::MEDIUM_SERIES,
Font::ITALIC_SHAPE, Color::math},
{"lyxfakefrak", Font::ROMAN_FAMILY, Font::BOLD_SERIES,
Font::ITALIC_SHAPE, Color::math}
};
@ -631,9 +631,9 @@ bool isFontName(docstring const & name)
}
LyXFont getFont(docstring const & name)
Font getFont(docstring const & name)
{
LyXFont font;
Font font;
augmentFont(font, name);
return font;
}
@ -655,7 +655,7 @@ void fakeFont(docstring const & orig, docstring const & fake)
}
void augmentFont(LyXFont & font, docstring const & name)
void augmentFont(Font & font, docstring const & name)
{
static bool initialized = false;
if (!initialized) {

View File

@ -21,32 +21,32 @@
namespace lyx {
class PainterInfo;
class LyXFont;
class Font;
class Dimension;
class MathData;
class MathAtom;
class InsetMath;
int mathed_char_width(LyXFont const &, char_type c);
int mathed_char_width(Font const &, char_type c);
int mathed_char_kerning(LyXFont const &, char_type c);
int mathed_char_kerning(Font const &, char_type c);
void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
docstring const & name);
void mathed_string_dim(LyXFont const & font,
void mathed_string_dim(Font const & font,
docstring const & s,
Dimension & dim);
int mathed_string_width(LyXFont const &, docstring const & s);
int mathed_string_width(Font const &, docstring const & s);
void drawStrRed(PainterInfo & pi, int x, int y, docstring const & s);
void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & s);
void math_font_max_dim(LyXFont const &, int & asc, int & desc);
void math_font_max_dim(Font const &, int & asc, int & desc);
void augmentFont(LyXFont & f, docstring const & cmd);
void augmentFont(Font & f, docstring const & cmd);
bool isFontName(docstring const & name);

View File

@ -369,7 +369,7 @@ TeXOnePar(Buffer const & buf,
break;
}
LyXFont const outerfont =
Font const outerfont =
outerFont(std::distance(paragraphs.begin(), pit),
paragraphs);
@ -388,7 +388,7 @@ TeXOnePar(Buffer const & buf,
// We do not need to use to change the font for the last paragraph
// or for a command.
LyXFont const font =
Font const font =
(pit->empty()
? pit->getLayoutFont(bparams, outerfont)
: pit->getFont(bparams, pit->size() - 1, outerfont));

View File

@ -32,7 +32,7 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos,
// Therefore, it should only be used for breaking and merging paragraphs
Paragraph::value_type const tmpChar = fromPar.getChar(fromPos);
LyXFont const tmpFont = fromPar.getFontSettings(params, fromPos);
Font const tmpFont = fromPar.getFontSettings(params, fromPos);
Change const tmpChange = fromPar.lookupChange(fromPos);
if (tmpChar == Paragraph::META_INSET) {
@ -124,8 +124,8 @@ void breakParagraph(BufferParams const & bparams,
// Make sure that we keep the language when
// breaking paragraph.
if (tmp->empty()) {
LyXFont changed = tmp->getFirstFontSettings(bparams);
LyXFont old = par.getFontSettings(bparams, par.size());
Font changed = tmp->getFirstFontSettings(bparams);
Font old = par.getFontSettings(bparams, par.size());
changed.setLanguage(old.language());
tmp->setFont(0, changed);
}
@ -282,10 +282,10 @@ int getEndLabel(pit_type p, ParagraphList const & pars)
}
LyXFont const outerFont(pit_type par_offset, ParagraphList const & pars)
Font const outerFont(pit_type par_offset, ParagraphList const & pars)
{
depth_type par_depth = pars[par_offset].getDepth();
LyXFont tmpfont(LyXFont::ALL_INHERIT);
Font tmpfont(Font::ALL_INHERIT);
// Resolve against environment font information
while (par_offset != pit_type(pars.size())

View File

@ -20,7 +20,7 @@ namespace lyx {
class Buffer;
class BufferParams;
class Inset;
class LyXFont;
class Font;
class Paragraph;
class ParagraphList;
@ -70,7 +70,7 @@ int getEndLabel(pit_type par, ParagraphList const & plist);
* Get the font of the "environment" of paragraph \p par_offset in \p pars.
* All font changes of the paragraph are relative to this font.
*/
LyXFont const outerFont(pit_type par_offset, ParagraphList const & pars);
Font const outerFont(pit_type par_offset, ParagraphList const & pars);
/// return the number of InsetOptArg in a paragraph
int numberOfOptArgs(Paragraph const & par);

View File

@ -78,20 +78,20 @@ public:
int maxWidth() { return max_width_; }
private:
void paintForeignMark(double orig_x, LyXFont const & font, int desc = 0);
void paintHebrewComposeChar(pos_type & vpos, LyXFont const & font);
void paintArabicComposeChar(pos_type & vpos, LyXFont const & font);
void paintChars(pos_type & vpos, LyXFont const & font,
void paintForeignMark(double orig_x, Font const & font, int desc = 0);
void paintHebrewComposeChar(pos_type & vpos, Font const & font);
void paintArabicComposeChar(pos_type & vpos, Font const & font);
void paintChars(pos_type & vpos, Font const & font,
bool hebrew, bool arabic);
int paintAppendixStart(int y);
void paintFromPos(pos_type & vpos);
void paintInset(pos_type const pos, LyXFont const & font);
void paintInset(pos_type const pos, Font const & font);
/// return left margin
int leftMargin() const;
/// return the label font for this row
LyXFont const getLabelFont() const;
Font const getLabelFont() const;
/// bufferview to paint on
BufferView & bv_;
@ -153,7 +153,7 @@ RowPainter::RowPainter(PainterInfo & pi,
}
LyXFont const RowPainter::getLabelFont() const
Font const RowPainter::getLabelFont() const
{
return text_.getLabelFont(*bv_.buffer(), par_);
}
@ -170,7 +170,7 @@ int RowPainter::leftMargin() const
// This draws green lines around each inset.
void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
void RowPainter::paintInset(pos_type const pos, Font const & font)
{
Inset const * inset = par_.getInset(pos);
BOOST_ASSERT(inset);
@ -231,7 +231,7 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
}
void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
void RowPainter::paintHebrewComposeChar(pos_type & vpos, Font const & font)
{
pos_type pos = text_.bidi.vis2log(vpos);
@ -265,7 +265,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
}
void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
void RowPainter::paintArabicComposeChar(pos_type & vpos, Font const & font)
{
pos_type pos = text_.bidi.vis2log(vpos);
docstring str;
@ -295,7 +295,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
}
void RowPainter::paintChars(pos_type & vpos, LyXFont const & font,
void RowPainter::paintChars(pos_type & vpos, Font const & font,
bool hebrew, bool arabic)
{
// This method takes up 70% of time when typing
@ -366,7 +366,7 @@ void RowPainter::paintChars(pos_type & vpos, LyXFont const & font,
docstring s(&str[0], str.size());
if (prev_change != Change::UNCHANGED) {
LyXFont copy(font);
Font copy(font);
if (prev_change == Change::DELETED) {
copy.setColor(Color::strikeout);
} else if (prev_change == Change::INSERTED) {
@ -379,7 +379,7 @@ void RowPainter::paintChars(pos_type & vpos, LyXFont const & font,
}
void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
void RowPainter::paintForeignMark(double orig_x, Font const & font, int desc)
{
if (!lyxrc.mark_foreign_language)
return;
@ -396,7 +396,7 @@ void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
void RowPainter::paintFromPos(pos_type & vpos)
{
pos_type const pos = text_.bidi.vis2log(vpos);
LyXFont orig_font = text_.getFont(*bv_.buffer(), par_, pos);
Font orig_font = text_.getFont(*bv_.buffer(), par_, pos);
double const orig_x = x_;
@ -513,7 +513,7 @@ void RowPainter::paintDepthBar()
int RowPainter::paintAppendixStart(int y)
{
LyXFont pb_font;
Font pb_font;
pb_font.setColor(Color::appendix);
pb_font.decSize();
@ -576,7 +576,7 @@ void RowPainter::paintFirst()
|| layout->latextype != LATEX_ENVIRONMENT
|| is_seq)) {
LyXFont const font = getLabelFont();
Font const font = getLabelFont();
FontMetrics const & fm = theFontMetrics(font);
docstring const str = par_.getLabelstring();
@ -626,7 +626,7 @@ void RowPainter::paintFirst()
(layout->labeltype == LABEL_TOP_ENVIRONMENT ||
layout->labeltype == LABEL_BIBLIO ||
layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
LyXFont font = getLabelFont();
Font font = getLabelFont();
if (!par_.getLabelstring().empty()) {
docstring const str = par_.getLabelstring();
double spacing_val = 1.0;
@ -682,7 +682,7 @@ void RowPainter::paintLast()
switch (endlabel) {
case END_LABEL_BOX:
case END_LABEL_FILLED_BOX: {
LyXFont const font = getLabelFont();
Font const font = getLabelFont();
FontMetrics const & fm = theFontMetrics(font);
int const size = int(0.75 * fm.maxAscent());
int const y = yo_ - size;
@ -699,7 +699,7 @@ void RowPainter::paintLast()
}
case END_LABEL_STATIC: {
LyXFont font = getLabelFont();
Font font = getLabelFont();
FontMetrics const & fm = theFontMetrics(font);
docstring const & str = par_.layout()->endlabelstring();
double const x = is_rtl ?
@ -732,7 +732,7 @@ void RowPainter::paintText()
// Use font span to speed things up, see below
FontSpan font_span;
LyXFont font;
Font font;
Buffer const & buffer = *bv_.buffer();
for (pos_type vpos = row_.pos(); vpos < end; ) {

Some files were not shown because too many files have changed in this diff Show More