Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Font looks different in simulator and phone
Started by DevilDev Sep 18 2019 01:16 AM

8 replies to this topic
font simulator phone test
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

DevilDev

[GLOBAL: userInfoPane.html]
DevilDev
  • Enthusiast

  • 77 posts
  • Corona SDK

In my game,font looks different on simulator and mobile.I put the same specifications of phone (Honor 9i) in simulator.But the phone output (font) is weird.

In simulator:

Attached File  D2.PNG   11.25KB   0 downloads

 

In phone:

Attached File  Doubt.jpg   14.91KB   0 downloads

 

My config.lua file

application = 
{
	content = 
	{ 
		fps = 60,
		width = 320,
		height = 480,
		scale = "letterbox",
		xAlign = "center",
		yAlign = "center",

		imageSuffix =
		{
			["@2x"] = 2.000,
			["@4x"] = 4.000
		}
	}
}

What could be the problem?

 

 

 



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 944 posts
  • Corona SDK

Seems to me that the font isn't loaded and that Corona defaults to default system font.

 

The filenames are cAsE SeNsItiVE on Android, so make sure that the filename in code matches exactly to the file in the project folder, this includes the file type, e.g. ".TTF" vs ."ttf".


  • roaminggamer and DevilDev like this

[TOPIC: post.html]
#3

DevilDev

[GLOBAL: userInfoPane.html]
DevilDev
  • Enthusiast

  • 77 posts
  • Corona SDK

Font spelling is correct. I checked it.
I think that phone forces its default font
in all apps.Is there any way to resolve this?

[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,207 posts
  • Enterprise

Can you share some code where you're creating the text with custom fonts?

 

Rob



[TOPIC: post.html]
#5

DevilDev

[GLOBAL: userInfoPane.html]
DevilDev
  • Enthusiast

  • 77 posts
  • Corona SDK

Code is here

    local gameTileText = display.newText(sg, "Color Blast", xc, 100, "a.ttf", 90)

    local tapToStartText = display.newText(sg, "Tap to start", xc, yc, "a.ttf", 30)



[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 944 posts
  • Corona SDK

Just to be thorough, would you add this piece of code anywhere in your project:
 

local path = system.pathForFile( "a.ttf", system.ResourceDirectory )
local fhd = io.open( path )
print( fhd )

Do you get an error or a warning message like this: "WARNING: case of filename '...long path name.../a.ttf' differs on disk", or do you just get a print that reads something like "file (6CA1E080)"?



[TOPIC: post.html]
#7

DevilDev

[GLOBAL: userInfoPane.html]
DevilDev
  • Enthusiast

  • 77 posts
  • Corona SDK

 

 

Just to be thorough, would you add this piece of code anywhere in your project:
 

local path = system.pathForFile( "a.ttf", system.ResourceDirectory )
local fhd = io.open( path )
print( fhd )

Do you get an error or a warning message like this: "WARNING: case of filename '...long path name.../a.ttf' differs on disk", or do you just get a print that reads something like "file (6CA1E080)"?

 

This is the output
file (6FC7E080)


[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,207 posts
  • Enterprise

Is that output from the simulator or from the app running on device (using "adb logcat" to get the device's console log)?



[TOPIC: post.html]
#9

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 944 posts
  • Corona SDK

I'd go with Rob's suggestion and check out what adb logcat tells you.

 

At this stage, my guess is that the font you are using is invalid/bugged/broken/etc. and fails to load on Android. I'd suggest trying another font.




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: font, simulator, phone, test