Giter Club home page Giter Club logo

Comments (6)

brunoalr avatar brunoalr commented on May 30, 2024 1

Hi, @dakhouya , thanks for opening the bug and posting a solution. I don't plan on supporting multiple qt versions - in fact I am considering switching to something as portable as qt, such as https://github.com/ocornut/imgui - but since this fix is minimal, a pull request is more than welcome :D

from openimagedebugger.

dakhouya avatar dakhouya commented on May 30, 2024 1

Will do then!

from openimagedebugger.

brunoalr avatar brunoalr commented on May 30, 2024 1

@dakhouya yeah, it makes sense. but thanks a lot anyways :D It's just that I have only so much bandwidth and lately I am the only one maintaining the project, so I have to impose some limitations. The sad part is that I don't have a strong background in CG as @csantosbh has, so I prefer to improve code quality and developer experience :) if you have any feature you would like to contribute feel free to chime in

from openimagedebugger.

dakhouya avatar dakhouya commented on May 30, 2024

If the support for old version of Qt is wanted, something like this could do the job.

diff --git a/src/ui/gl_text_renderer.cpp b/src/ui/gl_text_renderer.cpp
index 89362bf..d682009 100644
--- a/src/ui/gl_text_renderer.cpp
+++ b/src/ui/gl_text_renderer.cpp
@@ -165,7 +165,11 @@ void GLTextRenderer::generate_glyphs_texture()
     const int cropped_bitmap_height = real_ascent - real_descent;
 
     for (p = reinterpret_cast<const unsigned char*>(text); *p; p++) {
-        int advance_x     = g.horizontalAdvance(*p);
+        #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
+            int advance_x     = g.horizontalAdvance(*p);
+        #else
+            int advance_x     = g.width(*p);
+        #endif
         int bitmap_height = g.height();
 
         text_texture_advances[*p][0] = advance_x;
@@ -193,7 +197,11 @@ void GLTextRenderer::generate_glyphs_texture()
 
     int x = 0;
     for (p = reinterpret_cast<const unsigned char*>(text); *p; p++) {
-        int advance_x = g.horizontalAdvance(*p);
+        #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
+            int advance_x     = g.horizontalAdvance(*p);
+        #else
+            int advance_x     = g.width(*p);
+        #endif
 
         text_texture_offsets[*p][0] = x + border_size;
         text_texture_offsets[*p][1] = real_descent + border_size;

If needed I don't mind opening a PR.

from openimagedebugger.

dakhouya avatar dakhouya commented on May 30, 2024

@brunoalr with the latest changes which required Qt 5.12.8+ in cmake, I think this issue can be close.

from openimagedebugger.

dakhouya avatar dakhouya commented on May 30, 2024

I'm not sure if I have much time yet, but lets see!
Thanks for your work on this project btw!

from openimagedebugger.

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.