In case someone is interested, here is what I figured out: Adding fonts to the SDK allows them to be viewed in the browser. Also, applications can use them directly without having to load the font from an asset.
1) Add the font file android_1.5r2/frameworks/base/data/fonts/Comic.ttf 2) Add the font file to the build android_1.5r2/frameworks/base/data/fonts/Android.mk copy_from := \ ... DroidSansMono.ttf \ Comic.ttf 3) Let the font engine know the font exists. Each font file needs its own family. android_1.5r2/external/skia/src/ports/SkFontHost_android.cpp static const char* gMonoNames[] = { "monospace", "courier", "courier new", "monaco", NULL }; static const char *gComicNames[] = { "comic sans ms", NULL }; note: "comic san ms" for when the font is referenced by it's real name, e.g. browsing the web { "DroidSansMono.ttf", gMonoNames }, { "Comic.ttf", gComicNames }, At this point the font is available to the browser, as it will try to reference it by it's name. Additional steps are needed to make the font availble to your new android applications 4) Add an entry in the Typeface class, this creates Typeface.COMIC android_1.52/frameworks/base/graphics/java/android/graphics/ Typeface.java public static final Typeface MONOSPACE; public static final Typeface COMIC; MONOSPACE = create("monospace", 0); COMIC=create("comic sans ms", 0); At this point, you can set the font with java code: TextView tv = (TextView) findViewById(R.id.text); tv.setTypeface(Typeface.COMIC); 5) Add an entry for the xml parser android_1.5r2/frameworks/base/core/res/res/values/attrs.xml <attr name="typeface"> .. <enum name="monospace" value="3" /> <enum name="comic" value="4" /> </attr> 6) Link the xml value to the Typeface class android_1.5r2/frameworks/base/core/java/android/widget/TextView.java private static final int MONOSPACE = 3; private static final int COMIC = 4; private void setTypeFaceByIndex(int typefaceIndex, int styleIndex) ... case MONOSPACE: tf = Typeface.MONOSPACE; break; case COMIC: tf = Typeface.COMIC; break; } At this point, you can set the font using xml attributes: <TextView android:typeface="comic" android:text="Hi Mom!" /> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---