Port default DPI tracking to Rust
It's the only place from where we're accessing it already.
This still requires unsafe
due to the global state. Since it's what the C code does and it's deprecated anyway it's probably OK to leave it as-is if it's going to get removed. Alternatively some lazy_static!
and a Mutex
would make this safe if you'd prefer.