簡體   English   中英

Windows Phone IE中的連字符

[英]Hyphens in windows phone IE

在Windows Phone 8的IE中需要有連字符(或在7/8上都更好)。 我正在使用Web瀏覽器控件來顯示內容,並且正在嵌入一些CSS以使字體更漂亮。 看來IE的移動版本真的很流行! 例如p:first-child:first-letter不起作用hyphens:auto也不起作用。 有沒有變通方法來在頁邊距文本中添加連字符?

PS現在嘗試使用Hyphenator.js ,但是存在問題,因為找不到在Webbrowser控件中將本地腳本包含到頁面中的方法(即使用NavigateToString)。

您可以引用本地javascript文件,但需要先將其加載到獨立存儲中。

這樣可以將它們加載到本地存儲中。

var fileResourceStreamInfo = Application.GetResourceStream(new Uri("scripts/Hyphenator.js", UriKind.Relative));
if (fileResourceStreamInfo != null)
{
using (BinaryReader br = new BinaryReader(fileResourceStreamInfo.Stream))
{
    byte[] data = br.ReadBytes((int)fileResourceStreamInfo.Stream.Length);

    string strBaseDir = "scripts";

    if(!appStorage.DirectoryExists(strBaseDir))
    {
        //Debug.WriteLine("Creating Directory :: " + strBaseDir);
        appStorage.CreateDirectory(strBaseDir);
    }

    // This will truncate/overwrite an existing file, or 
    using (IsolatedStorageFileStream outFile = appStorage.OpenFile(AppRoot + "scripts/Hyphenator.js", FileMode.Create))
    {
        Debug.WriteLine("Writing data for " + AppRoot + "scripts/Hyphenator.js" + " and length = " + data.Length);
        using (var writer = new BinaryWriter(outFile))
        {
            writer.Write(data);
        }
    }
}

}

然后,您可以像這樣引用它們:

<script type="text/javascript" src="scripts/Hyphenator.js"></script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM