gfxgfxFreeBASIC Games Directory Forumgfxgfx
gfx gfx
gfx
Welcome, Guest. Please login or register. May 21, 2013, 05:22:16 PM

Login with username, password and session length
11.5.2013 - Added a webpage for the latest FBGD competition.

13.3.2013 - Members registrations temporary disabled. For all membership requests, please email me: lachie13@yahoo.com

30.11.2012 - The ninth issue of BASIC Gaming is out! Read it here: http://games.freebasic.net/forum/index.php?topic=560.0

22.11.2012 - Be sure to check our currently running annual FBGD game making competition. This year's theme is SEASONS OF THE YEAR, 300 $ first place prize, and the competition runs till 18th of February. Link: http://games.freebasic.net/forum/index.php?topic=559.0
gfx
gfx
*
gfxgfx
gfxgfx gfxgfx
gfxgfx Home Help Search Login Register   gfxgfx
gfx gfx
gfx
Poll
Question: Did you like this abfont lib?
Good work! I love it! - 4 (80%)
How the font-format like? - 1 (20%)
Keep it up! - 0 (0%)
Just nice... nothing else. - 0 (0%)
Bad! It was garbage! - 0 (0%)
Total Voters: 4

Pages: [1] 2 3
Print
Author Topic: Smooth font render in graphic screen mode (no OpenGL! no DX!)  (Read 5602 times)
Leonheart
Guest
« on: December 28, 2007, 07:11:45 AM »

This will give you some lib addition to draw smooth font text for pure graphic mode (15/16/24/32-bit only). No more must include ttf fontfile for your game or sprite, all font can imported into file. It support pitch,start,italic,... more? Thanks to Pritchard if he give can give me nice welcome. Tongue

Check this out: http://www.geocities.com/xaviorsoft/alpha.html

Or need direct download: http://www.geocities.com/xaviorsoft/libabfont_0.1.0.zip

Happy New Year Everyone!  Grin
« Last Edit: December 28, 2007, 07:40:22 AM by Leonheart » Logged
Lachie Dazdarian
Double dipper
Administrator
Forum Sage
*****
Gender: Male
Posts: 1195


lachie13
View Profile WWW Email
« Reply #1 on: December 28, 2007, 11:57:22 AM »

You forgot to put "Man, this is brilliant!" poll option. I love it. This is like a dream come true. Wonderful, easy to use, well packed, with 5 examples, font lib.

And the font converter beats everything similar that was attempted to be done in FB. Is the converter GUI FB? I would love the see the source for it.

I think the package only lacks complete documentation. Without the examples I would be lost. Does the lib feature a default font? That seems to be the case from the examples.

Keep up the great work. You have a fan.

P.S.

Nice tune on your website. I like your agenda.
« Last Edit: December 28, 2007, 11:58:35 AM by Lachie Dazdarian » Logged

"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist
notthecheatr
Global Moderator
Forum Sage
*****
Gender: Male
Posts: 351


Who's the guy from 21 Jump Street?

notthecheatr TheMysteriousStrangerFromMars
View Profile WWW Email
« Reply #2 on: December 28, 2007, 12:39:53 PM »

Not bad at all, though I would like to see more documentation - and in particular, I want to see what the font format is like.  It would be nice if you could also provide a converter for image-based fonts, since many of us don't have the capabilities to create TTF fonts.
Logged

The funniest thing happened yesterday.
KristopherWindsor
Forum Sage
*****
Gender: Male
Posts: 363


The Thirsty Smiley


View Profile WWW Email
« Reply #3 on: December 28, 2007, 09:21:28 PM »

This looks great! But I would like to know where in Example 1 the font / font file is specified and loaded. Smiley
Logged

sir_mud
Amoeba
*
Gender: Male
Posts: 15



View Profile
« Reply #4 on: January 02, 2008, 02:29:13 AM »

FontForge is an Open Source (GPL) program for creating TTF fonts, its not easy to use, but it can produce professional fonts.
http://fontforge.sf.net
Logged

"Never underestimate the bandwidth of a station wagon full of tapes speeding down the highway." - Andrew Tannebaum
KristopherWindsor
Forum Sage
*****
Gender: Male
Posts: 363


The Thirsty Smiley


View Profile WWW Email
« Reply #5 on: June 28, 2008, 07:35:12 PM »

* Bump! *

