News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Fontastic

Started by oex, May 23, 2010, 06:51:12 PM

Previous topic - Next topic

oex

Hey Guys,

I'm drawing my own font and I've come up against a wall and am unsure which method to proceed with.... Should I use variable width fonts or same width fonts.... I can edit pretty easily I have written a basic 8Kb font editor so it's not much hastle to do both but I have time constraints as ever (getting older by the day :lol) so want to do the best option first....

Right now I'm using same width 16x16 fonts and have decided I could just cut the images down to size with a function with 1 white pixel either side for spacing however this is a rather lame option....

I could also just modify for smaller fonts ie 14x14 or 12x12

But when it comes to the spacing (I'm writing an asm editor first) I can see that I'll have to run a function to work out cursor positioning based on what characters are in the line if I use variable length characters whereas with fixed I'll have potentially ugly spacing and fewer characters to the line....

I see QE has fixed font width and this text field I'm typing in now has variable length.... I do want as much text to a line as possible however before I go the variable route is there anything you can see I have missed?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

joemc

if you don't use a fixed width font nothing will line up vertically. Fixed width for code  :thumbu Variable for text  :thumbu

oex

Awesome I thought that might be the case, it explains why I find notepad also easy to code in :bg.... Fxed width first it is.... Do you have any recommendations on font sizing? 16x16 I think is probably too big.... Do I need to do 14x14 or 10x10 or is 12x12 enough?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

joemc

That is going really going to depend on size of your screen vs resolution vs viewing distance.  On my laptop i run 1680x1050 on a 15 inch 16:10 wide screen and generally am pretty close to it.  But a small screen and a large resolution makes things very small. I also use a 32 inch running at 1920x1080 16:9 TV as a monitor. Some people will be running the same display at  1280x720. or even the laptop at 800x600!  12pt can be very different in many situations. It is actually very small on my laptop.

Are you going to be the only user?  Who is your target audience?  If you are going to want it flexible for many people make it adjustable.

Other things to check out: WPF, Direct2d, and DirectWrite.  DirectWrite is the new way to make a font look as close to the same regardless of resolution.  If you are familiar with OpenGL or Direct3D. It is based on a similar concept of using a float as percentages of the screen.

oex

Initially it is for me until I get the bugs out, I dont know if it will be of interest to others as I'm making it a fullscreen mega app :lol for all my coding/3D/database/video/http/AI etc needs, I may partition it off into a standalone editor / MySQL style db module etc if there is any interest so may do a couple of font sizes in that case 12/14/16 or something.... Most of the code I have cobbled together in asm now just frontending it atm....

It's all written in OpenGL for best experience, I never got into the whole DirectX scene they went and f*cked it up as far as I'm concerned somewhere around 7/8.... It's almost all my own code outside of OpenGL and a couple other dependancies so I dont have to fill my head wth too much M$ garbage :bg.... I'd rather look at M$ as an external library rather than the focus of my entire life :lol
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Tedd

Don't use bitmap fonts - render real fonts into bitmaps and use those :P
Do CreateFont to get a handle to the font you want (as selected by the user), and then call wglUseFontBitmaps (http://msdn.microsoft.com/en-us/library/dd374392%28VS.85%29.aspx) to create bitmaps from it - which are put into a display list; you can then draw them directly from the display list.
No snowflake in an avalanche feels responsible.

oex

:lol this is exactly what I'm trying to avoid, I dont want to be tied to fonts a user might or might not have and want to be able to create custom and editable fonts, over time I want to get a proper handle over my fonts. I have designed some basic fonts that can be stored in a few bytes each character rather than the 150Kb Verdana font file or 358Kb Arial font. My first attempt current basic font without any real compression is reasonably readable and uses only 8Kb
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv