You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2020/12/17 10:02:19 UTC

[Bug 64999] New: XDDFRunProperties setFonts font override

https://bz.apache.org/bugzilla/show_bug.cgi?id=64999

            Bug ID: 64999
           Summary: XDDFRunProperties setFonts font override
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XDDF
          Assignee: dev@poi.apache.org
          Reporter: fanziang78@gmail.com
  Target Milestone: ---

public void setFonts(XDDFFont[] fonts) {
        for (XDDFFont font : fonts) {
            CTTextFont xml = font.getXmlObject();
            switch (font.getGroup()) {
            case COMPLEX_SCRIPT:
                if (xml == null) {
                    if (props.isSetCs()) {
                        props.unsetCs();
                    }
                } else {
                    props.setCs(xml);
                }
            case EAST_ASIAN:
                if (xml == null) {
                    if (props.isSetEa()) {
                        props.unsetEa();
                    }
                } else {
                    props.setEa(xml);
                }
            case LATIN:
                if (xml == null) {
                    if (props.isSetLatin()) {
                        props.unsetLatin();
                    }
                } else {
                    props.setLatin(xml);
                }
            case SYMBOL:
                if (xml == null) {
                    if (props.isSetSym()) {
                        props.unsetSym();
                    }
                } else {
                    props.setSym(xml);
                }
            }
        }
    }

Add break to case.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64999] XDDFRunProperties setFonts font override

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64999

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
the latest source code does not look like this - could you review the latest
code?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64999] XDDFRunProperties setFonts font override

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64999

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |CLOSED

--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
The thing is the code is fixed already. POI 5.0.0 will be released early next
year. You can also use a nightly build or do a custom build of your own based
on patching the source.
https://ci-builds.apache.org/job/POI/job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/dist/

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64999] XDDFRunProperties setFonts font override

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64999

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64999] XDDFRunProperties setFonts font override

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64999

--- Comment #2 from fanjiajia <fa...@gmail.com> ---
Version : 4.1.2

Maven confih: 
...
 <poi.version>4.1.2</poi.version>

...
<dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-scratchpad</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>${poi.version}</version>
        </dependency>
...


My java code:

XDDFFont[] fonts = new XDDFFont[2];
                fonts[0] = new XDDFFont(FontGroup.EAST_ASIAN,
StringUtils.isBlank(fontStyle.getEastAsianFontFamily()) ?
Constant.DEFAULT_EA_FONT :
                        title.getFont().getEastAsianFontFamily(), null, null,
null);
                fonts[1] = new XDDFFont(FontGroup.LATIN,
StringUtils.isBlank(fontStyle.getFontFamily()) ? Constant.DEFAULT_EN_FONT :
                        title.getFont().getFontFamily(), null, null, null);
                XDDFRunProperties xddfRunProperties = new XDDFRunProperties();
                xddfRunProperties.setFonts(fonts);

If I set LATIN to fonts[0],EAST_ASIAN font will override LATIN font.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org