Skip to content

Conflict with base-R's file.choose() #36

Closed
r-lib/systemfonts
#136

Description

@torden81

There seems to be a conflict with base-R's file.choose() when loading 'ragg' on Windows 10.

library(ragg)
file.choose()

leads to a "Select files" dialog where all fonts have disappeared.
The issue also exists for choose.files() and choose.dir() from the utils-package.

Interestingly, if executing from a fresh session:

file.choose()
library(ragg)
file.choose()

the fonts are shown correctly, indicating that calling file.choose() caches the fonts before the conflict with 'ragg'.

Any help with this issue would be appreciated.

Activity

  1. thomasp85 commented on Oct 4, 2023

    @thomasp85
    Member

    ragg does not interface in any way with base/utils file API so I'm a bit at a loss here...

    Can the issue be reproduced with loading either systemfonts or textshaping?

  2. torden81 commented on Oct 4, 2023

    @torden81
    Author

    It is indeed caused by 'textshaping'. If I substitute 'ragg' for 'textshaping' in my description above, the exact same issue is triggered.

  3. thomasp85 commented on Oct 4, 2023

    @thomasp85
    Member

    Thanks for confirming - does loading systemfonts trigger it as well?

  4. torden81 commented on Oct 4, 2023

    @torden81
    Author

    No, systemfonts is fine.

  5. thomasp85 commented on Oct 4, 2023

    @thomasp85
    Member

    Thanks. Can you provide a screenshot of the behaviour as I don't fully understand the description in the first post🙂

  6. torden81 commented on Oct 4, 2023

    @torden81
    Author

    Here we go. :)
    All letters within the file dialog have disappeared.

    image

  7. thomasp85 commented on Oct 4, 2023

    @thomasp85
    Member

    Thanks - and this only happens with the file selector summoned by file.choose(), not anything outside of R in the general windows UI?

  8. torden81 commented on Oct 5, 2023

    @torden81
    Author

    It seems that it is only happening in the R session that summons the file selector by file.choose() and has 'textshaping' loaded.

    I tested simultaneously with another R session that didn't have 'textshaping' loaded. There all letters were shown. Similarly I had no issues with the file selector in Edge, Firefox and Acrobat Reader.

    Let me know if I can test something else.

  9. transferred this issue fromr-lib/raggon Oct 6, 2023
  10. thomasp85 commented on Oct 6, 2023

    @thomasp85
    Member

    This issue seems to be connected with #35

  11. jeroen commented on Oct 6, 2023

    @jeroen
    Member

    Can you try installing the latest dev versions and test if the problem still exists?

    install.packages("textshaping", repos = "https://r-lib.r-universe.dev")
  12. torden81 commented on Oct 6, 2023

    @torden81
    Author

    Can you try installing the latest dev versions and test if the problem still exists?

    install.packages("textshaping", repos = "https://r-lib.r-universe.dev")

    This installed the dev version '0.3.6.9000' and the problem persists.

  13. torden81 commented on Dec 18, 2023

    @torden81
    Author

    It seems that the issue is also connected to rstudio/rstudio#13078

  14. jeroen commented on Jan 8, 2025

    @jeroen
    Member

    I suspect the R package textshaping.dll conflicts with a Windows system dll C:\Windows\System32\TextShaping.dll because windows file paths are case insensitive.

    Windows needs C:\Windows\System32\TextShaping.dll to render text in the dialog box. In the graphical WinGUI this dll is loaded at the start, but in Rterm this dll gets lazy loaded when calling file.choose().

    However, if the R package textshaping.dll is loaded first, Windows might think this DLL is already loaded, and not load it again. So it fails to find the procedures to render text.

    You can confirm in Rterm that the problem disappears by manually loading the system TextShaping.dll first:

    dyn.load("C:\\Windows\\System32\\TextShaping.dll")
    library(textshaping)
    file.choose()
  15. torden81 commented on Jan 9, 2025

    @torden81
    Author

    I suspect the R package textshaping.dll conflicts with a Windows system dll C:\Windows\System32\TextShaping.dll because windows file paths are case insensitive.

    Windows needs C:\Windows\System32\TextShaping.dll to render text in the dialog box. In the graphical WinGUI this dll is loaded at the start, but in Rterm this dll gets lazy loaded when calling file.choose().

    However, if the R package textshaping.dll is loaded first, Windows might think this DLL is already loaded, and not load it again. So it fails to find the procedures to render text.

    You can confirm in Rterm that the problem disappears by manually loading the system TextShaping.dll first:

    dyn.load("C:\\Windows\\System32\\TextShaping.dll")
    library(textshaping)
    file.choose()

    This is a great workaround! It will save my coworkers and me some headaches.
    Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions