Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I modified the library to be easier to add new TrueTrype files:
Now there are two classes, TypefaceManager and IconicFontDrawable
package com.atermenji.android.iconicdroid;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Hashtable;
import android.content.Context;
import android.content.res.Resources.NotFoundException;
import android.graphics.Typeface;
import android.util.Log;
class TypefaceManager {
}
/*
*
*
*/
package com.atermenji.android.iconicdroid;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
//import com.atermenji.android.iconicdroid.icon.Icon;
/**
*/
public class IconicFontDrawable extends Drawable {
// private Context mContext;
// private Font mIcon;
private char[] mIconUtfChars;
// mContext = getContext().getApplicationContext();
IconicFontDrawable(Typeface typeface, int utfValue) {
this();
updateIcon(typeface, utfValue);
}
// if (mIcon != null) {
final Rect viewBounds = getBounds();
// }
}
}
}
To use jut put the .ttf file(s) inside res/raw and, in Eclipse, choose Project->Clean... option.
IconicFontDrawable drawable = IconicFontDrawable.getDrawable(mContext, R.raw.roboto_bold, '$');
// you also can use the hex value of the character instead of a char as the second argument.