Please improve and increase slots from preview font pane [Solved]

Started by Mehrdad, Fri 10/03/2017 15:57:02

Previous topic - Next topic

Crimson Wizard

#20
Quote from: Mehrdad on Sun 12/03/2017 15:36:00
I'll try more than 40 fonts and result was same .Exactly Same slots is unknown for AGS . I think best solution is slot editable . So we can replace rectangle with letters as copy / paste .

We cannot make the slot editable so simply, because TTF are vector fonts, they require a real font editor with complex functionality, which knows how to deal with TTF data.
Also, AGS is not really meant to be a resource editor. Similarily like putting an image editor in it not likely is a good idea.
If someone makes a plugin that edits TTF fonts - that will be another story (there is already a font editor plugin that edits bitmap fonts).

Anyway, there is number of TTF editors around that let you do that. For example, download FontForge, open your font in it and copy letters to the slots you need:
https://fontforge.github.io

Mehrdad

OK . unfortunately I only can use TTF font for AGS . No bitmap and so on

I have some TTF editor too but It's just matter is unknown for AGS .
My official site: http://www.pershaland.com/

Crimson Wizard

Quote from: Mehrdad on Sun 12/03/2017 16:28:21
I have some TTF editor too but It's just matter is unknown for AGS .

Well, I have to admit that I am again not exactly sure what you mean.

Are you saying there an actual letter in the font between slots 0 and 255, that is not visible on preview and not working in game?
Could you post a font you have such problem with and point out which slot does not work? (If it is a font you already posted, then simply tell which slot is that.)


Mehrdad

Quote from: Crimson Wizard on Sun 12/03/2017 16:42:25
Are you saying there an actual letter in the font between slots 0 and 255, that is not visible on preview and not working in game?
Yes . Your shot showed them as rectangle . And it's happen for other fonts in exactly same slots.

Quote from: Crimson Wizard on Sun 12/03/2017 16:42:25
Could you post a font you have such problem with and point out which slot does not work? (If it is a font you already posted, then simply tell which slot is that.)

Sorry I don't understand what's you mean . I tried many fonts and it occur exactly in same slots . First rectangle slot want  :   Ã¯ÂºÂ»     U+FEBB &#65211



My official site: http://www.pershaland.com/

Crimson Wizard

#24
Quote from: Mehrdad on Sun 12/03/2017 17:00:52
Quote from: Crimson Wizard on Sun 12/03/2017 16:42:25
Are you saying there an actual letter in the font between slots 0 and 255, that is not visible on preview and not working in game?
Yes . Your shot showed them as rectangle . And it's happen for other fonts in exactly same slots.

I opened the TTF font you posted in the FontForge editor, and it also had NO LETTERS in these slots. There were just no letters, at all.

AGS works only with slots #0-255. If the font ITSELF does not have any letters there, then AGS obviously won't know them.

If you want to have particular letter in exactly these slots (where you see rectangles), then you need to open the font in a font editor, and copy/paste this letter to such slot.


Mehrdad

Quote

I opened the TTF font you posted in the FontForge editor, and it also had NO LETTERS in these slots. There were just no letters, at all.

Really ? ? ? ? . But I could find all of them in bottom list . Maybe I don't familiar with this program because it show me many China words too . I use 'High logic Font creator' and show all of them .
My official site: http://www.pershaland.com/

Crimson Wizard

#26
Mehrdad, I am not sure what you are trying to do exactly, and how do you want to use your fonts. But I am coming to a thought that either we do not understand each other, or you are doing it wrong.

So, just in case, I feel the need to explain following.

There was a big page in the wiki explaining how to use fonts of other languages in AGS. You can read it here:
http://www.adventuregamestudio.co.uk/wiki/Fonts
But that could be a long read.

In very short, the idea is that AGS only sees FIRST 256 slots from any font.
This means: if your letters are located in slots after #255, then AGS won't see them no matter what you do.
This means that you need a font where all of the letters you want to use are located in slots in the range between 0 and 255.

Such letters layout is called "ANSI codepage", Windows uses same thing, which is a long story. But important part is that you can use ANSI table to know where to paste your letters.

I am not very well acquianted with the alphabet you are using, but for example, I found this table for persian language:
https://en.wikipedia.org/wiki/Iran_System_encoding
EDIT: sorry, nevermind that, this seem to be the correct page:
https://en.wikipedia.org/wiki/Windows-1256