Hi, I'd like to use this library for my new upcoming super-awesome game, but I want a different interface, please. Wink
I like how this font lib supports semi-transparent pixels in the font.

Mainly I want an "all in one" version of DrawTextXY(); preferably Draw(target = 0, font, x, y, color, alpha).
Once I can use your library to draw to an image (instead of the screen), I will extend it to support scaling and rotation (with Multiput).

Also I hope you can modify your library to use the OOP features in FB:
Dim as font_type font
font.load("myfont.abf", 2) 'slot 2
font.draw(, 2, 55, 55, &HFF8888FF, 100)
print font.get_length("pizza")
font.unload()
system()

If you publish the source code, I *might* be able to make these changes myself, but I hope you (Leonheart) can update this. Wink

Cool Cheesy

Edit: there seems to be a bug if I set the alpha value SetTextForeColor() in Example 2: the text is brighter with an alpha of 50 than an alpha of 200!  Undecided  Wink
« Last Edit: June 28, 2008, 07:52:52 PM by KristopherWindsor » Logged

Leonheart
Novice
***
Posts: 54


tenchu_shinobi_taizen
View Profile WWW
« Reply #6 on: June 29, 2008, 10:37:34 PM »

Well, I in plan to do that, making reversion in full OOP. I use no OOP last day because it still development version so I can compare the speed too Undecided. But, I worried that I can't post it here soon. And, I'm sorry to delete the linux version before. I'll post linux version tommorow.

That you forget I'm shame to show up my code  Embarrassed, beside I like the black box. but, You can request next feature or something on fbpsc, is too lonely there  Cry. I'll make it open source if Microsoft let their at least Word Office for free Tongue or if someone want to port it to official fbgfx  Wink. I afraid I can't make scaling and rotation support because I design it for 2D acceleration and compatibility (its not stored as vector bitmap, rotation can make the font have unsual ugly look), You still can use different font size or rotate font from ttf source. If you want it as full text rotate not individual one, maybe I can make it -- laters. But, maybe I will worried about the speed  Smiley

Its use my special blend formula  Grin that maybe can't be achived by normal formula. Isn't the clue is in fb compiler resource for 32-bit alpha blend? But my speed is better isn't? Tongue

There is no bug. Think again, the backfround color in example 2 is white. 60 mean more transparent than 200. White blend will make the color brighter.  Huh
Logged

Even just one flap of butterfly can make storm in the world.
KristopherWindsor
Forum Sage
*****
Gender: Male
Posts: 363


The Thirsty Smiley


View Profile WWW Email
« Reply #7 on: July 02, 2008, 01:33:35 AM »

