Question

I'm essentially re-writing a document viewer with markups to move away from a COTS product and so far everything has been working VERY well. My code is based off of Mark Miller's Extensions to DrawTools (http://www.codeproject.com/Articles/17893/Extensions-to-DrawTools).

The old viewer stores pages and their markups based on x/y coordinates in inches and I have had NO trouble converting this to a pixel-based coordinate system and converting lines, boxes etc to the new viewer. The lines and boxes show up exactly where they are supposed to and have the correct size.

The problem has been displaying text markups, no matter what I do they always end up MUCH smaller than they should be.

I'm doing:

  1. UserControl->OnPaint()
  2. Create a Matrix Transform for:
  3. Scale
  4. Rotate
  5. Translate
  6. Apply Matrix to Graphics Object
  7. Call method that draws the Page Image and then all of the Markups.

I have the X/Y Coords and Font Size of the Text to draw, and the resulting string DOES end up at the correct coordinates but the text is WAY too small. The really bizarre part about this is the original viewer is written in .Net so I know that the Font and Size SHOULD relate especially since everything else scales so well.

Here is an example of what I'm talking about. Please ignore the BackColor and Border of the "This is some Text", I haven't gotten around to getting that transformed yet since I've been so focused on getting the TEXT right.

Original: Good Example

My Result: Bad Result

Was it helpful?

Solution

I ended up having to rework everything to be Inch Unit based. The font simply doesn't have an easy way of scaling between the units and the Inch Unit turned out to be the easiest solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top