473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

enumerating fonts, their sizes and styles

Hi again. I have written the following small piece of code

Dim f As FontFamily
For Each f In System.Drawing.FontFamily.Families
Console.WriteLine(f.Name)
Next f

and when executed it prints out
Arial
Arial Black
Arial Narrow
Arial Unicode MS
Batang
Book Antiqua
Bookman Old Style
Century
..
..
..
How the heck do you get a list of the font styles (eg. Regular,
Italic, Bold, Bold Italic) and supported font sizes (8, 9, 10 11, 12,
14, 16 etc) for each of these font family names.
All I can figure is to

Dim ff as new Font(f.name,x)

where x is the font size. But you therefore have to know in advance
what x is and not all fonts support, for example, 6 point (if x is 6).

I guess what I am asking is in a font dialog box, how are the font
style and font sizes populated - where does this information come
from?

Thank you all very much again.
Colin
Nov 20 '05 #1
5 2896
Easy.

f.IsStyleAvailable(FontStyle.Bold)

OHM


Colin McGuire wrote:
Hi again. I have written the following small piece of code

Dim f As FontFamily
For Each f In System.Drawing.FontFamily.Families
Console.WriteLine(f.Name)
Next f

and when executed it prints out
Arial
Arial Black
Arial Narrow
Arial Unicode MS
Batang
Book Antiqua
Bookman Old Style
Century
.
.
.
How the heck do you get a list of the font styles (eg. Regular,
Italic, Bold, Bold Italic) and supported font sizes (8, 9, 10 11, 12,
14, 16 etc) for each of these font family names.
All I can figure is to

Dim ff as new Font(f.name,x)

where x is the font size. But you therefore have to know in advance
what x is and not all fonts support, for example, 6 point (if x is 6).

I guess what I am asking is in a font dialog box, how are the font
style and font sizes populated - where does this information come
from?

Thank you all very much again.
Colin


Regards - OHM# OneHandedMan{at}BTInternet{dot}com
Nov 20 '05 #2
Cor
Hi OHM,

Hi I thought it were beer days?

:-))

Do not think I am not having Christmas, even three days

But my family says it are lazy days.

And I am the one who has to make dinners.
(And I like that)

Cor
Nov 20 '05 #3
> How the heck do you get a list of the font styles (eg. Regular,
Italic, Bold, Bold Italic) and supported font sizes (8, 9, 10 11, 12,
14, 16 etc) for each of these font family names.


Use the IsStyleAvailable method to find out if the font supports a style. I don't know how you can get the sizes for bitmap fonts. True type fonts are vector fonts and they can be scaled to any size so there's no "supported size" list (all sizes are supported by them).

--
Eduardo A. Morcillo [MS MVP VB]
http://www.mvps.org/emorcillo
Nov 20 '05 #4

yes well I had my girlfriends parents here for 48 hours, so I have not
posted until they went. We had huge dinners ( which I also made ) but did
not get drunk.

Roll on new year and spring sunshine !

:)

OHM
Cor wrote:
Hi OHM,

Hi I thought it were beer days?

:-))

Do not think I am not having Christmas, even three days

But my family says it are lazy days.

And I am the one who has to make dinners.
(And I like that)

Cor


Regards - OHM# OneHandedMan{at}BTInternet{dot}com
Nov 20 '05 #5
Thanks all. This is what I was after.
Colin
Nov 20 '05 #6

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

Similar topics

10
by: minchu | last post by:
Hello, I have used CSS in HTML page (font-verdana size-8pt), looks fine in windows but in linux the fonts are corrupt and its too small. Kindly help me and tell what is the solution to correct...
1
by: Cezary | last post by:
Hi Folks! I have a problem with fonts size on few browsers. I use size in %, because WAI recommend that form, but in diffrent browsers I have diffrent sizes. For example for IE6.0 100% is 100%,...
21
by: Jay Levitt | last post by:
I'm just starting to play around with CSS and MovableType. My home page (http://www.jay.fm) now validates on both the CSS and the XHTML. However, the Google cached version shows the wrong font in...
39
by: David Jubinville | last post by:
Hi All, I've run into a bit of an interesting problem with CSS and font DPI and would certainly welcome help. Problem: Page layout defined in CSS has font size issues (overlapping frames,...
5
by: Olli Krollmann | last post by:
hello folks, we have been developing several .NET-based windows forms applications during the last two years. there are two mysterious display problems that we have encountered so far but have...
4
by: Brian P. Bailey | last post by:
Hello, I'm trying to enumerate the fixed-pitch font families installed on a system. I am _not_ trying to create a generic monospaced font. I've tried looking at: FontFamily...
2
by: Gary | last post by:
1. I've installed a bunch of fonts in main application, which is in native C++ code using AddFontResourceEx 2. A C# application is launched from this main application, but failed to enumerate...
19
by: Viken Karaguesian | last post by:
Hello everyone, Just an observation here: the CSS newsgroup (comp.infosystems.www.authoring.stylesheets) is totally dead. Why?... Anyway here's my discussion point: What is the most versatile...
6
by: Steve | last post by:
I have a div with two - three paragrahs in it. Each paragraph has its own inline style tag with its own font size setting. When I set the last paragraph's font size the font sizes for ALL of...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.