Author Topic: Please improve and increase slots from preview font pane [Solved]  (Read 3789 times)

Re: Please improve and increase slots from preview font pane
« Reply #40 on: 16 Mar 2017, 07:59 »
Please, return it back for now.... I did not mean to force you to change it (you may have problems with that in some programs), I just needed to know what you are working with, because I wanted to make some experiments.

You mean is what is my work with ParsiNegar ? Sorry for bad English .
I used ParsiNegar for Farsi type in Photoshop , Premiere , .... And haven't any problem with it .  Only AGS have some issue with it that you know better than me.
If I don't understand your question please let me know

Re: Please improve and increase slots from preview font pane
« Reply #41 on: 16 Mar 2017, 08:26 »
Please, return it back for now.... I did not mean to force you to change it (you may have problems with that in some programs), I just needed to know what you are working with, because I wanted to make some experiments.

You mean is what is my work with ParsiNegar ? Sorry for bad English .
I used ParsiNegar for Farsi type in Photoshop , Premiere , .... And haven't any problem with it .  Only AGS have some issue with it that you know better than me.
If I don't understand your question please let me know

No, I mean  "Language for non-Unicode programs". Better return it to what you had before, because it can affect how some old programs, including AGS, work with text.


Regarding how to change the font. I would try following:

1. Create a text file (normal text file, not something like Word document).
2. Type every possible Persian letter (converted using ParsiNegar) from your font in that file to create some sort of "alphabet".
3. Save that text file in Unicode format.

What happens then, but probably I would have to do that:
4. Pick out unique symbols and sort the list by the order of letter codes.
5a. Use the standart ANSI character set (English) to know the codes of these letters in ANSI.
OR, if that won't work for some reason -
5b. Save a copy of that file, converting to ANSI format, and check the resulting codes there.
6. Write down a table of two columns:
Code of letter in UnicodeCode of letter in ANSI

Back to you:
7. Make a modification of your Persian font by moving letters to new codes.
8. Test in AGS.

Re: Please improve and increase slots from preview font pane
« Reply #42 on: 16 Mar 2017, 08:47 »
I don't see any different between last situation and now in  "Language for non-Unicode programs" .

