GithubHelp home page GithubHelp logo

DPI issue on OSX about mahi-gui HOT 4 OPEN

mahilab avatar mahilab commented on August 16, 2024
DPI issue on OSX

from mahi-gui.

Comments (4)

epezent avatar epezent commented on August 16, 2024

@mindv0rtex , DPI scaling is a WIP and currently has no effect. The whole thing was pushed prematurely, regretfully. I was using Syntacts and the example mahi-gui app as testing grounds while working on it.

In its present form, mahi-gui should do no DPI scaling yet (despite the option existing). I thought I would have this worked out soon enough that no one would catch it, but life got in the way. I just added a warning comment to not use it yet (it's the best I can do for now).

Sorry for the mess. Hopefully this is something I can resolve sooner than later.

Regarding sharper fonts, the general idea is that you load the font at a large size (e.g. 12 pt * dpi_scale), and then apply a global font scaling (e.g. 1.0 / dpi_scale). I was trying to make this work in Application.cpp, but did not get it finished.

DPI scaling ImGui in general is a bit confusing. There are two approaches: 1) manually scale all of ImGui's styling sizes and any hard coded window sizes, or 2) scale the framebuffer and continue to work under the assumption of 96 DPI. The latter is preferred, and what I hope to get working eventually.

from mahi-gui.

yan-zaretskiy avatar yan-zaretskiy commented on August 16, 2024

I am sorry I stumbled upon an unfinished feature I was not meant to find 😄

Regarding sharper fonts, the general idea is that you load the font at a large size (e.g. 12 pt * dpi_scale), and then apply a global font scaling (e.g. 1.0 / dpi_scale). I was trying to make this work in Application.cpp, but did not get it finished.

Is this something I can do now with mahi-gui or would I need to use vanilla Dear Imgui?

from mahi-gui.

yan-zaretskiy avatar yan-zaretskiy commented on August 16, 2024

@epezent, in case this could be helpful for you, I managed to make your code work for Retina scaling with very minor tweaks:

  • Changed enable_dpi_aware() to return 2.0f. I realize this is a hard-coded value, I was just trying to see if I could get it to work...
  • Removed dpi scale multiplier in methods that set/get window sizes.

Font size scaling and the DPI scaling method 1 are left untouched. I get nice crisp looking fonts now.

from mahi-gui.

yan-zaretskiy avatar yan-zaretskiy commented on August 16, 2024

Looks like this param in GLFW is relevant:

GLFW_COCOA_RETINA_FRAMEBUFFER specifies whether to use full resolution framebuffers on Retina displays. Possible values are GLFW_TRUE and GLFW_FALSE. This is ignored on other platforms.

from mahi-gui.

Related Issues (19)

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.