From 911105f298bdd8568253f01c0f3f8160bd572329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Tue, 29 Apr 2008 22:39:55 +0000 Subject: [PATCH] - tex2lyx/text.cpp: correct font size handling also for branch, fixes bug 4807 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@24558 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/text.cpp | 26 ++++++++++++++++++++++++-- status.15x | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index beb7dd991e..3123349958 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1539,23 +1539,45 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, eat_whitespace(p, os, context, true); } + // Starred section headings // Must attempt to parse "Section*" before "Section". else if ((p.next_token().asInput() == "*") && context.new_layout_allowed && - // The single '=' is meant here. (newlayout = findLayout(context.textclass, t.cs() + '*')).get() && newlayout->isCommand()) { + TeXFont const oldFont = context.font; + // save the current font size + string const size = oldFont.size; + // reset the font size to default, because the font size switches don't + // affect section headings and the like + context.font.size = known_coded_sizes[0]; + output_font_change(os, oldFont, context.font); + // write the layout p.get_token(); output_command_layout(os, p, outer, context, newlayout); + // set the font size to the original value + context.font.size = size; + output_font_change(os, oldFont, context.font); p.skip_spaces(); } - // The single '=' is meant here. + // Section headings and the like else if (context.new_layout_allowed && (newlayout = findLayout(context.textclass, t.cs())).get() && newlayout->isCommand()) { + TeXFont const oldFont = context.font; + // save the current font size + string const size = oldFont.size; + // reset the font size to default, because the font size switches don't + // affect section headings and the like + context.font.size = known_coded_sizes[0]; + output_font_change(os, oldFont, context.font); + // write the layout output_command_layout(os, p, outer, context, newlayout); + // set the font size to the original value + context.font.size = size; + output_font_change(os, oldFont, context.font); p.skip_spaces(); } diff --git a/status.15x b/status.15x index 48693bc60f..e9cbd2f93f 100644 --- a/status.15x +++ b/status.15x @@ -127,7 +127,7 @@ What's new - Import global paragraph settings correctly when importing LaTeX files (bug 4773). -- Fix the font size handling when importing LaTeX files (bug 4803). +- Fix font size handling when importing LaTeX files (bug 4803 and bug 4807). * USER INTERFACE: