fonts

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pradeep

fonts

Post by pradeep »

I am ready to display fonts. I have created fonts using Font Editor.It is 8x8 size. But how do i display it. should i fix on some mode say 800x600x16bpp or like that. Isn't there any general way for doing this font stuff. I am not quite sure of how to make the calculatios. What are the global variables necessary eg. font size,font spacing. Then what will be the x and y values? Will it be the top right or bottom right position of the last letter. If i want to make the font little bolder is there any way. From these questions you can be sure that i haven't got any idea of how to display the fonts.
zack

Re:fonts

Post by zack »

have you used GNU Font Editor (GFE) or which one.. can you give me the link.

is it a pixel font or not? if so you can't made it bolder except you make a new pixelfont.

Code: Select all

startposition=y *ScrWidth  * (BitsPerPixel/8) + x * (BitsPerPixel/8);
then you add the size of the last letter to x for the next.

greez
bluecode

Re:fonts

Post by bluecode »

hi,

you might want to use the Freetype Library to load/render fonts. I've no experience with it, but I hope you could share aour experience if you use it
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:fonts

Post by Pype.Clicker »

pradeep

Re:fonts

Post by pradeep »

@zack: Tauron VGA Utilities Version 3.0 consist this font editor
This link was pointed to by someone in this board. It is a pixel font.

By the way i have displayed the font and have a shell similar to that of BOS shell. Soon after creating an ELF loader i will have a complete working shell.( Till now only flat binaries )

I couldn't grab any documents regarding ttf file format. Anybody tried to write a font engine for opentype fonts (.ttf )
Just kinda curious! Is it like doing another project or is it simpler than we think
Warrior

Re:fonts

Post by Warrior »

This may help

Good luck.
pradeep

Re:fonts

Post by pradeep »

@zack: http://sunsite.lanet.lv/ftp/mirror/x2ft ... uron30.zip
This link was pointed out by bubach in reply for Dex4u's post. I searched the forum and found the link.
@Nelson: Thanks it helped me a lot. It was pointed out by candy in reply to one of my previous posts. I have to go through it once again.

Do all the font file formats using glyph's will be more or less similar. Candy could you explain about glyphs because the above document was so brief.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:fonts

Post by Candy »

pradeep wrote: Do all the font file formats using glyph's will be more or less similar. Candy could you explain about glyphs because the above document was so brief.
Well... no.

My font renderer was a 1-night programming thing I made for Pype, since he had fonts and some time to port a simple renderer, and I had time and experience with making a simple renderer. I then created this thing, imported 3 fonts (it can only do static width+height fonts) to its format, created 3 conversion tables and made a small display-function.

The files store image data in 8-bit-per-pixel format. Each glyph is x*y bytes, where each byte indicates how transparent the glyph would be at that point. It's then alpha-blended on the display surface, with a given color value as the color of the text.

Each glyph is a representation of a given character. You input a given stream of words, where each word indicates a given character. The renderer takes the current glyph information for that character, tells the display to mix that with the current content and moves the character x and y pointer by the indicated amount. For newlines, it sets the X to a baseline value (which needs to be known) and it moves the y down to the next "line", specified for the entire font.

The specific rendering of the glyph is irrelevant. In this case, it's a "bit"map where each bit has a transparency value, but you can substitute (such as with TTF) a bunch of polygons, which you first need to render to the given size, change according to a bunch of rendering hints (which is TTF specific) and then mix on the display surface.

IMO, it's a load of work you don't need to do for normal display. Just keep a bunch of prerendered ones, it's faster and more reliable.

Was there anything I've missed in this rant?

PS: I'm amazed you found that. I've lost it some time ago and couldn't find it again :)
Post Reply