AGS Awards nominations close at 13:59 GMT on Saturday 10 February 2018. You haven't yet nominated, so you've got 17 days and 4 hours left to play the games and decide which to nominate!

Author Topic: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.  (Read 18410 times)

san.daniele

    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
    • san.daniele worked on a game that was nominated for an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #40 on: 14 Apr 2013, 20:24 »
This Sir probably saved me weeks of worktime!
I made a custom font for my game and was extremely happy with it (any existing font would have destroyed the whole look). But had no idea how to implement it. Your plugin is better than I could have ever expected … and only took me a few hours to get it working (well, I am an absolute beginner and at first I did everything wrong that could be done wrong ;) ).

Short: Thanks so much!!
« Last Edit: 18 Apr 2013, 09:24 by san.daniele »

san.daniele

    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
    • san.daniele worked on a game that was nominated for an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #41 on: 18 Apr 2013, 09:33 »
When reworking my custom font and playing around with some glyphs I decided to use a variable width instead of a fixed one.

Unfortunately, now the line breaks don't work anymore. Everything is just written in one line. When there should be a line break, it just jumps to the beginning of the same line and draws the next letters on top of the previous ones. I could work around it using a lot of %s but I'm sure I'm just missing an obvious detail. How do I set the line spacing?

here's the code I'm using. As soon as I'm deleting SetVariableSpriteFont all lines break perfectly.

Code: Adventure Game Studio
  1.  
  2. // SetSpriteFont(0, 18, 5, 20, 43, 45, 32, 122, false);  //Custom Font
  3.  
  4.   SetVariableSpriteFont(0, 18);
  5.   SetSpacing(0, 5);
  6.  
  7.   //SetGlyph(int fontNum, int charNum, int x, int y, int width, int height)
  8.  
  9.    SetGlyph(0, 48, 688, 7, 27, 38); //0
  10.   SetGlyph(0, 49, 731, 7, 20, 38); //1
  11.   SetGlyph(0, 50, 774, 7, 27, 38); //2
  12.   SetGlyph(0, 51, 817, 7, 27, 38); //3
  13.   SetGlyph(0, 52, 0, 52, 27, 38); //4
  14.  

JSH

  • Founder of Clifftop Games
    • JSH worked on a game that was nominated for an AGS Award!
      JSH worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #42 on: 18 Apr 2013, 10:12 »
Sorry I completely forgot.

I'll pull the repo tomorrow when my NEW COMPUTER arrives and I'll see if I can add colouring and fix the D3D problem on my NEW COMPUTER.

...

NEW COMPUTER

I hate to be that guy, but we're still waiting for this?

Daniel Thomas

  • "zyndikate"
    • Daniel Thomas worked on a game that was nominated for an AGS Award!
      Daniel Thomas worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #43 on: 18 Apr 2013, 13:31 »
Thanks Joel, that means I didn't have to be the guy. :)

In other words, I'm also still interesting in this - I didn't want to bother as I assumed you were too busy.
Check out The Journey of Iesir Demo | Freelance artist, check out my Portfolio

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #44 on: 18 Apr 2013, 16:13 »
My apologies, I completely forgot.

I shall begin today!

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #45 on: 18 Apr 2013, 18:05 »
Ok new version here: https://dl.dropboxusercontent.com/u/27247158/ags-spritefont-plugin.dll

The filename has changed to match the reorganisation so make sure you delete the old version from your game directory and the ags directory.

All the functions and stuff are the same so it should be a drop in replacement.

When reworking my custom font and playing around with some glyphs I decided to use a variable width instead of a fixed one.

Unfortunately, now the line breaks don't work anymore. Everything is just written in one line. When there should be a line break, it just jumps to the beginning of the same line and draws the next letters on top of the previous ones. I could work around it using a lot of %s but I'm sure I'm just missing an obvious detail. How do I set the line spacing?

I can't reproduce this. For me line breaks work fine as seen here:



Yes, I thought there shouldnt be any good reason why it doesnt work in D3D.. and theres is the no-good reason.

Easy enough to fix. I will do so when i am next at home unless the miraculous happens and someone fixes it before me.

This is also fixed. The plugin now works in D3D

I will tackle the font tinting next.

Github: https://github.com/CalinLeafshade/ags-spritefont

san.daniele

    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
    • san.daniele worked on a game that was nominated for an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #46 on: 18 Apr 2013, 19:14 »

When reworking my custom font and playing around with some glyphs I decided to use a variable width instead of a fixed one.

Unfortunately, now the line breaks don't work anymore. Everything is just written in one line. When there should be a line break, it just jumps to the beginning of the same line and draws the next letters on top of the previous ones. I could work around it using a lot of %s but I'm sure I'm just missing an obvious detail. How do I set the line spacing?

I can't reproduce this. For me line breaks work fine as seen here:


