Add paper options when invoking dvipdfm.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1408 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-01-28 16:52:27 +00:00
parent 0a2b9f4b81
commit dd19aa6e63
3 changed files with 39 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2001-01-27 Dekel Tsur <dekelts@tau.ac.il>
* converter.C (dvipdfm_options): New method.
2001-01-26 Dekel Tsur <dekelts@tau.ac.il>
* vspace.C (isValidLength): Fix for empty input string.

View File

@ -173,7 +173,10 @@ bool Formats::View(Buffer const * buffer, string const & filename,
if (format_name == "dvi" &&
!lyxrc.view_dvi_paper_option.empty()) {
command += " " + lyxrc.view_dvi_paper_option;
command += " " + converters.dvi_papersize(buffer);
string paper_size = converters.papersize(buffer);
if (paper_size == "letter")
paper_size = "us";
command += " " + paper_size;
if (buffer->params.orientation
== BufferParams::ORIENTATION_LANDSCAPE)
command += 'r';
@ -606,6 +609,9 @@ bool Converters::Convert(Buffer const * buffer,
if (conv.from == "dvi" && conv.to == "ps")
command = add_options(command,
dvips_options(buffer));
else if (conv.from == "dvi" && prefixIs(conv.to, "pdf"))
command = add_options(command,
dvipdfm_options(buffer));
lyxerr << "Calling " << command << endl;
if (buffer)
@ -872,7 +878,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
}
string const Converters::dvi_papersize(Buffer const * buffer)
string const Converters::papersize(Buffer const * buffer)
{
char real_papersize = buffer->params.papersize;
if (real_papersize == BufferParams::PAPER_DEFAULT)
@ -893,7 +899,7 @@ string const Converters::dvi_papersize(Buffer const * buffer)
return "legal";
case BufferParams::PAPER_USLETTER:
default:
return "us";
return "letter";
}
}
@ -914,9 +920,7 @@ string const Converters::dvips_options(Buffer const * buffer)
result += ' ' + buffer->params.paperwidth;
result += ',' + buffer->params.paperheight;
} else {
string paper_option = dvi_papersize(buffer);
if (paper_option == "us")
paper_option = "letter";
string paper_option = papersize(buffer);
if (paper_option != "letter" ||
buffer->params.orientation != BufferParams::ORIENTATION_LANDSCAPE) {
// dvips won't accept -t letter -t landscape. In all other
@ -925,11 +929,32 @@ string const Converters::dvips_options(Buffer const * buffer)
result += ' ' + paper_option;
}
}
if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE &&
buffer->params.papersize2 != BufferParams::VM_PAPER_CUSTOM)
result += ' ' + lyxrc.print_landscape_flag;
return result;
}
string const Converters::dvipdfm_options(Buffer const * buffer)
{
string result;
if (!buffer)
return result;
if (buffer->params.papersize2 != BufferParams::VM_PAPER_CUSTOM) {
string paper_size = papersize(buffer);
if (paper_size != "b5" && paper_size != "foolscap")
result = "-p "+ paper_size;
if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
result += " -l";
}
return result;
}
vector<Converters::Vertex> Converters::vertices;

View File

@ -215,10 +215,12 @@ public:
string const & from_file, string const & to_file_base,
string const & from_format, string const & to_format);
///
string const dvi_papersize(Buffer const * buffer);
string const papersize(Buffer const * buffer);
///
string const dvips_options(Buffer const * buffer);
///
string const dvipdfm_options(Buffer const * buffer);
///
void Update(Formats const & formats);
///
void UpdateLast(Formats const & formats);