title: Calculate font size based on printable area and number of characters/lines
body: <p>I'd like to print text using a monospace font, 80 character wide, 66 characters tall.  The goal is to mimic sending raw text to an impact printer.</p>
  
  <p>Here's some code:</p>
  
  <pre><code>public void Print(string printerName, string text, string desc = "")
  {
      PrintDialog dialog = new PrintDialog();
      PrintQueue queue = new LocalPrintServer().GetPrintQueue(printerName);
      dialog.PrintQueue = queue;
  
      PageImageableArea area = queue.GetPrintCapabilities(dialog.PrintTicket).PageImageableArea;
  
      TextBlock block = new TextBlock();
      block.FontFamily = new FontFamily("Courier New");
      block.Margin = new Thickness(area.OriginWidth, area.OriginHeight, area.OriginWidth, area.OriginHeight);
      block.FontSize = ???
      block.Text = text;
      block.Measure(new Size(area.ExtentWidth, area.ExtentHeight));
      block.Arrange(new Rect(new Point(0, 0), block.DesiredSize));
  
      dialog.PrintVisual(block, desc);
  }
  </code></pre>
  
  <p>It's my understanding that PageImageableArea gives me <code>area.ExtentWidth</code> and <code>area.ExtentHeight</code> which are my actual printing dimensions (in pixels), and <code>area.OriginWidth</code> and <code>area.OriginHeight</code> which are the size of my margins (in pixels).</p>
  
  <p>If I want to fit exactly 80 characters across the page, each character should be <code>area.ExtentWidth / 80</code> wide, in pixels.  The <code>area.ExtentWidth</code> of my printer is 768, so each character should be 9.6 pixels wide.</p>
  
  <p>Additionally, if I want to fit exactly 66 lines on my page, each line should be <code>area.ExtentHeight / 66</code> tall, in pixels.  The <code>area.ExtentHeight</code> of my printer is 1038.66, so each line should be 15.7 pixels tall.</p>
  
  <p>Using these inputs, how do I choose a FontSize where each character is X pixels wide, and, when wrapped, causes each line to be Y pixels tall?</p>