我有一个显示垂直文本的多浏览器页面.
作为一个丑陋的黑客,让文本在所有浏览器中垂直渲染我创建了一个自定义页面处理程序,它返回一个垂直绘制文本的PNG.
这是我的基本代码(C#3,但对其他任何版本的细微更改为1):
Font f = GetSystemConfiguredFont();
//this sets the text to be rotated 90deg clockwise (i.e. down)
StringFormat stringFormat = new StringFormat { FormatFlags = StringFormatFlags.DirectionVertical };
SizeF size;
// creates 1Kx1K image buffer and uses it to find out how bit the image needs to be to fit the text
using ( Image imageg = (Image) new Bitmap( 1000, 1000 ) )
size = Graphics.FromImage( imageg ).
MeasureString( text, f, 25, stringFormat );
using ( Bitmap image = …Run Code Online (Sandbox Code Playgroud)