DmiFontsPlus

by Lummox JR
An advanced text-on-map library for BYOND 4.0
ID:91618
 
DmiFontsPlus is a revamp of DmiFonts designed for the new icon features in BYOND 4.0. It's a utility and library in one package. New features include alpha transparency, easier icon manipulation (no more clumsy /iconset datum), and fewer separate icons taking up room in your games cache.

The utility program will convert any font to a PNG-compatible .dmi format, and create a .dm file that you can include in your games to use the font. The library can be used to render text in many ways.

The library includes:

  • Support for anti-aliased fonts
  • A fleet of powerful procs to measure and arrange your text
  • Multi-font procs to draw text in changing styles just like this
  • Comprehensive documentation
  • The infamous un-smiley demo



Upgraders please note: You will have to re-make your font files with this library, since the old library used BYOND 3.0 icons and did not support alpha transparency. In place of the old /iconset datum, a single large /icon datum is now used for your text. Manipulating icons is much easier now, but you will have to make adjustments to your code. The QuickName() and QuickText() procs, however, should be unaffected. You will also not be able to use DmiFonts and DmiFontsPlus together; they conflict with each other.
I started playing around with this library over the last couple days, and I must say that I am very impressed. This library is relatively straightforward to use and very powerful.
This library is neat...however, I have trouble seeing the simplicity in it than others may see. I simply want to use the Chat Bubble feature for some NPC's talking in a story line, and do not know how to do so in an easy manner.
I would like to be able to specify a canvas size for the icon_states in the icon file the utility generates. My glyphs are all 8x8px, but the icon_states are 32x32px, and I can't help but feel that this unnecessary extra padding will have a hit on CPU and network performance when displaying a large number of characters.

For clarity: I am using the generated .dmi files with my own text display system. I am not using the DmiFontsPlus library in my project.
Definitly recommended! Makes all the writing stuff so easy.
Very impressive. Not just the font conversion exe but also the programing style itself. I'm not one for butt kissing however I can only hope to one day create such a beautiful script. My hat is off to you at this point...
I love this library. :3
There is a runtime I get with this program. Generally it wouldn't mean anything but in this case it does. It shows up randomly, unexpected.

runtime error: bad icon operation
proc name: New (/icon/New)
usr: Ganing (/mob)
src: /icon (/icon)
call stack:
/icon (/icon): New('', null, null, null, null)
Arial 7pt (/dmifont/Arial7pt): DrawText("Ganing", 48, 1, 96, 4104, 0, -1, 3, 1, null, null)
Arial 7pt (/dmifont/Arial7pt): QuickName(Ganing (/mob), "Ganing", "#ffffff", "#000", null, 3, 5)
Ganing (/mob): CreateName(255, 255, 255)
Ganing (/mob): Login()
runtime error: bad icon operation
proc name: MakeIcon (/mob/proc/MakeIcon)
source file: Login System.dm,51
usr: Ganing (/mob)
src: Ganing (/mob)
call stack:
Ganing (/mob): MakeIcon()
Ganing (/mob): Login()

It even makes the skin go back to 3.5.
It is in fact an awesome library and a must-have resource for every developer. You did a great job, Lummox, congratulations!
Is there a way to change it so instead of the usr's key, it's a name they chose when they began? Like I have a system where I can chose my name(no save file yet) but is there a way to make it so It displays the name I chose instead of my key, because that is what I want
You can use any text you want; you're not limited to just using your key. The QuickName() proc for instance lets you specify the text. I'm not sure how this is unclear from the documentation.
Can this do multiple lines?

Like if I wanted to print some text on the map as below:

Time to Battle
Player 1 vs Player 2
GO!

I want to use it on a 'screen' on the map you see.
Do you recommend phasing this library out in favor of native maptext? I have to assume so, since this does a lot of costly icon manipulation calls.
Wherever maptext is easier to use, absolutely.
Awesome, thanks for the quick response. :)
Can I request that you update this for the new features in 500+, a large amount of this can be re-written to be more efficient and I'd love to see how you'd handle it. You already made the leap from 3.0 to 4.0, now let's get 5.0 up in this!
I'm not sure how the new generation of features can do much for this library; most of them are client-side, and now there's maptext as well which partially obviates a lot of this library. DmiFontsPlus is basically all about icon manipulation, which hasn't really changed.
Icon.Transform, Color and animate() all pop straight to mind!

But those don't actually have any impact on this library, because they're client-side features. DFP creates a new icon at runtime using regular icon manipulation.
In response to Lummox JR
Lummox JR wrote:
But those don't actually have any impact on this library, because they're client-side features. DFP creates a new icon at runtime using regular icon manipulation.

Hrm maybe I misunderstood the full context of this library, looking through it again I understand a little better, it's not as much for actual text handling as it is for generating font files. My bad, should have read the documentation a bit better.
Page: 1 2