Basically, if you copy&paste letters to the slots as shown in this table, then not only AGS will be able to see that, but also you will be able to type texts in your own language in AGS using native language mode, and AGS should correctly convert these texts to use in game.

This is how, for example, we made Russian, and some other languages to work within AGS.

Mehrdad

How can I put letters in FIRST 256 ? Can you help me for one example? Please see this image in comparison with your shot in AGS . It's in 'High logic Font creator' program


My official site: http://www.pershaland.com/

Crimson Wizard

Quote from: Mehrdad on Sun 12/03/2017 17:40:51
How can I put letters in FIRST 256 ? Can you help me for one example . Please see this image in comparison with your shot in AGS . It's in 'High logic Font creator' program


Hmm... I can see that FontCreator displays the font differently from FontForge. I will try to install FontCreator and check that out.

Crimson Wizard

#29
Alright, I think I got it. There is a big misunderstanding here.

The font "slots" I was speaking about, are symbol "codes". As I mentioned, AGS only works with codes 0-255.

Font Creator does not show letters in the order of codes by default. It shows them in the order of alphabet, it seems. What you see in the program window is not what AGS "sees".

Do following: on the toolbar, where the glyph sorting is being set up, near "Default Grouping" text, choose following sort order:
- Codepoint
and following hints type:
- Codepoints

Then you will see which actual slots these letters occupy.

For example, in the font "LMN Sam.ttf", which you posted earlier, letters go from slot 32 to 126, then from 160 to 255, then from 338 to 376 and some letter has even code number 8729.
This is why they are not working in AGS (you need them all inside numbers 0-255).


I do not know how you do that in FontCreator exactly, but the idea is to change the codes of these letters to bring them into the range of 0-255.

The biggest question, though, is what codes each letter should have.

Normally I'd recommend trying to match the ANSI table shown at this page in wikipedia, and then type texts having your native language selected in Windows:
https://en.wikipedia.org/wiki/Windows-1256
Windows uses this codetable for Arabic and some non-Arabic languages like Persian (sorry if I am mistaken at something).

The problem there is that it looks like not all letters from your alphabet are on that page. So it may not work for you.

The only other solution I know at this point is to use some program that would translate real text in Farsi to the "pseudo-language" with letters in code range 0-255.
You have mentioned that you use some program to type texts already. I do not know what program that is and what it does exactly, but maybe it will help you in this case too.

Mehrdad

Sorry but I couldn't find sorting as codpoints . Would you mind a shot ? My version of this program is so old (2007) .

After success in sorting by code , Can I improve manually slots and export to AGS?


I use LeoMoon ParsiNegar software for type and export texts to AGS . Only this software is almost match with AGS .
https://leomoon.com/downloads/desktop-apps/leomoon-parsinegar/


Edit: I grab new version and find codpoints . Now how can I fill it for AGS ?
My official site: http://www.pershaland.com/

Crimson Wizard

#31
You need to assign codes to letters in such a way that they will fit into range of code #0 to code #255.
I do not know how to change letter's code, or do copy/paste letter in FontCreator, but I guess that is possible to find out. That is not the most important thing though.

More important question here, is which codes to assign to which letters. You cannot do that randomly, because this is connected to how your real text in Persian will be translated in to "pseudo-text" to work with this new font.

In other words, even more importantly, is first to find out how you will translate your text from one form into another.

You need some program that can take a text in Persian and change the letter codes so that real persian letter become the code of such letter in your font.

ORIGINAL LETTER CODE (XXX) == converted to ==> LETTER's CODE (YYY) IN AGS FONT.


I never used ParsiNegar, so I cannot tell if that may help. I can take a look, but I don't have much free time right now, so this may take a while.


EDIT: I tried ParsiNegar, and I understand how it works better now. For example, I can see that if I type something in ParsiNegar, I can then convert & copy "weird" text into FontCreator's "preview" window and see proper Persian letters.

With that, I realize that ParsiNegar won't be enough on its own to solve this problem, but I have some thoughts about what can be done here. Unfortunately I am too tired today, so I will explain my idea tomorrow.

Mehrdad

