473,805 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get Font language?

Windows comes with many fonts. When I'm writing with a word processor,
it's always annoying that fonts of the languages which I can't even
read (such as arabic) fill the font list making it hard for me to
choose the fonts I use. Those fonts are really useless because even if
I accidentally encounter web pages in those languages I can't even
understand what it says. I guess this situation is true for most
people. They always find font lists that are filled with fonts that
they have never used and never will.

Adobe Photoshop somehow groups the fonts according to their language.
I don't know about other languages but I can recognize that at least
Japanese, Korean, Simplified Chinese and Traditional Chinese fonts are
properly grouped. I would like to do the same thing. I would like to
show only the fonts that belong to some specific language so that
users can easily choose what they want.

First, I tried,
InstalledFontCo llection fonts = new InstalledFontCo llection();
foreach (FontFamily ff in fonts.Families)
{
try
{
Font f = new Font(ff, 10);
Debug.WriteLine (ff.Name+ " : " + f.GdiCharSet.To String());
}
catch{ }
}
But it returned all 1's for all fonts. I've searched Google and fixed
the code like,
InstalledFontCo llection fonts = new InstalledFontCo llection();
foreach (FontFamily ff in fonts.Families)
{
try
{
Font f = new Font(ff, 10);
LOGFONT lf = new LOGFONT();
f.ToLogFont(lf) ;
Debug.WriteLine (ff.Name+ " : " + lf.lfCharSet.To String());
}
catch{ }
}
Now, not all fonts returned 1's but I could clearly notice that all
the Korean fonts and all the Japanese fonts returned 1's. With these
values, I can't tell Korean fonts from Japanese fonts. What went wrong?
Sep 14 '08 #1
3 2611
No replies... Does that mean that this task is impossible with BCL?

On Sep 14, 10:59*pm, Sin Jeong-hun <typing...@gmai l.comwrote:
Windows comes with many fonts. When I'm writing with a word processor,
it's always annoying that fonts of the languages which I can't even
read (such as arabic) fill the font list making it hard for me to
choose the fonts I use. Those fonts are really useless because even if
I accidentally encounter web pages in those languages I can't even
understand what it says. I guess this situation is true for most
people. They always find font lists that are filled with fonts that
they have never used and never will.

Adobe Photoshop somehow groups the fonts according to their language.
I don't know about other languages but I can recognize that at least
Japanese, Korean, Simplified Chinese and Traditional Chinese fonts are
properly grouped. I would like to do the same thing. I would like to
show only the fonts that belong to some specific language so that
users can easily choose what they want.

First, I tried,
InstalledFontCo llection fonts = new InstalledFontCo llection();
foreach (FontFamily ff in fonts.Families)
{
* * * * try
* * * * {
* * * * * * * * Font f = new Font(ff, 10);
* * * * * * * * Debug.WriteLine (ff.Name+ " : " + f.GdiCharSet.To String());
* * * * }
* * * * catch{ *}}

But it returned all 1's for all fonts. I've searched Google and fixed
the code like,
InstalledFontCo llection fonts = new InstalledFontCo llection();
foreach (FontFamily ff in fonts.Families)
{
* * * * try
* * * * {
* * * * * * * * Font f = new Font(ff, 10);
* * * * * * * * LOGFONT lf = new LOGFONT();
* * * * * * * * f.ToLogFont(lf) ;
* * * * * * * * Debug.WriteLine (ff.Name+ " : " + lf.lfCharSet.To String());
* * * * }
* * * * catch{ *}}

Now, not all fonts returned 1's but I could clearly notice that all
the Korean fonts and all the Japanese fonts returned 1's. With these
values, I can't tell Korean fonts from Japanese fonts. What went wrong?
Sep 16 '08 #2
On Mon, 15 Sep 2008 22:33:18 -0700, Sin Jeong-hun <ty*******@gmai l.com>
wrote:
No replies... Does that mean that this task is impossible with BCL?
At most, all you can say for sure is that no one who read your question
and who had time to reply knows the answer. :)

As for the specific question, if any program can do it on Windows, then
all programs can do it. At worst, you might have to use p/invoke to get
at the unmanaged Windows API that the other programs use. However,
looking at the .NET docs, it looks to me as though you _might_ be able to
get this information using the System.Windows. Media namespace version of
the FontFamily class. That includes a FamilyMaps property that returns a
collection of FontFamilyMap instances that describe different languages
supported by a font.

I don't have any first-hand experience with it, but it's something you
might look at if you haven't already.

Pete
Sep 16 '08 #3
No replies... Does that mean that this task is impossible with BCL?
You might try using GetFontUnicodeR anges.
Or you might try setting lfCharSet in LOGFONT to each charset possible,
and call EnumFontFamilie sEx for each one.

But this breaks down these days, when one font supports more than one
language. I find that at times the "smart" grouping in PS (and others)
is so smart, that I can hardly find what I want.

M.
--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Sep 17 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1779
by: StaZ | last post by:
Hello I have a ASP script that generates a jpg/gif image using the Overpower.ImageLib component. I do all my tests on my own intranet server before uploading it to the webhost Actually i try to use the font "CasacedScript" to generates page titles.
5
3820
by: Mike M | last post by:
Hi all, Attempting to do css for cross platform/browser compatibility. Have an issue with IE6 sp1 running on NT4. When using IE6 sp1, example 1 works fine, example 2 produces unreadable text. Rectangular blocks and symbols. Is this unreadable serif font deal a known bug? Any suggestions appreciated. Thanks,
0
1404
by: Hariharan Subramony | last post by:
Hi Guys, I have the following issue ... I have a form with two richTextBoxes named (01) richTextBox1 (02) richTextBox2 with some controls for selecting Font types (Arial, Courier, etc) and Font
4
3499
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a snippet from my .css file: *************************** body { margin:0; padding:0;
2
2546
by: alberto.ribao | last post by:
Hello, I'm making some proofs of concept about localization with .NET Framework 2.0 My trouble is I'm trying to display the next string with a call to MessageBox.Show method: MessageBox.Show("250\u2009000 points");
9
4541
by: MadingS | last post by:
Is there an HTML (or CSS) way to say "use the user's INPUT font, whatever that might be."? Most browsers have the ability for the user to pick his or her own preference for what font to use inside of <INPUTtags. My question is, is there a way in HTML or StyleSheet language to say something like this: <h4>Here are some values - some are hardcoded, and others are input feilds:</h4> <FONT face="same as user's input font preference"...
14
2831
by: Roedy Green | last post by:
Is there a shortcut way to define the default font family (and characteristics) to be applied to all styles? -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
16
8651
by: Laszlo Nagy | last post by:
I need to create multi lingual invoices from reportlab. I think it is possible to use UTF 8 strings but there is a problem with the font. I could not find any free TTF font that can do latin1, latin2, arabic, chinese and other languages at the same time. Is there a single font that is able to handle these languages? (Most of our invoices will be for EN, FR, DE, HU, SK, CZ, RO but some of them needs to be in Chinese.) Thanks, Laszlo
2
2147
by: desertavataraz | last post by:
I am going write an application in C++ that allows the user to see two languages at once, and allows them to search each individual language for words or keywords. I have a font that I made specially for the non-English language, which would allow me to simply use different fonts for each specific language. I could also control how the search works simply by reading the font tags, for each language, so I only get results in that specific...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.