how to read and interpret TrueType Font files...

Go To Last Post
66 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hhm... does anyone know how to do this?
I want to have ttf files in my sd card and be able to read off using micro and then store the font in an array, if thats at all possible?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are aware that TTF are "glyph-based" outline fonts? Eg a more or less mathematical description of how the different parts of a character is to be drawn. Not a bitmap/raster-thingie of any sort at all.

There is substantial computations going on when drawing something with a TTF - not something you'd want to do on an AVR id you ask me. If you want a bitmask font that is a copy of a TTF at a certain size, then that might be doable.

More on the subject: http://en.wikipedia.org/wiki/Tru...

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ouch so ttf is a run time thing...
i was thinking ttf because of portability.
essentially what I want to be able to do is for me to place the font file in the memory card...atmega/uc3a then reads from sd card the file and converts to a bitmap/raster type and holds the hole alphabate in an array and calls the letters as the need comes during the run time of the program.

if its possible to compute raster type from truetype during the initialisation (after the chip starts) then thats fine...so computation is not an issue. because during run time codes will call the stored array from SRAM for the letters....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

check out FreeType for an open source TrueType rasterizer written is ANSI C :

http://freetype.sourceforge.net/...

It has no external dependencies, and will just ouput a byte array of the render.

I wouldn't be too worried about the execution speed though, but rather the code size needed to render the fonts.

Quote:

The TrueType Bytecode Interpreter

The reason why TrueType fonts can render so beautifully at small pixel sizes comes from the way glyph images are described and processed according to the TrueType specification.

* Each glyph image is stored in a TrueType font file as a simple scalable outline (built from line segments and quadratic Bézier arcs), to which is associated an array of bytes, called the glyph program.

* The glyph program really contains a series of program instructions, written for a specific virtual machine (the TrueType VM), defined in the TrueType specification.

The TrueType VM is heavily designed towards the processing of geometric shapes. For example, it contains instructions to move points, measure distances, align points to the pixel grid, etc.

* When a glyph needs to be rendered at a specific pixel size, its outline is loaded and scaled linearly to the current device space. Its glyph program is fed to a bytecode interpreter that executes it.

The glyph program knows about the current pixel size, and adjusts the glyph outlines to the font designer's intent in order to produce the best possible bitmap – at least in theory.

I imagine you can fit quite a few pixelfonts in flash for the amount of code required to render them at runtime.

Check out http://www.dafont.com/bitmap.php for loads of free pixel fonts..

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thygate wrote:
check out FreeType for an open source TrueType rasterizer written is ANSI C :

http://freetype.sourceforge.net/...

It has no external dependencies, and will just ouput a byte array of the render.

I wouldn't be too worried about the execution speed though, but rather the code size needed to render the fonts.

Quote:

The TrueType Bytecode Interpreter

The reason why TrueType fonts can render so beautifully at small pixel sizes comes from the way glyph images are described and processed according to the TrueType specification.

* Each glyph image is stored in a TrueType font file as a simple scalable outline (built from line segments and quadratic Bézier arcs), to which is associated an array of bytes, called the glyph program.

* The glyph program really contains a series of program instructions, written for a specific virtual machine (the TrueType VM), defined in the TrueType specification.

The TrueType VM is heavily designed towards the processing of geometric shapes. For example, it contains instructions to move points, measure distances, align points to the pixel grid, etc.

* When a glyph needs to be rendered at a specific pixel size, its outline is loaded and scaled linearly to the current device space. Its glyph program is fed to a bytecode interpreter that executes it.

The glyph program knows about the current pixel size, and adjusts the glyph outlines to the font designer's intent in order to produce the best possible bitmap – at least in theory.

I imagine you can fit quite a few pixelfonts in flash for the amount of code required to render them at runtime.

Check out http://www.dafont.com/bitmap.php for loads of free pixel fonts..

