how to use SVG files for cursors?


schmibble

Member
Local time
2:58 AM
Posts
8
OS
Windows 11
TL/DR can someone point me to a comprehensive source/sources of information on the technical aspects of how Windows uses cursor size in Windows 11, most especially with regard to SVG files for cursors? Looking for precise information on how Windows decides when to use different sizes, how to force Windows to use an SVG file for cursors if that's possible, and any other information pertinent to using SVGs for cursors. More specific questions follow at the end of "Details".

And thanks very much for any help! I worked on this issue for half a day and am now at the point where I've gotten everything there is to get from the web. That's it, no more info available, so I need help from an expert who knows the issue. I will be most grateful for your time.

Caveat: this question might conceptually seem to belong in the Custom cursors thread, but the focus there is on actual cursors to be posted and downloaded, not procedural questions like this one (notwithstanding the fact that a post on the equivalent thread from tenforums does contribute to this issue; see below).

=========================

Details:
```````````
As I move over to Windows 11, I am about to take a substantial amount of time to create some new custom cursors (icons too, but that's a different beast) in honor of the new, much more powerful laptop I've acquired in order to run the new OS without horrific time lags. Of course, the downside is that making really cool cursors, especially at the higher resolutions supported by Win11, takes lots of time in a bitmap editing program. I've just stumbled across the fact that Win10/11 can use SVG files for cursors, and since producing vector graphics is a lot less work than making bitmaps, this would be awesome.

Unfortunately I can find no tutorials or even official Microsoft specification info for creating--or even using--SVGs as cursors in Windows. Plenty of stuff for using SVGs as icons/cursors on web pages (controlling them with CSS) and there's also a substantial amount of discussion about SVG cursors/icons on Linux platforms, but basically nothing for Windows--even by Microsoft. The Microsoft Learn site's page on cursors mentions nothing at all about SVGs (About Cursors - Win32 apps). I've now spent a long time (3 hours? four?) doing variously worded searches such as "+SVG +cursors +Windows documentation -web -linux" (using the Startpage search engine which unlike both Google and DuckDuckGo actually implements the operators for inclusion and exclusion). Some searches were more general than this example, some more specific; none of them have yielded any official material from Microsoft nor any extended discussion of the issue.

As a testament to the helpfulness of Shawn Brink's set of sites, I only found two semi-helpful sources, both forum posts, and one of them is located here in Shawn's bailiwick: Custom Cursors - Windows 10 Help Forums . However, this post and the other one (reddit) were just short comments. At least the one here, by Hopachi, included the crucial point that Windows doesn't actually use a vector-display function the way a browser does when it refers to CSS to display an SVG; instead, Windows generates a bitmap and uses that. The post also noted that there's no animation possible during this process--static cursors only.

So all kudos to poster Hopachi for at least that much. It's more than I could find anywhere else. Nonetheless, if someone wishes to use SVG files for cursors, that post (and the shorter, less helpful Reddit one) raises more questions than it answers. So let me start with a basic observation, and someone please confirm if I'm wrong, but from the very few comments available on the web, it seems that we begin with the following fundamental issue:

--There is no way to tell Windows to use an SVG image as cursor for a specific pointer type. Windows simply will not do that. Therefore one cannot create a vector file that can be used directly as a cursor. --

So how does Windows use SVGs for cursors, then? Here's what I've been able to piece together after a long time of searching and reading very scattered and fragmented bits of info, along with my questions.

1. Hopachi says that Windows uses "the built-in system black / white / inverted CUR files for the regular size. But if you increase the pointer size then the SVG gets used and generated CUR gets saved at mentioned location."

This is probably clear to others but my dummy brain needs more help. Here's what I think Hopachi meant: In the cursors that ship with Windows (not the aero cursors), not only are there are various *.cur files in the standard roles, but also an SVG file for each role. When Windows uses this shipping icon set, it will NOT default to using the SVG file for any of the cursor functions. Instead it will use the regular bitmap *.cur file--that is, unless the user takes advantage of the Mouse Pointer dialog to change the cursor size AND if Windows doesn't find a *.cur with an appropriate size inside. If this scenario obtains, Windows will then use the shipping SVG file to generate a new *.cur file for that size. Correct?

This raises a few questions that are important if you want to create SVGs for cursor use:

When the user changes display size (not mouse pointer size), presumably Windows should change cursor size along with the new resolution. Does Windows ever use SVGs to create new cursors under this scenario? e.g. a user might change display size to a nonstandard resolution for which there's no cursor of a size that will work very well. It's been awhile but IIRC high-end gaming cards can sometimes support such nonstandard monitor resolutions. But if Windows only uses SVGs when the user goes into Mouse Dialog and changes pointer size, that severly limits the usefulness of SVGs as dynamic cursor sources. Surely the answer is No? Surely Windows uses SVGs for more than just this and the color-customization available in Settings | Accessibility | Mouse pointer and touch. Please confirm.

Also, does Windows reliably switch to an SVG-generated cursor when there truly aren't bitmap *.cur images of the correct size? If it does, that might mean that I could create a nice SVG image in CorelDraw, convert/edit that image in Photo-Paint to just a single nice, full-sized 32x32 cursor taking up all the canvas (and thus "extra large" in Microsft aero terms) with the ending cursor-size indicator "_rl" (what Microsoft uses for "extra large" in its non-aero cursor set). Then I might paste my custom cursor into Windows\Cursors along with the original SVG file of the same name. Then I could use the Mouse Pointer dialog to tell Windows to use that *.cur file. After using it for a while, make sure it works fine, then I could return to the Mouse Pointer dialog and downsize to the smallest-size icon (see Multi-resolution cursors on Windows · Issue #149 · ful1e5/Bibata_Cursor for downsize sizes.) In this scenariom, will Windows use my accompanying SVG file to create a nice decent *.cur, or will it ignore my SVG and just downsample, therefore presenting a blurry mess?

2. Hopachi also says, "Just set one up, with the colour you like, and it gets saved in %localappdata%\Microsoft\Windows\Cursors".

This is a bit more opaque. Hopachi is talking about Settings | Accessibility | Mouse pointer and touch. Is this functionality limited to Windows shipping cursors? In other words, if I create a bitmap and accompanying SVG file of the same name and then choose that cursor via Mouse Properties, can I then go to this Settings page and modify my custom cursor with a new color, created by Windows from the SVG file that accompanied the *.cur file?

Thanks a ton for any help.
 
Windows Build/Version
24h2
Last edited:

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    ASUS
    CPU
    Intel i7-13620H 10-Core
    Motherboard
    ASUS TUF FX507
    Memory
    32GB DDR5
    Graphics Card(s)
    GeForce RTX 4070
    Sound Card
    onboard
    Monitor(s) Displays
    laptop screen or Dell U3223QE
    Screen Resolution
    1980 or 2160, depending on laptop screen or desktop monitor
    Hard Drives
    SSD
    PSU
    laptop
    Case
    laptop
    Cooling
    laptop
    Keyboard
    laptop
    Mouse
    logitech M525
    Internet Speed
    5g
    Browser
    Firefox
TL/DR can someone point me to a comprehensive source/sources of information on the technical aspects of how Windows uses cursor size in Windows 11, most especially with regard to SVG files for cursors?
I couldn't find anything comprehensive when I looked.

Windows always uses bitmapped cursors. The SVG files in the Windows\Cursors folder are used to generate bitmapped cursors for the settings page: Accessibility - Mouse Pointer page. The sizing option generates the cursors at sizes from 32x32 upwards in 16 pixel increments. so the first increment is a 50% increase, the next 33%, then 25% etc.

As you mention the "Accessibility" cursors are all static, and start at roughly the same size as the Windows default (Aero) scheme. As soon as you make a selection a complete set of cursors is generated and each time you cange the size or colour or style they are all regenerated, overwriting your previous selection. So, to use different styles for different cursors you have to copy the cursor files elsewhere. You can't usefully mix different size cursors. Windows will always render all cursors to the same size bitmaps. If the desired size isn't available in the particular cursor file you choose, Windows will resize as required. The one nice thing about the "Accessibility" cursors is that the outlines are thicker than the default cursors, which I find helpful on my 27" 4K monitor.

The actual size of the cursors that windows uses depends on the base cursor size, and the display scale, but I think it's restricted to the standard cursor size increments. These are 100% 150% 200% 300%. I'm writing this on a PC connected to a 4K TV at the reccomeneded 300% scaling with a 32 cursor base size, and the cursors look as though they are 96x96. I run the same cursor set at 48 base size on my 27" monitor at 150% scaling where they end up at 72x72.

If you want to design your own cursors using an svg editor, and convert them to windows cursor files, then I think you'll have to write some scripts. resvg GitHub - linebender/resvg: An SVG rendering library. will render your SVG as png files at your required sizes and icoutils icoutils home will assemble lthem into cursor files. you can get windows executables for icoutils from Msys2 - Mingw64. If you don't want to install Msys2, I have a list of the minimal set of files you need to download and extract to get a working copy.

I assume that you have already found Realworld cursor editor, and Greenfish Icon editor, to allow you to examine cursor files you have or generate.

Finally, there is a documented API for refreshing the cursors after you've changed the files, and an undocumented API for changing the base cursor size. I have written a very basic command line program to invoke those functions. It's written in C# 5, so can be compiled using the built in compiler on windows 11 (or 10). I'll paste the source here if asked,
 

My Computer

System One

  • OS
    Windows 11 23H2 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI
    CPU
    i3-1215U
    Memory
    8GB
    Monitor(s) Displays
    Dell S2721
    Screen Resolution
    3840x2160
    PSU
    External 65W
    Keyboard
    Cherry mechanical (Blue)
    Mouse
    Microsoft
    Browser
    FireFox
    Antivirus
    MS
Skeptic, thanks-a-big for all the info and suggestions. Bummer that Windows hasn't embraced vectors for cursors--at this point it looks like Linux may get there first. Anyway...

I've been using Greenfish for both icons and cursors (it exports both); is Realworld better at making cursors? If so I'll check it out.

to use different styles for different cursors you have to copy the cursor files elsewhere
That's an especially important tidbit to know!

Thanks for turning me on to linebender. It's not an absolute necessity b/c vector programs can export as png and Greenfish can even open SVG natively, but if I'm working in Inkscape it would be nice to just convert a bunch of vectors in one fell sweep rather than having to individually export every single one. Nice to know about icoutils too, although for me that will be less useful. I can see it being a lifesaver if I do some really heavy work in CorelDraw or Photo-Paint with an animated icon and need to pack a bunch of those images, for sure. But under normal circumstances I'll always be retouching in Greenfish tbecause SVG->PNG conversion is never going to be good enough; the converted bitmaps will always need work. And once they're in Greenfish, well, you just export them as an *.ico and you're done.

And that was the original impetus for this thread--the hope that all those bitmap touchups wouldn't be necessary because maybe Windows could just use SVG direct. Damn. Basically back where I started, but at least with a few more tools and better knowledge. So thanks a ton for that.

Speaking of more tools--I find myself very interested in your code for refreshing cursors and changing base cursor size. I assume that the first is for mere convenience, because after I choose my new cursors via the regular Windows dialog, I should be able to reboot and see the changes--so a little refresh app would be nice but not crucial. That's not the case with setting base size, though (I'm assuming Settings | Accessibility | Mouse pointer | Cursor & pointer | Change pointer size don't set the actual base size that Windows starts from, they just generate and use whatever icon size is appropriate under your current settings.)

I did a quick search for "how to use the native windows 11 compiler for C#" and then simplified it to "built-in windows 11 compiler". Zilch except for a discussion at Stack Exchange https://stackoverflow.com/questions/59820244/has-windows-an-integrated-built-in-c-c-compiler-package where 2 people mentioned the Windows C# compiler but the only link they gave as Ngen.exe (Native Image Generator) - .NET Framework . If that's the compiler you mean, is there a simpler layperson/dummies set of instructions for using it? I've done some scripting (though eons ago) but have never had anything to do with real programming. I'd pretty much need my hand held.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    ASUS
    CPU
    Intel i7-13620H 10-Core
    Motherboard
    ASUS TUF FX507
    Memory
    32GB DDR5
    Graphics Card(s)
    GeForce RTX 4070
    Sound Card
    onboard
    Monitor(s) Displays
    laptop screen or Dell U3223QE
    Screen Resolution
    1980 or 2160, depending on laptop screen or desktop monitor
    Hard Drives
    SSD
    PSU
    laptop
    Case
    laptop
    Cooling
    laptop
    Keyboard
    laptop
    Mouse
    logitech M525
    Internet Speed
    5g
    Browser
    Firefox
This is all over my head as I know nothing about machine language, but back in 2013, I used the Metro X3 cursor pack that used custom cursors and symbols developed by Rei AJ Browning. In his old pack, there were many of different sizes, colors, and shapes and I inserted them via .inf files.

You may already be aware of this, but I see where that is now an on-going project in Windows 11. You might examine the pack to get some insight.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2 26100.4061
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900 10 core 20 threads
    Motherboard
    DELL 0J37VM
    Memory
    32 gb
    Graphics Card(s)
    none-Intel UHD Graphics 630
    Sound Card
    Integrated Realtek
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1tb Solidigm m.2 nvme+256gb SKHynix m.2 nvme /External drives 512gb Samsung m.2 sata+1tb Kingston m2.nvme+ 4gb Solidigm nvme
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    so slow I'm too embarrassed to tell
    Browser
    #1 Edge #2 Firefox
    Antivirus
    Defender+MWB Premium
  • Operating System
    Windows 11 Pro 24H2 26100.4061
    Computer type
    PC/Desktop
    Manufacturer/Model
    Beelink Mini PC SER5
    CPU
    AMD Ryzen 7 6800U
    Memory
    32 gb
    Graphics card(s)
    integrated
    Sound Card
    integrated
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Crucial nvme
    Mouse
    Logitech wireless
    Keyboard
    Logitech wired
    Internet Speed
    still too embarrassed to tell
    Browser
    Firefox
    Antivirus
    Defender
    Other Info
    System 3 is non compliant Dell 9020 i7-4770/24gb ram Win11 PRO 26100.4061

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    ASUS
    CPU
    Intel i7-13620H 10-Core
    Motherboard
    ASUS TUF FX507
    Memory
    32GB DDR5
    Graphics Card(s)
    GeForce RTX 4070
    Sound Card
    onboard
    Monitor(s) Displays
    laptop screen or Dell U3223QE
    Screen Resolution
    1980 or 2160, depending on laptop screen or desktop monitor
    Hard Drives
    SSD
    PSU
    laptop
    Case
    laptop
    Cooling
    laptop
    Keyboard
    laptop
    Mouse
    logitech M525
    Internet Speed
    5g
    Browser
    Firefox

Latest Support Threads

Back
Top Bottom