0 Replies Latest reply on Mar 26, 2010 9:52 PM by Francois Eric

    p:font encoding cannot be set by EL

    Francois Eric Novice

      Hi,


      I have an Itext document that I need to be translated in english and in chinese. 


      The only way I have been able to display the chinese characters is by using the encoding: UniGB-UCS2-H and fontName STSong-Light for all of my p:font. 
      Ex:

      <p:font size="12" name="STSong-Light" encoding="UniGB-UCS2-H">



      Even though everything is saved in UTF-8, I cannot output the chinese characters in utf-8.


      Now my problem is I would like to use EL to determine the name the encoding of the font so that I can determine which one touse depending on the locale by doing:
      Ex:

      <p:font size="12" name="#{purchaseOrderPDFFormAction.fontName}" encoding="#{purchaseOrderPDFFormAction.fontEncoding}">



      but the EL is never evaluated.  The fontName is but not the fontEncoding.


      Here are the methods:



          public String getFontName() {
               if(getCustomLocale().getLanguage().equals("zh")) {
                    return "STSong-Light";
               }
               return "HELVETICA";
          }
          
          public String getFontEncoding() {
               if(getCustomLocale().getLanguage().equals("zh")) {
                    return "UniGB-UCS2-H";
               }
               return "utf-8";
          }



      I put a breakpoint in both those methods and I can clearly see that it does reach the fontName method but not the fontEncoding.


      Any idea how I can do this.  Otherwise I'll have to create 2 itext documents that are exactly the same except for the encoding...which would be quite dissapointing ;)


      Thanks for your help