![]() |
|
Cyrillic fonts for allegro |
Nedjalko Milenkov
Member #5,394
January 2005
|
I was trying to use the unicode, but it needs spec. fonts. I do not have a cyryllic font. Could anyone give me? I searchd in google, but the tools which I found don not work (ttf2pcx and FontEditor). |
Kirr
Member #5,060
September 2004
![]() |
-- |
Nedjalko Milenkov
Member #5,394
January 2005
|
The url does not help me |
miran
Member #2,407
June 2002
|
All the basic MS fonts that come with XP (Arial, Times, etc) have cyrillic characters in them. And they do work with both ttf2pcx and the FontEditor, you just need to know what you're doing. Hint: ranges... -- |
Nedjalko Milenkov
Member #5,394
January 2005
|
After playing with the ranges I found cyrillic from 1024 to 2048 (betwen). I saved the file in fontx.pcx. Loaded it at the grabber and detects 1120 glyphs! After loading the font and puting some text to the screen it show rectan. Why? Should I edit the range and how? |
Evert
Member #794
November 2000
![]() |
Or use Glyph Keeper to use the TrueType fonts directly. EDIT: for font ranges, see Allegro's manual: [url http://alleg.sourceforge.net/onlinedocs/en/index017.html#load_txt_font]. (That link is for 4.1.18. If you use 4.0.3, the load_font() family of functions doesn't exist. But the information is still accurate, you'll just have to use the grabber and datafiles to load the font. Or upgrade;)) |
miran
Member #2,407
June 2002
|
I don't remember exactly where the cyrillic fonts are but there was a thread with this exact question not very long ago. You might want to do a search. In FontEditor all you have to do is this: select your colours (if you want multicolour font), load the font, add the range with the cyrillic characters and save as a pcx file. Then you must write a multi-range font script. Take a look at the unifont that comes with Allegro in the examples directory. Basically that will be just a normal text file that will look like this: unifont.pcx 0x0020 0x007F - 0x0400 0x047F Then when you load the font in your code, you load the txt file instead of the pcx. Again check the unicode example... EDIT: That took me a long time to write -- |
Nedjalko Milenkov
Member #5,394
January 2005
|
I checked the unicode example and see only \x14\x04 king of stuff. I know that that is the real unicode, but I prefer to write instead of code |
miran
Member #2,407
June 2002
|
Did you call set_uformat() before allegro_init()? Or whatever it's called. -- |
Nedjalko Milenkov
Member #5,394
January 2005
|
miran Yes I run set_uformat( U_UTF8 ); buf after allegro_init(); |
miran
Member #2,407
June 2002
|
What does the manual say about that? Last time I checked it recommended you do it before allegro_init()... -- |
gnolam
Member #2,030
March 2002
![]() |
And is your text input unicode as well? I know from personal experience that Cyrillic encoding is a bitch due to the many conflicting encoding standards... -- |
miran
Member #2,407
June 2002
|
Oh I just noticed, you're trying to use a Unicode font with extended 8bit ASCII strings. That simply won't work. Either you make or get a font with 8bit ASCII encoding or you format your strings into real 16bit Unicode... -- |
Matt Smith
Member #783
November 2000
|
I would hack a Unicode->CodePage export func into Miran's font editor Has anyone tested what happens when you feed UTF-8 strings through gcc? I expect it will choke. When you use Allegro's printing functions, they expect UTF-8 by default, so you should set it to 8-bit ASCII with set_uformat(U_ASCII_CP); first. You still need a Cyrillic CodePage font, to match the one in your code editor. (I was wary about using codepages in C code but all the compilers seem to accept it.) The manual says it should work with ASCII-8 strings and a Unicode font, provided the tables are set up right with void set_ucodepage(const unsigned short *table, const unsigned short *extras); |
Nedjalko Milenkov
Member #5,394
January 2005
|
What a big mess |
Evert
Member #794
November 2000
![]() |
Quote: What does the manual say about that? Last time I checked it recommended you do it before allegro_init()... You should, if you only intend to use a single encoding ever. I'm not actually sure if there will be problems if you set it later, but I assume not, since Allegro also allows you to switch encodings on the fly. This part of Allegro is pretty ugly, by the way. |
Matt Smith
Member #783
November 2000
|
The first thing you need to establish is which code page you are using. DOS had the old IBM code pages (Russian was 866) and Windows has 1251 (Slavic) and 1257 (Baltic). There is also iso 8859-5 etc. Then, you have to hope somebody has made the codepage tables for your chosen encoding, or make it yourself like this
|
Kirr
Member #5,060
September 2004
![]() |
Here is a table for converting cp-1251 into Unicode. But I don't suggest working with codepage through all your program. It's better to convert your strings to Unicode (for ex. UTF-16) in the startup of your program. Some libs, like ICU have this conversion functions, but it is trivial anyway, so I suggest to just code it. -- |
DanielH
Member #934
January 2001
![]() |
Nedjalko, look at my unicode example. It comes with a cyrillic font and prints Russian-English pairs. |
Nedjalko Milenkov
Member #5,394
January 2005
|
MattSmith Quote: Then, you have to hope somebody has made the codepage tables for your chosen encoding, or make it yourself like this -> I searched, but do not find some already defined. And if I deside to write it, should I write only number or? Because from your example it seems, that only positions or? Kirr Quote: Here is a table for converting cp-1251 into Unicode. -> I saw the table, but it only describes the position. I think that I should do the writing DanielH Quote: Nedjalko, look at my unicode example. It comes with a cyrillic font and prints Russian-English pairs. -> Actually everything began with it |
DanielH
Member #934
January 2001
![]() |
I used TTF2PCX to make the font. You just have to supply the min and max characters of the cyrillic font. Now that I think of it, I was using a font that only had cyrillic characters. |
Nedjalko Milenkov
Member #5,394
January 2005
|
I tried Monochrome from 0x20 to 0x7F and saved it as PCX, but the PCX was empty |
DanielH
Member #934
January 2001
![]() |
You have a bad ttf2pcx. Download Matt's http://www.allegro.cc/misc/ttf2pcx.zip Here's what you do. Create a font with characters from 0x20 to 0xff |
Nedjalko Milenkov
Member #5,394
January 2005
|
10x. I`v extracted the fonts fon 0x20 to 0x44F and the cyricllic font is fon 0x400 to 0x44F. How can I tell the grabber to extract |
DanielH
Member #934
January 2001
![]() |
What are you talking about? You have to use ttf2pcx and use a paint program to combine them. |
|
|