[Solved]Don't show Chinese phrases (square sign instead) in Spanish project

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
bonnie_641
Regular
Posts: 134
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

[Solved]Don't show Chinese phrases (square sign instead) in Spanish project

#1 Post by bonnie_641 »

Hello everyone.
I have the following problem. It is about making a Spanish-Chinese, Chinese-Spanish dictionary.
The problem is that when I want to display on screen, for example,

Code: Select all

|---------------------|---------------|
|    Español          |   中文         |
|---------------------|---------------|
|        (...)         |  (... )       |
| Me gusta el pan     |  □□□□□   |<------ instead of  我喜欢面包 
|        (...)         |  (... )       |
|---------------------|---------------|
At first, I tried creating a project in Chinese language, but it does not recognize the accents of the Spanish language.

I don't know what I can do.
Thanks in advance.

PS: I'm using version 7.4.11
Last edited by bonnie_641 on Sun Mar 27, 2022 7:35 pm, edited 1 time in total.
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2415
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Don't show Chinese phrases (square sign instead) in Spanish project

#2 Post by Ocelot »

What fonts are you using for Spanish and Chinese texts?
< < insert Rick Cook quote here > >

User avatar
bonnie_641
Regular
Posts: 134
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: Don't show Chinese phrases (square sign instead) in Spanish project

#3 Post by bonnie_641 »

Ocelot wrote: Sun Mar 27, 2022 2:18 pm What fonts are you using for Spanish and Chinese texts?
Spanish font: Courgette-Regular.ttf
Chinese font: Hanyi Senty Candy-color.ttf
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2415
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Don't show Chinese phrases (square sign instead) in Spanish project

#4 Post by Ocelot »

And those are used for Spanish and Chinese text respectfully?

Check, using style inspector (Shift+I while hovering over text) if those fonts are really used for broken text, and nothing overwrite it.
< < insert Rick Cook quote here > >

User avatar
bonnie_641
Regular
Posts: 134
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: Don't show Chinese phrases (square sign instead) in Spanish project

#5 Post by bonnie_641 »

Here is the solution (thanks Ocelot):

Code: Select all


# A character is defined who will use Chinese as a base language.
init:
    $ Lili = Character(None, who_language = "schinese", what_font = "font/SourceHanSansLite.ttf", what_size=30)
 
# A character is defined who will use Chinese as a base language.
    style ruby_style is default:
        size 12
        yoffset -20

    style say_dialogue:
        line_leading 12
        ruby_style style.ruby_style

# I will check if the Chinese language can be applied in a variable
default tense = "悪因悪果"


label start:

    show screen prueba_chino

# In this section I check if the Chinese language interferes with the Spanish language.
Note: If the Character is None, it works otherwise it will give error. 
# Don't forget that I defined Lily as a character who will use the Chinese language.
    Lili "你好"
    "Compruebo que el español funciona: inclusive el acento para á, é, í, ó ú"
    "¡Funciona!"
    "Nota: sólo funciona si Character es None."
    "Fin <3"
    Lili "{rb}東京{/rb}{rt}Tokyo{/rt}" #<----- example by PyTom in Ren'py's old wiki
    
# In the screen prueba_chino, you can apply the Chinese font by using "{font}{/font}"
screen prueba_chino:
    vbox:
        frame:
            label "{font=font/hanyi.ttf}你好{/font}" xpos 0.5 ypos 300
            text "{font=font/hanyi.ttf}你好{/font}" xpos 0.5 ypos 300+52

# And now, will it work with a variable? The answer is YES, but you have to call the character Lili to display the hanzi
label onii: # Example by Gas
    Lili "Beware of this: [tense]"
    #Lili "día con {font=font/hanyi.ttf}[tense]{/font}" <------- Mixing Spanish and Chinese in the same sentence does not work.
    $ tense = 'Evil cause, evil effect'
    Lili "Well, I was meaning: [tense]"

I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]