Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Displaying Chinese,Hebrew ,or any other fonts. — Gideros Forum

Displaying Chinese,Hebrew ,or any other fonts.

zoolaxzoolax Member
edited January 2013 in General questions
How can show foreign fonts in Gideros?

I came across these discussion.

http://www.giderosmobile.com/forum/discussion/2132/what039s-the-best-way-to-show-any-unicode-character

--I could not use this,It does not support Arabic(since it goes from right to left,it looks fragmented ) and Cantonese fonts(shows squares)
http://appcodingeasy.com/Gideros-Mobile/Localization-in-Gideros

--Keep in mind
Examples:
--goes from right to left
تنظیمات جستجو · تاریخچه ی شبکه. فار

-- or cantonese
广州话 or 廣州話
-------------------------------------------
So correct me if I am wrong ,
1.So as long as I copy and paste all the
required alphabet(Cantonese,arabic,german,..)
into the Gideros Font Creator and export it ,then I should be fine.
2.Then I can create a
--Arabic.lua class
Arabic = {}
Arabic.line 1 = "تنظیمات جستجو · تاریخچه ی شبکه. فار"

return Arabic
------------------------------------------
Then later can I print this out?in my main.lua

local Arabic = require("Arabic")
--do the text api function to show Arabic.line 1

Am I doing the right thing here?

Also any chance any of you know a good source to find different type of alphabets(different languages) for copying and pasting?so far all I can find is images.

Thanks again in advance,off the topic I have been really amazed by Gideros speed.
That what makes it so attractive for me.Very very smooth.
And it is far more amazing knowing it is done only by one person.
And for me you will see me around a lot asking lots of question,since I am new to this framework.
Thanks again
www.zoolax.com

Comments

  • Yes i would like to know better way to display arabic (complex script language) in Gideros as well. Let's ask @atilim
    have fun with our games~
    http://www.nightspade.com
  • john26john26 Maintainer
    You shouldn't have to copy/paste characters. Rather you should get hold of a true type font (TTF file) which contains the characters you are looking for. But there may be an issue of copyright...?
  • john26john26 Maintainer
    Accepted Answer
  • @john26
    That is exactly what I were looking for.
    The files seems very small which is good.29 kb for example.

    I did not mean just copy and paste it any where,what I meant to paste the alphabets into restore default in Gideros text editor .
    And there is a step after that,that I will look into.
    I have seen @atilim did it somewhere and it worked.
    Thanks
    www.zoolax.com
  • john26john26 Maintainer
    Not sure what you mean by restore default. My version does not have this. Are you referring to font creator?

    If you have a TTF font you need to do this:
    myfont=TTFont.new("fontfile.ttf",number,true)
    Textfield.new(myfont,"Hello, World!")
    I'm not sure what value to use for "number" however...
  • zoolaxzoolax Member
    edited January 2013
    Ok I found solution to my own problem,
    This include any language,Arabic, Chinese , any thing.

    1.Find a ttf file of that language.(that is the hardest part for me,
    if you have any better resource let me know.)

    2.In this case right click on ttf and install it(in windows).

    3.open Microsoft Words(Well I hope you have this software).
    Find the font in the font type drop down at the top.
    select the font and write something.

    4. Use Gideros Font Creator,use the TTF create text and png from it.

    5. Now you have to write first in the Microsoft word,
    and when it is ready ,just copy and paste it into your lua file.
    (it will shows up as random English fonts when you paste it)

    6.But when in Gideros player it show up correctly,even Arabic words.
    so that is the best solution I came up with:)

    I have attached an example.
    Cheers
    example.jpg
    1542 x 1040 - 397K

    Likes: Nascode, hosamred

    www.zoolax.com
    +1 -1 (+2 / -0 )Share on Facebook
  • john26john26 Maintainer
    @zoolax: Looks like you've found a good way to do it. However, you can display TTF fonts directly in Gideros so in principle Step 4 is not necessary. There are pros and cons to TTF versus bitmap fonts but not sure what they are..?

    It's a shame the text shows as garbage in Gideros Studio. Perhaps if you tried TTF fonts instead this would work better. I think you will need TTF fonts for Chinese as there are simply too many characters to make a PNG.

    Would any devs like to comment?
  • NascodeNascode Guru
    edited January 2013
    @zoolax thanks for your solution, could you tell us more what did you paste into Gideros Font Creator chars dialog to support Arabic?
    have fun with our games~
    http://www.nightspade.com
  • @john26 basically Bitmap font is faster, it is as prerendered characters. But since there will be a fontcache implemented, I think they will be the same from performance stand of point.

    But then the difference is in you as developer. TTF support allows you to use all those created fonts that already exist and BitmapFonts would allow you more easily create your own font (either from scratch or by modifying existing font)
  • zoolaxzoolax Member
    edited January 2013
    @Nascode
    Basically you have to get your translator to use the same TTF in microsoft words.
    Then copy and paste it ,from microsoft words into the gideros,
    It all shows up as numbers,but when you display it ,it will show up correctly.
    www.zoolax.com
  • john26john26 Maintainer
    Any devs care to comment on this? Although Zoolax's idea works it is not ideal to have text "showing up as numbers" in the Gideros IDE. I guess it's because the font used by the IDE is a simple western font with no foreign characters..? But in the past, @atilim has posted screenshots with Chinese characters in the IDE...
  • atilimatilim Maintainer
    edited January 2013
    Hi,

    Although we don't support for right to left languages, we support for Chinese, Japanese,
    Cyrillic, Hebrew, etc. You just need to find the correct font.
    scr.png
    1187 x 783 - 121K
    scr.png 121.1K
  • jdbcjdbc Member
    edited June 2013
    My solution for use japanese and chinese fonts is to use Droid TTF Fonts.

    They are free and included in Linux distribution and their size are not too much.
  • chipster123chipster123 Member
    edited January 2014
    @jdbc, do you mean the DroidSansFallback.ttf font to display Chinese?
  • jdbcjdbc Member
    edited January 2014
    @jdbc, do you mean the DroidSansFallback.ttf font to display Chinese?
    Yes, I use DroidSansFallback.ttf font to display Russian, Korean, Japanese and Chinese.

    I define two functions getString(key) to recover translation from key in the current language of the device and getTTFont(font, size, size2) where font is common font for English, Spanish, German, French, Italian, Portuguese...
    current_language = application:getLanguage()
    local strings = {
    	en=en,
    	es=es,
    	de=de,
    	fr=fr,
    	it=it,
    	pt=pt,
    	ko=ko,
    	ru=ru,
    	ja=ja,
    	zh=zh
    	}
     
    local en = {
    				title = "Mygame",
    				play = "Play",
                                    game_over = "Game over"
    				}
     
    local es = {
    				title = "Mi juego",
                                    play = "Jugar",
                                    game_over = "Fin del juego"
    				}
    ...
     
    function getString(key)
     
    	local language = strings[current_language]
    	if not language then
    		language = strings[default_language]
    	end
     
    	local value = language[key]
    	if value then
    		return value
    	else
    		return key
    	end
    end
     
    -- Return TTFont depending on language
    function getTTFont(font, size, size2)
     
    	local option_ttf 
    	if (current_language == "ko" 
    		or current_language == "ru"
    		or current_language == "ja"
    		or current_language == "zh") then
     
    		local special_size = size2 or size
    		option_ttf = TTFont.new("fonts/DroidSansFallback.ttf", special_size)
    	else
    		option_ttf = TTFont.new(font, size)
    	end
     
    	return option_ttf
    end
Sign In or Register to comment.