I installed this font
http://www.bibleplaces.com/paleo_hebrew_fonts/
http://www.bibleplaces.com/wp-content/uploads/2015/08/PaleoHebrew.zip
I installed it
It works in Ms Word, this is where it is and what it looks like / should look like. (And this is when in my taskbar it's set to EN - english - rather than hebrew). (If set to hebrew I get the standard hebrew script which is blocky, not paleo hebrew which is stick like). So setting the language bar to EN in the taskbar is correct.
But when I try it in visual studio, with a textbox I can't get the font to display
I can set the textbox to Wingdings so I know the code for setting the font is correct.
TextBox tb1 = new TextBox();
string fontname = "Wingdings"; // works
fontname = "PaleoHebrew"; // doesn't work
fontname = "Paleo-Hebrew"; // doesn't work
fontname = "Paleo Hebrew Regular"; // doesn't work
tb1.Font = new System.Drawing.Font(fontname, 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
The TTF file is PaleoHebrew.TTF, the fonts window shows it as "Paleo Hebrew Regular"
The textbox just displays english
or if I set the language to (HE) in the taskbar then I get the regular hebrew script, rather than paleo hebrew script. Though that happens in word too. So maybe that's normal.
I can't get the textbox in the winforms application written in C# in visual studio C#, display the stick like characters of the paleo hebrew font, though MS word can display them no problem.
I tried
System.Drawing.FontStyle.Regular
instead of
System.Drawing.FontStyle.Bold
But it's still not working.
Related
I am very tired of providing fonts for my application. It would be a lot easier to have some ready-to-use fonts collection that I can use.
See this
//I need to add text to image, no matter what font is
var fo = SystemFonts.Find("Mono");
var font = new Font(fo, 10f, FontStyle.Regular);
x.DrawText("123", font,color,point);
I need to be sure that computer running this piece of code have font Mono installed. But it is not always the case, so I had to keep font file in my project folder and so on...
This is just annoying.
What I want to do
//this must be a font that included into library itself.
var font = FontCollection.Any;
x.DrawText("123", font,color,point);
With this I can be sure that I will be able to print text on image no matter what system is.
My users do a lot of bi-directional text editing, it is not uncommon for them to sprinkle the text with some Left-to-right and/or Right-to-left marks. Sometimes they want to see where those marks are located in the text in order to move or delete them.
The TextBox control in Windows Forms offers a default context menu with some Unicode-related entries, one of which is Show Unicode control characters
Enabling this option will force the control to draw the glyphs defined in the corresponding font for those non-printable characters.
For example, if I set the Text property of a TextBox control to "Hello \u200E World!" and enable this option, I will get the LRM character rendered using its glyph as defined in the font file (font used is Segoe UI).
If we open the Segoe UI font in a font-editing software (I used FontForge), we can see that indeed there are glyphs defined for the LRM and RLM code points.
I also found that StringFormatFlags enumeration can be used to control how these characters are rendered in GDI+, specifically by providing the DisplayFormatControl flag to the StringFormat object:
private void Form_Paint(object sender, PaintEventArgs e)
{
var text = "Hello \u200E World!";
var g = e.Graphics;
// Will draw LRM symbol with its representative glyph
var fmt = new StringFormat(StringFormatFlags.DisplayFormatControl);
g.DrawString(text, Font, Brushes.Black, 10, 10, fmt);
}
However, I haven't found anything similar in WPF TextBox or RichTextBox control: the default context menu provides only Copy, Cut and Paste commands and none of the control properties (including attached ones) seem to enable the drawing of control characters with their font-defined glyphs.
Is there a way to draw Unicode control characters with their representative glyphs in WPF TextBox or RichTextBox without resorting to various hacks, such as replacing those characters with other ones in a converter?
I am creating a small tool like text editor. I am fetching fonts from system and applying to text written on editor.
string fontName = (string)Fonttype.SelectedItem;
RichTextControl.Selection.ApplyPropertyValue(
System.Windows.Controls.RichTextBox.FontFamilyProperty, fontName);
But font installed like STMSaradha.ttf(Bengali font) won't show properly on RichTextBox, some text will get combined and don't show properly. Any suggestions?
Screenshot:
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 :)
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.