如何在Web应用程序中嵌入hindi字体并支持所有浏览器 [英] how to embeded hindi font in web application and support to all Browsers

查看:69
本文介绍了如何在Web应用程序中嵌入hindi字体并支持所有浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我是新来的并且在pvt公司工作,它拥有来自UP政府组织的最大客户,所以他们要求申请是bialinguals(英语和印地语)并支持所有浏览器中的印地语字体我使用了文化(和Font Kruti Dev 10)。它仅适用于IE8以及IE9或其他浏览器不支持的Internet Explorer浏览器。

这里使用全球资源和印地语和英语主题

如何解决这个问题?

我也想要嵌入应用程序中的字体??

我在这个类型的每个网页中使用我的基础文化代码-----



< pre lang =cs> public class BasePage:System.Web.UI.Page
{
public const string LanguageDropDownID = ctl00 $ ddlLanguage;
public const string PostBackEventTarget = __ EVENTTARGET;
public static CultureInfo Culture;
public static DateTimeStyles Style;
public BasePage()
{


if (DateTime.Now < DateTime.Parse( 01-Jan-14 11:59:59 PM)&& DateTime.Now > DateTime.Parse( 01-Jan-01 12:00:00 AM))
{
Culture = CultureInfo.CreateSpecificCulture( en-GB);
Style = DateTimeStyles.None;
}
else
throw 例外( 您的许可期限到期请提交您的到期付款并为您的服务提供支持!);

// Culture = CultureInfo.CreateSpecificCulture(en-GB);
// Style = DateTimeStyles.None;
}
受保护 覆盖 void InitializeCulture()
{
/// < 备注 > < 备注 >
/// 检查PostBack是否发生。由于此属性尚未设置,因此无法在此方法中使用IsPostBack
///
/// < /备注 >
if (Request [PostBackEventTarget]!= null
{
string controlID = Request [PostBackEventTarget];

if (controlID.Equals(LanguageDropDownID)|| controlID.Equals( ddlLanguage))
{
会话[ LanguageChanged] = true ;
string selectedValue =
Request.Form [Request [PostBackEventTarget]]。ToString();

switch (selectedValue)
{
case 1:SetCulture( < span class =code-string> en-GB
en-GB);
break ;
case 2 :SetCulture( hi-IN hi-IN);
break ;
默认 break ;
}
}
else
会话[ LanguageChanged] = false ;
}
else if (会话[ MyUICulture] == null
{
SetCulture( hi-IN hi-IN);
会话[ LanguageChanged] = false ;
}
else
SetCulture(会话[ MyUICulture]。ToString(),Session [ MyUICulture]的ToString());

/// < 备注 >
/// 如果控件转移到
//从会话中获取文化/ 同一应用程序中的新页面。
/// < /备注 >
if (会话[ MyUICulture]!= null && Session [ MyCulture]!= null
{
Thread.CurrentThread.CurrentUICulture =(CultureInfo)会话[ < span class =code-string> MyUICulture
];
Thread.CurrentThread.CurrentCulture =(CultureInfo)会话[ MyCulture];
}
base .InitializeCulture();
}
受保护 void SetCulture( string name, string locale)
{
Thread.CurrentThread.CurrentUICulture = CultureInfo(名称);
Thread.CurrentThread.CurrentCulture = new CultureInfo(locale);
/// < 备注 >
/// 保存用户在会话中设置的当前线程的文化
/// ,以便可以在当前应用程序的各个页面中使用它。
/// < /备注 >
会话[ MyUICulture] = Thread.CurrentThread.CurrentUICulture;
会话[ MyCulture] = Thread.CurrentThread.CurrentCulture;

}
受保护 void Page_PreInit( Object sender,EventArgs e)
{
if (Session [ MyUICulture]!= null
{
if (会话[ MyCulture ] .ToString()== hi-IN
this .Page.Theme = 印地语;
else
this .Page.Theme = 英文;
}
其他
.Page.Theme = 印地语;
}

}









请逐步解决....

解决方案

ddlLanguage;
public const string PostBackEventTarget = __ EVENTTARGET;
public static CultureInfo Culture;
public static DateTimeStyles样式;
public BasePage()
{


if (DateTime。现在< DateTime.Parse( 01-Jan- 14 11:59:59 PM)&& DateTime.Now > DateTime.Parse( 01-Jan-01 12:00:00 AM))
{
Culture = CultureInfo.CreateSpecificCulture( en-GB);
Style = DateTimeStyles.None;
}
else
throw 例外( 您的许可期限到期请提交您的到期付款并为您的服务提供支持!);

// Culture = CultureInfo.CreateSpecificCulture(en-GB);
// Style = DateTimeStyles.None;
}
受保护 覆盖 void InitializeCulture()
{
/// < 备注 > < 备注 >
/// 检查PostBack是否发生。由于此属性尚未设置,因此无法在此方法中使用IsPostBack
///
/// < /备注 >
if (Request [PostBackEventTarget]!= null
{
string controlID = Request [PostBackEventTarget];

if (controlID.Equals(LanguageDropDownID)|| controlID.Equals( ddlLanguage))
{
会话[ LanguageChanged] = true ;
string selectedValue =
Request.Form [Request [PostBackEventTarget]]。ToString();

switch (selectedValue)
{
case 1:SetCulture( < span class =code-string> en-GB
en-GB);
break ;
case 2 :SetCulture( hi-IN hi-IN);
break ;
默认 break ;
}
}
else
会话[ LanguageChanged] = false ;
}
else if (会话[ MyUICulture] == null
{
SetCulture( hi-IN hi-IN);
会话[ LanguageChanged] = false ;
}
else
SetCulture(会话[ MyUICulture]。ToString(),Session [ MyUICulture]的ToString());

/// < 备注 >
/// 如果控件转移到
//从会话中获取文化/ 同一应用程序中的新页面。
/// < /备注 >
if (会话[ MyUICulture]!= null && Session [ MyCulture]!= null
{
Thread.CurrentThread.CurrentUICulture =(CultureInfo)会话[ < span class =code-string> MyUICulture
];
Thread.CurrentThread.CurrentCulture =(CultureInfo)会话[ MyCulture];
}
base .InitializeCulture();
}
受保护 void SetCulture( string name, string locale)
{
Thread.CurrentThread.CurrentUICulture = CultureInfo(名称);
Thread.CurrentThread.CurrentCulture = new CultureInfo(locale);
/// < 备注 >
/// 保存用户在会话中设置的当前线程的文化
/// ,以便可以在当前应用程序的各个页面中使用它。
/// < /备注 >
会话[ MyUICulture] = Thread.CurrentThread.CurrentUICulture;
会话[ MyCulture] = Thread.CurrentThread.CurrentCulture;

}
受保护 void Page_PreInit( Object sender,EventArgs e)
{
if (Session [ MyUICulture]!= null
{
if (会话[ MyCulture ] .ToString()== hi-IN
this .Page.Theme = 印地语;
else
this .Page.Theme = 英文;
}
其他
.Page.Theme = 印地语;
}

}









请逐步解决....


Dear Concerned,

I am new and working in pvt company which have maximum Client from UP goverment organisations so they require the application are bialinguals(English and Hindi) and support to Hindi font in all Browser i was used culture (and Font Kruti Dev 10) for it. It 's work only Internet Explorer Browser upto IE8 and after IE9 or other browsers are not supported.
And here used the Global resoures and Themes in Hindi and English
How Can i resolve this problem ??
and Also I want to embedded font in application ??
My code for culture in Base pase are used in every web page this type -----

public class BasePage : System.Web.UI.Page
{
    public const string LanguageDropDownID = "ctl00$ddlLanguage";
    public const string PostBackEventTarget = "__EVENTTARGET";
    public static CultureInfo Culture;
    public static DateTimeStyles Style;
    public BasePage()
    {


        if (DateTime.Now < DateTime.Parse("01-Jan-14 11:59:59 PM") && DateTime.Now > DateTime.Parse("01-Jan-01 12:00:00 AM"))
        {
            Culture = CultureInfo.CreateSpecificCulture("en-GB");
            Style = DateTimeStyles.None;
        }
        else
            throw new Exception("Your Licence Period is expire please Submited your due payment & Conntinue your Services !");

       // Culture = CultureInfo.CreateSpecificCulture("en-GB");
        //Style = DateTimeStyles.None;
    }
    protected override void InitializeCulture()
    {
        ///<remarks><REMARKS>
        ///Check if PostBack occured. Cannot use IsPostBack in this method
        ///as this property is not set yet.
        ///</remarks>
        if (Request[PostBackEventTarget] != null)
        {
            string controlID = Request[PostBackEventTarget];

            if (controlID.Equals(LanguageDropDownID) || controlID.Equals("ddlLanguage"))
            {
                Session["LanguageChanged"] = true;
                string selectedValue =
                       Request.Form[Request[PostBackEventTarget]].ToString();

                switch (selectedValue)
                {
                    case "1": SetCulture("en-GB", "en-GB");
                        break;
                    case "2": SetCulture("hi-IN", "hi-IN");
                        break;
                    default: break;
                }
            }
            else
                Session["LanguageChanged"] = false;
        }
        else if (Session["MyUICulture"] == null)
        {
            SetCulture("hi-IN", "hi-IN");
            Session["LanguageChanged"] = false;
        }
        else
            SetCulture(Session["MyUICulture"].ToString(), Session["MyUICulture"].ToString());

        ///<remarks>
        ///Get the culture from the session if the control is tranferred to a
        ///new page in the same application.
        ///</remarks>
        if (Session["MyUICulture"] != null && Session["MyCulture"] != null)
        {
            Thread.CurrentThread.CurrentUICulture = (CultureInfo)Session["MyUICulture"];
            Thread.CurrentThread.CurrentCulture = (CultureInfo)Session["MyCulture"];
        }
        base.InitializeCulture();
    }
    protected void SetCulture(string name, string locale)
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(name);
        Thread.CurrentThread.CurrentCulture = new CultureInfo(locale);
        ///<remarks>
        ///Saving the current thread's culture set by the User in the Session
        ///so that it can be used across the pages in the current application.
        ///</remarks>
        Session["MyUICulture"] = Thread.CurrentThread.CurrentUICulture;
        Session["MyCulture"] = Thread.CurrentThread.CurrentCulture;

    }
    protected void Page_PreInit(Object sender, EventArgs e)
    {
        if (Session["MyUICulture"] != null)
        {
            if (Session["MyCulture"].ToString() == "hi-IN")
                this.Page.Theme = "Hindi";
            else
                this.Page.Theme = "English";
        }
        else
            this.Page.Theme = "Hindi";
    }

}





Please Resolved Step by Steps....

解决方案

ddlLanguage"; public const string PostBackEventTarget = "__EVENTTARGET"; public static CultureInfo Culture; public static DateTimeStyles Style; public BasePage() { if (DateTime.Now < DateTime.Parse("01-Jan-14 11:59:59 PM") && DateTime.Now > DateTime.Parse("01-Jan-01 12:00:00 AM")) { Culture = CultureInfo.CreateSpecificCulture("en-GB"); Style = DateTimeStyles.None; } else throw new Exception("Your Licence Period is expire please Submited your due payment & Conntinue your Services !"); // Culture = CultureInfo.CreateSpecificCulture("en-GB"); //Style = DateTimeStyles.None; } protected override void InitializeCulture() { ///<remarks><REMARKS> ///Check if PostBack occured. Cannot use IsPostBack in this method ///as this property is not set yet. ///</remarks> if (Request[PostBackEventTarget] != null) { string controlID = Request[PostBackEventTarget]; if (controlID.Equals(LanguageDropDownID) || controlID.Equals("ddlLanguage")) { Session["LanguageChanged"] = true; string selectedValue = Request.Form[Request[PostBackEventTarget]].ToString(); switch (selectedValue) { case "1": SetCulture("en-GB", "en-GB"); break; case "2": SetCulture("hi-IN", "hi-IN"); break; default: break; } } else Session["LanguageChanged"] = false; } else if (Session["MyUICulture"] == null) { SetCulture("hi-IN", "hi-IN"); Session["LanguageChanged"] = false; } else SetCulture(Session["MyUICulture"].ToString(), Session["MyUICulture"].ToString()); ///<remarks> ///Get the culture from the session if the control is tranferred to a ///new page in the same application. ///</remarks> if (Session["MyUICulture"] != null && Session["MyCulture"] != null) { Thread.CurrentThread.CurrentUICulture = (CultureInfo)Session["MyUICulture"]; Thread.CurrentThread.CurrentCulture = (CultureInfo)Session["MyCulture"]; } base.InitializeCulture(); } protected void SetCulture(string name, string locale) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(name); Thread.CurrentThread.CurrentCulture = new CultureInfo(locale); ///<remarks> ///Saving the current thread's culture set by the User in the Session ///so that it can be used across the pages in the current application. ///</remarks> Session["MyUICulture"] = Thread.CurrentThread.CurrentUICulture; Session["MyCulture"] = Thread.CurrentThread.CurrentCulture; } protected void Page_PreInit(Object sender, EventArgs e) { if (Session["MyUICulture"] != null) { if (Session["MyCulture"].ToString() == "hi-IN") this.Page.Theme = "Hindi"; else this.Page.Theme = "English"; } else this.Page.Theme = "Hindi"; } }





Please Resolved Step by Steps....


这篇关于如何在Web应用程序中嵌入hindi字体并支持所有浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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