Skip to content

Instantly share code, notes, and snippets.

/// <summary>
/// Wrapper for GDI text rendering functions<br/>
/// This class is not thread-safe as GDI function should be called from the UI thread.
/// </summary>
/// <remarks>
/// http://theartofdev.com/2013/08/12/using-native-gdi-for-text-rendering-in-c/<br/>
/// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
/// </remarks>
public sealed class NativeTextRenderer : IDisposable
{
public class Test
{
private const int BaseIterations = 3;
private const int RenderIterations = 10000;
private const string TestString = "Test-s.tri,ng m(g=j{}3)";
private static readonly Font _font1 = new Font("Arial", 11);
// private static readonly Font _font1 = new Font("Segoe UI", 9);
// private static readonly Font _font1 = new Font("Tahoma", 10);
// private static readonly Font _font1 = new Font("Microsoft Sans Serif", 9);
using System;
using System.Globalization;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public class GoogleAuthenticator
{
const int IntervalLength = 30;
const int PinLength = 6;