New version of Font creator is commerical and don't export fonts. So I migrate to FontForge and tried similar slots as Name,Unicode,.. and export to AGS  many times . But don't get any success .  My knowledge is is poor for it.

Thanks so much for try ParsiNegar . If you can find a way for fix it you save me a lot.
I really appreciate your generous help.
My official site: http://www.pershaland.com/

Mehrdad

Today I tested another Farsi maker that was similar to ParsiNegar . With Roya name . I import new TTF (made for Roya only)  and I had exactly same missed slots . I don't know how can I arrange slots for AGS .
CW can you get any success in ParsiNegar ?   I know you are busy for 3.4.1 and thanks for this great updates .
My official site: http://www.pershaland.com/

Crimson Wizard

#34
Quote from: Mehrdad on Wed 15/03/2017 12:08:52
Today I tested another Farsi maker that was similar to ParsiNegar . With Roya name . I import new TTF (made for Roya only)  and I had exactly same missed slots . I don't know how can I arrange slots for AGS .
CW can you get any success in ParsiNegar ?   I know you are busy for 3.4.1 and thanks for this great updates .

I was taking a break to think this over, but in reality, there are just two possible ways to solve this problem (except for upgrading AGS to support Unicode, which is a big task).
It's just that I do not know which one you should take.

First of all, it does not matter which program do you use to type text and export fonts, because in either case you will get Unicode font and Unicode text. So just use the one you like more.
In either case you will have to create an ANSI font from your Unicode one, and you will need to have your Unicode text converted into ANSI text in such way that will make letter match codes in new font.

I will try to explain how this works, but that may be a little difficult for me to make good explanation.

----------------------------------------------------------------

You may already know, that there is a Unicode encoding for text, which allows letter codes up to #65535, and therefore Unicode fonts may have a very big range of letters.
There are ANSI encodings, which allow letter codes up to only #255, and therefore ANSI texts allow much smaller range of letters.
AGS only supports ANSI at the moment.

When you put Unicode text in AGS (for example, in the script), and then compile your game, this text will be converted into ANSI text. When this conversion is done, letters from Unicode have their codes changed to similar letters of particular ANSI table.
There are numerous ANSI tables: standard (latin only) table, cyrillic table, arabic table, and so forth. If wrong table is chosen, some native (non-latin) letters may get lost.

So, how AGS choses which table to use? It takes it from the system locale settings. Specifically, the option called "Language for non-Unicode programs". Here is a quick info on how to find this option in your Windows: https://www.java.com/en/download/help/locale.xml (don't mind the Java reference).

After this conversion, the resulting text's letters have codes in the range of #0-#255, so you cannot any longer use real Unicode font to display them (AGS wont be able to find correct letters). Instead, you need ANSI font, that has these letters in new slots (0 - 255), arranged according to the current system locale.

****************
EDIT: I had to rewrite following part, because I first wrote something not related to your situation.
****************

What I explained above is the standart way. However, you are using different method of typing: you first type Persian letters in your program (ParsiNegar, or other one), which converts them into some other letters ("special letters"), and then you put these, different letters, into AGS. We need to know how AGS will convert "special letters" into ANSI.

1. So, the first question really is, what is the "Language for non-Unicode programs" you are using, and what ANSI table does it use to convert text.
You'll need to check out what is set in your system (use above link to find it).
2. When we find out what table is used, we need to find what codes these "special" letters have there.
3. And then we would need to make a chart of our own:

Native Persian letter =>Letter created by ParsiNegar =>Code of the final letter in ANSI text

When we have such table, you will need to create a font, where Persian letters are put in the codes, which correspond to respective "special letters" in the ANSI table.

I am sorry if last thing sounds confusing. When we find out which ANSI table is being used, I can make a more "visual" example.

Mehrdad

OK. Thanks a lot for great answer. So we need a convertor from ParsiNegar to ANSI . I sent a massage to Amin ( ParsiNegar author ) for this problem and also sent your last answer too. Maybe he can find a solution for it .
I'm searching for convert to ANSI at the moment .   
My official site: http://www.pershaland.com/

Crimson Wizard

#36
Quote from: Mehrdad on Wed 15/03/2017 14:58:43
I'm searching for convert to ANSI at the moment .   

Notepad++ text editor can simply convert Unicode text files into ANSI using selected character set.
https://notepad-plus-plus.org/


