home-assistant / Iconic

:art: Auto-generated icon font library for iOS, watchOS and tvOS
Apache License 2.0
1.58k stars 86 forks source link

Getting 'No Icon found' #29

Closed enzosv closed 7 years ago

enzosv commented 8 years ago

I created a font using fontastic.me, installed with the .ttf file and all the SwiftGen generated Icon file has is import UIKit and a comment that says 'No Icon found'. I've tried it using FontAwesome's .ttf file and it works properly. Is there something I'm missing when creating the font or installing the pod?

enzosv commented 8 years ago

Also, I got it to work by editing the FontawesomeIcon.swift generated for fontawesome. I replaced the enum, iconmap and NSStringFromIcon function to accomodate my custom font. So maybe the problem is with SwiftGen?

dzenbot commented 8 years ago

The "No Icon Found" label is generated from the SwitGen custom stencil when the font parsing fails

Could you please share your custom fontastic font? I can then debug your use case and find the root cause for you. Thanks!

aloksahay commented 8 years ago

I'm having exactly the same issue. Created a font from fontastic.me, followed the steps exactly as suggested on http://rafaltomal.com/how-to-create-and-use-your-own-icon-fonts/

I've attached the font file in a zip, the first character was created by me, others are just taken from some collection on Fontastic. fontalok.ttf.zip

connectdotz commented 8 years ago

one of the possible causes of "icon not found" is when you pass in a "relative path" in FONT_PATH when doing pod update/install, as i learned earlier, since SwiftGen working path is not the same as the git root path. If that is what happened, just use the absolute path for the FONT_PATH.

dzenbot commented 8 years ago

@connectdotz: that's what I first though too, but after running the special pod install command with an absolute path to this sample font, no glyph are parsed...

Iconic uses a custom version of Swift right now. Will run a few tests in there and see why the parsing is breaking. Most likely, these fonts are not adding the icon glyphs in the PUA range.

whisper-bye commented 8 years ago

@dzenbot +1 // No icon found http://demo.amitjakhu.com/dripicons/

dzenbot commented 8 years ago

Cool. Will try with those one too. Thanks.

connectdotz commented 8 years ago

@dzenbot , after running "fontalok.ttf", I believe the problem is the same as #27. I tested this font with the updated IconsFileParser.swift and it generated 5 enum as expected. I will submit a PR later today.

connectdotz commented 8 years ago

@dzenbot I submitted the PR 13 days ago, but since it is in a submodule, the PR is in DZNLabs/SwiftGen, in case you haven't seen it...

dzenbot commented 8 years ago

Hey @connectdotz, sorry about that, but I haven't had the time yet. I will review it all very soon!

josefdolezal commented 8 years ago

Hey, just tried 1.0.0b3 with our custom font and still getting 'No Icon Found'.

My Podfile:

target 'iconictest' do
  use_frameworks!

  # Pods for iconictest
  pod 'Iconic', :git => 'https://github.com/dzenbot/Iconic.git', :submodules => true

end

Installation:

// I am sure that font at this path exists
FONT_PATH="$PWD/iconictest/Resources/Fonts/test.ttf" pod update Iconic

Including also my .ttf file generated by http://fontastic.me FontTest.ttf.zip

dzenbot commented 8 years ago

@josefdolezal: Will try and give it a look soon!

josefdolezal commented 8 years ago

@dzenbot: I was debugging the problem today and found out I have to install font on the system (which I haven't). Don't know why but I thought it is no longer required.

dzenbot commented 8 years ago

Oh really? That solved it? That should not be the case, as I've ran Iconic without installing and worked.

Haven't had time to look at this yet, but I really want to solve this. Maybe add more logs from SwiftGen to diagnose better what's going on.

josefdolezal commented 8 years ago

Yep, definetely. Getting No Icon Found again when removing font from Font Book.

Looks like this early return is fired

guard let cgFont = CGFontCreateWithFontName(fontName) else { return }

in IconsFontFileParser.

connectdotz commented 8 years ago

That looks like the old code, please make sure you have the latest SwiftGen master branch that should have fixed it ...

josefdolezal commented 8 years ago

You are right, I was few commits behind master.. Now all enums are generated as expected. But I am still unable to get get same result with cocoa pods. Looks like Iconizer cocoa pods chekouts ffcdf4e revision as I did. Any tips?

connectdotz commented 8 years ago

the submodule needs to be updated explicitly in the Iconic master branch.... Maybe @dzenbot can do this? Mean while, you can try git submodule update --init in your own fork, although I haven't verified if that solved the problem... If it worked, maybe you can submit a PR that will make everybody's life easier...

dzenbot commented 7 years ago

This should now be fixed thanks to https://github.com/dzenbot/Iconic/pull/50 I will soon provide a new beta release.

ravipxm commented 7 years ago

Using 1.3 version,

I have done everything but still getting No fonts found error.

Pod file

target 'event-swift' do

use_frameworks! pod 'LGSideMenuController' pod 'Iconic', :git => 'https://github.com/dzenbot/Iconic.git', :submodules => true

Pod Command FONT_PATH='/Users/ravimodha/Downloads/cds-scout/fonts/cds-scout.ttf' pod install --verbose

Please help to resolve this.

dzenbot commented 7 years ago

@ravipxm can you attach the cds-scout.ttf file?

ravipxm commented 7 years ago

@dzenbot thanks for replying. Following is the url from where you can download the font file.

https://drive.google.com/file/d/0By3bDr-TnOBMbFplYmVRSE5DX1U/view?usp=sharing

ravipxm commented 7 years ago

@dzenbot

Any updates on this issue.

Thank You

dzenbot commented 7 years ago

@ravipxm is this font custom designed? Seems like the unicodes being used are Basic Latin's. Instead, the unicodes to be mapped need to be under the PUA range (Private Use Areas). Iconic needs that specific range to be used on the fonts, to scan and retrieve that data accordantly.

ravipxm commented 7 years ago

@dzenbot

Thanks for replying. I am using fontastic font file only.

ravipxm commented 7 years ago

@dzenbot

I got it what you said and i have tried that solution and it's working

Thanks alot

dzenbot commented 7 years ago

That's good to know! 💪