mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
RenderGraphic::metrics(): return early.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25164 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9d00e2ec0a
commit
21f59b816b
@ -135,34 +135,37 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
{
|
{
|
||||||
bool image_ready = displayGraphic(params_) && readyToDisplay(loader_);
|
bool image_ready = displayGraphic(params_) && readyToDisplay(loader_);
|
||||||
|
|
||||||
|
if (image_ready) {
|
||||||
|
dim.wid = loader_.image()->width() + 2 * Inset::TEXT_TO_INSET_OFFSET;
|
||||||
|
dim.asc = loader_.image()->height();
|
||||||
|
dim_ = dim;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dim.asc = image_ready ? loader_.image()->height() : 50;
|
dim.asc = image_ready ? loader_.image()->height() : 50;
|
||||||
dim.des = 0;
|
dim.des = 0;
|
||||||
|
|
||||||
if (image_ready) {
|
int font_width = 0;
|
||||||
dim.wid = loader_.image()->width() + 2 * Inset::TEXT_TO_INSET_OFFSET;
|
|
||||||
} else {
|
|
||||||
int font_width = 0;
|
|
||||||
|
|
||||||
FontInfo msgFont(mi.base.font);
|
FontInfo msgFont(mi.base.font);
|
||||||
msgFont.setFamily(SANS_FAMILY);
|
msgFont.setFamily(SANS_FAMILY);
|
||||||
|
|
||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
docstring const justname = from_utf8(params_.filename.onlyFileName());
|
docstring const justname = from_utf8(params_.filename.onlyFileName());
|
||||||
if (!justname.empty()) {
|
if (!justname.empty()) {
|
||||||
msgFont.setSize(FONT_SIZE_FOOTNOTE);
|
msgFont.setSize(FONT_SIZE_FOOTNOTE);
|
||||||
font_width = theFontMetrics(msgFont).width(justname);
|
font_width = theFontMetrics(msgFont).width(justname);
|
||||||
}
|
|
||||||
|
|
||||||
docstring const msg = statusMessage(params_, loader_.status());
|
|
||||||
if (!msg.empty()) {
|
|
||||||
msgFont.setSize(FONT_SIZE_TINY);
|
|
||||||
font_width = max(font_width,
|
|
||||||
theFontMetrics(msgFont).width(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
dim.wid = max(50, font_width + 15);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
docstring const msg = statusMessage(params_, loader_.status());
|
||||||
|
if (!msg.empty()) {
|
||||||
|
msgFont.setSize(FONT_SIZE_TINY);
|
||||||
|
font_width = max(font_width,
|
||||||
|
theFontMetrics(msgFont).width(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
dim.wid = max(50, font_width + 15);
|
||||||
|
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user