Giter VIP home page Giter VIP logo

Comments (16)

Qrox avatar Qrox commented on May 18, 2024 1

So, judging from the r character, the non-ImGUI window is using Terminus, whereas the ImGUI window is using unifont, so this is indeed related to #73061. The blurry characters is actually a separate issue related to unifont. The unifont we're using is a vector font without embedded bitmap font for specific font sizes, so it renders across pixel boundaries resulting in gray pixels.

I made a modified unifont file with embedded bitmap font for font size 16 in #66749 which can probably work around this problem. That PR has stalled, but you can try replacing data/font/unifont.ttf with the version in that PR and see if it fixes the blurry characters.

I'm not sure if we can fix it for all font sizes though. Previous I tried to shift the glyphs horizontally by a fraction of a pixel but that still resulted in blurry characters. Subpixel rendering might fix it but it was more complicated than I expected. Maybe we can let the user turn antialiasing on or off for individual fonts, which might fix it.

from cataclysm-dda.

katemonster33 avatar katemonster33 commented on May 18, 2024 1

Fooled around in the options a bit. This appears to be an issue related to having the Renderer option set to "software". On opengl setting the problem is gone, the window looks exactly like it does on Windows.

from cataclysm-dda.

Qrox avatar Qrox commented on May 18, 2024

Looks like the ImGUI window is using a different font. For example the r looks different from the non-ImGUI window. Also, if you look closely you can see that the ImGUI font has gray pixels which suggests that it fails to use the bitmap version of the vector font. Could you post your config/fonts.json?

from cataclysm-dda.

NetSysFire avatar NetSysFire commented on May 18, 2024

I do not remember changing anything of this, so it is probably the default.

{
  "typeface": [ "Terminus", "unifont" ],
  "map_typeface": [ "Terminus", "unifont" ],
  "overmap_typeface": [ "Terminus", "unifont" ]
}

Additionally, have all the font-specific options in options.json I grepped::

{ "info": "Highlight selected item's contents and parent container in inventory screen.  \"Symbol\" shows a highlighted caret and \"Highlight\" uses font highlighting.", "default": "Default: symbol - Values: symbol, highlight, disable", "name": "INVENTORY_HIGHLIGHT", "value": "symbol" },
{ "info": "If true, will display scrolling combat text with Unicode font.", "default": "Default: True", "name": "ANIMATION_SCT_USE_FONT", "value": "true" },
{ "info": "If true, vector fonts may look better.", "default": "Default: False", "name": "FONT_BLENDING", "value": "true" },
{ "info": "Set the font width.  Requires restart.", "default": "Default: 8 - Min: 6, Max: 100", "name": "FONT_WIDTH", "value": "8" },
{ "info": "Set the font height.  Requires restart.", "default": "Default: 16 - Min: 8, Max: 100", "name": "FONT_HEIGHT", "value": "16" },
{ "info": "Set the font size.  Requires restart.", "default": "Default: 16 - Min: 8, Max: 100", "name": "FONT_SIZE", "value": "16" },
{ "info": "Set the map font width.  Requires restart.", "default": "Default: 16 - Min: 6, Max: 100", "name": "MAP_FONT_WIDTH", "value": "16" },
{ "info": "Set the map font height.  Requires restart.", "default": "Default: 16 - Min: 8, Max: 100", "name": "MAP_FONT_HEIGHT", "value": "16" },
{ "info": "Set the map font size.  Requires restart.", "default": "Default: 16 - Min: 8, Max: 100", "name": "MAP_FONT_SIZE", "value": "16" },
{ "info": "Set the overmap font width.  Requires restart.", "default": "Default: 16 - Min: 6, Max: 100", "name": "OVERMAP_FONT_WIDTH", "value": "16" },
{ "info": "Set the overmap font height.  Requires restart.", "default": "Default: 16 - Min: 8, Max: 100", "name": "OVERMAP_FONT_HEIGHT", "value": "16" },
{ "info": "Set the overmap font size.  Requires restart.", "default": "Default: 16 - Min: 8, Max: 100", "name": "OVERMAP_FONT_SIZE", "value": "16" },
{ "info": "If true, use SDL ASCII line drawing routine instead of Unicode Line Drawing characters.  Use this option when your selected font doesn't contain necessary glyphs.", "default": "Default: True", "name": "USE_DRAW_ASCII_LINES_ROUTINE", "value": "true" },

from cataclysm-dda.

NetSysFire avatar NetSysFire commented on May 18, 2024

That PR has stalled, but you can try replacing data/font/unifont.ttf with the version in that PR and see if it fixes the blurry characters.

I did but it does look even worse in this case than without the modified font. Worth a try though.

from cataclysm-dda.

Qrox avatar Qrox commented on May 18, 2024

I did but it does look even worse in this case than without the modified font.

Could you post a screenshot?

from cataclysm-dda.

NetSysFire avatar NetSysFire commented on May 18, 2024

Sure, with your custom font:

image

Without:

image

from cataclysm-dda.

Qrox avatar Qrox commented on May 18, 2024

Looks like it's still using the vector version of the font. Not sure if there's something wrong with the font or how ImGUI handles embedded bitmap font.

from cataclysm-dda.

Qrox avatar Qrox commented on May 18, 2024

image

Looks like it uses the bitmap glyphs for Chinese characters but uses the vector glyphs for English characters, and the color is also different. Intriguing. @katemonster33 Do you have any idea why this happens?

from cataclysm-dda.

katemonster33 avatar katemonster33 commented on May 18, 2024

image

Looks like it uses the bitmap glyphs for Chinese characters but uses the vector glyphs for English characters, and the color is also different. Intriguing. @katemonster33 Do you have any idea why this happens?

This happens because of #72579 , to get around ImGui's font rendering so that we can draw CJK characters without needing to cache all of them, I made ImGui call into CDDA's font rendering code to draw any character which doesn't exist in its cache.

We could have the same logic apply to all font drawing in ImGui, just have every character drawn by CDDA's code. This would have the added benefit of fixing the issue where ImGui does not respect the user's font choice. The only issue I could see would be the extra CPU usage, because ImGui screens tend to draw more frequently than the old screens. ImGui has this nice logic where it renders text in huge batches using SDL_RenderGeometry which makes it very efficient. But maybe the CPU hit won't be too bad.

from cataclysm-dda.

katemonster33 avatar katemonster33 commented on May 18, 2024

very weird. in windows the imgui UIs look fine.

Image

from cataclysm-dda.

katemonster33 avatar katemonster33 commented on May 18, 2024

Image
I zoomed in on the 'X' button on the window. Linux on top, Windows on bottom.
seems like transparency is off in linux? but why? so strange

from cataclysm-dda.

Qrox avatar Qrox commented on May 18, 2024

Is ImGUI using SDL for font rendering? If so you might want to check what blending mode and font hinting is used in Linux and Windows.

from cataclysm-dda.

NetSysFire avatar NetSysFire commented on May 18, 2024

image

My settings, for reference. I am also using the software renderer since ages.

from cataclysm-dda.

NetSysFire avatar NetSysFire commented on May 18, 2024

I can confirm that the fonts look so much more crisp on opengl

from cataclysm-dda.

Qrox avatar Qrox commented on May 18, 2024

I am using direct3d11 and the font also looks blurry. Changing to opengl does not fix it either. My game is compiled with MinGW-w64, if that matters.

from cataclysm-dda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.