hhm... that seems pretty complicated :(
i might have to go just go with the pixel style stuff... its not so much about the space on flash...but more for user flexibility...so that user can load up new fonts in memory card and that way can change fonts being shown on LCD.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

its not so much about the space on flash...but more for user flexibility...so that user can load up new fonts in memory card and that way can change fonts being shown on LCD.

You can still do this, but have the user place bitmap fonts on the memory card instead..

You could go for the oldskool style font bitmaps with characters bound to a constant/predefined grid..

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

or it could be so much better if user could place windows ttf files in sd card and these were read by the micro then translated to bitmap like array in SRAM and displayed on LCD. the beauty of this is that only one ttf file need be stored in sd card. and depending on what size is required, the code could generate the pixel array during initialization of the chip. for any size of font only one ttf file is used.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well then, give FreeType a go, it contains all the necessary code in portable ANSI C, and has no external dependencies. It will give you a byte array of the rendered image.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok let me read try type font papers online a bit :(
i hate reading.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe you should develop PC application that browse available TTF fonts and let's user select them and render to bitmap files on SD card. If you like this idea then you should think about dealing with fonts licencing issue...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hhm.... these ttf files under windows/fonts folder are big!! around 400kBs.

hhm... looks like i realy need an external SRAM! :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unless you're going to display them on a high resolution colour LCD where antialiasing is possible, be prepared to be disappointed with the results. Most outline fonts are hinted, but they still tend to produce horrendous results at small pixel sizes, unless they're specifically made for tiny sizes.

XFree86 has an impressive set of equally ugly bitmap fonts. You may as well skip the entire raster-rendering phase.

The Dark Boxes are coming.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

ok let me read try type font papers online a bit
i hate reading.

Not a good attitude when it comes to learning stuff like software development etc. :roll:

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fonts are a pain in the backside.

8x8 font uses 8 bytes per letter, so most likely you only need the printable ASCII letters, you work with the range of 0x20..0x7F = 32..127, meaning 96 characters, taking 768 bytes. I think you may want to have some non-displayed characters for user characters, so I'd say 1 kilobyte for the font.

Awful lot of SRAM. Or afwully fixed font if in FLASH. Maybe it would be best to store pre-rendered images to SD card...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i have decided to go through http://17.254.2.129/textfonts/TT...

and do my own code :(
so i am going to read the ttf files and convert them to array that will be stored in SRAM (have 64K ram) during initialiation of the chip.

this ttf seem to have some strange datatypes.

does any know what "16.16-bit signed fixed-point number". and also some fractional numbers? how on earth we supposed to type these in avr??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

16.16 signed fixed point means you have a signed 32-bit integer but you just interpret high 16 bits as integer and 16 low bits as fractional number. Basically, it is the equivalent of having a decimal point in the middle, or if you would like to think about things differently, everything is scaled by 65536, so in real world, your value of 1.0 would be 65536 in AVR, and you can change the value in 1/65536 steps.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"16.16-bit signed fixed-point number" is called s15.16 in AVRFIX library (32 bits in total with 1 bit for sign, 15 bits for integer part, and 16 bits for fractional part).

http://sourceforge.net/projects/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

is there a std lib for this format in avr gcc? which header file?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

is there a std lib for this format in avr gcc?

If you mean in avr-libc then the answer is "no", but you noticed avra linked to a lib in his recent post?

There also was an initiative by AVRfreaks members earlier this year to actually get something like that into avr-gcc, but I haven't seen any traffic on that subject for a while: https://www.avrfreaks.net/index.p... ... de=results . This requires a re-build of the compiler avr-gcc and the run time library avr-libc.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

man this is harder than i thought :(
does anyone know of any other sources of codes for truetype to binary raster info conversion?? :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Using FontForge to convert to bitmaps is absolutely not an option? I seriously don't think you can easily render TTF on a microcontroller. This is like playing Quake on a Turing machine.

The Dark Boxes are coming.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

does anyone know of any other sources of codes for truetype to binary raster info conversion??

I must have missed something - what was wrong with the solution proposed by 'thygate'? Or did you think that some other implementation would be "less complicated"? (it won't be)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

This is like playing Quake on a Turing machine.

LOL!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do you insist on True Type fonts? If that is a must then OK, but you could make your job a lot easier if you give up on it and just use bitmap based ones.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i just want to give it some flexibility and modularity so that at any time if i decided all i have to do is dump the xxx.ttf file in the font folder of the sd card and the device will load with that type of font on LCD screen.

so far I have read the docs and have written out the truetype structs in c and header files.... now i am reading the documentation of FreeType, there seems to be some good info there.

I am still hoping to write some functions that will read the ttf file and generate an array (in SRAM) with the pixel data in it. which the micro will use during rendering of the screen during run time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hhm... there are some issues here. :(
each char may not have the same width and height. How do i deal with such variation? it would help if everything had same size and was able to just dump the array of pixels on screen!

another issue is that, I would like to only write th pixels and not the background. most LCDs have just window write and dump all pixels inside that window.

so it seems for every pixel i have to send x and y coord to the LCD and then write the pixel. :( slow :(

if I have to store these individual chars in varying size of pixel counts then how do you recommend i store them? an array for each char??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

each char may not have the same width and height. How do i deal with such variation?

Well, welcome to the world of proportional fonts. You either make the character cell large enough to hold the largest character (making the font non-proportional - and a font designed to be proportional will almost definitively look awful that way) or make your display system handle proportional fonts. Are you still sure you want to go down this path? I suspect there will be more complications dowwn the road..

Quote:

another issue is that, I would like to only write th pixels and not the background. most LCDs have just window write and dump all pixels inside that window.

You now need a display buffer in RAM, which will allow you to "OR in" the pixels you want to set. You then "dump" (parts of) this buffer to the display. It seems you are heading for a rather complex display system now...

Quote:

i just want to give it some flexibility and modularity so that at any time if i decided all i have to do is dump the xxx.ttf

Again, the alternative is to dump the xxx.ttf onto a PC application (that converts it and writes it to the memory card). In terms of usability I see little or no difference..

I made an experiment, taking the word "pixel" as it is displayed by AVRfreaks on my PC. To the left it is in its original proportional form, in the center it is monospaced with characters flush left in their cells, to the right monospaced with the characters centered in their cells. As you can see, neither of the two latter looks particularly good. Now are you starting to see what you've dived into? :wink:

.

Attachment(s): 

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Thu. Dec 17, 2009 - 01:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or stick to Courier New which is fixed pitch ;-)

Cliff

(who once wrote part of a WYSIWYG wordprocessor in Z80 Asm that used proportional fonts - an UTTER nightmare! http://web.ukonline.co.uk/cliff.... )

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Or stick to Courier New which is fixed pitch

And then we are back to ONE font, and
i) the thing discussed here is not necessary, and
ii) we could locate an "old bitmapped" monospaced font (Courier, sans "new"?).

Just had a look at the Windoze system I am using right now, and all my fonts are TTF (apart from "MS-DOS CP 437" and "MS-DOS CP 949"). Of all those, I have three that are monospaced "(Courier New", "Lucida Console" and "OCR A Extended"). The rest (about 130 fonts) are proportional.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

luvocean1 wrote:
i just want to give it some flexibility and modularity so that at any time if i decided all i have to do is dump the xxx.ttf file in the font folder of the sd card and the device will load with that type of font on LCD screen.

As you have already seen, it's too much work for poor little AVR. It's more kind of work for something like ARM/Linux. You would have to invest too much time and spend so many AVR resources to achieve that. I still think that it would be much easier if you redefine your goal to achieve the same result. Making PC application that let's you choose any TrueType font in the system, and then generates bitmap fonts that AVR could use from SD card would make your life much easier. If you limit application to just fixed width fonts then it would be even more easier for an AVR. That would also change perspective - your MCU would not be "poor old AVR", instead it would be a mighty one. :lol:

Btw. There are hundreds of monospaced (fixed width) free fonts available for download. Google is your friend.

Last Edited: Fri. Dec 18, 2009 - 05:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Of course, as it's an AVR32 being discussed here maybe Linux or CoLinux is a possibility? In that case you get many many things handed to you on a plate and TTF support (in X) is just one of them.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

guys does anyone know of a program that will let me look at the content of the ttf file and analyse byte by byte?

I couldnt realy use freetype program as its a command line. i hate it. winhex I have bene using...but but the time i have traced one struct i loose track (I have a 8 bit brain) of the bytes in the file.

may be I need to write a msdn program now for myself :( grrr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

may be I need to write a msdn program now for myself

That'd be the way I do it. Write the code first in the easily debuggable x86 environment then port what you learned to the AVR later.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wonder if his one helps out

http://fontforge.sourceforge.net/

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

guys is there a way to hae a common type pointer inside a struct? like following:

typedef struct
{
  //blah blah
}CmapFormat0;

typedef struct
{
  //blah blah
}CmapFormat1;
typedef struct
{
  CmapSubtable *subtable;
  CmapFormat *format;
}CmapTable;

where can i define just CmapFormat ? later on i want to initialise it to either CmapFormat0 or CmapFormat1 type.

is that possible?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use a union?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rather than using a truetype font, how about use a glyph/bitmap based one?
The X window system uses these kind of fonts. Loading from BDF or ABF or similar should be much easier than rendering a ttf font.

Some more info here:
http://www.math.utah.edu/~beebe/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Use a union?

could you use the code sample above to demonstrate it? :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

luvocean1 wrote:
JohanEkdahl wrote:
Use a union?

could you use the code sample above to demonstrate it? :(

typedef struct 
{ 
  //blah blah 
}CmapFormat0; 

typedef struct 
{ 
  //blah blah 
}CmapFormat1;

typedef union
{
  CmapFormat1 f1;
  CmapFormat0 f0;
} CmapFormat;

typedef struct 
{ 
  CmapSubtable *subtable; 
  CmapFormat format; 
}CmapTable;

/Martin.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thats excellent. thanks for that!! what if I define it as void *?

as in:

typedef struct 
{ 
  CmapSubtable *subtable; 
  void *cmapFormat; 
}CmapTable; 



and later on do CmapTable->cmapFormat = cmapFormat1;

??
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

and later on do CmapTable->cmapFormat = cmapFormat1;

You're really sloppy now. CmapTable is a type, not a variable.

Time to get a good C book?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sorryy lol my bad!
i meant CmapTable *cmap;
then do cmap->cmapFormat = (CmapFormat1 *)cmapFormat1;

that should assign it to void pointer ok?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now, if you define the field cmapFormat as a void pointer, then why typecast?
And, depending on if cmapFormat1 is a struct or a pointer to a such a struct then you need either

cmap->cmapFormat = &cmapFormat1; 

or

cmap->cmapFormat = cmapFormat1;

The big question: Why do you want to throw away all type-safety and go for void * ?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok. thanks for that.
so u recommend the union way.

um... is there a way to check for type of a pointer? like say I have 6 of those cmapFormatX variables...

later on i want to be able to see what type cmapFormat variable is so i can do a switch case statement...

is it that possible? i remember i could do it with C++ with i think it was "typeof" keyword in msdn visual c++.

is there something like that in c?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

my bad! there is typeof in c too :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ah doesnt look like i can do switch case on typeof in c :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can use dynamic_cast but I don’t think it is supported in avr-gcc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TFrancuz wrote:

You can use dynamic_cast

In C? (I doubt it.)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

does anyone know of any other sources of codes for truetype to binary raster info conversion??

AFAIK, the fonts are copyrighted and thus ripping them in this manner would be illegal at least in the US. [I could be wrong in this particular situation] If so that could explain the dearth of code examples.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys.....
I am happy to join this group.
I am newbee....

Can you guys through some idea how to proceed with ttf files.I want to read a ttf file and represent each character of that into a matrix format i mean hexadecimal format.
I am totally confused with how to do that?
Please give me some idea.

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

want to read a ttf file and represent each character of that into a matrix format i mean hexadecimal format.
I am totally confused with how to do that?

Which AVR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how to read and interpret TrueType Font files...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

AVR?

Take a look at the top left of this web page. What exactly did you think this message board was about? See:

http://en.wikipedia.org/wiki/Atm...

If your question isn't related to AVRs then I'm afraid you came to the wrong place. This thread was started by an AVR user asking specifically how to access TTFs on an AVR microcontroller. I think it's been established that it's not technically possible.

If your question is just about rasterising TTFs on an x86 system then there are far far better message boards for that - some of the solutions that will be suggested to you there will be some of the very solutions suggested above (but that are too resource hungry for an AVR - but should have no problem on a PC)

Cliff
(moderator)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi,
Thank you.I dont know its just for AVR?
Mine is just about TTFs on x86 system.Can you please suggest me few links...where in i can resigter.
Is this not a borad for all people?
Thanks again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

you please suggest me few links

Have you actually read the preceding two pages of this thread?

(in particular the post from 'thygate')

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Should i unsubscribe from the group or is that ok?Will there be any problem ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i m sort of given up working with TTF files :(
well i am moving to Sydney....lots going on. perhaps in a month or two I will sit down and study the codes written for FontForge and FreeType softwares and learn from there.
I am in the process of learning the "instructions" embedded in TTF files.... its crazy!

when a PC displays a character, does it render the character from TTF file each time and for each char?? thats crazy painting each character from their glyphs +instructions!!! too much resource for even a PC!

or does it do what I am thinking of? it loads the TTF file and rasterizes it to array of pixels (bitmap) and then displays the bitmap everytime the char is to be displayed? this is viable. and so will be in an Atmel

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
too much resource for even a PC!

Your graphics adapter prolly contains a CPU that is specialized for doing stuff like that.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mtaschl wrote:
luvocean1 wrote:
JohanEkdahl wrote:
Use a union?

could you use the code sample above to demonstrate it? :(

typedef struct 
{ 
  //blah blah 
}CmapFormat0; 

typedef struct 
{ 
  //blah blah 
}CmapFormat1;

typedef union
{
  CmapFormat1 f1;
  CmapFormat0 f0;
} CmapFormat;

typedef struct 
{ 
  CmapSubtable *subtable; 
  CmapFormat format; 
}CmapTable;

ok guys I am sort of coming back tot this project now... i have had a lot going on in life lately and since this is all my spare time hobby stuff it has low priority..
anyway... so I have decided to write the software in Visual C++ express first then once I am happy I want to transfer to atmel UC3.

in the mean time does someone know how to have equipvalable of above suggestion in C++? union of class??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for that my initial code for atmel AVR32 environment in C was using struct and union.

but for visual studio C++ i cant use struct? can I? how would you malloc a struct in visual studio? you can only do gcnew for which you need a class not a struct. so I am all confused :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
how would you malloc a struct in visual studio?
Why would it be any different in Visual Studio than in any other C environment? You do this:

CMapTable *t = malloc(sizeof(CMapTable));

But if your using C++, why not do it the C++ way:

CMaptable *t = new CMapTable();

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

but for visual studio C++ i cant use struct? can I?

Why not?

Why would Microsoft, in the link supplied above, document structs as being part of the language if it wasn't? (I know. They are evil. But not that evil. :wink:)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Little known fact - even the latest Visual Studio Express will let you write C rather than C++ if you ask it nicely (otherwise I'd be rightly stuffed!), so if you are more familiar with C than C++ then just use C