Created
January 21, 2013 16:29
-
-
Save drott/4587232 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) | |
{ | |
base.OnPaint(e); | |
Graphics g = e.Graphics; | |
for (int i = 8; i <= 30; i++) | |
{ | |
FontFamily fontFamily = new FontFamily("Liberation Sans"); | |
Font liberation = new Font(fontFamily, i, FontStyle.Regular, GraphicsUnit.Pixel); | |
pinvokeMapped.TEXTMETRIC liberationMetrics = pinvokeMapped.GetTextMetrics(g, liberation); | |
String metricsOutputString = "Liberation Sans Metrics (initialized to " + i + "px): tmAscent: " + liberationMetrics.tmAscent + | |
" tmDescent: " + liberationMetrics.tmDescent + | |
" tmHeight " + liberationMetrics.tmHeight; | |
// g.DrawString(metricsOutputString, liberation, System.Drawing.Brushes.Blue, new Point(30, 30)); | |
Console.WriteLine(metricsOutputString); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment