I found out the answer to my own question through experimentation.
Thanks to all who looked into this.

The short answer is that there was something wrong with my TrueType
outlines; I suspect they were too large for Android to render.  I was
clued in on this when I ran an application using a custom font I'd
designed and noticed, at a large point size (60 points) that the
bottoms of the letters were being cut off.  I created another custom
font with a smaller design grid size (500x500 points vs. 720x720
points) and that fixed the problem.

One of the cues that tipped me off to the problem was that when I
double-clicked on my original TTF file, which was just the numbers 0
to 9, the type sample that normally reads "The quick brown fox jumps
over the lazy dogs" read "000 00000 00000 000 00000 0000 000 0000
0000".  Rubbish.  If a TrueType font is correctly designed, that test
phrase should be readable even if it's in Windows' system font.

So when I designed a new font with a 500x500 point area, and exported
the vector outlines from Corel Draw (that's what I used, believe it or
not; it works very well), while the numbers 0 to 9 appeared in my new
font style, I could still read the system font for the test phrase.
And when I installed the font to my assets/fonts folder and ran the
application, lo and behold - the test number string "12345" appeared
in my newly designed font.  Hurrah!

By the way, for anyone wondering the simplest way to use a custom
font, it's to define a TextView and then use the setTypeface method,
thus:


        someFont = Typeface.createFromAsset(this.getAssets(),
                "fonts/yourCustomFont.TTF");

        txtMsg = (TextView) findViewById(R.id.txtMsg);

        txtMsg.setTypeface(someFont);
        txtMsg.setText("12345");


Just don't forget to create a "fonts" folder under "assets" in your
project and then copy the TTF file into that folder.

I learned this technique from 
http://modmygphone.com/wiki/index.php/Using_Custom_Fonts.
Give it a look.

Cheers,
Charles


On Dec 11, 2:58 pm, illiniwatcher <[email protected]> wrote:
> To all:
>
> I've noticed that Android lets developers include their own TrueType
> fonts, by way of the assets\fonts folder.  This is a great feature,
> and works well.
>
> But I notice that if I copy one of my own homemade TrueType fonts -
> created using CorelDraw's export function - any text I render in that
> font comes out as the Android system default font rather than in the
> font I've just included.
>
> Is there something the Android environment looks for in TrueType or
> *.TTF files - a digital signature, a certain character, something -
> that would cause a homemade font file's outlines to be ignored?
>
> The TTF files I've created only have a subset of the entire character
> set, usually consisting only of numbers and symbols.  The TTF file
> works just fine in major applications like Microsoft Office (even the
> latest one) and Adobe Photoshop.  Can any of the Android developers
> comment?
>
> Thanks,
> Charles
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to