Maybe you misunderstood: Your lib doesn't need to support rotation because I will add that feature myself.
I just need an OOP syntax like the example in my previous post because this will be used in a large project. Wink
I also need your library to draw to an image buffer instead of the screen, so I can then add the rotation feature (with D.J. Peter's Multiput()).

Regarding the example with the bug: I mean, the text looks more red (solid) with the smaller alpha value, and with an alpha value of 100 the font is almost invisible. :/

I would really like this soon; it's hard to write a game (yes Lachie, A GAME!!!!) without the menu font. Wink

BTW, how's my highlighting?
I'm in a hurry. Cheesy
« Last Edit: July 02, 2008, 01:36:04 AM by KristopherWindsor » Logged

Lachie Dazdarian
Double dipper
Administrator
Forum Sage
*****
Gender: Male
Posts: 1195


lachie13
View Profile WWW Email
« Reply #8 on: July 02, 2008, 07:38:44 AM »

I'm all wet.
Logged

"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist
Leonheart
Novice
***
Posts: 54


tenchu_shinobi_taizen
View Profile WWW
« Reply #9 on: July 02, 2008, 09:15:52 PM »

Whoo... big job for short time. Ok, I try make the OOP version from original, but draw to an image buffer need big reconstruction to code (and for support old and new image buffer header). I'll check the if that was a bug or not.

If you can wait about two-three week, maybe X-Font lib replacement for alpha font will done, the converter GUI is hard stuff. Grin

Sorry, There is a problem with httpd last day, late update. Cry.

Here the linux version too (in attachment).
Logged

Even just one flap of butterfly can make storm in the world.
KristopherWindsor
Forum Sage
*****
Gender: Male
Posts: 363


The Thirsty Smiley


View Profile WWW Email
« Reply #10 on: July 02, 2008, 09:32:20 PM »

Fortunately I have the lack of fonts problem isolated (using draw string for now, and the wrapper for scaling and rotation is already made), but I think 3 weeks is a long time. Wink
To draw to a buffer, first of all, you don't need to support the old header; the new one has been around for well over a year, I'd guess.
To work on a screen or the image should be this simple:
If target = 0 then
dataptr = screenptr
else
dataptr = image + 1
end if
Smiley
Logged

Leonheart
Novice
***
Posts: 54


tenchu_shinobi_taizen
View Profile WWW
« Reply #11 on: July 02, 2008, 09:45:09 PM »

Hey, but that not so simply. The image buffer offset handle is different than screen offset. its will a big change. <see the answer on fbpsc too>.

But, 3 week its for make full revolution change. I need full of it.
« Last Edit: July 03, 2008, 12:15:46 AM by Leonheart » Logged

Even just one flap of butterfly can make storm in the world.
KristopherWindsor
Forum Sage
*****
Gender: Male
Posts: 363


The Thirsty Smiley


View Profile WWW Email
« Reply #12 on: July 03, 2008, 12:02:00 AM »

Yes it is that easy. Wink

' Pokin to the screen or an image! v1.0
' By Kristopher Windsor

#include once "fbgfx.bi"

Sub changefirstpixels (Byref target As fb.image Ptr = 0)
  Dim As Integer pitch
  Dim As Uinteger Ptr dataptr
 
  If target = 0 Then
    'note: you can get the dimensions with screeninfo()
    Screeninfo(,,,, pitch)
    dataptr = Screenptr
  Else
    'note: you can get the dimensions with (target -> width) and (target -> height)
    dataptr = cast(Uinteger Ptr, target + 1)
    pitch = target -> pitch
  End If
 
  For y As Integer = 0 To 49
    For x As Integer = 0 To 99
      'change the pixel
      *(dataptr + x) = &HFF44FF00
    Next x
    'go to the next row (have to convert to a byte ptr because pitch is given in bytes)
    dataptr = cast(Uinteger Ptr, cast(Byte Ptr, dataptr) + pitch)
  Next y
End Sub

Dim As fb.image Ptr g

Screenres 800, 600, 32

g = imagecreate(100, 100)

'screen
changefirstpixels()
Sleep

'image
changefirstpixels(g)
Put (100, 100), g, Pset
Sleep
Logged

Leonheart
Novice
***
Posts: 54


tenchu_shinobi_taizen
View Profile WWW
« Reply #13 on: July 03, 2008, 12:29:02 AM »

Okay, okay.... no rotate, no scale, just new header.

 - You need to OOP translate
 - and draw to image buffer.

Let see what I can do in 1-3 day A.S.A.P. Sorry, but my draw algorithm is different, it have 16 part each mode for make draw faster. Still this will just unofficial lib release, Specially made for u cat. Someone will kick me if my thesis mess too. Tongue

You must pay for this Tongue

Maybe you can send me some tutorial floating point with asm too. If you can, I'll bet maybe the next evolution lib can achive 1.4x faster. Grin

Is there somewhere someone need 3-3-2 bit mode too?

About the bug; after I change SetTextForeColor(255,0,0,ani) to example 3 and another bla..bla.. just for test it. Oh, there is no bug; smooth transition, maybe caused by screen unlinear looks (screen problem -> did u know RGB(200, 200, 200) is not twice brighter than RGB(100,100,100), thats why we need the gamma correction) Grin
See, no bugs. Wink
« Last Edit: July 03, 2008, 09:33:20 PM by Leonheart » Logged

Even just one flap of butterfly can make storm in the world.
KristopherWindsor
Forum Sage
*****
Gender: Male
Posts: 363


The Thirsty Smiley


View Profile WWW Email
« Reply #14 on: July 03, 2008, 03:59:36 PM »

I can wait one week if you have some important things to do, but I just can't wait three weeks, because most things planned that far away get canceled. Wink
I'll leave the ASM to Mysoft; I don't need ASM enough to remember how to do it. Tongue
Maybe someone else can try to confirm / explain the alpha bug? Smiley
Logged

Pages: [1] 2 3
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Cerberus design by Bloc
Valid XHTML 1.0! Valid CSS!
gfx
gfxgfx gfxgfx