Welcome, Guest. Please login or register.

Author Topic: AFAOS and encodings  (Read 4397 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« on: August 14, 2007, 05:04:18 PM »
that stand in AFA FAQ txt.

 Q: I want use unicode Fonts for other languages.

  A: Make sure the truetype font support your national signs.
     Select in the mainpage the codepage file.It must be a ASCII file that
     use no Hex values (0x). Now select the font and click on convert. The
     message "can`t copy font" can ignored when dir "Fonts:" is chosen.      
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #1 on: August 16, 2007, 07:09:47 PM »
that files use hex letters.

for example 0xc1 is 193
0x391 is 913

0xC1 0x0391 # GREEK CAPITAL LETTER ALPHA

correct for AFA is this

193 913 # GREEK CAPITAL LETTER ALPHA

but because MOS use the same truetype fontmanger i think if youz ask for a MOS greek codepage fiel this work in AFA too
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #2 on: August 18, 2007, 02:19:58 PM »
does this mean MOS support files with hex content ?

I thought MOS is same as AROS because MOS team should exchange files with AROS team.the diskfont stuff of MOS and AROS is same.

But if MOS work with hex codepages, and they dont want exchange the files, seem i must add this feature, because there are no codepages here

maybe you can ask if somebody send you the actual MOS source of the truetype manager to save me time ?
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #3 on: August 18, 2007, 05:17:07 PM »
The code i have is this.It work only with dec values.
or is MOS strtolong enhanced that strtolong support too hex values ?

BOOL LoadCodePage(const char *filename)
{
   BOOL ret = FALSE;
   BPTR file;
   UBYTE buf[256];

   SetDefaultCodePage();
   
   file = Open(filename, MODE_OLDFILE);
   if (file)
   {
      ret = TRUE;

      while (FGets(file, buf, sizeof(buf)))
      {
         STRPTR p = buf;
         LONG index, unicode;
         LONG chars;

         if (*p == '#')
            continue;

         chars = StrToLong(p, &index);

         if (chars <= 0 || index < 0 || index > 255)
            continue;

         p += chars;

         chars = StrToLong(p, &unicode);
         kprintf ("%d %d\n",codepage[index],unicode);

         if (chars <= 0)
            continue;

         codepage[index] = (UWORD)unicode;
      }

      Close(file);
   }

   return ret;
}

here is code of aros strtolong

{
    AROS_LIBFUNC_INIT
    AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)

    LONG sign=0, v=0;
    CONST_STRPTR s=string;

    /* Skip leading whitespace characters */
    if(*s==' '||*s=='\t')
   s++;

    /* Swallow sign */
    if(*s=='+'||*s=='-')
   sign=*s++;

    /* If there is no number return an error. */
    if(*s<'0'||*s>'9')
    {
   *value=0;
   return -1;
    }

    /* Calculate result */
    do
   v=v*10+*s++-'0';
    while(*s>='0'&&*s<='9');

    /* Negative? */
    if(sign=='-')
   v=-v;

    /* All done. */
    *value=v;
    return s-string;
    AROS_LIBFUNC_EXIT
} /* StrToLong */
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #4 on: August 18, 2007, 06:30:39 PM »
and source is not available ?

I look a little in ansi c libs, the command strtol seem work too in hex and dec.only syntax is diffrent.but maybe can wrap

does somebody know if strtolong on OS4 too work with hex ?
I prefer to enhance strtolong then because it is usefull when support too hex values
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #5 on: August 19, 2007, 12:33:19 PM »
I am sure they add the feature that hex is support and change the autodoc when they not went down 1994 ;-)

I think it is usefull for coding that strtolong support also other input formats.

So in parser can use hex and decimal values.

there is a ansi command strtol.
but when i look on this, i see it is not so easy to get the number of the character in the value.
 
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #6 on: August 19, 2007, 03:20:08 PM »
When i read this then maybe it is safer to let stringtolong as it is and change fontmanager.

but i am lazy and cant test if codepages work, because default font support german correct.

@Georg,

Do you have MOS source with stringtolong ?
I do it in a separate command.

 
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #7 on: August 20, 2007, 08:15:07 AM »
Ok on MOS this is less risc, because it is not 100% compatible so all 68k programs work and Coders must port their programs if they notice a bug when they test all functions.

AFA should be 100% compatible.

I think too there cant be a 100% garantie that there is none of the 10000 and more programs out that fail in some cases, maybe read bad load file only when option x and y is set and program do wired things.

As Georg told, AROS Team have no source of the new strtolong.

Can you please send it ?
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #8 on: August 21, 2007, 08:43:19 AM »
@Piru

Many thanks for the source
 

Offline unusedunused

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 479
    • Show all replies
Re: AFAOS and encodings
« Reply #9 on: August 23, 2007, 10:19:01 AM »
On AFA Page is new fontmanager, i add the code Piru send and rename it as MosStrToLong.source is included in that archive

please look if that work.if so, then the fontmanager is datet as non beta
 
The link to codepage files is too on AFA page or look here