https://issues.apache.org/bugzilla/show_bug.cgi?id=49908

           Summary: Add API for processing of symbols
           Product: POI
           Version: 3.7-dev
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HWPF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Symbols in Word documents are stored specially:
- in the CharacterRun there is a character 0x28
- CHP.fSpec is true
- CHP.ftcSym contains index of the symbol font in the font table
- CHP.xchSym contains character in the symbol font

There are several ways how support could be implemented:

1. add getters for ftcSym and xchSym to the CharacterRun, then user could
process symbols like this.

2. add helper class to help extract symbol and font from CharacterRun

With the first variant the user could do this:

  String text = characterRun.text();
  String fontName = characterRun.getFontName();
  if (characterRun.isSpecialCharacter() && text.length() == 1 && text.charAt(0)
== 0x28) {
    fontName = wd.getFontTable().getMainFont(chr.getFtcSym());
    text = new String(new char[] { (char) chr.getXchSym() } );
  }
  // work on with fontName and text

In my testing, the CharacterRun with symbol always contained exactly one
character, but I cannot confirm this is a rule.

Please let me know which version is better to be incorporated and I will
provide a patch.

Viliam

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

Reply via email to