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

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #80 on: 27 Mar 2014, 14:00 »
I am not sure what the best course of action is here. Breaking font height handling in labels would probably break legacy code.
<...>
The ideal would be for both to use wgetfontheight(n) + line_spacing, but that would require some kind of switch between legacy<-->rational mode.
There are simple ways to deal with compatibility, that's what I explained in regards to your very first pull request - checking game data version.
(Or against GUI version - if you were adding new properties to gui class)
In this case there may be a global variable (well, "global" by scope of applicance, not in C meaning) that defines message spacing, 0 for old games and 1 (or settable) for new ones.

Also I don't think GUI should use this usetup.textheight. Looking at its usage in code - it appears to be a very old legacy way to define text height, and it is used mostly in "built-in" dialogs. The only "new" gui using it is GUILabel. Maybe it was "forgotten" there.

EDIT: Wait... I've got confused myself. On more close examination, labels do not use usetup.textheight. They calculate their line height as
Code: C++
  1. TEXT_HT = wgettextheight("ZhypjIHQFb", font) + 1;
  2.  
The source of confusion is that TEXT_HT is also a macro defined as "usetup.textheight", but that macro is declared only for old built-in dialogs. And, there's a second set of control classes that are created on built-in dialogs, including label (MyLabel)
« Last Edit: 27 Mar 2014, 16:52 by Crimson Wizard »

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    •  
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • Gurok worked on a game that was nominated for an AGS Award!
      Gurok worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #81 on: 27 Mar 2014, 23:09 »
I am not sure what the best course of action is here. Breaking font height handling in labels would probably break legacy code.
<...>
The ideal would be for both to use wgetfontheight(n) + line_spacing, but that would require some kind of switch between legacy<-->rational mode.
There are simple ways to deal with compatibility, that's what I explained in regards to your very first pull request - checking game data version.
(Or against GUI version - if you were adding new properties to gui class)
In this case there may be a global variable (well, "global" by scope of applicance, not in C meaning) that defines message spacing, 0 for old games and 1 (or settable) for new ones.

Well, yeah, checking against the game data version or the GUI version is what I wanted to avoid, as that would provide no way for people to obtain the legacy behaviour when compiling in a new version of AGS. I wanted to ensure things wouldn't break for people with old projects.

I think your second suggestion is probably the way to go if I understand it correctly. e.g.:

Code: Adventure Game Studio
  1. game.use_global_line_spacing = true;
  2. game.global_line_spacing = 1;

And in the default game template, we could just define:

Code: Adventure Game Studio
  1. game.use_global_line_spacing = true;

Thus preserving old behaviour for people upgrading to 3.3.1 (or whatever). I'm sorry. I didn't mean to give you the impression that I wasn't taking note when you told me about checking against game versions. I just meant that it wasn't straightforward and I wanted to avoid complicating the API where possible. For instance, I think defining a number like:

Code: Adventure Game Studio
  1. game.message_line_spacing = 0;

Might be too much because then game authors would need knowledge of how message spacing works (message_line_spacing + global_line_spacing = actual_line_spacing).
Quote

EDIT: Wait... I've got confused myself. On more close examination, labels do not use usetup.textheight. They calculate their line height as
Code: C++
  1. TEXT_HT = wgettextheight("ZhypjIHQFb", font) + 1;
  2.  
The source of confusion is that TEXT_HT is also a macro defined as "usetup.textheight", but that macro is declared only for old built-in dialogs. And, there's a second set of control classes that are created on built-in dialogs, including label (MyLabel)

Yes, sorry about that. I did get confused. I ended up looking at MyLabel last night because I think I just jumped to the first label definition I found. The principle is the same for both though. That pesky +1. I need to stop and consider things a bit more before I post sometimes though.
« Last Edit: 27 Mar 2014, 23:13 by Gurok »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #82 on: 27 Mar 2014, 23:16 »
I am not sure I understand why you need two "spacings" and not just one for "message box". Are we talking about same problem? I've got an impression that you just needed extra spacing for Display box.


E: Uh, and I just realized that we are spamming this into Calin's plugin thread :tongue:
« Last Edit: 27 Mar 2014, 23:21 by Crimson Wizard »

Dropped Monocle Games

  • You can call me Sox
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with web design
    •  
    • Dropped Monocle Games worked on a game that was nominated for an AGS Award!
      Dropped Monocle Games worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #83 on: 21 Jan 2015, 19:59 »
Thanks Calin! The white/black thing sent me in the right direction. Importantly, I found you must also use the file from page 3 of this thread. The file in the original post has not been updated to support tinting.
Sorry to open this but I'm having a little problem,
The link on page 3 is broken and I'm using download from page 1


everything is working great apart from I can't seem to get tinting to work, should it work with .say and the colour set by the characters speech colour? if not is there a way for me to change colours for different characters speaking?
I have set my font sprite to be white with a black outline/shadow.
Really sorry if I have misunderstood this

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    •  
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • Gurok worked on a game that was nominated for an AGS Award!
      Gurok worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #84 on: 22 Jan 2015, 10:43 »
Yes, all was broken for me too until I got the magic version. Here's the one I'm using, Soxbrooker:

http://goo.gl/5xo2v7

