@@ -482,6 +482,7 @@ fn finalize_shape(
482482 text_box_padding : Insets ,
483483 text_box_vertical_align : TextBoxVerticalAlign ,
484484 text_box_no_wrap : bool ,
485+ text_box_auto_fit : bool ,
485486) -> Vec < FixedElement > {
486487 // Resolve effective fill: explicit > noFill > style fallback.
487488 let effective_fill: Option < Color > = if shape. fill . is_some ( ) {
@@ -559,6 +560,7 @@ fn finalize_shape(
559560 stroke : None ,
560561 shape_kind : None ,
561562 no_wrap : text_box_no_wrap,
563+ auto_fit : text_box_auto_fit,
562564 } ) ,
563565 } ) ;
564566 } else {
@@ -577,6 +579,7 @@ fn finalize_shape(
577579 stroke,
578580 shape_kind : None ,
579581 no_wrap : text_box_no_wrap,
582+ auto_fit : text_box_auto_fit,
580583 } ) ,
581584 } ) ;
582585 }
@@ -724,6 +727,7 @@ struct SlideXmlParser<'a> {
724727 text_box_padding : Insets ,
725728 text_box_vertical_align : TextBoxVerticalAlign ,
726729 text_box_no_wrap : bool ,
730+ text_box_auto_fit : bool ,
727731 text_body_style_defaults : PptxTextBodyStyleDefaults ,
728732
729733 // ── Paragraph state (`<a:p>`) ───────────────────────────────────
@@ -745,6 +749,7 @@ struct SlideXmlParser<'a> {
745749 in_text : bool ,
746750 in_rpr : bool ,
747751 in_end_para_rpr : bool ,
752+ in_text_line : bool ,
748753 solid_fill_ctx : SolidFillCtx ,
749754 /// Inside `<a:lnRef>` within `<p:style>` — for resolving fallback line color.
750755 in_style_ln_ref : bool ,
@@ -794,6 +799,7 @@ impl<'a> SlideXmlParser<'a> {
794799 text_box_padding : default_pptx_text_box_padding ( ) ,
795800 text_box_vertical_align : TextBoxVerticalAlign :: Top ,
796801 text_box_no_wrap : false ,
802+ text_box_auto_fit : false ,
797803 text_body_style_defaults : PptxTextBodyStyleDefaults :: default ( ) ,
798804
799805 in_para : false ,
@@ -812,6 +818,7 @@ impl<'a> SlideXmlParser<'a> {
812818 in_text : false ,
813819 in_rpr : false ,
814820 in_end_para_rpr : false ,
821+ in_text_line : false ,
815822 solid_fill_ctx : SolidFillCtx :: None ,
816823 in_style_ln_ref : false ,
817824 in_style_fill_ref : false ,
@@ -878,6 +885,7 @@ impl<'a> SlideXmlParser<'a> {
878885 self . text_box_padding = default_pptx_text_box_padding ( ) ;
879886 self . text_box_vertical_align = TextBoxVerticalAlign :: Top ;
880887 self . text_box_no_wrap = false ;
888+ self . text_box_auto_fit = false ;
881889 }
882890 b"sp" | b"cxnSp" if self . in_shape => {
883891 self . shape . depth += 1 ;
@@ -966,6 +974,9 @@ impl<'a> SlideXmlParser<'a> {
966974 & mut self . text_box_no_wrap ,
967975 ) ;
968976 }
977+ b"spAutoFit" | b"normAutofit" if self . in_shape && self . in_txbody => {
978+ self . text_box_auto_fit = true ;
979+ }
969980 b"lstStyle" if self . in_shape && self . in_txbody => {
970981 let local_defaults = parse_pptx_list_style ( reader, self . theme , self . color_map ) ;
971982 self . text_body_style_defaults . merge_from ( & local_defaults) ;
@@ -1068,10 +1079,13 @@ impl<'a> SlideXmlParser<'a> {
10681079 self . para_end_run_style = self . para_default_run_style . clone ( ) ;
10691080 extract_rpr_attributes ( e, & mut self . para_end_run_style ) ;
10701081 }
1071- b"solidFill" if self . in_rpr => {
1082+ b"ln" if self . in_rpr || self . in_end_para_rpr => {
1083+ self . in_text_line = true ;
1084+ }
1085+ b"solidFill" if self . in_rpr && !self . in_text_line => {
10721086 self . solid_fill_ctx = SolidFillCtx :: RunFill ;
10731087 }
1074- b"solidFill" if self . in_end_para_rpr => {
1088+ b"solidFill" if self . in_end_para_rpr && ! self . in_text_line => {
10751089 self . solid_fill_ctx = SolidFillCtx :: EndParaFill ;
10761090 }
10771091 b"srgbClr" | b"schemeClr" | b"sysClr" if self . solid_fill_ctx != SolidFillCtx :: None => {
@@ -1205,6 +1219,9 @@ impl<'a> SlideXmlParser<'a> {
12051219 & mut self . text_box_no_wrap ,
12061220 ) ;
12071221 }
1222+ b"spAutoFit" | b"normAutofit" if self . in_shape && self . in_txbody => {
1223+ self . text_box_auto_fit = true ;
1224+ }
12081225 b"prstGeom" if self . shape . in_sp_pr => {
12091226 if let Some ( prst) = get_attr_str ( e, b"prst" ) {
12101227 self . shape . prst_geom = Some ( prst) ;
@@ -1273,6 +1290,9 @@ impl<'a> SlideXmlParser<'a> {
12731290 self . para_end_run_style = self . para_default_run_style . clone ( ) ;
12741291 extract_rpr_attributes ( e, & mut self . para_end_run_style ) ;
12751292 }
1293+ b"ln" if self . in_rpr || self . in_end_para_rpr => {
1294+ self . in_text_line = true ;
1295+ }
12761296 b"pPr" if self . in_para && !self . in_run => {
12771297 self . para_level = extract_paragraph_level ( e) ;
12781298 self . para_style = self
@@ -1375,6 +1395,7 @@ impl<'a> SlideXmlParser<'a> {
13751395 self . text_box_padding ,
13761396 self . text_box_vertical_align ,
13771397 self . text_box_no_wrap ,
1398+ self . text_box_auto_fit ,
13781399 ) ) ;
13791400 }
13801401 self . in_shape = false ;
@@ -1430,6 +1451,9 @@ impl<'a> SlideXmlParser<'a> {
14301451 b"endParaRPr" if self . in_end_para_rpr => {
14311452 self . in_end_para_rpr = false ;
14321453 }
1454+ b"ln" if self . in_text_line => {
1455+ self . in_text_line = false ;
1456+ }
14331457 b"lnSpc" if self . in_ln_spc => {
14341458 self . in_ln_spc = false ;
14351459 }
0 commit comments