phip1611 / noto-sans-mono-bitmap-rs

Provides pre-rasterized characters from the "Noto Sans Mono" font in different sizes and font weights for multiple unicode ranges.
MIT License
28 stars 4 forks source link

Gamma correction #24

Open toothbrush7777777 opened 6 months ago

toothbrush7777777 commented 6 months ago

Should the font image values be gamma-corrected for standard displays (i.e. sRGB) instead of being linear intensities? In other words, should the values be linear_to_srgb(intensity)?

It isn't very hard to filter the values when creating the font images – this can be done with a 256-byte lookup table – and would be a lot faster than doing so when using the values to create the fonts.

The characters look better and less blurry after gamma correction for sRGB displays.

phip1611 commented 6 months ago

Sounds correct, yes. TBH, I never thought about this.

toothbrush7777777 commented 6 months ago

Yeah, I messed around with gamma encoding a bit when I was writing a physically-based renderer a few months ago, and gamma correction is absolutely vital for any kind of realistic render.

Gamma correction is not such a huge deal for standard GUIs, but I noticed that the font on low-PPI displays looks a lot better with gamma correction.

Shall I create a pull request for that?

phip1611 commented 2 months ago

Shall I create a pull request for that?

Yes, I will appreciate that very much!