fix/bug69510

fix bug #69510
This commit is contained in:
Timofey Derevyankin
2025-12-01 18:57:08 +03:00
parent 3ef5651dfd
commit c488384dbc
3 changed files with 9 additions and 37 deletions

View File

@ -271,7 +271,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
}
if( Context.get_drop_cap_context().Space > 0 )
{
CP_XML_ATTR(L"w:hSpace", Context.get_drop_cap_context().Space-100);
CP_XML_ATTR(L"w:hSpace", Context.get_drop_cap_context().Space);
}
CP_XML_ATTR(L"w:wrap", L"around");
CP_XML_ATTR(L"w:hAnchor", L"text");
@ -281,21 +281,14 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
CP_XML_NODE(L"w:spacing")
{
CP_XML_ATTR(L"w:after", 0);
if ( Context.get_inside_frame() )
{
if ( Context.get_drop_cap_context().Scale < 5 )
{
CP_XML_ATTR(L"w:line", 240 * ( Context.get_drop_cap_context().Scale ));
}
else
{
CP_XML_ATTR(L"w:line", 270 * ( Context.get_drop_cap_context().Scale ) + ( Context.get_drop_cap_context().Scale - 2 ) * 113);
}
}
else if (Context.get_drop_cap_context().FontSize > 0)
if (Context.get_drop_cap_context().FontSize > 0)
{
CP_XML_ATTR(L"w:line", Context.get_drop_cap_context().FontSize);
}
else if ( Context.get_inside_frame() && Context.get_drop_cap_context().Scale < 5 )
{
CP_XML_ATTR(L"w:line", 240 * ( Context.get_drop_cap_context().Scale ));
}
else
{
CP_XML_ATTR(L"w:line", 240);
@ -303,26 +296,6 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
CP_XML_ATTR(L"w:lineRule", L"exact");
}
CP_XML_NODE(L"w:textAlignment"){CP_XML_ATTR(L"w:val", L"baseline");}
if( Context.get_inside_frame() && Context.get_drop_cap_context().Scale >= 5 )
{
int fontSize = 0;
if( Context.get_current_fontSize() > 0 )
{
fontSize = static_cast<int>(Context.get_current_fontSize());
}
else
{
fontSize = 24;
}
if( fontSize > 0 )
{
const int scale = Context.get_drop_cap_context().Scale;
const int pos = -10;
_rPr << L"<w:position w:val=\"" << std::to_wstring(pos) << "\" />";
_rPr << L"<w:sz w:val=\"" << fontSize * scale + ( scale < 5 ? 0: 8 * (scale - 1) ) << "\"/>";
}
}
}
if (Context.get_page_break_before() == 2)

View File

@ -1347,9 +1347,8 @@ void text_format_properties::docx_convert(oox::docx_conversion_context & Context
{
fontSize = process_font_size(fo_font_size_, Context.get_styles_context().get_current_processed_style(),false,
Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7);//вместо 1 ДОЛЖНОБЫТЬ коэфф. межстрочного интервала!!!
if (fontSize < 1)
fontSize = (int)(Context.get_drop_cap_context().FontSize / 7.52);
fontSize = (int)(Context.get_drop_cap_context().FontSize / 10.0);
}
else
{
@ -1380,7 +1379,7 @@ void text_format_properties::docx_convert(oox::docx_conversion_context & Context
{
needProcessFontSize = false;
const int scale = Context.get_drop_cap_context().Scale == 1 ? Context.get_scale() : Context.get_drop_cap_context().Scale;
_rPr << L"<w:sz w:val=\"" << fontSize * scale + ( scale < 5 ? 0: 8 * (scale - 1) ) << "\"/>";
_rPr << L"<w:sz w:val=\"" << fontSize * scale << "\"/>";
Context.set_inside_frame(false);
}
}

View File

@ -91,7 +91,7 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con
Context.get_drop_cap_context().Scale = style_drop_cap_->style_lines_;
if (style_drop_cap_->style_distance_)
Context.get_drop_cap_context().Space = (int)(20.0 * (style_drop_cap_->style_distance_->get_value_unit(length::pt) + 5)+ 0.5);//формула ачуметь !! - подбор вручную
Context.get_drop_cap_context().Space = (int)(20.0 * (style_drop_cap_->style_distance_->get_value_unit(length::pt) ) );//формула ачуметь !! - подбор вручную
//font size пощитаем здесь .. так как его значение нужо в стиле параграфа (межстрочный интервал) - в (pt*20)