C# Sending String To Printer Not Working With Courier - c#

My IDE is .Net 2008 using C#. I need to send a string to a printer in a non proportionally spaced font. As an example lets say the string = "Hello World" and the printer is "Printer1"
I followed the advice of this stackoverflow post:
Sending String Directly to printer
When I set the font to "Times New Roman" or "Comic Sans MS", it works. But when I use Courier, I get a nonproportionally spaced font.
I am using the exact coding as the post that I have cited. Why won't Courier give me the non proportionally spaced font I need? Is there a way to fix this?
Thank you in advance,
Harvey Nusbaum

Courier is a monospace font. All of its characters have the same width.

Related

Syncfusion : Using a Google Font for the page number in html to pdf

I'm using Syncfusion's HTML to PDF which is working great!
Little hiccup though, all their documentation shows if you want to change the font of the page numbers at the bottom you have two choices:
standard font:
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f)
custom font:
PdfFont font = new PdfTrueTypeFont(Server.MapPath("/App_Data/ARIALUNI.ttf"), 24)
But I need to allow a font from google fonts. I have the font loaded in my html but the page numbers are painted after so I'm not sure how to 1. embed it & 2. set it.
Appreciate any help.
Many thanks
For anyone that comes across this rare ask, it's not supported. You need to load and store the TrueType font and then set it to the file location as above.

How to use custom font in visual studio 2008 for C#.net window application?

I want to use Indian Font (Hindi) in Windows apps.When i used Mangal font for Hindi text ,then text visible but in block format.
so any one can help me for this.
Create New windows forms project and in Form.OnLoad handler, add the following lines:
PrivateFontCollection pfc = new PrivateFontCollection();
string fontFilePath = "C:\\Fonts\\PALETX3.ttf"
pfc.AddFontFile(fontFilePath);
label1.Font = new Font(pfc.Families[0], 16, FontStyle.Regular);
You can find more information from
http://msdn.microsoft.com/en-us/library/ms533820(VS.85).aspx
You can use this code:
YourMainForm.YourTextBox.Font = new Font("Your name of indian font",
YourMainForm.YourTextBox.Font.Size);
Make sure the font you are using supports the Unicode characters in controls. You can find this out using windows utility Character Map.
Some older fonts have characters for a certain code page but not for Unicode characters. For example windows font Marlett have only a few Unicode chars defined, the rest will appear as the boxes in your screen shot. If that is the case your best bet is to find a newer Unicode version of the font. Although in theory you can use font editing software to create a new version yourself (the glyphs are already in there) but it won't be easy. Best of luck :)

What font is used if a Unicode-character is not found in the selected font (Tahoma)?

I have written a WPF user control that uses Tahoma as a font to display unicode strings, which works fine. However, I have noticed that some eastern asian characters are actually missing in Tahoma, i.e. this font does not support all common Unicode characters.
However, when I display a string that contains some east asian letters, that I suppose are missing in Tahoma.ttf, the character is displayed correctly anyway, instead of a black rectangle that I expected to get for the missing unicode character.
So out of curiosity: is there any fallback mechanism, i.e. does Windows 7 or C# WPF replace the missing characters from a fallback font? Can anybody please explain how exactly this is working, and which font is actually used as a allback?
See the Font Fallback section of the FontFamily reference.
Thanks alot H.B., with your keyword, I was able to find this really helpful ressource from Microsoft, that explains how Font Fallback and Font Linking work:
http://msdn.microsoft.com/en-us/goglobal/bb688134
Here is a good quote:
A user running Windows XP selects the Tahoma font to enter some text first in English, next in Hebrew, and then in Telugu. Since Tahoma is an OpenType font, it provides support for Latin and Hebrew scripts, but does not contain any Telugu glyphs. Uniscribe detects this lack of font support and automatically renders the Telugu script by using its fallback font, which is Gautami.

Is there a simple way to determine what font is being used in the user's title bar?

I'd like to find out what font the user has defined for a window. If they are using MS Sans Serif, then there are characters they cannot display. I'm assuming most people will be using Tahoma or Segoe UI but that's an assumption I'm not prepared to make within my program.
Can I easily and safely query the user's type of font for the title bar (non-client area)?
System.Drawing.SystemFonts.CaptionFont
System.Drawing.SystemFonts.CaptionFont should give you what you're looking for.

How can I make ASCII text that will look good on Facebook?

I'm making a .NET application that will take any picture and spit out ASCII text that will appear just like the image.
So far, it works well when the font is Lucida Console. Facebook doesn't use this font and thus break the art illusion.
Any thoughts, ideas and suggestions on how to tackle this problem? It's pretty a pretty neat idea! :)
EDIT:
Facebooks default font is:
font-family: "lucida grande", "tahoma", "verdana", "arial", sans-serif;
How do you suggest I solve this unique problem. :)
EDIT 2:
Added more relevant tags.
Here's an interesting "bended" idea:
There's a set of "Mathematical monospace" characters in Unicode, that always render using a monospace font. On my computer, even though the font chosen is DejaVu Sans, the font used to render these characters changes to DejaVu Sans Mono.
The ranges are:
U+1D670 to U+1D689 for A-Z
U+1D68A to U+1D6A3 for a-z
U+1D7F6 to U+1D7FF for 0-9
Try and see if you can see these on your computer:
π™°π™±π™²π™³π™΄π™΅π™Άπ™·π™Έπ™Ήπ™Ίπ™»π™Όπ™½π™Ύπ™Ώπš€πšπš‚πšƒπš„πš…πš†πš‡πšˆπš‰πšŠπš‹πšŒπšπšŽπšπšπš‘πš’πš“πš”πš•πš–πš—πš˜πš™πššπš›πšœπšπšžπšŸπš πš‘πš’πš£πŸΆπŸ·πŸΈπŸΉπŸΊπŸ»πŸΌπŸ½πŸΎπŸΏ
If you see these as letters and numbers, and in monospace, you're good to go! I'm on Ubuntu 10.10, and my fonts have these characters.
Here's a screenshot of the above example on Ubuntu:
http://i25.tinypic.com/30ijhjs.png
There's a generator out there that works with variable width fonts:
http://sourceforge.net/projects/ascgen2/
Maybe you could peek at its source for some ideas (but no stealing, of course!). Or, since it's an open source project, you and the author could collaborate and work on it together?

Categories