I fixed it myself (well, "fixed" is a big word). I only tested it with numbers 0-9. Now I defined all 90 characters with SetGlyph and voilá: all works fine (maybe that makes sense to you).

I don't understand why this plugin doesn't get more love (like an insane amount). It's just amazing and I'm quite sure I'm going to use it for every project I'm going to do in AGS. So thanks again.
(or maybe I just didn't realize yet that there are several other plugins/methods to use a custom font).

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #47 on: 18 Apr 2013, 19:54 »
No one ever likes my plugins :(

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!

Daniel Thomas

  • "zyndikate"
    • Daniel Thomas worked on a game that was nominated for an AGS Award!
      Daniel Thomas worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #49 on: 20 Apr 2013, 05:44 »
I can confirm that it works now, both tinting and using it in D3D.

There seem to be a transparency problem when used for dialogues (a room with a background image). Seems to work fine when used over a GUI though - so I suspect it's the AGS transparency limitation which is causing this?

(Your plugins should get some more love, it does fix some of the AGS limitations, but I suspect it's just a minority of the developers who think it's a problem)
« Last Edit: 20 Apr 2013, 05:46 by Daniel Thomas »
Check out The Journey of Iesir Demo | Freelance artist, check out my Portfolio

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #50 on: 20 Apr 2013, 05:57 »
There seem to be a transparency problem when used for dialogues (a room with a background image). Seems to work fine when used over a GUI though - so I suspect it's the AGS transparency limitation which is causing this?

Is "Antialias Truetype fonts" set to true in the options? AGS doesnt provide a 32-bit canvas to draw fonts on unless that is selected and so transparency will completely mess up.

Daniel Thomas

  • "zyndikate"
    • Daniel Thomas worked on a game that was nominated for an AGS Award!
      Daniel Thomas worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #51 on: 20 Apr 2013, 06:06 »
Yes, that fixed it. :)

« Last Edit: 20 Apr 2013, 06:07 by Daniel Thomas »
Check out The Journey of Iesir Demo | Freelance artist, check out my Portfolio

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with web design
    •  
    • selmiak worked on a game that was nominated for an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #52 on: 24 Apr 2013, 12:05 »
is there a way to apply this to guis and especially text displayed on buttons and textboxes?

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #53 on: 24 Apr 2013, 12:09 »
Yes, it will work anywhere where a font is rendered.

However it wont show up on the preview in the editor because the plugin is only loaded at runtime and theres nothing i can do about that.

But the example picture i posted is text on a GUI label.

Ghost

  • AGS Baker
  • Rottwheelers
  • Simple plans can work.
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #54 on: 26 Apr 2013, 17:35 »
No one ever likes my plugins :(

I am loving this!

san.daniele

    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
    • san.daniele worked on a game that was nominated for an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #55 on: 27 Apr 2013, 12:09 »
There seem to be a transparency problem when used for dialogues (a room with a background image). Seems to work fine when used over a GUI though - so I suspect it's the AGS transparency limitation which is causing this?

Is "Antialias Truetype fonts" set to true in the options? AGS doesnt provide a 32-bit canvas to draw fonts on unless that is selected and so transparency will completely mess up.

I'm having a transparency issue as well. If the text is displayed in a GUI, it looks messed up if the GUI is transparent or the GUI background has an alpha channel. All sprites are 32-bit (of course game set to that as well) and Antialias Font set to true. The room background has no alpha channel.

I've been playing around with it for hours now without finding any solution. If wanted, I can upload an example dialog I quickly set up in the AGS Demo Game.
Am I missing something?

I found several topics about problems using transparency over an already (semi-)transparent GUI (most of them being a little over my head). But everything works fine using transparent sprites in a transparent inventory GUI, so my guess is it has something to do with the font rendering.

edit: actually, I should specify a little more. It kinda recognices the general transparent area around the characters, but looses all details.
Instead of explaining, here's two screenshots:

here's how a simple Say("") or Display("") looks like:

and here's what happens if inside a transparent gui
« Last Edit: 27 Apr 2013, 12:29 by san.daniele »

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #56 on: 27 Apr 2013, 18:01 »
I can't reproduce the issue.

A demonstration game with the source would be useful.

san.daniele

    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
    • san.daniele worked on a game that was nominated for an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #57 on: 27 Apr 2013, 21:12 »
http://www.whalesplash.com/CrossStitchCasper/Examples/FontGame.zip

The .zip might look a little messed up as I packed it using my mac.
I hope that's all you need. There's some sprites in there to test inventory item/font. just start it and talk to the 2nd character in the room.

If you miss anything just tell me and I'll add it right away.


Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #58 on: 28 Apr 2013, 18:17 »
That looks to be a bug in AGS's TextWindow system. I will forward it on to the engine team.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #59 on: 28 Apr 2013, 19:10 »
I am yet to check this, but it looks like the bug I was fixing recently, related to alpha blending on gui:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=47666.0