To clarify something, I modified my previous post after writing it. Did you read first or modified variant (with "EDIT" line in it)?

Mehrdad

Quote from: Crimson Wizard on Wed 15/03/2017 15:40:40
To clarify something, I modified my previous post after writing it. Did you read first or modified variant (with "EDIT" line in it)?

Yes I read it. "Language for non-Unicode programs" was English and now I changed it to Persian (Iran)
But I don't know what ANSI table use to convert text .
My official site: http://www.pershaland.com/

Monsieur OUXX

#38
EDIT: bad reading through thread

I think your issue is a combination of two issues :
1) Your TTF font doesn't have all the characters. Yep, CW guessed correctly : it's perfectly possible for a font not to have all the characters. But most of the times you don't notice it because Windows replaces the missing characters with the same character from a similar-looking font. For example, as a French, how many times have I been using a cool font, only to realize that all the instances of character é appear in Arial? windows knows how to do that. But AGS obviously can't do that.
2) You don't know how to render your TTF font to WFN and how to move the characters you need to the first 256 slots.


I'd follow this process :
1) Read the Font wiki page : http://www.adventuregamestudio.co.uk/wiki/Fonts
2) Use rulaman's tool to turn your TTF font into WFN : look for the "Rulaman's TtfWfnSci" section in the wiki page
3) Use Rulaman's other tool ("Rulaman's WFN-FontEditor" - see dedicated section of the wiki page) to edit that WFN font and draw the (potentially missing) required characters into the first 256 slots.



Oh, and when you're done, UPLOAD the font you made, to make it available to the Persian/Iranian/Farsi AGS community ;)

 

Crimson Wizard

#39
Quote from: Mehrdad on Wed 15/03/2017 16:51:00
Quote from: Crimson Wizard on Wed 15/03/2017 15:40:40
To clarify something, I modified my previous post after writing it. Did you read first or modified variant (with "EDIT" line in it)?

Yes I read it. "Language for non-Unicode programs" was English and now I changed it to Persian (Iran)
But I don't know what ANSI table use to convert text .
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.



@ Monsieur OUXX, it seems like you have not read this the discussion thoroughly, because what you said cannot not really apply here.

1) I did not "guess" that TTF font does not have something. I opened posted TTF font in the editor to see its contents, and it did not miss anything, it had all letters it need; problem was they had codes > #255.
There was a big misunderstanding with Mehrdad thinking that he has letters at certain slots, while AGS did not see them, because font editor displayed these letters in different order.

2,3) Mehrdad did not want, and cannot use WFN, for the reason he explained in one of this posts above (and something you learn as soon as you try to write in Persian with the program Mehrdad referenced). The thing is that Persian letters are combined with each other when printed. One spot in text can have 2 symbols placed one upon another. TTF renderers can do that, because their font parameters describe these rules. But you cannot do that with WFN - you would have to make distinct letters for all possible combinations, thus significantly increasing their numbers.
Besides, what's the point of converting to WFN (and loosing ability to e.g. resize font and antialias text) when you can just edit TTF and put necessary letters in the first 256 slots?

At last but not least, from what I gathered up to this point, it seems that there is no direct way to convert Persian text from Unicode to ANSI, because there is no compatible ANSI table that would keep all required letters.


EDIT:
To elaborate further, Persian language does not have a proper ANSI codepage to use in MS Windows, like they do with, for example, French, Russian, etc languages. The closest available is codepage 1256, used for Arabic languages, but it has only small part of necessary letters.
I am not an expert here, but searching around the web, I found this article that gives some insight in this issue:
http://archives.miloush.net/michkap/archive/2010/05/11/10009925.html

judging on that explanation, this may related mainly to legal issues (US sanctions against Iran, and Microsoft being US-based company).

So, what Mehrdad does, he uses a special program called "ParsiNegar", where he is typing Persian texts using virtual on-screen keyboard. That program then takes that persian text and converts it into "pseudo-text", consisting of all kinds of extended characters. This pseudo-text, when used in combination with very special types of Unicode fonts, produces correct Persian visual output.

The only viable solution I have at this point is to make another step, and find out, how does this "pseudo-text" converts into ANSI, using, for example, standard (English) table, and then modify these Persian fonts accordingly to match the conversion result.

SMF spam blocked by CleanTalk