Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing a font viewer program that shows all the fonts on my system. I have figured out how to list them all. Now I want to filter the list.

I have two listviews. Listview one FilterListView and the second FontListView. The FontListView is populated will all the fonts available on my system over (1800) the FilterListView will be populated with "All", "Serif", "San-Serif", "Decorative", "Script" etc... depending on what I can filter by.

When a selection is made from the FilterListView I want the FontViewListView to show only those fonts that are say Serif fonts if that is what is selected from the FilterListView.

Please do not tell me what a serif is. I know this.
I want to Filter the list of fonts on my system and I have over 1800.
Posted
Updated 3-Apr-13 6:49am
v5
Comments
Sergey Alexandrovich Kryukov 11-Apr-12 16:23pm    
What does it mean: "a font has serifs"?
--SA
Matt T Heffron 3-Apr-13 12:37pm    
"serifs" in typesetting are the little "decorations" at the ends of strokes.
For example, in a serif font the lower case 'L' will ususally have a little leftward "tic" at the top of the vertical stroke, and a "base" at the bottom of the stroke.
http://en.wikipedia.org/wiki/Serif
Sergey Alexandrovich Kryukov 3-Apr-13 13:14pm    
Oh, I actually knew what does "serif" mean; buy the wording of the question is confusing.
Thank you,
—SA
[no name] 11-Apr-12 19:56pm    
Please use the "Improve Question" widget to clarify your question.
Sergey Alexandrovich Kryukov 11-Apr-12 20:52pm    
Please, clarify your question using "Improve question" and write a comment, not as a "solution" (deleted).
And you did not clarify anything. How a font can "have" another font? or a feature? How exactly you want to classify the fonts, and -- essentially -- why?
--SA

If you are using C# the System.Drawing.Font class has a FontFamily property.

It's not clear from the documentation if this property will be helpful for you or not, but you might investigate what it is for each of your fonts and see if it will do the trick.

In C/MFC, you have the CFont class which you can use to retrieve a LOGFONT struct that describes the font -- one of the fields in that struct is lfPitchAndFamily which is defined as:

The pitch and family of the font. The two low-order bits specify the pitch of the font and can be one of the following values.
•DEFAULT_PITCH
•FIXED_PITCH
•VARIABLE_PITCH

Bits 4 through 7 of the member specify the font family and can be one of the following values.
•FF_DECORATIVE
•FF_DONTCARE
•FF_MODERN
•FF_ROMAN
•FF_SCRIPT
•FF_SWISS

It doesn't quite give you serif / sans-serif -- the closest is roman / modern -- but if you are just trying to break them up in some sort of groups, it might work for you.
 
Share this answer
 
As far as I can tell, from the TrueType and OpenType specification docume\nts (found here[^]), there is no such property to tell you this. But, I didn't read the entire specification for either technology.

I can tell you there is no such property in the Font classes in .NET. So, if it's in the specification that this information should be supplied, you'd have to parse the font files yourself to get at it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900