Converting Bitmaps to TTF


#1

Hi all,

I’m looking for a way to convert Android Bitmaps into a TTF file.
My general intention is to have a Bitmap for every font and from that generate a TTF file using Juce/JNI/ANDROID-NDK.
I was wandering if this approach might work - and if so,
can someone give me any *pointers on how to accomplish this.

Millo


#2

Hi,

I’m trying to load a ttf file from the SD card by using this flow:

String filePath("path_to_ttf_file"); File ttfFile(filePath); FileInputStream input(ttfFile); ReferenceCountedObjectPtr<CustomTypeface> m_typeface = =new CustomTypeface(input);

When debuging I see that input.getTotalLength() is showing the right size of the TTF file - so no problem here I guess,
but the CustomTypeface constructor reading the input stream is getting nothing on
the name field and the numChars = 0.

Looking deeper into the CustomTypeface constructor I see that it uses GZIPDecompressorInputStream to decompress
the file.
Why would it assume that the FileInputStream always needs to be decompressed?
My original file is not zipped in any way.

What am I missing here ?


#3

/** Loads a typeface from a previously saved stream. The stream must have been created by writeToStream(). @see writeToStream */

Like the comment says, it loads data that was created using writeToStream(), not TTF file data.