joypixels / emojione

[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
https://www.joypixels.com
Other
4.46k stars 532 forks source link

native typeface cannot be made #252

Open ayalma opened 8 years ago

ayalma commented 8 years ago

i faced with this issue in android api 17 when i want to use emojione.ttf as custom font .

caseyahenson commented 8 years ago

@ayalma where are you storing the .tff? This sounds like it could be a build issue either related to asset location or, less likely, an issue with system memory.

ayalma commented 8 years ago

İ pasted font in asset/fonts folder

This not the real problem, I think. cuz my app worked in api23 emulator and api19 tablet but in api17 huawei g730 don't worked On May 17, 2016 7:54 PM, "Casey A Henson" notifications@github.com wrote:

@ayalma https://github.com/ayalma where are you storing the .tff? This sounds like it could be a build issue either related to asset location or, less likely, an issue with system memory.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/Ranks/emojione/issues/252#issuecomment-219753295

ghost commented 8 years ago

@ayalma I have same problem , do you find any solution ?

ayalma commented 8 years ago

Not yet. On May 19, 2016 10:52 AM, "farzad farazmand" notifications@github.com wrote:

@ayalma https://github.com/ayalma do you find any solution ?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/Ranks/emojione/issues/252#issuecomment-220237769

caseyahenson commented 8 years ago

While I'm looking into this, can you let me know a couple of things which will help in my debugging? I apologize if they're over simplistic: 1.) Are you calling setTypeface before or after calling setContentView? 2.) Are you still getting the error after cleaning and rebuilding the project? 3.) Can you show me the line where you're defining your font? Thanks!

ayalma commented 8 years ago

No mind. 1) I'm using typeface in android RecyclerView in adapter class in onBindViewHolder method.

 @Override
    public void onBindViewHolder(EmojiItemHolder holder, int position) {

        Typeface myTypeface = TypefaceUtil.getTypeFace(holder.itemView.getContext(), "emojione.ttf");

        if (myTypeface!=null)holder.etv.setTypeface(myTypeface);
        holder.etv.setText(Util.getEmijoByUnicode(start+position));
    }

2 ) yes i do clean and rebuild. 3) I created the util class for that. with this code.

public class TypefaceUtil {

    private static HashMap<String,Typeface> fontCache;

    static {
        fontCache = new HashMap<>();
    }

    public static Typeface getTypeFace(Context context,String path)
    {
        Typeface tf = fontCache.get(path);
        if (tf == null)
        {
            try {
                tf =  Typeface.createFromAsset(context.getAssets(),path);
                fontCache.put(path,tf);
            }
            catch (Exception e)
            {
                  //
            }
        }
        return tf;
    }
}
jfkthame commented 8 years ago

This not the real problem, I think. cuz my app worked in api23 emulator and api19 tablet but in api17 huawei g730 don't worked

Could this be an issue with the versions of freetype in the different environments? Color font support in freetype is relatively new; maybe the freetype lib in the api17 device is too old to include it. IIUC, api17 is JellyBean, but color font support first shipped in KitKat....

ayalma commented 8 years ago

So what can i do with that? On May 31, 2016 2:27 PM, "jfkthame" notifications@github.com wrote:

This not the real problem, I think. cuz my app worked in api23 emulator and api19 tablet but in api17 huawei g730 don't worked

Could this be an issue with the versions of freetype in the different environments? Color font support in freetype is relatively new; maybe the freetype lib in the api17 device is too old to include it. IIUC, api17 is JellyBean, but color font support first shipped in KitKat....

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ranks/emojione/issues/252#issuecomment-222644293, or mute the thread https://github.com/notifications/unsubscribe/AO-VRKqOufaaKcitwBBYSvFSqy-nZqy6ks5qHAX8gaJpZM4IfrIl .

jfkthame commented 8 years ago

If my guess as to the problem is correct (you might want to check what version of FreeType you've got; it looks like at least FreeType 2.5 is required for color bitmap support), then there would appear to be two main options:

(a) update to Android KitKat or later (i.e. a version with color-font support); or

(b) forget about using the system text rendering (at least for the emoji characters) and implement your own code to render the glyphs you want.

caseyahenson commented 8 years ago

@ayalma Have you had any luck getting this resolved?

ayalma commented 8 years ago

No On Jun 5, 2016 11:50 PM, "Casey A Henson" notifications@github.com wrote:

@ayalma https://github.com/ayalma Have you had any luck getting this resolved?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ranks/emojione/issues/252#issuecomment-223831750, or mute the thread https://github.com/notifications/unsubscribe/AO-VRMLucasYGspp_j__YRQElJYrpLYkks5qIyFlgaJpZM4IfrIl .

13rac1 commented 8 years ago

FWIW Signal uses it's own emoji rendering system to avoid this issue: https://github.com/WhisperSystems/Signal-Android Note the GPLv3 license, if your project isn't GPLv3 don't look at the code. Haha! 😉

grote commented 8 years ago

I have the same issue and it looks like only Android 6 upgraded freetype to a version that supports color emoji. More details here.

So it looks to me that this is unfortunately an issue that can not be solved within the scope of emojione.