moalhaddar commented on code in PR #536:
URL: https://github.com/apache/poi/pull/536#discussion_r1359369096


##########
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java:
##########
@@ -905,10 +1006,28 @@ public void setFontSize(int size) {
      */
     @Override
     public void setFontSize(double size) {
-        BigDecimal bd = BigDecimal.valueOf(size);
+        setFontSize(size, ScriptType.NON_COMPLEX);
+    }
+
+    /**
+     * Whether the font size property shall be applied to the specified script 
type.
+     *
+     * @param size The font size as number of point measurements.
+     * @param scriptType the script type to apply this property to.
+     */
+    public void setFontSize(double size, ScriptType scriptType) {
         CTRPr pr = getRunProperties(true);
-        CTHpsMeasure ctSize = pr.sizeOfSzArray() > 0 ? pr.getSzArray(0) : 
pr.addNewSz();
-        ctSize.setVal(bd.multiply(BigDecimal.valueOf(2)).setScale(0, 
RoundingMode.HALF_UP).toBigInteger());
+        BigDecimal bd = BigDecimal.valueOf(size);
+        BigInteger val = bd.multiply(BigDecimal.valueOf(2)).setScale(0, 
RoundingMode.HALF_UP).toBigInteger();
+        boolean isComplexScript = scriptType == ScriptType.COMPLEX;
+
+        if (isComplexScript) {
+            CTHpsMeasure ctCsSize = pr.sizeOfSzCsArray() > 0 ? 
pr.getSzCsArray(0) : pr.addNewSzCs();

Review Comment:
   The current behavior of POI does exactly this for the regular fonts. So i 
repeated the implementation with the complex scripts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to