i have this same problem as well… did you ever find a solution?? [import]uid: 39086 topic_id: 2289 reply_id: 50520[/import]
Hello,
I’m running into issues embedding custom fonts here as well. I followed the sample that is in the documentation (with Harrowprint, which I downloaded from the link provided in the sample code), and the custom font just won’t display. I’ve copied the code to the letter, and made sure every file is in its proper place before running.
Are custom fonts just not working right now?
Thanks!
Logan [import]uid: 44896 topic_id: 2289 reply_id: 66594[/import]
^I wonder the same as above. Anything changed on r704?
My font is being found (checked that names match), but is not loaded by the simulator. In Android it’s not loaded (nor is it in the list of fonts).
I tried a bunch of “tricks”:
- Putting font in root dir (obvious)
- Installing font in Windows (for simulator to see it, it still fails to load it though it is in fonts list)
- Change font extension from OTF to TTF (including removing it)
- Testing both font name and font names match, and also tried with filename(both with and without extension on both Android and simulator
- Simplifying font name with FontForge (actually, it was simple already but I changed to an 8 letter lower case name)
Probably irrelevant, but in a pure Android version of the app, the font is loadable, but I guess Corona uses different font loading code.
Any more ideas? Or shall I submit as bug report? I would normally just select a working font but I’m on a short deadline and client specifically wants this font. [import]uid: 58849 topic_id: 2289 reply_id: 85931[/import]
Any new insights, tricks or tips on this topic? I’ve hit a wall to get my custom font to load on Android. It works on simulator (windows) and I’ve tried all mentioned variations, i.e. simplifying names, referencing file name vs. font name, ttf vs. otf, rebooting but no luck. [import]uid: 46570 topic_id: 2289 reply_id: 103837[/import]
I just gave up and embedded custom fonts for static strings into images and used system defaults for most dynamic strings, and had the font exported to BMF (bitmap font) for some dynamic strings where the difference in style was too distinct to be ignored.
I think, it’s just something in the font file that causes loading in Corona to silently fail for that font. If it’s possible, one can simply try replacing the font. However, my client had decided that that particular font should be used and I couldn’t explain why it wouldn’t work in Corona as opposed to Java Android. Tough luck.
[import]uid: 58849 topic_id: 2289 reply_id: 103856[/import]
Result! \o/
I did an experiment that maybe it wants the actual path and tried using the pathToFile-version form resoure-dir. This helped nothing, but using aLogCat I could see Corona gave an error about not finding the font. So I concluded Corona tries to load the font but fails silently (like people suggested).
Next attempt convert/resave the font file if that would help. FontForge that was recommended seemed like a major PITA in Windows so I tried Type Light and a couple of web tools. What gave results was
http://onlinefontconverter.com/
When I converted from .otf to .ttf, the tool changed the filename from the original, presumably to match the font metadata. Using this new file and name (without extension!) worked! Either that tool changes file format, or it’s the fact of file name matching internal metadata.
So to be clear
- Upload “OldName.otf” to site
- Save “NewName.ttf” to project root
- Use “NewName” as the font name in Corona
And all this is ANDROID! [import]uid: 46570 topic_id: 2289 reply_id: 104154[/import]
Thank you so much for this! It worked for me too! This is the first time I’ve ever been able to get a custom font to work on an Android device. [import]uid: 27965 topic_id: 2289 reply_id: 109147[/import]
That’s good to hear. This process worked for me on two fonts on both iPhone and Android. But that is to say “I got fonts to load”. The other font still did not render properly (had strange small T-letters). So the custom fonts is a bit touchy. [import]uid: 46570 topic_id: 2289 reply_id: 109415[/import]
I never got a good answer to my question a few years back about embedded text vertical alignment. Its fine in the simulator, but on the app its off by about 3-5px. Could this be the font ascender? And if it is, how can I fix this?
The best way is to probably put in an if statement to see if your on the simulator or device and provide some padding adjustment to the x, y of your text string.
I never got a good answer to my question a few years back about embedded text vertical alignment. Its fine in the simulator, but on the app its off by about 3-5px. Could this be the font ascender? And if it is, how can I fix this?
The best way is to probably put in an if statement to see if your on the simulator or device and provide some padding adjustment to the x, y of your text string.