There is great way .  Thanks a lot  . If you want any help for Persian language please let me know . ( It's similar to Arabic font but with a few more letters)

p.s : I get first post from Amin ( ParsiNegar author ) . That he said what is your font . I replied and ask Is it possible convert to ANSI or other trick in your program . I'm waiting to answer.

Snarky

  • Global Moderator
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: Please improve and increase slots from preview font pane
« Reply #43 on: 16 Mar 2017, 09:14 »
Man, CW, you're going far above and beyond here!

One thing that puzzles me a little: even if Mehrdad moves the character glyphs to other slots in the font, won't the font coding that combines different glyphs to make up a full character still refer to the old slots, so that as soon as you get into compound characters or ligatures, the whole thing will break?

Re: Please improve and increase slots from preview font pane
« Reply #44 on: 16 Mar 2017, 09:23 »
One thing that puzzles me a little: even if Mehrdad moves the character glyphs to other slots in the font, won't the font coding that combines different glyphs to make up a full character still refer to the old slots, so that as soon as you get into compound characters or ligatures, the whole thing will break?

That is a good question. I am not a big expert in TTFs, although I probably learnt a little more while researching this issue.

How these special Persian fonts work: they require you to type 2 characters for 1 letter, first character corresponding to "modification" symbol, and second character corresponding to "base" symbol.
(That special typing program converts some Persian letters to combinations of 2 characters)
"Modification" symbols in font are given offset properties, that actually make them overlap following character. They do not have exact reference to what chars they need to overlap, I guess that could be anything (even incorrect combinations).
Hope my explanation makes sense; I am not really aware of proper terminology for all this.
« Last Edit: 16 Mar 2017, 09:26 by Crimson Wizard »

Re: Please improve and increase slots from preview font pane
« Reply #45 on: 17 Mar 2017, 08:50 »
Just to make a little update, I decided to write a tiny utility program which will create a table of conversion between unicode font codes and ansi font codes. Because making such table by hand would be a chore.

My idea is to make a program that will analyze Unicode text, and converted ANSI text, and then write a table of correspondence between letter codes. This table is then used to modify letter codes in the font.

I guess this won't take long, but I need to find some free time.

Re: Please improve and increase slots from preview font pane
« Reply #46 on: 17 Mar 2017, 12:22 »
Great news CW . Thanks a lot for this plan . I'm waiting for your good news  ;-D

Snarky

  • Global Moderator
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: Please improve and increase slots from preview font pane
« Reply #47 on: 17 Mar 2017, 14:59 »
So many hoops to jump through just because AGS doesn't support Unicode... :~(

Re: Please improve and increase slots from preview font pane
« Reply #48 on: 17 Mar 2017, 15:50 »
Alright, here is the program.
https://www.dropbox.com/s/ua0jdrd9xlgshcl/TextConvMapMaker_Build.zip?dl=0

I do not think I will be able to do much more to it.

Instructions:
1. Type all the Persian letters (whole alphabet) in the ParsiNegar, and convert text to use for you font, as usual.
2. Copy resulting text into my program, in the big field.
3. Click "Create map". You will see the table of letter codes, first column is letter (in your case that would be "pseudo-letter" from ParsiNegar), second - original Unicode codepoint, third - codepoint in the ANSI encoding of your system.
4. For convenience you may click "Save table" - that will print this table into simple text file.

5. Use this table to modify Persian font in your favorite TTF editor. What you need to do is to change each letter's code, according to this table. For example, if table sais like:
some letter123445
Then you need to find a letter with code 1234, and change that code to 45 (or make a copy of letter and paste it into slot 45).

Re: Please improve and increase slots from preview font pane
« Reply #49 on: 17 Mar 2017, 17:08 »
AWESOME !!!! . It seems works perfect . I replaced some letters in correct slots and now I have right words without any problem  ;-D
I only must improve all slots for start Farsi typing as 2th language after English in my game.

Many thanks, in advance, for your help and your great program

Mehrdad

A little problem . I have equal number for different original codepoints . Where is my wrong ?

I think problem is choose Arabian unicode .  I can't see Persian unicode in list .

« Last Edit: 18 Mar 2017, 08:17 by Mehrdad »

A little problem . I have equal number for different original codepoints . Where is my wrong ?
Not every Unicode letter can be converted to unique letters in ANSI automatically. If you have such letters, you would need to deal with them specially.

I think problem is choose Arabian unicode .  I can't see Persian unicode in list .
As I was saying earlier, there is no ANSI codeset for Persian language in Windows.

That was the reason why I suggested to return your "Language for non-Unicode applications" to what you had before (English?). This setting is also used when you build your game in AGS.
Of course if you do that now, some codes may change and you need to edit font again.

Not every Unicode letter can be converted to unique letters in ANSI automatically. If you have such letters, you would need to deal with them specially.
But it's will be so hard by typing .Please see it :
   Ã   195    63
   Ì   204    63
   º   186    63
   ö   246    63
Quote
As I was saying earlier, there is no ANSI codeset for Persian language in Windows.

That was the reason why I suggested to return your "Language for non-Unicode applications" to what you had before (English?). This setting is also used when you build your game in AGS.
Of course if you do that now, some codes may change and you need to edit font again.

English is one of language my game and it's OK . Second is Persian . Sorry I don't understand . Did you mean I ignore it ? Or made a custom alphabet keyboard for Farsi ?


But it's will be so hard by typing .
Yes, it will be difficult. That is a problem with putting Unicode text into non-Unicode program, such as AGS.

The only thing I can suggest here is to first deal with simple letters, and then see how many free slots are there remaining in the font. If you still have free slots, you may use them for missing letters.
But if you do that, you will also have to change these letters in Parsi-Negar's texts.


As I was saying earlier, there is no ANSI codeset for Persian language in Windows.

That was the reason why I suggested to return your "Language for non-Unicode applications" to what you had before (English?). This setting is also used when you build your game in AGS.
Of course if you do that now, some codes may change and you need to edit font again.

English is one of language my game and it's OK . Second is Persian . Sorry I don't understand . Did you mean I ignore it ? Or made a custom alphabet keyboard for Farsi ?

No, that's not what I mean.
This setting "language for non-Unicode programs" is used when Unicode text is converted to non-Unicode. This is what AGS does, for example, when you put ParsiNegar's text in there, and then compile the game.
What I mean, is that different options may produce different results. I am suggesting to try changing it back to English and see if that reduces the number of letters that have same code.
I do not know if it will, but I think it's worth trying.

OK . Finally done.

Your right CW . I back to English , Arabic ,.... and English was best result for "language for non-Unicode programs" option  . I improved all slots but 3 letters was complete missed without any rectangle slot even. So replaced to another slots that I don't need to them .

It seems works perfect now and ready to typing.

Thanks a lot for great advises.

I have an issue with line break Farsi fonts for long words .Please see this example :
player.Say("!kLva¶ Iµ{ ¾M IÀ·A ÂThL{¼i , kù¨Â¶ ºI¶jI{ pHoMH o«Äj o#º ¦Ä ÂThL{¼i pH ÂT¤» .ÁnA");

After run game it show :  o«Äj o#º ¦Ä ÂThL{¼i pH ÂT¤» .ÁnA    under    ¾M IÀ·A ÂThL{¼i , kù¨Â¶ ºI¶jI{ pHoMH

I changed place two words and result was worse .

How AGS do it ? Is it any way for manually set break long words ?

How AGS do it ? Is it any way for manually set break long words ?

This is a common issue with autobreak, AFAIK AGS is breaking at nearest space character. But you can use '[' character to set line break.

This is a common issue with autobreak, AFAIK AGS is breaking at nearest space character. But you can use '[' character to set line break.

OK. Thanks. It's seems good when player stand on middle screen but in edges I have a messy words  :(