Page 1 of 1

Font shows red in preview even though all characters available

Posted: Fri Oct 21, 2016 5:06 pm
by nabsltd
I have a lot of fonts that show as red in the preview (implying missing characters from the preview), even though all characters are there.

Many of these fonts have been run through FontCreator by me to change properties like name, foundry, embedding, etc., but some have been untouched. It turns out that the "missing" character in all these fonts is the space (ASCII 0x20).
PreviewSpace.jpg
PreviewSpace.jpg (26.42 KiB) Viewed 2606 times
With the space gone from the preview, no red:
PreviewNoSpace.jpg
PreviewNoSpace.jpg (39 KiB) Viewed 2606 times
I've looked at the fonts, and it appears that if the glyph for space is mapped to more code points than $20, that triggers the problem:
SpaceGlyphDetails.jpg
SpaceGlyphDetails.jpg (177.9 KiB) Viewed 2606 times

Re: Font shows red in preview even though all characters available

Posted: Fri Oct 21, 2016 5:31 pm
by Erwin Denissen
I think the main issue is the fact the first glyph is known as the missing glyph. So if you have your space character mapped to the first glyph, it is treated as missing. Can you confirm this?

Re: Font shows red in preview even though all characters available

Posted: Fri Oct 21, 2016 6:27 pm
by nabsltd
Erwin Denissen wrote:I think the main issue is the fact the first glyph is known as the missing glyph. So if you have your space character mapped to the first glyph, it is treated as missing. Can you confirm this?
Adding a ".notdef" glyph fixed the problem, so that was it.

Is having the first/missing glpyh also mapped to a code point a violation of the OpenType spec? If not, then MainType should handle this correctly and not show the preview in red.

Also, is it possible that FontCreator does something that can create this issue with commercial fonts that don't already have it? Generally, all I do is sort by Unicode codepoint, and then change some of the properties (like name). My original "AdobeGaramondPro-regular.otf" file doesn't show this issue, but the version with the font renamed to "Adobe Garamond Pro" using FontCreator 8.0 does. I just ran it through FontCreator 10 and sorted the glyphs, then renamed, and there were no issues, so maybe it's an old bug. Either way, an enhancement to FontCreator's Validation that makes sure that the first glyph is an unmapped ".notdef" glyph would be nice.

Re: Font shows red in preview even though all characters available

Posted: Fri Oct 21, 2016 7:41 pm
by Bhikkhu Pesala

Re: Font shows red in preview even though all characters available

Posted: Tue Oct 25, 2016 1:07 am
by nabsltd
Bhikkhu Pesala wrote:Recommended Glyphs
So, it's not required to have those glyphs the OpenType spec, which means MainType should handle the font correctly.

Re: Font shows red in preview even though all characters available

Posted: Tue Oct 25, 2016 12:59 pm
by Erwin Denissen
nabsltd wrote:Adding a ".notdef" glyph fixed the problem, so that was it.
That is good to know!
nabsltd wrote:Is having the first/missing glpyh also mapped to a code point a violation of the OpenType spec? If not, then MainType should handle this correctly and not show the preview in red.
MainType uses a default Windows control which has no options to change the way the rendering functionality works.

Re: Font shows red in preview even though all characters available

Posted: Tue Oct 25, 2016 6:44 pm
by nabsltd
Erwin Denissen wrote:MainType uses a default Windows control which has no options to change the way the rendering functionality works.
You must do something, because you decide to change to red text if characters are missing. The control doesn't know about such things...only MainType does. So, change your "missing" logic so that fonts without truly missing characters don't display in red.

Re: Font shows red in preview even though all characters available

Posted: Tue Oct 25, 2016 6:51 pm
by Erwin Denissen
Point taken. We use a windows API to detect if all characters are available. I doubt if we can do anything easy to improve this. Of course we can build our own logic, but we have more important things on our to-do list.