Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

True Fixed Width Fonts in WPF

Tags:

c#

.net

wpf

I'm trying to parse Lab Data from an Microsoft Access Database I've already formatted all the data but text tables (Tables created with ASCII Chars) do not display correctly. I'm using a fixed pitch font (Couier New) but the pitch seems to not be fixed when printing Underscores in markup eveything looks fine but when printing the underscored lines come up short.

like image 615
FA Servers Avatar asked Dec 01 '10 20:12

FA Servers


People also ask

What fonts are fixed width?

The system fonts Courier, Menlo, and Consolas are examples of monospaced fonts , so named because every character is the same width.

Is calibri a fixed width font?

“Arial”, “Helvetica” and “Calibri” are sans serif fonts. Fixed width fonts have, well, fixed widths for each character. This is especially useful to programmers because it makes code easier to read. “Courier New”, “Lucida Console” and “Consolas” are fixed width fonts.

Is Arial fixed width?

A proportional font uses varying widths to display each of its letters and symbols, while a non-proportional font uses the same fixed width to display its characters. Some of the most popular proportional fonts are Times New Roman, Arial, Verdana and Georgia.

Is calibri a monospaced font?

Consolas was the first ClearType family Microsoft invited Luc(as) to work on. That monospaced design was a series of fonts where all glyphs had an equal width. Consolas is intended for use in programming environments and other circumstances that require a monospaced font.


1 Answers

The following XAML aligns correctly both on screen (in XamlPad) and on printer (HP CP2025):

  <StackPanel>
    <TextBlock FontFamily="Courier New" FontSize="30">ABCDEFGHI</TextBlock>
    <TextBlock FontFamily="Courier New" FontSize="30">A_C_E_G_I</TextBlock>
  </StackPanel>

I would check your font substitution settings on your printer.

like image 151
James Kovacs Avatar answered Sep 28 '22 02:09

James Kovacs