How to list the avaiable fonts in Java

To list the avaiable fonts in Java you can use the following snippet.

Sample Java

GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
String fonts[] = g.getAvailableFontFamilyNames();
for (int Counter = 0; Counter < fonts.length;Counter++ ){
	System.out.println(fonts[Counter]);
}

Please rate this snippet

How to choose a font using FontDialog in C# and VB.NET

To choose a font using FontDialog in C# and VB.NET you can use the following snippet.

Sample C#

using (var dialog = new FontDialog())
{
	if (dialog.ShowDialog() != DialogResult.Cancel)
	{
		textBox1.Font = dialog.Font;
	}
}

Sample VB.NET

Using dialog = New FontDialog()
	If dialog.ShowDialog() <> DialogResult.Cancel Then
		textBox1.Font = dialog.Font
	End If
End Using

Please rate this snippet

CSS Web Safe Font Combinations

CSS Web Safe Font Combinations

Serif Fonts

  • Georgia, serif
  • “Palatino Linotype”, “Book Antiqua”, Palatino, serif
  • “Times New Roman”, Times, serif
  • Sans-Serif Fonts

  • Arial, Helvetica, sans-serif
  • “Arial Black”, Gadget, sans-serif
  • “Comic Sans MS”, cursive, sans-serif
  • Impact, Charcoal, sans-serif
  • “Lucida Sans Unicode”, “Lucida Grande”, sans-serif
  • Tahoma, Geneva, sans-serif
  • “Trebuchet MS”, Helvetica, sans-serif
  • Verdana, Geneva, sans-serif
  • Monospace Fonts

  • “Courier New”, Courier, monospace
  • “Lucida Console”, Monaco, monospace
  • source: W3Schools

    Please rate this snippet