Silverlight 引路蜂二维图形库示例:矢量字体
来源:互联网 发布:沈阳 英语网络授课 编辑:程序博客网 时间:2024/04/28 03:57
引路蜂二维图形库支持矢量字体,包括中文和英文。对于Silverlight应用,由于访问权限的问题,字库一般需作为资源文件包含在应用中,对于英文字体不是个大问题,而对于中文字库,GB2312字库文件最小也要4M以上,所以尽量是用同一字体。引路蜂二维图形库绘制文字时是采用的矢量字库。也可以对文字内部进行填充。文字方向可以从左到右,从上到下,从右到左。
字体下载链接如下表:
字体大小下载Arial34KDownloadCourier New50KDownloadElephant52KDownloadImpact34KDownloadGeorgia53KDownloadRockwell35KDownloadTimes New Roman44KDownloadMicrosoft Sans Serif29KDownloadVerdana36KDownload幼圆5128KDownload新魏15874KDownload新宋体5740KDownload行楷13588KDownload宋体5740KDownload隶书7083KDownload仿宋8104KDownload黑体6108KDownload下例使用行楷显示“引路蜂软件”。
private void FontDemo(){ TextureBrush brush1; BitmapImage img = new BitmapImage(); img.CreateOptions = BitmapCreateOptions.None; string path = "/SilverlightGraphics2DDemo;component/brick.png"; Stream s = Application.GetResourceStream (new Uri(path, UriKind.Relative)).Stream; img.SetSource(s); WriteableBitmap writeableBitmap = new WriteableBitmap(img); brush1 = new TextureBrush(writeableBitmap.Pixels, img.PixelWidth, img.PixelHeight); Pen pen = new Pen(Color.Blue, 1); path = "/SilverlightGraphics2DDemo;component/xingkai.fon"; int fontSize = 100; s = Application.GetResourceStream (new Uri(path, UriKind.Relative)).Stream; s.Seek(0, SeekOrigin.Begin); //Clear the canvas with white color. graphics2D.Clear(Color.White); char[] longLine = null; FontEx font = new FontEx(s); string guidebee = "引路蜂软件"; longLine = guidebee.ToCharArray(); graphics2D.SetPenAndBrush(pen,brush1); graphics2D.DrawChars(font, fontSize, longLine, 0, longLine.Length, (screenWidth - fontSize) / 2, 20, FontEx.TextDirTb); int offset = 20; for (int i = 1; i < 4;i++ ) { fontSize=100-i*20; offset += fontSize+5; graphics2D.DrawChars(font, fontSize, longLine, 0, longLine.Length, (screenWidth - fontSize) / 2 - offset, 20, FontEx.TextDirTb); graphics2D.DrawChars(font, fontSize, longLine, 0, longLine.Length, (screenWidth - fontSize) / 2 + offset, 20, FontEx.TextDirTb); }}
除了外挂字体外,引路蜂二维图形库自带了一个英文字库可以通过FontEx.GetSystemFont()取得。此外上述.fon 字体格式为引路蜂自定义,内部使用SVG来描述字体。和Windows中的字体格式不一致。
- Silverlight 引路蜂二维图形库示例:矢量字体
- Silverlight 引路蜂二维图形库示例:概述
- Silverlight 引路蜂二维图形库示例:包定义
- Silverlight 引路蜂二维图形库示例:基本知识
- Silverlight 引路蜂二维图形库示例:绘制各种几何图形
- Silverlight 引路蜂二维图形库示例:颜色
- Silverlight 引路蜂二维图形库示例:虚线类型
- Silverlight 引路蜂二维图形库示例:不同线宽
- Silverlight 引路蜂二维图形库示例:椭圆
- Silverlight 引路蜂二维图形库示例:路径
- Silverlight 引路蜂二维图形库示例:坐标变换
- Silverlight 引路蜂二维图形库示例:颜色渐变
- Silverlight 引路蜂二维图形库示例:材质画刷
- Silverlight 引路蜂二维图形库示例:显示位图
- Silverlight 引路蜂二维图形库示例:动画Beziers曲线
- Silverlight 引路蜂二维图形库示例:结束语
- Silverlight 引路蜂二维图形库示例:线段末端形状(LineCap)
- Silverlight 引路蜂二维图形库示例:线段连接类型(LineJoin)
- java 环境
- 使用DDE来操作Word
- 何谓成长?——大学生毕业失业有感
- 对Xlib进行全面分析的好文章
- 看O'REILY的《Linux设备驱动程序》一书(一)
- Silverlight 引路蜂二维图形库示例:矢量字体
- 儿子百日照
- Windows7旗舰版32位Oracle10g的安装和卸载
- Android引路蜂地图开发示例:地址查询
- java字符串子串
- 浮动的公告——jQuery简单实现
- 目录的相关操作
- flash与动画:小球左右摆动
- Neterm终端输入显示重复字符问题