My mistake. I'll address your question first. The mapping of pixels to a unit of length is given by
PPI. Related term is
DPI. You definitely should know about both if you are making a WYSIWYG editor.
PPI and DPI are not fixed. Many applications assume they are however (to 96 PPI, I think), or don't properly address them. So sadly, other applications don't serve as good role models. Want to see how bad things get? Change the PPI on your computer. Watch things go horribly, horribly wrong in every GUI.
Getting the PPI of the display is OS specific, but it's possible. So do investigate for your respective OS. Before you run off gleefully knowing that you have metric to do pixel to length unit conversions, you should be warned of something else that you probably haven't considered.
You seem to be intelligently probing the issues in making an editor, so I apologize if once again I cover ground you already considered. If all you drew were lines and boxes on the screen, a WYSIWYG editor would not be so bad. You have to be mindful of PPI and DPI, and do a lot of math yourself, but it is doable.
Although APIs haven't exactly been considerate of PPI issues. Most of them will show you examples of how to specify GUI positioning by choosing pixel numbers directly. (Pixels directly? When the PPI can be different or changed?). In fact, I respect the Microsoft WPF designers and team for considering this issue. Even if you will not use
WPF. You might be interested in how they addressed this mapping of device size. Measurements in WPF are done in device independent units! Although WPF has its own share of problems...
The problem is text. What is the size of the letter 'a'? This is dependent on so many factors. I only know enough about this to be dangerous. But if you're making something to create labels, pricetags, and so on, you will care about fonts and text, right? And that's where the problems start.