Weird behavior of “IF” in common with “FONT-SIZE”

Forums Desktop Info Weird behavior of “IF” in common with “FONT-SIZE”

Tagged: 

Viewing 8 reply threads
  • Author
    Posts
    • #4739
      markusmoench
      Participant

      Hello Glen,

      I´m facing some strange behavior in case on the IF-Function, trying to set the FONT-SIZE.

      code is:
      #############################
      font-size=8
      # adjust fontsize and width according to screen resolution
      MONITOR=set:dpi,hidden:1,display:%7
      TEXT=display:dpi %dpi%

      #if dpi is larger than 96 then
      #IF=value1:%dpi%,value2:96,comp:gt
      #font-size=16

      comment=before_IF_in_common_with_FONT

      IF=value1:33,value2:96,comp:eq
      comment=first_IF_result_is_not_equal

      IF=value1:33,value2:96,comp:eq
      FONT-SIZE=16

      IF=value1:33,value2:96,comp:eq
      comment=third_IF_result_is_not_equal

      #surface pro 4 has 168dpi
      #font-size=16
      #width=450
      #############################

      We would expect that all three IF are getting result FALSE and the commands in following line are not executed, right?
      Result we get is:
      comment #1 displayed with size 8
      IF #1 correctly processed, no output
      IF #2 font size set to value 16
      IF #3 text “third_IF_result_is_not_equal” displayed in font size 16

      tested on 2 different PC

      Windowns 21h1
      Desktopinfo v3.2.4.4142

      best regards
      Markus

    • #4741
      rtruss
      Participant

      I saw this and thought, this would be VERY helpful as I have many diff mfgs and of course potential dpi settings to contend with. I copied your code and notices that your IF statements do not do the compare correctly.

      this code
      MONITOR=set:dpi,hidden:1,display:%7
      TEXT=display:dpi %dpi%
      tells to set DPI, which if you look at it is not just a number but actually dpi 96. once I updated the IFs they seemed to process correctly from what I could tell.

    • #4742
      markusmoench
      Participant

      Hello rtruss,
      the three IF statements are comparing number 33 with 96 each – they are not tied to a variable in this example.
      My issue is that the IF function is not working anymore after having “FONT-SIZE” in the executed line after.

      I believe the %dpi% variable is always filled with just a number.

    • #4743
      rtruss
      Participant

      All i can tell you is that when i changed the comparisons to use ‘dpi 96’ vs just 96 they processed the comments. Now I had not yet had coffee 🙂 and was doing like 6 other things so I will revisit as I would like this to work as well.

    • #4744
      rtruss
      Participant

      I see what threw me off. tour text line, I didn’t see the first dpi in there.

    • #4747
      Glenn
      Keymaster

      the FONT-SIZE lines are not items per se. Check the manual page 23. They are evaluated once during config load to set the default font size for the following items. Font size is not a dynamic thing. i suggest you put this section at the top of your config wrapped in BEGIN-ONLOAD / END-ONLOAD pair.

    • #4748
      markusmoench
      Participant

      great, this was working. I did the code like this:

      thanks for your much appreciated support

    • #4750
      rtruss
      Participant

      will it re-evaluate that if there is a monitor change or if you hit the reload button? I am asking about the monitor change as we do use this on VDI units and if someone has multiple monitors that they can move the ‘rdp’ connection to that may affect the dpi.

    • #4751
      markusmoench
      Participant

      yes, it will rescan the dpi and set accordingly within the BEGIN-ONLOAD group

Viewing 8 reply threads
  • You must be logged in to reply to this topic.
Glenn's Page