Font character of zero width gets ignored when creating font asset

I am trying to use the following free font: http://www.keshikan/fonts-e.html

Please note how it sets the width of the decimal point character to zero, so that the displayed width of a string doesnt change if there is a decimal in it.

When I import the font into UE4 and create a font asset, and switch from Runtime to Offline, the preview shows the widths incorrectly, but the decimal point is shown. When I enable “Use Distance Field Alpha” and select Asset/Reimport then the preview display shows correct font spacing, apart from the decimal character, which has disappeared.

My overall goal here is to create a 7-segment LED display counter, with a decimal in it. Im using a Text Render component showing a string of “xx.yy” If there’s an easier or better way, please let me know.

Hello RE-Games,

After running several tests I was able to reproduce this results that you are seeing on your end. I found that this is currently a limitation of how the offlline font characters are generated. Thank you for the feed back on this system, we will take into consideration changes to handle rendering zero width characters. As a possible workaround, you could use a widget component containing the text that you need. The zero width character will be rendered correctly using this method. I hope that this information helps.

Make it a great day

Hello RE-Games,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  3. Could you provide screen shots of any settings/blueprints/issue itself that may be involved?

Steps to reproduce in a clean project:

  • Create a New Project (4.16.1)
  • Drag and drop the DSEG 14 Classic ttf into the Content Browser, and answer Yes when it asks if you want to create a font asset
  • Double click on the black-background icon with the white font text on it, for DSEG 14 Classic Bold
  • Change the Font Cache Type from Runtime to Offline
  • Answer Yes and choose the ttf in the dialog. I picked a size of 22
  • The font is now visible. In the preview window where it says “The quick brown fox…:” enter the string “12345” and then move the cursor back a few characters and insert a decimal between the numbers. The desired behavior (as exhibited in Gimp, for instance) is that inserting a decimal into the middle of the string does not cause the characters to the right to move to the right, but this isn’t working here. Something is already wrong… but lets continue…
  • Under Import Options, enable the “Use Distance Field Alpha” option.
  • Go to Asset / Reimport
  • Notice how the decimals disappear from the preview window
  • Repeat the step about inserting decimals again - the other characters in the string now do not move their position when you insert a decimal (good, this is the desired behavior) but the decimal itself is not rendered (bad!)

I’m not using any blueprint, nor have I changed any settings from the defaults. Attached is the screenshot at the end of the above steps… please compare the string at the very bottom with the output in the Preview window to see the issue.

Hope this helps to reproduce the problem. I assume that somewhere the code is looking at a zero-width character, and deciding to increase the width of the string by zero (good) but then it renders the character with a zero width too (bad!) I don’t know the internals of TTF or UE4 and can’t speculate more, but am happy to provide more info if you have specific questions