ref-counting image and font resources, wip