#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
-#include "Color.h"
#include "CutAndPaste.h"
#include "debug.h"
#include "FontIterator.h"
void TextMetrics::applyOuterFont(Font & font) const
{
Font lf(font_);
- lf.reduce(bv_->buffer().params().getFont());
- lf.realize(font);
+ lf.fontInfo().reduce(bv_->buffer().params().getFont().fontInfo());
+ lf.fontInfo().realize(font.fontInfo());
lf.setLanguage(font.language());
font = lf;
}
applyOuterFont(f);
bool lab = layout->labeltype == LABEL_MANUAL && pos < body_pos;
- Font const & lf = lab ? layout->labelfont : layout->font;
- Font rlf = lab ? layout->reslabelfont : layout->resfont;
+ FontInfo const & lf = lab ? layout->labelfont : layout->font;
+ FontInfo rlf = lab ? layout->reslabelfont : layout->resfont;
// In case the default family has been customized
- if (lf.family() == Font::INHERIT_FAMILY)
- rlf.setFamily(params.getFont().family());
- return f.realize(rlf);
+ if (lf.family() == INHERIT_FAMILY)
+ rlf.setFamily(params.getFont().fontInfo().family());
+ f.fontInfo().realize(rlf);
+ return f;
}
// The uncommon case need not be optimized as much
- Font const & layoutfont = pos < body_pos ?
+ FontInfo const & layoutfont = pos < body_pos ?
layout->labelfont : layout->font;
Font font = par.getFontSettings(params, pos);
- font.realize(layoutfont);
+ font.fontInfo().realize(layoutfont);
if (!text_->isMainText(buffer))
applyOuterFont(font);
// NOTE: the cast to pit_type should be removed when pit_type
// changes to a unsigned integer.
if (pit < pit_type(pars.size()))
- font.realize(outerFont(pit, pars));
+ font.fontInfo().realize(outerFont(pit, pars).fontInfo());
// Realize with the fonts of lesser depth.
- font.realize(params.getFont());
+ font.fontInfo().realize(params.getFont().fontInfo());
return font;
}
- right_margin;
Font const & font = ii->inset->noFontChange() ?
bufferfont : getDisplayFont(pit, ii->pos);
- MetricsInfo mi(bv_, font, w);
+ MetricsInfo mi(bv_, font.fontInfo(), w);
ii->inset->metrics(mi, dim);
Dimension const old_dim = pm.insetDimension(ii->inset);
pm.setInsetDimension(ii->inset, dim);
// often.
Buffer const & buffer = bv_->buffer();
Font font = getDisplayFont(pit, first);
- Font::FONT_SIZE const tmpsize = font.size();
- font = text_->getLayoutFont(buffer, pit);
- Font::FONT_SIZE const size = font.size();
- font.setSize(tmpsize);
+ FontSize const tmpsize = font.fontInfo().size();
+ font.fontInfo() = text_->getLayoutFont(buffer, pit);
+ FontSize const size = font.fontInfo().size();
+ font.fontInfo().setSize(tmpsize);
- Font labelfont = text_->getLabelFont(buffer, par);
+ FontInfo labelfont = text_->getLabelFont(buffer, par);
FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
FontMetrics const & fontmetrics = theFontMetrics(font);
// cosmetic error for now.
int labeladdon = 0;
- Font::FONT_SIZE maxsize =
+ FontSize maxsize =
par.highestFontInRange(first, end, size);
- if (maxsize > font.size()) {
+ if (maxsize > font.fontInfo().size()) {
// use standard paragraph font with the maximal size
- Font maxfont = font;
+ FontInfo maxfont = font.fontInfo();
maxfont.setSize(maxsize);
FontMetrics const & maxfontmetrics = theFontMetrics(maxfont);
maxasc = max(maxasc, maxfontmetrics.maxAscent());
&& pit > 0 && pars[pit - 1].layout()->nextnoindent)
parindent.erase();
- Font const labelfont = text_->getLabelFont(buffer, par);
+ FontInfo const labelfont = text_->getLabelFont(buffer, par);
FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
switch (layout->margintype) {
// (if paragraph background was not cleared)
if (row_selection || (!pi.full_repaint && row_has_changed)) {
pi.pain.fillRectangle(x, y - rit->ascent(),
- width(), rit->height(),
- Color_color(Color::color(pi.background_color)));
+ width(), rit->height(), pi.background_color);
}
if (row_selection) {
DocIterator beg = bv_->cursor().selectionBegin();
if (middleTop < middleBottom) {
// draw middle rectangle
pi.pain.fillRectangle(x, middleTop, width(), middleBottom - middleTop,
- Color::selection);
+ Color_selection);
}
if (!clipBelow) {
// draw the margins
if (drawOnBegMargin) {
if (text_->isRTL(buffer, beg.paragraph()))
- pi.pain.fillRectangle(x + x1, y1, width() - x1, y2 - y1, Color::selection);
+ pi.pain.fillRectangle(x + x1, y1, width() - x1, y2 - y1, Color_selection);
else
- pi.pain.fillRectangle(x, y1, x1, y2 - y1, Color::selection);
+ pi.pain.fillRectangle(x, y1, x1, y2 - y1, Color_selection);
}
if (drawOnEndMargin) {
if (text_->isRTL(buffer, beg.paragraph()))
- pi.pain.fillRectangle(x, y1, x2, y2 - y1, Color::selection);
+ pi.pain.fillRectangle(x, y1, x2, y2 - y1, Color_selection);
else
- pi.pain.fillRectangle(x + x2, y1, width() - x2, y2 - y1, Color::selection);
+ pi.pain.fillRectangle(x + x2, y1, width() - x2, y2 - y1, Color_selection);
}
// if we are on a boundary from the beginning, it's probably
if (!(cur < end) || drawNow) {
x2 = cursorX(cur.top(), cur.boundary());
pi.pain.fillRectangle(x + min(x1,x2), y1, abs(x2 - x1), y2 - y1,
- Color::selection);
+ Color_selection);
// reset x1, so it is set again next round (which will be on the
// right side of a boundary or at the selection end)
int defaultRowHeight()
{
- return int(theFontMetrics(Font(Font::ALL_SANE)).maxHeight() * 1.2);
+ return int(theFontMetrics(sane_font).maxHeight() * 1.2);
}
} // namespace lyx