<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Aug 28, 2018 at 1:23 AM Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2018-08-27 18:01 GMT+02:00 Marcus D. Hanwell <<a href="mailto:marcus.hanwell@kitware.com" target="_blank">marcus.hanwell@kitware.com</a>>:<br>
> On Sat, Aug 25, 2018 at 9:33 AM Elvis Stansvik<br>
> <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>> wrote:<br>
>><br>
>> 2018-08-25 15:05 GMT+02:00 Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>>:<br>
>> > 2018-08-25 14:45 GMT+02:00 Elvis Stansvik<br>
>> > <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>>:<br>
>> >> 2018-08-25 14:04 GMT+02:00 Elvis Stansvik<br>
>> >> <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>>:<br>
>> >>> Marcus, I found this (very) old post of yours where you linked to a<br>
>> >>> Gerrit change in which (I believe) you fixed a problem with the string<br>
>> >>> texture cache of vtkOpenGLContextDevice2D not being invalidated when<br>
>> >>> the font size, color et.c. changes:<br>
>> >>><br>
>> >>> <a href="https://www.vtk.org/pipermail/vtkusers/2011-November/071067.html" rel="noreferrer" target="_blank">https://www.vtk.org/pipermail/vtkusers/2011-November/071067.html</a><br>
>> >>><br>
>> >>> The reason I'm asking is that I'm suspecting that, since the DPI is<br>
>> >>> taken into account when these textures are created, the cache should<br>
>> >>> be invalidated also when the DPI of the render window changes?<br>
>> >>><br>
>> >>> I'm in a situation now where I'm trying to make our application react<br>
>> >>> well to DPI changes, but a simple SetDPI on the render window, the<br>
>> >>> axis label text sizes do not change. So I'm faced with perhaps having<br>
>> >>> to recreate the entire chart when the DPI changes.<br>
>> >>><br>
>> >>> Does it sound plausible that it could be the texture cache mentioned<br>
>> >>> in that old thread?<br>
>> >><br>
>> >> Nevermind, I've just discovered that something is mysteriously<br>
>> >> re-setting the DPI to 72 after I set it.<br>
>> >><br>
>> >> I'll have to investigate that issue instead.<br>
>> ><br>
>> > So the first time setEnableHiDPI is called (and there's a render<br>
>> > window present), the DPI at that time is cached in this->OriginalDPI,<br>
>> > and that DPI is used for subsequent calls.<br>
>> ><br>
>> > I don't see how this can work with runtime DPI changes (when the user<br>
>> > calls SetDPI to set the appropriate DPI)?<br>
>><br>
>> I can work around the problem by re-setting OriginalDPI to 0 directly<br>
>> after I call SetDPI on DPI changes (I'm subclassing QVTKOpenGLWidget,<br>
>> so have access to it), but I doubt this was intended?<br>
><br>
><br>
> That is an old issue, I think we got it fixed, but I am not sure whether the<br>
> font cache would be using the DPI as most of that work predated all this. I<br>
> will try and take a look, but it is many years since I last looked at that<br>
> code.<br>
<br>
Thanks. Just to clarify: With the hack above, it works fine - the text<br>
rendering respects the set DPI.<br>
<br>
What I don't understand is the logic in setEnableHiDPI, because the<br>
way it is written, it means that each time setEnableHiDPI is called<br>
during runtime, the DPI will be re-set to whatever it was when<br>
setEnableHiDPI was called the first time. And when using<br>
QVTKOpenGLWidget, setEnableHiDPI is called on each recreateFBO call.<br>
So it seems to me a user can never call SetDPI on the render window of<br>
a QVTKOpenGLWidget and have it "stick". It will be re-set behind the<br>
scenes :/<br><br></blockquote><div>I was just looking at this yesterday, and agree with your diagnosis. I had overridden void setEnableHiDPI(bool enable) but the signature changed, and now don't see a good way to do that. I am also looking into font scaling issues, at least on Linux with a 4k high DPI display the chart fonts look tiny. I will try and do some more testing, the fonts in Qt look fine so it would appear to be an issue with our rendering somewhere.</div><div><br></div><div>Thanks,</div><div><br></div><div>Marcus</div></div></div>