FLTK logo

Re: [fltk.general] Re: Can custom box type functions handle their own high-DPI screen scaling?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: Can custom box type functions handle their own high-DPI screen scaling? Bill Spitzak Feb 25, 2021  
 
I recommend the existing fl_push_matrix and fl_pop_matrix be used, and one new function that sets the scale to 1:

fl_push_matrix();
fl_reset_scale();
draw();
fl_pop_matrix();

Setting the scale to 1 probably should preserve translation and rotation, and maybe even mirror images. This is scale(1/abs(det)) where det is the determinant of the current matrix. It might make sense for this to round the translation to the nearest integer, that may be expected by code using this.


On Thu, Feb 25, 2021 at 9:40 AM Albrecht Schlosser <AlbrechtS.fltk@online.de> wrote:
On 2/25/21 3:54 PM Manolo wrote:
>
> On Thursday, February 25, 2021 at 1:57:34 PM UTC+1 Albrecht Schlosser wrote:
>
>     If there's anything wrong with my test program, please tell me.
>
> Yes. There is. That program assumes the font face and size are correctly
> set when fl_text_extents() is called. But that's not the case at
> the very beginning of the draw() method.
>
> If you add
>      fl_font(labelfont(), labelsize());
> just before
>      fl_text_extents(label(), dx, dy, ll, lh);
> all runs smoothly.

Ooh, what a silly mistake, sorry for the noise. I had copied things
around and obviously deleted that line.

Works now, as you say. Thanks for the correction.

> The transient window display lets the font size to large values which
> produce erroneously large colored boxes later.

Yep, that explains it very well.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/5d22c61e-f4b3-4ec2-ea84-bc1270afdc14%40online.de.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAL-8oAh2OGSOJF-N7gkrh1puTpAUyx695x92g7k%2Bso3oeT_C-g%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.