Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Help Installing Custom Fonts
Started by Jam Paraiso Oct 02 2013 12:22 AM

- - - - -
17 replies to this topic
font install custom help

Best Answer Develephant , 02 October 2013 - 04:41 AM

I ran a test with the Krabby Patty font and I can confirm that it does not work on Android.  Unfortunately there is no way to make it work as some fonts are just not supported.

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Jam Paraiso

[GLOBAL: userInfoPane.html]
Jam Paraiso
  • Enthusiast

  • 98 posts
  • Corona SDK

Hello there,

 

My android phone doesn't install the custom font of my app, It works well on the simulator,, but when I build it, and install it, the font doesn't change, it shows the systemFont

 

I call the font like this

local fontStyle = "Krabby Patty" or "Arial" or system.nativeFont

I follow this one,

http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/

 

The name of my the font style is

Krabby Patty.ttf

 

Please help me,

Jam



[TOPIC: post.html]
#2

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

First you had font file in project folder in the same level as main (not on subfolders), right?

Second, what you have under fontStyls is logical 'true' not string. You test 'or' operation and stringa always return true! So it's as you asking: true or true. If you wanted to check if there is font of such name then first not this way and second you cannot check it -file must be in your .apk file so no need for checking.

[TOPIC: post.html]
#3

Jam Paraiso

[GLOBAL: userInfoPane.html]
Jam Paraiso
  • Enthusiast

  • 98 posts
  • Corona SDK

thank for replying piotrz55,

 

I tried it like this,

local fontStyle = "Krabby Patty"

 

doesn't work either.



[TOPIC: post.html]
#4

Alex@Panc

[GLOBAL: userInfoPane.html]
Alex@Panc
  • Corona Geek

  • 1,733 posts
  • Corona SDK

I'd suggest simply using this to call your font: 

 

local fontStyle = "Krabby Patty"

If it doesn't find your font it will default to the system.nativeFont, so no need to do that in code. Could you post your build.settings file?



[TOPIC: post.html]
#5

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,473 posts
  • Corona SDK

  Best Answer

I ran a test with the Krabby Patty font and I can confirm that it does not work on Android.  Unfortunately there is no way to make it work as some fonts are just not supported.



[TOPIC: post.html]
#6

Jam Paraiso

[GLOBAL: userInfoPane.html]
Jam Paraiso
  • Enthusiast

  • 98 posts
  • Corona SDK

thanks for the reply develephant,

 

Aw, then that answer's my problem then,,

too bad,, I like how Krabby Patty looks though



[TOPIC: post.html]
#7

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

Gimme font file and I will check it on Android in few hours



[TOPIC: post.html]
#8

Jam Paraiso

[GLOBAL: userInfoPane.html]
Jam Paraiso
  • Enthusiast

  • 98 posts
  • Corona SDK

Sorry piotrz for the reply, I've been doing many school works lately.

 

I got the font style from here,

http://www.dafont.com/krabby-patty.font

 

If it doesn't bother you can download it from there.

 

Thanks in advance,

Jam



[TOPIC: post.html]
#9

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

Worked out of the box for me. Both pc and Android

 

Just main.lua

local krabbyText = display.newText( "My new text in 'Krabby Patty' font", 25, 100, "Krabby Patty", 40 )

 

 

and "Krabby Patty.ttf" in project folder



[TOPIC: post.html]
#10

Alex@Panc

[GLOBAL: userInfoPane.html]
Alex@Panc
  • Corona Geek

  • 1,733 posts
  • Corona SDK

@piotr, I received an error in my tests as well. Can you provide your build.settings file and the code you used to call it? I'm intrigued as to how you got it to work!



[TOPIC: post.html]
#11

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

No other files, just main.lua and font file. Code is in post above.



[TOPIC: post.html]
#12

Alex@Panc

[GLOBAL: userInfoPane.html]
Alex@Panc
  • Corona Geek

  • 1,733 posts
  • Corona SDK

Fascinating... so it's just this line:

 

local krabbyText = display.newText( "My new text in 'Krabby Patty' font", 25, 100, "Krabby Patty", 40 )

Which Corona build are you using?



[TOPIC: post.html]
#13

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

2013.1202



[TOPIC: post.html]
#14

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

Check if this apk works for you

 

http://www.sendspace.com/file/z5pny0



[TOPIC: post.html]
#15

Jam Paraiso

[GLOBAL: userInfoPane.html]
Jam Paraiso
  • Enthusiast

  • 98 posts
  • Corona SDK

it doesn't work for me.. or is it the device itself has the problem? I'm using samsung galaxy tab 2 7.0 as a testing device..

Can you post the source code piotrz55?



[TOPIC: post.html]
#16

piotrz55

[GLOBAL: userInfoPane.html]
piotrz55
  • Contributor

  • 754 posts
  • Corona SDK

As I said: just main.lua with this one line and ttf file with font.
Checked on galaxy s3.

[TOPIC: post.html]
#17

joerijacobs

[GLOBAL: userInfoPane.html]
joerijacobs
  • Observer

  • 17 posts
  • Corona SDK

I have a same kind of issue with fonts on Android.

 

I have a .ttf file that i implement in my newText. If i run the app then in the simulator i can't see the font change but if i compile it and run it on my Android phone then it is the font that i want.

 

Maybe you can try to run it on your device, then i should work.

 

I think this issue has something to do with older laptops i think. I have a laptop from 2007 and before i could run the app in the simulator i had to update my openglide version because i didn't see images and buttons. I udated to the latest video drivers and that fixed this issue. Maybe this can help you.

 

Anyway, good luck with building an app. I started now 2 months ago with corona and it is a great platform and the coding is easy.

 

I noticed also the following issue on my system and that is that some fonts are working fine in the simulator and others don't. Both are .ttf files. That is something strange.



[TOPIC: post.html]
#18

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,613 posts
  • Enterprise

@joerijacobs before the simulator can use custom fonts, they have to be installed in the operating system. The simulator does not pick them up out of folder like the devices do.  This is a limitation of Windows and OS-X.  Just double click on the font to install it, then restart Corona SDK and you should see your fonts in the simulator.




[topic_controls]
[/topic_controls]