Font problem

Help
2011-10-27
2013-03-18
  • nenad cikic
    nenad cikic
    2011-10-27

    Hello again. I am progressing. I have managed to create visual c++ dll project that is a bridge between Java and my third party dll using JNI. I have started to create the application and I have problems with fonts. In the attached image you can see that in the list box all Croatian letters are ok while i have artifacts in the STRING control, in the menu and in the window text both in frame and browse. I have tried ms sanserif and tahoma.
    This is the frame definition
    AppFrame APPLICATION('Qiqo d.o.o Pula - Mjenjačnica'),AT(,,400,240),FONT('Tahoma',,,,CHARSET:EASTEUROPE), |
             STATUS(-1,80,120,45),SYSTEM,MAX,RESIZE
           MENUBAR,USE(?Menubar)
             MENU('&File'),USE(?FileMenu)
               ITEM('&Print Setup …'),USE(?PrintSetup),MSG('Setup printer'),STD(STD:PrintSetup)
               ITEM,SEPARATOR
               ITEM('E&xit'),USE(?Exit),MSG('Exit this application'),STD(STD:Close)
             END
             MENU('&Edit'),USE(?EditMenu)
               ITEM('Cu&t'),USE(?Cut),MSG('Remove item to Windows Clipboard'),STD(STD:Cut)
               ITEM('&Copy'),USE(?Copy),MSG('Copy item to Windows Clipboard'),STD(STD:Copy)
               ITEM('&Paste'),USE(?Paste),MSG('Paste contents of Windows Clipboard'),STD(STD:Paste)
             END
             MENU('<138>ifarnici'),USE(?Sifarnici)
               ITEM('Pregled vrsti transakcija'),USE(?SifarniciPregledvrstitransakcija)
             END

    and this is the browse
    QuickWindow WINDOW('Pregled vrsti transakcija <154>đčć<158,138>ĐČĆ<142>'),AT(,,319,195),FONT('Tahoma',8,,FONT:regular,CHARSET:EASTEUROPE), |
             CENTER,IMM,HLP('BrwVT'),SYSTEM,GRAY,DOUBLE,MDI
           LIST,AT(8,19,306,157),USE(?Browse:1),IMM,HVSCROLL,MSG('Browsing the vrsta_transakcije file'),FORMAT('72C(2)|M~vrsta transakcije~C(0)@s2@80L(2)|M~opis~@s200@'), |
               FROM(Queue:Browse:1),#SEQ(1),#ORIG(?List),#FIELDS(VT:vrsta_transakcije,VT:opis)
           SHEET,AT(1,1,317,175),USE(?CurrentTab),#ORIG(CurrentTab)
             TAB,USE(?Tab:2)
               PROMPT('<138>ĐČĆ<142,154>đčć<158>Filtriraj po opisu:'),AT(49,2),USE(?OpisFilter:Prompt),#ORIG(?OpisFilter:Prompt), |
                   #LINK(?OpisFilter)
               ENTRY(@s200),AT(103,1,144,10),USE(OpisFilter),LEFT(2),#ORIG(OpisFilter),#LINK(?OpisFilter:Prompt)
             END
           END
           BUTTON('&Close'),AT(268,180,49,14),USE(?Close),LEFT,MSG('Close Window'),TIP('Close Window'),ICON('WACLOSE.ICO'), |
               #SEQ(2),#ORIG(?Close)
         END

    I have discovered that when i manually change the browse clw as
    WINDOW('Pregled vrsti transakcija šđč枊ĐČĆŽ')
    and
    PROMPT('ŠĐČĆŽšđčćžFiltriraj po opisu:'),AT(49,2),USE(?OpisFilter:Prompt)

    then there are no artifacts.
    Obiously i would like not to edit manually the clw each time i regenerate.
    Have you faced these type of problems?
    thanks
    Nenad

     
  • nenad cikic
    nenad cikic
    2011-10-29

    I have worked arround this writing a small clarion application that, after the clw are generated, parses the clw and <xx> string costants changes with actual char value. It works, at least for Croatian letters.

    Nenad

     
  • Andrew Barnham
    Andrew Barnham
    2011-10-30

    I live in Australia, and all my own customers are based here. So chars 0x00 -> 0x7f are all I need.

    I have spent time though getting clarion2java working for extended character sets; helping out others in Europe with extended char set needs.  There are tests in regression suite that verify proper handling of Kanji etc.

    I think I know what is happening in above.  It is an issue with character sets.  Now Š = UTC +0160  which compiles correctly. But corresponding <138> is converted into a single char.  138 = UTC +008A, which is not a display character.

    <138> probably is a char in your current code page that maps to to UTC +0160.  I think you are probably using Windows-1250 code page.  http://www.science.co.il/language/character-code.asp?s=1250. Search for 138.

    Clarion2java assumes that <138> is unicode.  You can try changing this behaviour by modifying runtime file thus:
    org.jclarion.clarion.lang.Constant

    In this java file you will see a method that handles processing of string constants. Method : encodeBinary is of key interest.
    Line 215:
    appendOrd(encoding.getBuilder(),(char)ord,javaFormat);

    Following instead may give better results.
    appendOrd(encoding.getBuilder(),(char)ord,javaFormat);

          char x = (new String(new byte { (byte)ord })).charAt(0);
          appendOrd(encoding.getBuilder(),x,javaFormat);

    If you can, try changing clarion2java runtime with above, modify compiler to use -SNAPSHOT version of clarion2java and see if that makes a difference. If it works will incorporate it into clarion2java.

     
  • nenad cikic
    nenad cikic
    2011-10-30

    OK,i think is time i learn how to compile c2j itself.
    I have checked out the source code and will try here, but before commiting i will ask you to see if it is ok (i am also not sure how to commit since this is first time i use sourceforge).
    thanks
    nenad

     
  • nenad cikic
    nenad cikic
    2011-10-31

    Can you help me on compiling c2j?
    I have checked out the 4 trunks as specified in 4.8 of your help doc.
    My folder structure is now
    C:\clarion2java-source\compiler
                                              \plugin
                                              \runtime
                                              \sysruntime

    If i enter the runtime folder and enter mvn as specified it gives me that it can not resolve the dependency to clarion-sysruntime 1.16
    I have went to maven site and i found the last version for sysruntime is 1.15 so i have changed the pom.xml.
    Now i can pass the dependency resolving, but it stucks on compiling:
    it seems the GuiModel imports the CConfigImpl and CConfigStore which do not exist. There are also other errors. Maybe
    I have incorrectly took a working copy from the repository. Can you check please if the trunk compiles?
    Thanks
    Nenad
                                            

     
  • Andrew Barnham
    Andrew Barnham
    2011-10-31

    Hi.  I have not synced to maven repository for a while.  Just done it now.  Try after an hour or so after date of this email.

    Or:  compile sysruntime, check sysruntime pom.xml to see what version it is. (should be 1.17-SNAPSHOT) and make version in runtime the same.

     
  • nenad cikic
    nenad cikic
    2011-11-02

    I have managed to build all 4 projects (runtime,compiler etc).
    I have changed in my project pom.xml the clarion-maven-plugin to 1.21-SNAPSHOT (which is the compiler version if i understood well).
    Now when building my project it gives me error on equates.clw on line
    INCLUDE 'property.clw'

    When i paste property.clw instead in equates.clw i get then error on
      OMIT('***',_WIDTH32_)
    SIGNED                  EQUATE(SHORT)
    UNSIGNED                EQUATE(USHORT)
    _nopos                  EQUATE(08000H)
      ***
      COMPILE('***',_WIDTH32_)
    SIGNED                  EQUATE(LONG)
    UNSIGNED                EQUATE(LONG)
    _nopos                  EQUATE(080000000H)
      ***

    I fi comment the omit block then it passes the equates.clw but halts again on my main project clw at the beggingin on the include statements.
       PROGRAM

       INCLUDE('ABERROR.INC'),ONCE
       INCLUDE('ABFILE.INC'),ONCE
       INCLUDE('ABFUZZY.INC'),ONCE
       INCLUDE('ABUTIL.INC'),ONCE
       INCLUDE('ERRORS.CLW'),ONCE
       INCLUDE('KEYCODES.CLW'),ONCE

    I have not made any changes to the Costant.java till now. With compiler version 1.19 i do not get these errors.
    I have tried also with clarion-maven-plugin=1.20 and it is ok. With clarion-maven-plugin=1.21 it gives me unknown dependency.

    Can you please help me with this issue? I can workaround the font problem, as i said before, but i would like to understand better how to compile c2j.
    Thanks
    Nenad

     
  • Andrew Barnham
    Andrew Barnham
    2011-11-02

    What is the error you are getting?

    Try running "mvn clean" and then "mvn".

    Failing that, create a zip of your project, including zip of things you checked out and email it to me directly.  andrew dot barnham at gmail dot com

     
  • nenad cikic
    nenad cikic
    2011-11-03

    Super!
    Doing mvn clean and then mvn  -D maven.test.skip=true in sequence on
    sysruntime
    runtime
    compiler
    plugin

    and after that doing mvn on my project
    solved my problem.
    The Croatian letters are now OK. You can sync the repository with your proposal.
    I have now to investigate why the javaw or java process stays pending after i exit the application.
    Thanks
    Nenad

     
  • Andrew Barnham
    Andrew Barnham
    2011-11-03

    Copy  that. Give me a few days, currently trying to deliver some other code. will aim put a day into tweaking items you have raised either Wed or Thur next week.

     
  • nenad cikic
    nenad cikic
    2011-11-03

    Ok thanks. I will submit one more issue in the help forum, just to track it easier.

     
  • Andrew Barnham
    Andrew Barnham
    2011-11-06

    Just commited change to svn.  It will take byte list in a string constant, either runtime (i.e. EVALUATE) or compile time and convert to characters based on default char set.  For multi-byte charsets, (i.e. Chinese/Japanese), I am assuming that clarion generator will yield multibytes like this <b1,b2,b3,b4>  - but this is just a guess so we may need to revisit this.

    If you want to change charset on the fly from java startup time default; the following should work for example:

    @java-code 'org.jclarion.clarion.lang.Constant.charset=java.nio.charset.Charset.forName("Win-1250");'

    Note that this is not thread safe, i.e. if you have multiple threads all using EVALUATE simultaneously, then changing charset will affect all threads.