opcon / QuickFont

A Modern OpenGL Font Rendering Library for OpenTK
https://github.com/opcon/QuickFont
MIT License
81 stars 25 forks source link

NaturallyMonospaced fonts not rendering #47

Open CristianOG opened 4 years ago

CristianOG commented 4 years ago

When loading a font that is naturally monospaced it is not rendered.

Segoe UI.zip

Example using font attached:

image

Any Monospacing option makes no difference.

opcon commented 4 years ago

Hi @CristianOG,

Just confirming a few things:

1) Do non-monospaced fonts load okay? 2) Are other monospaced fonts also rendered incorrectly?

Cheers

CristianOG commented 4 years ago

After some digging I found it's not about monospacing. This is a custom font which comes with no glyphs. So when LoadGlyph is executed GetCharIndex is always 0.

Is there a way to detect this? For example I've got a project where I need to load the embedded fonts from a file, but in this case it should fallback to a system installed font.

It would be good if DrawString reported if the text has been fully rendered, partially rendered or not rendered at all.

opcon commented 4 years ago

Thanks for looking in to it a bit further. I've been pretty busy lately, but I should have some time over the weekend to look in to this.

I agree that some sort of reporting on whether the string rendered correctly or not would be good - I'll have a look at it.

Alternatively, would a simple check for an 'empty/glyph-less' font file be sufficient?

CristianOG commented 4 years ago

Yes, that kind of check would work. Would it be possible to load it's config into another font? Let's say I get a custom Segoe UI font without glyphs, but with some metadata in it used in the rendering, and I want to get the system Segoe UI font and render it with the metada from the custom font. Is that possible? Does it make sense?

Many thanks for the help.