ni / labview-icon-editor

Source for LabVIEW's icon editor
MIT License
12 stars 8 forks source link

Wanted: pixel-exact cross-platform icon fonts #7

Open rtollert opened 4 months ago

rtollert commented 4 months ago

This is something I always wanted to see eventually; I spoke with AristosQueue a couple of years ago and IIRC he opined approximately the same thing.

The Icon Editor relies on LabVIEW's text drawing functions, which in turn relies on platform-specific text rendering behavior. On Windows this is basically guaranteed to do what we want by default, because all fonts are max-hinted at small sizes. But on Linux the fonts tend to come out antialiased. So the same icon operations can result in radically different-looking results, depending on what OS you were making the changes in. Which explains stupid little details like "all of the icon text for the Multiple Errors VIs is antialiased" — the feature was developed mostly on MacOS. (Another problem is that LabVIEW's text compositing is just completely unaware of alpha blending, but AFAIK that's a bug with LabVIEW, not with the Icon Editor.)

Additionally, the Icon Editor uses significantly different default fonts on different platforms. The default font is Small Fonts, because it is far and away the best font for the job on Windows. But that font doesn't exist on Linux, so there, it falls back to Sans. If we were to use a font that exists on all platforms, it would probably need to be Arial, and I'm not particularly thrilled about that.

Potential solutions:

JayKayAce commented 4 months ago

How would a user go by creating his own font? Say I wanted to make this font https://youtu.be/wOntiXaIu2o?si=Esz7u35JgFlVlwuT&t=656 image Would that be doable and ship it with the icon editor?

rtollert commented 3 months ago

I can't speak as to inclusion, although I will opine that the Icon Editor doesn't have a great track record when it comes to managing user IP — it's always bugged me that I can't define glyph libraries on e.g. a per-project basis. But I haven't thought about that hard enough to distill it into a filable issue.

Character sets are going to be a serious complication. AFAIK, the Icon Editor (like most of the rest of LabVIEW) uses the system encoding. so e.g., in relation to your sample font, LabVIEW literally does not support the use of an encoding which supports literally all of the glyphs in that image. This has serialization implications for the Icon Text tab.

On top of that (and this is something I realized only just now) I think that the statement "writing a bitmap font is pretty easy" is rather Western-centric. Rolling one's own ASCII bitmap font is a thing; rolling one's own CJK bitmap font is, ah, not. And I'm pretty sure that there are many Asian LabVIEW users who would effectively lose major functionality if CJK were unavailable to them in the Icon Editor.

So my first opinion was going to be "just roll our own PNG font atlas format" because traditional bitmap font formats are kind of horrible? But maybe the right approach is PCF. Or, perhaps, both.

JayKayAce commented 3 months ago

I think it is an interesting approach to have pr project templates/glyphs, but it would be best to track it in a separate issue ;)