How to get the font styling of the placeholder text (Java)

Hi Team
I am trying to read the font size, font family, isBold, isItalic property of the text. I observe text which is present inside the placeholder for that it’s not giving the right value.
Here is the code
`
JSONArray placeholder = new JSONArray();

	for(IShape ishape : iLayoutSlide.getShapes().toArray()) {
		JSONObject shapeData = new JSONObject();

		if(ishape instanceof AutoShape) {
			IAutoShape ishape2 = (IAutoShape) ishape;
			String shapeText = ishape2.getTextFrame().getText().toLowerCase();
			System.out.println("readPrimarySubMaster " + shapeText);
			
			if(Pattern.matches(PRESENTATION_TITLE, shapeText) || Pattern.matches(CUSTOMER, shapeText) || Pattern.matches(PRESENTER_NAME, shapeText) || Pattern.matches(PRESENTATION_DATE, shapeText)) {
				System.out.println("pattern match");
				shapeData.put("name", ishape2.getTextFrame().getText());
				shapeData.put("type", ishape2.getShapeType());
				shapeData.put("inputType", Pattern.matches(PRESENTATION_DATE, shapeText) ? "date": "text");
				shapeData.put("label", Pattern.matches(PRESENTATION_TITLE, shapeText) ? "Title": Pattern.matches(CUSTOMER, shapeText) ? "Customer Name"
						: Pattern.matches(PRESENTATION_DATE, shapeText) ? "Presentation Date" : "Presenter Name");
				shapeData.put("height", Math.round(ishape.getHeight()* 100.0) / 100.0);
				shapeData.put("width", Math.round(ishape.getWidth() * 100.0) / 100.0);
				shapeData.put("x", Math.round(ishape.getX()* 100.0) / 100.0);
				shapeData.put("y", Math.round(ishape.getY()* 100.0) / 100.0);							

				JSONObject font = new JSONObject();
				IPortionCollection portion = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions();

				if(portion.getCount() > 0) {
					int blue = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
							.getPortionFormat().getFillFormat().getSolidFillColor().getColor().getBlue();
					int green = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
							.getPortionFormat().getFillFormat().getSolidFillColor().getColor().getGreen();
					int red = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
							.getPortionFormat().getFillFormat().getSolidFillColor().getColor().getRed();
					String color = red + "," + green + "," + blue;
					
					float fontSize = Math.round(ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFontHeight());

					boolean fontBold = false;
					if (ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFontBold() == (byte)1)
						fontBold = true;

					boolean fontItalic = false;
					if (ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFontItalic() == (byte)1)
						fontItalic = true;

					JSONObject style = new JSONObject();
					style.put("bold", fontBold);
					style.put("italic", fontItalic);

					font.put("style", style);
					font.put("color", color);
					font.put("size", fontSize);
				}
				shapeData.put("font", font);
				System.out.println("Shape data: " + shapeData.toString());
				placeholder.put(shapeData);
			}
		}
	}
	System.out.println("themeData: " + placeholder);
	layoutMetaData.put("themeData", placeholder);

`

The sample pptx on which I try to fetch the font styling is here placeholderFontRead.zip (140.2 KB)

The result which I fond for this here: resultOutput.zip (483 Bytes)

@Shree995,

I have observed the issue shared by you and request you to please try using getEffective() method available in getPortionFormat() to extract the missing height, text and height information. Actually, your text is inheriting styling from theme. Therefore, you need to use following alternate code in your application. Please share, if there is still an issue.

    int blue = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
                    .getPortionFormat().getEffective().getFillFormat().getSolidFillColor().getColor().getBlue();
    int green = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
                    .getPortionFormat().getEffective().getFillFormat().getSolidFillColor().getColor().getGreen();
    int red = ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)
                    .getPortionFormat().getEffective().getFillFormat().getSolidFillColor().getColor().getRed();
    String color = red + "," + green + "," + blue;

    float fontSize = Math.round(ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getEffective().getFontHeight());

    boolean fontBold = false;
    if (ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getEffective().getFontBold() == (byte)1)
            fontBold = true;

    boolean fontItalic = false;
    if (ishape2.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getEffective().getFontItalic() == (byte)1)
            fontItalic = true;

@mudassir.fayyaz Thanks. It’s solved my issue.

@Shree995,

Thank you for your feedback.