mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
DocBook: remove special options from InsetGraphics.cpp
This was not really a useful attribute for DocBook, or it must be parsed beforehand.
This commit is contained in:
parent
91d442d505
commit
1766bff806
@ -450,56 +450,56 @@ docstring InsetGraphics::toDocbookLength(Length const & len) const
|
|||||||
{
|
{
|
||||||
odocstringstream result;
|
odocstringstream result;
|
||||||
switch (len.unit()) {
|
switch (len.unit()) {
|
||||||
case Length::SP: // Scaled point (65536sp = 1pt) TeX's smallest unit.
|
case Length::SP: // Scaled point (65536sp = 1pt) TeX's smallest unit.
|
||||||
result << len.value() * 65536.0 * 72 / 72.27 << "pt";
|
result << len.value() * 65536.0 * 72 / 72.27 << "pt";
|
||||||
break;
|
break;
|
||||||
case Length::PT: // Point = 1/72.27in = 0.351mm
|
case Length::PT: // Point = 1/72.27in = 0.351mm
|
||||||
result << len.value() * 72 / 72.27 << "pt";
|
result << len.value() * 72 / 72.27 << "pt";
|
||||||
break;
|
break;
|
||||||
case Length::BP: // Big point (72bp = 1in), also PostScript point
|
case Length::BP: // Big point (72bp = 1in), also PostScript point
|
||||||
result << len.value() << "pt";
|
result << len.value() << "pt";
|
||||||
break;
|
break;
|
||||||
case Length::DD: // Didot point = 1/72 of a French inch, = 0.376mm
|
case Length::DD: // Didot point = 1/72 of a French inch, = 0.376mm
|
||||||
result << len.value() * 0.376 << "mm";
|
result << len.value() * 0.376 << "mm";
|
||||||
break;
|
break;
|
||||||
case Length::MM: // Millimeter = 2.845pt
|
case Length::MM: // Millimeter = 2.845pt
|
||||||
result << len.value() << "mm";
|
result << len.value() << "mm";
|
||||||
break;
|
break;
|
||||||
case Length::PC: // Pica = 12pt = 4.218mm
|
case Length::PC: // Pica = 12pt = 4.218mm
|
||||||
result << len.value() << "pc";
|
result << len.value() << "pc";
|
||||||
break;
|
break;
|
||||||
case Length::CC: // Cicero = 12dd = 4.531mm
|
case Length::CC: // Cicero = 12dd = 4.531mm
|
||||||
result << len.value() * 4.531 << "mm";
|
result << len.value() * 4.531 << "mm";
|
||||||
break;
|
break;
|
||||||
case Length::CM: // Centimeter = 10mm = 2.371pc
|
case Length::CM: // Centimeter = 10mm = 2.371pc
|
||||||
result << len.value() << "cm";
|
result << len.value() << "cm";
|
||||||
break;
|
break;
|
||||||
case Length::IN: // Inch = 25.4mm = 72.27pt = 6.022pc
|
case Length::IN: // Inch = 25.4mm = 72.27pt = 6.022pc
|
||||||
result << len.value() << "in";
|
result << len.value() << "in";
|
||||||
break;
|
break;
|
||||||
case Length::EX: // Height of a small "x" for the current font.
|
case Length::EX: // Height of a small "x" for the current font.
|
||||||
// Obviously we have to compromise here. Any better ratio than 1.5 ?
|
// Obviously we have to compromise here. Any better ratio than 1.5 ?
|
||||||
result << len.value() / 1.5 << "em";
|
result << len.value() / 1.5 << "em";
|
||||||
break;
|
break;
|
||||||
case Length::EM: // Width of capital "M" in current font.
|
case Length::EM: // Width of capital "M" in current font.
|
||||||
result << len.value() << "em";
|
result << len.value() << "em";
|
||||||
break;
|
break;
|
||||||
case Length::MU: // Math unit (18mu = 1em) for positioning in math mode
|
case Length::MU: // Math unit (18mu = 1em) for positioning in math mode
|
||||||
result << len.value() * 18 << "em";
|
result << len.value() * 18 << "em";
|
||||||
break;
|
break;
|
||||||
case Length::PTW: // Percent of TextWidth
|
case Length::PTW: // Percent of TextWidth
|
||||||
case Length::PCW: // Percent of ColumnWidth
|
case Length::PCW: // Percent of ColumnWidth
|
||||||
case Length::PPW: // Percent of PageWidth
|
case Length::PPW: // Percent of PageWidth
|
||||||
case Length::PLW: // Percent of LineWidth
|
case Length::PLW: // Percent of LineWidth
|
||||||
case Length::PTH: // Percent of TextHeight
|
case Length::PTH: // Percent of TextHeight
|
||||||
case Length::PPH: // Percent of PaperHeight
|
case Length::PPH: // Percent of PaperHeight
|
||||||
case Length::BLS: // Percent of BaselineSkip
|
case Length::BLS: // Percent of BaselineSkip
|
||||||
// Sigh, this will go wrong.
|
// Sigh, this will go wrong.
|
||||||
result << len.value() << "%";
|
result << len.value() << "%";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result << len.asDocstring();
|
result << len.asDocstring();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
@ -511,27 +511,23 @@ docstring InsetGraphics::createDocBookAttributes() const
|
|||||||
// stream since we copied the code from createLatexParams() ;-)
|
// stream since we copied the code from createLatexParams() ;-)
|
||||||
|
|
||||||
odocstringstream options;
|
odocstringstream options;
|
||||||
double const scl = convert<double>(params().scale);
|
auto const scl = convert<double>(params().scale);
|
||||||
if (!params().scale.empty() && !float_equal(scl, 0.0, 0.05)) {
|
if (!params().scale.empty() && !float_equal(scl, 0.0, 0.05)) {
|
||||||
if (!float_equal(scl, 100.0, 0.05))
|
if (!float_equal(scl, 100.0, 0.05))
|
||||||
options << " scale=\""
|
options << " scale=\""
|
||||||
<< support::iround(scl)
|
<< support::iround(scl)
|
||||||
<< "\" ";
|
<< "\" ";
|
||||||
} else {
|
} else {
|
||||||
if (!params().width.zero()) {
|
if (!params().width.zero())
|
||||||
options << " width=\"" << toDocbookLength(params().width) << "\" ";
|
options << " width=\"" << toDocbookLength(params().width) << "\" ";
|
||||||
}
|
if (!params().height.zero())
|
||||||
if (!params().height.zero()) {
|
|
||||||
options << " depth=\"" << toDocbookLength(params().height) << "\" ";
|
options << " depth=\"" << toDocbookLength(params().height) << "\" ";
|
||||||
}
|
if (params().keepAspectRatio)
|
||||||
if (params().keepAspectRatio) {
|
|
||||||
// This will be irrelevant unless both width and height are set
|
// This will be irrelevant unless both width and height are set
|
||||||
options << "scalefit=\"1\" ";
|
options << "scalefit=\"1\" ";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params().special.empty())
|
// TODO: parse params().special?
|
||||||
options << from_ascii(params().special) << " ";
|
|
||||||
|
|
||||||
// trailing blanks are ok ...
|
// trailing blanks are ok ...
|
||||||
return options.str();
|
return options.str();
|
||||||
|
Loading…
Reference in New Issue
Block a user