The state of Bitmap fonts [FIXED]

oripessach

  • *
  • Posts: 259
I'm trying to work around some font rendering issues by using a bitmap font, and I'm running into serious issues.

First, the bitmap font editor could use some work, but there's nothing there that's a showstopper, apparently.

The big issue is that using the draw text block after selecting my bitmap font doesn't seem to do anything - the text isn't drawn. Selecting a normal (ttf) font does work with the same code.

As an additional data point, using the same bitmap font in the dialog extension results in what looks like garbage being drawn to the screen.

Is this supposed to work at all?

« Last Edit: September 28, 2015, 08:18:11 pm by Jon »

letmethink

  • *
  • Posts: 2545
They work perfectly for me. What build are you using? What OS? Could you attach a screenshot of your bitmap font page and the text you are attempting to draw?
~Letmethink

oripessach

  • *
  • Posts: 259
Here's what the bitmap editor's screen looks like. The code I'm using to draw is pretty simple, too, and a screenshot is attached.


oripessach

  • *
  • Posts: 259
One thing I noticed that's pretty annoying is that trying to import a new image in the bitmap font editor doesn't update the image.

oripessach

  • *
  • Posts: 259
The version I'm running is 8627, by the way.

Justin

  • *
  • Posts: 4716
The dialog extension is from before bitmap fonts were available in Stencyl, so it now uses the same graphics as the font Stencyl creates, but still uses its own implementation for drawing. The issues may or may not be related.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

oripessach

  • *
  • Posts: 259
I still can't get bitmap fonts to work. Any updates on this?


oripessach

  • *
  • Posts: 259
Folks, this is a blocking issue for me. Truetype font rendering is glitchy, and the suggested workaround (bitmap fonts) doesn't work and renders the development environment unuseable when I try it. (See my other recent bug report with logs attached, showing that the problem happens when Stencyl tries to generate a thumbnail for a bad font.)

I need to be able to use a specific font, with specific metrics. If the only way to do that without visual glitches is to use bitmap fonts, I need them to work. I would appreciate it if someone looked into it. 


yoplalala

  • *
  • Posts: 1632
Humm, you could  make your alternaztive system . But have you tried labels, do they work if it ?
I'm creating my own label system where the image every letter is copied on a bitmap image ( kind of like the dialog extension, I saw it afterwords), so I don't have this problem

ajimundi

  • *
  • Posts: 230
If I remembered correctly, image API allows you to copy parts of an image. Why not import your font as actual bitmap, copy each 'letter' into an array, and create your own rendering routine?
::: It's never too late, unless you're dead. Maybe not even then. :::

oripessach

  • *
  • Posts: 259
If I remembered correctly, image API allows you to copy parts of an image. Why not import your font as actual bitmap, copy each 'letter' into an array, and create your own rendering routine?

A couple of reasons. First, I think the font rendering APIs should work. Bitmap fonts should also work and not render the entire environment unstable.

Also, I'm using the dialog extension, and the problem is evident there, too. I'm not going to reimplement the dialog extension, or something equivalent to it.

And, the final reason why I'm not going to roll my own version of a basic piece of functionality that's supposed to just work - I don't have time to do that. I have a deadline to meet, I need to keep some promises, and I'd like fonts to display correctly on supported devices. The project I'm working on needs to be done, one way or another, in a few weeks. It won't get done if I have to repeatedly work around or reimplement large pieces of engine functionality that simply don't work as they should.


Jon

  • *
  • Posts: 17524
This applies in general, but if you have an issue you'd like resolved, providing a minimal, one-scene test game that we can import and run right away provides a huge incentive for us to examine the issue.

It also verifies to both sides that the issue can be isolated from your game - if you find that it doesn't recur in a simple test case, something else may be amiss.

oripessach

  • *
  • Posts: 259
There. The sample game should display text. It doesn't.

letmethink

  • *
  • Posts: 2545
On your bottom row of letters, the letters defined are 1px taller than the image. This is giving the error '(x+width) is out of raster' and is why bitmap fonts aren't displaying for you. (looking at the image you first posted). At least I think that is why. I however cannot test this theory as the test game is making my Stencyl very angry:

Code: [Select]
2015-09-12 07:35:39,185 ERROR [AWT-EventQueue-0] root: Unexpected problem on thread AWT-EventQueue-0: (x + width) is outside of Raster
java.awt.image.RasterFormatException: (x + width) is outside of Raster
at sun.awt.image.ByteInterleavedRaster.createWritableChild(Unknown Source)
at java.awt.image.BufferedImage.getSubimage(Unknown Source)
at stencyl.sw.editors.font.BitmapFontPage.generateThumbnail(BitmapFontPage.java:289)
at stencyl.sw.app.lists.font.FontItemRenderer.fetchIcon(FontItemRenderer.java:44)
at stencyl.sw.app.lists.AbstractItemRenderer.getListCellRendererComponent(AbstractItemRenderer.java:81)
at javax.swing.plaf.basic.BasicListUI.paintCell(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.paintImpl(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at stencyl.sw.app.lists.AbstractList.paintComponent(AbstractList.java:616)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$700(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at stencyl.sw.util.dg.UncaughtExceptionDialog.<init>(UncaughtExceptionDialog.java:68)
at stencyl.sw.UncaughtExceptionHandler.showGenericErrorMessage(UncaughtExceptionHandler.java:169)
at stencyl.sw.UncaughtExceptionHandler.showErrorMessage(UncaughtExceptionHandler.java:128)
at stencyl.sw.UncaughtExceptionHandler.uncaughtException(UncaughtExceptionHandler.java:47)
at stencyl.sw.UncaughtExceptionHandler.handle(UncaughtExceptionHandler.java:34)
at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.awt.EventDispatchThread.handleException(Unknown Source)
at java.awt.EventDispatchThread.processException(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at stencyl.sw.util.dg.UncaughtExceptionDialog.<init>(UncaughtExceptionDialog.java:68)
at stencyl.sw.UncaughtExceptionHandler.showGenericErrorMessage(UncaughtExceptionHandler.java:169)
at stencyl.sw.UncaughtExceptionHandler.showErrorMessage(UncaughtExceptionHandler.java:128)
at stencyl.sw.UncaughtExceptionHandler.uncaughtException(UncaughtExceptionHandler.java:47)
at stencyl.sw.UncaughtExceptionHandler.handle(UncaughtExceptionHandler.java:34)
at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.awt.EventDispatchThread.handleException(Unknown Source)
at java.awt.EventDispatchThread.processException(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

(It sends out this faster than I can dismiss it)
~Letmethink