I believe it should use the character's speech colour, but I haven't tested that recently. I know that drawing to surfaces works, e.g.:

Code: Adventure Game Studio
  1. surface.DrawingColor = 14; // Set to yellow
  2. surface.DrawStringWrapped(1 + offset1, 1, widthMax - 1, font1, align, text1); // Draw some text in yellow
« Last Edit: 22 Jan 2015, 10:45 by Gurok »

Dropped Monocle Games

  • You can call me Sox
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with web design
    •  
    • Dropped Monocle Games worked on a game that was nominated for an AGS Award!
      Dropped Monocle Games worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #85 on: 22 Jan 2015, 18:09 »
Awesome yeah, that worked great! Thank you :D

Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #86 on: 06 Apr 2015, 15:28 »
I am very interested in this plugin and the tool "Spritefont.exe". It seems that almost all download links are broken. Does anyone have a copy that he/she wishes to share?

Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #87 on: 09 Apr 2015, 21:30 »
Well, I did some carefull digging and found the sources at:

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

So I fired up visual studio and recompiled all. Als I've found the original spritefont tool, so added this to the package at all.

It is working in my AGS game, so grab your binaries here:
https://dl.dropboxusercontent.com/u/20918686/ags/ags_sprtitefont.zip

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #88 on: 10 Apr 2015, 10:17 »
thanks a lot nims! Broken links are always a pain.
 

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 #89 on: 10 Sep 2015, 11:19 »
Hey Calin, it looks like the source on github wasn't updated after the tinting fix. Would it be possible to have that uploaded? :)
« Last Edit: 10 Sep 2015, 11:32 by JSH »

Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #90 on: 19 Dec 2017, 16:18 »
Sorry to dig this up

Does anyone have a working link to a compiled version

Thanks

Honza

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #91 on: 09 Apr 2018, 12:27 »
Another attempt to bump this up, a link to a compiled version would be great! Thanks.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #92 on: 09 Apr 2018, 13:29 »
Here: https://www.dropbox.com/s/k67znqeiyk8juic/AGSSpriteFont.zip?dl=0

Not sure if it works, just built it, not tested.

Honza

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #93 on: 09 Apr 2018, 13:45 »
Perfect, thank you!

Honza

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #94 on: 10 Apr 2018, 23:32 »
Works like a charm, but manually setting up the character widths is a pain. Any chance of also getting my hands on AGSSpriteFontGen.exe mentioned in the first post?

Also if I'm using a sprite font for dialogue options, they don't highlight on mouseover anymore. Any way around this? Maybe the version with tinting... ?
« Last Edit: 10 Apr 2018, 23:46 by Honza »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #95 on: 11 Apr 2018, 00:37 »
Works like a charm, but manually setting up the character widths is a pain. Any chance of also getting my hands on AGSSpriteFontGen.exe mentioned in the first post?

Probably this: https://www.dropbox.com/s/n1hwnh2kqikja6c/AGSSpriteFontGen.zip?dl=0
In Calin's repository project is called "agssprite-helper", but output file is AGSSpriteFontGen.exe.

Also if I'm using a sprite font for dialogue options, they don't highlight on mouseover anymore. Any way around this? Maybe the version with tinting... ?
I don't know how spritefont works, but if it does not support glyth recoloring itself, you would need to write the custom dialog options rendering script.
For example, create second font from the same images, applying tint (DynamicSprite.Tint). Then in the dialog rendering script choose either font depending on whether option is active or not.

Honza

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #96 on: 11 Apr 2018, 09:55 »
That's it, thanks once more, this makes it really easy to use. Not up to writing a custom dialog rendering script just yet, still a relative AGS beginner, but might get there eventually. Too bad the version of the plugin with tinting functionality isn't available anymore :/. This is a great plugin otherwise.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #97 on: 11 Apr 2018, 10:26 »
I built the plugin from Calin's repository this time, but from the quick glance on the code the difference is negligible, and also I do not see "color" parameter being used anywhere, so idk if tinting work: https://www.dropbox.com/s/tcdmy3meuh3ml4f/ags-spritefont-plugin.zip?dl=0

Calin has mentioned working tinting same day he created repository, so maybe he just forgot to push latest code there.

UPD: I noticed higher in this thread Gurok said that he has the version with tinting, and the download link still works.
Yes, all was broken for me too until I got the magic version. Here's the one I'm using, Soxbrooker:

http://goo.gl/5xo2v7

I believe it should use the character's speech colour, but I haven't tested that recently. I know that drawing to surfaces works, e.g.:

Code: Adventure Game Studio
  1. surface.DrawingColor = 14; // Set to yellow
  2. surface.DrawStringWrapped(1 + offset1, 1, widthMax - 1, font1, align, text1); // Draw some text in yellow
« Last Edit: 11 Apr 2018, 13:16 by Crimson Wizard »

Honza

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #98 on: 11 Apr 2018, 13:01 »
Overlooked that one, tried it and everything works now! I'm in your debt sir :)

imsomnia212

  • Imsomnia
Re: Another Plugin: SpriteFont Renderer. Native Bitmap Fonts.
« Reply #99 on: 07 Aug 2018, 08:39 »
Sorry for bump this but anyone have a link of the SpriteFont.exe? I downloaded the dll and the generator but I need the creator
Are u a tuna?