diff --git a/development/FORMAT b/development/FORMAT index c253117c72..b56bdc510c 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,9 @@ LyX file-format changes ----------------------- +2008-06-04 Jürgen Spitzmüller + * Format incremented to 336: new param \font_cjk. + 2008-05-30 Richard Heck * Format incremented to 335: fixes for InsetSpace problems. diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 3fda0029fb..00dbfefa90 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -2500,6 +2500,13 @@ def revert_InsetSpace(document): document.body[i] = document.body[i].replace('\\begin_inset space', '\\begin_inset Space') +def remove_fontsCJK(document): + ' Remove font_cjk param ' + i = find_token(document.header, "\\font_cjk", 0) + if i != -1: + del document.header[i] + + def convert_plain_layout(document): " Convert 'PlainLayout' to 'Plain Layout'" i = 0 @@ -2602,9 +2609,11 @@ convert = [[277, [fix_wrong_tables]], [333, [update_apa_styles]], [334, [convert_paper_sizes]], [335, [convert_InsetSpace]], + [336, []], ] -revert = [[334, [revert_InsetSpace]], +revert = [[335, [remove_fontsCJK]], + [334, [revert_InsetSpace]], [333, [revert_paper_sizes]], [332, []], [331, [revert_graphics_group]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index ccba24493d..632826fbc6 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -115,7 +115,7 @@ namespace os = support::os; namespace { -int const LYX_FORMAT = 335; +int const LYX_FORMAT = 336; typedef map DepClean; typedef map > RefCache; @@ -459,6 +459,7 @@ int Buffer::readHeader(Lexer & lex) params().headsep.erase(); params().footskip.erase(); params().columnsep.erase(); + params().fontsCJK.erase(); params().listings_params.clear(); params().clearLayoutModules(); params().pdfoptions().clear(); diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index b276c95a60..8df7ace37f 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -522,6 +522,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, lex >> fontsSansScale; } else if (token == "\\font_tt_scale") { lex >> fontsTypewriterScale; + } else if (token == "\\font_cjk") { + lex >> fontsCJK; } else if (token == "\\paragraph_separation") { string parsep; lex >> parsep; @@ -727,7 +729,11 @@ void BufferParams::writeFile(ostream & os) const << "\n\\font_osf " << convert(fontsOSF) << "\n\\font_sf_scale " << fontsSansScale << "\n\\font_tt_scale " << fontsTypewriterScale - << "\n\\graphics " << graphicsDriver << '\n'; + << '\n'; + if (!fontsCJK.empty()) { + os << "\\font_cjk " << fontsCJK << '\n'; + } + os << "\n\\graphics " << graphicsDriver << '\n'; if (!float_placement.empty()) { os << "\\float_placement " << float_placement << '\n'; diff --git a/src/BufferParams.h b/src/BufferParams.h index dae8c4e3b2..fe85a3dab8 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -185,6 +185,8 @@ public: int fontsSansScale; /// the scale factor of the tt font int fontsTypewriterScale; + /// the font used by the CJK command + std::string fontsCJK; /// Spacing & spacing(); Spacing const & spacing() const; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index e678a8170b..9cbaec7436 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -605,6 +605,8 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(change_adaptor())); connect(fontModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); + connect(fontModule->cjkFontLE, SIGNAL(textChanged(const QString &)), + this, SLOT(change_adaptor())); connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)), @@ -1647,6 +1649,9 @@ void GuiDocument::apply(BufferParams & params) params.fontsTypewriter = tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()]; + params.fontsCJK = + fromqstr(fontModule->cjkFontLE->text()); + params.fontsSansScale = fontModule->scaleSansSB->value(); params.fontsTypewriterScale = fontModule->scaleTypewriterSB->value(); @@ -1945,6 +1950,12 @@ void GuiDocument::paramsToDialog(BufferParams const & params) ttChanged(n); } + if (!params.fontsCJK.empty()) + fontModule->cjkFontLE->setText( + toqstr(params.fontsCJK)); + else + fontModule->cjkFontLE->setText(QString()); + fontModule->fontScCB->setChecked(params.fontsSC); fontModule->fontOsfCB->setChecked(params.fontsOSF); fontModule->scaleSansSB->setValue(params.fontsSansScale); diff --git a/src/frontends/qt4/ui/FontUi.ui b/src/frontends/qt4/ui/FontUi.ui index 64ac16e8bd..20d12b553e 100644 --- a/src/frontends/qt4/ui/FontUi.ui +++ b/src/frontends/qt4/ui/FontUi.ui @@ -5,8 +5,8 @@ 0 0 - 409 - 232 + 414 + 268 @@ -19,7 +19,7 @@ 6 - + Qt::Vertical @@ -30,100 +30,92 @@ 391 - 21 + 16 - + + + + C&JK: + + + cjkFontLE + + + + + + + Input the font to be used for Chinese, Japanese or Korean (CJK) script + + + + Qt::Horizontal - 131 + 151 20 - - - - 200 + + + + Use old style instead of lining figures - - 10 + + Use &Old Style Figures - - + + + + Use a real small caps shape, if the font provides one + - Sc&ale (%): + Use true S&mall Caps + + + + + + + Select the default family for the document + + + + + + + &Base Size: - scaleTypewriterSB + fontsizeCO - - + + + + + + - - + + - &Typewriter: + &Default Family: - fontsTypewriterCO - - - - - - - - - - &Roman: - - - fontsRomanCO - - - - - - - 200 - - - 10 - - - - - - - S&cale (%): - - - scaleSansSB - - - - - - - - - - &Sans Serif: - - - fontsSansCO + fontsDefaultCO @@ -140,45 +132,115 @@ - - + + - Use &Old Style Figures - - - - - - - Use true S&mall Caps - - - - - - - &Default Family: + &Sans Serif: - fontsDefaultCO + fontsSansCO - - + + + + Select the Sans Serif (grotesque) typeface + + - - + + - &Base Size: + S&cale (%): - fontsizeCO + scaleSansSB - - + + + + Scale the Sans Serif font to match the base font's dimensions + + + 200 + + + 10 + + + + + + + &Roman: + + + fontsRomanCO + + + + + + + Select the roman (serif) typeface + + + + + + + &Typewriter: + + + fontsTypewriterCO + + + + + + + Select the typewriter (monospaced) typeface + + + + + + + Sc&ale (%): + + + scaleTypewriterSB + + + + + + + Scale the Typewriter font to match the base font's dimensions + + + 200 + + + 10 + + + + + + + Qt::Horizontal + + + + 131 + 20 + + + diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 2166425f07..da12b20012 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -183,7 +183,7 @@ TeXEnvironment(Buffer const & buf, if (par_language->encoding()->package() == Encoding::CJK && open_encoding_ != CJK && pit->isMultiLingual(bparams)) { os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName()) - << "}{}%\n"; + << "}{" << from_ascii(bparams.fontsCJK) << "}%\n"; open_encoding_ = CJK; cjk_nested = true; texrow.newline(); @@ -453,7 +453,7 @@ TeXOnePar(Buffer const & buf, if (par_language->encoding()->package() == Encoding::CJK && open_encoding_ != CJK && cjk_inherited_ == 0) { os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName()) - << "}{}%\n"; + << "}{" << from_ascii(bparams.fontsCJK) << "}%\n"; open_encoding_ = CJK; texrow.newline(); } @@ -760,7 +760,7 @@ void latexParagraphs(Buffer const & buf, // if the document's language is a CJK language if (maintext && bparams.encoding().package() == Encoding::CJK) { os << "\\begin{CJK}{" << from_ascii(bparams.encoding().latexName()) - << "}{}%\n"; + << "}{" << from_ascii(bparams.fontsCJK) << "}%\n"; texrow.newline(); open_encoding_ = CJK; } @@ -937,7 +937,8 @@ pair switchEncoding(odocstream & os, BufferParams const & bparams, os << "\\egroup"; count += 7; } - os << "\\begin{CJK}{" << inputenc_arg << "}{}"; + os << "\\begin{CJK}{" << inputenc_arg << "}{" + << from_ascii(bparams.fontsCJK) << "}"; open_encoding_ = CJK; return make_pair(true, count + 15); }