When I mix a math portion with a regular text portion in a paragraph, the text frame containing the paragraph does not reshape correctly with TextAutofitType.Shape. The result frame is very small and the text is barely visible. Removing the MathPortion or changing to autofit type would result in a better looking slide.
Did I do something wrong. Here is my code demonstrating the problem.
public void test() throws IOException {
// temp file directory
String tmpdir = System.getProperty("java.io.tmpdir");
Files.createDirectories(Paths.get(tmpdir + "/test"));
// new presentation
Presentation presentation = new Presentation();
ISlideCollection slides = presentation.getSlides();
// get the default slide
ISlide slide = slides.get_Item(0);
// add a rectangle
IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 100, 600, 400);
// add a new paragraph
Paragraph paragraph = new Paragraph();
autoShape.getTextFrame().getParagraphs().add(paragraph);
// add some text to the paragraph via a portion
Portion portion = new Portion();
paragraph.getPortions().add(portion);
portion.setText("test-------");
// add math text to the paragraph via a math portion
MathPortion mathPortion = new MathPortion();
paragraph.getPortions().add(mathPortion);
MathBlock mathBlock = new MathBlock();
mathPortion.getMathParagraph().add(mathBlock);
mathBlock.add(new MathematicalText("abc"));
// reshape the rectangle
autoShape.getTextFrame().getTextFrameFormat().setAutofitType(TextAutofitType.Shape);
presentation.save(tmpdir + "/test/test.pptx", SaveFormat.Pptx);
}