如何安装在Windows Azure上的自定义字体? [英] How can I install custom fonts on Windows Azure?

查看:189
本文介绍了如何安装在Windows Azure上的自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用一个自定义字体为我自己的应用程序绘制。是否有可能被部署脚本安装?


解决方案

<一个href=\"http://stackoverflow.com/questions/3909520/how-to-manage-custom-fonts-in-web-application-system-drawing\">How来管理Web应用程序自定义字体(System.Drawing中)


  

应该可以存储您的
  在磁盘上或在数据库字体文件,并
  然后使用
   PrivateFontCollection
  使用的字体在运行时。


  
  

下面是你将如何使用它:


  PrivateFontCollection收集=新PrivateFontCollection();
    //添加自定义字体的家庭。
    //(或者使用AddMemoryFont,如果你有在内存中的字体,从数据库中检索)。
    collection.AddFontFile(@E:\\下载\\ actest.ttf);
    使用(VAR G = Graphics.FromImage(BM))
    {
        //基于PrivateFontCollection字体系列之一创建字体实例
        字体F =新Font(co​​llection.Families.First(),16);
        g.DrawString(你好字体,F Brushes.White,50,50);
    }

干杯。

I need to use a custom fonts for drawing on my own application. Is it possible to install by deployment scripts?

解决方案

How to manage custom fonts in web application (system.drawing)

It should be possible to store your font files on disk or in database, and then use the PrivateFontCollection class to use the fonts at runtime.

Here is how you would use it:

    PrivateFontCollection collection = new PrivateFontCollection();
    // Add the custom font families. 
    // (Alternatively use AddMemoryFont if you have the font in memory, retrieved from a database).
    collection.AddFontFile(@"E:\Downloads\actest.ttf");
    using (var g = Graphics.FromImage(bm))
    {
        // Create a font instance based on one of the font families in the PrivateFontCollection
        Font f = new Font(collection.Families.First(), 16);
        g.DrawString("Hello fonts", f, Brushes.White, 50, 50);
    }

Cheers.

这篇关于如何安装在Windows Azure上的自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